diff --git a/gradlew b/gradlew old mode 100755 new mode 100644 diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/account/AccountPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/account/AccountPlugin.java deleted file mode 100644 index de6222c38f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/account/AccountPlugin.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2017, 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.account; - -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.client.account.AccountSession; -import net.runelite.client.account.SessionManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.SessionOpen; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; - -@PluginDescriptor( - name = "Account", - description = "Sync RuneLite config settings with your Google account", - tags = {"external", "google", "integration"}, - loadWhenOutdated = true, - hidden = true -) -@Slf4j -@Singleton -public class AccountPlugin extends Plugin -{ - @Inject - private SessionManager sessionManager; - - @Subscribe - private void onSessionOpen(SessionOpen sessionOpen) - { - AccountSession session = sessionManager.getAccountSession(); - - if (session.getUsername() == null) - { - return; // No username yet - } - - log.debug("Session opened as {}", session.getUsername()); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/CombatLevelRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/CombatLevelRequirement.java deleted file mode 100644 index 1a16de26f4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/CombatLevelRequirement.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2019 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.achievementdiary; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@RequiredArgsConstructor -@Getter(AccessLevel.PACKAGE) -public class CombatLevelRequirement implements Requirement -{ - private final int level; - - @Override - public String toString() - { - return level + " " + "Combat"; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/DiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/DiaryRequirement.java deleted file mode 100644 index bf583c27b9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/DiaryRequirement.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2018, Marshall - * Copyright (c) 2018, 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.achievementdiary; - -import com.google.common.collect.ImmutableList; -import java.util.List; -import lombok.AccessLevel; -import lombok.Getter; - -@Getter(AccessLevel.PACKAGE) -class DiaryRequirement -{ - private final String task; - private final List requirements; - - DiaryRequirement(String task, Requirement[] requirements) - { - this.task = task; - this.requirements = ImmutableList.copyOf(requirements); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/DiaryRequirementsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/DiaryRequirementsPlugin.java deleted file mode 100644 index 531a655d9b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/DiaryRequirementsPlugin.java +++ /dev/null @@ -1,336 +0,0 @@ -/* - * Copyright (c) 2018, Marshall - * Copyright (c) 2018, 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.achievementdiary; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.regex.Pattern; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.FontTypeFace; -import net.runelite.api.QuestState; -import net.runelite.api.ScriptID; -import net.runelite.api.VarPlayer; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.achievementdiary.diaries.ArdougneDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.diaries.DesertDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.diaries.FaladorDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.diaries.FremennikDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.diaries.KandarinDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.diaries.KaramjaDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.diaries.KourendDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.diaries.LumbridgeDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.diaries.MorytaniaDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.diaries.VarrockDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.diaries.WesternDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.diaries.WildernessDiaryRequirement; - -@Slf4j -@PluginDescriptor( - name = "Diary Requirements", - description = "Display level requirements in Achievement Diary interface", - tags = {"achievements", "tasks"}, - type = PluginType.UTILITY -) -@Singleton -public class DiaryRequirementsPlugin extends Plugin -{ - private static final String AND_JOINER = ", "; - private static final Pattern AND_JOINER_PATTERN = Pattern.compile("(?<=, )"); - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Subscribe - private void onWidgetLoaded(final WidgetLoaded event) - { - if (event.getGroupId() == WidgetID.DIARY_QUEST_GROUP_ID) - { - String widgetTitle = Text.removeTags( - client.getWidget( - WidgetInfo.DIARY_QUEST_WIDGET_TITLE) - .getText()) - .replace(' ', '_') - .toUpperCase(); - if (widgetTitle.startsWith("ACHIEVEMENT_DIARY")) - { - showDiaryRequirements(); - } - } - } - - private void showDiaryRequirements() - { - Widget widget = client.getWidget(WidgetInfo.DIARY_QUEST_WIDGET_TEXT); - Widget[] children = widget.getStaticChildren(); - - Widget titleWidget = children[0]; - if (titleWidget == null) - { - return; - } - - FontTypeFace font = titleWidget.getFont(); - int maxWidth = titleWidget.getWidth(); - - List originalAchievements = getOriginalAchievements(children); - - // new requirements starts out as a copy of the original - List newRequirements = new ArrayList<>(originalAchievements); - - GenericDiaryRequirement requirements = getRequirementsForTitle(titleWidget.getText()); - if (requirements == null) - { - log.debug("Unknown achievement diary {}", titleWidget.getText()); - return; - } - - Map skillRequirements = buildRequirements(requirements.getRequirements()); - - int offset = 0; - String taskBuffer = ""; - for (int i = 0; i < originalAchievements.size(); i++) - { - String rowText = Text.removeTags(originalAchievements.get(i)); - if (skillRequirements.get(taskBuffer + " " + rowText) != null) - { - taskBuffer = taskBuffer + " " + rowText; - } - else - { - taskBuffer = rowText; - } - - if (skillRequirements.get(taskBuffer) != null) - { - String levelRequirement = skillRequirements.get(taskBuffer); - String task = originalAchievements.get(i); - - int taskWidth = font.getTextWidth(task); - int ourWidth = font.getTextWidth(levelRequirement); - String strike = task.startsWith("") ? "" : ""; - - if (ourWidth + taskWidth < maxWidth) - { - // Merge onto 1 line - newRequirements.set(i + offset, task + levelRequirement); - } - else if (ourWidth < maxWidth) - { - // 2 line split - newRequirements.add(i + (++offset), strike + levelRequirement); - } - else - { - // Full text layout - StringBuilder b = new StringBuilder(); - b.append(task); - int runningWidth = font.getTextWidth(b.toString()); - for (String word : AND_JOINER_PATTERN.split(levelRequirement)) - { - int wordWidth = font.getTextWidth(word); - if (runningWidth == 0 || wordWidth + runningWidth < maxWidth) - { - runningWidth += wordWidth; - b.append(word); - } - else - { - newRequirements.add(i + (offset++), b.toString()); - b.delete(0, b.length()); - runningWidth = wordWidth; - b.append(strike); - b.append(word); - } - } - newRequirements.set(i + offset, b.toString()); - } - } - } - - int lastLine = 0; - for (int i = 0; i < newRequirements.size() && i < children.length; i++) - { - Widget achievementWidget = children[i]; - String text = newRequirements.get(i); - achievementWidget.setText(text); - if (text != null && !text.isEmpty()) - { - lastLine = i; - } - } - - int numLines = lastLine; - clientThread.invokeLater(() -> client.runScript(ScriptID.DIARY_QUEST_UPDATE_LINECOUNT, 1, numLines)); - } - - private List getOriginalAchievements(Widget[] children) - { - List preloadedRequirements = new ArrayList<>(children.length); - for (Widget requirementWidget : children) - { - preloadedRequirements.add(requirementWidget.getText()); - } - return preloadedRequirements; - } - - private GenericDiaryRequirement getRequirementsForTitle(String title) - { - String diaryName = Text.removeTags(title - .replaceAll(" ", "_") - .toUpperCase()); - - GenericDiaryRequirement diaryRequirementContainer; - switch (diaryName) - { - case "ARDOUGNE_AREA_TASKS": - diaryRequirementContainer = new ArdougneDiaryRequirement(); - break; - case "DESERT_TASKS": - diaryRequirementContainer = new DesertDiaryRequirement(); - break; - case "FALADOR_AREA_TASKS": - diaryRequirementContainer = new FaladorDiaryRequirement(); - break; - case "FREMENNIK_TASKS": - diaryRequirementContainer = new FremennikDiaryRequirement(); - break; - case "KANDARIN_TASKS": - diaryRequirementContainer = new KandarinDiaryRequirement(); - break; - case "KARAMJA_AREA_TASKS": - diaryRequirementContainer = new KaramjaDiaryRequirement(); - break; - case "KOUREND_&_KEBOS_TASKS": - diaryRequirementContainer = new KourendDiaryRequirement(); - break; - case "LUMBRIDGE_&_DRAYNOR_TASKS": - diaryRequirementContainer = new LumbridgeDiaryRequirement(); - break; - case "MORYTANIA_TASKS": - diaryRequirementContainer = new MorytaniaDiaryRequirement(); - break; - case "VARROCK_TASKS": - diaryRequirementContainer = new VarrockDiaryRequirement(); - break; - case "WESTERN_AREA_TASKS": - diaryRequirementContainer = new WesternDiaryRequirement(); - break; - case "WILDERNESS_AREA_TASKS": - diaryRequirementContainer = new WildernessDiaryRequirement(); - break; - default: - return null; - } - return diaryRequirementContainer; - } - - // returns a map of task -> level requirements - private Map buildRequirements(Collection requirements) - { - Map reqs = new HashMap<>(); - for (DiaryRequirement req : requirements) - { - StringBuilder b = new StringBuilder(); - b.append("("); - - assert !req.getRequirements().isEmpty(); - for (Requirement ireq : req.getRequirements()) - { - boolean satifisfied = satisfiesRequirement(ireq); - b.append(satifisfied ? "" : ""); - b.append(ireq.toString()); - b.append(satifisfied ? "" : ""); - b.append(AND_JOINER); - } - - b.delete(b.length() - AND_JOINER.length(), b.length()); - - b.append(")"); - - reqs.put(req.getTask(), b.toString()); - } - return reqs; - } - - private boolean satisfiesRequirement(Requirement r) - { - if (r instanceof OrRequirement) - { - return ((OrRequirement) r).getRequirements() - .stream() - .anyMatch(this::satisfiesRequirement); - } - if (r instanceof SkillRequirement) - { - SkillRequirement s = (SkillRequirement) r; - return client.getRealSkillLevel(s.getSkill()) >= s.getLevel(); - } - if (r instanceof CombatLevelRequirement) - { - return client.getLocalPlayer().getCombatLevel() >= ((CombatLevelRequirement) r).getLevel(); - } - if (r instanceof QuestRequirement) - { - QuestRequirement q = (QuestRequirement) r; - QuestState state = q.getQuest().getState(client); - if (q.isStarted()) - { - return state != QuestState.NOT_STARTED; - } - return state == QuestState.FINISHED; - } - if (r instanceof QuestPointRequirement) - { - return client.getVar(VarPlayer.QUEST_POINTS) >= ((QuestPointRequirement) r).getQp(); - } - if (r instanceof FavourRequirement) - { - FavourRequirement f = (FavourRequirement) r; - int realFavour = client.getVar(f.getHouse().getVarbit()); - return (realFavour / 10) >= f.getPercent(); - } - log.warn("Unknown requirement {}", r); - return false; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/FavourRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/FavourRequirement.java deleted file mode 100644 index 035c032e23..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/FavourRequirement.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2019 William - * 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.achievementdiary; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.api.Favour; - -@RequiredArgsConstructor -@Getter(AccessLevel.PACKAGE) -public class FavourRequirement implements Requirement -{ - private final Favour house; - private final int percent; - - @Override - public String toString() - { - return percent + "% " + house.getName() + " favour"; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/GenericDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/GenericDiaryRequirement.java deleted file mode 100644 index f34d2ac505..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/GenericDiaryRequirement.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2018, Marshall - * Copyright (c) 2018, 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.achievementdiary; - -import java.util.HashSet; -import java.util.Set; -import lombok.AccessLevel; -import lombok.Getter; - -public abstract class GenericDiaryRequirement -{ - @Getter(AccessLevel.PACKAGE) - private Set requirements = new HashSet<>(); - - protected void add(String task, Requirement... requirements) - { - DiaryRequirement diaryRequirement = new DiaryRequirement(task, requirements); - this.requirements.add(diaryRequirement); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/OrRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/OrRequirement.java deleted file mode 100644 index 9270b5203b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/OrRequirement.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2019 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.achievementdiary; - -import com.google.common.base.Joiner; -import com.google.common.collect.ImmutableList; -import java.util.List; -import lombok.AccessLevel; -import lombok.Getter; - -public class OrRequirement implements Requirement -{ - @Getter(AccessLevel.PACKAGE) - private final List requirements; - - public OrRequirement(Requirement... reqs) - { - this.requirements = ImmutableList.copyOf(reqs); - } - - @Override - public String toString() - { - return Joiner.on(" or ").join(requirements); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/QuestPointRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/QuestPointRequirement.java deleted file mode 100644 index b8917067db..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/QuestPointRequirement.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2019 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.achievementdiary; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@RequiredArgsConstructor -@Getter(AccessLevel.PACKAGE) -public class QuestPointRequirement implements Requirement -{ - private final int qp; - - @Override - public String toString() - { - return qp + " " + "Quest points"; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/QuestRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/QuestRequirement.java deleted file mode 100644 index 2781e55f03..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/QuestRequirement.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2019 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.achievementdiary; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.api.Quest; - -@Getter(AccessLevel.PACKAGE) -@RequiredArgsConstructor -public class QuestRequirement implements Requirement -{ - private final Quest quest; - private final boolean started; - - public QuestRequirement(Quest quest) - { - this(quest, false); - } - - @Override - public String toString() - { - if (started) - { - return "Started " + quest.getName(); - } - - return quest.getName(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/Requirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/Requirement.java deleted file mode 100644 index cddf78e866..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/Requirement.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2019 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.achievementdiary; - -public interface Requirement {} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/SkillRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/SkillRequirement.java deleted file mode 100644 index 1f331a9aee..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/SkillRequirement.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2019 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.achievementdiary; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.api.Skill; - -@RequiredArgsConstructor -@Getter(AccessLevel.PACKAGE) -public class SkillRequirement implements Requirement -{ - private final Skill skill; - private final int level; - - @Override - public String toString() - { - return level + " " + skill.getName(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/ArdougneDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/ArdougneDiaryRequirement.java deleted file mode 100644 index e519510885..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/ArdougneDiaryRequirement.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2018, Marshall - * Copyright (c) 2018, 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.achievementdiary.diaries; - -import net.runelite.api.Quest; -import net.runelite.api.Skill; -import net.runelite.client.plugins.achievementdiary.GenericDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.QuestRequirement; -import net.runelite.client.plugins.achievementdiary.SkillRequirement; - -public class ArdougneDiaryRequirement extends GenericDiaryRequirement -{ - public ArdougneDiaryRequirement() - { - // EASY - add("Have Wizard Cromperty teleport you to the Rune Essence mine.", - new QuestRequirement(Quest.RUNE_MYSTERIES)); - add("Steal a cake from the Ardougne market stalls.", - new SkillRequirement(Skill.THIEVING, 5)); - add("Enter the Combat Training Camp north of W. Ardougne.", - new QuestRequirement(Quest.BIOHAZARD)); - add("Go out fishing on the Fishing Trawler.", - new SkillRequirement(Skill.FISHING, 15)); - - // MEDIUM - add("Enter the Unicorn pen in Ardougne zoo using Fairy rings.", - new QuestRequirement(Quest.FAIRYTALE_II__CURE_A_QUEEN, true)); - add("Grapple over Yanille's south wall.", - new SkillRequirement(Skill.AGILITY, 39), - new SkillRequirement(Skill.STRENGTH, 38), - new SkillRequirement(Skill.RANGED, 21)); - add("Harvest some strawberries from the Ardougne farming patch.", - new SkillRequirement(Skill.FARMING, 31)); - add("Cast the Ardougne Teleport spell.", - new SkillRequirement(Skill.MAGIC, 51), - new QuestRequirement(Quest.PLAGUE_CITY)); - add("Travel to Castlewars by Hot Air Balloon.", - new SkillRequirement(Skill.FIREMAKING, 50), - new QuestRequirement(Quest.ENLIGHTENED_JOURNEY)); - add("Claim buckets of sand from Bert in Yanille.", - new SkillRequirement(Skill.CRAFTING, 49), - new QuestRequirement(Quest.THE_HAND_IN_THE_SAND)); - add("Catch any fish on the Fishing Platform.", - new QuestRequirement(Quest.SEA_SLUG, true)); - add("Pickpocket the master farmer north of Ardougne.", - new SkillRequirement(Skill.THIEVING, 38)); - add("Collect some Nightshade from the Skavid Caves.", - new QuestRequirement(Quest.WATCHTOWER, true)); - add("Kill a swordchick in the Tower of Life.", - new QuestRequirement(Quest.TOWER_OF_LIFE)); - add("Equip Iban's upgraded staff or upgrade an Iban staff.", - new SkillRequirement(Skill.MAGIC, 50), - new SkillRequirement(Skill.ATTACK, 50), - new QuestRequirement(Quest.UNDERGROUND_PASS)); - add("Visit the Island East of the Necromancer's tower.", - new QuestRequirement(Quest.FAIRYTALE_II__CURE_A_QUEEN, true)); - - // HARD - // When the task is completed "the Totem" changes to "Totem" - so we add - // both variations. - add("Recharge some Jewellery at the Totem in the Legends Guild.", - new QuestRequirement(Quest.LEGENDS_QUEST)); - add("Recharge some Jewellery at Totem in the Legends Guild.", - new QuestRequirement(Quest.LEGENDS_QUEST)); - add("Enter the Magic Guild.", - new SkillRequirement(Skill.MAGIC, 66)); - add("Attempt to steal from King Lathas' chest.", - new SkillRequirement(Skill.THIEVING, 72)); - add("Have a zookeeper put you in Ardougne Zoo's monkey cage.", - new QuestRequirement(Quest.MONKEY_MADNESS_I, true)); - add("Teleport to the Watchtower.", - new SkillRequirement(Skill.MAGIC, 58), - new QuestRequirement(Quest.WATCHTOWER)); - add("Catch a Red Salamander.", - new SkillRequirement(Skill.HUNTER, 59)); - add("Check the health of a Palm tree near tree gnome village.", - new SkillRequirement(Skill.FARMING, 68)); - add("Pick some Poison Ivy berries from the patch south of Ardougne.", - new SkillRequirement(Skill.FARMING, 70)); - add("Smith a Mithril platebody near Ardougne.", - new SkillRequirement(Skill.SMITHING, 68)); - add("Enter your POH from Yanille.", - new SkillRequirement(Skill.CONSTRUCTION, 50)); - add("Smith a Dragon sq shield in West Ardougne.", - new SkillRequirement(Skill.SMITHING, 60), - new QuestRequirement(Quest.LEGENDS_QUEST)); - add("Craft some Death runes.", - new SkillRequirement(Skill.RUNECRAFT, 65), - new QuestRequirement(Quest.MOURNINGS_END_PART_II)); - - // ELITE - add("Catch a Manta ray in the Fishing Trawler and cook it in Port Khazard.", - new SkillRequirement(Skill.FISHING, 81), - new SkillRequirement(Skill.COOKING, 91) - ); - add("Attempt to picklock the door to the basement of Yanille Agility Dungeon.", - new SkillRequirement(Skill.THIEVING, 82)); - add("Pickpocket a Hero.", - new SkillRequirement(Skill.THIEVING, 80)); - add("Make a rune crossbow yourself from scratch within Witchaven or Yanille.", - new SkillRequirement(Skill.CRAFTING, 10), - new SkillRequirement(Skill.SMITHING, 91), - new SkillRequirement(Skill.FLETCHING, 69)); - add("Imbue a salve amulet at Nightmare Zone or equip an imbued salve amulet.", - new QuestRequirement(Quest.HAUNTED_MINE)); - add("Pick some Torstol from the patch north of Ardougne.", - new SkillRequirement(Skill.FARMING, 85)); - add("Complete a lap of Ardougne's rooftop agility course.", - new SkillRequirement(Skill.AGILITY, 90)); - add("Cast Ice Barrage on another player within Castlewars.", - new SkillRequirement(Skill.MAGIC, 94), - new QuestRequirement(Quest.DESERT_TREASURE)); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/DesertDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/DesertDiaryRequirement.java deleted file mode 100644 index 4de2c0a4d3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/DesertDiaryRequirement.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2018, Marshall - * Copyright (c) 2018, 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.achievementdiary.diaries; - -import net.runelite.api.Quest; -import net.runelite.api.Skill; -import net.runelite.client.plugins.achievementdiary.GenericDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.QuestRequirement; -import net.runelite.client.plugins.achievementdiary.SkillRequirement; - -public class DesertDiaryRequirement extends GenericDiaryRequirement -{ - public DesertDiaryRequirement() - { - // EASY - add("Catch a Golden Warbler.", - new SkillRequirement(Skill.HUNTER, 5)); - add("Mine 5 clay in the north-eastern desert.", - new SkillRequirement(Skill.MINING, 5)); - add("Open the Sarcophagus in the first room of Pyramid Plunder.", - new SkillRequirement(Skill.THIEVING, 21), - new QuestRequirement(Quest.ICTHLARINS_LITTLE_HELPER, true)); - - // MEDIUM - add("Climb to the summit of the Agility Pyramid.", - new SkillRequirement(Skill.AGILITY, 30)); - add("Slay a desert lizard.", - new SkillRequirement(Skill.SLAYER, 22)); - add("Catch an Orange Salamander.", - new SkillRequirement(Skill.HUNTER, 47)); - add("Steal a feather from the Desert Phoenix.", - new SkillRequirement(Skill.THIEVING, 25)); - add("Travel to Uzer via Magic Carpet.", - new QuestRequirement(Quest.THE_GOLEM)); - add("Travel to the Desert via Eagle.", - new QuestRequirement(Quest.EAGLES_PEAK)); - add("Pray at the Elidinis statuette in Nardah.", - new QuestRequirement(Quest.SPIRITS_OF_THE_ELID)); - add("Create a combat potion in the desert.", - new SkillRequirement(Skill.HERBLORE, 36)); - add("Teleport to Enakhra's Temple with the Camulet.", - new QuestRequirement(Quest.ENAKHRAS_LAMENT)); - add("Visit the Genie.", - new QuestRequirement(Quest.SPIRITS_OF_THE_ELID)); - add("Teleport to Pollnivneach with a redirected teleport to house tablet.", - new SkillRequirement(Skill.CONSTRUCTION, 20)); - add("Chop some Teak logs near Uzer.", - new SkillRequirement(Skill.WOODCUTTING, 35)); - - // HARD - add("Knock out and pickpocket a Menaphite Thug.", - new SkillRequirement(Skill.THIEVING, 65), - new QuestRequirement(Quest.THE_FEUD)); - add("Mine some Granite.", - new SkillRequirement(Skill.MINING, 45)); - add("Refill your waterskins in the Desert using Lunar magic.", - new SkillRequirement(Skill.MAGIC, 68), - new QuestRequirement(Quest.DREAM_MENTOR)); - add("Complete a lap of the Pollnivneach agility course.", - new SkillRequirement(Skill.AGILITY, 70)); - add("Slay a Dust Devil with a Slayer helmet equipped.", - new SkillRequirement(Skill.SLAYER, 65), - new SkillRequirement(Skill.DEFENCE, 10), - new SkillRequirement(Skill.CRAFTING, 55), - new QuestRequirement(Quest.DESERT_TREASURE, true)); - add("Activate Ancient Magicks at the altar in the Jaldraocht Pyramid.", - new QuestRequirement(Quest.DESERT_TREASURE)); - add("Defeat a Locust Rider with Keris.", - new SkillRequirement(Skill.ATTACK, 50), - new QuestRequirement(Quest.CONTACT)); - add("Burn some yew logs on the Nardah Mayor's balcony.", - new SkillRequirement(Skill.FIREMAKING, 60)); - add("Create a Mithril Platebody in Nardah.", - new SkillRequirement(Skill.SMITHING, 68)); - - // ELITE - add("Bake a wild pie at the Nardah Clay Oven.", - new SkillRequirement(Skill.COOKING, 85)); - add("Cast Ice Barrage against a foe in the Desert.", - new SkillRequirement(Skill.MAGIC, 94), - new QuestRequirement(Quest.DESERT_TREASURE)); - add("Fletch some Dragon darts at the Bedabin Camp.", - new SkillRequirement(Skill.FLETCHING, 95), - new QuestRequirement(Quest.THE_TOURIST_TRAP)); - add("Speak to the KQ head in your POH.", - new SkillRequirement(Skill.CONSTRUCTION, 78), - new QuestRequirement(Quest.PRIEST_IN_PERIL)); - add("Steal from the Grand Gold Chest in the final room of Pyramid Plunder.", - new SkillRequirement(Skill.THIEVING, 91), - new QuestRequirement(Quest.ICTHLARINS_LITTLE_HELPER, true)); - add("Restore at least 85 Prayer points when praying at the Altar in Sophanem.", - new SkillRequirement(Skill.PRAYER, 85), - new QuestRequirement(Quest.ICTHLARINS_LITTLE_HELPER, true)); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/FaladorDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/FaladorDiaryRequirement.java deleted file mode 100644 index 30f7843199..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/FaladorDiaryRequirement.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2018, Marshall - * Copyright (c) 2018, 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.achievementdiary.diaries; - -import net.runelite.api.Quest; -import net.runelite.api.Skill; -import net.runelite.client.plugins.achievementdiary.GenericDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.QuestRequirement; -import net.runelite.client.plugins.achievementdiary.SkillRequirement; - -public class FaladorDiaryRequirement extends GenericDiaryRequirement -{ - public FaladorDiaryRequirement() - { - // EASY - add("Find out what your family crest is from Sir Renitee.", - new SkillRequirement(Skill.CONSTRUCTION, 16)); - add("Climb over the western Falador wall.", - new SkillRequirement(Skill.AGILITY, 5)); - add("Make a mind tiara.", - new QuestRequirement(Quest.RUNE_MYSTERIES)); - add("Smith some Blurite Limbs on Doric's Anvil.", - new SkillRequirement(Skill.MINING, 10), - new SkillRequirement(Skill.SMITHING, 13), - new QuestRequirement(Quest.THE_KNIGHTS_SWORD), - new QuestRequirement(Quest.DORICS_QUEST)); - - // MEDIUM - add("Light a Bullseye lantern at the Chemist's in Rimmington.", - new SkillRequirement(Skill.FIREMAKING, 49)); - add("Telegrab some Wine of Zamorak at the Chaos Temple by the Wilderness.", - new SkillRequirement(Skill.MAGIC, 33)); - add("Place a Scarecrow in the Falador farming patch.", - new SkillRequirement(Skill.FARMING, 23)); - add("Kill a Mogre at Mudskipper Point.", - new SkillRequirement(Skill.SLAYER, 32), - new QuestRequirement(Quest.SKIPPY_AND_THE_MOGRES)); - add("Visit the Port Sarim Rat Pits.", - new QuestRequirement(Quest.RATCATCHERS, true)); - add("Grapple up and then jump off the north Falador wall.", - new SkillRequirement(Skill.AGILITY, 11), - new SkillRequirement(Skill.STRENGTH, 37), - new SkillRequirement(Skill.RANGED, 19)); - add("Pickpocket a Falador guard.", - new SkillRequirement(Skill.THIEVING, 40)); - add("Pray at the Altar of Guthix in Taverley whilst wearing full Initiate.", - new SkillRequirement(Skill.PRAYER, 10), - new SkillRequirement(Skill.DEFENCE, 20), - new QuestRequirement(Quest.RECRUITMENT_DRIVE)); - add("Mine some Gold ore at the Crafting Guild.", - new SkillRequirement(Skill.CRAFTING, 40), - new SkillRequirement(Skill.MINING, 40)); - add("Squeeze through the crevice in the Dwarven mines.", - new SkillRequirement(Skill.AGILITY, 42)); - add("Chop and burn some Willow logs in Taverley", - new SkillRequirement(Skill.WOODCUTTING, 30), - new SkillRequirement(Skill.FIREMAKING, 30)); - add("Craft a fruit basket on the Falador Farm loom.", - new SkillRequirement(Skill.CRAFTING, 36)); - add("Teleport to Falador.", - new SkillRequirement(Skill.MAGIC, 37)); - - // HARD - add("Craft 140 Mind runes simultaneously.", - new SkillRequirement(Skill.RUNECRAFT, 56)); - add("Change your family crest to the Saradomin symbol.", - new SkillRequirement(Skill.PRAYER, 70)); - add("Kill a Skeletal Wyvern in the Asgarnia Ice Dungeon.", - new SkillRequirement(Skill.SLAYER, 72)); - add("Complete a lap of the Falador rooftop agility course.", - new SkillRequirement(Skill.AGILITY, 50)); - add("Enter the mining guild wearing full prospector.", - new SkillRequirement(Skill.MINING, 60)); - add("Kill the Blue Dragon under the Heroes' Guild.", - new QuestRequirement(Quest.HEROES_QUEST)); - add("Crack a wall safe within Rogues Den.", - new SkillRequirement(Skill.THIEVING, 50)); - add("Recharge your prayer in the Port Sarim church while wearing full Proselyte.", - new SkillRequirement(Skill.DEFENCE, 30), - new QuestRequirement(Quest.THE_SLUG_MENACE)); - add("Equip a dwarven helmet within the dwarven mines.", - new SkillRequirement(Skill.DEFENCE, 50), - new QuestRequirement(Quest.GRIM_TALES)); - - // ELITE - add("Craft 252 Air Runes simultaneously.", - new SkillRequirement(Skill.RUNECRAFT, 88)); - add("Purchase a White 2h Sword from Sir Vyvin.", - new QuestRequirement(Quest.WANTED)); - add("Find at least 3 magic roots at once when digging up your magic tree in Falador.", - new SkillRequirement(Skill.FARMING, 91), - new SkillRequirement(Skill.WOODCUTTING, 75)); - add("Jump over the strange floor in Taverley dungeon.", - new SkillRequirement(Skill.AGILITY, 80)); - add("Mix a Saradomin brew in Falador east bank.", - new SkillRequirement(Skill.HERBLORE, 81)); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/FremennikDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/FremennikDiaryRequirement.java deleted file mode 100644 index 46c708efbb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/FremennikDiaryRequirement.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2018, Marshall - * Copyright (c) 2018, 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.achievementdiary.diaries; - -import net.runelite.api.Quest; -import net.runelite.api.Skill; -import net.runelite.client.plugins.achievementdiary.GenericDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.QuestRequirement; -import net.runelite.client.plugins.achievementdiary.SkillRequirement; - -public class FremennikDiaryRequirement extends GenericDiaryRequirement -{ - public FremennikDiaryRequirement() - { - // EASY - add("Catch a Cerulean twitch.", - new SkillRequirement(Skill.HUNTER, 11)); - add("Change your boots at Yrsa's Shoe Store.", - new QuestRequirement(Quest.THE_FREMENNIK_TRIALS)); - add("Craft a tiara from scratch in Rellekka.", - new SkillRequirement(Skill.CRAFTING, 23), - new SkillRequirement(Skill.MINING, 20), - new SkillRequirement(Skill.SMITHING, 20), - new QuestRequirement(Quest.THE_FREMENNIK_TRIALS)); - add("Browse the Stonemasons shop.", - new QuestRequirement(Quest.THE_GIANT_DWARF, true)); - add("Steal from the Keldagrim crafting or baker's stall.", - new SkillRequirement(Skill.THIEVING, 5), - new QuestRequirement(Quest.THE_GIANT_DWARF, true)); - add("Enter the Troll Stronghold.", - new QuestRequirement(Quest.DEATH_PLATEAU), - new QuestRequirement(Quest.TROLL_STRONGHOLD, true)); - add("Chop and burn some oak logs in the Fremennik Province.", - new SkillRequirement(Skill.WOODCUTTING, 15), - new SkillRequirement(Skill.FIREMAKING, 15)); - - // MEDIUM - add("Slay a Brine rat.", - new SkillRequirement(Skill.SLAYER, 47), - new QuestRequirement(Quest.OLAFS_QUEST, true)); - add("Travel to the Snowy Hunter Area via Eagle.", - new QuestRequirement(Quest.EAGLES_PEAK)); - add("Mine some coal in Rellekka.", - new SkillRequirement(Skill.MINING, 30), - new QuestRequirement(Quest.THE_FREMENNIK_TRIALS)); - add("Steal from the Rellekka Fish stalls.", - new SkillRequirement(Skill.THIEVING, 42), - new QuestRequirement(Quest.THE_FREMENNIK_TRIALS)); - add("Travel to Miscellania by Fairy ring.", - new QuestRequirement(Quest.THE_FREMENNIK_TRIALS), - new QuestRequirement(Quest.FAIRYTALE_II__CURE_A_QUEEN, true)); - add("Catch a Snowy knight.", - new SkillRequirement(Skill.HUNTER, 35)); - add("Pick up your Pet Rock from your POH Menagerie.", - new SkillRequirement(Skill.CONSTRUCTION, 37), - new QuestRequirement(Quest.THE_FREMENNIK_TRIALS)); - add("Visit the Lighthouse from Waterbirth island.", - new QuestRequirement(Quest.HORROR_FROM_THE_DEEP), - new QuestRequirement(Quest.THE_FREMENNIK_TRIALS, true)); - add("Mine some gold at the Arzinian mine.", - new SkillRequirement(Skill.MINING, 40), - new QuestRequirement(Quest.BETWEEN_A_ROCK, true)); - - // HARD - add("Teleport to Trollheim.", - new SkillRequirement(Skill.MAGIC, 61), - new QuestRequirement(Quest.EADGARS_RUSE)); - add("Catch a Sabre-toothed Kyatt.", - new SkillRequirement(Skill.HUNTER, 55)); - add("Mix a super defence potion in the Fremennik province.", - new SkillRequirement(Skill.HERBLORE, 66)); - add("Steal from the Keldagrim Gem Stall.", - new SkillRequirement(Skill.THIEVING, 75), - new QuestRequirement(Quest.THE_GIANT_DWARF, true)); - add("Craft a Fremennik shield on Neitiznot.", - new SkillRequirement(Skill.WOODCUTTING, 56), - new QuestRequirement(Quest.THE_FREMENNIK_ISLES)); - add("Mine 5 Adamantite ores on Jatizso.", - new SkillRequirement(Skill.MINING, 70), - new QuestRequirement(Quest.THE_FREMENNIK_ISLES)); - add("Obtain 100% support from your kingdom subjects.", - new QuestRequirement(Quest.THRONE_OF_MISCELLANIA)); - add("Teleport to Waterbirth Island.", - new SkillRequirement(Skill.MAGIC, 72), - new QuestRequirement(Quest.LUNAR_DIPLOMACY)); - add("Obtain the Blast Furnace Foreman's permission to use the Blast Furnace for free.", - new SkillRequirement(Skill.SMITHING, 60), - new QuestRequirement(Quest.THE_GIANT_DWARF, true)); - - // ELITE - add("Craft 56 astral runes at once.", - new SkillRequirement(Skill.RUNECRAFT, 82), - new QuestRequirement(Quest.LUNAR_DIPLOMACY)); - add("Create a dragonstone amulet in the Neitiznot furnace.", - new SkillRequirement(Skill.CRAFTING, 80), - new QuestRequirement(Quest.THE_FREMENNIK_ISLES, true)); - add("Complete a lap of the Rellekka agility course.", - new SkillRequirement(Skill.AGILITY, 80)); - add("Kill each of the Godwars generals.", - new SkillRequirement(Skill.AGILITY, 70), - new SkillRequirement(Skill.STRENGTH, 70), - new SkillRequirement(Skill.HITPOINTS, 70), - new SkillRequirement(Skill.RANGED, 70), - new QuestRequirement(Quest.TROLL_STRONGHOLD)); - add("Slay a Spiritual mage within the Godwars Dungeon.", - new SkillRequirement(Skill.SLAYER, 83), - new QuestRequirement(Quest.TROLL_STRONGHOLD)); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KandarinDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KandarinDiaryRequirement.java deleted file mode 100644 index ef9df50ce2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KandarinDiaryRequirement.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2018, Marshall - * Copyright (c) 2018, 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.achievementdiary.diaries; - -import net.runelite.api.Quest; -import net.runelite.api.Skill; -import net.runelite.client.plugins.achievementdiary.GenericDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.QuestRequirement; -import net.runelite.client.plugins.achievementdiary.SkillRequirement; - -public class KandarinDiaryRequirement extends GenericDiaryRequirement -{ - public KandarinDiaryRequirement() - { - // EASY - add("Catch a Mackerel at Catherby.", - new SkillRequirement(Skill.FISHING, 16)); - add("Plant some Jute seeds in the patch north of McGrubor's Wood.", - new SkillRequirement(Skill.FARMING, 13)); - add("Defeat one of each elemental in the workshop.", - new QuestRequirement(Quest.ELEMENTAL_WORKSHOP_I, true)); - add("Cross the Coal truck log shortcut.", - new SkillRequirement(Skill.AGILITY, 20)); - - // MEDIUM - add("Complete a lap of the Barbarian agility course.", - new SkillRequirement(Skill.AGILITY, 35), - new QuestRequirement(Quest.ALFRED_GRIMHANDS_BARCRAWL)); - add("Create a Super Antipoison potion from scratch in the Seers/Catherby Area.", - new SkillRequirement(Skill.HERBLORE, 48)); - add("Enter the Ranging guild.", - new SkillRequirement(Skill.RANGED, 40)); - add("Use the grapple shortcut to get from the water obelisk to Catherby shore.", - new SkillRequirement(Skill.AGILITY, 36), - new SkillRequirement(Skill.STRENGTH, 22), - new SkillRequirement(Skill.RANGED, 39)); - add("Catch and cook a Bass in Catherby.", - new SkillRequirement(Skill.FISHING, 46), - new SkillRequirement(Skill.COOKING, 43)); - add("Teleport to Camelot.", - new SkillRequirement(Skill.MAGIC, 45)); - add("String a Maple shortbow in Seers' Village bank.", - new SkillRequirement(Skill.FLETCHING, 50)); - add("Pick some Limpwurt root from the farming patch in Catherby.", - new SkillRequirement(Skill.FARMING, 26)); - add("Create a Mind helmet.", - new QuestRequirement(Quest.ELEMENTAL_WORKSHOP_II)); - add("Kill a Fire Giant inside Baxtorian Waterfall.", - new QuestRequirement(Quest.WATERFALL_QUEST, true)); - add("Steal from the chest in Hemenster.", - new SkillRequirement(Skill.THIEVING, 47)); - add("Travel to McGrubor's Wood by Fairy Ring.", - new QuestRequirement(Quest.FAIRYTALE_II__CURE_A_QUEEN, true)); - add("Mine some coal near the coal trucks.", - new SkillRequirement(Skill.MINING, 30)); - - // HARD - add("Catch a Leaping Sturgeon.", - new SkillRequirement(Skill.FISHING, 70), - new SkillRequirement(Skill.AGILITY, 45), - new SkillRequirement(Skill.STRENGTH, 45)); - add("Complete a lap of the Seers' Village agility course.", - new SkillRequirement(Skill.AGILITY, 60)); - add("Create a Yew Longbow from scratch around Seers' Village.", - new SkillRequirement(Skill.WOODCUTTING, 60), - new SkillRequirement(Skill.FLETCHING, 70), - new SkillRequirement(Skill.CRAFTING, 10)); - add("Enter the Seers' Village courthouse with piety turned on.", - new SkillRequirement(Skill.PRAYER, 70), - new SkillRequirement(Skill.DEFENCE, 70), - new QuestRequirement(Quest.KINGS_RANSOM)); - add("Charge a Water Orb.", - new SkillRequirement(Skill.MAGIC, 56)); - add("Burn some Maple logs with a bow in Seers' Village.", - new SkillRequirement(Skill.FIREMAKING, 65)); - add("Kill a Shadow Hound in the Shadow dungeon.", - new SkillRequirement(Skill.THIEVING, 53), - new QuestRequirement(Quest.DESERT_TREASURE, true)); - add("Purchase and equip a granite body from Barbarian Assault.", - new SkillRequirement(Skill.STRENGTH, 50), - new SkillRequirement(Skill.DEFENCE, 50)); - add("Have the Seers' estate agent decorate your house with Fancy Stone.", - new SkillRequirement(Skill.CONSTRUCTION, 50)); - add("Smith an Adamant spear at Otto's Grotto.", - new SkillRequirement(Skill.SMITHING, 75), - new QuestRequirement(Quest.TAI_BWO_WANNAI_TRIO)); - - // ELITE - add("Pick some Dwarf weed from the herb patch at Catherby.", - new SkillRequirement(Skill.FARMING, 79)); - add("Fish and Cook 5 Sharks in Catherby using the Cooking gauntlets.", - new SkillRequirement(Skill.FISHING, 76), - new SkillRequirement(Skill.COOKING, 80), - new QuestRequirement(Quest.FAMILY_CREST)); - add("Mix a Stamina Mix on top of the Seers' Village bank.", - new SkillRequirement(Skill.HERBLORE, 86), - new SkillRequirement(Skill.AGILITY, 60)); - add("Smith a Rune Hasta at Otto's Grotto.", - new SkillRequirement(Skill.SMITHING, 90)); - add("Construct a Pyre ship from Magic Logs.(Requires Chewed Bones.)", - new SkillRequirement(Skill.FIREMAKING, 85), - new SkillRequirement(Skill.CRAFTING, 85)); - add("Teleport to Catherby.", - new SkillRequirement(Skill.MAGIC, 87), - new QuestRequirement(Quest.LUNAR_DIPLOMACY)); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KaramjaDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KaramjaDiaryRequirement.java deleted file mode 100644 index fc906cccb4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KaramjaDiaryRequirement.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2018, Marshall - * Copyright (c) 2018, 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.achievementdiary.diaries; - -import net.runelite.api.Quest; -import net.runelite.api.Skill; -import net.runelite.client.plugins.achievementdiary.CombatLevelRequirement; -import net.runelite.client.plugins.achievementdiary.GenericDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.OrRequirement; -import net.runelite.client.plugins.achievementdiary.QuestRequirement; -import net.runelite.client.plugins.achievementdiary.SkillRequirement; - -public class KaramjaDiaryRequirement extends GenericDiaryRequirement -{ - public KaramjaDiaryRequirement() - { - // EASY - add("Use the rope swing to travel to the small island north-west of Karamja, where the " + - "moss giants are.", - new SkillRequirement(Skill.AGILITY, 10)); - add("Mine some gold from the rocks on the north-west peninsula of Karamja.", - new SkillRequirement(Skill.MINING, 40)); - add("Explore Cairn Island to the west of Karamja.", - new SkillRequirement(Skill.AGILITY, 15)); - - // MEDIUM - add("Claim a ticket from the Agility Arena in Brimhaven.", - new SkillRequirement(Skill.AGILITY, 30)); - add("Discover hidden wall in the dungeon below the volcano.", - new QuestRequirement(Quest.DRAGON_SLAYER, true)); - add("Visit the Isle of Crandor via the dungeon below the volcano.", - new QuestRequirement(Quest.DRAGON_SLAYER, true)); - add("Use Vigroy and Hajedy's cart service.", - new QuestRequirement(Quest.SHILO_VILLAGE)); - add("Earn 100% favour in the village of Tai Bwo Wannai.", - new SkillRequirement(Skill.WOODCUTTING, 10), - new QuestRequirement(Quest.JUNGLE_POTION)); - add("Cook a spider on a stick.", - new SkillRequirement(Skill.COOKING, 16)); - add("Charter the Lady of the Waves from Cairn Isle to Port Khazard.", - new QuestRequirement(Quest.SHILO_VILLAGE)); - add("Cut a log from a teak tree.", - new SkillRequirement(Skill.WOODCUTTING, 35), - new QuestRequirement(Quest.JUNGLE_POTION)); - add("Cut a log from a mahogany tree.", - new SkillRequirement(Skill.WOODCUTTING, 50), - new QuestRequirement(Quest.JUNGLE_POTION)); - add("Catch a karambwan.", - new SkillRequirement(Skill.FISHING, 65), - new QuestRequirement(Quest.TAI_BWO_WANNAI_TRIO, true)); - add("Exchange gems for a machete.", - new QuestRequirement(Quest.JUNGLE_POTION)); - add("Use the gnome glider to travel to Karamja.", - new QuestRequirement(Quest.THE_GRAND_TREE)); - add("Grow a healthy fruit tree in the patch near Brimhaven.", - new SkillRequirement(Skill.FARMING, 27)); - add("Trap a horned graahk.", - new SkillRequirement(Skill.HUNTER, 41)); - add("Chop the vines to gain deeper access to Brimhaven Dungeon.", - new SkillRequirement(Skill.WOODCUTTING, 10)); - add("Cross the lava using the stepping stones within Brimhaven Dungeon.", - new SkillRequirement(Skill.AGILITY, 12)); - add("Climb the stairs within Brimhaven Dungeon.", - new SkillRequirement(Skill.WOODCUTTING, 10)); - add("Charter a ship from the shipyard in the far east of Karamja.", - new QuestRequirement(Quest.THE_GRAND_TREE)); - add("Mine a red topaz from a gem rock.", - new SkillRequirement(Skill.MINING, 40), - new OrRequirement( - new QuestRequirement(Quest.SHILO_VILLAGE), - new QuestRequirement(Quest.JUNGLE_POTION) - ) - ); - - // HARD - add("Craft some nature runes.", - new SkillRequirement(Skill.RUNECRAFT, 44), - new QuestRequirement(Quest.RUNE_MYSTERIES)); - add("Cook a karambwan thoroughly.", - new SkillRequirement(Skill.COOKING, 30), - new QuestRequirement(Quest.TAI_BWO_WANNAI_TRIO)); - add("Kill a deathwing in the dungeon under the Kharazi Jungle.", - new SkillRequirement(Skill.WOODCUTTING, 15), - new SkillRequirement(Skill.STRENGTH, 50), - new SkillRequirement(Skill.AGILITY, 50), - new SkillRequirement(Skill.THIEVING, 50), - new SkillRequirement(Skill.MINING, 52), - new QuestRequirement(Quest.LEGENDS_QUEST)); - add("Use the crossbow short cut south of the volcano.", - new SkillRequirement(Skill.AGILITY, 53), - new SkillRequirement(Skill.RANGED, 42), - new SkillRequirement(Skill.STRENGTH, 21)); - add("Collect 5 palm leaves.", - new SkillRequirement(Skill.WOODCUTTING, 15), - new QuestRequirement(Quest.LEGENDS_QUEST)); - add("Be assigned a Slayer task by Duradel north of Shilo Village.", - new CombatLevelRequirement(100), - new SkillRequirement(Skill.SLAYER, 50), - new QuestRequirement(Quest.SHILO_VILLAGE)); - - // ELITE - add("Craft 56 Nature runes at once.", - new SkillRequirement(Skill.RUNECRAFT, 91)); - add("Check the health of a palm tree in Brimhaven.", - new SkillRequirement(Skill.FARMING, 68)); - add("Create an antivenom potion whilst standing in the horse shoe mine.", - new SkillRequirement(Skill.HERBLORE, 87)); - add("Check the health of your Calquat tree patch.", - new SkillRequirement(Skill.FARMING, 72)); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KourendDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KourendDiaryRequirement.java deleted file mode 100644 index fa568cfe2e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/KourendDiaryRequirement.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2019 William - * 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.achievementdiary.diaries; - -import net.runelite.api.Favour; -import net.runelite.api.Quest; -import net.runelite.api.Skill; -import net.runelite.client.plugins.achievementdiary.FavourRequirement; -import net.runelite.client.plugins.achievementdiary.GenericDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.QuestRequirement; -import net.runelite.client.plugins.achievementdiary.SkillRequirement; - -public class KourendDiaryRequirement extends GenericDiaryRequirement -{ - public KourendDiaryRequirement() - { - //EASY - add("Mine some Iron at the Mount Karuulm mine.", - new SkillRequirement(Skill.MINING, 15)); - add("Steal from a Hosidius Food Stall.", - new SkillRequirement(Skill.THIEVING, 25), - new FavourRequirement(Favour.HOSIDIUS, 15)); - add("Browse the Warrens General Store.", - new QuestRequirement(Quest.THE_QUEEN_OF_THIEVES, true)); - add("Enter your Player Owned House from Hosidius.", - new SkillRequirement(Skill.CONSTRUCTION, 25)); - add("Create a Strength potion in the Lovakengj Pub.", - new SkillRequirement(Skill.HERBLORE, 12)); - add("Fish a Trout from the River Molch.", - new SkillRequirement(Skill.FISHING, 20)); - - //MEDIUM - add("Travel to the Fairy Ring south of Mount Karuulm.", - new QuestRequirement(Quest.FAIRYTALE_II__CURE_A_QUEEN, true)); - add("Use Kharedst's memoirs to teleport to all five cities in Great Kourend.", - new QuestRequirement(Quest.THE_DEPTHS_OF_DESPAIR), - new QuestRequirement(Quest.THE_QUEEN_OF_THIEVES), - new QuestRequirement(Quest.TALE_OF_THE_RIGHTEOUS), - new QuestRequirement(Quest.THE_FORSAKEN_TOWER), - new QuestRequirement(Quest.THE_ASCENT_OF_ARCEUUS)); - add("Mine some Volcanic sulphur.", - new SkillRequirement(Skill.MINING, 42)); - add("Enter the Farming Guild.", - new SkillRequirement(Skill.FARMING, 45)); - add("Switch to the Necromancy Spellbook at Tyss.", - new FavourRequirement(Favour.ARCEUUS, 60)); - add("Repair a Piscarilius crane.", - new SkillRequirement(Skill.CRAFTING, 30)); - add("Deliver some intelligence to Captain Ginea.", - new FavourRequirement(Favour.SHAYZIEN, 40)); - add("Catch a Bluegill on Molch Island.", - new SkillRequirement(Skill.FISHING, 43), - new SkillRequirement(Skill.HUNTER, 35)); - add("Use the boulder leap in the Arceuus essence mine.", - new SkillRequirement(Skill.AGILITY, 49)); - add("Subdue the Wintertodt.", - new SkillRequirement(Skill.FIREMAKING, 50)); - add("Catch a Chinchompa in the Kourend Woodland.", - new SkillRequirement(Skill.HUNTER, 53), - new QuestRequirement(Quest.EAGLES_PEAK)); - add("Chop some Mahogany logs north of the Farming Guild.", - new SkillRequirement(Skill.WOODCUTTING, 50)); - - //HARD - add("Enter the Woodcutting Guild.", - new SkillRequirement(Skill.WOODCUTTING, 60), - new FavourRequirement(Favour.HOSIDIUS, 75)); - add("Smelt an Adamantite bar in The Forsaken Tower.", - new SkillRequirement(Skill.SMITHING, 70), - new QuestRequirement(Quest.THE_FORSAKEN_TOWER, true)); - add("Kill a Lizardman Shaman in Molch.", - new FavourRequirement(Favour.SHAYZIEN, 100)); - add("Mine some Lovakite.", - new SkillRequirement(Skill.MINING, 65), - new FavourRequirement(Favour.LOVAKENGJ, 30)); - add("Plant some Logavano seeds at the Tithe Farm.", - new SkillRequirement(Skill.FARMING, 74), - new FavourRequirement(Favour.HOSIDIUS, 100)); - add("Teleport to Xeric's Heart using Xeric's Talisman.", - new QuestRequirement(Quest.ARCHITECTURAL_ALLIANCE)); - add("Deliver an artefact to Captain Khaled.", - new SkillRequirement(Skill.THIEVING, 49), - new FavourRequirement(Favour.PISCARILIUS, 75)); - add("Kill a Wyrm in the Karuulm Slayer Dungeon.", - new SkillRequirement(Skill.SLAYER, 62)); - add("Cast Monster Examine on a Troll south of Mount Quidamortem.", - new SkillRequirement(Skill.MAGIC, 66), - new QuestRequirement(Quest.DREAM_MENTOR)); - - //ELITE - add("Craft one or more Blood runes.", - new SkillRequirement(Skill.RUNECRAFT, 77), - new SkillRequirement(Skill.MINING, 38), - new SkillRequirement(Skill.CRAFTING, 38), - new FavourRequirement(Favour.ARCEUUS, 100)); - add("Chop some Redwood logs.", - new SkillRequirement(Skill.WOODCUTTING, 90), - new FavourRequirement(Favour.HOSIDIUS, 75)); - add("Catch an Anglerfish and cook it whilst in Great Kourend.", - new SkillRequirement(Skill.FISHING, 82), - new SkillRequirement(Skill.COOKING, 84), - new FavourRequirement(Favour.PISCARILIUS, 100)); - add("Kill a Hydra in the Karuulm Slayer Dungeon.", - new SkillRequirement(Skill.SLAYER, 95)); - add("Create an Ape Atoll teleport tablet.", - new SkillRequirement(Skill.MAGIC, 90), - new SkillRequirement(Skill.MINING, 38), - new SkillRequirement(Skill.CRAFTING, 38), - new FavourRequirement(Favour.ARCEUUS, 100)); - add("Create your own Battlestaff from scratch within the Farming Guild.", - new SkillRequirement(Skill.FARMING, 85), - new SkillRequirement(Skill.FLETCHING, 40)); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/LumbridgeDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/LumbridgeDiaryRequirement.java deleted file mode 100644 index 7238e18a55..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/LumbridgeDiaryRequirement.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2018, Marshall - * Copyright (c) 2018, 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.achievementdiary.diaries; - -import net.runelite.api.Quest; -import net.runelite.api.Skill; -import net.runelite.client.plugins.achievementdiary.CombatLevelRequirement; -import net.runelite.client.plugins.achievementdiary.GenericDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.QuestRequirement; -import net.runelite.client.plugins.achievementdiary.SkillRequirement; - -public class LumbridgeDiaryRequirement extends GenericDiaryRequirement -{ - public LumbridgeDiaryRequirement() - { - // EASY - add("Complete a lap of the Draynor Village agility course.", - new SkillRequirement(Skill.AGILITY, 10)); - add("Slay a Cave bug beneath Lumbridge Swamp.", - new SkillRequirement(Skill.SLAYER, 7)); - add("Have Sedridor teleport you to the Essence Mine.", - new QuestRequirement(Quest.RUNE_MYSTERIES)); - add("Craft some water runes.", - new SkillRequirement(Skill.RUNECRAFT, 5), - new QuestRequirement(Quest.RUNE_MYSTERIES)); - add("Chop and burn some oak logs in Lumbridge.", - new SkillRequirement(Skill.WOODCUTTING, 15), - new SkillRequirement(Skill.FIREMAKING, 15)); - add("Catch some Anchovies in Al Kharid.", - new SkillRequirement(Skill.FISHING, 15)); - add("Bake some Bread on the Lumbridge kitchen range.", - new QuestRequirement(Quest.COOKS_ASSISTANT)); - add("Mine some Iron ore at the Al Kharid mine.", - new SkillRequirement(Skill.MINING, 15)); - - // MEDIUM - add("Complete a lap of the Al Kharid agility course.", - new SkillRequirement(Skill.AGILITY, 20)); - add("Grapple across the River Lum.", - new SkillRequirement(Skill.AGILITY, 8), - new SkillRequirement(Skill.STRENGTH, 19), - new SkillRequirement(Skill.RANGED, 37)); - add("Purchase an upgraded device from Ava.", - new SkillRequirement(Skill.RANGED, 50), - new QuestRequirement(Quest.ANIMAL_MAGNETISM)); - add("Travel to the Wizards' Tower by Fairy ring.", - new QuestRequirement(Quest.FAIRYTALE_II__CURE_A_QUEEN, true)); - add("Cast the teleport to Lumbridge spell.", - new SkillRequirement(Skill.MAGIC, 31)); - add("Catch some Salmon in Lumbridge.", - new SkillRequirement(Skill.FISHING, 30)); - add("Craft a coif in the Lumbridge cow pen.", - new SkillRequirement(Skill.CRAFTING, 38)); - add("Chop some willow logs in Draynor Village.", - new SkillRequirement(Skill.WOODCUTTING, 30)); - add("Pickpocket Martin the Master Gardener.", - new SkillRequirement(Skill.THIEVING, 38)); - add("Get a slayer task from Chaeldar.", - new CombatLevelRequirement(70), - new QuestRequirement(Quest.LOST_CITY)); - add("Catch an Essence or Eclectic impling in Puro-Puro.", - new SkillRequirement(Skill.HUNTER, 42), - new QuestRequirement(Quest.LOST_CITY)); - add("Craft some Lava runes at the fire altar in Al Kharid.", - new SkillRequirement(Skill.RUNECRAFT, 23), - new QuestRequirement(Quest.RUNE_MYSTERIES)); - - // HARD - add("Cast Bones to Peaches in Al Kharid palace.", - new SkillRequirement(Skill.MAGIC, 60)); - add("Squeeze past the jutting wall on your way to the cosmic altar.", - new SkillRequirement(Skill.AGILITY, 46), - new QuestRequirement(Quest.LOST_CITY)); - add("Craft 56 Cosmic runes simultaneously.", - new SkillRequirement(Skill.RUNECRAFT, 59), - new QuestRequirement(Quest.LOST_CITY)); - add("Travel from Lumbridge to Edgeville on a Waka Canoe.", - new SkillRequirement(Skill.WOODCUTTING, 57)); - add("Collect at least 100 Tears of Guthix in one visit.", - new QuestRequirement(Quest.TEARS_OF_GUTHIX)); - add("Take the train from Dorgesh-Kaan to Keldagrim.", - new QuestRequirement(Quest.ANOTHER_SLICE_OF_HAM)); - add("Purchase some Barrows gloves from the Lumbridge bank chest.", - new QuestRequirement(Quest.RECIPE_FOR_DISASTER)); - add("Pick some Belladonna from the farming patch at Draynor Manor.", - new SkillRequirement(Skill.FARMING, 63)); - add("Light your mining helmet in the Lumbridge castle basement.", - new SkillRequirement(Skill.FIREMAKING, 65)); - add("Recharge your prayer at Clan Wars with Smite activated.", - new SkillRequirement(Skill.PRAYER, 52)); - add("Craft, string and enchant an Amulet of Power in Lumbridge.", - new SkillRequirement(Skill.CRAFTING, 70), - new SkillRequirement(Skill.MAGIC, 57)); - - // ELITE - add("Steal from a Dorgesh-Kaan rich chest.", - new SkillRequirement(Skill.THIEVING, 78), - new QuestRequirement(Quest.DEATH_TO_THE_DORGESHUUN)); - add("Pickpocket Movario on the Dorgesh-Kaan Agility course.", - new SkillRequirement(Skill.AGILITY, 70), - new SkillRequirement(Skill.RANGED, 70), - new SkillRequirement(Skill.STRENGTH, 70), - new QuestRequirement(Quest.DEATH_TO_THE_DORGESHUUN)); - add("Chop some magic logs at the Mage Training Arena.", - new SkillRequirement(Skill.WOODCUTTING, 75)); - add("Smith an Adamant platebody down Draynor sewer.", - new SkillRequirement(Skill.SMITHING, 88)); - add("Craft 140 or more Water runes at once.", - new SkillRequirement(Skill.RUNECRAFT, 76), - new QuestRequirement(Quest.RUNE_MYSTERIES)); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/MorytaniaDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/MorytaniaDiaryRequirement.java deleted file mode 100644 index 826b1a8410..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/MorytaniaDiaryRequirement.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2018, Marshall - * Copyright (c) 2018, 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.achievementdiary.diaries; - -import net.runelite.api.Quest; -import net.runelite.api.Skill; -import net.runelite.client.plugins.achievementdiary.CombatLevelRequirement; -import net.runelite.client.plugins.achievementdiary.GenericDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.OrRequirement; -import net.runelite.client.plugins.achievementdiary.QuestRequirement; -import net.runelite.client.plugins.achievementdiary.SkillRequirement; - -public class MorytaniaDiaryRequirement extends GenericDiaryRequirement -{ - public MorytaniaDiaryRequirement() - { - // EASY - add("Craft any Snelm from scratch in Morytania.", - new SkillRequirement(Skill.CRAFTING, 15)); - add("Cook a thin Snail on the Port Phasmatys range.", - new SkillRequirement(Skill.COOKING, 12)); - add("Get a slayer task from Mazchna.", - new CombatLevelRequirement(20)); - add("Kill a Banshee in the Slayer Tower.", - new SkillRequirement(Skill.SLAYER, 15)); - add("Place a Scarecrow in the Morytania flower patch.", - new SkillRequirement(Skill.FARMING, 23)); - add("Kill a werewolf in its human form using the Wolfbane Dagger.", - new QuestRequirement(Quest.PRIEST_IN_PERIL)); - add("Restore your prayer points at the nature altar.", - new QuestRequirement(Quest.NATURE_SPIRIT)); - - // MEDIUM - add("Catch a swamp lizard.", - new SkillRequirement(Skill.HUNTER, 29)); - add("Complete a lap of the Canifis agility course.", - new SkillRequirement(Skill.AGILITY, 40)); - add("Obtain some Bark from a Hollow tree.", - new SkillRequirement(Skill.WOODCUTTING, 45)); - add("Kill a Terror Dog.", - new SkillRequirement(Skill.SLAYER, 40), - new QuestRequirement(Quest.LAIR_OF_TARN_RAZORLOR)); - add("Complete a game of trouble brewing.", - new SkillRequirement(Skill.COOKING, 40), - new QuestRequirement(Quest.CABIN_FEVER)); - add("Make a batch of cannonballs at the Port Phasmatys furnace.", - new SkillRequirement(Skill.SMITHING, 35), - new QuestRequirement(Quest.DWARF_CANNON), - new QuestRequirement(Quest.GHOSTS_AHOY, true)); - add("Kill a Fever Spider on Braindeath Island.", - new SkillRequirement(Skill.SLAYER, 42), - new QuestRequirement(Quest.RUM_DEAL)); - add("Use an ectophial to return to Port Phasmatys.", - new QuestRequirement(Quest.GHOSTS_AHOY)); - add("Mix a Guthix Balance potion while in Morytania.", - new SkillRequirement(Skill.HERBLORE, 22), - new QuestRequirement(Quest.IN_AID_OF_THE_MYREQUE, true)); - - // HARD - add("Enter the Kharyrll portal in your POH.", - new SkillRequirement(Skill.MAGIC, 66), - new SkillRequirement(Skill.CONSTRUCTION, 50), - new QuestRequirement(Quest.DESERT_TREASURE)); - add("Climb the advanced spike chain within Slayer Tower.", - new SkillRequirement(Skill.AGILITY, 71)); - add("Harvest some Watermelon from the Allotment patch on Harmony Island.", - new SkillRequirement(Skill.FARMING, 47), - new QuestRequirement(Quest.THE_GREAT_BRAIN_ROBBERY, true)); - add("Chop and burn some mahogany logs on Mos Le'Harmless.", - new SkillRequirement(Skill.WOODCUTTING, 50), - new SkillRequirement(Skill.FIREMAKING, 50), - new QuestRequirement(Quest.CABIN_FEVER)); - add("Complete a temple trek with a hard companion.", - new QuestRequirement(Quest.IN_AID_OF_THE_MYREQUE)); - add("Kill a Cave Horror.", - new SkillRequirement(Skill.SLAYER, 58), - new QuestRequirement(Quest.CABIN_FEVER)); - add("Harvest some Bittercap Mushrooms from the patch in Canifis.", - new SkillRequirement(Skill.FARMING, 53)); - add("Pray at the Altar of Nature with Piety activated.", - new SkillRequirement(Skill.PRAYER, 70), - new SkillRequirement(Skill.DEFENCE, 70), - new QuestRequirement(Quest.NATURE_SPIRIT), - new QuestRequirement(Quest.KINGS_RANSOM)); - add("Use the shortcut to get to the bridge over the Salve.", - new SkillRequirement(Skill.AGILITY, 65)); - add("Mine some Mithril ore in the Abandoned Mine.", - new SkillRequirement(Skill.MINING, 55), - new QuestRequirement(Quest.HAUNTED_MINE)); - - // ELITE - add("Catch a shark in Burgh de Rott with your bare hands.", - new SkillRequirement(Skill.FISHING, 96), - new SkillRequirement(Skill.STRENGTH, 76), - new QuestRequirement(Quest.IN_AID_OF_THE_MYREQUE)); - add("Cremate any Shade remains on a Magic or Redwood pyre.", - new SkillRequirement(Skill.FIREMAKING, 80), - new QuestRequirement(Quest.SHADES_OF_MORTTON)); - add("Fertilize the Morytania herb patch using Lunar Magic.", - new SkillRequirement(Skill.MAGIC, 83), - new QuestRequirement(Quest.LUNAR_DIPLOMACY)); - add("Craft a Black dragonhide body in Canifis bank.", - new SkillRequirement(Skill.CRAFTING, 84)); - add("Kill an Abyssal demon in the Slayer Tower.", - new SkillRequirement(Skill.SLAYER, 85)); - add("Loot the Barrows chest while wearing any complete barrows set.", - new SkillRequirement(Skill.DEFENCE, 70), - new OrRequirement( - new SkillRequirement(Skill.ATTACK, 70), - new SkillRequirement(Skill.STRENGTH, 70), - new SkillRequirement(Skill.RANGED, 70), - new SkillRequirement(Skill.MAGIC, 70) - ) - ); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/VarrockDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/VarrockDiaryRequirement.java deleted file mode 100644 index bff800b4c2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/VarrockDiaryRequirement.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2018, Marshall - * Copyright (c) 2018, 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.achievementdiary.diaries; - -import net.runelite.api.Quest; -import net.runelite.api.Skill; -import net.runelite.client.plugins.achievementdiary.CombatLevelRequirement; -import net.runelite.client.plugins.achievementdiary.GenericDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.QuestPointRequirement; -import net.runelite.client.plugins.achievementdiary.QuestRequirement; -import net.runelite.client.plugins.achievementdiary.SkillRequirement; - -public class VarrockDiaryRequirement extends GenericDiaryRequirement -{ - public VarrockDiaryRequirement() - { - // EASY - add("Have Aubury teleport you to the Essence mine.", - new QuestRequirement(Quest.RUNE_MYSTERIES)); - add("Mine some Iron in the south east mining patch near Varrock.", - new SkillRequirement(Skill.MINING, 15)); - add("Jump over the fence south of Varrock.", - new SkillRequirement(Skill.AGILITY, 13)); - add("Spin a bowl on the pottery wheel and fire it in the oven in Barb Village.", - new SkillRequirement(Skill.CRAFTING, 8)); - add("Craft some Earth runes.", - new SkillRequirement(Skill.RUNECRAFT, 9)); - add("Catch some trout in the River Lum at Barbarian Village.", - new SkillRequirement(Skill.FISHING, 20)); - add("Steal from the Tea stall in Varrock.", - new SkillRequirement(Skill.THIEVING, 5)); - - // MEDIUM - add("Enter the Champions' Guild.", - new QuestPointRequirement(32)); - add("Select a colour for your kitten.", - new QuestRequirement(Quest.GARDEN_OF_TRANQUILLITY, true), - new QuestRequirement(Quest.GERTRUDES_CAT)); - add("Use the spirit tree north of Varrock.", - new QuestRequirement(Quest.TREE_GNOME_VILLAGE)); - add("Enter the Tolna dungeon after completing A Soul's Bane.", - new QuestRequirement(Quest.A_SOULS_BANE)); - add("Teleport to the digsite using a Digsite pendant.", - new QuestRequirement(Quest.THE_DIG_SITE)); - add("Cast the teleport to Varrock spell.", - new SkillRequirement(Skill.MAGIC, 25)); - add("Get a Slayer task from Vannaka.", - new CombatLevelRequirement(40)); - add("Pick a White tree fruit.", - new SkillRequirement(Skill.FARMING, 25), - new QuestRequirement(Quest.GARDEN_OF_TRANQUILLITY)); - add("Use the balloon to travel from Varrock.", - new SkillRequirement(Skill.FIREMAKING, 40), - new QuestRequirement(Quest.ENLIGHTENED_JOURNEY)); - add("Complete a lap of the Varrock Agility course.", - new SkillRequirement(Skill.AGILITY, 30)); - - // HARD - add("Trade furs with the Fancy Dress Seller for a spottier cape and equip it.", - new SkillRequirement(Skill.HUNTER, 66)); - add("Make a Waka Canoe near Edgeville.", - new SkillRequirement(Skill.WOODCUTTING, 57)); - add("Teleport to Paddewwa.", - new SkillRequirement(Skill.MAGIC, 54), - new QuestRequirement(Quest.DESERT_TREASURE)); - add("Chop some yew logs in Varrock and burn them at the top of the Varrock church.", - new SkillRequirement(Skill.WOODCUTTING, 60), - new SkillRequirement(Skill.FIREMAKING, 60)); - add("Have the Varrock estate agent decorate your house with Fancy Stone.", - new SkillRequirement(Skill.CONSTRUCTION, 50)); - add("Collect at least 2 yew roots from the Tree patch in Varrock Palace.", - new SkillRequirement(Skill.WOODCUTTING, 60), - new SkillRequirement(Skill.FARMING, 68)); - add("Pray at the altar in Varrock palace with Smite active.", - new SkillRequirement(Skill.PRAYER, 52)); - add("Squeeze through the obstacle pipe in Edgeville dungeon.", - new SkillRequirement(Skill.AGILITY, 51)); - - // ELITE - add("Create a super combat potion in Varrock west bank.", - new SkillRequirement(Skill.HERBLORE, 90), - new QuestRequirement(Quest.DRUIDIC_RITUAL)); - add("Use Lunar magic to make 20 mahogany planks at the Lumberyard.", - new SkillRequirement(Skill.MAGIC, 86), - new QuestRequirement(Quest.DREAM_MENTOR)); - add("Bake a summer pie in the Cooking Guild.", - new SkillRequirement(Skill.COOKING, 95)); - add("Smith and fletch ten rune darts within Varrock.", - new SkillRequirement(Skill.SMITHING, 89), - new SkillRequirement(Skill.FLETCHING, 81), - new QuestRequirement(Quest.THE_TOURIST_TRAP)); - add("Craft 100 or more earth runes simultaneously.", - new SkillRequirement(Skill.RUNECRAFT, 78), - new QuestRequirement(Quest.RUNE_MYSTERIES)); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/WesternDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/WesternDiaryRequirement.java deleted file mode 100644 index 133ef6903a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/WesternDiaryRequirement.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2018, Marshall - * Copyright (c) 2018, 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.achievementdiary.diaries; - -import net.runelite.api.Quest; -import net.runelite.api.Skill; -import net.runelite.client.plugins.achievementdiary.CombatLevelRequirement; -import net.runelite.client.plugins.achievementdiary.GenericDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.QuestRequirement; -import net.runelite.client.plugins.achievementdiary.SkillRequirement; - -public class WesternDiaryRequirement extends GenericDiaryRequirement -{ - public WesternDiaryRequirement() - { - // EASY - add("Catch a Copper Longtail.", - new SkillRequirement(Skill.HUNTER, 9)); - add("Complete a novice game of Pest Control.", - new CombatLevelRequirement(40)); - add("Mine some Iron Ore near Piscatoris.", - new SkillRequirement(Skill.MINING, 15)); - add("Claim any Chompy bird hat from Rantz.", - new QuestRequirement(Quest.BIG_CHOMPY_BIRD_HUNTING)); - add("Have Brimstail teleport you to the Essence mine.", - new QuestRequirement(Quest.RUNE_MYSTERIES)); - add("Fletch an Oak shortbow from the Gnome Stronghold.", - new SkillRequirement(Skill.FLETCHING, 20)); - - // MEDIUM - add("Take the agility shortcut from the Grand Tree to Otto's Grotto.", - new SkillRequirement(Skill.AGILITY, 37), - new QuestRequirement(Quest.TREE_GNOME_VILLAGE), - new QuestRequirement(Quest.THE_GRAND_TREE)); - add("Travel to the Gnome Stronghold by Spirit Tree.", - new QuestRequirement(Quest.TREE_GNOME_VILLAGE)); - add("Trap a Spined Larupia.", - new SkillRequirement(Skill.HUNTER, 31)); - add("Fish some Bass on Ape Atoll.", - new SkillRequirement(Skill.FISHING, 46), - new QuestRequirement(Quest.MONKEY_MADNESS_I, true)); - add("Chop and burn some teak logs on Ape Atoll.", - new SkillRequirement(Skill.WOODCUTTING, 35), - new SkillRequirement(Skill.FIREMAKING, 35), - new QuestRequirement(Quest.MONKEY_MADNESS_I)); - add("Complete an intermediate game of Pest Control.", - new CombatLevelRequirement(70)); - add("Travel to the Feldip Hills by Gnome Glider.", - new QuestRequirement(Quest.ONE_SMALL_FAVOUR), - new QuestRequirement(Quest.THE_GRAND_TREE)); - add("Claim a Chompy bird hat from Rantz after registering at least 125 kills.", - new QuestRequirement(Quest.BIG_CHOMPY_BIRD_HUNTING)); - add("Travel from Eagles' Peak to the Feldip Hills by Eagle.", - new QuestRequirement(Quest.EAGLES_PEAK)); - add("Make a Chocolate Bomb at the Grand Tree.", - new SkillRequirement(Skill.COOKING, 42)); - add("Complete a delivery for the Gnome Restaurant.", - new SkillRequirement(Skill.COOKING, 29)); - add("Turn your small crystal seed into a Crystal saw.", - new QuestRequirement(Quest.THE_EYES_OF_GLOUPHRIE)); - add("Mine some Gold ore underneath the Grand Tree.", - new SkillRequirement(Skill.MINING, 40), - new QuestRequirement(Quest.THE_GRAND_TREE)); - - // HARD - add("Kill an Elf with a Crystal bow.", - new SkillRequirement(Skill.RANGED, 70), - new SkillRequirement(Skill.AGILITY, 56), - new QuestRequirement(Quest.ROVING_ELVES)); - add("Catch and cook a Monkfish in Piscatoris.", - new SkillRequirement(Skill.FISHING, 62), - new SkillRequirement(Skill.COOKING, 62), - new QuestRequirement(Quest.SWAN_SONG)); - add("Complete a Veteran game of Pest Control.", - new CombatLevelRequirement(100)); - add("Catch a Dashing Kebbit.", - new SkillRequirement(Skill.HUNTER, 69)); - add("Complete a lap of the Ape Atoll agility course.", - new SkillRequirement(Skill.AGILITY, 48), - new QuestRequirement(Quest.MONKEY_MADNESS_I)); - add("Chop and burn some Mahogany logs on Ape Atoll.", - new SkillRequirement(Skill.WOODCUTTING, 50), - new SkillRequirement(Skill.FIREMAKING, 50), - new QuestRequirement(Quest.MONKEY_MADNESS_I)); - add("Mine some Adamantite ore in Tirannwn.", - new SkillRequirement(Skill.MINING, 70), - new QuestRequirement(Quest.REGICIDE)); - add("Check the health of your Palm tree in Lletya.", - new SkillRequirement(Skill.FARMING, 68), - new QuestRequirement(Quest.MOURNINGS_END_PART_I, true)); - add("Claim a Chompy bird hat from Rantz after registering at least 300 kills.", - new QuestRequirement(Quest.BIG_CHOMPY_BIRD_HUNTING)); - add("Build an Isafdar painting in your POH Quest hall.", - new SkillRequirement(Skill.CONSTRUCTION, 65), - new QuestRequirement(Quest.ROVING_ELVES)); - add("Kill Zulrah.", - new QuestRequirement(Quest.REGICIDE, true)); - add("Teleport to Ape Atoll.", - new SkillRequirement(Skill.MAGIC, 64), - new QuestRequirement(Quest.RECIPE_FOR_DISASTER, true)); - add("Pickpocket a Gnome.", - new SkillRequirement(Skill.THIEVING, 75), - new QuestRequirement(Quest.TREE_GNOME_VILLAGE)); - - // ELITE - add("Fletch a Magic Longbow in Tirannwn.", - new SkillRequirement(Skill.FLETCHING, 85), - new QuestRequirement(Quest.MOURNINGS_END_PART_I)); - add("Kill the Thermonuclear Smoke devil (Does not require task).", - new SkillRequirement(Skill.SLAYER, 93)); - add("Have Prissy Scilla protect your Magic tree.", - new SkillRequirement(Skill.FARMING, 75)); - add("Use the Elven overpass advanced cliffside shortcut.", - new SkillRequirement(Skill.AGILITY, 85), - new QuestRequirement(Quest.UNDERGROUND_PASS)); - add("Claim a Chompy bird hat from Rantz after registering at least 1000 kills.", - new QuestRequirement(Quest.BIG_CHOMPY_BIRD_HUNTING)); - add("Pickpocket an Elf.", - new SkillRequirement(Skill.THIEVING, 85), - new QuestRequirement(Quest.MOURNINGS_END_PART_I, true)); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/WildernessDiaryRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/WildernessDiaryRequirement.java deleted file mode 100644 index 0a059a1785..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/achievementdiary/diaries/WildernessDiaryRequirement.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2018, Marshall - * Copyright (c) 2018, 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.achievementdiary.diaries; - -import net.runelite.api.Quest; -import net.runelite.api.Skill; -import net.runelite.client.plugins.achievementdiary.GenericDiaryRequirement; -import net.runelite.client.plugins.achievementdiary.OrRequirement; -import net.runelite.client.plugins.achievementdiary.QuestRequirement; -import net.runelite.client.plugins.achievementdiary.SkillRequirement; - -public class WildernessDiaryRequirement extends GenericDiaryRequirement -{ - public WildernessDiaryRequirement() - { - // EASY - add("Cast Low Alchemy at the Fountain of Rune.", - new SkillRequirement(Skill.MAGIC, 21)); - add("Kill an Earth Warrior in the Wilderness beneath Edgeville.", - new SkillRequirement(Skill.AGILITY, 15)); - add("Mine some Iron ore in the Wilderness.", - new SkillRequirement(Skill.MINING, 15)); - add("Have the Mage of Zamorak teleport you to the Abyss.", - new QuestRequirement(Quest.ENTER_THE_ABYSS)); - - // MEDIUM - add("Mine some Mithril ore in the wilderness.", - new SkillRequirement(Skill.MINING, 55)); - add("Chop some yew logs from a fallen Ent.", - new SkillRequirement(Skill.WOODCUTTING, 61)); - add("Enter the Wilderness Godwars Dungeon.", - new OrRequirement( - new SkillRequirement(Skill.AGILITY, 60), - new SkillRequirement(Skill.STRENGTH, 60) - ) - ); - add("Complete a lap of the Wilderness Agility course.", - new SkillRequirement(Skill.AGILITY, 52)); - add("Charge an Earth Orb.", - new SkillRequirement(Skill.MAGIC, 60)); - add("Kill a Bloodveld in the Wilderness Godwars Dungeon.", - new SkillRequirement(Skill.SLAYER, 50)); - add("Smith a Golden helmet in the Resource Area.", - new SkillRequirement(Skill.SMITHING, 50), - new QuestRequirement(Quest.BETWEEN_A_ROCK, true)); - - // HARD - add("Cast one of the 3 God spells against another player in the Wilderness.", - new SkillRequirement(Skill.MAGIC, 60), - new QuestRequirement(Quest.THE_MAGE_ARENA)); - add("Charge an Air Orb.", - new SkillRequirement(Skill.MAGIC, 66)); - add("Catch a Black Salamander in the Wilderness.", - new SkillRequirement(Skill.HUNTER, 67)); - add("Smith an Adamant scimitar in the Resource Area.", - new SkillRequirement(Skill.SMITHING, 75)); - add("Take the agility shortcut from Trollheim into the Wilderness.", - new SkillRequirement(Skill.AGILITY, 64), - new QuestRequirement(Quest.DEATH_PLATEAU)); - add("Kill a Spiritual warrior in the Wilderness Godwars Dungeon.", - new SkillRequirement(Skill.SLAYER, 68)); - add("Fish some Raw Lava Eel in the Wilderness.", - new SkillRequirement(Skill.FISHING, 53)); - - // ELITE - add("Teleport to Ghorrock.", - new SkillRequirement(Skill.MAGIC, 96), - new QuestRequirement(Quest.DESERT_TREASURE)); - add("Fish and Cook a Dark Crab in the Resource Area.", - new SkillRequirement(Skill.FISHING, 85), - new SkillRequirement(Skill.COOKING, 90)); - add("Smith a rune scimitar from scratch in the Resource Area.", - new SkillRequirement(Skill.MINING, 85), - new SkillRequirement(Skill.SMITHING, 90)); - add("Steal from the Rogues' chest.", - new SkillRequirement(Skill.THIEVING, 84)); - add("Slay a spiritual mage inside the wilderness Godwars Dungeon.", - new SkillRequirement(Skill.SLAYER, 83), - new OrRequirement( - new SkillRequirement(Skill.AGILITY, 60), - new SkillRequirement(Skill.STRENGTH, 60) - ) - ); - add("Cut and burn some magic logs in the Resource Area.", - new SkillRequirement(Skill.WOODCUTTING, 75), - new SkillRequirement(Skill.FIREMAKING, 75)); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityArenaTimer.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityArenaTimer.java deleted file mode 100644 index b47abee85a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityArenaTimer.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2018, Alex Kolpa - * 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.agility; - -import java.awt.image.BufferedImage; -import java.time.temporal.ChronoUnit; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.ui.overlay.infobox.Timer; - -class AgilityArenaTimer extends Timer -{ - AgilityArenaTimer(Plugin plugin, BufferedImage image) - { - super(1, ChronoUnit.MINUTES, image, plugin); - setTooltip("Time left until location changes"); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityConfig.java deleted file mode 100644 index 60db4d7974..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityConfig.java +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (c) 2018, Cas - * 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.agility; - -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.ConfigTitleSection; -import net.runelite.client.config.Title; - -@ConfigGroup("agility") -public interface AgilityConfig extends Config -{ - @ConfigTitleSection( - keyName = "mainConfig", - position = 0, - name = "Main Config", - description = "" - ) - default Title mainConfig() - { - return new Title(); - } - - @ConfigItem( - keyName = "removeDistanceCap", - name = "Remove Distance Cap", - description = "This will remove the distance cap on rendering overlays for agility.", - warning = "
Enabling this setting on a low end machine may severely affect your fps." + - "
Click yes to enable this setting, knowing it might affect performance.
", - position = 0, - titleSection = "mainConfig" - ) - default boolean removeDistanceCap() - { - return false; - } - - @ConfigItem( - keyName = "showCourseClickboxes", - name = "Show course Clickboxes", - description = "Show agility course obstacle clickboxes", - position = 1 - ) - default boolean showCourseClickboxes() - { - return true; - } - - @ConfigItem( - keyName = "showLapCount", - name = "Show Lap Count", - description = "Enable/disable the lap counter", - position = 2, - titleSection = "mainConfig" - ) - default boolean showLapCount() - { - return true; - } - - @ConfigItem( - keyName = "lapTimeout", - name = "Hide Lap Count", - description = "Time in minutes until the lap counter hides/resets", - position = 3, - titleSection = "mainConfig", - hidden = true, - unhide = "showLapCount" - ) - default int lapTimeout() - { - return 5; - } - - @ConfigItem( - keyName = "lapsToLevel", - name = "Show Laps Until Level", - description = "Show number of laps remaining until next level is reached.", - position = 4, - titleSection = "mainConfig", - hidden = true, - unhide = "showLapCount" - ) - default boolean lapsToLevel() - { - return false; - } - - @ConfigItem( - keyName = "lapsToGoal", - name = "Show Laps Until Goal", - description = "Show number of laps remaining until experience tracker goal is reached", - position = 5, - titleSection = "mainConfig", - hidden = true, - unhide = "showLapCount" - ) - default boolean lapsToGoal() - { - return false; - } - - @ConfigItem( - keyName = "agilityArenaTimer", - name = "Agility Arena timer", - description = "Configures whether Agility Arena timer is displayed", - position = 6, - titleSection = "mainConfig" - ) - default boolean showAgilityArenaTimer() - { - return true; - } - - @ConfigItem( - keyName = "addLevelsToShortcutOptions", - name = "Show Shortcut Agility Reqs", - description = "Enable/disable showing shortcut agility level requirements in right-click options", - position = 7, - titleSection = "mainConfig" - ) - default boolean showShortcutLevel() - { - return false; - } - - @ConfigTitleSection( - keyName = "miscConfig", - position = 8, - name = "Misc Config", - description = "" - ) - default Title miscConfig() - { - return new Title(); - } - - @ConfigItem( - keyName = "highlightMarks", - name = "Highlight Marks of Grace", - description = "Enable/disable the highlighting of retrievable Marks of Grace", - position = 9, - titleSection = "miscConfig" - ) - default boolean highlightMarks() - { - return true; - } - - @ConfigItem( - keyName = "highlightShortcuts", - name = "Highlight Agility Shortcuts", - description = "Enable/disable the highlighting of Agility shortcuts", - position = 10, - titleSection = "miscConfig" - ) - default boolean highlightShortcuts() - { - return true; - } - - @ConfigItem( - keyName = "showTrapOverlay", - name = "Highlight Traps", - description = "Enable/disable the highlighting of traps on Agility courses", - position = 11, - titleSection = "miscConfig" - ) - default boolean showTrapOverlay() - { - return false; - } - - @ConfigItem( - keyName = "agilityArenaNotifier", - name = "Agility Arena notifier", - description = "Notify on ticket location change in Agility Arena", - position = 12, - titleSection = "miscConfig" - ) - default boolean notifyAgilityArena() - { - return false; - } - - @ConfigItem( - keyName = "overlayColor", - name = "Global Overlay Color", - description = "Color of Agility overlay", - position = 13, - titleSection = "miscConfig" - ) - default Color getOverlayColor() - { - return Color.GREEN; - } - - @ConfigItem( - keyName = "trapHighlight", - name = "Trap Overlay Color", - description = "Color of Agility trap overlay", - position = 14, - titleSection = "miscConfig", - hidden = true, - unhide = "showTrapOverlay" - ) - default Color getTrapColor() - { - return Color.RED; - } - - @ConfigItem( - keyName = "markHighlight", - name = "Mark Highlight Color", - description = "Color of highlighted Marks of Grace", - position = 15, - titleSection = "miscConfig", - hidden = true, - unhide = "highlightMarks" - ) - default Color getMarkColor() - { - return Color.RED; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java deleted file mode 100644 index 6068252da8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityOverlay.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * Copyright (c) 2018, Cas - * 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.agility; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.Shape; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Point; -import net.runelite.api.Tile; -import net.runelite.api.coords.LocalPoint; -import net.runelite.client.game.AgilityShortcut; -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; - -@Singleton -class AgilityOverlay extends Overlay -{ - private static final int MAX_DISTANCE = 2350; - private static final Color SHORTCUT_HIGH_LEVEL_COLOR = Color.ORANGE; - - private final Client client; - private final AgilityPlugin plugin; - - @Inject - private AgilityOverlay(final Client client, final AgilityPlugin plugin) - { - super(plugin); - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - LocalPoint playerLocation = client.getLocalPlayer().getLocalLocation(); - Point mousePosition = client.getMouseCanvasPosition(); - final List marksOfGrace = plugin.getMarksOfGrace(); - plugin.getObstacles().forEach((object, obstacle) -> - { - if (Obstacles.SHORTCUT_OBSTACLE_IDS.containsKey(object.getId()) && !plugin.isHighlightShortcuts() || - Obstacles.TRAP_OBSTACLE_IDS.contains(object.getId()) && !plugin.isShowTrapOverlay() || - Obstacles.COURSE_OBSTACLE_IDS.contains(object.getId()) && !plugin.isShowCourseClickboxes()) - { - return; - } - - Tile tile = obstacle.getTile(); - - if (tile.getPlane() == client.getPlane() && checkDistance(object.getLocalLocation(), playerLocation)) - { - // This assumes that the obstacle is not clickable. - if (Obstacles.TRAP_OBSTACLE_IDS.contains(object.getId())) - { - Polygon polygon = object.getCanvasTilePoly(); - if (polygon != null) - { - OverlayUtil.renderPolygon(graphics, polygon, plugin.getTrapColor()); - } - return; - } - Shape objectClickbox = object.getClickbox(); - if (objectClickbox != null) - { - AgilityShortcut agilityShortcut = obstacle.getShortcut(); - Color configColor = agilityShortcut == null || agilityShortcut.getLevel() <= plugin.getAgilityLevel() ? plugin.getOverlayColor() : SHORTCUT_HIGH_LEVEL_COLOR; - if (plugin.isHighlightMarks() && !marksOfGrace.isEmpty()) - { - configColor = plugin.getMarkColor(); - } - - OverlayUtil.renderClickBox(graphics, mousePosition, objectClickbox, configColor); - } - } - - }); - - if (plugin.isHighlightMarks() && !marksOfGrace.isEmpty()) - { - for (Tile markOfGraceTile : marksOfGrace) - { - if (markOfGraceTile.getPlane() == client.getPlane() && markOfGraceTile.getItemLayer() != null - && checkDistance(markOfGraceTile.getLocalLocation(), playerLocation)) - { - final Polygon poly = markOfGraceTile.getItemLayer().getCanvasTilePoly(); - - if (poly == null) - { - continue; - } - - OverlayUtil.renderPolygon(graphics, poly, plugin.getMarkColor()); - } - } - } - - return null; - } - - private boolean checkDistance(LocalPoint localPoint, LocalPoint playerPoint) - { - if (plugin.isRemoveDistanceCap()) - { - return true; - } - return localPoint.distanceTo(playerPoint) < MAX_DISTANCE; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityPlugin.java deleted file mode 100644 index 5520c0b583..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilityPlugin.java +++ /dev/null @@ -1,569 +0,0 @@ -/* - * Copyright (c) 2018, 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.agility; - -import com.google.common.primitives.Ints; -import com.google.inject.Provides; -import java.awt.Color; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.ItemID; -import static net.runelite.api.ItemID.AGILITY_ARENA_TICKET; -import net.runelite.api.MenuEntry; -import net.runelite.api.MenuOpcode; -import net.runelite.api.Player; -import net.runelite.api.Skill; -import static net.runelite.api.Skill.AGILITY; -import net.runelite.api.Tile; -import net.runelite.api.TileItem; -import net.runelite.api.TileObject; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.BeforeRender; -import net.runelite.api.events.DecorativeObjectChanged; -import net.runelite.api.events.DecorativeObjectDespawned; -import net.runelite.api.events.DecorativeObjectSpawned; -import net.runelite.api.events.GameObjectChanged; -import net.runelite.api.events.GameObjectDespawned; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.GroundObjectChanged; -import net.runelite.api.events.GroundObjectDespawned; -import net.runelite.api.events.GroundObjectSpawned; -import net.runelite.api.events.ItemDespawned; -import net.runelite.api.events.ItemSpawned; -import net.runelite.api.events.MenuOpened; -import net.runelite.api.events.StatChanged; -import net.runelite.api.events.WallObjectChanged; -import net.runelite.api.events.WallObjectDespawned; -import net.runelite.api.events.WallObjectSpawned; -import net.runelite.client.Notifier; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.AgilityShortcut; -import net.runelite.client.game.ItemManager; -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.ui.overlay.infobox.InfoBoxManager; -import net.runelite.client.util.ColorUtil; - -@PluginDescriptor( - name = "Agility", - description = "Show helpful information about agility courses and obstacles", - tags = {"grace", "marks", "overlay", "shortcuts", "skilling", "traps"}, - type = PluginType.SKILLING -) -@Slf4j -@Singleton -public class AgilityPlugin extends Plugin -{ - private static final int AGILITY_ARENA_REGION_ID = 11157; - private static final Object MENU_SUBS = new Object(); - - @Getter(AccessLevel.PACKAGE) - private final Map obstacles = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private final List marksOfGrace = new ArrayList<>(); - - @Inject - private OverlayManager overlayManager; - - @Inject - private AgilityOverlay agilityOverlay; - - @Inject - private LapCounterOverlay lapCounterOverlay; - - @Inject - private Notifier notifier; - - @Inject - private Client client; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private AgilityConfig config; - - @Inject - private ItemManager itemManager; - - @Inject - private EventBus eventBus; - - @Getter(AccessLevel.PACKAGE) - private AgilitySession session; - - private int lastAgilityXp; - private WorldPoint lastArenaTicketPosition; - - @Getter(AccessLevel.PACKAGE) - private int agilityLevel; - - // Config values - @Getter(AccessLevel.PACKAGE) - private boolean removeDistanceCap; - @Getter(AccessLevel.PACKAGE) - private boolean showCourseClickboxes; - @Getter(AccessLevel.PACKAGE) - private boolean showLapCount; - @Getter(AccessLevel.PACKAGE) - private int lapTimeout; - @Getter(AccessLevel.PACKAGE) - private boolean lapsToLevel; - @Getter(AccessLevel.PACKAGE) - private boolean lapsToGoal; - @Getter(AccessLevel.PACKAGE) - private Color overlayColor; - @Getter(AccessLevel.PACKAGE) - private boolean highlightMarks; - @Getter(AccessLevel.PACKAGE) - private Color markColor; - @Getter(AccessLevel.PACKAGE) - private boolean highlightShortcuts; - @Getter(AccessLevel.PACKAGE) - private boolean showTrapOverlay; - @Getter(AccessLevel.PACKAGE) - private Color trapColor; - private boolean notifyAgilityArena; - private boolean showAgilityArenaTimer; - - @Provides - AgilityConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(AgilityConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - if (config.showShortcutLevel()) - { - addMenuSubscriptions(); - } - - overlayManager.add(agilityOverlay); - overlayManager.add(lapCounterOverlay); - agilityLevel = client.getBoostedSkillLevel(Skill.AGILITY); - } - - @Override - protected void shutDown() - { - eventBus.unregister(MENU_SUBS); - - overlayManager.remove(agilityOverlay); - overlayManager.remove(lapCounterOverlay); - marksOfGrace.clear(); - obstacles.clear(); - session = null; - agilityLevel = 0; - } - - private void addMenuSubscriptions() - { - eventBus.subscribe(BeforeRender.class, MENU_SUBS, this::onBeforeRender); - eventBus.subscribe(MenuOpened.class, MENU_SUBS, this::onMenuOpened); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - switch (event.getGameState()) - { - case HOPPING: - case LOGIN_SCREEN: - session = null; - lastArenaTicketPosition = null; - removeAgilityArenaTimer(); - break; - case LOADING: - marksOfGrace.clear(); - obstacles.clear(); - break; - case LOGGED_IN: - if (!isInAgilityArena()) - { - lastArenaTicketPosition = null; - removeAgilityArenaTimer(); - } - break; - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("agility")) - { - return; - } - - if ("addLevelsToShortcutOptions".equals(event.getKey())) - { - if (config.showShortcutLevel()) - { - addMenuSubscriptions(); - } - else - { - eventBus.unregister(MENU_SUBS); - } - return; - } - - updateConfig(); - - if (!this.showAgilityArenaTimer) - { - removeAgilityArenaTimer(); - } - } - - private void updateConfig() - { - this.removeDistanceCap = config.removeDistanceCap(); - this.showCourseClickboxes = config.showCourseClickboxes(); - this.showLapCount = config.showLapCount(); - this.lapTimeout = config.lapTimeout(); - this.lapsToLevel = config.lapsToLevel(); - this.lapsToGoal = config.lapsToGoal(); - this.overlayColor = config.getOverlayColor(); - this.highlightMarks = config.highlightMarks(); - this.markColor = config.getMarkColor(); - this.highlightShortcuts = config.highlightShortcuts(); - this.showTrapOverlay = config.showTrapOverlay(); - this.trapColor = config.getTrapColor(); - this.notifyAgilityArena = config.notifyAgilityArena(); - this.showAgilityArenaTimer = config.showAgilityArenaTimer(); - } - - @Subscribe - public void onStatChanged(StatChanged statChanged) - { - if (statChanged.getSkill() != AGILITY) - { - return; - } - - agilityLevel = statChanged.getBoostedLevel(); - - if (!this.showLapCount) - { - return; - } - - // Determine how much EXP was actually gained - int agilityXp = client.getSkillExperience(AGILITY); - int skillGained = agilityXp - lastAgilityXp; - lastAgilityXp = agilityXp; - - // Get course - Courses course = Courses.getCourse(client.getLocalPlayer().getWorldLocation().getRegionID()); - if (course == null - || (course.getCourseEndWorldPoints().length == 0 - ? Math.abs(course.getLastObstacleXp() - skillGained) > 1 - : Arrays.stream(course.getCourseEndWorldPoints()).noneMatch(wp -> wp.equals(client.getLocalPlayer().getWorldLocation())))) - { - return; - } - - if (session != null && session.getCourse() == course) - { - session.incrementLapCount(client); - } - else - { - session = new AgilitySession(course); - // New course found, reset lap count and set new course - session.resetLapCount(); - session.incrementLapCount(client); - } - } - - @Subscribe - private void onItemSpawned(ItemSpawned itemSpawned) - { - if (obstacles.isEmpty()) - { - return; - } - - final TileItem item = itemSpawned.getItem(); - final Tile tile = itemSpawned.getTile(); - - if (item.getId() == ItemID.MARK_OF_GRACE) - { - marksOfGrace.add(tile); - } - } - - @Subscribe - private void onItemDespawned(ItemDespawned itemDespawned) - { - final Tile tile = itemDespawned.getTile(); - marksOfGrace.remove(tile); - } - - @Subscribe - private void onGameTick(GameTick tick) - { - if (isInAgilityArena()) - { - // Hint arrow has no plane, and always returns the current plane - WorldPoint newTicketPosition = client.getHintArrowPoint(); - WorldPoint oldTickPosition = lastArenaTicketPosition; - - lastArenaTicketPosition = newTicketPosition; - - if (oldTickPosition != null && newTicketPosition != null - && (oldTickPosition.getX() != newTicketPosition.getX() || oldTickPosition.getY() != newTicketPosition.getY())) - { - log.debug("Ticked position moved from {} to {}", oldTickPosition, newTicketPosition); - - if (this.notifyAgilityArena) - { - notifier.notify("Ticket location changed"); - } - - if (this.showAgilityArenaTimer) - { - showNewAgilityArenaTimer(); - } - } - } - } - - private boolean isInAgilityArena() - { - Player local = client.getLocalPlayer(); - if (local == null) - { - return false; - } - - WorldPoint location = local.getWorldLocation(); - return location.getRegionID() == AGILITY_ARENA_REGION_ID; - } - - private void removeAgilityArenaTimer() - { - infoBoxManager.removeIf(infoBox -> infoBox instanceof AgilityArenaTimer); - } - - private void showNewAgilityArenaTimer() - { - removeAgilityArenaTimer(); - infoBoxManager.addInfoBox(new AgilityArenaTimer(this, itemManager.getImage(AGILITY_ARENA_TICKET))); - } - - @Subscribe - private void onGameObjectSpawned(GameObjectSpawned event) - { - onTileObject(event.getTile(), null, event.getGameObject()); - } - - @Subscribe - private void onGameObjectChanged(GameObjectChanged event) - { - onTileObject(event.getTile(), event.getPrevious(), event.getGameObject()); - } - - @Subscribe - private void onGameObjectDespawned(GameObjectDespawned event) - { - onTileObject(event.getTile(), event.getGameObject(), null); - } - - @Subscribe - private void onGroundObjectSpawned(GroundObjectSpawned event) - { - onTileObject(event.getTile(), null, event.getGroundObject()); - } - - @Subscribe - private void onGroundObjectChanged(GroundObjectChanged event) - { - onTileObject(event.getTile(), event.getPrevious(), event.getGroundObject()); - } - - @Subscribe - private void onGroundObjectDespawned(GroundObjectDespawned event) - { - onTileObject(event.getTile(), event.getGroundObject(), null); - } - - @Subscribe - private void onWallObjectSpawned(WallObjectSpawned event) - { - onTileObject(event.getTile(), null, event.getWallObject()); - } - - @Subscribe - private void onWallObjectChanged(WallObjectChanged event) - { - onTileObject(event.getTile(), event.getPrevious(), event.getWallObject()); - } - - @Subscribe - private void onWallObjectDespawned(WallObjectDespawned event) - { - onTileObject(event.getTile(), event.getWallObject(), null); - } - - @Subscribe - private void onDecorativeObjectSpawned(DecorativeObjectSpawned event) - { - onTileObject(event.getTile(), null, event.getDecorativeObject()); - } - - @Subscribe - private void onDecorativeObjectChanged(DecorativeObjectChanged event) - { - onTileObject(event.getTile(), event.getPrevious(), event.getDecorativeObject()); - } - - @Subscribe - private void onDecorativeObjectDespawned(DecorativeObjectDespawned event) - { - onTileObject(event.getTile(), event.getDecorativeObject(), null); - } - - private void onTileObject(Tile tile, TileObject oldObject, TileObject newObject) - { - obstacles.remove(oldObject); - - if (newObject == null) - { - return; - } - - if (Obstacles.COURSE_OBSTACLE_IDS.contains(newObject.getId()) || - (Obstacles.TRAP_OBSTACLE_IDS.contains(newObject.getId()) - && Obstacles.TRAP_OBSTACLE_REGIONS.contains(newObject.getWorldLocation().getRegionID()))) - { - obstacles.put(newObject, new Obstacle(tile, null)); - } - - if (Obstacles.SHORTCUT_OBSTACLE_IDS.containsKey(newObject.getId())) - { - AgilityShortcut closestShortcut = null; - int distance = -1; - - // Find the closest shortcut to this object - for (AgilityShortcut shortcut : Obstacles.SHORTCUT_OBSTACLE_IDS.get(newObject.getId())) - { - if (shortcut.getWorldLocation() == null) - { - closestShortcut = shortcut; - break; - } - else - { - int newDistance = shortcut.getWorldLocation().distanceTo2D(newObject.getWorldLocation()); - if (closestShortcut == null || newDistance < distance) - { - closestShortcut = shortcut; - distance = newDistance; - } - } - } - - if (closestShortcut != null) - { - obstacles.put(newObject, new Obstacle(tile, closestShortcut)); - } - } - } - - private void onBeforeRender(BeforeRender event) - { - if (client.isMenuOpen() || client.getMenuOptionCount() <= 0) - { - return; - } - - final MenuEntry entry = client.getLeftClickMenuEntry(); - if (checkAndModify(entry)) - { - client.setLeftClickMenuEntry(entry); - } - } - - private void onMenuOpened(MenuOpened event) - { - boolean changed = false; - for (MenuEntry entry : event.getMenuEntries()) - { - changed |= checkAndModify(entry); - } - - if (changed) - { - event.setModified(); - } - } - - private boolean checkAndModify(MenuEntry old) - { - //Guarding against non-first option because agility shortcuts are always that type of event. - if (old.getOpcode() != MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId()) - { - return false; - } - - for (Obstacle nearbyObstacle : getObstacles().values()) - { - AgilityShortcut shortcut = nearbyObstacle.getShortcut(); - if (shortcut != null && Ints.contains(shortcut.getObstacleIds(), old.getIdentifier())) - { - final int reqLevel = shortcut.getLevel(); - final String requirementText = ColorUtil.getLevelColorString(reqLevel, getAgilityLevel()) + " (level-" + reqLevel + ")"; - - old.setTarget(old.getTarget() + requirementText); - return true; - } - } - - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilitySession.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilitySession.java deleted file mode 100644 index 116f5725b6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/AgilitySession.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.agility; - -import java.time.Instant; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.Client; -import net.runelite.api.Experience; -import net.runelite.api.Skill; -import net.runelite.api.VarPlayer; - -@Getter(AccessLevel.PACKAGE) -@Setter(AccessLevel.PACKAGE) -class AgilitySession -{ - private final Courses course; - private Instant lastLapCompleted; - private int totalLaps; - private int lapsTillLevel; - private int lapsTillGoal; - - AgilitySession(final Courses course) - { - this.course = course; - } - - void incrementLapCount(Client client) - { - lastLapCompleted = Instant.now(); - ++totalLaps; - - int currentExp = client.getSkillExperience(Skill.AGILITY); - int nextLevel = client.getRealSkillLevel(Skill.AGILITY) + 1; - - int remainingXp; - do - { - remainingXp = nextLevel <= Experience.MAX_VIRT_LEVEL ? Experience.getXpForLevel(nextLevel) - currentExp : 0; - nextLevel++; - } while (remainingXp < 0); - - lapsTillLevel = remainingXp > 0 ? (int) Math.ceil(remainingXp / course.getTotalXp()) : 0; - int goalRemainingXp = client.getVar(VarPlayer.AGILITY_GOAL_END) - currentExp; - lapsTillGoal = goalRemainingXp > 0 ? (int) Math.ceil(goalRemainingXp / course.getTotalXp()) : 0; - } - - void resetLapCount() - { - totalLaps = 0; - lapsTillLevel = 0; - lapsTillGoal = 0; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/Courses.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/Courses.java deleted file mode 100644 index 5c1484101d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/Courses.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.agility; - -import com.google.common.collect.ImmutableMap; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.coords.WorldPoint; - -enum Courses -{ - GNOME(86.5, 46, 9781), - DRAYNOR(120.0, 79, 12338), - AL_KHARID(180.0, 30, 13105, new WorldPoint(3299, 3194, 0)), - PYRAMID(722.0, 300, 13356, new WorldPoint(3364, 2830, 0)), - VARROCK(238.0, 125, 12853), - PENGUIN(540.0, 65, 10559), - BARBARIAN(139.5, 60, 10039), - CANIFIS(240.0, 175, 13878), - APE_ATOLL(580.0, 300, 11050), - FALADOR(440, 180, 12084), - WILDERNESS(571.0, 499, 11837), - WEREWOLF(730.0, 380, 14234), - SEERS(570.0, 435, 10806), - POLLNIVNEACH(890.0, 540, 13358), - RELLEKA(780.0, 475, 10553), - PRIFDDINAS(1337.0, 1037, 12895), - ARDOUGNE(793.0, 529, 10547); - - private final static Map coursesByRegion; - - @Getter(AccessLevel.PACKAGE) - private final double totalXp; - - @Getter(AccessLevel.PACKAGE) - private final int lastObstacleXp; - - @Getter(AccessLevel.PACKAGE) - private final int regionId; - - @Getter(AccessLevel.PACKAGE) - private final WorldPoint[] courseEndWorldPoints; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (Courses course : values()) - { - builder.put(course.regionId, course); - } - - coursesByRegion = builder.build(); - } - - Courses(double totalXp, int lastObstacleXp, int regionId, WorldPoint... courseEndWorldPoints) - { - this.totalXp = totalXp; - this.lastObstacleXp = lastObstacleXp; - this.regionId = regionId; - this.courseEndWorldPoints = courseEndWorldPoints; - } - - static Courses getCourse(int regionId) - { - return coursesByRegion.get(regionId); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/LapCounterOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/LapCounterOverlay.java deleted file mode 100644 index ab0f7e9a67..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/LapCounterOverlay.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.agility; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.time.Duration; -import java.time.Instant; -import javax.inject.Inject; -import javax.inject.Singleton; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -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; -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; - -@Singleton -class LapCounterOverlay extends Overlay -{ - private final AgilityPlugin plugin; - - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - private LapCounterOverlay(final AgilityPlugin plugin) - { - super(plugin); - setPosition(OverlayPosition.TOP_LEFT); - setPriority(OverlayPriority.LOW); - this.plugin = plugin; - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Agility overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - AgilitySession session = plugin.getSession(); - - if (!plugin.isShowLapCount() || - session == null || - session.getLastLapCompleted() == null || - session.getCourse() == null) - { - return null; - } - - Duration lapTimeout = Duration.ofMinutes(plugin.getLapTimeout()); - Duration sinceLap = Duration.between(session.getLastLapCompleted(), Instant.now()); - - if (sinceLap.compareTo(lapTimeout) >= 0) - { - // timeout session - session.setLastLapCompleted(null); - return null; - } - - panelComponent.getChildren().clear(); - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - tableComponent.addRow("Total Laps:", Integer.toString(session.getTotalLaps())); - - if (plugin.isLapsToLevel() && session.getLapsTillLevel() > 0) - { - tableComponent.addRow("Laps until level:", Integer.toString(session.getLapsTillLevel())); - } - - if (plugin.isLapsToGoal() && session.getLapsTillGoal() > 0) - { - tableComponent.addRow("Laps until goal:", Integer.toString(session.getLapsTillGoal())); - } - - panelComponent.getChildren().add(tableComponent); - - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/Obstacle.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/Obstacle.java deleted file mode 100644 index 6038de468b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/Obstacle.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2019, MrGroggle - * 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.client.plugins.agility; - -import javax.annotation.Nullable; -import lombok.AllArgsConstructor; -import lombok.Value; -import net.runelite.api.Tile; -import net.runelite.client.game.AgilityShortcut; - -@Value -@AllArgsConstructor -class Obstacle -{ - private final Tile tile; - @Nullable - private final AgilityShortcut shortcut; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/agility/Obstacles.java b/runelite-client/src/main/java/net/runelite/client/plugins/agility/Obstacles.java deleted file mode 100644 index edd06acee7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/agility/Obstacles.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2018, SomeoneWithAnInternetConnection - * 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.agility; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Multimap; -import java.util.List; -import java.util.Set; -import static net.runelite.api.NullObjectID.*; -import static net.runelite.api.ObjectID.*; -import net.runelite.client.game.AgilityShortcut; - -class Obstacles -{ - static final Set COURSE_OBSTACLE_IDS = ImmutableSet.of( - // Gnome - OBSTACLE_NET_23134, TREE_BRANCH_23559, TREE_BRANCH_23560, OBSTACLE_NET_23135, OBSTACLE_PIPE_23138, - OBSTACLE_PIPE_23139, LOG_BALANCE_23145, BALANCING_ROPE_23557, - // Brimhaven - PLANK_3572, PLANK_3571, PLANK_3570, ROPE_SWING, PILLAR_3578, LOW_WALL, LOG_BALANCE, LOG_BALANCE_3557, - BALANCING_LEDGE_3561, BALANCING_LEDGE, MONKEY_BARS_3564, BALANCING_ROPE, HAND_HOLDS_3583, - // Draynor - ROUGH_WALL, TIGHTROPE, TIGHTROPE_11406, NARROW_WALL, WALL_11630, GAP_11631, CRATE_11632, STILE_7527, - // Al-Kharid - ROUGH_WALL_11633, TIGHTROPE_14398, CABLE, ZIP_LINE_14403, TROPICAL_TREE_14404, ROOF_TOP_BEAMS, - TIGHTROPE_14409, GAP_14399, - // Pyramid - STAIRS_10857, LOW_WALL_10865, LEDGE_10860, PLANK_10868, GAP_10882, LEDGE_10886, STAIRS_10857, GAP_10884, - GAP_10859, GAP_10861, LOW_WALL_10865, GAP_10859, LEDGE_10888, PLANK_10868, CLIMBING_ROCKS_10851, DOORWAY_10855, - // Varrock - ROUGH_WALL_14412, CLOTHES_LINE, GAP_14414, WALL_14832, GAP_14833, GAP_14834, GAP_14835, LEDGE_14836, EDGE, - // Penguin - STEPPING_STONE_21120, STEPPING_STONE_21126, STEPPING_STONE_21128, STEPPING_STONE_21129, - STEPPING_STONE_21130, STEPPING_STONE_21131, STEPPING_STONE_21132, STEPPING_STONE_21133, - ICICLES, ICE, ICE_21149, ICE_21150, ICE_21151, ICE_21152, ICE_21153, ICE_21154, ICE_21155, ICE_21156, - // Barbarian - ROPESWING_23131, LOG_BALANCE_23144, OBSTACLE_NET_20211, BALANCING_LEDGE_23547, LADDER_16682, CRUMBLING_WALL_1948, - // Canifis - TALL_TREE_14843, GAP_14844, GAP_14845, GAP_14848, GAP_14846, POLEVAULT, GAP_14847, GAP_14897, - // Ape atoll - STEPPING_STONE_15412, TROPICAL_TREE_15414, MONKEYBARS_15417, SKULL_SLOPE_15483, ROPE_15487, TROPICAL_TREE_16062, - // Falador - ROUGH_WALL_14898, TIGHTROPE_14899, HAND_HOLDS_14901, GAP_14903, GAP_14904, TIGHTROPE_14905, - TIGHTROPE_14911, GAP_14919, LEDGE_14920, LEDGE_14921, LEDGE_14922, LEDGE_14923, LEDGE_14924, EDGE_14925, - // Wilderness - OBSTACLE_PIPE_23137, ROPESWING_23132, STEPPING_STONE_23556, LOG_BALANCE_23542, ROCKS_23640, - // Seers - WALL_14927, GAP_14928, TIGHTROPE_14932, GAP_14929, GAP_14930, EDGE_14931, - // Dorgesh-Kaan - CABLE_22569, CABLE_22572, LADDER_22564, JUTTING_WALL_22552, TUNNEL_22557, PYLON_22664, - CONSOLE, BOILER_22635, STAIRS_22650, STAIRS_22651, STAIRS_22609, STAIRS_22608, - // Pollniveach - BASKET_14935, MARKET_STALL_14936, BANNER_14937, GAP_14938, TREE_14939, ROUGH_WALL_14940, - MONKEYBARS, TREE_14944, DRYING_LINE, - // Rellaka - ROUGH_WALL_14946, GAP_14947, TIGHTROPE_14987, GAP_14990, GAP_14991, TIGHTROPE_14992, PILE_OF_FISH, - // Ardougne - WOODEN_BEAMS, GAP_15609, PLANK_26635, GAP_15610, GAP_15611, STEEP_ROOF, GAP_15612, - // Meiyerditch - NULL_12945, ROCK_17958, ROCK_17959, ROCK_17960, BOAT_17961, NULL_18122, NULL_18124, WALL_RUBBLE, - WALL_RUBBLE_18038, FLOORBOARDS, FLOORBOARDS_18071, FLOORBOARDS_18072, FLOORBOARDS_18073, NULL_18129, NULL_18130, - WALL_18078, NULL_18132, NULL_18133, NULL_18083, TUNNEL_18085, SHELF_18086, SHELF_18087, WALL_18088, - FLOORBOARDS_18089, FLOORBOARDS_18090, DOOR_18091, FLOORBOARDS_18093, FLOORBOARDS_18094, SHELF_18095, - SHELF_18096, FLOORBOARDS_18097, FLOORBOARDS_18098, WASHING_LINE_18099, WASHING_LINE_18100, - NULL_18135, NULL_18136, SHELF_18105, SHELF_18106, SHELF_18107, SHELF_18108, FLOORBOARDS_18109, - FLOORBOARDS_18110, FLOORBOARDS_18112, FLOORBOARDS_18111, FLOORBOARDS_18114, FLOORBOARDS_18113, - NULL_18116, FLOORBOARDS_18117, FLOORBOARDS_18118, STAIRS_DOWN, WALL_17980, - // Werewolf - STEPPING_STONE_11643, HURDLE, HURDLE_11639, HURDLE_11640, PIPE_11657, SKULL_SLOPE, ZIP_LINE, - ZIP_LINE_11645, ZIP_LINE_11646, - // Prifddinas - LADDER_36221, TIGHTROPE_36225, CHIMNEY_36227, ROOF_EDGE, DARK_HOLE_36229, LADDER_36231, LADDER_36232, - ROPE_BRIDGE_36233, TIGHTROPE_36234, ROPE_BRIDGE_36235, TIGHTROPE_36236, TIGHTROPE_36237, DARK_HOLE_36238, - // Prifddinas portals - NULL_36241, NULL_36242, NULL_36243, NULL_36244, NULL_36245, NULL_36246 - ); - - static final Multimap SHORTCUT_OBSTACLE_IDS; - - static final Set TRAP_OBSTACLE_IDS = ImmutableSet.of( - // Agility pyramid - NULL_3550, NULL_10872, NULL_10873 - ); - - static final List TRAP_OBSTACLE_REGIONS = ImmutableList.of(12105, 13356); - - static - { - final ImmutableMultimap.Builder builder = ImmutableMultimap.builder(); - for (final AgilityShortcut item : AgilityShortcut.values()) - { - for (int obstacle : item.getObstacleIds()) - { - builder.put(obstacle, item); - } - } - SHORTCUT_OBSTACLE_IDS = builder.build(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/alchemicalhydra/AlchemicalHydra.java b/runelite-client/src/main/java/net/runelite/client/plugins/alchemicalhydra/AlchemicalHydra.java deleted file mode 100644 index 97782f5c8a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/alchemicalhydra/AlchemicalHydra.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2019, Lucas - * 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.alchemicalhydra; - -import java.awt.image.BufferedImage; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; -import net.runelite.api.NPC; -import net.runelite.api.Prayer; -import net.runelite.api.ProjectileID; -import net.runelite.api.SpriteID; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.util.ImageUtil; - -@Getter(AccessLevel.PACKAGE) -@RequiredArgsConstructor -@Singleton -class AlchemicalHydra -{ - @Getter(AccessLevel.PACKAGE) - @RequiredArgsConstructor - enum AttackStyle - { - MAGIC(ProjectileID.HYDRA_MAGIC, Prayer.PROTECT_FROM_MAGIC, SpriteID.PRAYER_PROTECT_FROM_MAGIC), - RANGED(ProjectileID.HYDRA_RANGED, Prayer.PROTECT_FROM_MISSILES, SpriteID.PRAYER_PROTECT_FROM_MISSILES); - - private final int projectileID; - private final Prayer prayer; - private final int spriteID; - - @Getter(AccessLevel.NONE) - private BufferedImage image; - - BufferedImage getImage(SpriteManager spriteManager) - { - if (image == null) - { - BufferedImage tmp = spriteManager.getSprite(spriteID, 0); - image = tmp == null ? null : ImageUtil.resizeImage(tmp, AlchemicalHydraOverlay.IMGSIZE, AlchemicalHydraOverlay.IMGSIZE); - } - - return image; - } - } - - private final NPC npc; - - private AlchemicalHydraPhase phase = AlchemicalHydraPhase.ONE; - - private int attackCount = 0; - private int nextSwitch = phase.getAttacksPerSwitch(); - - @Setter(AccessLevel.PACKAGE) - private int nextSpecial = 3; - - private AttackStyle nextAttack = AttackStyle.MAGIC; - private AttackStyle lastAttack = AttackStyle.MAGIC; - - @Setter(AccessLevel.PACKAGE) - private boolean weakened = false; - - void changePhase(AlchemicalHydraPhase newPhase) - { - phase = newPhase; - nextSpecial = 3; - attackCount = 0; - weakened = false; - - if (newPhase == AlchemicalHydraPhase.FOUR) - { - weakened = true; - switchStyles(); - nextSwitch = phase.getAttacksPerSwitch(); - } - } - - private void switchStyles() - { - nextAttack = lastAttack == AlchemicalHydra.AttackStyle.MAGIC - ? AlchemicalHydra.AttackStyle.RANGED - : AlchemicalHydra.AttackStyle.MAGIC; - } - - void handleAttack(int id) - { - if (id != nextAttack.getProjectileID()) - { - if (id == lastAttack.getProjectileID()) - { - // If the current attack isn't what was expected and we accidentally counted 1 too much - return; - } - - // If the current attack isn't what was expected and we should have switched prayers - switchStyles(); - nextSwitch = phase.getAttacksPerSwitch() - 1; - } - else - { - nextSwitch--; - } - - lastAttack = nextAttack; - attackCount++; - - if (nextSwitch <= 0) - { - switchStyles(); - nextSwitch = phase.getAttacksPerSwitch(); - } - } - - int getNextSpecialRelative() - { - return nextSpecial - attackCount; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/alchemicalhydra/AlchemicalHydraConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/alchemicalhydra/AlchemicalHydraConfig.java deleted file mode 100644 index 90ac1350cb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/alchemicalhydra/AlchemicalHydraConfig.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2019, Lucas - * 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.alchemicalhydra; - -import java.awt.Color; -import net.runelite.client.config.Alpha; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigSection; - -@ConfigGroup("betterHydra") -public interface AlchemicalHydraConfig extends Config -{ - @ConfigSection( - keyName = "features", - name = "Features", - description = "Feathers. Jk, features", - position = 0 - ) - default boolean features() - { - return true; - } - - @ConfigItem( - keyName = "counting", - name = "Prayer helper", - description = "Basically everything this plugin is known for. Also has attacks between specs and poison overlay. Shouldn't NOT use this tbh", - position = 1, - section = "features" - ) - default boolean counting() - { - return true; - } - - @ConfigItem( - keyName = "fountain", - name = "Fountain helper", - description = "Indicates if hydra is on a fountain", - position = 2, - section = "features" - ) - default boolean fountain() - { - return true; - } - - @ConfigItem( - keyName = "stun", - name = "Stun timer", - description = "Shows when you can walk in fire phase", - position = 3, - section = "features" - ) - default boolean stun() - { - return false; - } - - @ConfigSection( - keyName = "colours", - name = "Colours", - description = "colours...", - position = 2 - ) - default boolean colours() - { - return false; - } - - @Alpha - @ConfigItem( - keyName = "safeCol", - name = "Safe colour", - description = "Colour overlay will be when there's >2 attacks left", - position = 1, - section = "colours" - ) - default Color safeCol() - { - return new Color(0, 156, 0, 156); - } - - @Alpha - @ConfigItem( - keyName = "medCol", - name = "Medium colour", - description = "Colour overlay will be when a input is coming up", - position = 2, - section = "colours" - ) - default Color medCol() - { - return new Color(200, 156, 0, 156); - } - - @Alpha - @ConfigItem( - keyName = "badCol", - name = "Bad colour", - description = "Colour overlay will be when you have to do something NOW", - position = 3, - section = "colours" - ) - default Color badCol() - { - return new Color(156, 0, 0, 156); - } - - @Alpha - @ConfigItem( - keyName = "poisonBorderCol", - name = "Poison border colour", - description = "Colour the edges of the area highlighted by poison special will be", - position = 4, - section = "colours" - ) - default Color poisonBorderCol() - { - return new Color(255, 0, 0, 100); - } - - @Alpha - @ConfigItem( - keyName = "poisonCol", - name = "Poison colour", - description = "Colour the fill of the area highlighted by poison special will be", - position = 5, - section = "colours" - ) - default Color poisonCol() - { - return new Color(255, 0, 0, 50); - } - - @Alpha - @ConfigItem( - keyName = "fountainColA", - name = "Fountain colour (not on top)", - description = "Fountain colour (not on top)", - position = 6, - section = "colours" - ) - default Color fountainColA() - { - return new Color(255, 0, 0, 100); - } - - @Alpha - @ConfigItem( - keyName = "fountainColB", - name = "Fountain colour (on top)", - description = "Fountain colour (on top)", - position = 7, - section = "colours" - ) - default Color fountainColB() - { - return new Color(0, 255, 0, 100); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/alchemicalhydra/AlchemicalHydraOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/alchemicalhydra/AlchemicalHydraOverlay.java deleted file mode 100644 index e844f897b3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/alchemicalhydra/AlchemicalHydraOverlay.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright (c) 2019, Lucas - * 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.alchemicalhydra; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Setter; -import net.runelite.api.Client; -import net.runelite.api.IndexDataBase; -import net.runelite.api.Prayer; -import net.runelite.api.Sprite; -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.ComponentOrientation; -import net.runelite.client.ui.overlay.components.InfoBoxComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.util.ImageUtil; - -@Singleton -class AlchemicalHydraOverlay extends Overlay -{ - static final int IMGSIZE = 36; - - private final AlchemicalHydraPlugin plugin; - private final Client client; - private final SpriteManager spriteManager; - private final PanelComponent panelComponent = new PanelComponent(); - - private BufferedImage stunImg; - - @Setter(AccessLevel.PACKAGE) - private Color safeCol; - - @Setter(AccessLevel.PACKAGE) - private Color medCol; - - @Setter(AccessLevel.PACKAGE) - private Color badCol; - - @Setter(AccessLevel.PACKAGE) - private int stunTicks; - - @Inject - AlchemicalHydraOverlay(final AlchemicalHydraPlugin plugin, final Client client, final SpriteManager spriteManager) - { - this.plugin = plugin; - this.client = client; - this.spriteManager = spriteManager; - this.setPosition(OverlayPosition.BOTTOM_RIGHT); - panelComponent.setOrientation(ComponentOrientation.VERTICAL); - } - - @Override - public Dimension render(Graphics2D graphics2D) - { - final AlchemicalHydra hydra = plugin.getHydra(); - panelComponent.getChildren().clear(); - - if (hydra == null) - { - return null; - } - - // First add stunned thing if needed - if (stunTicks > 0) - { - addStunOverlay(); - } - - - if (plugin.isCounting()) - { - // Add spec box second, to keep it above pray - addSpecOverlay(hydra); - - // Finally add prayer box - addPrayOverlay(hydra); - } - - panelComponent.setPreferredSize(new Dimension(40, 0)); - panelComponent.setBorder(new Rectangle(0, 0, 0, 0)); - - return panelComponent.render(graphics2D); - } - - private void addStunOverlay() - { - final InfoBoxComponent stunComponent = new InfoBoxComponent(); - - stunComponent.setBackgroundColor(badCol); - stunComponent.setImage(getStunImg()); - stunComponent.setText(" " + stunTicks); - stunComponent.setPreferredSize(new Dimension(40, 40)); - - panelComponent.getChildren().add(stunComponent); - } - - private void addSpecOverlay(final AlchemicalHydra hydra) - { - final AlchemicalHydraPhase phase = hydra.getPhase(); - final int nextSpec = hydra.getNextSpecialRelative(); - - if (nextSpec > 3) - { - return; - } - final InfoBoxComponent specComponent = new InfoBoxComponent(); - - if (nextSpec == 0) - { - specComponent.setBackgroundColor(badCol); - } - else if (nextSpec == 1) - { - specComponent.setBackgroundColor(medCol); - } - - specComponent.setImage(phase.getSpecImage(spriteManager)); - specComponent.setText(" " + nextSpec); // hacky way to not have to figure out how to move text - specComponent.setPreferredSize(new Dimension(40, 40)); - - panelComponent.getChildren().add(specComponent); - } - - private void addPrayOverlay(final AlchemicalHydra hydra) - { - final Prayer nextPrayer = hydra.getNextAttack().getPrayer(); - final int nextSwitch = hydra.getNextSwitch(); - - InfoBoxComponent prayComponent = new InfoBoxComponent(); - - if (nextSwitch == 1) - { - prayComponent.setBackgroundColor(client.isPrayerActive(nextPrayer) ? medCol : badCol); - } - else - { - prayComponent.setBackgroundColor(client.isPrayerActive(nextPrayer) ? safeCol : badCol); - } - - prayComponent.setImage(hydra.getNextAttack().getImage(spriteManager)); - prayComponent.setText(" " + nextSwitch); - prayComponent.setColor(Color.white); - prayComponent.setPreferredSize(new Dimension(40, 40)); - - panelComponent.getChildren().add(prayComponent); - } - - boolean onGameTick() - { - return --stunTicks <= 0; - } - - private BufferedImage getStunImg() - { - if (stunImg == null) - { - stunImg = createStunImage(client); - } - - return stunImg; - } - - private static BufferedImage createStunImage(Client client) - { - final Sprite root = getSprite(client, SpriteID.BIG_ASS_GREY_ENTANGLE); - final Sprite mark = getSprite(client, SpriteID.TRADE_EXCLAMATION_MARK_ITEM_REMOVAL_WARNING); - - if (mark == null || root == null) - { - return null; - } - - final Sprite sprite = ImageUtil.mergeSprites(client, ImageUtil.resizeSprite(client, root, IMGSIZE, IMGSIZE), mark); - - return sprite.toBufferedImage(); - } - - private static Sprite getSprite(Client client, int id) - { - final IndexDataBase spriteDb = client.getIndexSprites(); - if (spriteDb == null) - { - return null; - } - - final Sprite[] sprites = client.getSprites(spriteDb, id, 0); - if (sprites == null) - { - return null; - } - - return sprites[0]; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/alchemicalhydra/AlchemicalHydraPhase.java b/runelite-client/src/main/java/net/runelite/client/plugins/alchemicalhydra/AlchemicalHydraPhase.java deleted file mode 100644 index 97e577d6ef..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/alchemicalhydra/AlchemicalHydraPhase.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2019, Lucas - * 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.alchemicalhydra; - -import java.awt.image.BufferedImage; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.api.AnimationID; -import net.runelite.api.ProjectileID; -import net.runelite.api.SpriteID; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.util.ImageUtil; - -@Getter(AccessLevel.PACKAGE) -@RequiredArgsConstructor -enum AlchemicalHydraPhase -{ - ONE(3, AnimationID.HYDRA_1_1, AnimationID.HYDRA_1_2, ProjectileID.HYDRA_POISON, 0, SpriteID.BIG_ASS_GUTHIX_SPELL, new WorldPoint(1371, 10263, 0)), - TWO(3, AnimationID.HYDRA_2_1, AnimationID.HYDRA_2_2, 0, AnimationID.HYDRA_LIGHTNING, SpriteID.BIG_SPEC_TRANSFER, new WorldPoint(1371, 10272, 0)), - THREE(3, AnimationID.HYDRA_3_1, AnimationID.HYDRA_3_2, 0, AnimationID.HYDRA_FIRE, SpriteID.BIG_SUPERHEAT, new WorldPoint(1362, 10272, 0)), - FOUR(1, AnimationID.HYDRA_4_1, AnimationID.HYDRA_4_2, ProjectileID.HYDRA_POISON, 0, SpriteID.BIG_ASS_GUTHIX_SPELL, null); - - private final int attacksPerSwitch; - private final int deathAnim1; - private final int deathAnim2; - private final int specProjectileId; - private final int specAnimationId; - - @Getter(AccessLevel.NONE) - private final int specImageID; - private final WorldPoint fountain; - - private BufferedImage specImage; - - BufferedImage getSpecImage(SpriteManager spriteManager) - { - if (specImage == null) - { - BufferedImage tmp = spriteManager.getSprite(specImageID, 0); - specImage = tmp == null ? null : ImageUtil.resizeImage(tmp, AlchemicalHydraOverlay.IMGSIZE, AlchemicalHydraOverlay.IMGSIZE); - } - - return specImage; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/alchemicalhydra/AlchemicalHydraPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/alchemicalhydra/AlchemicalHydraPlugin.java deleted file mode 100644 index c51dde9e2d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/alchemicalhydra/AlchemicalHydraPlugin.java +++ /dev/null @@ -1,401 +0,0 @@ -/* - * Copyright (c) 2019, Lucas - * 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.alchemicalhydra; - -import com.google.inject.Provides; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -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.GameState; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.Projectile; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.events.AnimationChanged; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.events.ProjectileMoved; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.alchemicalhydra.AlchemicalHydra.AttackStyle; -import net.runelite.client.ui.overlay.OverlayManager; - -@PluginDescriptor( - name = "Alchemical Hydra", - description = "Show what to pray against hydra", - tags = {"Hydra", "Lazy", "4 headed asshole"}, - type = PluginType.PVM, - enabledByDefault = false -) -@Slf4j -@Singleton -public class AlchemicalHydraPlugin extends Plugin -{ - private static final int[] HYDRA_REGIONS = { - 5279, 5280, - 5535, 5536 - }; - private static final int STUN_LENGTH = 7; - - @Getter(AccessLevel.PACKAGE) - private Map poisonProjectiles = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private AlchemicalHydra hydra; - - @Getter(AccessLevel.PACKAGE) - private boolean counting; - - @Getter(AccessLevel.PACKAGE) - private boolean fountain; - - @Getter(AccessLevel.PACKAGE) - private boolean stun; - - private boolean inHydraInstance; - private int lastAttackTick; - - @Inject - private Client client; - - @Inject - private EventBus eventBus; - - @Inject - private AlchemicalHydraConfig config; - - @Inject - private AlchemicalHydraOverlay overlay; - - @Inject - private AlchemicalHydraSceneOverlay sceneOverlay; - - @Inject - private OverlayManager overlayManager; - - @Provides - AlchemicalHydraConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(AlchemicalHydraConfig.class); - } - - @Override - protected void startUp() - { - initConfig(); - - inHydraInstance = checkArea(); - lastAttackTick = -1; - poisonProjectiles.clear(); - } - - @Override - protected void shutDown() - { - eventBus.unregister("fight"); - eventBus.unregister("npcSpawned"); - - inHydraInstance = false; - hydra = null; - poisonProjectiles.clear(); - removeOverlays(); - lastAttackTick = -1; - } - - private void initConfig() - { - this.counting = config.counting(); - this.fountain = config.fountain(); - this.stun = config.stun(); - this.overlay.setSafeCol(config.safeCol()); - this.overlay.setMedCol(config.medCol()); - this.overlay.setBadCol(config.badCol()); - this.sceneOverlay.setPoisonBorder(config.poisonBorderCol()); - this.sceneOverlay.setPoisonFill(config.poisonCol()); - this.sceneOverlay.setBadFountain(config.fountainColA()); - this.sceneOverlay.setGoodFountain(config.fountainColB()); - } - - private void addFightSubscriptions() - { - eventBus.subscribe(AnimationChanged.class, "fight", this::onAnimationChanged); - eventBus.subscribe(ProjectileMoved.class, "fight", this::onProjectileMoved); - eventBus.subscribe(ChatMessage.class, "fight", this::onChatMessage); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("betterHydra")) - { - return; - } - - switch (event.getKey()) - { - case "counting": - this.counting = config.counting(); - break; - case "fountain": - this.fountain = config.fountain(); - break; - case "stun": - this.stun = config.stun(); - break; - case "safeCol": - overlay.setSafeCol(config.safeCol()); - return; - case "medCol": - overlay.setMedCol(config.medCol()); - return; - case "badCol": - overlay.setBadCol(config.badCol()); - return; - case "poisonBorderCol": - sceneOverlay.setPoisonBorder(config.poisonBorderCol()); - break; - case "poisonCol": - sceneOverlay.setPoisonFill(config.poisonCol()); - break; - case "fountainColA": - sceneOverlay.setBadFountain(config.fountainColA()); - break; - case "fountainColB": - sceneOverlay.setGoodFountain(config.fountainColB()); - break; - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged state) - { - if (state.getGameState() != GameState.LOGGED_IN) - { - return; - } - - inHydraInstance = checkArea(); - - if (!inHydraInstance) - { - - if (hydra != null) - { - removeOverlays(); - hydra = null; - } - - eventBus.unregister("npcSpawned"); - eventBus.unregister("fight"); - return; - } - - eventBus.subscribe(NpcSpawned.class, "npcSpawned", this::onNpcSpawned); - - for (NPC npc : client.getNpcs()) - { - if (npc.getId() == NpcID.ALCHEMICAL_HYDRA) - { - hydra = new AlchemicalHydra(npc); - addFightSubscriptions(); - break; - } - } - - addOverlays(); - } - - private void onNpcSpawned(NpcSpawned event) - { - if (event.getNpc().getId() != NpcID.ALCHEMICAL_HYDRA) - { - return; - } - - eventBus.unregister("npcSpawned"); - hydra = new AlchemicalHydra(event.getNpc()); - addFightSubscriptions(); - addOverlays(); - } - - private void onAnimationChanged(AnimationChanged animationChanged) - { - Actor actor = animationChanged.getActor(); - - if (!inHydraInstance || hydra == null || actor == client.getLocalPlayer()) - { - return; - } - - AlchemicalHydraPhase phase = hydra.getPhase(); - - if (actor.getAnimation() == phase.getDeathAnim2() && - phase != AlchemicalHydraPhase.THREE // Else log's gonna say "Tried some weird shit" - || actor.getAnimation() == phase.getDeathAnim1() && - phase == AlchemicalHydraPhase.THREE) // We want the pray to switch ye ok ty - { - switch (phase) - { - case ONE: - hydra.changePhase(AlchemicalHydraPhase.TWO); - return; - case TWO: - hydra.changePhase(AlchemicalHydraPhase.THREE); - return; - case THREE: - hydra.changePhase(AlchemicalHydraPhase.FOUR); - return; - case FOUR: - hydra = null; - poisonProjectiles.clear(); - eventBus.unregister("fight"); - eventBus.subscribe(NpcSpawned.class, "npcSpawned", this::onNpcSpawned); - removeOverlays(); - return; - default: - log.debug("Tried some weird shit"); - break; - } - } - - else if (actor.getAnimation() == phase.getSpecAnimationId() && phase.getSpecAnimationId() != 0) - { - hydra.setNextSpecial(hydra.getNextSpecial() + 9); - } - - if (poisonProjectiles.isEmpty()) - { - return; - } - - Set exPoisonProjectiles = new HashSet<>(); - for (Entry entry : poisonProjectiles.entrySet()) - { - if (entry.getValue().getEndCycle() < client.getGameCycle()) - { - exPoisonProjectiles.add(entry.getKey()); - } - } - for (LocalPoint toRemove : exPoisonProjectiles) - { - poisonProjectiles.remove(toRemove); - } - } - - private void onProjectileMoved(ProjectileMoved event) - { - if (!inHydraInstance || hydra == null - || client.getGameCycle() >= event.getProjectile().getStartMovementCycle()) - { - return; - } - - Projectile projectile = event.getProjectile(); - int id = projectile.getId(); - - if (hydra.getPhase().getSpecProjectileId() != 0 && hydra.getPhase().getSpecProjectileId() == id) - { - if (hydra.getAttackCount() == hydra.getNextSpecial()) - { - // Only add 9 to next special on the first poison projectile (whoops) - hydra.setNextSpecial(hydra.getNextSpecial() + 9); - } - - poisonProjectiles.put(event.getPosition(), projectile); - } - else if (client.getTickCount() != lastAttackTick - && (id == AttackStyle.MAGIC.getProjectileID() || id == AttackStyle.RANGED.getProjectileID())) - { - hydra.handleAttack(id); - lastAttackTick = client.getTickCount(); - } - } - - private void onChatMessage(ChatMessage event) - { - if (event.getMessage().equals("The chemicals neutralise the Alchemical Hydra's defences!")) - { - hydra.setWeakened(true); - } - else if (event.getMessage().equals("The Alchemical Hydra temporarily stuns you.")) - { - if (isStun()) - { - overlay.setStunTicks(STUN_LENGTH); - eventBus.subscribe(GameTick.class, "hydraStun", this::onGameTick); - } - } - } - - private void onGameTick(GameTick tick) - { - if (overlay.onGameTick()) - { - // unregister self when 7 ticks have passed - eventBus.unregister("hydraStun"); - } - } - - private boolean checkArea() - { - return Arrays.equals(client.getMapRegions(), HYDRA_REGIONS) && client.isInInstancedRegion(); - } - - private void addOverlays() - { - if (counting || stun) - { - overlayManager.add(overlay); - } - - if (counting || fountain) - { - overlayManager.add(sceneOverlay); - } - } - - private void removeOverlays() - { - overlayManager.remove(overlay); - overlayManager.remove(sceneOverlay); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/alchemicalhydra/AlchemicalHydraSceneOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/alchemicalhydra/AlchemicalHydraSceneOverlay.java deleted file mode 100644 index 71e24470b8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/alchemicalhydra/AlchemicalHydraSceneOverlay.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2019, Lucas - * 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.alchemicalhydra; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.geom.Area; -import java.util.Collection; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Setter; -import net.runelite.api.Client; -import static net.runelite.api.Perspective.getCanvasTileAreaPoly; -import net.runelite.api.Projectile; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldArea; -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; - -@Singleton -class AlchemicalHydraSceneOverlay extends Overlay -{ - @Setter(AccessLevel.PACKAGE) - private Color poisonBorder; - - @Setter(AccessLevel.PACKAGE) - private Color poisonFill; - - @Setter(AccessLevel.PACKAGE) - private Color goodFountain; - - @Setter(AccessLevel.PACKAGE) - private Color badFountain; - - private final AlchemicalHydraPlugin plugin; - private final Client client; - - @Inject - public AlchemicalHydraSceneOverlay(final Client client, final AlchemicalHydraPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.UNDER_WIDGETS); - this.plugin = plugin; - this.client = client; - } - - @Override - public Dimension render(Graphics2D graphics) - { - AlchemicalHydra hydra = plugin.getHydra(); - final Map poisonProjectiles = plugin.getPoisonProjectiles(); - - if (plugin.isCounting() && !poisonProjectiles.isEmpty()) - { - drawPoisonArea(graphics, poisonProjectiles); - } - - if (plugin.isFountain() && hydra.getPhase().getFountain() != null) - { - drawFountain(graphics, hydra); - } - - return null; - } - - private void drawPoisonArea(Graphics2D graphics, Map poisonProjectiles) - { - Area poisonTiles = new Area(); - - for (Map.Entry entry : poisonProjectiles.entrySet()) - { - if (entry.getValue().getEndCycle() < client.getGameCycle()) - { - continue; - } - - LocalPoint point = entry.getKey(); - Polygon poly = getCanvasTileAreaPoly(client, point, 3); - - if (poly != null) - { - poisonTiles.add(new Area(poly)); - } - } - - graphics.setPaintMode(); - graphics.setColor(poisonBorder); - graphics.draw(poisonTiles); - graphics.setColor(poisonFill); - graphics.fill(poisonTiles); - } - - private void drawFountain(Graphics2D graphics, AlchemicalHydra hydra) - { - Collection fountainWorldPoint = WorldPoint.toLocalInstance(client, hydra.getPhase().getFountain()); // thanks - if (fountainWorldPoint.size() > 1) // for - { - return; - } - - WorldPoint wp = null; - for (WorldPoint p : fountainWorldPoint) // this - { - wp = p; - } - - LocalPoint fountainPoint = wp == null ? null : LocalPoint.fromWorld(client, wp); // trash - - if (fountainPoint == null || hydra.isWeakened()) // I - { - return; - } - - final Polygon poly = getCanvasTileAreaPoly(client, fountainPoint, 3); // don't - - if (poly == null) - { - return; - } - - Color color; // like - - if (hydra.getNpc().getWorldArea().intersectsWith(new WorldArea(wp, 1, 1))) // coords - { // WHICH FUCKING RETARD DID X, Y, dX, dY, Z???? IT'S XYZdXdY REEEEEEEEEE - color = goodFountain; - } - else - { - color = badFountain; - } - - graphics.setColor(color); - graphics.setStroke(new BasicStroke(3)); - graphics.draw(poly); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/ammo/AmmoCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/ammo/AmmoCounter.java deleted file mode 100644 index 01edad16f0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/ammo/AmmoCounter.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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.ammo; - -import java.awt.image.BufferedImage; -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.time.Duration; -import java.time.Instant; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.ui.overlay.infobox.Counter; -import net.runelite.client.util.QuantityFormatter; - -class AmmoCounter extends Counter -{ - @Getter(AccessLevel.PACKAGE) - private int itemID; - private final String name; - private final int total; - private final Instant time; - private BigDecimal ammoPerHour; - - AmmoCounter(Plugin plugin, int itemID, int count, String name, BufferedImage image) - { - super(image, plugin, count); - this.total = count; - this.itemID = itemID; - this.name = name; - this.time = Instant.now(); - } - - @Override - public String getText() - { - return QuantityFormatter.quantityToRSDecimalStack(getCount()); - } - - @Override - public String getTooltip() - { - if (lossRate() >= 1) - { - return String.format("%s
Loss Rate: %s/h", name, lossRate()); - } - else - { - return "Need more data"; - } - } - - private int lossRate() - { - BigDecimal diff = BigDecimal.valueOf(total).subtract(BigDecimal.valueOf(getCount())); - BigDecimal timeSinceStart = BigDecimal.valueOf(Duration.between(time, Instant.now()).getSeconds()) - .setScale(6, RoundingMode.UP); - if (timeSinceStart.compareTo(BigDecimal.ZERO) != 0) - { - BigDecimal timeSinceStartInHours = timeSinceStart.divide(BigDecimal.valueOf(3600), RoundingMode.UP); - ammoPerHour = diff.divide(timeSinceStartInHours, RoundingMode.HALF_UP); - } - if (ammoPerHour != null) - { - return ammoPerHour.intValue(); - } - else - { - return 0; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/ammo/AmmoPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/ammo/AmmoPlugin.java deleted file mode 100644 index af4fcf5cde..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/ammo/AmmoPlugin.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * 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.ammo; - -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.EquipmentInventorySlot; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemDefinition; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.client.callback.ClientThread; -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.plugins.PluginType; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; - -@PluginDescriptor( - name = "Ammo", - description = "Shows the current ammo the player has equipped", - tags = {"bolts", "darts", "chinchompa", "equipment"}, - type = PluginType.UTILITY -) -@Singleton -public class AmmoPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private ItemManager itemManager; - - private AmmoCounter counterBox; - - @Override - protected void startUp() - { - - clientThread.invokeLater(() -> - { - final ItemContainer container = client.getItemContainer(InventoryID.EQUIPMENT); - - if (container != null) - { - checkInventory(container.getItems()); - } - }); - } - - @Override - protected void shutDown() - { - infoBoxManager.removeInfoBox(counterBox); - counterBox = null; - } - - @Subscribe - private void onItemContainerChanged(ItemContainerChanged event) - { - if (event.getItemContainer() != client.getItemContainer(InventoryID.EQUIPMENT)) - { - return; - } - - checkInventory(event.getItemContainer().getItems()); - } - - private void checkInventory(final Item[] items) - { - // Check for weapon slot items. This overrides the ammo slot, - // as the player will use the thrown weapon (eg. chinchompas, knives, darts) - if (items.length > EquipmentInventorySlot.WEAPON.getSlotIdx()) - { - final Item weapon = items[EquipmentInventorySlot.WEAPON.getSlotIdx()]; - final ItemDefinition weaponComp = itemManager.getItemDefinition(weapon.getId()); - if (weaponComp.isStackable()) - { - updateInfobox(weapon, weaponComp); - return; - } - } - - if (items.length <= EquipmentInventorySlot.AMMO.getSlotIdx()) - { - removeInfobox(); - return; - } - - final Item ammo = items[EquipmentInventorySlot.AMMO.getSlotIdx()]; - final ItemDefinition comp = itemManager.getItemDefinition(ammo.getId()); - - if (!comp.isStackable()) - { - removeInfobox(); - return; - } - - updateInfobox(ammo, comp); - } - - private void updateInfobox(final Item item, final ItemDefinition comp) - { - if (counterBox != null && counterBox.getItemID() == item.getId()) - { - counterBox.setCount(item.getQuantity()); - return; - } - - removeInfobox(); - final BufferedImage image = itemManager.getImage(item.getId(), 5, false); - counterBox = new AmmoCounter(this, item.getId(), item.getQuantity(), comp.getName(), image); - infoBoxManager.addInfoBox(counterBox); - } - - private void removeInfobox() - { - infoBoxManager.removeInfoBox(counterBox); - counterBox = null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/animations/AnimationsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/animations/AnimationsPlugin.java deleted file mode 100644 index f405e85417..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/animations/AnimationsPlugin.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2017, 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.animations; - -import java.io.IOException; -import java.util.HashMap; -import javax.inject.Inject; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.events.AnimationChanged; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.http.api.animation.AnimationsClient; -import org.apache.commons.lang3.ArrayUtils; - -@PluginDescriptor( - name = "Animations", - hidden = true -) -@Slf4j -public class AnimationsPlugin extends Plugin -{ - private final AnimationsClient animationsClient = new AnimationsClient(); - - private HashMap animations; - @Inject - private Client client; - - { - try - { - animations = animationsClient.get(); - } - catch (IOException e) - { - e.printStackTrace(); - } - } - - @Subscribe - private void onAnimationChanged(AnimationChanged event) - { - if (event.getActor() instanceof NPC) - { - if (event.getActor().getAnimation() != -1) - { - if (ArrayUtils.contains(animations.get(((NPC) event.getActor()).getId()), event.getActor().getAnimation())) - { - return; - } - int[] newAnimations = ArrayUtils.add(animations.get(((NPC) event.getActor()).getId()), event.getActor().getAnimation()); - animations.put(((NPC) event.getActor()).getId(), newAnimations); - animationsClient.submit(((NPC) event.getActor()).getId(), event.getActor().getAnimation()); - } - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/animsmoothing/AnimationSmoothingConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/animsmoothing/AnimationSmoothingConfig.java deleted file mode 100644 index 05dadb450a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/animsmoothing/AnimationSmoothingConfig.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2018, 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.animsmoothing; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup(AnimationSmoothingPlugin.CONFIG_GROUP) -public interface AnimationSmoothingConfig extends Config -{ - - @ConfigItem( - keyName = "smoothPlayerAnimations", - name = "Smooth Player Animations", - description = "Configures whether the player animations are smooth or not", - position = 1 - ) - default boolean smoothPlayerAnimations() - { - return true; - } - - @ConfigItem( - keyName = "smoothNpcAnimations", - name = "Smooth NPC Animations", - description = "Configures whether the npc animations are smooth or not", - position = 2 - ) - default boolean smoothNpcAnimations() - { - return true; - } - - @ConfigItem( - keyName = "smoothObjectAnimations", - name = "Smooth Object Animations", - description = "Configures whether the object animations are smooth or not", - position = 3 - ) - default boolean smoothObjectAnimations() - { - return true; - } - - @ConfigItem( - keyName = "smoothWidgetAnimations", - name = "Smooth Widget Animations", - description = "Configures whether the widget animations are smooth or not", - position = 4 - ) - default boolean smoothWidgetAnimations() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/animsmoothing/AnimationSmoothingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/animsmoothing/AnimationSmoothingPlugin.java deleted file mode 100644 index ac411f525d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/animsmoothing/AnimationSmoothingPlugin.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2018, 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.animsmoothing; - -import com.google.inject.Provides; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Animation Smoothing", - description = "Show smoother player, NPC, and object animations", - tags = {"npcs", "objects", "players"}, - enabledByDefault = false, - type = PluginType.MISCELLANEOUS -) -@Singleton -public class AnimationSmoothingPlugin extends Plugin -{ - static final String CONFIG_GROUP = "animationSmoothing"; - - @Inject - private Client client; - - @Inject - private AnimationSmoothingConfig config; - - @Provides - AnimationSmoothingConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(AnimationSmoothingConfig.class); - } - - @Override - protected void startUp() - { - update(); - } - - @Override - protected void shutDown() - { - client.setInterpolatePlayerAnimations(false); - client.setInterpolateNpcAnimations(false); - client.setInterpolateObjectAnimations(false); - client.setInterpolateWidgetAnimations(false); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals(CONFIG_GROUP)) - { - update(); - } - } - - private void update() - { - client.setInterpolatePlayerAnimations(config.smoothPlayerAnimations()); - client.setInterpolateNpcAnimations(config.smoothNpcAnimations()); - client.setInterpolateObjectAnimations(config.smoothObjectAnimations()); - client.setInterpolateWidgetAnimations(config.smoothWidgetAnimations()); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragConfig.java deleted file mode 100644 index 5ab668c9a4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragConfig.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2018, DennisDeV - * 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.antidrag; - -import java.awt.Color; -import java.awt.event.KeyEvent; -import net.runelite.api.Constants; -import net.runelite.client.config.Alpha; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.Keybind; -import net.runelite.client.config.ModifierlessKeybind; - -@ConfigGroup("antiDrag") -public interface AntiDragConfig extends Config -{ - @ConfigItem( - position = 0, - keyName = "alwaysOn", - name = "Always On", - description = "Makes the anti-drag always active and disables the hotkey toggle", - disabledBy = "toggleKeyBind || holdKeyBind", - hide = "toggleKeyBind || holdKeyBind" - ) - default boolean alwaysOn() - { - return false; - } - - @ConfigItem( - position = 1, - keyName = "toggleKeyBind", - name = "Toggle with Keybind", - description = "Toggle anti drag on and off, rather than always on.", - disabledBy = "alwaysOn || holdKeyBind", - hide = "alwaysOn || holdKeyBind" - ) - default boolean toggleKeyBind() - { - return false; - } - - @ConfigItem( - position = 2, - keyName = "holdKeyBind", - name = "Hold with Keybind", - description = "Hold anti drag key to turn it on, rather than toggle it on or off.", - disabledBy = "alwaysOn || toggleKeyBind", - hide = "alwaysOn || toggleKeyBind" - ) - default boolean holdKeyBind() - { - return false; - } - - @ConfigItem( - keyName = "key", - name = "Keybind", - description = "The keybind you want to use for antidrag", - position = 3, - hidden = true, - unhide = "toggleKeyBind || holdKeyBind" - ) - default Keybind key() - { - return new ModifierlessKeybind(KeyEvent.VK_SHIFT, 0); - } - - @ConfigItem( - keyName = "dragDelay", - name = "Drag Delay", - description = "Configures the inventory drag delay in client ticks (20ms)", - position = 4 - ) - default int dragDelay() - { - return Constants.GAME_TICK_LENGTH / Constants.CLIENT_TICK_LENGTH; // one game tick - } - - @ConfigItem( - keyName = "reqFocus", - name = "Reset on focus loss", - description = "Disable antidrag when losing focus (like alt tabbing)", - position = 5, - hidden = true, - unhide = "toggleKeyBind || holdKeyBind" - ) - default boolean reqFocus() - { - return false; - } - - @ConfigItem( - keyName = "overlay", - name = "Enable overlay", - description = "Do you really need a description?", - position = 6, - hidden = true, - unhide = "toggleKeyBind || holdKeyBind" - ) - default boolean overlay() - { - return false; - } - - @Alpha - @ConfigItem( - keyName = "color", - name = "Overlay color", - description = "Change the overlay color, duh", - hidden = true, - unhide = "toggleKeyBind || holdKeyBind", - position = 7 - ) - default Color color() - { - return new Color(255, 0, 0, 30); - } - - @ConfigItem( - keyName = "changeCursor", - name = "Change Cursor", - description = "Change cursor when you have anti-drag enabled.", - position = 8, - hidden = true, - unhide = "toggleKeyBind || holdKeyBind" - ) - default boolean changeCursor() - { - return false; - } - - @ConfigItem( - keyName = "cursorStyle", - name = "Cursor", - description = "Select which cursor you wish to use", - hidden = true, - unhide = "changeCursor", - position = 9 - ) - default CustomCursor selectedCursor() - { - return CustomCursor.RS3_GOLD; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragOverlay.java deleted file mode 100644 index 3a374aa7d2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragOverlay.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.antidrag; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.Rectangle; -import lombok.AccessLevel; -import lombok.Setter; -import net.runelite.api.Client; -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; - -@Singleton -public class AntiDragOverlay extends Overlay -{ - private static final int RADIUS = 20; - - private final Client client; - - @Setter(AccessLevel.PACKAGE) - private Color color; - - @Inject - private AntiDragOverlay(final Client client) - { - this.client = client; - setPosition(OverlayPosition.TOOLTIP); - setPriority(OverlayPriority.HIGHEST); - setLayer(OverlayLayer.ALWAYS_ON_TOP); - } - - @Override - public Dimension render(Graphics2D g) - { - g.setColor(color); - - final net.runelite.api.Point mouseCanvasPosition = client.getMouseCanvasPosition(); - final Point mousePosition = new Point(mouseCanvasPosition.getX() - RADIUS, mouseCanvasPosition.getY() - RADIUS); - final Rectangle bounds = new Rectangle(mousePosition.x, mousePosition.y, 2 * RADIUS, 2 * RADIUS); - g.fillOval(bounds.x, bounds.y, bounds.width, bounds.height); - - return bounds.getSize(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragPlugin.java deleted file mode 100644 index da40cdf465..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragPlugin.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (c) 2018, DennisDeV - * 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.antidrag; - -import com.google.inject.Provides; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.events.FocusChanged; -import net.runelite.api.events.GameStateChanged; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.config.Keybind; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.input.KeyManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.ui.ClientUI; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.util.HotkeyListener; - -@PluginDescriptor( - name = "Anti Drag", - description = "Prevent dragging an item for a specified delay", - tags = {"antidrag", "delay", "inventory", "items"}, - type = PluginType.UTILITY, - enabledByDefault = false -) -@Singleton -public class AntiDragPlugin extends Plugin -{ - private static final int DEFAULT_DELAY = 5; - - @Inject - private Client client; - - @Inject - private ClientUI clientUI; - - @Inject - private AntiDragConfig config; - - @Inject - private AntiDragOverlay overlay; - - @Inject - private OverlayManager overlayManager; - - @Inject - private KeyManager keyManager; - - private boolean toggleDrag; - private boolean configOverlay; - private boolean changeCursor; - private CustomCursor selectedCursor; - private Keybind key; - - private final HotkeyListener toggleListener = new HotkeyListener(() -> this.key) - { - @Override - public void hotkeyPressed() - { - toggleDrag = !toggleDrag; - if (toggleDrag) - { - if (configOverlay) - { - overlayManager.add(overlay); - } - if (changeCursor) - { - clientUI.setCursor(selectedCursor.getCursorImage(), selectedCursor.toString()); - } - - client.setInventoryDragDelay(config.dragDelay()); - } - else - { - overlayManager.remove(overlay); - client.setInventoryDragDelay(DEFAULT_DELAY); - clientUI.resetCursor(); - } - } - }; - - private final HotkeyListener holdListener = new HotkeyListener(() -> this.key) - { - @Override - public void hotkeyPressed() - { - if (configOverlay) - { - overlayManager.add(overlay); - } - if (changeCursor) - { - clientUI.setCursor(selectedCursor.getCursorImage(), selectedCursor.toString()); - } - - client.setInventoryDragDelay(config.dragDelay()); - } - - @Override - public void hotkeyReleased() - { - overlayManager.remove(overlay); - client.setInventoryDragDelay(DEFAULT_DELAY); - clientUI.resetCursor(); - } - }; - - @Provides - AntiDragConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(AntiDragConfig.class); - } - - @Override - protected void startUp() - { - overlay.setColor(config.color()); - updateConfig(); - updateKeyListeners(); - - if (config.alwaysOn()) - { - client.setInventoryDragDelay(config.dragDelay()); - } - } - - @Override - protected void shutDown() - { - client.setInventoryDragDelay(DEFAULT_DELAY); - keyManager.unregisterKeyListener(holdListener); - keyManager.unregisterKeyListener(toggleListener); - toggleDrag = false; - overlayManager.remove(overlay); - clientUI.resetCursor(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("antiDrag")) - { - updateConfig(); - - switch (event.getKey()) - { - case "toggleKeyBind": - case "holdKeyBind": - updateKeyListeners(); - break; - case "alwaysOn": - client.setInventoryDragDelay(config.alwaysOn() ? config.dragDelay() : DEFAULT_DELAY); - break; - case "dragDelay": - if (config.alwaysOn()) - { - client.setInventoryDragDelay(config.dragDelay()); - } - break; - case ("changeCursor"): - clientUI.resetCursor(); - break; - case ("color"): - overlay.setColor(config.color()); - break; - } - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGIN_SCREEN) - { - keyManager.unregisterKeyListener(toggleListener); - keyManager.unregisterKeyListener(holdListener); - } - else if (event.getGameState() == GameState.LOGGING_IN) - { - updateKeyListeners(); - } - } - - private void updateConfig() - { - this.key = config.key(); - this.configOverlay = config.overlay(); - this.changeCursor = config.changeCursor(); - this.selectedCursor = config.selectedCursor(); - } - - @Subscribe - private void onFocusChanged(FocusChanged focusChanged) - { - if (!focusChanged.isFocused() && config.reqFocus() && !config.alwaysOn()) - { - client.setInventoryDragDelay(DEFAULT_DELAY); - overlayManager.remove(overlay); - } - } - - private void updateKeyListeners() - { - if (config.holdKeyBind()) - { - keyManager.registerKeyListener(holdListener); - } - else - { - keyManager.unregisterKeyListener(holdListener); - } - - if (config.toggleKeyBind()) - { - keyManager.registerKeyListener(toggleListener); - } - else - { - keyManager.unregisterKeyListener(toggleListener); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/CustomCursor.java b/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/CustomCursor.java deleted file mode 100644 index 16b965f979..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/antidrag/CustomCursor.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2018, Kruithne - * 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.antidrag; - -import java.awt.image.BufferedImage; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.plugins.customcursor.CustomCursorPlugin; -import net.runelite.client.util.ImageUtil; - -public enum CustomCursor -{ - RS3_GOLD("RS3 Gold", "cursor-rs3-gold.png"), - RS3_SILVER("RS3 Silver", "cursor-rs3-silver.png"), - DRAGON_DAGGER("Dragon Dagger", "cursor-dragon-dagger.png"), - DRAGON_DAGGER_POISON("Dragon Dagger (p)", "cursor-dragon-dagger-p.png"), - TROUT("Trout", "cursor-trout.png"), - DRAGON_SCIMITAR("Dragon Scimitar", "cursor-dragon-scimitar.png"), - ARMADYL_GODSWORD("Armadyl Godsword", "cursor-armadyl-godsword.png"), - BANDOS_GODSWORD("Bandos Godsword", "cursor-bandos-godsword.png"), - MOUSE("Mouse", "cursor-mouse.png"), - SARADOMIN_GODSWORD("Saradomin Godsword", "cursor-saradomin-godsword.png"), - ZAMORAK_GODSWORD("Zamorak Godsword", "cursor-zamorak-godsword.png"), - SKILL_SPECS("Skill Specs", "cursor-skill-specs.png"); - - private final String name; - - @Getter(AccessLevel.PACKAGE) - private final BufferedImage cursorImage; - - CustomCursor(String name, String icon) - { - this.name = name; - this.cursorImage = ImageUtil.getResourceStreamFromClass(CustomCursorPlugin.class, icon); - } - - @Override - public String toString() - { - return name; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeProjectileInfo.java b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeProjectileInfo.java deleted file mode 100644 index 16d7902528..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeProjectileInfo.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * All rights reserved. - * - * - * Modified by farhan1666 - * - * 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.aoewarnings; - -import java.util.HashMap; -import java.util.Map; -import net.runelite.api.ProjectileID; - - -public enum AoeProjectileInfo -{ - LIZARDMAN_SHAMAN_AOE(ProjectileID.LIZARDMAN_SHAMAN_AOE, 5), - CRAZY_ARCHAEOLOGIST_AOE(ProjectileID.CRAZY_ARCHAEOLOGIST_AOE, 3), - ICE_DEMON_RANGED_AOE(ProjectileID.ICE_DEMON_RANGED_AOE, 3), - - /** - * When you don't have pray range on ice demon does an ice barrage - */ - ICE_DEMON_ICE_BARRAGE_AOE(ProjectileID.ICE_DEMON_ICE_BARRAGE_AOE, 3), - - /** - * The AOE when vasa first starts - */ - VASA_AWAKEN_AOE(ProjectileID.VASA_AWAKEN_AOE, 3), - VASA_RANGED_AOE(ProjectileID.VASA_RANGED_AOE, 3), - TEKTON_METEOR_AOE(ProjectileID.TEKTON_METEOR_AOE, 3), - - /** - * The AOEs of Vorkath - */ - VORKATH_BOMB(ProjectileID.VORKATH_BOMB_AOE, 3), - VORKATH_POISON_POOL(ProjectileID.VORKATH_POISON_POOL_AOE, 1), - VORKATH_SPAWN(ProjectileID.VORKATH_SPAWN_AOE, 1), //extra tick because hard to see otherwise - VORKATH_TICK_FIRE(ProjectileID.VORKATH_TICK_FIRE_AOE, 1), - - /** - * the AOEs of Galvek - */ - GALVEK_MINE(ProjectileID.GALVEK_MINE, 3), - GALVEK_BOMB(ProjectileID.GALVEK_BOMB, 3), - - /** - * the AOEs of Grotesque Guardians - */ - DAWN_FREEZE(ProjectileID.DAWN_FREEZE, 3), - DUSK_CEILING(ProjectileID.DUSK_CEILING, 3), - - /** - * the AOE of Vet'ion - */ - VETION_LIGHTNING(ProjectileID.VETION_LIGHTNING, 1), - - /** - * the AOE of Chaos Fanatic - */ - CHAOS_FANATIC(ProjectileID.CHAOS_FANATIC_AOE, 1), - - /** - * the AOE of the Corporeal Beast - */ - CORPOREAL_BEAST(ProjectileID.CORPOREAL_BEAST_AOE, 1), - CORPOREAL_BEAST_DARK_CORE(ProjectileID.CORPOREAL_BEAST_DARK_CORE_AOE, 3), - - /** - * the AOEs of The Great Olm - */ - OLM_FALLING_CRYSTAL(ProjectileID.OLM_FALLING_CRYSTAL, 3), - OLM_BURNING(ProjectileID.OLM_BURNING, 1), - OLM_FALLING_CRYSTAL_TRAIL(ProjectileID.OLM_FALLING_CRYSTAL_TRAIL, 1), - OLM_ACID_TRAIL(ProjectileID.OLM_ACID_TRAIL, 1), - OLM_FIRE_LINE(ProjectileID.OLM_FIRE_LINE, 1), - - /** - * the AOE of the Wintertodt snow that falls - */ - WINTERTODT_SNOW_FALL(ProjectileID.WINTERTODT_SNOW_FALL_AOE, 3), - - /** - * AOE of Xarpus throwing poison - */ - XARPUS_POISON_AOE(ProjectileID.XARPUS_ACID, 1), - - /** - * Aoe of Addy Drags - */ - ADDY_DRAG_POISON(ProjectileID.ADDY_DRAG_POISON, 1), - - /** - * the Breath of the Drake - */ - DRAKE_BREATH(ProjectileID.DRAKE_BREATH, 1), - - /** - * Cerbs fire - */ - CERB_FIRE(ProjectileID.CERB_FIRE, 2), - - /** - * Demonic gorilla - */ - DEMONIC_GORILLA_BOULDER(ProjectileID.DEMONIC_GORILLA_BOULDER, 1), - - /** - * Marble gargoyle (Superior Gargoyle) - */ - MARBLE_GARGOYLE_AOE(ProjectileID.MARBLE_GARGOYLE_AOE, 1); - - private static final Map map = new HashMap<>(); - - static - { - for (AoeProjectileInfo aoe : values()) - { - map.put(aoe.id, aoe); - } - } - - /** - * The id of the projectile to trigger this AoE warning - */ - private final int id; - /** - * How long the indicator should last for this AoE warning This might - * need to be a bit longer than the projectile actually takes to land as - * there is a fade effect on the warning - */ - private final int aoeSize; - - AoeProjectileInfo(int id, int aoeSize) - { - this.id = id; - this.aoeSize = aoeSize; - } - - public static AoeProjectileInfo getById(int id) - { - return map.get(id); - } - - public int getId() - { - return id; - } - - public int getAoeSize() - { - return aoeSize; - } -} 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 deleted file mode 100644 index acce255546..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningConfig.java +++ /dev/null @@ -1,965 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * All rights reserved. - * - * Modified by farhan1666 - * - * 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.aoewarnings; - -import java.awt.Color; -import java.awt.Font; -import lombok.AccessLevel; -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.ConfigTitleSection; -import net.runelite.client.config.Range; -import net.runelite.client.config.Title; - -@ConfigGroup("aoe") -public interface AoeWarningConfig extends Config -{ - @Getter(AccessLevel.PACKAGE) - @AllArgsConstructor - 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(); - } - } - - @ConfigTitleSection( - keyName = "notifyTitle", - name = "Notify", - description = "", - position = -1 - ) - default Title notifyTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "aoeNotifyAll", - name = "Notify for all AoE warnings", - description = "Configures whether or not AoE Projectile Warnings should trigger a notification", - position = 0, - titleSection = "notifyTitle" - ) - default boolean aoeNotifyAll() - { - return false; - } - - @ConfigTitleSection( - keyName = "overlayTitle", - name = "Overlay", - description = "", - position = 1 - ) - default Title overlayTitle() - { - return new Title(); - } - - @ConfigItem( - position = 2, - keyName = "overlayColor", - name = "Overlay Color", - description = "Configures the color of the AoE Projectile Warnings overlay", - titleSection = "overlayTitle" - ) - default Color overlayColor() - { - return new Color(0, 150, 200); - } - - @ConfigItem( - keyName = "outline", - name = "Display Outline", - description = "Configures whether or not AoE Projectile Warnings have an outline", - titleSection = "overlayTitle", - position = 3 - ) - default boolean isOutlineEnabled() - { - return true; - } - - @ConfigItem( - keyName = "delay", - name = "Fade Delay", - description = "Configures the amount of time in milliseconds that the warning lingers for after the projectile has touched the ground", - titleSection = "overlayTitle", - position = 4 - ) - default int delay() - { - return 300; - } - - @ConfigItem( - keyName = "fade", - name = "Fade Warnings", - description = "Configures whether or not AoE Projectile Warnings fade over time", - titleSection = "overlayTitle", - position = 5 - ) - default boolean isFadeEnabled() - { - return true; - } - - @ConfigItem( - keyName = "tickTimers", - name = "Tick Timers", - description = "Configures whether or not AoE Projectile Warnings has tick timers overlaid as well.", - titleSection = "overlayTitle", - position = 6 - ) - default boolean tickTimers() - { - return true; - } - - @ConfigTitleSection( - keyName = "textTitle", - position = 7, - name = "Text", - description = "", - hidden = true, - unhide = "tickTimers" - ) - default Title textTitle() - { - return new Title(); - } - - @ConfigItem( - position = 8, - keyName = "fontStyle", - name = "Font Style", - description = "Bold/Italics/Plain", - titleSection = "textTitle", - 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.", - titleSection = "textTitle", - hidden = true, - unhide = "tickTimers" - ) - default int textSize() - { - return 32; - } - - @ConfigItem( - position = 10, - keyName = "shadows", - name = "Shadows", - description = "Adds Shadows to text.", - titleSection = "textTitle", - hidden = true, - unhide = "tickTimers" - ) - default boolean shadows() - { - return true; - } - - @ConfigTitleSection( - keyName = "npcTitle", - name = "NPC's", - description = "", - position = 11 - ) - default Title npcTitle() - { - return new Title(); - } - - @ConfigTitleSection( - keyName = "lizardmanaoeTitle", - name = "Lizardman Shamans", - description = "", - position = 12, - titleSection = "npcTitle" - ) - default Title lizardmanaoeTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "lizardmanaoe", - name = "Lizardman Shamans", - description = "Configures whether or not AoE Projectile Warnings for Lizardman Shamans is displayed", - titleSection = "lizardmanaoeTitle", - position = 13 - ) - default boolean isShamansEnabled() - { - return true; - } - - @ConfigItem( - keyName = "lizardmanaoenotify", - name = "Lizardman Shamans Notify", - description = "Configures whether or not AoE Projectile Warnings for Lizardman Shamans should trigger a notification", - titleSection = "lizardmanaoeTitle", - position = 14, - hide = "aoeNotifyAll" - ) - default boolean isShamansNotifyEnabled() - { - return false; - } - - @ConfigTitleSection( - keyName = "archaeologistaoeTitle", - name = "Crazy Archaeologist", - description = "", - position = 15, - titleSection = "npcTitle" - ) - default Title archaeologistaoeTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "archaeologistaoe", - name = "Crazy Archaeologist", - description = "Configures whether or not AoE Projectile Warnings for Archaeologist is displayed", - titleSection = "archaeologistaoeTitle", - position = 16 - ) - default boolean isArchaeologistEnabled() - { - return true; - } - - @ConfigItem( - keyName = "archaeologistaoenotify", - name = "Crazy Archaeologist Notify", - description = "Configures whether or not AoE Projectile Warnings for Crazy Archaeologist should trigger a notification", - titleSection = "archaeologistaoeTitle", - position = 17, - hide = "aoeNotifyAll" - ) - default boolean isArchaeologistNotifyEnabled() - { - return false; - } - - @ConfigTitleSection( - keyName = "icedemonTitle", - name = "Ice Demon", - description = "", - position = 18, - titleSection = "npcTitle" - ) - default Title icedemonTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "icedemon", - name = "Ice Demon", - description = "Configures whether or not AoE Projectile Warnings for Ice Demon is displayed", - titleSection = "icedemonTitle", - position = 19 - ) - default boolean isIceDemonEnabled() - { - return true; - } - - @ConfigItem( - keyName = "icedemonnotify", - name = "Ice Demon Notify", - description = "Configures whether or not AoE Projectile Warnings for Ice Demon should trigger a notification", - titleSection = "icedemonTitle", - position = 20, - hide = "aoeNotifyAll" - ) - default boolean isIceDemonNotifyEnabled() - { - return false; - } - - @ConfigTitleSection( - keyName = "vasaTitle", - name = "Vasa", - description = "", - position = 21, - titleSection = "npcTitle" - ) - default Title vasaTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "vasa", - name = "Vasa", - description = "Configures whether or not AoE Projectile Warnings for Vasa is displayed", - titleSection = "vasaTitle", - position = 22 - ) - default boolean isVasaEnabled() - { - return true; - } - - @ConfigItem( - keyName = "vasanotify", - name = "Vasa Notify", - description = "Configures whether or not AoE Projectile Warnings for Vasa should trigger a notification", - titleSection = "vasaTitle", - position = 23, - hide = "aoeNotifyAll" - ) - default boolean isVasaNotifyEnabled() - { - return false; - } - - @ConfigTitleSection( - keyName = "tektonTitle", - name = "Tekton", - description = "", - position = 24, - titleSection = "npcTitle" - ) - default Title tektonTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "tekton", - name = "Tekton", - description = "Configures whether or not AoE Projectile Warnings for Tekton is displayed", - titleSection = "tektonTitle", - position = 25 - ) - default boolean isTektonEnabled() - { - return true; - } - - @ConfigItem( - keyName = "tektonnotify", - name = "Tekton Notify", - description = "Configures whether or not AoE Projectile Warnings for Tekton should trigger a notification", - titleSection = "tektonTitle", - position = 26, - hide = "aoeNotifyAll" - ) - default boolean isTektonNotifyEnabled() - { - return false; - } - - @ConfigTitleSection( - keyName = "vorkathTitle", - name = "Vorkath", - description = "", - position = 27, - titleSection = "npcTitle" - ) - default Title vorkathTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "vorkath", - name = "Vorkath", - description = "Configures whether or not AoE Projectile Warnings for Vorkath are displayed", - titleSection = "vorkathTitle", - position = 28 - ) - default boolean isVorkathEnabled() - { - return true; - } - - @ConfigItem( - keyName = "vorkathotify", - name = "Vorkath Notify", - description = "Configures whether or not AoE Projectile Warnings for Vorkath should trigger a notification", - titleSection = "vorkathTitle", - position = 29, - hide = "aoeNotifyAll" - ) - default boolean isVorkathNotifyEnabled() - { - return false; - } - - @ConfigTitleSection( - keyName = "galvekTitle", - name = "Galvek", - description = "", - position = 30, - titleSection = "npcTitle" - ) - default Title galvekTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "galvek", - name = "Galvek", - description = "Configures whether or not AoE Projectile Warnings for Galvek are displayed", - titleSection = "galvekTitle", - position = 31 - ) - default boolean isGalvekEnabled() - { - return true; - } - - @ConfigItem( - keyName = "galveknotify", - name = "Galvek Notify", - description = "Configures whether or not AoE Projectile Warnings for Galvek should trigger a notification", - titleSection = "galvekTitle", - position = 32, - hide = "aoeNotifyAll" - ) - default boolean isGalvekNotifyEnabled() - { - return false; - } - - @ConfigTitleSection( - keyName = "gargbossTitle", - name = "Gargoyle Boss", - description = "", - position = 33, - titleSection = "npcTitle" - ) - default Title gargbossTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "gargboss", - name = "Gargoyle Boss", - description = "Configs whether or not AoE Projectile Warnings for Dawn/Dusk are displayed", - titleSection = "gargbossTitle", - position = 34 - ) - default boolean isGargBossEnabled() - { - return true; - } - - @ConfigItem( - keyName = "gargbossnotify", - name = "Gargoyle Boss Notify", - description = "Configures whether or not AoE Projectile Warnings for Gargoyle Bosses should trigger a notification", - titleSection = "gargbossTitle", - position = 35, - hide = "aoeNotifyAll" - ) - default boolean isGargBossNotifyEnabled() - { - return false; - } - - @ConfigTitleSection( - keyName = "vetionTitle", - name = "Vet'ion", - description = "", - position = 36, - titleSection = "npcTitle" - ) - default Title vetionTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "vetion", - name = "Vet'ion", - description = "Configures whether or not AoE Projectile Warnings for Vet'ion are displayed", - titleSection = "vetionTitle", - position = 37 - ) - default boolean isVetionEnabled() - { - return true; - } - - @ConfigItem( - keyName = "vetionnotify", - name = "Vet'ion Notify", - description = "Configures whether or not AoE Projectile Warnings for Vet'ion should trigger a notification", - titleSection = "vetionTitle", - position = 38, - hide = "aoeNotifyAll" - ) - default boolean isVetionNotifyEnabled() - { - return false; - } - - @ConfigTitleSection( - keyName = "chaosfanaticTitle", - name = "Chaos Fanatic", - description = "", - position = 39, - titleSection = "npcTitle" - ) - default Title chaosfanaticTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "chaosfanatic", - name = "Chaos Fanatic", - description = "Configures whether or not AoE Projectile Warnings for Chaos Fanatic are displayed", - titleSection = "chaosfanaticTitle", - position = 40 - ) - default boolean isChaosFanaticEnabled() - { - return true; - } - - @ConfigItem( - keyName = "chaosfanaticnotify", - name = "Chaos Fanatic Notify", - description = "Configures whether or not AoE Projectile Warnings for Chaos Fanatic should trigger a notification", - titleSection = "chaosfanaticTitle", - position = 41, - hide = "aoeNotifyAll" - ) - default boolean isChaosFanaticNotifyEnabled() - { - return false; - } - - @ConfigTitleSection( - keyName = "olmTitle", - name = "Olm", - description = "", - position = 42, - titleSection = "npcTitle" - ) - default Title olmTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "olm", - name = "Olm", - description = "Configures whether or not AoE Projectile Warnings for The Great Olm are displayed", - titleSection = "olmTitle", - position = 43 - ) - default boolean isOlmEnabled() - { - return true; - } - - @ConfigItem( - keyName = "olmnotify", - name = "Olm Notify", - description = "Configures whether or not AoE Projectile Warnings for Olm should trigger a notification", - titleSection = "olmTitle", - position = 44, - hide = "aoeNotifyAll" - ) - default boolean isOlmNotifyEnabled() - { - return false; - } - - @ConfigTitleSection( - keyName = "olmBombsTitle", - name = "Bombs", - description = "", - position = 45, - titleSection = "olmTitle" - ) - default Title olmBombsTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "bombDisplay", - name = "Olm Bombs", - description = "Display a timer and colour-coded AoE for Olm's crystal-phase bombs.", - titleSection = "olmBombsTitle", - position = 46 - ) - default boolean bombDisplay() - { - return true; - } - - @ConfigItem( - keyName = "bombDisplaynotify", - name = "Olm Bombs Notify", - description = "Configures whether or not AoE Projectile Warnings for Olm Bombs should trigger a notification", - titleSection = "olmBombsTitle", - position = 47, - hide = "aoeNotifyAll" - ) - default boolean bombDisplayNotifyEnabled() - { - return false; - } - - @ConfigTitleSection( - keyName = "olmlightningTitle", - name = "Lightning Trails", - description = "", - position = 48, - titleSection = "olmTitle" - ) - default Title olmlightningTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "lightning", - name = "Olm Lightning Trails", - description = "Show Lightning Trails", - titleSection = "olmlightningTitle", - position = 49 - ) - default boolean LightningTrail() - { - return true; - } - - @ConfigItem( - keyName = "lightningnotify", - name = "Olm Lightning Trails Notify", - description = "Configures whether or not AoE Projectile Warnings for Olm Lightning Trails should trigger a notification", - titleSection = "olmlightningTitle", - position = 50, - hide = "aoeNotifyAll" - ) - default boolean LightningTrailNotifyEnabled() - { - return false; - } - - @ConfigTitleSection( - keyName = "corpTitle", - name = "Corporeal Beast", - description = "", - position = 51, - titleSection = "npcTitle" - ) - default Title corpTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "corp", - name = "Corporeal Beast", - description = "Configures whether or not AoE Projectile Warnings for the Corporeal Beast are displayed", - titleSection = "corpTitle", - position = 52 - ) - default boolean isCorpEnabled() - { - return true; - } - - @ConfigItem( - keyName = "corpnotify", - name = "Corporeal Beast Notify", - description = "Configures whether or not AoE Projectile Warnings for Corporeal Beast should trigger a notification", - titleSection = "corpTitle", - position = 53, - hide = "aoeNotifyAll" - ) - default boolean isCorpNotifyEnabled() - { - return false; - } - - @ConfigTitleSection( - keyName = "wintertodtTitle", - name = "Wintertodt", - description = "", - position = 54, - titleSection = "npcTitle" - ) - default Title wintertodtTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "wintertodt", - name = "Wintertodt Snow Fall", - description = "Configures whether or not AOE Projectile Warnings for the Wintertodt snow fall are displayed", - titleSection = "wintertodtTitle", - position = 55 - ) - default boolean isWintertodtEnabled() - { - return true; - } - - @ConfigItem( - keyName = "wintertodtnotify", - name = "Wintertodt Snow Fall Notify", - description = "Configures whether or not AoE Projectile Warnings for Wintertodt Snow Fall Notify should trigger a notification", - titleSection = "wintertodtTitle", - position = 56, - hide = "aoeNotifyAll" - ) - default boolean isWintertodtNotifyEnabled() - { - return false; - } - - @ConfigTitleSection( - keyName = "xarpusTitle", - name = "Xarpus", - description = "", - position = 57, - titleSection = "npcTitle" - ) - default Title xarpusTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "isXarpusEnabled", - name = "Xarpus", - description = "Configures whether or not AOE Projectile Warnings for Xarpus are displayed", - titleSection = "xarpusTitle", - position = 58 - ) - default boolean isXarpusEnabled() - { - return true; - } - - @ConfigItem( - keyName = "isXarpusEnablednotify", - name = "Xarpus Notify", - description = "Configures whether or not AoE Projectile Warnings for Xarpus should trigger a notification", - titleSection = "xarpusTitle", - position = 59, - hide = "aoeNotifyAll" - ) - default boolean isXarpusNotifyEnabled() - { - return false; - } - - @ConfigTitleSection( - keyName = "addyDragsTitle", - name = "Addy Drags", - description = "", - position = 60, - titleSection = "npcTitle" - ) - default Title addyDragsTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "addyDrags", - name = "Addy Drags", - description = "Show Bad Areas", - titleSection = "addyDragsTitle", - position = 61 - ) - default boolean addyDrags() - { - return true; - } - - @ConfigItem( - keyName = "addyDragsnotify", - name = "Addy Drags Notify", - description = "Configures whether or not AoE Projectile Warnings for Addy Dragons should trigger a notification", - titleSection = "addyDragsTitle", - position = 62, - hide = "aoeNotifyAll" - ) - default boolean addyDragsNotifyEnabled() - { - return false; - } - - @ConfigTitleSection( - keyName = "drakeTitle", - name = "Drakes", - description = "", - position = 63, - titleSection = "npcTitle" - ) - default Title drakeTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "drake", - name = "Drakes Breath", - description = "Configures if Drakes Breath tile markers are displayed", - titleSection = "drakeTitle", - position = 64 - ) - default boolean isDrakeEnabled() - { - return true; - } - - @ConfigItem( - keyName = "drakenotify", - name = "Drakes Breath Notify", - description = "Configures whether or not AoE Projectile Warnings for Drakes Breath should trigger a notification", - titleSection = "drakeTitle", - position = 65, - hide = "aoeNotifyAll" - ) - default boolean isDrakeNotifyEnabled() - { - return false; - } - - @ConfigTitleSection( - keyName = "cerberusTitle", - name = "Cerberus", - description = "", - position = 66, - titleSection = "npcTitle" - ) - default Title cerberusTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "cerbFire", - name = "Cerberus Fire", - description = "Configures if Cerberus fire tile markers are displayed", - titleSection = "cerberusTitle", - position = 67 - ) - default boolean isCerbFireEnabled() - { - return true; - } - - @ConfigItem( - keyName = "cerbFirenotify", - name = "Cerberus Fire Notify", - description = "Configures whether or not AoE Projectile Warnings for Cerberus his fire should trigger a notification", - titleSection = "cerberusTitle", - position = 68, - hide = "aoeNotifyAll" - ) - default boolean isCerbFireNotifyEnabled() - { - return false; - } - - @ConfigTitleSection( - keyName = "demonicGorillaTitle", - name = "Demonic Gorilla", - description = "", - position = 69, - titleSection = "npcTitle" - ) - default Title demonicGorillaTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "demonicGorilla", - name = "Demonic Gorilla", - description = "Configures if Demonic Gorilla boulder tile markers are displayed", - titleSection = "demonicGorillaTitle", - position = 70 - ) - default boolean isDemonicGorillaEnabled() - { - return true; - } - - @ConfigItem( - keyName = "demonicGorillaNotify", - name = "Demonic Gorilla Notify", - description = "Configures whether or not AoE Projectile Warnings for Demonic Gorilla boulders should trigger a notification", - titleSection = "demonicGorillaTitle", - position = 71, - hide = "aoeNotifyAll" - ) - default boolean isDemonicGorillaNotifyEnabled() - { - return false; - } -} \ No newline at end of file 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 deleted file mode 100644 index 9ad9e037fe..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningOverlay.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * All rights reserved. - * - * - * Modified by farhan1666 - * - * 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.aoewarnings; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.Rectangle; -import java.time.Duration; -import java.time.Instant; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.ProjectileID; -import net.runelite.api.Varbits; -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; - -@Singleton -public class AoeWarningOverlay extends Overlay -{ - private static final int FILL_START_ALPHA = 25; - private static final int OUTLINE_START_ALPHA = 255; - - private final Client client; - private final AoeWarningPlugin plugin; - - @Inject - public AoeWarningOverlay(final Client client, final AoeWarningPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.UNDER_WIDGETS); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - WorldPoint lp = client.getLocalPlayer().getWorldLocation(); - - plugin.getLightningTrail().forEach(o -> - OverlayUtil.drawTiles(graphics, client, o, lp, new Color(0, 150, 200), 2, 150, 50)); - - plugin.getAcidTrail().forEach(o -> - OverlayUtil.drawTiles(graphics, client, o.getWorldLocation(), lp, new Color(69, 241, 44), 2, 150, 50)); - - plugin.getCrystalSpike().forEach(o -> - OverlayUtil.drawTiles(graphics, client, o.getWorldLocation(), lp, new Color(255, 0, 84), 2, 150, 50)); - - plugin.getWintertodtSnowFall().forEach(o -> - OverlayUtil.drawTiles(graphics, client, o.getWorldLocation(), lp, new Color(255, 0, 84), 2, 150, 50)); - - Instant now = Instant.now(); - Set projectiles = plugin.getProjectiles(); - projectiles.forEach(proj -> - { - if (proj.getTargetPoint() == null) - { - return; - } - - Color color; - - if (now.isAfter(proj.getStartTime().plus(Duration.ofMillis(proj.getLifetime())))) - { - return; - } - - if (proj.getProjectile().getId() == ProjectileID.ICE_DEMON_ICE_BARRAGE_AOE || proj.getProjectile().getId() == ProjectileID.TEKTON_METEOR_AOE) - { - if (client.getVar(Varbits.IN_RAID) == 0) - { - return; - } - } - - final Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, proj.getTargetPoint(), proj.getAoeProjectileInfo().getAoeSize()); - - if (tilePoly == null) - { - return; - } - - final double progress = (System.currentTimeMillis() - proj.getStartTime().toEpochMilli()) / (double) proj.getLifetime(); - - final int tickProgress = proj.getFinalTick() - client.getTickCount(); - - int fillAlpha, outlineAlpha; - if (plugin.isConfigFadeEnabled()) - { - fillAlpha = (int) ((1 - progress) * FILL_START_ALPHA); - outlineAlpha = (int) ((1 - progress) * OUTLINE_START_ALPHA); - } - else - { - fillAlpha = FILL_START_ALPHA; - outlineAlpha = OUTLINE_START_ALPHA; - } - if (tickProgress == 0) - { - color = Color.RED; - } - else - { - color = Color.WHITE; - } - - if (fillAlpha < 0) - { - fillAlpha = 0; - } - if (outlineAlpha < 0) - { - outlineAlpha = 0; - } - - if (fillAlpha > 255) - { - fillAlpha = 255; - } - if (outlineAlpha > 255) - { - outlineAlpha = 255; - } - - if (plugin.isConfigOutlineEnabled()) - { - graphics.setColor(new Color(setAlphaComponent(plugin.getOverlayColor().getRGB(), outlineAlpha), true)); - graphics.drawPolygon(tilePoly); - } - if (plugin.isTickTimers() && tickProgress >= 0) - { - OverlayUtil.renderTextLocation(graphics, Integer.toString(tickProgress), plugin.getTextSize(), - plugin.getFontStyle(), color, centerPoint(tilePoly.getBounds()), plugin.isShadows(), 0); - } - - graphics.setColor(new Color(setAlphaComponent(plugin.getOverlayColor().getRGB(), fillAlpha), true)); - graphics.fillPolygon(tilePoly); - }); - projectiles.removeIf(proj -> now.isAfter(proj.getStartTime().plus(Duration.ofMillis(proj.getLifetime())))); - return null; - } - - 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 deleted file mode 100644 index 0d486a65ec..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningPlugin.java +++ /dev/null @@ -1,496 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * All rights reserved. - * - * Modified by farhan1666 - * - * 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.aoewarnings; - -import com.google.inject.Provides; -import java.awt.Color; -import java.time.Instant; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.GameState; -import net.runelite.api.GraphicID; -import net.runelite.api.NullObjectID; -import net.runelite.api.ObjectID; -import net.runelite.api.Projectile; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameObjectDespawned; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.ProjectileMoved; -import net.runelite.api.events.ProjectileSpawned; -import net.runelite.client.Notifier; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "AoE Warnings", - description = "Shows the final destination for AoE Attack projectiles", - tags = {"bosses", "combat", "pve", "overlay"}, - type = PluginType.PVM, - enabledByDefault = false -) -@Singleton -@Slf4j -public class AoeWarningPlugin extends Plugin -{ - @Getter(AccessLevel.PACKAGE) - private final Set bombs = new HashSet<>(); - - @Getter(AccessLevel.PACKAGE) - private final Set projectiles = new HashSet<>(); - - @Inject - public AoeWarningConfig config; - - @Inject - private Notifier notifier; - - @Inject - private OverlayManager overlayManager; - - @Inject - private AoeWarningOverlay coreOverlay; - - @Inject - private BombOverlay bombOverlay; - - @Inject - private Client client; - - @Getter(AccessLevel.PACKAGE) - private List lightningTrail = new ArrayList<>(); - - @Getter(AccessLevel.PACKAGE) - private List acidTrail = new ArrayList<>(); - - @Getter(AccessLevel.PACKAGE) - private List crystalSpike = new ArrayList<>(); - - @Getter(AccessLevel.PACKAGE) - private List wintertodtSnowFall = new ArrayList<>(); - - // Config values - private boolean aoeNotifyAll; - @Getter(AccessLevel.PACKAGE) - private Color overlayColor; - @Getter(AccessLevel.PACKAGE) - private boolean configOutlineEnabled; - private int delay; - @Getter(AccessLevel.PACKAGE) - private boolean configFadeEnabled; - @Getter(AccessLevel.PACKAGE) - private boolean tickTimers; - @Getter(AccessLevel.PACKAGE) - private int fontStyle; - @Getter(AccessLevel.PACKAGE) - private int textSize; - @Getter(AccessLevel.PACKAGE) - private boolean shadows; - private boolean configShamansEnabled; - private boolean configShamansNotifyEnabled; - private boolean configArchaeologistEnabled; - private boolean configArchaeologistNotifyEnabled; - private boolean configIceDemonEnabled; - private boolean configIceDemonNotifyEnabled; - private boolean configVasaEnabled; - private boolean configVasaNotifyEnabled; - private boolean configTektonEnabled; - private boolean configTektonNotifyEnabled; - private boolean configVorkathEnabled; - private boolean configVorkathNotifyEnabled; - private boolean configGalvekEnabled; - private boolean configGalvekNotifyEnabled; - private boolean configGargBossEnabled; - private boolean configGargBossNotifyEnabled; - private boolean configVetionEnabled; - private boolean configVetionNotifyEnabled; - private boolean configChaosFanaticEnabled; - private boolean configChaosFanaticNotifyEnabled; - private boolean configOlmEnabled; - private boolean configOlmNotifyEnabled; - @Getter(AccessLevel.PACKAGE) - private boolean configbombDisplay; - private boolean configbombDisplayNotifyEnabled; - private boolean configLightningTrail; - private boolean configLightningTrailNotifyEnabled; - private boolean configCorpEnabled; - private boolean configCorpNotifyEnabled; - private boolean configWintertodtEnabled; - private boolean configWintertodtNotifyEnabled; - private boolean configXarpusEnabled; - private boolean configXarpusNotifyEnabled; - private boolean configaddyDrags; - private boolean configaddyDragsNotifyEnabled; - private boolean configDrakeEnabled; - private boolean configDrakeNotifyEnabled; - private boolean configCerbFireEnabled; - private boolean configCerbFireNotifyEnabled; - private boolean configDemonicGorillaEnabled; - private boolean configDemonicGorillaNotifyEnabled; - - @Provides - AoeWarningConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(AoeWarningConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - overlayManager.add(coreOverlay); - overlayManager.add(bombOverlay); - reset(); - } - - @Override - protected void shutDown() - { - overlayManager.remove(coreOverlay); - overlayManager.remove(bombOverlay); - reset(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("aoe")) - { - return; - } - - updateConfig(); - } - - @Subscribe - private void onProjectileSpawned(ProjectileSpawned event) - { - final Projectile projectile = event.getProjectile(); - - if (AoeProjectileInfo.getById(projectile.getId()) == null) - { - return; - } - - final int id = projectile.getId(); - final int lifetime = this.delay + (projectile.getRemainingCycles() * 20); - int ticksRemaining = projectile.getRemainingCycles() / 30; - if (!isTickTimersEnabledForProjectileID(id)) - { - ticksRemaining = 0; - } - final int tickCycle = client.getTickCount() + ticksRemaining; - if (isConfigEnabledForProjectileId(id, false)) - { - projectiles.add(new ProjectileContainer(projectile, Instant.now(), lifetime, tickCycle)); - - if (this.aoeNotifyAll || isConfigEnabledForProjectileId(id, true)) - { - notifier.notify("AoE attack detected!"); - } - } - } - - @Subscribe - private void onProjectileMoved(ProjectileMoved event) - { - if (projectiles.isEmpty()) - { - return; - } - - final Projectile projectile = event.getProjectile(); - - projectiles.forEach(proj -> - { - if (proj.getProjectile() == projectile) - { - proj.setTargetPoint(event.getPosition()); - } - }); - } - - @Subscribe - private void onGameObjectSpawned(GameObjectSpawned event) - { - final GameObject gameObject = event.getGameObject(); - - switch (gameObject.getId()) - { - case ObjectID.CRYSTAL_BOMB: - bombs.add(new CrystalBomb(gameObject, client.getTickCount())); - - if (this.aoeNotifyAll || this.configbombDisplayNotifyEnabled) - { - notifier.notify("Bomb!"); - } - break; - case ObjectID.ACID_POOL: - acidTrail.add(gameObject); - break; - case ObjectID.SMALL_CRYSTALS: - crystalSpike.add(gameObject); - break; - case NullObjectID.NULL_26690: - if (this.configWintertodtEnabled) - { - wintertodtSnowFall.add(gameObject); - - if (this.aoeNotifyAll || this.configWintertodtNotifyEnabled) - { - notifier.notify("Snow Fall!"); - } - } - break; - } - } - - @Subscribe - private void onGameObjectDespawned(GameObjectDespawned event) - { - final GameObject gameObject = event.getGameObject(); - - switch (gameObject.getId()) - { - case ObjectID.CRYSTAL_BOMB: - bombs.removeIf(o -> o.getGameObject() == gameObject); - break; - case ObjectID.ACID_POOL: - acidTrail.remove(gameObject); - break; - case ObjectID.SMALL_CRYSTALS: - crystalSpike.remove(gameObject); - break; - case NullObjectID.NULL_26690: - wintertodtSnowFall.remove(gameObject); - break; - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGGED_IN) - { - return; - } - reset(); - } - - @Subscribe - private void onGameTick(GameTick event) - { - lightningTrail.clear(); - - if (this.configLightningTrail) - { - client.getGraphicsObjects().forEach(o -> - { - if (o.getId() == GraphicID.OLM_LIGHTNING) - { - lightningTrail.add(WorldPoint.fromLocal(client, o.getLocation())); - - if (this.aoeNotifyAll || this.configLightningTrailNotifyEnabled) - { - notifier.notify("Lightning!"); - } - } - }); - } - - bombs.forEach(CrystalBomb::bombClockUpdate); - } - - 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); - if (projectileInfo == null) - { - return false; - } - - if (notify && this.aoeNotifyAll) - { - return true; - } - - switch (projectileInfo) - { - case LIZARDMAN_SHAMAN_AOE: - return notify ? this.configShamansNotifyEnabled : this.configShamansEnabled; - case CRAZY_ARCHAEOLOGIST_AOE: - return notify ? this.configArchaeologistNotifyEnabled : this.configArchaeologistEnabled; - case ICE_DEMON_RANGED_AOE: - case ICE_DEMON_ICE_BARRAGE_AOE: - return notify ? this.configIceDemonNotifyEnabled : this.configIceDemonEnabled; - case VASA_AWAKEN_AOE: - case VASA_RANGED_AOE: - return notify ? this.configVasaNotifyEnabled : this.configVasaEnabled; - case TEKTON_METEOR_AOE: - return notify ? this.configTektonNotifyEnabled : this.configTektonEnabled; - case VORKATH_BOMB: - case VORKATH_POISON_POOL: - case VORKATH_SPAWN: - case VORKATH_TICK_FIRE: - return notify ? this.configVorkathNotifyEnabled : this.configVorkathEnabled; - case VETION_LIGHTNING: - return notify ? this.configVetionNotifyEnabled : this.configVetionEnabled; - case CHAOS_FANATIC: - return notify ? this.configChaosFanaticNotifyEnabled : this.configChaosFanaticEnabled; - case GALVEK_BOMB: - case GALVEK_MINE: - return notify ? this.configGalvekNotifyEnabled : this.configGalvekEnabled; - case DAWN_FREEZE: - case DUSK_CEILING: - return notify ? this.configGargBossNotifyEnabled : this.configGargBossEnabled; - case OLM_FALLING_CRYSTAL: - case OLM_BURNING: - case OLM_FALLING_CRYSTAL_TRAIL: - case OLM_ACID_TRAIL: - case OLM_FIRE_LINE: - return notify ? this.configOlmNotifyEnabled : this.configOlmEnabled; - case CORPOREAL_BEAST: - case CORPOREAL_BEAST_DARK_CORE: - return notify ? this.configCorpNotifyEnabled : this.configCorpEnabled; - case XARPUS_POISON_AOE: - return notify ? this.configXarpusNotifyEnabled : this.configXarpusEnabled; - case ADDY_DRAG_POISON: - return notify ? this.configaddyDragsNotifyEnabled : this.configaddyDrags; - case DRAKE_BREATH: - return notify ? this.configDrakeNotifyEnabled : this.configDrakeEnabled; - case CERB_FIRE: - return notify ? this.configCerbFireNotifyEnabled : this.configCerbFireEnabled; - case DEMONIC_GORILLA_BOULDER: - return notify ? this.configDemonicGorillaNotifyEnabled : this.configDemonicGorillaEnabled; - } - - return false; - } - - private void updateConfig() - { - this.aoeNotifyAll = config.aoeNotifyAll(); - this.overlayColor = config.overlayColor(); - this.configOutlineEnabled = config.isOutlineEnabled(); - this.delay = config.delay(); - this.configFadeEnabled = config.isFadeEnabled(); - this.tickTimers = config.tickTimers(); - this.fontStyle = config.fontStyle().getFont(); - this.textSize = config.textSize(); - this.shadows = config.shadows(); - this.configShamansEnabled = config.isShamansEnabled(); - this.configShamansNotifyEnabled = config.isShamansNotifyEnabled(); - this.configArchaeologistEnabled = config.isArchaeologistEnabled(); - this.configArchaeologistNotifyEnabled = config.isArchaeologistNotifyEnabled(); - this.configIceDemonEnabled = config.isIceDemonEnabled(); - this.configIceDemonNotifyEnabled = config.isIceDemonNotifyEnabled(); - this.configVasaEnabled = config.isVasaEnabled(); - this.configVasaNotifyEnabled = config.isVasaNotifyEnabled(); - this.configTektonEnabled = config.isTektonEnabled(); - this.configTektonNotifyEnabled = config.isTektonNotifyEnabled(); - this.configVorkathEnabled = config.isVorkathEnabled(); - this.configVorkathNotifyEnabled = config.isVorkathNotifyEnabled(); - this.configGalvekEnabled = config.isGalvekEnabled(); - this.configGalvekNotifyEnabled = config.isGalvekNotifyEnabled(); - this.configGargBossEnabled = config.isGargBossEnabled(); - this.configGargBossNotifyEnabled = config.isGargBossNotifyEnabled(); - this.configVetionEnabled = config.isVetionEnabled(); - this.configVetionNotifyEnabled = config.isVetionNotifyEnabled(); - this.configChaosFanaticEnabled = config.isChaosFanaticEnabled(); - this.configChaosFanaticNotifyEnabled = config.isChaosFanaticNotifyEnabled(); - this.configOlmEnabled = config.isOlmEnabled(); - this.configOlmNotifyEnabled = config.isOlmNotifyEnabled(); - this.configbombDisplay = config.bombDisplay(); - this.configbombDisplayNotifyEnabled = config.bombDisplayNotifyEnabled(); - this.configLightningTrail = config.LightningTrail(); - this.configLightningTrailNotifyEnabled = config.LightningTrailNotifyEnabled(); - this.configCorpEnabled = config.isCorpEnabled(); - this.configCorpNotifyEnabled = config.isCorpNotifyEnabled(); - this.configWintertodtEnabled = config.isWintertodtEnabled(); - this.configWintertodtNotifyEnabled = config.isWintertodtNotifyEnabled(); - this.configXarpusEnabled = config.isXarpusEnabled(); - this.configXarpusNotifyEnabled = config.isXarpusNotifyEnabled(); - this.configaddyDrags = config.addyDrags(); - this.configaddyDragsNotifyEnabled = config.addyDragsNotifyEnabled(); - this.configDrakeEnabled = config.isDrakeEnabled(); - this.configDrakeNotifyEnabled = config.isDrakeNotifyEnabled(); - this.configCerbFireEnabled = config.isCerbFireEnabled(); - this.configCerbFireNotifyEnabled = config.isCerbFireNotifyEnabled(); - this.configDemonicGorillaEnabled = config.isDemonicGorillaEnabled(); - this.configDemonicGorillaNotifyEnabled = config.isDemonicGorillaNotifyEnabled(); - } - - private void reset() - { - lightningTrail.clear(); - acidTrail.clear(); - crystalSpike.clear(); - wintertodtSnowFall.clear(); - bombs.clear(); - projectiles.clear(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/BombOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/BombOverlay.java deleted file mode 100644 index 707ed7c5c4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/BombOverlay.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2018, PallasDieKatze (Pallas Cat) - * 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.aoewarnings; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.text.DecimalFormat; -import java.text.NumberFormat; -import java.time.Instant; -import java.util.Locale; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -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.OverlayPriority; -import net.runelite.client.ui.overlay.OverlayUtil; - -@Slf4j -@Singleton -public class BombOverlay extends Overlay -{ - - private static final String SAFE = "#00cc00"; - private static final String CAUTION = "#ffff00"; - private static final String WARNING = "#ff9933"; - private static final String DANGER = "#ff6600"; - private static final String LETHAL = "#cc0000"; - private static final int BOMB_AOE = 7; - private static final int BOMB_DETONATE_TIME = 8; - private static final double ESTIMATED_TICK_LENGTH = .6; - private static final NumberFormat TIME_LEFT_FORMATTER = - DecimalFormat.getInstance(Locale.US); - - static - { - ((DecimalFormat) TIME_LEFT_FORMATTER).applyPattern("#0.0"); - } - - private final Client client; - private final AoeWarningPlugin plugin; - - @Inject - public BombOverlay(final Client client, final AoeWarningPlugin plugin) - { - this.client = client; - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - setPriority(OverlayPriority.MED); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.isConfigbombDisplay()) - { - drawDangerZone(graphics); - } - return null; - } - - private void drawDangerZone(Graphics2D graphics) - { - final WorldPoint loc = client.getLocalPlayer().getWorldLocation(); - plugin.getBombs().forEach(bomb -> - { - final LocalPoint localLoc = LocalPoint.fromWorld(client, bomb.getWorldLocation()); - final WorldPoint worldLoc = bomb.getWorldLocation(); - - if (localLoc == null) - { - return; - } - - final double distance_x = Math.abs(worldLoc.getX() - loc.getX()); - final double distance_y = Math.abs(worldLoc.getY() - loc.getY()); - - Color color_code = Color.decode(SAFE); - - if (distance_x < 1 && distance_y < 1) - { - color_code = Color.decode(LETHAL); - } - else if (distance_x < 2 && distance_y < 2) - { - color_code = Color.decode(DANGER); - } - else if (distance_x < 3 && distance_y < 3) - { - color_code = Color.decode(WARNING); - } - else if (distance_x < 4 && distance_y < 4) - { - color_code = Color.decode(CAUTION); - } - final LocalPoint CenterPoint = new LocalPoint(localLoc.getX(), localLoc.getY()); - final Polygon poly = Perspective.getCanvasTileAreaPoly(client, CenterPoint, BOMB_AOE); - - if (poly != null) - { - graphics.setColor(color_code); - graphics.setStroke(new BasicStroke(1)); - graphics.drawPolygon(poly); - graphics.setColor(new Color(0, 0, 0, 10)); - graphics.fillPolygon(poly); - } - - final Instant now = Instant.now(); - double timeLeft = ((BOMB_DETONATE_TIME - (client.getTickCount() - bomb.getTickStarted())) * ESTIMATED_TICK_LENGTH) - - (now.toEpochMilli() - bomb.getLastClockUpdate().toEpochMilli()) / 1000.0; - - timeLeft = Math.max(0.0, timeLeft); - final String bombTimerString = TIME_LEFT_FORMATTER.format(timeLeft); - final int textWidth = graphics.getFontMetrics().stringWidth(bombTimerString); - final int textHeight = graphics.getFontMetrics().getAscent(); - final Point canvasPoint = Perspective.localToCanvas(client, localLoc.getX(), localLoc.getY(), worldLoc.getPlane()); - - if (canvasPoint != null) - { - Point canvasCenterPoint = new Point(canvasPoint.getX() - textWidth / 2, canvasPoint.getY() + textHeight / 2); - OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, bombTimerString, color_code); - } - }); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/CrystalBomb.java b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/CrystalBomb.java deleted file mode 100644 index ade1288e48..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/CrystalBomb.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2018, PallasDieKatze (Pallas Cat) - * 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.aoewarnings; - -import java.time.Instant; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.GameObject; -import net.runelite.api.coords.WorldPoint; - -@Slf4j -@Getter(AccessLevel.PACKAGE) -class CrystalBomb -{ - private GameObject gameObject; - private Instant plantedOn; - private Instant lastClockUpdate; - private int objectId; - private int tickStarted; - private WorldPoint worldLocation; - - CrystalBomb(GameObject gameObject, int startTick) - { - this.gameObject = gameObject; - this.objectId = gameObject.getId(); - this.plantedOn = Instant.now(); - this.worldLocation = gameObject.getWorldLocation(); - this.tickStarted = startTick; - } - - void bombClockUpdate() - { - lastClockUpdate = Instant.now(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/ProjectileContainer.java b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/ProjectileContainer.java deleted file mode 100644 index cb226d6262..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/ProjectileContainer.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.runelite.client.plugins.aoewarnings; - -import java.time.Instant; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.Projectile; -import net.runelite.api.coords.LocalPoint; - -@Getter(AccessLevel.PACKAGE) -class ProjectileContainer -{ - private Projectile projectile; - private Instant startTime; - private AoeProjectileInfo aoeProjectileInfo; - private int lifetime; - private int finalTick; - @Setter(AccessLevel.PACKAGE) - private LocalPoint targetPoint; - - ProjectileContainer(Projectile projectile, Instant startTime, int lifetime, int finalTick) - { - this.projectile = projectile; - this.startTime = startTime; - this.targetPoint = null; - this.aoeProjectileInfo = AoeProjectileInfo.getById(projectile.getId()); - this.lifetime = lifetime; - this.finalTick = finalTick; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStyle.java b/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStyle.java deleted file mode 100644 index c32ba11af3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStyle.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2017, honeyhoney - * 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.attackstyles; - -import net.runelite.api.Skill; - -public enum AttackStyle -{ - ACCURATE("Accurate", Skill.ATTACK), - AGGRESSIVE("Aggressive", Skill.STRENGTH), - DEFENSIVE("Defensive", Skill.DEFENCE), - CONTROLLED("Controlled", Skill.ATTACK, Skill.STRENGTH, Skill.DEFENCE), - RANGING("Ranging", Skill.RANGED), - LONGRANGE("Longrange", Skill.RANGED, Skill.DEFENCE), - CASTING("Casting", Skill.MAGIC), - DEFENSIVE_CASTING("Defensive Casting", Skill.MAGIC, Skill.DEFENCE), - OTHER("Other"); - - private final String name; - private final Skill[] skills; - - AttackStyle(String name, Skill... skills) - { - this.name = name; - this.skills = skills; - } - - public String getName() - { - return name; - } - - public Skill[] getSkills() - { - return skills; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesConfig.java deleted file mode 100644 index c3715481d1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesConfig.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2017, honeyhoney - * 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.attackstyles; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("attackIndicator") -public interface AttackStylesConfig extends Config -{ - @ConfigItem( - keyName = "alwaysShowStyle", - name = "Always show style", - description = "Show attack style indicator at all times", - position = 1 - ) - default boolean alwaysShowStyle() - { - return true; - } - - @ConfigItem( - keyName = "warnForDefensive", - name = "Warn for defence", - description = "Show warning when a Defence skill combat option is selected", - position = 2 - ) - default boolean warnForDefence() - { - return false; - } - - @ConfigItem( - keyName = "warnForAttack", - name = "Warn for attack", - description = "Show warning when an Attack skill combat option is selected", - position = 3 - ) - default boolean warnForAttack() - { - return false; - } - - @ConfigItem( - keyName = "warnForStrength", - name = "Warn for strength", - description = "Show warning when a Strength skill combat option is selected", - position = 4 - ) - default boolean warnForStrength() - { - return false; - } - - @ConfigItem( - keyName = "warnForRanged", - name = "Warn for ranged", - description = "Show warning when a Ranged skill combat option is selected", - position = 5 - ) - default boolean warnForRanged() - { - return false; - } - - @ConfigItem( - keyName = "warnForMagic", - name = "Warn for magic", - description = "Show warning when a Magic skill combat option is selected", - position = 6 - ) - default boolean warnForMagic() - { - return false; - } - - @ConfigItem( - keyName = "hideAutoRetaliate", - name = "Hide auto retaliate", - description = "Hide auto retaliate from the combat options tab", - position = 7 - ) - default boolean hideAutoRetaliate() - { - return false; - } - - @ConfigItem( - keyName = "removeWarnedStyles", - name = "Remove warned styles", - description = "Remove warned styles from the combat options tab", - position = 8 - ) - default boolean removeWarnedStyles() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesOverlay.java deleted file mode 100644 index 784a569d4a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesOverlay.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2017, honeyhoney - * 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.attackstyles; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -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; - -@Singleton -class AttackStylesOverlay extends Overlay -{ - private final AttackStylesPlugin plugin; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - private AttackStylesOverlay(final AttackStylesPlugin plugin) - { - super(plugin); - setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT); - this.plugin = plugin; - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Attack style overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - panelComponent.getChildren().clear(); - boolean warnedSkillSelected = plugin.isWarnedSkillSelected(); - - if (warnedSkillSelected || plugin.isAlwaysShowStyle()) - { - final AttackStyle attackStyle = plugin.getAttackStyle(); - - if (attackStyle == null) - { - return null; - } - - final String attackStyleString = attackStyle.getName(); - - panelComponent.getChildren().add(TitleComponent.builder() - .text(attackStyleString) - .color(warnedSkillSelected ? Color.RED : Color.WHITE) - .build()); - - panelComponent.setPreferredSize(new Dimension( - graphics.getFontMetrics().stringWidth(attackStyleString) + 10, - 0)); - - return panelComponent.render(graphics); - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesPlugin.java deleted file mode 100644 index 29dc7792d4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesPlugin.java +++ /dev/null @@ -1,416 +0,0 @@ -/* - * Copyright (c) 2017, honeyhoney - * 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.attackstyles; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.collect.HashBasedTable; -import com.google.common.collect.Table; -import com.google.inject.Provides; -import java.util.HashSet; -import java.util.Set; -import javax.annotation.Nullable; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.Skill; -import net.runelite.api.VarPlayer; -import net.runelite.api.Varbits; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.events.WidgetHiddenChanged; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.widgets.Widget; -import static net.runelite.api.widgets.WidgetID.COMBAT_GROUP_ID; -import net.runelite.api.widgets.WidgetInfo; -import static net.runelite.api.widgets.WidgetInfo.TO_GROUP; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import static net.runelite.client.plugins.attackstyles.AttackStyle.CASTING; -import static net.runelite.client.plugins.attackstyles.AttackStyle.DEFENSIVE_CASTING; -import static net.runelite.client.plugins.attackstyles.AttackStyle.OTHER; -import net.runelite.client.ui.overlay.OverlayManager; - -@PluginDescriptor( - name = "Attack Styles", - description = "Show your current attack style as an overlay", - tags = {"combat", "defence", "magic", "overlay", "ranged", "strength", "warn", "pure"}, - type = PluginType.UTILITY -) -@Singleton -public class AttackStylesPlugin extends Plugin -{ - private int attackStyleVarbit = -1; - private int equippedWeaponTypeVarbit = -1; - private int castingModeVarbit = -1; - @Getter(AccessLevel.PACKAGE) - @Nullable - private AttackStyle attackStyle; - private final Set warnedSkills = new HashSet<>(); - @Getter(AccessLevel.PACKAGE) - private boolean warnedSkillSelected = false; - private final Table widgetsToHide = HashBasedTable.create(); - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private AttackStylesConfig config; - - @Inject - private OverlayManager overlayManager; - - @Inject - private AttackStylesOverlay overlay; - - @Provides - AttackStylesConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(AttackStylesConfig.class); - } - - // config values - @Getter(AccessLevel.PACKAGE) - private boolean alwaysShowStyle; - private boolean warnForDefence; - private boolean warnForAttack; - private boolean warnForStrength; - private boolean warnForRanged; - private boolean warnForMagic; - private boolean hideAutoRetaliate; - @VisibleForTesting - boolean removeWarnedStyles; - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - - if (client.getGameState() == GameState.LOGGED_IN) - { - clientThread.invoke(this::start); - } - } - - private void start() - { - resetWarnings(); - - attackStyleVarbit = client.getVar(VarPlayer.ATTACK_STYLE); - equippedWeaponTypeVarbit = client.getVar(Varbits.EQUIPPED_WEAPON_TYPE); - castingModeVarbit = client.getVar(Varbits.DEFENSIVE_CASTING_MODE); - updateAttackStyle( - equippedWeaponTypeVarbit, - attackStyleVarbit, - castingModeVarbit); - updateWarning(false); - processWidgets(); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - hideWarnedStyles(false); - processWidgets(); - hideWidget(client.getWidget(WidgetInfo.COMBAT_AUTO_RETALIATE), false); - } - - @Subscribe - @VisibleForTesting - void onWidgetHiddenChanged(WidgetHiddenChanged event) - { - if (event.getWidget().isSelfHidden() || TO_GROUP(event.getWidget().getId()) != COMBAT_GROUP_ID) - { - return; - } - - processWidgets(); - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded event) - { - if (event.getGroupId() != COMBAT_GROUP_ID) - { - return; - } - - processWidgets(); - } - - /** - * Hide or unhide widgets depending on widgetsToHide - */ - private void processWidgets() - { - WeaponType equippedWeaponType = WeaponType.getWeaponType(equippedWeaponTypeVarbit); - - if (widgetsToHide.containsRow(equippedWeaponType)) - { - for (WidgetInfo widgetKey : widgetsToHide.row(equippedWeaponType).keySet()) - { - hideWidget(client.getWidget(widgetKey), widgetsToHide.get(equippedWeaponType, widgetKey)); - } - } - hideWidget(client.getWidget(WidgetInfo.COMBAT_AUTO_RETALIATE), this.hideAutoRetaliate); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGGED_IN) - { - resetWarnings(); - } - } - - @Subscribe - @VisibleForTesting - void onVarbitChanged(VarbitChanged event) - { - int currentAttackStyleVarbit = client.getVar(VarPlayer.ATTACK_STYLE); - int currentEquippedWeaponTypeVarbit = client.getVar(Varbits.EQUIPPED_WEAPON_TYPE); - int currentCastingModeVarbit = client.getVar(Varbits.DEFENSIVE_CASTING_MODE); - - if (attackStyleVarbit != currentAttackStyleVarbit || equippedWeaponTypeVarbit != currentEquippedWeaponTypeVarbit || castingModeVarbit != currentCastingModeVarbit) - { - boolean weaponSwitch = currentEquippedWeaponTypeVarbit != equippedWeaponTypeVarbit; - - attackStyleVarbit = currentAttackStyleVarbit; - equippedWeaponTypeVarbit = currentEquippedWeaponTypeVarbit; - castingModeVarbit = currentCastingModeVarbit; - - updateAttackStyle(equippedWeaponTypeVarbit, attackStyleVarbit, - castingModeVarbit); - updateWarning(weaponSwitch); - - if (weaponSwitch) - { - processWidgets(); - } - } - } - - @Subscribe - @VisibleForTesting - void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("attackIndicator")) - { - updateConfig(); - - boolean enabled = event.getNewValue().equals("true"); - switch (event.getKey()) - { - case "warnForDefensive": - updateWarnedSkills(enabled, Skill.DEFENCE); - break; - case "warnForAttack": - updateWarnedSkills(enabled, Skill.ATTACK); - break; - case "warnForStrength": - updateWarnedSkills(enabled, Skill.STRENGTH); - break; - case "warnForRanged": - updateWarnedSkills(enabled, Skill.RANGED); - break; - case "warnForMagic": - updateWarnedSkills(enabled, Skill.MAGIC); - break; - case "removeWarnedStyles": - hideWarnedStyles(enabled); - break; - } - processWidgets(); - } - } - - private void updateConfig() - { - this.alwaysShowStyle = config.alwaysShowStyle(); - this.warnForDefence = config.warnForDefence(); - this.warnForAttack = config.warnForAttack(); - this.warnForStrength = config.warnForStrength(); - this.warnForRanged = config.warnForRanged(); - this.warnForMagic = config.warnForMagic(); - this.hideAutoRetaliate = config.hideAutoRetaliate(); - this.removeWarnedStyles = config.removeWarnedStyles(); - } - - private void resetWarnings() - { - updateWarnedSkills(this.warnForAttack, Skill.ATTACK); - updateWarnedSkills(this.warnForStrength, Skill.STRENGTH); - updateWarnedSkills(this.warnForDefence, Skill.DEFENCE); - updateWarnedSkills(this.warnForRanged, Skill.RANGED); - updateWarnedSkills(this.warnForMagic, Skill.MAGIC); - } - - private void updateAttackStyle(int equippedWeaponType, int attackStyleIndex, int castingMode) - { - AttackStyle[] attackStyles = WeaponType.getWeaponType(equippedWeaponType).getAttackStyles(); - if (attackStyleIndex < attackStyles.length) - { - attackStyle = attackStyles[attackStyleIndex]; - if (attackStyle == null) - { - attackStyle = OTHER; - } - else if ((attackStyle == CASTING) && (castingMode == 1)) - { - attackStyle = DEFENSIVE_CASTING; - } - } - } - - private void updateWarnedSkills(boolean enabled, Skill skill) - { - if (enabled) - { - warnedSkills.add(skill); - } - else - { - warnedSkills.remove(skill); - } - updateWarning(false); - } - - private void updateWarning(boolean weaponSwitch) - { - warnedSkillSelected = false; - if (attackStyle != null) - { - for (Skill skill : attackStyle.getSkills()) - { - if (warnedSkills.contains(skill)) - { -// if (weaponSwitch) -// { -// // TODO : chat message to warn players that their weapon switch also caused an unwanted attack style change -// } - warnedSkillSelected = true; - break; - } - } - } - hideWarnedStyles(this.removeWarnedStyles); - } - - private void hideWarnedStyles(boolean enabled) - { - WeaponType equippedWeaponType = WeaponType.getWeaponType(equippedWeaponTypeVarbit); - if (equippedWeaponType == null) - { - return; - } - - AttackStyle[] attackStyles = equippedWeaponType.getAttackStyles(); - - // Iterate over attack styles - for (int i = 0; i < attackStyles.length; i++) - { - AttackStyle attackStyle = attackStyles[i]; - if (attackStyle == null) - { - continue; - } - - boolean warnedSkill = false; - for (Skill skill : attackStyle.getSkills()) - { - if (warnedSkills.contains(skill)) - { - warnedSkill = true; - break; - } - } - - // Magic staves defensive casting mode - if (attackStyle == AttackStyle.DEFENSIVE_CASTING || !enabled) - { - widgetsToHide.put(equippedWeaponType, WidgetInfo.COMBAT_DEFENSIVE_SPELL_BOX, enabled && warnedSkill); - widgetsToHide.put(equippedWeaponType, WidgetInfo.COMBAT_DEFENSIVE_SPELL_ICON, enabled && warnedSkill); - widgetsToHide.put(equippedWeaponType, WidgetInfo.COMBAT_DEFENSIVE_SPELL_SHIELD, enabled && warnedSkill); - widgetsToHide.put(equippedWeaponType, WidgetInfo.COMBAT_DEFENSIVE_SPELL_TEXT, enabled && warnedSkill); - } - - // Remove appropriate combat option - switch (i) - { - case 0: - widgetsToHide.put(equippedWeaponType, WidgetInfo.COMBAT_STYLE_ONE, enabled && warnedSkill); - break; - case 1: - widgetsToHide.put(equippedWeaponType, WidgetInfo.COMBAT_STYLE_TWO, enabled && warnedSkill); - break; - case 2: - widgetsToHide.put(equippedWeaponType, WidgetInfo.COMBAT_STYLE_THREE, enabled && warnedSkill); - break; - case 3: - widgetsToHide.put(equippedWeaponType, WidgetInfo.COMBAT_STYLE_FOUR, enabled && warnedSkill); - break; - case 4: - widgetsToHide.put(equippedWeaponType, WidgetInfo.COMBAT_SPELLS, enabled && warnedSkill); - break; - default: - // 5 can be defensive casting - } - } - } - - private void hideWidget(Widget widget, boolean hidden) - { - if (widget != null) - { - widget.setHidden(hidden); - } - } - - @VisibleForTesting - Set getWarnedSkills() - { - return warnedSkills; - } - - @VisibleForTesting - Table getHiddenWidgets() - { - return widgetsToHide; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/WeaponType.java b/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/WeaponType.java deleted file mode 100644 index e1d3fa9442..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/WeaponType.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2017, honeyhoney - * 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.attackstyles; - -import com.google.common.collect.ImmutableMap; -import java.util.Map; -import static net.runelite.client.plugins.attackstyles.AttackStyle.ACCURATE; -import static net.runelite.client.plugins.attackstyles.AttackStyle.AGGRESSIVE; -import static net.runelite.client.plugins.attackstyles.AttackStyle.CASTING; -import static net.runelite.client.plugins.attackstyles.AttackStyle.CONTROLLED; -import static net.runelite.client.plugins.attackstyles.AttackStyle.DEFENSIVE; -import static net.runelite.client.plugins.attackstyles.AttackStyle.DEFENSIVE_CASTING; -import static net.runelite.client.plugins.attackstyles.AttackStyle.LONGRANGE; -import static net.runelite.client.plugins.attackstyles.AttackStyle.OTHER; -import static net.runelite.client.plugins.attackstyles.AttackStyle.RANGING; - -public enum WeaponType -{ - TYPE_0(ACCURATE, AGGRESSIVE, null, DEFENSIVE), - TYPE_1(ACCURATE, AGGRESSIVE, AGGRESSIVE, DEFENSIVE), - TYPE_2(ACCURATE, AGGRESSIVE, null, DEFENSIVE), - TYPE_3(RANGING, RANGING, null, LONGRANGE), - TYPE_4(ACCURATE, AGGRESSIVE, CONTROLLED, DEFENSIVE), - TYPE_5(RANGING, RANGING, null, LONGRANGE), - TYPE_6(AGGRESSIVE, RANGING, DEFENSIVE_CASTING, null), - TYPE_7(RANGING, RANGING, null, LONGRANGE), - TYPE_8(OTHER, AGGRESSIVE, null, null), - TYPE_9(ACCURATE, AGGRESSIVE, CONTROLLED, DEFENSIVE), - TYPE_10(ACCURATE, AGGRESSIVE, AGGRESSIVE, DEFENSIVE), - TYPE_11(ACCURATE, AGGRESSIVE, AGGRESSIVE, DEFENSIVE), - TYPE_12(CONTROLLED, AGGRESSIVE, null, DEFENSIVE), - TYPE_13(ACCURATE, AGGRESSIVE, null, DEFENSIVE), - TYPE_14(ACCURATE, AGGRESSIVE, AGGRESSIVE, DEFENSIVE), - TYPE_15(CONTROLLED, CONTROLLED, CONTROLLED, DEFENSIVE), - TYPE_16(ACCURATE, AGGRESSIVE, CONTROLLED, DEFENSIVE), - TYPE_17(ACCURATE, AGGRESSIVE, AGGRESSIVE, DEFENSIVE), - TYPE_18(ACCURATE, AGGRESSIVE, null, DEFENSIVE, CASTING, DEFENSIVE_CASTING), - TYPE_19(RANGING, RANGING, null, LONGRANGE), - TYPE_20(ACCURATE, CONTROLLED, null, DEFENSIVE), - TYPE_21(ACCURATE, AGGRESSIVE, null, DEFENSIVE, CASTING, DEFENSIVE_CASTING), - TYPE_22(ACCURATE, AGGRESSIVE, AGGRESSIVE, DEFENSIVE), - TYPE_23(CASTING, CASTING, null, DEFENSIVE_CASTING), - TYPE_24(ACCURATE, AGGRESSIVE, CONTROLLED, DEFENSIVE), - TYPE_25(CONTROLLED, AGGRESSIVE, null, DEFENSIVE), - TYPE_26(AGGRESSIVE, AGGRESSIVE, null, AGGRESSIVE), - TYPE_27(ACCURATE, null, null, OTHER); - - private final AttackStyle[] attackStyles; - - private static final Map weaponTypes; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (WeaponType weaponType : values()) - { - builder.put(weaponType.ordinal(), weaponType); - } - - weaponTypes = builder.build(); - } - - WeaponType(AttackStyle... attackStyles) - { - this.attackStyles = attackStyles; - } - - public AttackStyle[] getAttackStyles() - { - return attackStyles; - } - - public static WeaponType getWeaponType(int id) - { - return weaponTypes.get(id); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankConfig.java deleted file mode 100644 index eea92e195d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankConfig.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) 2018, TheLonelyDev - * Copyright (c) 2018, Jeremy Plsek - * 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.bank; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigSection; - -@ConfigGroup("bank") -public interface BankConfig extends Config -{ - @ConfigSection( - name = "Show Values", - description = "", - position = 0, - keyName = "ValueSection" - ) - default boolean ValueSection() - { - return false; - } - - @ConfigSection( - name = "Disable Left Click", - description = "", - position = 1, - keyName = "DisableLClickSection" - ) - default boolean DisableLClickSection() - { - return false; - } - - @ConfigSection( - name = "Bank Pin", - description = "", - position = 2, - keyName = "BankPinSection" - ) - default boolean BankPinSection() - { - return false; - } - - @ConfigItem( - keyName = "showGE", - name = "Show Grand Exchange price", - description = "Show grand exchange price total (GE)", - position = 0, - section = "ValueSection" - ) - default boolean showGE() - { - return true; - } - - @ConfigItem( - keyName = "showHA", - name = "Show high alchemy price", - description = "Show high alchemy price total (HA)", - position = 2, - section = "ValueSection" - ) - default boolean showHA() - { - return false; - } - - @ConfigItem( - keyName = "showExact", - name = "Show exact bank value", - description = "Show exact bank value", - position = 3, - section = "ValueSection" - ) - default boolean showExact() - { - return false; - } - - @ConfigItem( - keyName = "seedVaultValue", - name = "Show seed vault value", - description = "Adds the total value of all seeds inside the seed vault to the title", - position = 4, - section = "ValueSection" - ) - default boolean seedVaultValue() - { - return true; - } - - @ConfigItem( - keyName = "rightClickBankInventory", - name = "Disable left click bank inventory", - description = "Configures whether the bank inventory button will bank your inventory on left click", - position = 0, - section = "DisableLClickSection" - ) - default boolean rightClickBankInventory() - { - return false; - } - - @ConfigItem( - keyName = "rightClickBankEquip", - name = "Disable left click bank equipment", - description = "Configures whether the bank equipment button will bank your equipment on left click", - position = 1, - section = "DisableLClickSection" - ) - default boolean rightClickBankEquip() - { - return false; - } - - @ConfigItem( - keyName = "rightClickBankLoot", - name = "Disable left click bank looting bag", - description = "Configures whether the bank looting bag button will bank your looting bag contents on left click", - position = 2, - section = "DisableLClickSection" - ) - default boolean rightClickBankLoot() - { - return false; - } - - @ConfigItem( - keyName = "rightClickSetPlaceholders", - name = "Disable left click set placeholders", - description = "Configures whether the set bank placeholder button will be on left click", - position = 3, - section = "DisableLClickSection" - ) - default boolean rightClickSetPlaceholders() - { - return false; - } - - @ConfigItem( - keyName = "rightClickReleasePlaceholders", - name = "Disable left click release placeholder", - description = "Configures whether the release bank placeholder button will be on left click", - position = 4, - section = "DisableLClickSection" - ) - default boolean rightClickReleasePlaceholders() - { - return false; - } - - @ConfigItem( - keyName = "rightClickFillBankFiller", - name = "Disable left click fill bank fillers", - description = "Configures whether the fill bank fillers button will be on left click", - position = 5, - section = "DisableLClickSection" - ) - default boolean rightClickFillBankFiller() - { - return false; - } - - @ConfigItem( - keyName = "rightClickSearch", - name = "Disable left click search", - description = "Configures whether the search button will search on left click", - position = 6, - section = "DisableLClickSection" - ) - default boolean rightClickSearch() - { - return false; - } - - @ConfigItem( - keyName = "largePinNumbers", - name = "Large bank pin numbers", - description = "Enlarges and centers the numbers inside the bank pin buttons", - position = 0, - section = "BankPinSection" - ) - default boolean largePinNumbers() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankPlugin.java deleted file mode 100644 index 971731de4b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankPlugin.java +++ /dev/null @@ -1,597 +0,0 @@ -/* - * Copyright (c) 2018, TheLonelyDev - * Copyright (c) 2018, Jeremy Plsek - * 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.bank; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Strings; -import com.google.common.collect.HashMultiset; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Multiset; -import com.google.inject.Provides; -import java.text.ParseException; -import java.util.Arrays; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import static net.runelite.api.Constants.HIGH_ALCHEMY_MULTIPLIER; -import net.runelite.api.FontID; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemDefinition; -import net.runelite.api.ItemID; -import net.runelite.api.MenuEntry; -import net.runelite.api.SpriteID; -import net.runelite.api.VarClientInt; -import net.runelite.api.VarClientStr; -import net.runelite.api.Varbits; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.MenuShouldLeftClick; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.api.events.VarClientStrChanged; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.vars.InputType; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.banktags.tabs.BankSearch; -import net.runelite.client.util.QuantityFormatter; - -@PluginDescriptor( - name = "Bank", - description = "Modifications to the banking interface", - tags = {"grand", "exchange", "high", "alchemy", "prices", "deposit"}, - type = PluginType.UTILITY -) -@Singleton -public class BankPlugin extends Plugin -{ - private static final List TAB_VARBITS = ImmutableList.of( - Varbits.BANK_TAB_ONE_COUNT, - Varbits.BANK_TAB_TWO_COUNT, - Varbits.BANK_TAB_THREE_COUNT, - Varbits.BANK_TAB_FOUR_COUNT, - Varbits.BANK_TAB_FIVE_COUNT, - Varbits.BANK_TAB_SIX_COUNT, - Varbits.BANK_TAB_SEVEN_COUNT, - Varbits.BANK_TAB_EIGHT_COUNT, - Varbits.BANK_TAB_NINE_COUNT - ); - - private static final List BANK_PINS = ImmutableList.of( - WidgetInfo.BANK_PIN_1, - WidgetInfo.BANK_PIN_2, - WidgetInfo.BANK_PIN_3, - WidgetInfo.BANK_PIN_4, - WidgetInfo.BANK_PIN_5, - WidgetInfo.BANK_PIN_6, - WidgetInfo.BANK_PIN_7, - WidgetInfo.BANK_PIN_8, - WidgetInfo.BANK_PIN_9, - WidgetInfo.BANK_PIN_10 - ); - - private static final String DEPOSIT_WORN = "Deposit worn items"; - private static final String DEPOSIT_INVENTORY = "Deposit inventory"; - private static final String DEPOSIT_LOOT = "Deposit loot"; - private static final String DISABLE = "Disable"; - private static final String ENABLE = "Enable"; - private static final String RELEASE_ALL_PLACEHOLDERS = "Release all placeholders"; - private static final String SEARCH = "Search"; - private static final String FILL = "Fill"; - - private static final String SEED_VAULT_TITLE = "Seed Vault"; - private static final int PIN_FONT_OFFSET = 5; - - private static final String NUMBER_REGEX = "[0-9]+(\\.[0-9]+)?[kmb]?"; - private static final Pattern VALUE_SEARCH_PATTERN = Pattern.compile("^(?ge|ha|alch)?" + - " *(((?[<>=]|>=|<=) *(?" + NUMBER_REGEX + "))|" + - "((?" + NUMBER_REGEX + ") *- *(?" + NUMBER_REGEX + ")))$", Pattern.CASE_INSENSITIVE); - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private ItemManager itemManager; - - @Inject - private BankConfig config; - - @Inject - private BankSearch bankSearch; - - @Inject - private ContainerCalculation bankCalculation; - - @Inject - private ContainerCalculation seedVaultCalculation; - - private boolean forceRightClickFlag; - private boolean largePinNumbers; - private Multiset itemQuantities; // bank item quantities for bank value search - private String searchString; - @Getter(AccessLevel.PACKAGE) - private boolean showGE; - @Getter(AccessLevel.PACKAGE) - private boolean showHA; - private boolean showExact; - private boolean rightClickBankInventory; - private boolean rightClickBankEquip; - private boolean rightClickBankLoot; - private boolean seedVaultValue; - private boolean rightClickSetPlaceholders; - private boolean rightClickReleasePlaceholders; - private boolean rightClickSearch; - private boolean rightClickFillBankFiller; - - @Provides - BankConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(BankConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - searchString = ""; - } - - @Override - protected void shutDown() - { - clientThread.invokeLater(() -> bankSearch.reset(false)); - forceRightClickFlag = false; - itemQuantities = null; - } - - @Subscribe - private void onMenuShouldLeftClick(MenuShouldLeftClick event) - { - if (!forceRightClickFlag) - { - return; - } - - forceRightClickFlag = false; - MenuEntry[] menuEntries = client.getMenuEntries(); - for (MenuEntry entry : menuEntries) - { - if ((entry.getOption().equals(DEPOSIT_WORN) && this.rightClickBankEquip) - || (entry.getOption().equals(DEPOSIT_INVENTORY) && this.rightClickBankInventory) - || (entry.getOption().equals(DEPOSIT_LOOT) && this.rightClickBankLoot) - || (entry.getOption().equals(DISABLE) && this.rightClickSetPlaceholders) - || (entry.getOption().equals(ENABLE) && this.rightClickSetPlaceholders) - || (entry.getOption().equals(RELEASE_ALL_PLACEHOLDERS) && this.rightClickReleasePlaceholders) - || (entry.getOption().equals(SEARCH) && this.rightClickSearch) - || (entry.getOption().equals(FILL) && this.rightClickFillBankFiller)) - { - event.setForceRightClick(true); - return; - } - } - } - - @Subscribe - private void onMenuEntryAdded(MenuEntryAdded event) - { - if ((event.getOption().equals(DEPOSIT_WORN) && this.rightClickBankEquip) - || (event.getOption().equals(DEPOSIT_INVENTORY) && this.rightClickBankInventory) - || (event.getOption().equals(DEPOSIT_LOOT) && this.rightClickBankLoot) - || (event.getOption().startsWith(DISABLE) && this.rightClickSetPlaceholders) - || (event.getOption().startsWith(ENABLE) && this.rightClickSetPlaceholders) - || (event.getOption().equals(RELEASE_ALL_PLACEHOLDERS) && this.rightClickReleasePlaceholders) - || (event.getOption().equals(SEARCH) && this.rightClickSearch) - || (event.getOption().equals(FILL) && this.rightClickFillBankFiller)) - { - forceRightClickFlag = true; - } - } - - @Subscribe - private void onScriptCallbackEvent(ScriptCallbackEvent event) - { - if (event.getEventName().equals("bankPinButtons") && this.largePinNumbers) - { - updateBankPinSizes(); - } - - if (!event.getEventName().equals("setBankTitle")) - { - return; - } - - int[] intStack = client.getIntStack(); - String[] stringStack = client.getStringStack(); - int intStackSize = client.getIntStackSize(); - int stringStackSize = client.getStringStackSize(); - - switch (event.getEventName()) - { - case "setBankTitle": - final ContainerPrices prices = bankCalculation.calculate(getBankTabItems()); - if (prices == null) - { - return; - } - - final String strCurrentTab = createValueText(prices); - - stringStack[stringStackSize - 1] += strCurrentTab; - break; - case "bankSearchFilter": - int itemId = intStack[intStackSize - 1]; - String search = stringStack[stringStackSize - 1]; - - if (valueSearch(itemId, search)) - { - // return true - intStack[intStackSize - 2] = 1; - } - - break; - } - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded event) - { - if (event.getGroupId() != WidgetID.SEED_VAULT_GROUP_ID || !this.seedVaultValue) - { - return; - } - - updateSeedVaultTotal(); - } - - @Subscribe - public void onVarClientStrChanged(VarClientStrChanged event) - { - String searchVar = client.getVar(VarClientStr.INPUT_TEXT); - - if (!searchVar.equals(searchString)) - { - Widget searchButtonBackground = client.getWidget(WidgetInfo.BANK_SEARCH_BUTTON_BACKGROUND); - if (searchButtonBackground != null && searchButtonBackground.hasListener()) - { - searchButtonBackground.setOnTimerListener((Object[]) null); - searchButtonBackground.setHasListener(false); - } - - clientThread.invokeLater(() -> bankSearch.layoutBank()); - searchString = searchVar; - } - - if (client.getVar(VarClientInt.INPUT_TYPE) != InputType.SEARCH.getType() && Strings.isNullOrEmpty(client.getVar(VarClientStr.INPUT_TEXT))) - { - Widget searchBackground = client.getWidget(WidgetInfo.BANK_SEARCH_BUTTON_BACKGROUND); - if (searchBackground != null) - { - searchBackground.setSpriteId(SpriteID.EQUIPMENT_SLOT_TILE); - } - } - } - - @Subscribe - public void onItemContainerChanged(ItemContainerChanged event) - { - int containerId = event.getContainerId(); - - if (containerId == InventoryID.BANK.getId()) - { - itemQuantities = null; - } - else if (containerId == InventoryID.SEED_VAULT.getId() && this.seedVaultValue) - { - updateSeedVaultTotal(); - } - } - - private String createValueText(final ContainerPrices prices) - { - final long gePrice = prices.getGePrice(); - final long haPrice = prices.getHighAlchPrice(); - - String strCurrentTab = ""; - if (this.showGE && gePrice != 0) - { - strCurrentTab += " ("; - - if (this.showHA) - { - strCurrentTab += "EX: "; - } - - if (this.showExact) - { - strCurrentTab += QuantityFormatter.formatNumber(gePrice) + ")"; - } - else - { - strCurrentTab += QuantityFormatter.quantityToStackSize(gePrice) + ")"; - } - } - - if (this.showHA && haPrice != 0) - { - strCurrentTab += " ("; - - if (this.showGE) - { - strCurrentTab += "HA: "; - } - - if (this.showExact) - { - strCurrentTab += QuantityFormatter.formatNumber(haPrice) + ")"; - } - else - { - strCurrentTab += QuantityFormatter.quantityToStackSize(haPrice) + ")"; - } - } - - return strCurrentTab; - } - - private Item[] getBankTabItems() - { - final ItemContainer container = client.getItemContainer(InventoryID.BANK); - if (container == null) - { - return null; - } - - final Item[] items = container.getItems(); - int currentTab = client.getVar(Varbits.CURRENT_BANK_TAB); - - if (currentTab > 0) - { - int startIndex = 0; - - for (int i = currentTab - 1; i > 0; i--) - { - startIndex += client.getVar(TAB_VARBITS.get(i - 1)); - } - - int itemCount = client.getVar(TAB_VARBITS.get(currentTab - 1)); - return Arrays.copyOfRange(items, startIndex, startIndex + itemCount); - } - - return items; - } - - private void updateSeedVaultTotal() - { - final Widget titleContainer = client.getWidget(WidgetInfo.SEED_VAULT_TITLE_CONTAINER); - if (titleContainer == null) - { - return; - } - - final Widget[] children = titleContainer.getDynamicChildren(); - if (children == null || children.length < 2) - { - return; - } - - final ContainerPrices prices = seedVaultCalculation.calculate(getSeedVaultItems()); - if (prices == null) - { - return; - } - - final String titleText = createValueText(prices); - - final Widget title = children[1]; - title.setText(SEED_VAULT_TITLE + titleText); - } - - private Item[] getSeedVaultItems() - { - final ItemContainer itemContainer = client.getItemContainer(InventoryID.SEED_VAULT); - if (itemContainer == null) - { - return null; - } - - return itemContainer.getItems(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("bank")) - { - return; - } - - updateConfig(); - } - - private void updateBankPinSizes() - { - for (final WidgetInfo widgetInfo : BANK_PINS) - { - final Widget pin = client.getWidget(widgetInfo); - if (pin == null) - { - continue; - } - - final Widget[] children = pin.getDynamicChildren(); - if (children.length < 2) - { - continue; - } - - final Widget button = children[0]; - final Widget number = children[1]; - - // Change to a bigger font size - number.setFontId(FontID.QUILL_CAPS_LARGE); - number.setYTextAlignment(0); - - // Change size to match container widths - number.setOriginalWidth(button.getWidth()); - // The large font id text isn't centered, we need to offset it slightly - number.setOriginalHeight(button.getHeight() + PIN_FONT_OFFSET); - number.setOriginalY(-PIN_FONT_OFFSET); - number.setOriginalX(0); - - number.revalidate(); - } - } - - private void updateConfig() - { - this.showGE = config.showGE(); - this.showHA = config.showHA(); - this.largePinNumbers = config.largePinNumbers(); - this.showExact = config.showExact(); - this.rightClickBankInventory = config.rightClickBankInventory(); - this.rightClickBankEquip = config.rightClickBankEquip(); - this.rightClickBankLoot = config.rightClickBankLoot(); - this.seedVaultValue = config.seedVaultValue(); - this.rightClickSetPlaceholders = config.rightClickSetPlaceholders(); - this.rightClickReleasePlaceholders = config.rightClickReleasePlaceholders(); - this.rightClickSearch = config.rightClickSearch(); - this.rightClickFillBankFiller = config.rightClickFillBankFiller(); - } - - @VisibleForTesting - boolean valueSearch(final int itemId, final String str) - { - final Matcher matcher = VALUE_SEARCH_PATTERN.matcher(str); - if (!matcher.matches()) - { - return false; - } - - // Count bank items and remember it for determining item quantity - if (itemQuantities == null) - { - itemQuantities = getBankItemSet(); - } - - final ItemDefinition itemComposition = itemManager.getItemDefinition(itemId); - long gePrice = (long) itemManager.getItemPrice(itemId) * (long) itemQuantities.count(itemId); - long haPrice = (long) (itemComposition.getPrice() * HIGH_ALCHEMY_MULTIPLIER) * (long) itemQuantities.count(itemId); - - long value = Math.max(gePrice, haPrice); - - final String mode = matcher.group("mode"); - if (mode != null) - { - value = mode.toLowerCase().equals("ge") ? gePrice : haPrice; - } - - final String op = matcher.group("op"); - if (op != null) - { - long compare; - try - { - compare = QuantityFormatter.parseQuantity(matcher.group("num")); - } - catch (ParseException e) - { - return false; - } - - switch (op) - { - case ">": - return value > compare; - case "<": - return value < compare; - case "=": - return value == compare; - case ">=": - return value >= compare; - case "<=": - return value <= compare; - } - } - - final String num1 = matcher.group("num1"); - final String num2 = matcher.group("num2"); - if (num1 != null && num2 != null) - { - long compare1, compare2; - try - { - compare1 = QuantityFormatter.parseQuantity(num1); - compare2 = QuantityFormatter.parseQuantity(num2); - } - catch (ParseException e) - { - return false; - } - - return compare1 <= value && compare2 >= value; - } - - return false; - } - - private Multiset getBankItemSet() - { - ItemContainer itemContainer = client.getItemContainer(InventoryID.BANK); - if (itemContainer == null) - { - return HashMultiset.create(); - } - - Multiset set = HashMultiset.create(); - for (Item item : itemContainer.getItems()) - { - if (item.getId() != ItemID.BANK_FILLER) - { - set.add(item.getId(), item.getQuantity()); - } - } - return set; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bank/ContainerCalculation.java b/runelite-client/src/main/java/net/runelite/client/plugins/bank/ContainerCalculation.java deleted file mode 100644 index d2543a7adc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bank/ContainerCalculation.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2019, 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.bank; - -import java.util.HashMap; -import java.util.Map; -import javax.annotation.Nullable; -import javax.inject.Inject; -import net.runelite.api.Constants; -import net.runelite.api.Item; -import net.runelite.api.ItemID; -import net.runelite.client.game.ItemManager; - -class ContainerCalculation -{ - private final ItemManager itemManager; - - private int hash; - private ContainerPrices containerPrices; - - @Inject - private ContainerCalculation(ItemManager itemManager) - { - this.itemManager = itemManager; - } - - @Nullable - ContainerPrices calculate(Item[] items) - { - // Returns last calculation if inventory hasn't changed - - if (items == null) - { - return null; - } - - final int newHash = hashItems(items); - - if (containerPrices != null && hash == newHash) - { - return containerPrices; - } - - hash = newHash; - - long ge = 0; - long alch = 0; - - for (final Item item : items) - { - final int qty = item.getQuantity(); - final int id = item.getId(); - - if (id <= 0 || qty == 0) - { - continue; - } - - switch (id) - { - case ItemID.COINS_995: - ge += qty; - alch += qty; - break; - case ItemID.PLATINUM_TOKEN: - ge += qty * 1000L; - alch += qty * 1000L; - break; - default: - final long storePrice = itemManager.getItemDefinition(id).getPrice(); - final long alchPrice = (long) (storePrice * Constants.HIGH_ALCHEMY_MULTIPLIER); - alch += alchPrice * qty; - ge += (long) itemManager.getItemPrice(id) * qty; - break; - } - - } - - ContainerPrices prices = new ContainerPrices(ge, alch); - containerPrices = prices; - - return prices; - } - - private int hashItems(final Item[] items) - { - final Map mapCheck = new HashMap<>(items.length); - for (Item item : items) - { - mapCheck.put(item.getId(), item.getQuantity()); - } - - return mapCheck.hashCode(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bank/ContainerPrices.java b/runelite-client/src/main/java/net/runelite/client/plugins/bank/ContainerPrices.java deleted file mode 100644 index 5762218e18..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bank/ContainerPrices.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.bank; - -import lombok.Value; - -@Value -class ContainerPrices -{ - private long gePrice; - private long highAlchPrice; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsConfig.java deleted file mode 100644 index 0d18dace78..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsConfig.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2018, Ron Young - * 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.banktags; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("banktags") -public interface BankTagsConfig extends Config -{ - @ConfigItem( - keyName = "useTabs", - name = "Use Tag Tabs", - description = "Enable the ability to add tabs to your bank which allow fast access to tags.", - position = 1 - ) - default boolean tabs() - { - return true; - } - - @ConfigItem( - keyName = "rememberTab", - name = "Remember last Tag Tab", - description = "Enable the ability to remember last Tag Tab when closing/opening the bank.", - position = 2 - ) - default boolean rememberTab() - { - return true; - } - - @ConfigItem( - keyName = "removeSeparators", - name = "Remove tab separators in Tag Tabs", - description = "Removes tab separators and corrects item layouts in Tag Tabs to mimic a regular tab", - position = 3 - ) - default boolean removeSeparators() - { - return true; - } - - @ConfigItem( - keyName = "hidePlaceholders", - name = "Hide placeholders", - description = "Hide placeholders in tag tabs or tag search.", - position = 4 - ) - default boolean hidePlaceholders() - { - return false; - } - - @ConfigItem( - keyName = "position", - name = "", - description = "", - hidden = true - ) - default int position() - { - return 0; - } - - @ConfigItem( - keyName = "position", - name = "", - description = "" - ) - void position(int idx); - - @ConfigItem( - keyName = "tab", - name = "", - description = "", - hidden = true - ) - default String tab() - { - return ""; - } - - @ConfigItem( - keyName = "tab", - name = "", - description = "" - ) - void tab(String tab); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java deleted file mode 100644 index 7c3c680b31..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java +++ /dev/null @@ -1,626 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * Copyright (c) 2018, Ron Young - * Copyright (c) 2018, Tomas Slusny - * Copyright (c) 2018, Lucas - * 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.banktags; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.collect.HashMultiset; -import com.google.common.collect.Multiset; -import com.google.inject.Provides; -import java.awt.event.KeyEvent; -import java.awt.event.MouseWheelEvent; -import java.text.ParseException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import static net.runelite.api.Constants.HIGH_ALCHEMY_MULTIPLIER; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemDefinition; -import net.runelite.api.ItemID; -import net.runelite.api.MenuOpcode; -import net.runelite.api.VarClientInt; -import net.runelite.api.VarClientStr; -import net.runelite.api.events.DraggingWidgetChanged; -import net.runelite.api.events.FocusChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.util.Text; -import net.runelite.api.vars.InputType; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.game.chatbox.ChatboxPanelManager; -import net.runelite.client.input.KeyListener; -import net.runelite.client.input.KeyManager; -import net.runelite.client.input.MouseManager; -import net.runelite.client.input.MouseWheelListener; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDependency; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.banktags.tabs.BankSearch; -import net.runelite.client.plugins.banktags.tabs.TabInterface; -import static net.runelite.client.plugins.banktags.tabs.TabInterface.FILTERED_CHARS; -import net.runelite.client.plugins.banktags.tabs.TabSprites; -import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin; -import net.runelite.client.util.QuantityFormatter; - -@PluginDescriptor( - name = "Bank Tags", - description = "Enable tagging of bank items and searching of bank tags", - tags = {"searching", "tagging"}, - type = PluginType.UTILITY -) -@PluginDependency(ClueScrollPlugin.class) -@Singleton -public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyListener -{ - public static final String CONFIG_GROUP = "banktags"; - public static final String TAG_SEARCH = "tag:"; - public static final String ICON_SEARCH = "icon_"; - public static final String VAR_TAG_SUFFIX = "*"; - private static final String EDIT_TAGS_MENU_OPTION = "Edit-tags"; - private static final String NUMBER_REGEX = "[0-9]+(\\.[0-9]+)?[kmb]?"; - - private static final String SEARCH_BANK_INPUT_TEXT = - "Show items whose names or tags contain the following text:
" + - "(To show only tagged items, start your search with 'tag:')"; - private static final String SEARCH_BANK_INPUT_TEXT_FOUND = - "Show items whose names or tags contain the following text: (%d found)
" + - "(To show only tagged items, start your search with 'tag:')"; - private static final Pattern VALUE_SEARCH_PATTERN = Pattern.compile("^(?ge|ha|alch)?" + - " *(((?[<>=]|>=|<=) *(?" + NUMBER_REGEX + "))|" + - "((?" + NUMBER_REGEX + ") *- *(?" + NUMBER_REGEX + ")))$", Pattern.CASE_INSENSITIVE); - - @VisibleForTesting - final Multiset itemQuantities = HashMultiset.create(); - - @Inject - private ItemManager itemManager; - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private ChatboxPanelManager chatboxPanelManager; - - @Inject - private MouseManager mouseManager; - - @Inject - private BankTagsConfig config; - - @Inject - private TagManager tagManager; - - @Inject - private TabInterface tabInterface; - - @Inject - private BankSearch bankSearch; - - @Inject - private KeyManager keyManager; - - @Inject - private SpriteManager spriteManager; - - @Inject - private ConfigManager configManager; - - private boolean shiftPressed = false; - private int nextRowIndex = 0; - - @Provides - BankTagsConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(BankTagsConfig.class); - } - - @Override - public void startUp() - { - - cleanConfig(); - keyManager.registerKeyListener(this); - mouseManager.registerMouseWheelListener(this); - clientThread.invokeLater(tabInterface::init); - spriteManager.addSpriteOverrides(TabSprites.values()); - } - - @Override - public void shutDown() - { - keyManager.unregisterKeyListener(this); - mouseManager.unregisterMouseWheelListener(this); - clientThread.invokeLater(tabInterface::destroy); - spriteManager.removeSpriteOverrides(TabSprites.values()); - - shiftPressed = false; - itemQuantities.clear(); - } - - @Deprecated - private void cleanConfig() - { - removeInvalidTags("tagtabs"); - - List tags = configManager.getConfigurationKeys(CONFIG_GROUP + ".item_"); - tags.forEach(s -> - { - String[] split = s.split("\\.", 2); - removeInvalidTags(split[1]); - }); - - List icons = configManager.getConfigurationKeys(CONFIG_GROUP + ".icon_"); - icons.forEach(s -> - { - String[] split = s.split("\\.", 2); - String replaced = split[1].replaceAll("[<>/]", ""); - if (!split[1].equals(replaced)) - { - String value = configManager.getConfiguration(CONFIG_GROUP, split[1]); - configManager.unsetConfiguration(CONFIG_GROUP, split[1]); - if (replaced.length() > "icon_".length()) - { - configManager.setConfiguration(CONFIG_GROUP, replaced, value); - } - } - }); - } - - @Deprecated - private void removeInvalidTags(final String key) - { - final String value = configManager.getConfiguration(CONFIG_GROUP, key); - if (value == null) - { - return; - } - - String replaced = value.replaceAll("[<>/]", ""); - if (!value.equals(replaced)) - { - replaced = Text.toCSV(Text.fromCSV(replaced)); - if (replaced.isEmpty()) - { - configManager.unsetConfiguration(CONFIG_GROUP, key); - } - else - { - configManager.setConfiguration(CONFIG_GROUP, key, replaced); - } - } - } - - private boolean isSearching() - { - return client.getVar(VarClientInt.INPUT_TYPE) == InputType.SEARCH.getType() - || (client.getVar(VarClientInt.INPUT_TYPE) <= 0 - && client.getVar(VarClientStr.INPUT_TEXT) != null && client.getVar(VarClientStr.INPUT_TEXT).length() > 0); - } - - @Subscribe - private void onScriptCallbackEvent(ScriptCallbackEvent event) - { - String eventName = event.getEventName(); - - int[] intStack = client.getIntStack(); - String[] stringStack = client.getStringStack(); - int intStackSize = client.getIntStackSize(); - int stringStackSize = client.getStringStackSize(); - - switch (eventName) - { - case "setSearchBankInputText": - stringStack[stringStackSize - 1] = SEARCH_BANK_INPUT_TEXT; - break; - case "setSearchBankInputTextFound": - { - int matches = intStack[intStackSize - 1]; - stringStack[stringStackSize - 1] = String.format(SEARCH_BANK_INPUT_TEXT_FOUND, matches); - break; - } - case "bankSearchFilter": - int itemId = intStack[intStackSize - 1]; - String search = stringStack[stringStackSize - 1]; - - boolean tagSearch = search.startsWith(TAG_SEARCH); - if (tagSearch) - { - search = search.substring(TAG_SEARCH.length()).trim(); - } - - if (tagManager.findTag(itemId, search) || valueSearch(itemId, search)) - { - if (!config.hidePlaceholders()) - { - // return true - intStack[intStackSize - 2] = 1; - } - - // not a placeholder - else if (itemManager.getItemDefinition(itemId).getPlaceholderTemplateId() == -1) - { - // return true - intStack[intStackSize - 2] = 1; - } - break; - } - else if (tagSearch) - { - intStack[intStackSize - 2] = 0; - } - break; - case "getSearchingTagTab": - intStack[intStackSize - 1] = tabInterface.isActive() ? 1 : 0; - break; - } - - if (!config.removeSeparators() || !isSearching() || !tabInterface.isActive()) - { - return; - } - - switch (eventName) - { - case "lineSpace": - // prevent Y value being incremented to account for line separators - // fallthrough - case "tabTextSpace": - // prevent Y value being incremented to account for "Tab x" text - intStack[intStackSize - 1] = 0; - break; - case "hideLine": - case "hideTabText": - // hide the widget for the line separator - // hide the widget for the "Tab x" text - intStack[intStackSize - 1] = 1; - break; - case "rowIndex": - // remember the next index in the row so we can start the next tab's items there - nextRowIndex = intStack[intStackSize - 1]; - break; - case "rowIndexInit": - // set the index to our remembered value instead of 0 - intStack[intStackSize - 1] = nextRowIndex; - break; - case "bankLayoutInit": - // reset the row index if the bank is rebuilt - nextRowIndex = 0; - break; - case "newBankRow": - // if we haven't filled a row when the current tab is finished building, - // adjust the y offset to continue the next tab on the same row - if (nextRowIndex != 0) - { - intStack[intStackSize - 2] = intStack[intStackSize - 2] - 32; - } - // if we have filled the row, adjust the y offset to maintain appropriate row spacing - else - { - intStack[intStackSize - 2] = intStack[intStackSize - 2] + 4; - } - break; - case "addLastRow": - // after all tabs are finished building, add an extra row of space - // this ensures the scrollbar is set to the correct height - intStack[intStackSize - 1] = intStack[intStackSize - 1] + 32; - break; - } - } - - @Subscribe - private void onMenuEntryAdded(MenuEntryAdded event) - { - if (event.getParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId() - && event.getOption().equals("Examine")) - { - Widget container = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER); - Widget item = container.getChild(event.getParam0()); - int itemID = item.getItemId(); - String text = EDIT_TAGS_MENU_OPTION; - int tagCount = tagManager.getTags(itemID, false).size() + tagManager.getTags(itemID, true).size(); - - if (tagCount > 0) - { - text += " (" + tagCount + ")"; - } - - client.insertMenuItem( - text, - event.getTarget(), - MenuOpcode.RUNELITE.getId(), - event.getIdentifier(), - event.getParam0(), - event.getParam1(), - false - ); - } - - tabInterface.handleAdd(event); - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked event) - { - if (event.getParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId() - && event.getMenuOpcode() == MenuOpcode.RUNELITE - && event.getOption().startsWith(EDIT_TAGS_MENU_OPTION)) - { - event.consume(); - int inventoryIndex = event.getParam0(); - ItemContainer bankContainer = client.getItemContainer(InventoryID.BANK); - if (bankContainer == null) - { - return; - } - Item[] items = bankContainer.getItems(); - if (inventoryIndex < 0 || inventoryIndex >= items.length) - { - return; - } - Item item = bankContainer.getItems()[inventoryIndex]; - if (item == null) - { - return; - } - - int itemId = item.getId(); - ItemDefinition itemDefinition = itemManager.getItemDefinition(itemId); - String name = itemDefinition.getName(); - - // Get both tags and vartags and append * to end of vartags name - Collection tags = tagManager.getTags(itemId, false); - tagManager.getTags(itemId, true).stream() - .map(i -> i + "*") - .forEach(tags::add); - - boolean isSearchOpen = client.getVar(VarClientInt.INPUT_TYPE) == InputType.SEARCH.getType(); - String searchText = client.getVar(VarClientStr.INPUT_TEXT); - String initialValue = Text.toCSV(tags); - - chatboxPanelManager.openTextInput(name + " tags:
(append " + VAR_TAG_SUFFIX + " for variation tag)") - .addCharValidator(FILTERED_CHARS) - .value(initialValue) - .onDone((newValue) -> - clientThread.invoke(() -> - { - // Split inputted tags to vartags (ending with *) and regular tags - final Collection newTags = new ArrayList<>(Text.fromCSV(newValue.toLowerCase())); - final Collection newVarTags = new ArrayList<>(newTags).stream().filter(s -> s.endsWith(VAR_TAG_SUFFIX)).map(s -> - { - newTags.remove(s); - return s.substring(0, s.length() - VAR_TAG_SUFFIX.length()); - }).collect(Collectors.toList()); - - // And save them - tagManager.setTagString(itemId, Text.toCSV(newTags), false); - tagManager.setTagString(itemId, Text.toCSV(newVarTags), true); - - // Check both previous and current tags in case the tag got removed in new tags or in case - // the tag got added in new tags - tabInterface.updateTabIfActive(Text.fromCSV(initialValue.toLowerCase().replaceAll(Pattern.quote(VAR_TAG_SUFFIX), ""))); - tabInterface.updateTabIfActive(Text.fromCSV(newValue.toLowerCase().replaceAll(Pattern.quote(VAR_TAG_SUFFIX), ""))); - })) - .build(); - - if (isSearchOpen) - { - bankSearch.reset(false); - bankSearch.search(InputType.SEARCH, searchText, false); - } - } - else - { - tabInterface.handleClick(event); - } - } - - @Subscribe - private void onItemContainerChanged(ItemContainerChanged event) - { - if (event.getContainerId() == InventoryID.BANK.getId()) - { - itemQuantities.clear(); - for (Item item : event.getItemContainer().getItems()) - { - if (item.getId() != ItemID.BANK_FILLER) - { - itemQuantities.add(item.getId(), item.getQuantity()); - } - } - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged configChanged) - { - if (configChanged.getGroup().equals("banktags") && configChanged.getKey().equals("useTabs")) - { - if (config.tabs()) - { - clientThread.invokeLater(tabInterface::init); - } - else - { - clientThread.invokeLater(tabInterface::destroy); - } - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - tabInterface.update(); - } - - @Subscribe - private void onDraggingWidgetChanged(DraggingWidgetChanged event) - { - tabInterface.handleDrag(event.isDraggingWidget(), shiftPressed); - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded event) - { - if (event.getGroupId() == WidgetID.BANK_GROUP_ID) - { - tabInterface.init(); - } - } - - @Subscribe - private void onFocusChanged(FocusChanged event) - { - if (!event.isFocused()) - { - shiftPressed = false; - } - } - - @Override - public MouseWheelEvent mouseWheelMoved(MouseWheelEvent event) - { - tabInterface.handleWheel(event); - return event; - } - - @Override - public void keyTyped(KeyEvent e) - { - } - - @Override - public void keyPressed(KeyEvent e) - { - if (e.getKeyCode() == KeyEvent.VK_SHIFT) - { - shiftPressed = true; - } - } - - @Override - public void keyReleased(KeyEvent e) - { - if (e.getKeyCode() == KeyEvent.VK_SHIFT) - { - shiftPressed = false; - } - } - - @VisibleForTesting - boolean valueSearch(final int itemId, final String str) - { - final Matcher matcher = VALUE_SEARCH_PATTERN.matcher(str); - if (!matcher.matches()) - { - return false; - } - - final ItemDefinition itemComposition = itemManager.getItemDefinition(itemId); - long gePrice = (long) itemManager.getItemPrice(itemId) * (long) itemQuantities.count(itemId); - long haPrice = (long) (itemComposition.getPrice() * HIGH_ALCHEMY_MULTIPLIER) * (long) itemQuantities.count(itemId); - - long value = Math.max(gePrice, haPrice); - - final String mode = matcher.group("mode"); - if (mode != null) - { - value = mode.toLowerCase().equals("ge") ? gePrice : haPrice; - } - - final String op = matcher.group("op"); - if (op != null) - { - long compare; - try - { - compare = QuantityFormatter.parseQuantity(matcher.group("num")); - } - catch (ParseException e) - { - return false; - } - - switch (op) - { - case ">": - return value > compare; - case "<": - return value < compare; - case "=": - return value == compare; - case ">=": - return value >= compare; - case "<=": - return value <= compare; - } - } - - final String num1 = matcher.group("num1"); - final String num2 = matcher.group("num2"); - if (num1 != null && num2 != null) - { - long compare1, compare2; - try - { - compare1 = QuantityFormatter.parseQuantity(num1); - compare2 = QuantityFormatter.parseQuantity(num2); - } - catch (ParseException e) - { - return false; - } - - return compare1 <= value && compare2 >= value; - } - - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/TagManager.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/TagManager.java deleted file mode 100644 index 5f8f299c1a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/TagManager.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * Copyright (c) 2018, Ron Young - * 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.banktags; - -import com.google.common.base.Strings; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.stream.Collectors; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.ItemID; -import net.runelite.api.util.Text; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.ItemVariationMapping; -import static net.runelite.client.plugins.banktags.BankTagsPlugin.CONFIG_GROUP; -import net.runelite.client.plugins.cluescrolls.ClueScrollService; -import net.runelite.client.plugins.cluescrolls.clues.ClueScroll; -import net.runelite.client.plugins.cluescrolls.clues.CoordinateClue; -import net.runelite.client.plugins.cluescrolls.clues.EmoteClue; -import net.runelite.client.plugins.cluescrolls.clues.FairyRingClue; -import net.runelite.client.plugins.cluescrolls.clues.HotColdClue; -import net.runelite.client.plugins.cluescrolls.clues.MapClue; -import net.runelite.client.plugins.cluescrolls.clues.item.ItemRequirement; - -@Singleton -public class TagManager -{ - private static final String ITEM_KEY_PREFIX = "item_"; - private final ConfigManager configManager; - private final ItemManager itemManager; - private final ClueScrollService clueScrollService; - - @Inject - private TagManager( - final ItemManager itemManager, - final ConfigManager configManager, - final ClueScrollService clueScrollService) - { - this.itemManager = itemManager; - this.configManager = configManager; - this.clueScrollService = clueScrollService; - } - - private String getTagString(int itemId, boolean variation) - { - itemId = getItemId(itemId, variation); - - String config = configManager.getConfiguration(CONFIG_GROUP, ITEM_KEY_PREFIX + itemId); - if (config == null) - { - return ""; - } - - return config; - } - - Collection getTags(int itemId, boolean variation) - { - return new LinkedHashSet<>(Text.fromCSV(getTagString(itemId, variation).toLowerCase())); - } - - void setTagString(int itemId, String tags, boolean variation) - { - itemId = getItemId(itemId, variation); - - if (Strings.isNullOrEmpty(tags)) - { - configManager.unsetConfiguration(CONFIG_GROUP, ITEM_KEY_PREFIX + itemId); - } - else - { - configManager.setConfiguration(CONFIG_GROUP, ITEM_KEY_PREFIX + itemId, tags); - } - } - - public void addTags(int itemId, final Collection t, boolean variation) - { - final Collection tags = getTags(itemId, variation); - if (tags.addAll(t)) - { - setTags(itemId, tags, variation); - } - } - - public void addTag(int itemId, String tag, boolean variation) - { - final Collection tags = getTags(itemId, variation); - if (tags.add(Text.standardize(tag))) - { - setTags(itemId, tags, variation); - } - } - - private void setTags(int itemId, Collection tags, boolean variation) - { - setTagString(itemId, Text.toCSV(tags), variation); - } - - boolean findTag(int itemId, String search) - { - if (search.equals("clue") && testClue(itemId)) - { - return true; - } - - Collection tags = getTags(itemId, false); - tags.addAll(getTags(itemId, true)); - return tags.stream().anyMatch(tag -> tag.startsWith(Text.standardize(search))); - } - - public List getItemsForTag(String tag) - { - final String prefix = CONFIG_GROUP + "." + ITEM_KEY_PREFIX; - return configManager.getConfigurationKeys(prefix).stream() - .map(item -> Integer.parseInt(item.replace(prefix, ""))) - .filter(item -> getTags(item, false).contains(tag) || getTags(item, true).contains(tag)) - .collect(Collectors.toList()); - } - - public void removeTag(String tag) - { - final String prefix = CONFIG_GROUP + "." + ITEM_KEY_PREFIX; - configManager.getConfigurationKeys(prefix).forEach(item -> - { - int id = Integer.parseInt(item.replace(prefix, "")); - removeTag(id, tag); - }); - } - - public void removeTag(int itemId, String tag) - { - Collection tags = getTags(itemId, false); - if (tags.remove(Text.standardize(tag))) - { - setTags(itemId, tags, false); - } - - tags = getTags(itemId, true); - if (tags.remove(Text.standardize(tag))) - { - setTags(itemId, tags, true); - } - } - - public void renameTag(String oldTag, String newTag) - { - List items = getItemsForTag(Text.standardize(oldTag)); - items.forEach(id -> - { - Collection tags = getTags(id, id < 0); - - tags.remove(Text.standardize(oldTag)); - tags.add(Text.standardize(newTag)); - - setTags(id, tags, id < 0); - }); - } - - private int getItemId(int itemId, boolean variation) - { - itemId = Math.abs(itemId); - itemId = itemManager.canonicalize(itemId); - - if (variation) - { - itemId = ItemVariationMapping.map(itemId) * -1; - } - - return itemId; - } - - private boolean testClue(int itemId) - { - ClueScroll c = clueScrollService.getClue(); - - if (c == null) - { - return false; - } - - if (c instanceof EmoteClue) - { - EmoteClue emote = (EmoteClue) c; - - for (ItemRequirement ir : emote.getItemRequirements()) - { - if (ir.fulfilledBy(itemId)) - { - return true; - } - } - } - else if (c instanceof CoordinateClue || c instanceof HotColdClue || c instanceof FairyRingClue) - { - return itemId == ItemID.SPADE; - } - else if (c instanceof MapClue) - { - MapClue mapClue = (MapClue) c; - - return mapClue.getObjectId() == -1 && itemId == ItemID.SPADE; - } - - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/BankSearch.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/BankSearch.java deleted file mode 100644 index 589f7052e5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/BankSearch.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2018, Ron Young - * 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.banktags.tabs; - -import com.google.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.ScriptID; -import net.runelite.api.VarClientInt; -import net.runelite.api.VarClientStr; -import net.runelite.api.vars.InputType; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.callback.ClientThread; - -public class BankSearch -{ - private final Client client; - private final ClientThread clientThread; - - @Inject - private BankSearch( - final Client client, - final ClientThread clientThread - ) - { - this.client = client; - this.clientThread = clientThread; - } - - public void search(InputType inputType, String search, boolean closeInput) - { - clientThread.invoke(() -> - { - - // This ensures that any chatbox input (e.g from search) will not remain visible when - // selecting/changing tab - if (closeInput) - { - client.runScript(ScriptID.MESSAGE_LAYER_CLOSE, 0, 0); - } - - client.setVar(VarClientInt.INPUT_TYPE, inputType.getType()); - client.setVar(VarClientStr.INPUT_TEXT, search); - - layoutBank(); - }); - } - - public void layoutBank() - { - Widget bankContainer = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER); - if (bankContainer == null || bankContainer.isHidden()) - { - return; - } - - Object[] scriptArgs = bankContainer.getOnInvTransmit(); - - if (scriptArgs == null) - { - return; - } - - client.runScript(scriptArgs); - } - - public void reset(boolean closeChat) - { - search(InputType.NONE, "", closeChat); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/MenuIndexes.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/MenuIndexes.java deleted file mode 100644 index 51e179b143..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/MenuIndexes.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2018, Ron Young - * 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.banktags.tabs; - -class MenuIndexes -{ - static class NewTab - { - static final int NEW_TAB = 2; - static final int IMPORT_TAB = 3; - } - - static class Tab - { - static final int OPEN_TAG = 2; - static final int CHANGE_ICON = 3; - static final int DELETE_TAB = 4; - static final int EXPORT_TAB = 5; - static final int RENAME_TAB = 6; - } -} 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 deleted file mode 100644 index 2bd7ba0e01..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java +++ /dev/null @@ -1,1093 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * Copyright (c) 2018, Ron Young - * 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.banktags.tabs; - -import com.google.common.base.Strings; -import com.google.common.collect.Lists; -import com.google.common.util.concurrent.Runnables; -import java.awt.Color; -import java.awt.Rectangle; -import java.awt.Toolkit; -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.StringSelection; -import java.awt.datatransfer.UnsupportedFlavorException; -import java.awt.event.MouseWheelEvent; -import java.io.IOException; -import java.time.Instant; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.function.IntPredicate; -import java.util.stream.Collectors; -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.ItemContainer; -import net.runelite.api.ItemDefinition; -import net.runelite.api.MenuEntry; -import net.runelite.api.MenuOpcode; -import net.runelite.api.Point; -import net.runelite.api.ScriptEvent; -import net.runelite.api.ScriptID; -import net.runelite.api.SoundEffectID; -import net.runelite.api.SpriteID; -import net.runelite.api.VarClientInt; -import net.runelite.api.VarClientStr; -import net.runelite.api.Varbits; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.util.Text; -import net.runelite.api.vars.InputType; -import net.runelite.api.widgets.ItemQuantityMode; -import net.runelite.api.widgets.JavaScriptCallback; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetConfig; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.api.widgets.WidgetSizeMode; -import net.runelite.api.widgets.WidgetType; -import net.runelite.client.Notifier; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.chatbox.ChatboxItemSearch; -import net.runelite.client.game.chatbox.ChatboxPanelManager; -import net.runelite.client.plugins.banktags.BankTagsConfig; -import net.runelite.client.plugins.banktags.BankTagsPlugin; -import static net.runelite.client.plugins.banktags.BankTagsPlugin.TAG_SEARCH; -import static net.runelite.client.plugins.banktags.BankTagsPlugin.VAR_TAG_SUFFIX; -import net.runelite.client.plugins.banktags.TagManager; -import static net.runelite.client.plugins.banktags.tabs.MenuIndexes.NewTab; -import static net.runelite.client.plugins.banktags.tabs.MenuIndexes.Tab; -import net.runelite.client.ui.JagexColors; -import net.runelite.client.util.ColorUtil; - -@Singleton -public class TabInterface -{ - public static final IntPredicate FILTERED_CHARS = c -> "".indexOf(c) == -1; - - private static final Color HILIGHT_COLOR = JagexColors.MENU_TARGET; - private static final String SCROLL_UP = "Scroll up"; - private static final String SCROLL_DOWN = "Scroll down"; - private static final String NEW_TAB = "New tag tab"; - private static final String REMOVE_TAB = "Delete tag tab"; - private static final String EXPORT_TAB = "Export tag tab"; - private static final String IMPORT_TAB = "Import tag tab"; - private static final String VIEW_TAB = "View tag tab"; - private static final String RENAME_TAB = "Rename tag tab"; - private static final String CHANGE_ICON = "Change icon"; - private static final String REMOVE_TAG = "Remove-tag"; - private static final String TAG_GEAR = "Tag-equipment"; - private static final String TAG_INVENTORY = "Tag-inventory"; - private static final int TAB_HEIGHT = 40; - private static final int TAB_WIDTH = 39; - private static final int BUTTON_HEIGHT = 20; - private static final int MARGIN = 1; - private static final int SCROLL_TICK = 500; - private static final int INCINERATOR_WIDTH = 48; - private static final int INCINERATOR_HEIGHT = 39; - private static TagTab iconToSet; - - private final Client client; - private final ClientThread clientThread; - private final ItemManager itemManager; - private final TagManager tagManager; - private final TabManager tabManager; - private final ChatboxPanelManager chatboxPanelManager; - private final BankTagsConfig config; - private final Notifier notifier; - private final BankSearch bankSearch; - private final Rectangle bounds = new Rectangle(); - private final Rectangle canvasBounds = new Rectangle(); - - private final ChatboxItemSearch searchProvider; - private TagTab activeTab; - private int maxTabs; - private int currentTabIndex; - private Instant startScroll = Instant.now(); - private String rememberedSearch; - private boolean waitSearchTick; - - @Getter - private Widget upButton; - - @Getter - private Widget downButton; - - @Getter - private Widget newTab; - - @Getter - private Widget parent; - - @Inject - private TabInterface( - final Client client, - final ClientThread clientThread, - final ItemManager itemManager, - final TagManager tagManager, - final TabManager tabManager, - final ChatboxPanelManager chatboxPanelManager, - final BankTagsConfig config, - final Notifier notifier, - final BankSearch bankSearch, - final ChatboxItemSearch searchProvider) - { - this.client = client; - this.clientThread = clientThread; - this.itemManager = itemManager; - this.tagManager = tagManager; - this.tabManager = tabManager; - this.chatboxPanelManager = chatboxPanelManager; - this.config = config; - this.notifier = notifier; - this.bankSearch = bankSearch; - this.searchProvider = searchProvider; - } - - public boolean isActive() - { - return activeTab != null; - } - - public void init() - { - if (isHidden()) - { - return; - } - - currentTabIndex = config.position(); - parent = client.getWidget(WidgetInfo.BANK_CONTENT_CONTAINER); - - updateBounds(); - - upButton = createGraphic("", TabSprites.UP_ARROW.getSpriteId(), -1, TAB_WIDTH, BUTTON_HEIGHT, bounds.x, 0, true); - upButton.setAction(1, SCROLL_UP); - int clickmask = upButton.getClickMask(); - clickmask |= WidgetConfig.DRAG; - upButton.setClickMask(clickmask); - upButton.setOnOpListener((JavaScriptCallback) (event) -> scrollTab(-1)); - - downButton = createGraphic("", TabSprites.DOWN_ARROW.getSpriteId(), -1, TAB_WIDTH, BUTTON_HEIGHT, bounds.x, 0, true); - downButton.setAction(1, SCROLL_DOWN); - clickmask = downButton.getClickMask(); - clickmask |= WidgetConfig.DRAG; - downButton.setClickMask(clickmask); - downButton.setOnOpListener((JavaScriptCallback) (event) -> scrollTab(1)); - - newTab = createGraphic("", TabSprites.NEW_TAB.getSpriteId(), -1, TAB_WIDTH, 39, bounds.x, 0, true); - newTab.setAction(1, NEW_TAB); - newTab.setAction(2, IMPORT_TAB); - newTab.setOnOpListener((JavaScriptCallback) this::handleNewTab); - - tabManager.clear(); - tabManager.getAllTabs().forEach(this::loadTab); - activateTab(null); - scrollTab(0); - - if (config.rememberTab() && !Strings.isNullOrEmpty(config.tab())) - { - // the server will resync the last opened vanilla tab when the bank is opened - client.setVarbit(Varbits.CURRENT_BANK_TAB, 0); - openTag(config.tab()); - } - } - - private void handleDeposit(MenuOptionClicked event, Boolean inventory) - { - ItemContainer container = client.getItemContainer(inventory ? InventoryID.INVENTORY : InventoryID.EQUIPMENT); - - if (container == null) - { - return; - } - - List items = Arrays.stream(container.getItems()) - .filter(Objects::nonNull) - .map(Item::getId) - .filter(id -> id != -1) - .collect(Collectors.toList()); - - if (!Strings.isNullOrEmpty(event.getTarget())) - { - if (activeTab != null && Text.removeTags(event.getTarget()).equals(activeTab.getTag())) - { - for (Integer item : items) - { - tagManager.addTag(item, activeTab.getTag(), false); - } - - openTag(activeTab.getTag()); - } - - return; - } - - chatboxPanelManager.openTextInput((inventory ? "Inventory " : "Equipment ") + " tags:") - .addCharValidator(FILTERED_CHARS) - .onDone((newTags) -> - clientThread.invoke(() -> - { - final List tags = Text.fromCSV(newTags.toLowerCase()); - - for (Integer item : items) - { - tagManager.addTags(item, tags, false); - } - - updateTabIfActive(tags); - })) - .build(); - } - - private void handleNewTab(ScriptEvent event) - { - switch (event.getOp()) - { - case NewTab.NEW_TAB: - chatboxPanelManager.openTextInput("Tag name") - .addCharValidator(FILTERED_CHARS) - .onDone((tagName) -> clientThread.invoke(() -> - { - if (!Strings.isNullOrEmpty(tagName)) - { - loadTab(tagName); - tabManager.save(); - scrollTab(0); - } - })) - .build(); - break; - case NewTab.IMPORT_TAB: - try - { - final String dataString = Toolkit - .getDefaultToolkit() - .getSystemClipboard() - .getData(DataFlavor.stringFlavor) - .toString() - .trim(); - - final Iterator dataIter = Text.fromCSV(dataString).iterator(); - String name = dataIter.next(); - StringBuilder sb = new StringBuilder(); - for (char c : name.toCharArray()) - { - if (FILTERED_CHARS.test(c)) - { - sb.append(c); - } - } - - if (sb.length() == 0) - { - notifier.notify("Failed to import tag tab from clipboard, invalid format."); - return; - } - - name = sb.toString(); - - final String icon = dataIter.next(); - tabManager.setIcon(name, icon); - - while (dataIter.hasNext()) - { - final int itemId = Integer.parseInt(dataIter.next()); - tagManager.addTag(itemId, name, itemId < 0); - } - - loadTab(name); - tabManager.save(); - scrollTab(0); - - if (activeTab != null && name.equals(activeTab.getTag())) - { - openTag(activeTab.getTag()); - } - - notifier.notify("Tag tab " + name + " has been imported from your clipboard!"); - } - catch (UnsupportedFlavorException | NoSuchElementException | IOException | NumberFormatException ex) - { - notifier.notify("Failed to import tag tab from clipboard, invalid format."); - } - } - } - - private void handleTagTab(ScriptEvent event) - { - switch (event.getOp()) - { - case Tab.OPEN_TAG: - client.setVarbit(Varbits.CURRENT_BANK_TAB, 0); - Widget clicked = event.getSource(); - - TagTab tab = tabManager.find(Text.removeTags(clicked.getName())); - - if (tab.equals(activeTab)) - { - bankSearch.reset(true); - - clientThread.invokeLater(() -> client.runScript(ScriptID.MESSAGE_LAYER_CLOSE, 0, 0)); - } - else - { - openTag(Text.removeTags(clicked.getName())); - } - - client.playSoundEffect(SoundEffectID.UI_BOOP); - break; - case Tab.CHANGE_ICON: - final String tag = Text.removeTags(event.getOpbase()); - searchProvider - .tooltipText(CHANGE_ICON + " (" + tag + ")") - .onItemSelected((itemId) -> - { - TagTab iconToSet = tabManager.find(tag); - if (iconToSet != null) - { - iconToSet.setIconItemId(itemId); - iconToSet.getIcon().setItemId(itemId); - tabManager.setIcon(iconToSet.getTag(), itemId + ""); - } - }) - .build(); - break; - case Tab.DELETE_TAB: - String target = Text.standardize(event.getOpbase()); - chatboxPanelManager.openTextMenuInput("Delete " + target) - .option("1. Tab and tag from all items", () -> - clientThread.invoke(() -> - { - tagManager.removeTag(target); - deleteTab(target); - }) - ) - .option("2. Only tab", () -> clientThread.invoke(() -> deleteTab(target))) - .option("3. Cancel", Runnables::doNothing) - .build(); - break; - case Tab.EXPORT_TAB: - final List data = new ArrayList<>(); - final TagTab tagTab = tabManager.find(Text.removeTags(event.getOpbase())); - data.add(tagTab.getTag()); - data.add(String.valueOf(tagTab.getIconItemId())); - - for (Integer item : tagManager.getItemsForTag(tagTab.getTag())) - { - data.add(String.valueOf(item)); - } - - final StringSelection stringSelection = new StringSelection(Text.toCSV(data)); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringSelection, null); - notifier.notify("Tag tab " + tagTab.getTag() + " has been copied to your clipboard!"); - break; - case Tab.RENAME_TAB: - String renameTarget = Text.standardize(event.getOpbase()); - renameTab(renameTarget); - break; - } - } - - public void destroy() - { - activeTab = null; - currentTabIndex = 0; - maxTabs = 0; - parent = null; - waitSearchTick = false; - rememberedSearch = ""; - - if (upButton != null) - { - upButton.setHidden(true); - downButton.setHidden(true); - newTab.setHidden(true); - } - - tabManager.clear(); - } - - public void update() - { - if (isHidden()) - { - parent = null; - waitSearchTick = false; - rememberedSearch = ""; - - // If bank window was just hidden, update last active tab position - if (currentTabIndex != config.position()) - { - config.position(currentTabIndex); - } - - // Do the same for last active tab - if (config.rememberTab()) - { - if (activeTab == null && !Strings.isNullOrEmpty(config.tab())) - { - config.tab(""); - } - else if (activeTab != null && !activeTab.getTag().equals(config.tab())) - { - config.tab(activeTab.getTag()); - } - } - else if (!Strings.isNullOrEmpty(config.tab())) - { - config.tab(""); - } - - return; - } - - if (activeTab != null && client.getVar(VarClientInt.INPUT_TYPE) == InputType.RUNELITE.getType()) - { - // don't reset active tab if we are editing tags - updateBounds(); - scrollTab(0); - return; - } - - String str = client.getVar(VarClientStr.INPUT_TEXT); - - if (Strings.isNullOrEmpty(str)) - { - str = ""; - } - - Widget bankTitle = client.getWidget(WidgetInfo.BANK_TITLE_BAR); - if (bankTitle != null && !bankTitle.isHidden() && !str.startsWith(TAG_SEARCH)) - { - str = bankTitle.getText().replaceFirst("Showing items: ", ""); - - if (str.startsWith("Tab ")) - { - str = ""; - } - } - - str = Text.standardize(str); - - if (str.startsWith(BankTagsPlugin.TAG_SEARCH)) - { - activateTab(tabManager.find(str.substring(TAG_SEARCH.length()))); - } - else - { - activateTab(null); - } - - if (!waitSearchTick - && activeTab == null - && !Strings.isNullOrEmpty(rememberedSearch) - && client.getVar(VarClientInt.INPUT_TYPE) == InputType.NONE.getType()) - { - bankSearch.reset(true); - bankSearch.search(InputType.NONE, rememberedSearch, true); - rememberedSearch = ""; - } - else if (waitSearchTick) - { - waitSearchTick = false; - } - - updateBounds(); - scrollTab(0); - } - - public void handleWheel(final MouseWheelEvent event) - { - if (parent == null || !canvasBounds.contains(event.getPoint())) - { - return; - } - - event.consume(); - - clientThread.invoke(() -> - { - if (isHidden()) - { - return; - } - - scrollTab(event.getWheelRotation()); - }); - } - - public void handleAdd(MenuEntryAdded event) - { - if (isHidden()) - { - return; - } - - if (activeTab != null - && event.getParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId() - && event.getOption().equals("Examine")) - { - insertMenuEntry(event, REMOVE_TAG + " (" + activeTab.getTag() + ")", event.getTarget()); - } - else if (event.getParam1() == WidgetInfo.BANK_DEPOSIT_INVENTORY.getId() - && event.getOption().equals("Deposit inventory")) - { - insertMenuEntry(event, TAG_INVENTORY, event.getTarget()); - - if (activeTab != null) - { - insertMenuEntry(event, TAG_INVENTORY, ColorUtil.wrapWithColorTag(activeTab.getTag(), HILIGHT_COLOR)); - } - } - else if (event.getParam1() == WidgetInfo.BANK_DEPOSIT_EQUIPMENT.getId() - && event.getOption().equals("Deposit worn items")) - { - insertMenuEntry(event, TAG_GEAR, event.getTarget()); - - if (activeTab != null) - { - insertMenuEntry(event, TAG_GEAR, ColorUtil.wrapWithColorTag(activeTab.getTag(), HILIGHT_COLOR)); - } - } - } - - public void handleClick(MenuOptionClicked event) - { - if (isHidden()) - { - return; - } - - if (chatboxPanelManager.getCurrentInput() != null - && event.getMenuOpcode() != MenuOpcode.CANCEL - && !event.getOption().equals(SCROLL_UP) - && !event.getOption().equals(SCROLL_DOWN)) - { - chatboxPanelManager.close(); - } - - if ((event.getIdentifier() == WidgetInfo.BANK_ITEM_CONTAINER.getId() - || event.getIdentifier() == WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER.getId()) - && event.getMenuOpcode() == MenuOpcode.CC_OP_LOW_PRIORITY - && (event.getOption().equalsIgnoreCase("withdraw-x") - || event.getOption().equalsIgnoreCase("deposit-x"))) - { - waitSearchTick = true; - rememberedSearch = client.getVar(VarClientStr.INPUT_TEXT); - bankSearch.search(InputType.NONE, rememberedSearch, true); - } - - if (iconToSet != null) - { - if (event.getOption().startsWith(CHANGE_ICON + " (")) - { - ItemDefinition item = getItem(event.getParam0()); - if (item != null) - { - int itemId = itemManager.canonicalize(item.getId()); - iconToSet.setIconItemId(itemId); - iconToSet.getIcon().setItemId(itemId); - tabManager.setIcon(iconToSet.getTag(), itemId + ""); - event.consume(); - } - } - - // Reset icon selection even when we do not clicked item with icon - iconToSet = null; - } - - if (activeTab != null - && event.getOption().equals("Search") - && client.getWidget(WidgetInfo.BANK_SEARCH_BUTTON_BACKGROUND).getSpriteId() != SpriteID.EQUIPMENT_SLOT_SELECTED) - { - activateTab(null); - // This ensures that when clicking Search when tab is selected, the search input is opened rather - // than client trying to close it first - client.setVar(VarClientStr.INPUT_TEXT, ""); - client.setVar(VarClientInt.INPUT_TYPE, 0); - } - else if (activeTab != null - && event.getOption().startsWith("View tab")) - { - activateTab(null); - } - else if (activeTab != null - && event.getParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId() - && event.getMenuOpcode() == MenuOpcode.RUNELITE - && event.getOption().startsWith(REMOVE_TAG)) - { - // Add "remove" menu entry to all items in bank while tab is selected - event.consume(); - final ItemDefinition item = getItem(event.getParam0()); - final int itemId; - if (item != null) - { - itemId = item.getId(); - tagManager.removeTag(itemId, activeTab.getTag()); - bankSearch.search(InputType.SEARCH, TAG_SEARCH + activeTab.getTag(), true); - } - } - else if (event.getMenuOpcode() == MenuOpcode.RUNELITE - && ((event.getParam1() == WidgetInfo.BANK_DEPOSIT_INVENTORY.getId() && event.getOption().equals(TAG_INVENTORY)) - || (event.getParam1() == WidgetInfo.BANK_DEPOSIT_EQUIPMENT.getId() && event.getOption().equals(TAG_GEAR)))) - { - handleDeposit(event, event.getParam1() == WidgetInfo.BANK_DEPOSIT_INVENTORY.getId()); - } - } - - public void updateTabIfActive(final Collection tags) - { - if (activeTab != null && tags.contains(activeTab.getTag())) - { - openTag(activeTab.getTag()); - } - } - - public void handleDrag(boolean isDragging, boolean shiftDown) - { - if (isHidden()) - { - return; - } - - Widget draggedOn = client.getDraggedOnWidget(); - Widget draggedWidget = client.getDraggedWidget(); - - // round-about way to prevent drag reordering when in a tag tab, now that it looks like a normal tab - // returning early from drag release and nulling out the drag release listener have no effect, - // probably a better way to do this though - if (draggedWidget.getId() == WidgetInfo.BANK_ITEM_CONTAINER.getId() && isActive() - && config.removeSeparators()) - { - client.setDraggedOnWidget(null); - } - - if (!isDragging || draggedOn == null) - { - return; - } - - // is dragging widget and mouse button released - if (client.getMouseCurrentButton() == 0) - { - if (draggedWidget.getItemId() > 0 && draggedWidget.getId() != parent.getId()) - { - // Tag an item dragged on a tag tab - if (draggedOn.getId() == parent.getId()) - { - tagManager.addTag(draggedWidget.getItemId(), draggedOn.getName(), shiftDown); - updateTabIfActive(Lists.newArrayList(Text.standardize(draggedOn.getName()))); - } - } - else if (parent.getId() == draggedOn.getId() && parent.getId() == draggedWidget.getId() && !Strings.isNullOrEmpty(draggedOn.getName())) - { - tabManager.move(draggedWidget.getName(), draggedOn.getName()); - tabManager.save(); - updateTabs(); - } - } - else if (draggedWidget.getItemId() > 0) - { - MenuEntry[] entries = client.getMenuEntries(); - - if (entries.length > 0) - { - MenuEntry entry = entries[entries.length - 1]; - - if (draggedWidget.getItemId() > 0 && entry.getOption().equals(VIEW_TAB) && draggedOn.getId() != draggedWidget.getId()) - { - entry.setOption(TAG_SEARCH + Text.removeTags(entry.getTarget()) + (shiftDown ? VAR_TAG_SUFFIX : "")); - entry.setTarget(draggedWidget.getName()); - client.setMenuEntries(entries); - } - - if (entry.getOption().equals(SCROLL_UP)) - { - scrollTick(-1); - } - else if (entry.getOption().equals(SCROLL_DOWN)) - { - scrollTick(1); - } - } - } - } - - private boolean isHidden() - { - Widget widget = client.getWidget(WidgetInfo.BANK_CONTAINER); - return !config.tabs() || widget == null || widget.isHidden(); - } - - private void loadTab(String tag) - { - TagTab tagTab = tabManager.load(tag); - - if (tagTab.getBackground() == null) - { - Widget btn = createGraphic(ColorUtil.wrapWithColorTag(tagTab.getTag(), HILIGHT_COLOR), TabSprites.TAB_BACKGROUND.getSpriteId(), -1, TAB_WIDTH, TAB_HEIGHT, bounds.x, 1, true); - btn.setAction(1, VIEW_TAB); - btn.setAction(2, CHANGE_ICON); - btn.setAction(3, REMOVE_TAB); - btn.setAction(4, EXPORT_TAB); - btn.setAction(5, RENAME_TAB); - btn.setOnOpListener((JavaScriptCallback) this::handleTagTab); - tagTab.setBackground(btn); - } - - if (tagTab.getIcon() == null) - { - 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; - icon.setClickMask(clickmask); - icon.setDragDeadTime(5); - icon.setDragDeadZone(5); - icon.setItemQuantity(10000); - icon.setItemQuantityMode(ItemQuantityMode.NEVER); - tagTab.setIcon(icon); - } - - tabManager.add(tagTab); - } - - private void deleteTab(String tag) - { - if (activeTab != null && activeTab.getTag().equals(tag)) - { - bankSearch.reset(true); - } - - tabManager.remove(tag); - tabManager.save(); - - updateBounds(); - scrollTab(0); - } - - private void renameTab(String oldTag) - { - chatboxPanelManager.openTextInput("Enter new tag name for tag \"" + oldTag + "\":") - .addCharValidator(FILTERED_CHARS) - .onDone((newTag) -> clientThread.invoke(() -> - { - if (!Strings.isNullOrEmpty(newTag) && !newTag.equalsIgnoreCase(oldTag)) - { - if (tabManager.find(newTag) == null) - { - TagTab tagTab = tabManager.find(oldTag); - tagTab.setTag(newTag); - - final String coloredName = ColorUtil.wrapWithColorTag(newTag, HILIGHT_COLOR); - tagTab.getIcon().setName(coloredName); - tagTab.getBackground().setName(coloredName); - - tabManager.removeIcon(oldTag); - tabManager.setIcon(newTag, tagTab.getIconItemId() + ""); - - tabManager.save(); - tagManager.renameTag(oldTag, newTag); - - if (activeTab != null && activeTab.equals(tagTab)) - { - openTag(newTag); - } - } - else - { - chatboxPanelManager.openTextMenuInput("The specified bank tag already exists.") - .option("1. Merge into existing tag \"" + newTag + "\".", () -> - clientThread.invoke(() -> - { - tagManager.renameTag(oldTag, newTag); - final String activeTag = activeTab != null ? activeTab.getTag() : ""; - deleteTab(oldTag); - - if (activeTag.equals(oldTag)) - { - openTag(newTag); - } - }) - ) - .option("2. Choose a different name.", () -> - clientThread.invoke(() -> - renameTab(oldTag)) - ) - .build(); - } - } - })) - .build(); - } - - private void scrollTick(int direction) - { - // This ensures that dragging on scroll buttons do not scrolls too fast - if (startScroll.until(Instant.now(), ChronoUnit.MILLIS) >= SCROLL_TICK) - { - startScroll = Instant.now(); - scrollTab(direction); - } - } - - private void scrollTab(int direction) - { - maxTabs = (bounds.height - BUTTON_HEIGHT * 2 - MARGIN * 2) / TAB_HEIGHT; - - // prevent running into the incinerator - while (bounds.y + maxTabs * TAB_HEIGHT + MARGIN * maxTabs + BUTTON_HEIGHT * 2 + MARGIN > bounds.y + bounds.height) - { - --maxTabs; - } - - int proposedIndex = currentTabIndex + direction; - int numTabs = tabManager.size() + 1; - - if (proposedIndex >= numTabs || proposedIndex < 0) - { - currentTabIndex = 0; - } - else if (numTabs - proposedIndex >= maxTabs) - { - currentTabIndex = proposedIndex; - } - else if (maxTabs < numTabs && numTabs - proposedIndex < maxTabs) - { - // Edge case when only 1 tab displays instead of up to maxTabs when one is deleted at the end of the list - currentTabIndex = proposedIndex; - scrollTab(-1); - } - - updateTabs(); - } - - private void activateTab(TagTab tagTab) - { - if (activeTab != null && activeTab.equals(tagTab)) - { - return; - } - - if (activeTab != null) - { - Widget tab = activeTab.getBackground(); - tab.setSpriteId(TabSprites.TAB_BACKGROUND.getSpriteId()); - tab.revalidate(); - activeTab = null; - } - - if (tagTab != null) - { - Widget tab = tagTab.getBackground(); - tab.setSpriteId(TabSprites.TAB_BACKGROUND_ACTIVE.getSpriteId()); - tab.revalidate(); - activeTab = tagTab; - } - } - - private void updateBounds() - { - Widget itemContainer = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER); - if (itemContainer == null) - { - return; - } - - int height = itemContainer.getHeight(); - - // If player isn't using normal bank tabs - if (itemContainer.getRelativeY() == 0) - { - height -= (TAB_HEIGHT + MARGIN); - } - - bounds.setSize(TAB_WIDTH + MARGIN * 2, height); - bounds.setLocation(MARGIN, TAB_HEIGHT + MARGIN); - - Widget incinerator = client.getWidget(WidgetInfo.BANK_INCINERATOR); - - if (incinerator != null && !incinerator.isHidden()) - { - incinerator.setOriginalHeight(INCINERATOR_HEIGHT); - incinerator.setOriginalWidth(INCINERATOR_WIDTH); - incinerator.setOriginalY(INCINERATOR_HEIGHT); - - Widget child = incinerator.getDynamicChildren()[0]; - child.setOriginalHeight(INCINERATOR_HEIGHT); - child.setOriginalWidth(INCINERATOR_WIDTH); - child.setWidthMode(WidgetSizeMode.ABSOLUTE); - child.setHeightMode(WidgetSizeMode.ABSOLUTE); - child.setType(WidgetType.GRAPHIC); - child.setSpriteId(TabSprites.INCINERATOR.getSpriteId()); - incinerator.revalidate(); - - bounds.setSize(TAB_WIDTH + MARGIN * 2, height - incinerator.getHeight()); - } - - if (upButton != null) - { - Point p = upButton.getCanvasLocation(); - canvasBounds.setBounds(p.getX(), p.getY() + BUTTON_HEIGHT, bounds.width, maxTabs * TAB_HEIGHT + maxTabs * MARGIN); - } - } - - private void updateTabs() - { - int y = bounds.y + MARGIN + BUTTON_HEIGHT; - - if (maxTabs > tabManager.size()) - { - currentTabIndex = 0; - } - else - { - y -= (currentTabIndex * TAB_HEIGHT + currentTabIndex * MARGIN); - } - - for (TagTab tab : tabManager.getTabs()) - { - updateWidget(tab.getBackground(), y); - updateWidget(tab.getIcon(), y + 4); - - // Edge case where item icon is 1 pixel out of bounds - tab.getIcon().setHidden(tab.getBackground().isHidden()); - - // Keep item widget shown while drag scrolling - if (client.getDraggedWidget() == tab.getIcon()) - { - tab.getIcon().setHidden(false); - } - - y += TAB_HEIGHT + MARGIN; - } - - updateWidget(newTab, y); - - boolean hidden = !(tabManager.size() > 0); - - upButton.setHidden(hidden); - upButton.setOriginalY(bounds.y); - upButton.revalidate(); - - downButton.setHidden(hidden); - downButton.setOriginalY(bounds.y + maxTabs * TAB_HEIGHT + MARGIN * maxTabs + BUTTON_HEIGHT + MARGIN); - downButton.revalidate(); - } - - private Widget createGraphic(String name, int spriteId, int itemId, int width, int height, int x, int y, boolean hasListener) - { - Widget widget = parent.createChild(-1, WidgetType.GRAPHIC); - widget.setOriginalWidth(width); - widget.setOriginalHeight(height); - widget.setOriginalX(x); - widget.setOriginalY(y); - - widget.setSpriteId(spriteId); - - if (itemId > -1) - { - widget.setItemId(itemId); - widget.setItemQuantity(-1); - widget.setBorderType(1); - } - - if (hasListener) - { - widget.setOnOpListener(ScriptID.NULL); - widget.setHasListener(true); - } - - widget.setName(name); - widget.revalidate(); - - return widget; - } - - private void updateWidget(Widget t, int y) - { - t.setOriginalY(y); - t.setHidden(y < (bounds.y + BUTTON_HEIGHT + MARGIN) || y > (bounds.y + bounds.height - TAB_HEIGHT - MARGIN - BUTTON_HEIGHT)); - t.revalidate(); - } - - - private ItemDefinition getItem(int idx) - { - ItemContainer bankContainer = client.getItemContainer(InventoryID.BANK); - Item item = null; - if (bankContainer != null) - { - item = bankContainer.getItems()[idx]; - } - if (item != null) - { - return itemManager.getItemDefinition(item.getId()); - } - - return null; - } - - private void openTag(final String tag) - { - activateTab(tabManager.find(tag)); - bankSearch.search(InputType.SEARCH, TAG_SEARCH + tag, true); - - // When tab is selected with search window open, the search window closes but the search button - // stays highlighted, this solves that issue - Widget searchBackground = client.getWidget(WidgetInfo.BANK_SEARCH_BUTTON_BACKGROUND); - searchBackground.setSpriteId(SpriteID.EQUIPMENT_SLOT_TILE); - } - - private void insertMenuEntry(MenuEntryAdded event, String option, String target) - { - client.insertMenuItem( - option, - target, - MenuOpcode.RUNELITE.getId(), - event.getIdentifier(), - event.getParam0(), - event.getParam1(), - false - ); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabManager.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabManager.java deleted file mode 100644 index 12466c6c32..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabManager.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * Copyright (c) 2018, Ron Young - * 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.banktags.tabs; - -import com.google.common.base.MoreObjects; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ItemID; -import net.runelite.api.util.Text; -import net.runelite.client.config.ConfigManager; -import static net.runelite.client.plugins.banktags.BankTagsPlugin.CONFIG_GROUP; -import static net.runelite.client.plugins.banktags.BankTagsPlugin.ICON_SEARCH; -import org.apache.commons.lang3.math.NumberUtils; - -@Singleton -class TabManager -{ - private static final String TAG_TABS_CONFIG = "tagtabs"; - - @Getter(AccessLevel.PACKAGE) - private final List tabs = new ArrayList<>(); - private final ConfigManager configManager; - - @Inject - private TabManager(ConfigManager configManager) - { - this.configManager = configManager; - } - - void add(TagTab tagTab) - { - if (!contains(tagTab.getTag())) - { - tabs.add(tagTab); - } - } - - void clear() - { - tabs.forEach(t -> t.setHidden(true)); - tabs.clear(); - } - - TagTab find(String tag) - { - Optional first = tabs.stream().filter(t -> t.getTag().equals(Text.standardize(tag))).findAny(); - return first.orElse(null); - } - - List getAllTabs() - { - return Text.fromCSV(MoreObjects.firstNonNull(configManager.getConfiguration(CONFIG_GROUP, TAG_TABS_CONFIG), "")); - } - - TagTab load(String tag) - { - TagTab tagTab = find(tag); - - if (tagTab == null) - { - tag = Text.standardize(tag); - String item = configManager.getConfiguration(CONFIG_GROUP, ICON_SEARCH + tag); - int itemid = NumberUtils.toInt(item, ItemID.SPADE); - tagTab = new TagTab(itemid, tag); - } - - return tagTab; - } - - void move(String tagToMove, String tagDestination) - { - tagToMove = Text.standardize(tagToMove); - tagDestination = Text.standardize(tagDestination); - - if (contains(tagToMove) && contains(tagDestination)) - { - Collections.swap(tabs, indexOf(tagToMove), indexOf(tagDestination)); - } - } - - void remove(String tag) - { - TagTab tagTab = find(tag); - - if (tagTab != null) - { - tagTab.setHidden(true); - tabs.remove(tagTab); - removeIcon(tag); - } - } - - void save() - { - String tags = Text.toCSV(tabs.stream().map(TagTab::getTag).collect(Collectors.toList())); - configManager.setConfiguration(CONFIG_GROUP, TAG_TABS_CONFIG, tags); - } - - void removeIcon(final String tag) - { - configManager.unsetConfiguration(CONFIG_GROUP, ICON_SEARCH + Text.standardize(tag)); - } - - void setIcon(final String tag, final String icon) - { - configManager.setConfiguration(CONFIG_GROUP, ICON_SEARCH + Text.standardize(tag), icon); - } - - int size() - { - return tabs.size(); - } - - private boolean contains(String tag) - { - return tabs.stream().anyMatch(t -> t.getTag().equals(tag)); - } - - private int indexOf(TagTab tagTab) - { - return tabs.indexOf(tagTab); - } - - private int indexOf(String tag) - { - return indexOf(find(tag)); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabSprites.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabSprites.java deleted file mode 100644 index 7961380b1a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabSprites.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * Copyright (c) 2018, Ron Young - * 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.banktags.tabs; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.client.game.SpriteOverride; - -@RequiredArgsConstructor -public enum TabSprites implements SpriteOverride -{ - INCINERATOR(-200, "incinerator.png"), - TAB_BACKGROUND(-201, "tag-tab.png"), - TAB_BACKGROUND_ACTIVE(-202, "tag-tab-active.png"), - UP_ARROW(-203, "up-arrow.png"), - DOWN_ARROW(-204, "down-arrow.png"), - NEW_TAB(-205, "new-tab.png"); - - @Getter(AccessLevel.PUBLIC) - private final int spriteId; - - @Getter(AccessLevel.PUBLIC) - private final String fileName; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TagTab.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TagTab.java deleted file mode 100644 index 004e5f45ed..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TagTab.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * Copyright (c) 2018, Ron Young - * 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.banktags.tabs; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import net.runelite.api.widgets.Widget; - -@Data -@EqualsAndHashCode(of = "tag") -class TagTab -{ - private String tag; - private int iconItemId; - private Widget background; - private Widget icon; - - TagTab(int iconItemId, String tag) - { - this.iconItemId = iconItemId; - this.tag = tag; - } - - void setHidden(boolean hide) - { - if (background != null) - { - background.setHidden(hide); - } - - if (icon != null) - { - icon.setHidden(hide); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banlist/BanListConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/banlist/BanListConfig.java deleted file mode 100644 index f05e456098..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banlist/BanListConfig.java +++ /dev/null @@ -1,113 +0,0 @@ -package net.runelite.client.plugins.banlist; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigTitleSection; -import net.runelite.client.config.Title; - -@ConfigGroup("banlist") - -public interface BanListConfig extends Config -{ - @ConfigTitleSection( - keyName = "listsTitle", - name = "Lists", - description = "", - position = 0 - ) - default Title listsTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "bannedPlayers", - name = "Manual Scammer List", - description = "Manually add players seperated by commas that you wish to be warned about while in a clan/cox/tob party", - position = 1, - titleSection = "listsTitle" - ) - default String getBannedPlayers() - { - return ""; - } - - @ConfigItem( - keyName = "bannedPlayers", - name = "", - description = "" - ) - void setBannedPlayers(String key); - - @ConfigItem( - position = 2, - keyName = "enableWDRScam", - name = "Enable WDR Scammer List", - description = "Incorporate WDR Scammer list", - titleSection = "listsTitle" - ) - default boolean enableWDRScam() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "enableWDRToxic", - name = "Enable WDR Toxic List", - description = "Incorporate WDR Toxic list", - titleSection = "listsTitle" - ) - default boolean enableWDRToxic() - { - return true; - } - - @ConfigItem( - position = 4, - keyName = "enableRuneWatch", - name = "Enable RuneWatch List", - description = "Incorporate RuneWatch potential scammer list", - titleSection = "listsTitle" - ) - default boolean enableRuneWatch() - { - return true; - } - - @ConfigTitleSection( - keyName = "highlightTitle", - name = "Highlight", - description = "", - position = 5 - ) - default Title highlightTitle() - { - return new Title(); - } - - @ConfigItem( - position = 6, - keyName = "highlightInClan", - name = "Highlight red in Clan Chat", - description = "Highlights Scammer\'s name in your current clan chat.", - titleSection = "highlightTitle" - ) - default boolean highlightInClan() - { - return true; - } - - @ConfigItem( - position = 7, - keyName = "highlightInTrade", - name = "Highlight red in trade screen", - description = "Highlights Scammer\'s name in your trade window", - titleSection = "highlightTitle" - ) - default boolean highlightInTrade() - { - return true; - } -} \ No newline at end of file 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 deleted file mode 100644 index e29d801d29..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banlist/BanListPlugin.java +++ /dev/null @@ -1,455 +0,0 @@ -/* - * Copyright (c) 2019, xperiaclash - * Copyright (c) 2019, ganom - * 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.banlist; - -import com.google.inject.Provides; -import java.io.IOException; -import java.util.HashSet; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.ClanMember; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.events.ClanMemberJoined; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.WidgetHiddenChanged; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.Widget; -import static net.runelite.api.widgets.WidgetID.PLAYER_TRADE_SCREEN_GROUP_ID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.callback.ClientThread; -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.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.http.api.RuneLiteAPI; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Request; -import okhttp3.Response; -import org.jetbrains.annotations.NotNull; - -@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.MISCELLANEOUS, - enabledByDefault = false -) -@Singleton -@Slf4j -public class BanListPlugin extends Plugin -{ - private final Set wdrScamSet = new HashSet<>(); - private final Set wdrToxicSet = new HashSet<>(); - private final Set runeWatchSet = new HashSet<>(); - private final Set manualBans = new HashSet<>(); - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private BanListConfig config; - - @Inject - private ChatMessageManager chatMessageManager; - - private String tobNames = ""; - private boolean enableWDRScam; - private boolean enableWDRToxic; - private boolean enableRuneWatch; - private boolean highlightInClan; - private boolean highlightInTrade; - - @Provides - BanListConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(BanListConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - manualBans.addAll(Text.fromCSV(Text.standardize(config.getBannedPlayers()))); - - fetchFromWebsites(); - } - - @Override - protected void shutDown() - { - - wdrScamSet.clear(); - wdrToxicSet.clear(); - runeWatchSet.clear(); - manualBans.clear(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("banlist") && event.getKey().equals("bannedPlayers")) - { - manualBans.clear(); - - String newValue = event.getNewValue(); - - manualBans.addAll(Text.fromCSV(Text.standardize(newValue))); - } - } - - private void updateConfig() - { - this.enableWDRScam = config.enableWDRScam(); - this.enableWDRToxic = config.enableWDRToxic(); - this.enableRuneWatch = config.enableRuneWatch(); - this.highlightInClan = config.highlightInClan(); - this.highlightInTrade = config.highlightInTrade(); - } - - /** - * Event to keep making sure player names are highlighted red in clan chat, since the red name goes away frequently - */ - @Subscribe - private 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 - || !this.highlightInClan) - { - return; - } - - clientThread.invokeLater(() -> - { - if (!client.getWidget(WidgetInfo.CLAN_CHAT).isHidden()) - { - highlightRedInCC(); - } - }); - } - - @Subscribe - private void onClanMemberJoined(ClanMemberJoined event) - { - ClanMember member = event.getMember(); - String memberUsername = Text.standardize(member.getUsername().toLowerCase()); - - ListType scamList = checkScamList(memberUsername); - ListType toxicList = checkToxicList(memberUsername); - - if (scamList != null) - { - sendWarning(memberUsername, scamList); - if (this.highlightInClan) - { - highlightRedInCC(); - } - } - - if (toxicList != null) - { - sendWarning(memberUsername, toxicList); - if (this.highlightInClan) - { - highlightRedInCC(); - } - } - } - - /** - * If a trade window is opened and the person trading us is on the list, modify "trading with" - */ - @Subscribe - private void onWidgetLoaded(WidgetLoaded widgetLoaded) - { - if (this.highlightInTrade && widgetLoaded.getGroupId() == PLAYER_TRADE_SCREEN_GROUP_ID) - { //if trading window was loaded - clientThread.invokeLater(() -> - { - Widget tradingWith = client.getWidget(WidgetInfo.TRADING_WITH); - - String name = tradingWith.getText().replaceAll("Trading With: ", "").toLowerCase(); - if (checkScamList(name) != null) - { - tradingWith.setText(tradingWith.getText().replaceAll(name, "" + name + " (Scammer)" + "")); - } - if (checkToxicList(name) != null) - { - tradingWith.setText(tradingWith.getText().replaceAll(name, "" + name + " (Toxic)" + "")); - } - }); - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - final Widget raidingParty = client.getWidget(WidgetInfo.THEATRE_OF_BLOOD_RAIDING_PARTY); - if (raidingParty == null) - { - return; - } - - String allNames = raidingParty.getText(); - - if (allNames.equalsIgnoreCase(tobNames)) - { - return; - } - - tobNames = allNames; - - String[] split = allNames.split("
"); - - for (String name : split) - { - if (!name.equals("-")) - { - String stdName = Text.standardize(name); - - ListType scamList = checkScamList(stdName); - - if (scamList != null) - { - sendWarning(name, scamList); - } - - ListType toxicList = checkToxicList(stdName); - - if (toxicList != null) - { - sendWarning(name, toxicList); - } - } - } - } - - /** - * Compares player name to everything in the ban lists - */ - private ListType checkScamList(String nameToBeChecked) - { - if (this.enableWDRScam && wdrScamSet.contains(nameToBeChecked)) - { - return ListType.WEDORAIDSSCAM_LIST; - } - - if (this.enableRuneWatch && runeWatchSet.contains(nameToBeChecked)) - { - return ListType.RUNEWATCH_LIST; - } - - if (manualBans.contains(nameToBeChecked)) - { - return ListType.MANUAL_LIST; - } - - return null; - } - - private ListType checkToxicList(String nameToBeChecked) - { - if (this.enableWDRToxic && wdrToxicSet.contains(nameToBeChecked)) - { - return ListType.WEDORAIDSTOXIC_LIST; - } - - return null; - } - - /** - * Sends a warning to our player, notifying them that a player is on a ban list - */ - private void sendWarning(String playerName, ListType listType) - { - switch (listType) - { - case WEDORAIDSSCAM_LIST: - final String wdr__scam_message = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append("Warning! " + playerName + " is on WeDoRaids\' scammer list!") - .build(); - - chatMessageManager.queue( - 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(); - - chatMessageManager.queue( - 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 potential scammer list!") - .build(); - - chatMessageManager.queue( - 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(); - - chatMessageManager.queue( - QueuedMessage.builder() - .type(ChatMessageType.CONSOLE) - .runeLiteFormattedMessage(manual_message) - .build()); - break; - } - } - - /** - * Pulls data from wdr and runewatch to build a list of blacklisted usernames - */ - private void fetchFromWebsites() - { - Request request = new Request.Builder() - .url("https://wdrdev.github.io/index") - .build(); - fetchAndParseWdr(request, wdrScamSet); - - - Request secondRequest = new Request.Builder() - .url("https://runewatch.com/incident-index-page/") - .build(); - RuneLiteAPI.CLIENT.newCall(secondRequest).enqueue(new Callback() - { - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) - { - log.debug("error retrieving names from runewatch"); - } - - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException - { - String text = response.body().string(); - String mytext = text.substring(text.indexOf("lcp_instance_0"), text.indexOf("strong>Evidence Quality Suggestion")); - String[] split = mytext.split("href="); - for (String x : split) - { - if (x.contains("title")) - { - x = x.substring(x.indexOf("title"), x.indexOf('>')); - x = x.substring(x.indexOf('=') + 2, x.length() - 1); - runeWatchSet.add(Text.standardize(x).toLowerCase()); - } - } - } - }); - - Request thirdRequest = new Request.Builder() - .url("https://wdrdev.github.io/toxic") - .build(); - fetchAndParseWdr(thirdRequest, wdrToxicSet); - } - - private void fetchAndParseWdr(Request req, Set tgtSet) - { - RuneLiteAPI.CLIENT.newCall(req).enqueue(new Callback() - { - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) - { - log.debug("error retrieving names from wdr"); - } - - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException - { - String text = response.body().string(); - text = text.substring(text.indexOf("

") + 3, text.indexOf("

")); - text = text.replace("/", ","); - text = text.replace(", $", ""); - - Text.fromCSV(text).forEach(str -> tgtSet.add(Text.standardize(str))); - } - }); - } - - /** - * Iterates through the clan chat list widget and checks if a string (name) is on any of the ban lists to highlight them red. - */ - private void highlightRedInCC() - { - clientThread.invokeLater(() -> - { - Widget widget = client.getWidget(WidgetInfo.CLAN_CHAT_LIST); - for (Widget widgetChild : widget.getDynamicChildren()) - { - String text = widgetChild.getText(), lc = text.toLowerCase(); - - if (checkScamList(lc) != null) - { - widgetChild.setText("" + text + ""); - } - else if (checkToxicList(lc) != null) - { - widgetChild.setText("" + text + ""); - } - } - }); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banlist/ListType.java b/runelite-client/src/main/java/net/runelite/client/plugins/banlist/ListType.java deleted file mode 100644 index 5349662734..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banlist/ListType.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.runelite.client.plugins.banlist; - -public enum ListType -{ - WEDORAIDSSCAM_LIST, - WEDORAIDSTOXIC_LIST, - RUNEWATCH_LIST, - MANUAL_LIST -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/AboveSceneOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/AboveSceneOverlay.java deleted file mode 100644 index 6c091bd9c1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/AboveSceneOverlay.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (c) 2018, Jacob M - * Copyright (c) 2019, 7ate9 - * Copyright (c) 2019, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.barbarianassault; - -import com.google.common.collect.ImmutableMap; -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Stroke; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -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; - -@Singleton -class AboveSceneOverlay extends Overlay -{ - private static final int HEALTH_BAR_HEIGHT = 20; - private static final int HEALTH_BAR_WIDTH = 115; - private static final int CENTER_OFFSET = Perspective.LOCAL_HALF_TILE_SIZE / 8; - private static final int EGG_DIAMETER = Perspective.LOCAL_HALF_TILE_SIZE / 4; - private static final Color HEALTH_BAR_COLOR = new Color(225, 35, 0, 125); - private static final ImmutableMap TEAMMATES = ImmutableMap.of( - WidgetInfo.BA_HEAL_TEAMMATE1, new Point(28, 2), - WidgetInfo.BA_HEAL_TEAMMATE2, new Point(26, 2), - WidgetInfo.BA_HEAL_TEAMMATE3, new Point(26, 2), - WidgetInfo.BA_HEAL_TEAMMATE4, new Point(25, 2)); - - private final Client client; - private final BarbarianAssaultPlugin game; - - - @Inject - private AboveSceneOverlay(final Client client, final BarbarianAssaultPlugin game) - { - super(game); - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.client = client; - this.game = game; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!game.isInGame() || game.getRole() == null || game.isUsingGloryHorn()) - { - return null; - } - - switch (game.getRole()) - { - - case HEALER: - if (game.isShowTeammateHealthbars()) - { - renderHealthBars(graphics); - } - if (game.isHealerCodes()) - { - renderHealerCodes(graphics); - } - break; - - - case COLLECTOR: - if (game.isHighlightCollectorEggs()) - { - renderEggs(graphics); - } - break; - } - return null; - } - - //TODO add poison color change or low health color change - private void renderHealthBars(Graphics2D graphics) - { - for (Map.Entry teammate : TEAMMATES.entrySet()) - { - Widget widget = client.getWidget(teammate.getKey()); - if (widget == null) - { - continue; - } - - // This will give us two elements, the first will be current health, and the second will be max health - String[] teammateHealth = widget.getText().split(" / "); - - graphics.setColor(HEALTH_BAR_COLOR); - graphics.fillRect((widget.getCanvasLocation().getX() - teammate.getValue().getX()), - (widget.getCanvasLocation().getY() - teammate.getValue().getY()), - getBarWidth(Integer.parseInt(teammateHealth[1]), Integer.parseInt(teammateHealth[0])), - HEALTH_BAR_HEIGHT); - } - } - - private int getBarWidth(int base, int current) - { - final double ratio = (double) current / base; - - if (ratio >= 1) - { - return HEALTH_BAR_WIDTH; - } - - return (int) Math.round(ratio * HEALTH_BAR_WIDTH); - } - - private void renderHealerCodes(Graphics2D graphics) - { - for (Healer healer : game.getHealers().values()) - { - Color color = Color.GREEN; - int timeLeft = 0; - - if (game.getWave() != null) - { - timeLeft = healer.getLastFoodTime() - (int) game.getWave().getWaveTimer().getElapsedTime(); - } - - timeLeft = timeLeft < 1 ? 0 : timeLeft; - - if (timeLeft > 0) - { - color = Color.RED; - } - - String text = String.format("%d %d", healer.getFoodRemaining(), timeLeft); - - OverlayUtil.renderActorOverlay(graphics, healer.getNpc(), text, color); - } - } - - private void renderEggs(Graphics2D graphics) - { - final Color color = graphics.getColor(); - final Stroke originalStroke = graphics.getStroke(); - String listen = game.getLastListenText(); - if (listen != null && !listen.equals("- - -")) - { - graphics.setStroke(new BasicStroke(2)); - //TODO Render quantity text as well - //TODO add config options for overlay colors - switch (listen) - { - case "Red eggs": - graphics.setColor(new Color(Color.RED.getRed(), Color.RED.getGreen(), Color.RED.getBlue(), 150)); - game.getRedEggs().forEach((point, quantity) -> drawCircle(graphics, LocalPoint.fromWorld(client, point))); - break; - case "Green eggs": - graphics.setColor(new Color(Color.GREEN.getRed(), Color.GREEN.getGreen(), Color.GREEN.getBlue(), 150)); - game.getGreenEggs().forEach((point, quantity) -> drawCircle(graphics, LocalPoint.fromWorld(client, point))); - break; - case "Blue eggs": - graphics.setColor(new Color(Color.BLUE.getRed(), Color.BLUE.getGreen(), Color.BLUE.getBlue(), 150)); - game.getBlueEggs().forEach((point, quantity) -> drawCircle(graphics, LocalPoint.fromWorld(client, point))); - break; - } - } - graphics.setColor(new Color(Color.YELLOW.getRed(), Color.YELLOW.getGreen(), Color.YELLOW.getBlue(), 150)); - game.getYellowEggs().forEach((point, quantity) -> drawCircle(graphics, LocalPoint.fromWorld(client, point))); - graphics.setColor(color); - graphics.setStroke(originalStroke); - } - - private void drawCircle(Graphics2D graphics, LocalPoint point) - { - if (point == null) - { - return; - } - - Point canvasPoint = Perspective.localToCanvas(client, point, 0); - if (canvasPoint == null) - { - return; - } - - //TODO rendering a model would be better / more accurate - graphics.fillOval(canvasPoint.getX() - CENTER_OFFSET, canvasPoint.getY() - CENTER_OFFSET, EGG_DIAMETER, EGG_DIAMETER); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/AboveWidgetsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/AboveWidgetsOverlay.java deleted file mode 100644 index 0d97291329..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/AboveWidgetsOverlay.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2019, 7ate9 - * Copyright (c) 2019, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.barbarianassault; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Point; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.api.widgets.WidgetItem; -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.ImageUtil; - -@Singleton -class AboveWidgetsOverlay extends Overlay -{ - private static final int OFFSET_X_TEXT_QUANTITY = 0; - private static final int OFFSET_Y_TEXT_QUANTITY = 10; - - private final Client client; - private final BarbarianAssaultPlugin game; - - @Inject - private AboveWidgetsOverlay(final Client client, final BarbarianAssaultPlugin game) - { - super(game); - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - this.client = client; - this.game = game; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!game.isInGame() || game.getRole() == null || game.isUsingGloryHorn()) - { - return null; - } - - Role role = game.getRole(); - - if (game.isShowTimer()) - { - renderTimer(graphics, role); - } - - switch (role) - { - case ATTACKER: - if (game.isHighlightArrows()) - { - renderInventoryHighlights(graphics, game.getRole().getListenItem(game.getLastListenText()), game.getHighlightArrowColor()); - } - break; - - case DEFENDER: - if (game.isHighlightBait()) - { - renderInventoryHighlights(graphics, game.getRole().getListenItem(game.getLastListenText()), game.getHighlightBaitColor()); - } - break; - - case HEALER: - if (game.isHighlightPoison()) - { - renderInventoryHighlights(graphics, game.getRole().getListenItem(game.getLastListenText()), game.getHighlightPoisonColor()); - } - } - return null; - } - - private void renderTimer(Graphics2D graphics, Role role) - { - Widget roleText = client.getWidget(role.getRoleText()); - Widget roleSprite = client.getWidget(role.getRoleSprite()); - - if (roleText == null || roleSprite == null) - { - return; - } - - if (role == Role.COLLECTOR && game.isShowEggCountOverlay() && game.getWave() != null) - { - roleText.setText("(" + game.getWave().getCollectedEggCount() + ") " + formatClock()); - } - else if (role == Role.HEALER && game.isShowHpCountOverlay() && game.getWave() != null) - { - roleText.setText("(" + game.getWave().getHpHealed() + ") " + formatClock()); - } - else - { - roleText.setText(formatClock()); - } - - Rectangle spriteBounds = roleSprite.getBounds(); - graphics.drawImage(game.getClockImage(), spriteBounds.x, spriteBounds.y, null); - roleSprite.setHidden(true); - } - - private void renderInventoryHighlights(Graphics2D graphics, int itemID, Color color) - { - Widget inventory = client.getWidget(WidgetInfo.INVENTORY); - - if (inventory == null || inventory.isHidden() || itemID == -1) - { - return; - } - - Color highlight = new Color(color.getRed(), color.getGreen(), color.getBlue(), 150); - BufferedImage image = ImageUtil.fillImage(client.createItemSprite(itemID, 300, 2, 0, 0, true, 710).toBufferedImage(), highlight); - for (WidgetItem item : inventory.getWidgetItems()) - { - if (item.getId() == itemID) - { - OverlayUtil.renderImageLocation(graphics, item.getCanvasLocation(), image); - //The item's text quantity is rendered after the sprite's image is rendered so that the text appears on top - if (item.getQuantity() > 1) - { - OverlayUtil.renderTextLocation(graphics, - new Point(item.getCanvasLocation().getX() + OFFSET_X_TEXT_QUANTITY, item.getCanvasLocation().getY() + OFFSET_Y_TEXT_QUANTITY), - String.valueOf(item.getQuantity()), Color.YELLOW); - } - } - } - } - - private String formatClock() - { - if (game.getCallTimer() == null) - { - return "- - -"; - } - else - { - long timeLeft = game.getTimeToChange(); - if (timeLeft < 0) - { - return "00:00"; - } - else - { - return String.format("00:%02d", timeLeft); - } - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultConfig.java deleted file mode 100644 index dfe2930e08..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultConfig.java +++ /dev/null @@ -1,516 +0,0 @@ -/* - * Copyright (c) 2019, 7ate9 - * Copyright (c) 2019, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.barbarianassault; - -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.ConfigSection; -import net.runelite.client.config.Range; - -@ConfigGroup("barbarianAssault") -public interface BarbarianAssaultConfig extends Config -{ - @ConfigItem( - keyName = "swapLadder", - name = "Swap quick-start", - description = "Enables swapping of 'Climb-down' and 'Quick-start' in the wave lobby", - position = 0 - ) - default boolean swapLadder() - { - return true; - } - - @ConfigItem( - keyName = "showTimer", - name = "Show call change timer", - description = "Shows time to next call change", - position = 1 - ) - default boolean showTimer() - { - return true; - } - - @ConfigItem( - keyName = "removeIncorrectCalls", - name = "Remove incorrect calls", - description = "Removes incorrect 'Tell' menu options from horn", - position = 2 - ) - default boolean removeIncorrectCalls() - { - return true; - } - - @ConfigItem( - keyName = "removeUnusedMenus", - name = "Remove unused menus", - description = "Removes unnecessary menu options" + - "
Example: Attack options are removed when not attacker", - position = 3 - ) - default boolean removeUnusedMenus() - { - return true; - } - - @ConfigItem( - keyName = "prayerMetronome", - name = "Enable prayer metronome", - description = "Turns on a metronome sync'd to the game's tick rate when any prayer is active", - position = 4 - ) - default boolean prayerMetronome() - { - return false; - } - - @Range( - min = 1, - max = 50 - ) - @ConfigItem( - keyName = "prayerMetronomeVolume", - name = "Metronome volume", - description = "Adjusts the metronome's volume", - position = 5, - hidden = true, - unhide = "prayerMetronome" - ) - default int prayerMetronomeVolume() - { - return 10; - } - - @ConfigItem( - keyName = "showDeathTimes", - name = "Show death times", - description = "Shows the time all penance monsters of a certain type are killed in the chat box, an info box, or both", - position = 6 - ) - default boolean showDeathTimes() - { - return true; - } - - @ConfigItem( - keyName = "showDeathTimesMode", - name = "Mode", - description = "", - position = 7, - hidden = true, - unhide = "showDeathTimes" - ) - default DeathTimesMode showDeathTimesMode() - { - return DeathTimesMode.BOTH; - } - - @ConfigItem( - keyName = "waveTimes", - name = "Show wave and game duration", - description = "Displays wave duration after each wave and total game time after wave 10", - position = 8 - ) - default boolean waveTimes() - { - return true; - } - - @ConfigItem( - keyName = "showTotalRewards", - name = "Summarize total reward points", - description = "Gives summary of advanced points breakdown in chat log", - position = 9 - ) - default boolean showTotalRewards() - { - return true; - } - - - /*///************///*/ - /*/// Attacker ///*/ - /*///************///*/ - - @ConfigSection( - name = "Attacker", - description = "", - position = 10, - keyName = "attackerSection" - ) - default boolean attackerSection() - { - return false; - } - - @ConfigItem( - keyName = "highlightArrows", - name = "Highlight called arrows", - description = "Highlights arrows called by your teammate", - position = 0, - section = "attackerSection" - ) - default boolean highlightArrows() - { - return true; - } - - @ConfigItem( - keyName = "highlightArrowColor", - name = "Arrow color", - description = "Configures the color to highlight the called arrows", - position = 1, - section = "attackerSection", - hidden = true, - unhide = "highlightArrows" - ) - default Color highlightArrowColor() - { - return Color.GREEN; - } - - @ConfigItem( - keyName = "removeIncorrectAttackStyles", - name = "Remove incorrect attack styles", - description = "Hides wrong attack styles for dragon claws and crystal halberd", - position = 2, - section = "attackerSection" - ) - default boolean removeIncorrectAttackStyles() - { - return false; - } - - @ConfigItem( - keyName = "tagging", - name = "Enable tagging", - description = "Highlights the menu entry of an attacker/ranger that has not been tagged.", - position = 3, - section = "attackerSection" - ) - default boolean tagging() - { - return false; - } - - - /*///************///*/ - /*/// Defender ///*/ - /*///************///*/ - - @ConfigSection( - name = "Defender", - description = "", - position = 11, - keyName = "defenderSection" - ) - default boolean defenderSection() - { - return false; - } - - @ConfigItem( - keyName = "highlightBait", - name = "Highlight called bait", - description = "Highlights bait called by your teammate", - position = 0, - section = "defenderSection" - ) - default boolean highlightBait() - { - return true; - } - - @ConfigItem( - keyName = "highlightBaitColor", - name = "Bait color", - description = "Configures the color to highlight the called bait", - position = 1, - section = "defenderSection", - hidden = true, - unhide = "highlightBait" - ) - default Color highlightBaitColor() - { - return Color.GREEN; - } - - @ConfigItem( - keyName = "showDefTimer", - name = "Show defender tick timer", - description = "Shows the current cycle tick of runners", - position = 2, - section = "defenderSection" - ) - default boolean showDefTimer() - { - return true; - } - - @ConfigItem( - keyName = "deprioritizeBait", - name = "Deprioritize bait", - description = "Moves 'Take' menu option for all bait below 'Walk Here'", - position = 3, - section = "defenderSection" - ) - default boolean deprioritizeBait() - { - return true; - } - - @ConfigItem( - keyName = "removePenanceCave", - name = "Remove penance cave", - description = "Removes 'Block' menu option from penance cave", - position = 4, - section = "defenderSection" - ) - default boolean removePenanceCave() - { - return true; - } - - - /*///**********///*/ - /*/// Healer ///*/ - /*///**********///*/ - - @ConfigSection( - name = "Healer", - description = "", - position = 12, - keyName = "healerSection" - ) - default boolean healerSection() - { - return false; - } - - @ConfigItem( - keyName = "highlightPoison", - name = "Highlight called poison", - description = "Highlights poison called by your teammate", - position = 0, - section = "healerSection" - ) - default boolean highlightPoison() - { - return true; - } - - @ConfigItem( - keyName = "highlightPoisonColor", - name = "Poison color", - description = "Configures the color to highlight the called poison", - position = 1, - section = "healerSection", - hidden = true, - unhide = "highlightPoison" - ) - default Color highlightPoisonColor() - { - return Color.GREEN; - } - - @ConfigItem( - keyName = "highlightNotification", - name = "Highlight incorrect notification", - description = "Highlights incorrect poison chat notification", - position = 2, - section = "healerSection" - ) - default boolean highlightNotification() - { - return true; - } - - @ConfigItem( - keyName = "highlightNotificationColor", - name = "Notification color", - description = "Configures the color to highlight the notification text", - position = 3, - section = "healerSection", - hidden = true, - unhide = "highlightNotification" - ) - default Color highlightNotificationColor() - { - return Color.RED; - } - - @ConfigItem( - keyName = "showHpCountOverlay", - name = "Show number of hitpoints healed", - description = "Displays current number of hitpoints healed", - position = 4, - section = "healerSection" - ) - default boolean showHpCountOverlay() - { - return true; - } - - @ConfigItem( - keyName = "showTeammateHealthbars", - name = "Show health bars", - description = "Displays a health bar where a teammate's remaining health is located", - position = 5, - section = "healerSection" - ) - default boolean showTeammateHealthbars() - { - return true; - } - - @ConfigItem( - keyName = "healerCodes", - name = "Show healer codes", - description = "Overlay to show healer codes", - position = 6, - section = "healerSection" - ) - default boolean healerCodes() - { - return false; - } - - @ConfigItem( - keyName = "healerMenuOption", - name = "Show healer menu options", - description = "Shows tick count in healer menu options", - position = 7, - section = "healerSection" - ) - default boolean healerMenuOption() - { - return false; - } - - @ConfigItem( - keyName = "shiftOverstock", - name = "Enable shift overstock", - description = "Enables overstocking by pressing shift", - position = 8, - section = "healerSection" - ) - default boolean shiftOverstock() - { - return true; - } - - @ConfigItem( - keyName = "controlHealer", - name = "Control Healer", - description = "Hold ctrl to put last healer clicked on top", - position = 9, - section = "healerSection" - ) - default boolean controlHealer() - { - return true; - } - - - /*///*************///*/ - /*/// Collector ///*/ - /*///*************///*/ - - @ConfigSection( - name = "Collector", - description = "", - position = 13, - keyName = "collectorSection" - ) - default boolean collectorSection() - { - return false; - } - - @ConfigItem( - keyName = "swapCollectorBag", - name = "Swap empty", - description = "Enables swapping of 'Look-in' and 'Empty' on the collector's bag", - position = 0, - section = "collectorSection" - ) - default boolean swapCollectorBag() - { - return true; - } - - @ConfigItem( - keyName = "swapDestroyEggs", - name = "Swap destroy", - description = "Enables swapping of 'Use' and 'Destroy' on collector eggs; this does not affect yellow/omega eggs", - position = 1, - section = "collectorSection" - ) - default boolean swapDestroyEggs() - { - return true; - } - - @ConfigItem( - keyName = "highlightCollectorEggs", - name = "Highlight collector eggs", - description = "Highlight called egg colors", - position = 2, - section = "collectorSection" - ) - default boolean highlightCollectorEggs() - { - return true; - } - - @ConfigItem( - keyName = "deprioritizeIncorrectEggs", - name = "Deprioritize incorrect eggs", - description = "Moves 'Take' menu option for incorrect eggs below 'Walk Here'", - position = 3, - section = "collectorSection" - ) - default boolean deprioritizeIncorrectEggs() - { - return true; - } - - @ConfigItem( - keyName = "showEggCountOverlay", - name = "Show number of eggs collected", - description = "Displays current number of eggs collected", - position = 4, - section = "collectorSection" - ) - default boolean showEggCountOverlay() - { - return true; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultMenu.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultMenu.java deleted file mode 100644 index 341ada9685..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultMenu.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) 2019, 7ate9 - * Copyright (c) 2019, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.barbarianassault; - -import com.google.common.collect.Sets; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import javax.inject.Inject; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.client.menus.AbstractComparableEntry; -import net.runelite.client.menus.MenuManager; - -class BarbarianAssaultMenu -{ - private final MenuManager menuManager; - private final BarbarianAssaultPlugin game; - private final List tracker = new ArrayList<>(); - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private boolean hornUpdated = false; - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private boolean rebuildForced = false; - - @Inject - BarbarianAssaultMenu(final MenuManager menuManager, final BarbarianAssaultPlugin game) - { - this.menuManager = menuManager; - this.game = game; - } - - private boolean isHornOptionHidden(String option) - { - if (game.isInGame() && game.getRole() != null && game.getRole().getTell(game.getLastCallText()).equalsIgnoreCase(option)) - { - // This will force the menu to be rebuilt after the correct tell is found - // medic will be added to the menu if it wasn't there before - if (!hornUpdated) - { - rebuildForced = true; - } - hornUpdated = true; - return false; - } - return true; - } - - void clearHiddenMenus() - { - // Clears menus from MenuManager and tracker - for (Iterator iterator = tracker.iterator(); iterator.hasNext(); ) - { - menuManager.removeHiddenEntry(iterator.next()); - iterator.remove(); - } - } - - //TODO add omega egg use on? - void validateHiddenMenus(Role role) - { - clearHiddenMenus(); - - HashSet hiddenMenus = Sets.newHashSet(Menus.getMenus()); - HashSet conditionalMenus = Sets.newHashSet(Menus.getMenus()); - - // Any option left in this set will not be hidden - // Checking each option for the correct role prevents MenuManager from - // iterating over off role menu entry options that are not possible - conditionalMenus.removeIf(entry -> - { - switch (entry) - { - // Attacker role options - case TELL_BLUE_ATTACKER_HORN: - case TELL_GREEN_ATTACKER_HORN: - case TELL_RED_ATTACKER_HORN: - return ((role == Role.ATTACKER && isHornOptionHidden(entry.getOption())) || role == null) && game.isRemoveIncorrectCalls(); - - case ATTACK_PENANCE_FIGHTER: - case ATTACK_PENANCE_RANGER: - case GET_SPIKES_PETRIFIED_MUSHROOM: - case TAKE_ATTACKER_ITEM_MACHINE: - return (role != Role.ATTACKER && role != null) && game.isRemoveUnusedMenus(); - - - // Defender role Options - case TELL_MEAT_DEFENDER_HORN: - case TELL_TOFU_DEFENDER_HORN: - case TELL_WORMS_DEFENDER_HORN: - return ((role == Role.DEFENDER && isHornOptionHidden(entry.getOption())) || role == null) && game.isRemoveIncorrectCalls(); - - case BLOCK_PENANCE_CAVE: - return ((role != Role.DEFENDER && role != null) && game.isRemoveUnusedMenus()) - || (role == Role.DEFENDER && game.isRemovePenanceCave()); - - case DUNK_LAVA_CRATER: - case FIX: - case STOCK_UP_DEFENDER_ITEM_MACHINE: - case TAKE_DEFENDER_ITEM_MACHINE: - case TAKE_HAMMER: - case TAKE_LOGS: - return (role != Role.DEFENDER && role != null) && game.isRemoveUnusedMenus(); - - - // Collector role options - case TELL_ACCURATE_COLLECTOR_HORN: - case TELL_AGGRESSIVE_COLLECTOR_HORN: - case TELL_CONTROLLED_COLLECTOR_HORN: - case TELL_DEFENSIVE_COLLECTOR_HORN: - return ((role == Role.COLLECTOR && isHornOptionHidden(entry.getOption())) || role == null) && game.isRemoveIncorrectCalls(); - - case CONVERT_COLLECTOR_CONVERTER: - case LOAD_EGG_HOPPER: - case TAKE_BLUE_EGG: - case TAKE_GREEN_EGG: - case TAKE_RED_EGG: - case TAKE_YELLOW_EGG: - return (role != Role.COLLECTOR && role != null) && game.isRemoveUnusedMenus(); - - - // Healer role options - case TELL_CRACKERS_HEALER_HORN: - case TELL_TOFU_HEALER_HORN: - case TELL_WORMS_HEALER_HORN: - return ((role == Role.HEALER && isHornOptionHidden(entry.getOption())) || role == null) && game.isRemoveIncorrectCalls(); - - case DUNK_POISON_CRATER: - case STOCK_UP_HEALER_ITEM_MACHINE: - case TAKE_HEALER_ITEM_MACHINE: - case TAKE_FROM_HEALER_SPRING: - case DRINK_FROM_HEALER_SPRING: - return (role != Role.HEALER && role != null) && game.isRemoveUnusedMenus(); - - case USE_VIAL_GROUND: - case USE_VIAL_ITEM: - case USE_VIAL_NPC: - case USE_VIAL_WIDGET: - return role == Role.HEALER && game.isRemoveUnusedMenus(); - - - // Any role options - case DROP_HORN: - case EXAMINE_HORN: - case USE_HORN: - return game.isRemoveIncorrectCalls(); - - case MEDIC_HORN: - return game.isRemoveIncorrectCalls() && !hornUpdated; - - default: - return role != null && game.isRemoveUnusedMenus(); - } - }); - - hiddenMenus.removeAll(conditionalMenus); - - for (Menus entry : hiddenMenus) - { - menuManager.addHiddenEntry(entry.getEntry()); - tracker.add(entry.getEntry()); - } - } - - void enableSwaps() - { - if (game.isSwapLadder()) - { - menuManager.addSwap("climb-down", "ladder", "quick-start", "ladder"); - } - if (game.isSwapCollectorBag()) - { - menuManager.addSwap("look-in", "collection bag", "empty", "collection bag"); - } - if (game.isSwapDestroyEggs()) - { - menuManager.addSwap("use", "blue egg", "destroy", "blue egg"); - menuManager.addSwap("use", "green egg", "destroy", "green egg"); - menuManager.addSwap("use", "red egg", "destroy", "red egg"); - } - } - - void disableSwaps(boolean force) - { - if (!game.isSwapLadder() || force) - { - menuManager.removeSwap("climb-down", "ladder", "quick-start", "ladder"); - } - - if (!game.isSwapCollectorBag() || force) - { - menuManager.removeSwap("look-in", "collection bag", "empty", "collection bag"); - } - - if (!game.isSwapDestroyEggs() || force) - { - menuManager.removeSwap("use", "blue egg", "destroy", "blue egg"); - menuManager.removeSwap("use", "green egg", "destroy", "green egg"); - menuManager.removeSwap("use", "red egg", "destroy", "red egg"); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultPlugin.java deleted file mode 100644 index 02b83f4b18..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/BarbarianAssaultPlugin.java +++ /dev/null @@ -1,1613 +0,0 @@ -/* - * Copyright (c) 2018, Cameron - * Copyright (c) 2018, Jacob M - * Copyright (c) 2019, 7ate9 - * Copyright (c) 2019, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.barbarianassault; - -import com.google.common.collect.ImmutableList; -import com.google.inject.Provides; -import java.awt.Color; -import java.awt.Font; -import java.awt.event.KeyEvent; -import java.awt.image.BufferedImage; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -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.ItemID; -import net.runelite.api.MenuEntry; -import net.runelite.api.MessageNode; -import net.runelite.api.NPC; -import net.runelite.api.Player; -import net.runelite.api.Prayer; -import net.runelite.api.Projectile; -import net.runelite.api.SoundEffectID; -import net.runelite.api.Varbits; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.BeforeRender; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.InteractingChanged; -import net.runelite.api.events.ItemDespawned; -import net.runelite.api.events.ItemSpawned; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.events.ProjectileSpawned; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.api.widgets.WidgetItem; -import net.runelite.client.callback.ClientThread; -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.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.input.KeyListener; -import net.runelite.client.input.KeyManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.attackstyles.AttackStyle; -import net.runelite.client.plugins.attackstyles.WeaponType; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.ui.overlay.infobox.InfoBox; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; -import net.runelite.client.util.ColorUtil; -import net.runelite.client.util.ImageUtil; -import org.apache.commons.lang3.StringUtils; - - -@Slf4j -@PluginDescriptor( - name = "Barbarian Assault", - description = "Custom barbarian assault plugin, use along with BA Tools", - tags = {"minigame", "overlay", "timer"}, - type = PluginType.MINIGAME // don't remove this, added this because our barbarian assault plugin is big time modified -) -@Singleton -public class BarbarianAssaultPlugin extends Plugin implements KeyListener -{ - private static final String ENDGAME_REWARD_NEEDLE_TEXT = "
5"; - - private static final int COLOR_CALL_UPDATED = 16316664; - - private static final int COLOR_CALL_CALLED = 16291864; - - private static final int BA_WAVE_NUM_INDEX = 2; - - private static final ImmutableList attackStyles = ImmutableList.of(WidgetInfo.COMBAT_STYLE_ONE, - WidgetInfo.COMBAT_STYLE_TWO, WidgetInfo.COMBAT_STYLE_THREE, WidgetInfo.COMBAT_STYLE_FOUR); - - @Getter(AccessLevel.PACKAGE) - private final Map redEggs = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private final Map greenEggs = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private final Map blueEggs = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private final Map yellowEggs = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private final Map healers = new HashMap<>(); - - private final List deathTimes = new ArrayList<>(); - private final Map projectiles = new HashMap<>(); - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private ChatMessageManager chatMessageManager; - - @Inject - private OverlayManager overlayManager; - - @Inject - private BarbarianAssaultConfig config; - - @Inject - private AboveWidgetsOverlay widgetsOverlay; - - @Inject - private AboveSceneOverlay sceneOverlay; - - @Inject - private BarbarianAssaultMenu menu; - - @Inject - private ItemManager itemManager; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private KeyManager keyManager; - - @Getter(AccessLevel.PACKAGE) - private boolean inGame = false; - @Getter(AccessLevel.PACKAGE) - private Wave wave = null; - @Getter(AccessLevel.PACKAGE) - private Role role = null; - @Getter(AccessLevel.PACKAGE) - private Scorecard scorecard = null; - @Getter(AccessLevel.PACKAGE) - private Timer gameTimer = null; - @Getter(AccessLevel.PACKAGE) - private Timer callTimer = null; - @Getter(AccessLevel.PACKAGE) - private int stage = -1; - @Getter(AccessLevel.PACKAGE) - private BufferedImage clockImage; - @Getter(AccessLevel.PACKAGE) - private Font font = null; - - // private String lastClickedTell = null; - @Getter(AccessLevel.PACKAGE) - private String lastCallText = null; - @Getter(AccessLevel.PACKAGE) - private String lastListenText = null; - private int lastCallColor = -1; - private int lastInteracted = -1; - - // private int gameTick = -1; - private int lastHealerPoisoned = -1; - private int tickNum = 0; - private int inGameBit = 0; - private boolean syncd = true; - private boolean tickReset = false; - private boolean hornCalled = false; - private boolean hornListened = false; - @Getter(AccessLevel.PACKAGE) - private boolean usingGloryHorn = false; - private boolean shiftDown = false; - private boolean controlDown = false; - private BufferedImage torsoImage, fighterImage, healerImage, rangerImage, runnerImage; - private TimerBox tickCounter; - - private String poisonUsed = null; - - // save config values - @Getter(AccessLevel.PACKAGE) - private boolean swapLadder; - @Getter(AccessLevel.PACKAGE) - private boolean showTimer; - @Getter(AccessLevel.PACKAGE) - private boolean removeIncorrectCalls; - @Getter(AccessLevel.PACKAGE) - private boolean removeUnusedMenus; - private boolean prayerMetronome; - private int prayerMetronomeVolume; - private boolean showDeathTimes; - private DeathTimesMode showDeathTimesMode; - private boolean waveTimes; - private boolean showTotalRewards; - @Getter(AccessLevel.PACKAGE) - private boolean highlightArrows; - @Getter(AccessLevel.PACKAGE) - private Color highlightArrowColor; - private boolean removeIncorrectAttackStyles; - private boolean tagging; - @Getter(AccessLevel.PACKAGE) - private boolean highlightBait; - @Getter(AccessLevel.PACKAGE) - private Color highlightBaitColor; - private boolean showDefTimer; - private boolean deprioritizeBait; - @Getter(AccessLevel.PACKAGE) - private boolean removePenanceCave; - @Getter(AccessLevel.PACKAGE) - private boolean highlightPoison; - @Getter(AccessLevel.PACKAGE) - private Color highlightPoisonColor; - private boolean highlightNotification; - private Color highlightNotificationColor; - @Getter(AccessLevel.PACKAGE) - private boolean showHpCountOverlay; - @Getter(AccessLevel.PACKAGE) - private boolean showTeammateHealthbars; - @Getter(AccessLevel.PACKAGE) - private boolean healerCodes; - private boolean healerMenuOption; - private boolean shiftOverstock; - private boolean controlHealer; - @Getter(AccessLevel.PACKAGE) - private boolean swapCollectorBag; - @Getter(AccessLevel.PACKAGE) - private boolean swapDestroyEggs; - @Getter(AccessLevel.PACKAGE) - private boolean highlightCollectorEggs; - private boolean deprioritizeIncorrectEggs; - @Getter(AccessLevel.PACKAGE) - private boolean showEggCountOverlay; - - @Provides - BarbarianAssaultConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(BarbarianAssaultConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - font = FontManager.getRunescapeFont().deriveFont(Font.BOLD, 24); - torsoImage = itemManager.getImage(ItemID.FIGHTER_TORSO); - clockImage = ImageUtil.getResourceStreamFromClass(getClass(), "clock.png"); - fighterImage = ImageUtil.getResourceStreamFromClass(getClass(), "fighter.png"); - healerImage = ImageUtil.getResourceStreamFromClass(getClass(), "healer.png"); - rangerImage = ImageUtil.getResourceStreamFromClass(getClass(), "ranger.png"); - runnerImage = ImageUtil.getResourceStreamFromClass(getClass(), "runner.png"); - overlayManager.add(widgetsOverlay); - overlayManager.add(sceneOverlay); - keyManager.registerKeyListener(this); - clientThread.invoke(this::validateGame); - } - - @Override - protected void shutDown() - { - overlayManager.remove(widgetsOverlay); - overlayManager.remove(sceneOverlay); - keyManager.unregisterKeyListener(this); - showRoleSprite(); - font = null; - torsoImage = null; - clockImage = null; - fighterImage = null; - healerImage = null; - rangerImage = null; - runnerImage = null; - shiftDown = false; - controlDown = false; - resetWave(); - wave = null; - // gameTick = client.getTickCount(); - menu.disableSwaps(true); - menu.clearHiddenMenus(); - } - - @Override - public void keyTyped(KeyEvent e) - { - } - - @Override - public void keyPressed(KeyEvent e) - { - if (e.getKeyCode() == KeyEvent.VK_SHIFT) - { - shiftDown = true; - } - - if (e.getKeyCode() == KeyEvent.VK_CONTROL) - { - controlDown = true; - } - } - - @Override - public void keyReleased(KeyEvent e) - { - if (e.getKeyCode() == KeyEvent.VK_SHIFT) - { - shiftDown = false; - } - - if (e.getKeyCode() == KeyEvent.VK_CONTROL) - { - controlDown = false; - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged configChanged) - { - //not client thread be careful - if (!configChanged.getGroup().equals("barbarianAssault")) - { - return; - } - - updateConfig(); - - switch (configChanged.getKey()) - { - case "showTimer": - if (!this.showTimer) - { - showRoleSprite(); - } - break; - - case "swapLadder": - case "swapCollectorBag": - case "swapDestroyEggs": - if (Boolean.parseBoolean(configChanged.getNewValue())) - { - menu.enableSwaps(); - } - else - { - menu.disableSwaps(false); - } - break; - - case "showDefTimer": - if (this.showDefTimer && getRole() == Role.DEFENDER) - { - addTickTimer(); - } - else - { - removeTickTimer(); - } - break; - - case "showDeathTimes": - case "showDeathTimesMode": - if (this.showDeathTimes - && (this.showDeathTimesMode == DeathTimesMode.INFO_BOX - || this.showDeathTimesMode == DeathTimesMode.BOTH)) - { - addAllDeathTimes(); - } - else - { - removeAllDeathTimes(false); - } - break; - - case "removePenanceCave": - case "removeUnusedMenus": - case "removeWrongPoison": - clientThread.invoke(() -> menu.validateHiddenMenus(getRole())); - break; - - case "removeIncorrectAttackStyles": - if (!this.removeIncorrectAttackStyles) - { - clientThread.invoke(this::showAllStyles); - } - break; - } - } - - private void updateConfig() - { - this.swapLadder = config.swapLadder(); - this.showTimer = config.showTimer(); - this.removeIncorrectCalls = config.removeIncorrectCalls(); - this.removeUnusedMenus = config.removeUnusedMenus(); - this.prayerMetronome = config.prayerMetronome(); - this.prayerMetronomeVolume = config.prayerMetronomeVolume(); - this.showDeathTimes = config.showDeathTimes(); - this.showDeathTimesMode = config.showDeathTimesMode(); - this.waveTimes = config.waveTimes(); - this.showTotalRewards = config.showTotalRewards(); - this.highlightArrows = config.highlightArrows(); - this.highlightArrowColor = config.highlightArrowColor(); - this.removeIncorrectAttackStyles = config.removeIncorrectAttackStyles(); - this.tagging = config.tagging(); - this.highlightBait = config.highlightBait(); - this.highlightBaitColor = config.highlightBaitColor(); - this.showDefTimer = config.showDefTimer(); - this.deprioritizeBait = config.deprioritizeBait(); - this.removePenanceCave = config.removePenanceCave(); - this.highlightPoison = config.highlightPoison(); - this.highlightPoisonColor = config.highlightPoisonColor(); - this.highlightNotification = config.highlightNotification(); - this.highlightNotificationColor = config.highlightNotificationColor(); - this.showHpCountOverlay = config.showHpCountOverlay(); - this.showTeammateHealthbars = config.showTeammateHealthbars(); - this.healerCodes = config.healerCodes(); - this.healerMenuOption = config.healerMenuOption(); - this.shiftOverstock = config.shiftOverstock(); - this.controlHealer = config.controlHealer(); - this.swapCollectorBag = config.swapCollectorBag(); - this.swapDestroyEggs = config.swapDestroyEggs(); - this.highlightCollectorEggs = config.highlightCollectorEggs(); - this.deprioritizeIncorrectEggs = config.deprioritizeIncorrectEggs(); - this.showEggCountOverlay = config.showEggCountOverlay(); - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded event) - { - switch (event.getGroupId()) - { - case WidgetID.BA_REWARD_GROUP_ID: - announceWaveTime(); - - Widget rewardWidget = client.getWidget(WidgetInfo.BA_REWARD_TEXT); - if (rewardWidget == null) - { - break; - } - - Widget pointsWidget = client.getWidget(WidgetInfo.BA_REWARD_TEXT); - if (!rewardWidget.getText().contains(ENDGAME_REWARD_NEEDLE_TEXT)) - { - if (this.showTotalRewards && pointsWidget != null) - { - // The wave will be null if the plugin is disabled mid game, but - // the wave points will still be accurate if it is re-enabled - if (wave == null) - { - wave = new Wave(client); - } - - wave.setAmounts(); - wave.setPoints(); - - announce(wave.getSummary()); - - // The scorecard will be null if the client is restart mid game - if (scorecard != null) - { - scorecard.addWave(wave); - } - } - } - else - { - announceGameTime(); - - if (this.showTotalRewards && scorecard != null && scorecard.getNumberOfWaves() == 9) - { - announce(scorecard.getGameSummary()); - } - } - break; - - case WidgetID.BA_ATTACKER_GROUP_ID: - startWave(Role.ATTACKER); - menu.validateHiddenMenus(Role.ATTACKER); - break; - - case WidgetID.BA_DEFENDER_GROUP_ID: - startWave(Role.DEFENDER); - menu.validateHiddenMenus(Role.DEFENDER); - break; - - case WidgetID.BA_HEALER_GROUP_ID: - startWave(Role.HEALER); - menu.validateHiddenMenus(Role.HEALER); - break; - - case WidgetID.BA_COLLECTOR_GROUP_ID: - startWave(Role.COLLECTOR); - menu.validateHiddenMenus(Role.COLLECTOR); - break; - } - } - - @Subscribe - private void onChatMessage(ChatMessage chatMessage) - { - if (!chatMessage.getType().equals(ChatMessageType.GAMEMESSAGE)) - { - return; - } - - final String message = chatMessage.getMessage(); - if (message.startsWith("---- Wave:")) - { - stage = Integer.parseInt(message.split(" ")[BA_WAVE_NUM_INDEX]); - if (stage == 1) - { - scorecard = new Scorecard(this); - gameTimer = new Timer(); - } - } - else if (isInGame()) - { - if (scorecard != null) - { - scorecard.onChatMessage(chatMessage); - } - - if (message.contains("exploded") && wave != null) - { - wave.setWrongEggs(wave.getWrongEggs() + 1); - wave.setPositiveEggCount(wave.getPositiveEggCount() - 1); - } - else if (message.contains("You healed") && wave != null) - { - String[] tokens = message.split(" "); - if (Integer.parseInt(tokens[2]) > 0) - { - int health = Integer.parseInt(tokens[2]); - wave.setHpHealed(wave.getHpHealed() + health); - } - } - else if (message.contains("the wrong type of poisoned food to use") && this.highlightNotification) - { - final MessageNode messageNode = chatMessage.getMessageNode(); - final String nodeValue = Text.removeTags(messageNode.getValue()); - messageNode.setValue(ColorUtil.wrapWithColorTag(nodeValue, this.highlightNotificationColor)); - chatMessageManager.update(messageNode); - } - else if (message.startsWith("All of the Penance")) - { - String[] tokens = message.split(" "); - - int time = wave == null ? -1 : (int) wave.getWaveTimer().getElapsedTime(); - - switch (tokens[4]) - { - case "Fighters": - addDeathTimes(new TimerBox(fighterImage, this, time)); - break; - - case "Healers": - addDeathTimes(new TimerBox(healerImage, this, time)); - break; - - case "Rangers": - addDeathTimes(new TimerBox(rangerImage, this, time)); - break; - - case "Runners": - addDeathTimes(new TimerBox(runnerImage, this, time)); - break; - } - - if (this.showDeathTimes && wave != null - && (this.showDeathTimesMode == DeathTimesMode.CHAT_BOX - || this.showDeathTimesMode == DeathTimesMode.BOTH)) - { - final MessageNode node = chatMessage.getMessageNode(); - final String nodeValue = Text.removeTags(node.getValue()); - node.setValue(nodeValue + " (" + wave.getWaveTimer().getElapsedTime() + "s)"); - chatMessageManager.update(node); - } - } - } - } - - @Subscribe - private void onItemSpawned(ItemSpawned itemSpawned) - { - if (!isInGame()) - { - return; - } - - Map eggMap = getEggMap(itemSpawned.getItem().getId()); - if (eggMap != null) - { - WorldPoint worldPoint = itemSpawned.getTile().getWorldLocation(); - Integer existingQuantity = eggMap.putIfAbsent(worldPoint, 1); - if (existingQuantity != null) - { - eggMap.put(worldPoint, existingQuantity + 1); - } - } - } - - @Subscribe - private void onItemDespawned(ItemDespawned itemDespawned) - { - if (!isInGame()) - { - return; - } - - int itemId = itemDespawned.getItem().getId(); - - if (!isItemEgg(itemId)) - { - return; - } - - // If an egg despawns due to time and the collector is standing over it, - // a point will added as if the player picked it up - Map eggMap = getEggMap(itemId); - if (eggMap != null) - { - WorldPoint worldPoint = itemDespawned.getTile().getWorldLocation(); - if (eggMap.containsKey(worldPoint)) - { - int quantity = eggMap.get(worldPoint); - - if (quantity > 1) - { - eggMap.put(worldPoint, quantity - 1); - } - else - { - eggMap.remove(worldPoint); - } - } - } - - if (getRole() == Role.COLLECTOR - && wave != null - && itemDespawned.getTile().getWorldLocation().equals(client.getLocalPlayer().getWorldLocation())) - { - wave.setPositiveEggCount(wave.getPositiveEggCount() + 1); - - if (wave.getPositiveEggCount() > 60) - { - wave.setPositiveEggCount(60); - } - - wave.setCollectedEggCount(wave.getPositiveEggCount() - wave.getWrongEggs()); - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - // Keep in mind isInGame is delayed by a tick when a wave ends - if (!isInGame() || getRole() == null) - { - return; - } - - tickNum++; - - if (tickNum > 9 || tickReset) - { - tickNum = 0; - tickReset = false; - projectiles.entrySet().removeIf(projectile -> projectile.getValue().getRemainingCycles() < 1); - } - - if (tickCounter != null) - { - tickCounter.setCount(tickNum); - } - - if (this.prayerMetronome && isAnyPrayerActive()) - { - for (int i = 0; i < this.prayerMetronomeVolume; i++) - { - client.playSoundEffect(SoundEffectID.GE_INCREMENT_PLOP); - } - } - } - - @Subscribe - private void onNpcSpawned(NpcSpawned event) - { - if (!isInGame()) - { - return; - } - - NPC npc = event.getNpc(); - - if (npc == null) - { - return; - } - - String name = event.getNpc().getName(); - - if (name.equals("Penance Healer") && !healers.containsKey(npc.getIndex())) - { - healers.put(npc.getIndex(), new Healer(npc, healers.size(), stage)); - } - } - - @Subscribe - private void onNpcDespawned(NpcDespawned event) - { - if (!isInGame()) - { - return; - } - - healers.remove(event.getNpc().getIndex()); - } - - - // So this is a mess, but it works and the horn of glory doesn't mess up anything. - // This was almost certainly a waste of time to get working, because almost nobody - // actually uses the horn of glory. At least now there shouldn't be anyone complaining - // about the horn of glory breaking anything and everything that should never break. - @Subscribe - private void onBeforeRender(BeforeRender event) - { - if (!isInGame()) - { - return; - } - - boolean rebuild = false; - - Widget callWidget = getRole() == null ? null : client.getWidget(getRole().getGloryCall()); - if (callWidget == null) - { - callWidget = getRole() == null ? null : client.getWidget(getRole().getCall()); - } - - String newCallText = getRole() == null ? lastCallText : getRole().getCall(client); - int newCallColor = callWidget == null ? lastCallColor : callWidget.getTextColor(); - - Widget listenWidget = getRole() == null ? null : client.getWidget(getRole().getGloryListen()); - if (listenWidget == null) - { - listenWidget = getRole() == null ? null : client.getWidget(getRole().getListen()); - usingGloryHorn = false; - } - else - { - usingGloryHorn = true; - } - - String newListenText = getRole() == null ? lastListenText : getRole().getListen(client); - - if (!Objects.equals(newCallText, lastCallText)) - { - rebuild = true; - lastCallText = newCallText; - callTimer = new Timer(); - tickReset = true; - hornCalled = false; - hornListened = false; - menu.setHornUpdated(false); - syncd = true; - - if (tickCounter != null) - { - tickCounter.setInSync(true); - } - } - - if (!Objects.equals(newListenText, lastListenText)) - { - if (newListenText != null && !newListenText.equals("- - -")) - { - hornListened = true; - rebuild = true; - } - else if (hornListened) - { - newListenText = lastListenText; - - // If the player uses the horn of glory, the listen text will be taken from there and set to the - // normal widget when the player exits the interface - if (listenWidget != null && !usingGloryHorn) - { - // Attacker has two widgets for it's listen text, the top widget is the one that is kept track of - if (getRole() == Role.ATTACKER) - { - listenWidget.setText(newListenText); - client.getWidget(WidgetInfo.BA_ATK_LISTEN_BOTTOM_TEXT).setText(Role.getMissingListen(newListenText)); - } - else - { - listenWidget.setText(newListenText); - } - - } - } - - lastListenText = newListenText; - } - - // Disabled for now, will need to also check either chat or verify a busy animation is not happening - /*if (newCallColor == COLOR_CALL_CALLED && !Objects.equals(lastClickedTell, lastCallText)) - { - hornCalled = false; - rebuild = true; - - if (callWidget != null) - { - callWidget.setTextColor(COLOR_CALL_UPDATED); - lastCallColor = COLOR_CALL_UPDATED; - } - } - - else if (newCallColor == COLOR_CALL_UPDATED && Objects.equals(lastClickedTell, lastCallText)) - { - hornCalled = true; - rebuild = true; - - if (callWidget != null) - { - callWidget.setTextColor(COLOR_CALL_CALLED); - lastCallColor = COLOR_CALL_CALLED; - } - }*/ - - // Horn of glory will switch text back to white color before call change - if (newCallColor != lastCallColor) - { - if (newCallColor == COLOR_CALL_CALLED) - { - hornCalled = true; - rebuild = true; - } - else if (hornCalled) - { - newCallColor = COLOR_CALL_CALLED; - if (callWidget != null) - { - callWidget.setTextColor(newCallColor); - } - } - - lastCallColor = newCallColor; - } - - if (rebuild || menu.isRebuildForced()) - { - menu.setRebuildForced(false); - menu.validateHiddenMenus(role); - } - - // This doesn't have to be done in BeforeRender. And although it is - // inefficient, it's only being done while in the instance. Will - // likely be changed in the future - if (getRole() == Role.ATTACKER && this.removeIncorrectAttackStyles) - { - Widget weapon = client.getWidget(WidgetInfo.COMBAT_WEAPON); - - if (weapon != null) - { - if ((StringUtils.contains(weapon.getText(), "Crystal halberd") || StringUtils.contains(weapon.getText(), "Dragon claws")) - && newListenText != null && !newListenText.equals("- - -")) - { - int i = 0; - for (AttackStyle style : getAttackStyles()) - { - Widget attackStyle = client.getWidget(attackStyles.get(i)); - if (attackStyle != null && style != null) - { - if (StringUtils.startsWith(newListenText, style.getName())) - { - attackStyle.setHidden(false); - } - else - { - attackStyle.setHidden(true); - } - } - - i++; - } - } - else - { - showAllStyles(); - } - } - } - } - - // onMenuEntryAdded is being used for conditional entry changes that are not - // easily achievable using MenuManager, all other changes use MenuManager in - // the BarbarianAssaultMenu/Menus classes - @Subscribe - private void onMenuEntryAdded(MenuEntryAdded event) - { - if (!isInGame()) - { - return; - } - - final List menu = new ArrayList<>(); - final List selected = new ArrayList<>(); - final List priority = new ArrayList<>(); - MenuEntry walk = null; - boolean prioritizeWalk = false; - - String listen = lastListenText != null ? StringUtils.remove(lastListenText, "Pois. ").toLowerCase() : ""; - - for (MenuEntry entry : client.getMenuEntries()) - { - String option = Text.removeTags(entry.getOption()).toLowerCase(); - String target = Text.removeTags(entry.getTarget()).toLowerCase(); - int identifier = entry.getIdentifier(); - - if (option.equals("walk here")) - { - walk = entry; - } - else - { - switch (getRole()) - { - case ATTACKER: - if (this.tagging && option.equals("attack") && (target.startsWith("penance fighter") || target.startsWith("penance ranger"))) - { - String tag = StringUtils.substringBefore(entry.getTarget(), ")"); - - NPC[] npcs = client.getCachedNPCs(); - - if (identifier >= 0 && identifier < npcs.length) - { - NPC npc = npcs[identifier]; - if (npc != null) - { - Projectile projectile = projectiles.get(identifier); - if (npc.getInteracting() == null && projectile == null) - { - entry.setTarget((tag + ") (" + (10 - (tickNum + 1)) + ")").replace("", "")); - selected.add(entry); - continue; - } - // TODO add check to see if other attacker is attacking fighter/ranger - // Possibly just add it to a list when the projectile is spawned - // Also maybe add order by health option - else if (npc.getInteracting() == client.getLocalPlayer() || (projectile != null && projectile.getInteracting() == npc)) - { - entry.setTarget((tag + ") (" + (10 - (tickNum)) + ")").replace("", "")); - } - else - { - entry.setTarget((tag + ") (" + (10 - (tickNum)) + ")").replace("", "")); - } - } - } - } - break; - - case COLLECTOR: - // Take option for yellow eggs should always be the first option - if (option.equals("take") && target.equals("yellow egg")) - { - priority.add(entry); - continue; - } - else if (this.deprioritizeIncorrectEggs - && option.equals("take") - && (target.equals("blue egg") || target.equals("green egg") || target.equals("red egg"))) - { - prioritizeWalk = true; - - if (listen.startsWith(target)) - { - selected.add(entry); - continue; - } - } - break; - - case DEFENDER: - // Take option for logs and hammer should always be the first option - if (option.equals("take") - && (target.equals("logs") || target.equals("hammer"))) - { - priority.add(entry); - continue; - } - else if (this.deprioritizeBait - && option.equals("take") - && (target.equals("tofu") || target.equals("crackers") || target.equals("worms"))) - { - prioritizeWalk = true; - } - break; - - case HEALER: - if (this.healerMenuOption && target.contains("penance healer") && healers.containsKey(identifier)) - { - String tag = StringUtils.substringBefore(entry.getTarget(), " ("); - int time = healers.get(identifier).timeToPoison(); - - if (time != -1) - { - entry.setTarget(tag + " (" + (healers.get(identifier).timeToPoison()) + ")"); - target = Text.removeTags(entry.getTarget()).toLowerCase(); - } - } - - if ((target.startsWith("poisoned meat ->") || target.startsWith("poisoned tofu ->") || target.startsWith("poisoned worms ->"))) - { - // Poison should only be used on healers - if (this.removeUnusedMenus && !target.contains("penance healer")) - { - continue; - } - else if (this.controlHealer && controlDown && identifier == lastHealerPoisoned && target.contains("penance healer")) - { - selected.add(entry); - continue; - } - } - else if (this.shiftOverstock && target.equals("healer item machine") && shiftDown) - { - if (option.contains(listen)) - { - selected.add(entry); - continue; - } - } - else if (this.removeUnusedMenus) - { - // Vials that are empty should only be used on spring - if (target.startsWith("healing vial ->") && !target.endsWith("healer spring")) - { - continue; - } - // Vials that are full should only be used on players - else if (target.startsWith("healing vial(4) ->")) - { - Player[] players = client.getCachedPlayers(); - - if (!(identifier >= 0 && identifier < players.length && players[identifier] != null)) - { - continue; - } - } - // Vials that are not full or empty can be used on either players or spring - else if (target.startsWith("healing vial(") && target.contains("->")) - { - Player[] players = client.getCachedPlayers(); - - if ((!(identifier >= 0 && identifier < players.length && players[identifier] != null)) - && !target.endsWith("healer spring")) - { - continue; - } - } - } - break; - } - } - - menu.add(entry); - } - - if (prioritizeWalk && walk != null) - { - menu.remove(walk); - menu.add(walk); - } - - if (!selected.isEmpty()) - { - menu.addAll(selected); - } - - if (!priority.isEmpty()) - { - menu.addAll(priority); - } - - client.setMenuEntries(menu.toArray(new MenuEntry[0])); - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked event) - { - if (!isInGame() && getRole() != null) - { - return; - } - - String target = Text.removeTags(event.getTarget()).toLowerCase(); - - if (getRole() == Role.HEALER && (target.startsWith("poisoned meat -> penance healer") - || target.startsWith("poisoned tofu -> penance healer") - || target.startsWith("poisoned worms -> penance healer"))) - { - lastHealerPoisoned = event.getIdentifier(); - poisonUsed = StringUtils.substringBefore(target.replace("oned", "."), " ->"); - } - - // INW - /* - String option = Text.removeTags(event.getMenuOption()); - if (option.startsWith("Tell-")) - { - lastClickedTell = getRole().getCallFromTell(option); - } - else if (usingGloryHorn && option.equals("Call")) - { - - } - */ - } - - // Interacting changed has a slight delay until after the hitsplat is applied - @Subscribe - private void onInteractingChanged(InteractingChanged event) - { - if (!isInGame() || getRole() != Role.HEALER) - { - return; - } - - Actor source = event.getSource(); - - if (source != client.getLocalPlayer()) - { - return; - } - - Actor opponent = event.getTarget(); - - if (opponent == null) - { - if (lastInteracted != -1 && StringUtils.equalsIgnoreCase(poisonUsed, getRole().getListen(client)) && healers.containsKey(lastInteracted)) - { - Healer healer = healers.get(lastInteracted); - healer.setFoodRemaining(healer.getFoodRemaining() - 1); - healer.setTimeLastPoisoned(Instant.now()); - } - - lastInteracted = -1; - poisonUsed = null; - } - else if (StringUtils.equals(opponent.getName(), "Penance Healer")) - { - lastInteracted = ((NPC) opponent).getIndex(); - } - - } - - @Subscribe - private void onProjectileSpawned(ProjectileSpawned event) - { - if (!isInGame()) - { - return; - } - - Actor target = event.getProjectile().getInteracting(); - if (target == null) - { - return; - } - - String name = target.getName(); - if ("Penance Fighter".equals(name) || "Penance Ranger".equals(name)) - { - projectiles.put(((NPC) target).getIndex(), event.getProjectile()); - } - } - - @Subscribe - private void onVarbitChanged(VarbitChanged event) - { - int newInGameBit = client.getVar(Varbits.IN_GAME_BA); - - if (inGameBit != newInGameBit) - { - if (newInGameBit == 0) - { - resetWave(); - callTimer = null; - hornCalled = false; - hornListened = false; - lastListenText = null; - lastCallText = null; - lastCallColor = -1; - // lastClickedTell = null; - } - else - { - wave = new Wave(client); - } - - inGameBit = newInGameBit; - } - } - - private void resetWave() - { - inGame = false; - menu.setHornUpdated(false); - menu.setRebuildForced(false); - removeTickTimer(); - removeAllDeathTimes(true); - projectiles.clear(); - clearAllEggMaps(); - healers.clear(); - role = null; - lastInteracted = -1; - poisonUsed = null; - lastHealerPoisoned = -1; - tickNum = 0; - showAllStyles(); - usingGloryHorn = false; - menu.validateHiddenMenus(null); - } - - private void startWave(Role role) - { - inGame = true; - this.role = role; - - validateWidgets(); - } - - // Role widgets are not accurate if a player is using horn of glory - private void validateGame() - { - Role role = null; - - Widget inventory = client.getWidget(WidgetInfo.INVENTORY); - - if (inventory != null) - { - Collection items = inventory.getWidgetItems(); - - for (WidgetItem item : items) - { - int id = item.getId(); - if (id == ItemID.COLLECTOR_HORN) - { - role = Role.COLLECTOR; - } - else if (id == ItemID.DEFENDER_HORN) - { - role = Role.DEFENDER; - } - else if (id == ItemID.ATTACKER_HORN || id == ItemID.ATTACKER_HORN_10517 || id == ItemID.ATTACKER_HORN_10518 - || id == ItemID.ATTACKER_HORN_10519 || id == ItemID.ATTACKER_HORN_10520) - { - role = Role.ATTACKER; - } - else if (id == ItemID.HEALER_HORN || id == ItemID.HEALER_HORN_10527 || id == ItemID.HEALER_HORN_10528 - || id == ItemID.HEALER_HORN_10529 || id == ItemID.HEALER_HORN_10530) - { - role = Role.HEALER; - } - } - } - - if (role != null) - { - inGame = true; - this.role = role; - - inGameBit = 1; - - usingGloryHorn = client.getWidget(role.getGloryListen()) != null; - - Widget stage = client.getWidget(role.getWave()); - - if (stage != null) - { - this.stage = Integer.parseInt(StringUtils.substringAfter(stage.getText(), " ")); - } - - lastCallText = role.getCall(client); - lastListenText = role.getListen(client); - - if (callTimer != null && callTimer.getElapsedTime() > 30) - { - callTimer = null; - - } - - // TODO getTickCount() does not work as expected - // tickNum = (client.getTickCount() - gameTick) % 10; - - syncd = false; - - if (tickCounter != null) - { - tickCounter.setInSync(false); - } - - // If the horn is currently called, or if the call timer is still in sync - // the text will be updated to the last called color - Widget callWidget = getRole() == null ? null : client.getWidget(getRole().getGloryCall()); - if (callWidget == null) - { - callWidget = getRole() == null ? null : client.getWidget(getRole().getCall()); - } - - int newCallColor = callWidget == null ? lastCallColor : callWidget.getTextColor(); - - if (newCallColor == COLOR_CALL_CALLED) - { - lastCallColor = COLOR_CALL_CALLED; - // lastClickedTell = lastCallText; - } - else if (callTimer == null) - { - lastCallColor = COLOR_CALL_UPDATED; - // lastClickedTell = null; - } - - if (callWidget != null) - { - callWidget.setTextColor(lastCallColor); - } - } - else - { - inGameBit = 0; - } - - validateWidgets(); - - menu.enableSwaps(); - menu.validateHiddenMenus(getRole()); - } - - private void validateWidgets() - { - if (!this.showTimer) - { - showRoleSprite(); - } - - if (this.showDefTimer && getRole() == Role.DEFENDER) - { - addTickTimer(); - } - else - { - removeTickTimer(); - } - - if (this.showDeathTimes - && (this.showDeathTimesMode == DeathTimesMode.INFO_BOX - || this.showDeathTimesMode == DeathTimesMode.BOTH)) - { - addAllDeathTimes(); - } - else - { - removeAllDeathTimes(false); - } - } - - private void showAllStyles() - { - for (WidgetInfo info : attackStyles) - { - Widget style = client.getWidget(info); - if (style != null) - { - style.setHidden(false); - } - } - } - - private void addTickTimer() - { - if (!isInGame() || tickCounter != null) - { - return; - } - - tickCounter = new TimerBox(torsoImage, this, tickNum); - - tickCounter.setInSync(syncd); - - tickCounter.setTooltipEnabled(true); - - removeAllDeathTimes(false); - - infoBoxManager.addInfoBox(tickCounter); - - addAllDeathTimes(); - } - - private void removeTickTimer() - { - if (tickCounter != null) - { - infoBoxManager.removeInfoBox(tickCounter); - tickCounter = null; - } - } - - private void addDeathTimes(TimerBox box) - { - if (!isInGame()) - { - return; - } - - deathTimes.add(box); - - if (this.showDeathTimes && (this.showDeathTimesMode == DeathTimesMode.INFO_BOX || this.showDeathTimesMode == DeathTimesMode.BOTH)) - { - infoBoxManager.addInfoBox(box); - } - } - - private void addAllDeathTimes() - { - if (!isInGame()) - { - return; - } - - List boxes = infoBoxManager.getInfoBoxes(); - - for (TimerBox box : deathTimes) - { - if (!boxes.contains(box)) - { - infoBoxManager.addInfoBox(box); - } - } - } - - private void removeAllDeathTimes(boolean clear) - { - for (InfoBox box : infoBoxManager.getInfoBoxes().toArray(new InfoBox[0])) - { - if (box instanceof TimerBox && box.getImage() != torsoImage) - { - infoBoxManager.removeInfoBox(box); - } - } - if (clear) - { - deathTimes.clear(); - } - } - - private void showRoleSprite() - { - if (getRole() == null || !isInGame()) - { - return; - } - - Widget roleText = client.getWidget(role.getRoleText()); - Widget roleSprite = client.getWidget(role.getRoleSprite()); - - if (roleSprite != null) - { - roleSprite.setHidden(false); - } - if (roleText != null) - { - roleText.setText(getRole().name()); - } - } - - private AttackStyle[] getAttackStyles() - { - return WeaponType.getWeaponType(client.getVar(Varbits.EQUIPPED_WEAPON_TYPE)).getAttackStyles(); - } - - private void announceWaveTime() - { - if (this.waveTimes && wave != null) - { - announceTime("Wave " + getStage() + " duration: ", wave.getWaveTimer().getElapsedTimeFormatted()); - } - } - - private void announceGameTime() - { - if (this.waveTimes && gameTimer != null) - { - announceTime("Game finished, duration: ", gameTimer.getElapsedTimeFormatted()); - } - } - - private void announceTime(String preText, String time) - { - final String chatMessage = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append(preText) - .append(ChatColorType.HIGHLIGHT) - .append(time) - .build(); - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.CONSOLE) - .runeLiteFormattedMessage(chatMessage) - .build()); - } - - private void announce(final ChatMessageBuilder chatMessage) - { - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.CONSOLE) - .runeLiteFormattedMessage(chatMessage.build()) - .build()); - } - - long getTimeToChange() - { - return 30 - callTimer.getElapsedTime(); - } - - private void clearAllEggMaps() - { - redEggs.clear(); - greenEggs.clear(); - blueEggs.clear(); - yellowEggs.clear(); - } - - private Map getEggMap(int itemID) - { - switch (itemID) - { - case ItemID.RED_EGG: - return redEggs; - - case ItemID.GREEN_EGG: - return greenEggs; - - case ItemID.BLUE_EGG: - return blueEggs; - - case ItemID.YELLOW_EGG: - return yellowEggs; - } - - return null; - } - - private boolean isItemEgg(int itemId) - { - return itemId == ItemID.RED_EGG || - itemId == ItemID.GREEN_EGG || - itemId == ItemID.BLUE_EGG || - itemId == ItemID.YELLOW_EGG; - } - - private boolean isAnyPrayerActive() - { - for (Prayer pray : Prayer.values()) - { - if (client.isPrayerActive(pray)) - { - return true; - } - } - - return false; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/DeathTimesMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/DeathTimesMode.java deleted file mode 100644 index 30f0e9792c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/DeathTimesMode.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2019, 7ate9 - * Copyright (c) 2019, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.barbarianassault; - - -public enum DeathTimesMode -{ - BOTH("Both"), - CHAT_BOX("Chat Box"), - INFO_BOX("Info Box"); - - private final String name; - - DeathTimesMode(String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Healer.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Healer.java deleted file mode 100644 index f40657bb3a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Healer.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2019, 7ate9 - * Copyright (c) 2019, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.barbarianassault; - -import com.google.common.collect.ImmutableList; -import java.time.Duration; -import java.time.Instant; -import java.util.List; -import lombok.AccessLevel; -import lombok.Data; -import lombok.Getter; -import net.runelite.api.NPC; - - -@Data -class Healer -{ - @Getter(AccessLevel.NONE) - private static final List> CODES = ImmutableList.of( - // ImmutableList.of(firstCallFood, secondCallFood, lastFoodTime), - ImmutableList.of(new int[]{1, 1}, new int[]{0, 0}, new int[]{0, 0}), - ImmutableList.of(new int[]{1, 1, 2}, new int[]{0, 0, 0}, new int[]{0, 0, 21}), - ImmutableList.of(new int[]{1, 6, 2}, new int[]{0, 0, 0}, new int[]{0, 0, 0}), - ImmutableList.of(new int[]{2, 5, 2, 0}, new int[]{0, 0, 7, 10}, new int[]{0, 0, 0, 0}), - ImmutableList.of(new int[]{2, 5, 2, 3, 0}, new int[]{0, 0, 0, 0, 7}, new int[]{0, 0, 21, 30, 0}), - ImmutableList.of(new int[]{3, 5, 2, 2, 0, 0}, new int[]{0, 0, 0, 2, 9, 10}, new int[]{12, 18, 21, 0, 0, 0}), - ImmutableList.of(new int[]{3, 7, 1, 1, 0, 0, 0}, new int[]{2, 0, 1, 1, 2, 4, 10}, new int[]{0, 21, 0, 0, 30, 45, 0}), - ImmutableList.of(new int[]{1, 9, 1, 1, 0, 0, 0}, new int[]{1, 0, 1, 1, 2, 2, 10}, new int[]{0, 0, 0, 0, 33, 42, 0}), - ImmutableList.of(new int[]{2, 8, 1, 1, 0, 0, 0, 0}, new int[]{1, 0, 1, 1, 2, 1, 1, 10}, new int[]{0, 21, 0, 0, 0, 0, 0, 0, 0}), - ImmutableList.of(new int[]{2, 5, 1, 1, 0, 0, 0}, new int[]{1, 0, 1, 1, 4, 4, 8}, new int[]{21, 33, 0, 33, 30, 45, 0})); - - private final NPC npc; - - private int wave; - - private int spawnNumber; - - private int foodRemaining; - - private int lastFoodTime; - - private int firstCallFood; - - private int secondCallFood; - - private Instant timeLastPoisoned = null; - - Healer(NPC npc, int spawnNumber, int wave) - { - this.npc = npc; - this.wave = wave; - this.spawnNumber = spawnNumber; - List code = CODES.get(wave - 1); - this.firstCallFood = code.get(0)[spawnNumber]; - this.secondCallFood = code.get(1)[spawnNumber]; - this.lastFoodTime = code.get(2)[spawnNumber]; - this.foodRemaining = firstCallFood + secondCallFood; - } - - int timeToPoison() - { - if (timeLastPoisoned == null) - { - return -1; - } - else - { - long time = Duration.between(timeLastPoisoned, Instant.now()).getSeconds(); - return time > 20 ? 0 : (int) (20 - time); - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Menus.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Menus.java deleted file mode 100644 index 013c0093cf..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Menus.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2019, 7ate9 - * Copyright (c) 2019, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.barbarianassault; - -import com.google.common.collect.ImmutableSet; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.MenuOpcode; -import net.runelite.client.menus.BaseComparableEntry; -import static net.runelite.client.menus.ComparableEntries.newBaseComparableEntry; - -@AllArgsConstructor -public enum Menus -{ - ATTACK_PENANCE_FIGHTER(Role.ATTACKER, newBaseComparableEntry("attack", "penance fighter", -1, -1, true, false)), - ATTACK_PENANCE_RANGER(Role.ATTACKER, newBaseComparableEntry("attack", "penance ranger", -1, -1, true, false)), - GET_SPIKES_PETRIFIED_MUSHROOM(Role.ATTACKER, newBaseComparableEntry("get-spikes", "petrified mushroom", -1, -1, true, true)), - TAKE_ATTACKER_ITEM_MACHINE(Role.ATTACKER, newBaseComparableEntry("take", "attacker item machine", -1, -1, false, true)), - TELL_RED_ATTACKER_HORN(Role.ATTACKER, newBaseComparableEntry("tell-red", "attacker horn", -1, -1, true, true)), - TELL_GREEN_ATTACKER_HORN(Role.ATTACKER, newBaseComparableEntry("tell-green", "attacker horn", -1, -1, true, true)), - TELL_BLUE_ATTACKER_HORN(Role.ATTACKER, newBaseComparableEntry("tell-blue", "attacker horn", -1, -1, true, true)), - - BLOCK_PENANCE_CAVE(Role.DEFENDER, newBaseComparableEntry("block", "penance cave", -1, -1, true, true)), - DUNK_LAVA_CRATER(Role.DEFENDER, newBaseComparableEntry("dunk", "lava crater", -1, -1, true, true)), - FIX(Role.DEFENDER, newBaseComparableEntry("fix", "", -1, -1, true, false)), - STOCK_UP_DEFENDER_ITEM_MACHINE(Role.DEFENDER, newBaseComparableEntry("stock-up", "defender item machine", -1, -1, true, true)), - TAKE_DEFENDER_ITEM_MACHINE(Role.DEFENDER, newBaseComparableEntry("take", "defender item machine", -1, -1, false, true)), - TAKE_HAMMER(Role.DEFENDER, newBaseComparableEntry("take", "hammer", -1, -1, true, true)), - TAKE_LOGS(Role.DEFENDER, newBaseComparableEntry("take", "logs", -1, -1, true, true)), - TELL_WORMS_DEFENDER_HORN(Role.DEFENDER, newBaseComparableEntry("tell-worms", "defender horn", -1, -1, true, true)), - TELL_TOFU_DEFENDER_HORN(Role.DEFENDER, newBaseComparableEntry("tell-tofu", "defender horn", -1, -1, true, true)), - TELL_MEAT_DEFENDER_HORN(Role.DEFENDER, newBaseComparableEntry("tell-meat", "defender horn", -1, -1, true, true)), - - DRINK_FROM_HEALER_SPRING(Role.HEALER, newBaseComparableEntry("drink-from", "healer spring", -1, -1, true, true)), - DUNK_POISON_CRATER(Role.HEALER, newBaseComparableEntry("dunk", "poison crater", -1, -1, true, true)), - STOCK_UP_HEALER_ITEM_MACHINE(Role.HEALER, newBaseComparableEntry("stock-up", "healer item machine", -1, -1, true, true)), - TAKE_HEALER_ITEM_MACHINE(Role.HEALER, newBaseComparableEntry("take", "healer item machine", -1, -1, false, true)), - TAKE_FROM_HEALER_SPRING(Role.HEALER, newBaseComparableEntry("take-from", "healer spring", -1, -1, true, true)), - TELL_TOFU_HEALER_HORN(Role.HEALER, newBaseComparableEntry("tell-tofu", "healer horn", -1, -1, true, true)), - TELL_CRACKERS_HEALER_HORN(Role.HEALER, newBaseComparableEntry("tell-crackers", "healer horn", -1, -1, true, true)), - TELL_WORMS_HEALER_HORN(Role.HEALER, newBaseComparableEntry("tell-worms", "healer horn", -1, -1, true, true)), - USE_VIAL_GROUND(Role.HEALER, newBaseComparableEntry("use", "healing vial", -1, MenuOpcode.ITEM_USE_ON_GROUND_ITEM.getId(), true, false)), - USE_VIAL_ITEM(Role.HEALER, newBaseComparableEntry("use", "healing vial", -1, MenuOpcode.ITEM_USE_ON_WIDGET_ITEM.getId(), true, false)), - USE_VIAL_NPC(Role.HEALER, newBaseComparableEntry("use", "healing vial", -1, MenuOpcode.ITEM_USE_ON_NPC.getId(), true, false)), - USE_VIAL_WIDGET(Role.HEALER, newBaseComparableEntry("use", "healing vial", -1, MenuOpcode.ITEM_USE_ON_WIDGET.getId(), true, false)), - - CONVERT_COLLECTOR_CONVERTER(Role.COLLECTOR, newBaseComparableEntry("convert", "collector converter", -1, -1, true, true)), - LOAD_EGG_HOPPER(Role.COLLECTOR, newBaseComparableEntry("load", "egg hopper", -1, -1, true, true)), - TAKE_BLUE_EGG(Role.COLLECTOR, newBaseComparableEntry("take", "blue egg", -1, -1, true, true)), - TAKE_GREEN_EGG(Role.COLLECTOR, newBaseComparableEntry("take", "green egg", -1, -1, true, true)), - TAKE_RED_EGG(Role.COLLECTOR, newBaseComparableEntry("take", "red egg", -1, -1, true, true)), - TAKE_YELLOW_EGG(Role.COLLECTOR, newBaseComparableEntry("take", "yellow egg", -1, -1, true, true)), - TELL_CONTROLLED_COLLECTOR_HORN(Role.COLLECTOR, newBaseComparableEntry("tell-controlled", "collector horn", -1, -1, true, true)), - TELL_ACCURATE_COLLECTOR_HORN(Role.COLLECTOR, newBaseComparableEntry("tell-accurate", "collector horn", -1, -1, true, true)), - TELL_AGGRESSIVE_COLLECTOR_HORN(Role.COLLECTOR, newBaseComparableEntry("tell-aggressive", "collector horn", -1, -1, true, true)), - TELL_DEFENSIVE_COLLECTOR_HORN(Role.COLLECTOR, newBaseComparableEntry("tell-defensive", "collector horn", -1, -1, true, true)), - - ATTACK_PENANCE_QUEEN(null, newBaseComparableEntry("attack", "penance queen", -1, -1, true, false)), - ATTACK_QUEEN_SPAWN(null, newBaseComparableEntry("attack", "queen spawn", -1, -1, true, false)), - DROP_HORN(null, newBaseComparableEntry("drop", "r horn", -1, -1, true, false)), - EXAMINE_HORN(null, newBaseComparableEntry("examine", "r horn", -1, -1, true, false)), - LIGHT_LOGS(null, newBaseComparableEntry("light", "logs", -1, -1, true, true)), - MEDIC_HORN(null, newBaseComparableEntry("medic", "r horn", -1, -1, true, false)), - USE_HORN(null, newBaseComparableEntry("use", "r horn", -1, -1, true, false)); - - @Getter(AccessLevel.PACKAGE) - private final Role role; - - @Getter(AccessLevel.PACKAGE) - private final BaseComparableEntry entry; - - private static final ImmutableSet ALL = ImmutableSet.copyOf(Menus.values()); - - public String getOption() - { - return entry.getOption(); - } - - public String getTarget() - { - return entry.getTarget(); - } - - public int getId() - { - return entry.getId(); - } - - public int getType() - { - return entry.getType(); - } - - public boolean isStrictOption() - { - return entry.isStrictOption(); - } - - public boolean isStrictTarget() - { - return entry.isStrictTarget(); - } - - public static ImmutableSet getMenus() - { - return ALL; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Role.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Role.java deleted file mode 100644 index 696aa6b502..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Role.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (c) 2018, Cameron - * Copyright (c) 2019, 7ate9 - * Copyright (c) 2019, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.barbarianassault; - -import com.google.common.collect.ImmutableMap; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.ItemID; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; - - -@AllArgsConstructor -enum Role -{ - ATTACKER(WidgetInfo.BA_ATK_WAVE_TEXT, WidgetInfo.BA_ATK_LISTEN_TOP_TEXT, WidgetInfo.BA_ATK_HORN_LISTEN_TEXT, - WidgetInfo.BA_ATK_CALL_TEXT, WidgetInfo.BA_COLL_HORN_LISTEN_TEXT, WidgetInfo.BA_ATK_ROLE_TEXT, - WidgetInfo.BA_ATK_ROLE_SPRITE), - DEFENDER(WidgetInfo.BA_DEF_WAVE_TEXT, WidgetInfo.BA_DEF_LISTEN_TEXT, WidgetInfo.BA_DEF_HORN_LISTEN_TEXT, - WidgetInfo.BA_DEF_CALL_TEXT, WidgetInfo.BA_HEAL_HORN_LISTEN_TEXT, WidgetInfo.BA_DEF_ROLE_TEXT, - WidgetInfo.BA_DEF_ROLE_SPRITE), - COLLECTOR(WidgetInfo.BA_COLL_WAVE_TEXT, WidgetInfo.BA_COLL_LISTEN_TEXT, WidgetInfo.BA_COLL_HORN_LISTEN_TEXT, - WidgetInfo.BA_COLL_CALL_TEXT, WidgetInfo.BA_ATK_HORN_LISTEN_TEXT, WidgetInfo.BA_COLL_ROLE_TEXT, - WidgetInfo.BA_COLL_ROLE_SPRITE), - HEALER(WidgetInfo.BA_HEAL_WAVE_TEXT, WidgetInfo.BA_HEAL_LISTEN_TEXT, WidgetInfo.BA_DEF_HORN_LISTEN_TEXT, - WidgetInfo.BA_HEAL_CALL_TEXT, WidgetInfo.BA_DEF_HORN_LISTEN_TEXT, WidgetInfo.BA_HEAL_ROLE_TEXT, - WidgetInfo.BA_HEAL_ROLE_SPRITE); - - @Getter(AccessLevel.PACKAGE) - private final WidgetInfo wave; - @Getter(AccessLevel.PACKAGE) - private final WidgetInfo listen; - @Getter(AccessLevel.PACKAGE) - private final WidgetInfo gloryListen; - @Getter(AccessLevel.PACKAGE) - private final WidgetInfo call; - @Getter(AccessLevel.PACKAGE) - private final WidgetInfo gloryCall; - @Getter(AccessLevel.PACKAGE) - private final WidgetInfo roleText; - @Getter(AccessLevel.PACKAGE) - private final WidgetInfo roleSprite; - - // Duplicate* entries are to catch instances where the horn of glory has - // text different than the normal horn - private static final ImmutableMap TELLS = ImmutableMap.builder() - .put("Red egg", "Tell-red") - .put("Green egg", "Tell-green") - .put("Blue egg", "Tell-blue") - .put("Controlled/Bullet/Wind", "Tell-controlled") - .put("Accurate/Field/Water", "Tell-accurate") - .put("Aggressive/Blunt/Earth", "Tell-aggressive") - .put("Defensive/Barbed/Fire", "Tell-defensive") - .put("Tofu", "Tell-tofu") - .put("Crackers", "Tell-crackers") - .put("Worms", "Tell-worms") - .put("Poison Worms", "Tell-worms") - .put("Pois. Worms", "Tell-worms") - .put("Poison Tofu", "Tell-tofu") - .put("Pois. Tofu", "Tell-tofu") - .put("Poison Meat", "Tell-meat") - .put("Pois. Meat", "Tell-meat") - .build(); - private static final ImmutableMap GLORY_CALLS = ImmutableMap.builder() - .put("Controlled/Bullet/Wind", "Controlled/") - .put("Accurate/Field/Water", "Accurate/") - .put("Aggressive/Blunt/Earth", "Aggressive/") - .put("Defensive/Barbed/Fire", "Defensive/") - .put("Tofu", "Tofu") - .put("Crackers", "Crackers") - .put("Worms", "Worms") - .put("Poison worms", "Pois. Worms") - .put("Poison tofu", "Pois. Tofu") - .put("Poison meat", "Pois. Meat") - .put("Red egg", "Red egg") - .put("Green egg", "Green egg") - .put("Blue egg", "Blue egg") - .build(); - private static final ImmutableMap ITEMS = ImmutableMap.builder() - .put("Tofu", ItemID.TOFU) - .put("Crackers", ItemID.CRACKERS) - .put("Worms", ItemID.WORMS) - .put("Pois. Worms", ItemID.POISONED_WORMS) - .put("Pois. Tofu", ItemID.POISONED_TOFU) - .put("Pois. Meat", ItemID.POISONED_MEAT) - .put("Defensive/", ItemID.BARBED_ARROW) - .put("Aggressive/", ItemID.BLUNT_ARROW) - .put("Accurate/", ItemID.FIELD_ARROW) - .put("Controlled/", ItemID.BULLET_ARROW) - .build(); - private static final ImmutableMap SPLIT_LISTENS = ImmutableMap.builder() - .put("Controlled/", "Bullet/Wind") - .put("Bullet/Wind", "Controlled/") - .put("Accurate/", "Field/Water") - .put("Field/Water", "Accurate/") - .put("Aggressive/", "Blunt/Earth") - .put("Blunt/Earth", "Aggressive/") - .put("Defensive/", "Barbed/Fire") - .put("Barbed/Fire", "Defensive/") - .build(); - - - int getListenItem(String listen) - { - return ITEMS.getOrDefault(listen, -1); - } - - String getTell(String call) - { - return TELLS.getOrDefault(call, ""); - } - - String getCall(Client client) - { - // Do not reverse these if statements to be more efficient - // The normal widgets are no longer null/hidden after you - // click one time in the horn, and the values are incorrect - Widget callWidget = client.getWidget(getGloryCall()); - if (callWidget != null) - { - return GLORY_CALLS.get(callWidget.getText()); - } - - callWidget = client.getWidget(getCall()); - if (callWidget != null) - { - return callWidget.getText(); - } - - return null; - } - - String getListen(Client client) - { - // See the comment in getCall(Client client), before editing - Widget listenWidget = client.getWidget(getGloryListen()); - if (listenWidget != null) - { - return GLORY_CALLS.get(listenWidget.getText()); - } - - listenWidget = client.getWidget(getListen()); - if (listenWidget != null) - { - return listenWidget.getText(); - } - - return null; - } - - static String getMissingListen(String listen) - { - return SPLIT_LISTENS.getOrDefault(listen, "- - -"); - } - - // I call it "Switchception" :wutwedoin: - // Should probably switch to using an interface instead of an enum at this point - String getCallFromTell(String listen) - { - switch (this) - { - case COLLECTOR: - switch (listen) - { - case "Tell-controlled": - return "Controlled/"; - case "Tell-accurate": - return "Accurate/"; - case "Tell-aggressive": - return "Aggressive/"; - case "Tell-defensive": - return "Defensive/"; - } - break; - case ATTACKER: - switch (listen) - { - case "Tell-red": - return "Red egg"; - case "Tell-green": - return "Green egg"; - case "Tell-blue": - return "Blue egg"; - } - break; - case HEALER: - switch (listen) - { - case "Tell-tofu": - return "Tofu"; - case "Tell-crackers": - return "Crackers"; - case "Tell-worms": - return "Worms"; - } - break; - case DEFENDER: - switch (listen) - { - case "Tell-meat": - return "Pois. Meat"; - case "Tell-tofu": - return "Pois. Tofu"; - case "Tell-worms": - return "Pois. Worms"; - } - break; - } - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Scorecard.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Scorecard.java deleted file mode 100644 index 8e6c465b71..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Scorecard.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2018, Jacob M - * Copyright (c) 2019, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.barbarianassault; - -import java.awt.Color; -import java.util.ArrayList; -import java.util.List; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.events.ChatMessage; -import net.runelite.client.chat.ChatMessageBuilder; - - -@Getter(AccessLevel.PACKAGE) -public class Scorecard -{ - private BarbarianAssaultPlugin game; - - @Getter(AccessLevel.NONE) - private List waves = new ArrayList<>(); - private String[] totalDescriptions = { - "A: ", - "; D: ", - "; C: ", - "; Vial: ", - "; H packs: ", - "; Total: "}; - private String[] otherPointsDescriptions = { - " A: ", - "; D: ", - "; C: ", - "; H: " - }; - private int[] totalPoints = new int[6]; - private int[] totalAmounts = new int[6]; - private int[] otherRolesPoints = new int[4]; - - Scorecard(BarbarianAssaultPlugin game) - { - this.game = game; - } - - public void onChatMessage(ChatMessage chatMessage) - { - if (chatMessage.getMessage().startsWith("---- Points:") && game.getStage() == 1) - { - totalPoints = new int[6]; - totalAmounts = new int[6]; - } - } - - void addWave(Wave wave) - { - this.waves.add(wave); - } - - int getNumberOfWaves() - { - return waves.size(); - } - - ChatMessageBuilder getGameSummary() - { - int[] amountsList; - int[] pointsList; - int[] otherRolesPointsList; - ChatMessageBuilder message = new ChatMessageBuilder(); - message.append("Game points: "); - for (Wave wave : waves) - { - amountsList = wave.getAmounts(); - pointsList = wave.getPoints(); - otherRolesPointsList = wave.getOtherRolesPointsList(); - for (int j = 0; j < totalAmounts.length; j++) - { - totalAmounts[j] += amountsList[j]; - } - for (int k = 0; k < totalPoints.length; k++) - { - totalPoints[k] += pointsList[k]; - } - for (int z = 0; z < otherRolesPoints.length; z++) - { - otherRolesPoints[z] += otherRolesPointsList[z]; - } - } - for (int i = 0; i < otherRolesPoints.length; i++) - { - otherRolesPoints[i] += 80; - } - totalAmounts[5] += 80; - for (int i = 0; i < totalDescriptions.length; i++) - { - if (i != 4) - { - message.append(totalDescriptions[i]); - message.append(String.valueOf(totalAmounts[i])); - message.append("("); - if (totalPoints[i] < 0) - { - message.append(Color.RED, String.valueOf(totalPoints[i])); - } - else if (totalPoints[i] > 0) - { - message.append(Color.BLUE, String.valueOf(totalPoints[i])); - } - else - { - message.append(String.valueOf(totalPoints[i])); - } - message.append(")"); - } - } - message.append(System.getProperty("line.separator")); - message.append("All roles points this game: "); - for (int i = 0; i < otherPointsDescriptions.length; i++) - { - message.append(otherPointsDescriptions[i]); - message.append(String.valueOf(otherRolesPoints[i])); - } - return message; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Timer.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Timer.java deleted file mode 100644 index 8845291326..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Timer.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2019, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.barbarianassault; - -import java.time.Duration; -import java.time.Instant; -import java.time.LocalTime; -import java.time.format.DateTimeFormatter; -import lombok.AccessLevel; -import lombok.Getter; - -class Timer -{ - @Getter(AccessLevel.PACKAGE) - private final Instant startTime; - - Timer() - { - this.startTime = Instant.now(); - } - - long getElapsedTime() - { - return Duration.between(startTime, Instant.now()).getSeconds(); - } - - String getElapsedTimeFormatted() - { - return formatTime(LocalTime.ofSecondOfDay(getElapsedTime())); - } - - private static String formatTime(LocalTime time) - { - if (time.getHour() > 0) - { - return time.format(DateTimeFormatter.ofPattern("HH:mm")); - } - else if (time.getMinute() > 9) - { - return time.format(DateTimeFormatter.ofPattern("mm:ss")); - } - else - { - return time.format(DateTimeFormatter.ofPattern("m:ss")); - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/TimerBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/TimerBox.java deleted file mode 100644 index 1d65a35a31..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/TimerBox.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2019, 7ate9 - * Copyright (c) 2019, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.barbarianassault; - -import java.awt.Color; -import java.awt.image.BufferedImage; -import lombok.Data; -import lombok.EqualsAndHashCode; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.ui.overlay.infobox.InfoBox; - -@EqualsAndHashCode(callSuper = true) -@Data -public class TimerBox extends InfoBox -{ - private int count; - - private boolean inSync = true; - - private boolean tooltipEnabled = false; - - TimerBox(BufferedImage image, Plugin plugin, int count) - { - super(image, plugin); - this.count = count; - } - - @Override - public String getText() - { - if (count == -1) - { - return ""; - } - return Integer.toString(getCount()); - } - - @Override - public Color getTextColor() - { - if (inSync) - { - return Color.WHITE; - } - else - { - return Color.RED; - } - } - - @Override - public String getTooltip() - { - if (!tooltipEnabled) - { - return ""; - } - else if (inSync) - { - return "Valid"; - } - else - { - return "Invalid"; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Wave.java b/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Wave.java deleted file mode 100644 index 39308e6b29..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barbarianassault/Wave.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) 2018, Jacob M - * Copyright (c) 2019, 7ate9 - * Copyright (c) 2019, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.barbarianassault; - -import com.google.common.collect.ImmutableList; -import java.awt.Color; -import lombok.AccessLevel; -import lombok.Data; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.chat.ChatMessageBuilder; - -@Data -public class Wave -{ - @Getter(AccessLevel.NONE) - private static final ImmutableList WIDGETS = ImmutableList.of( - WidgetInfo.BA_FAILED_ATTACKER_ATTACKS, - WidgetInfo.BA_RUNNERS_PASSED, - WidgetInfo.BA_EGGS_COLLECTED, - WidgetInfo.BA_HITPOINTS_REPLENISHED, - WidgetInfo.BA_WRONG_POISON_PACKS, - WidgetInfo.BA_HONOUR_POINTS_REWARD - ); - - @Getter(AccessLevel.NONE) - private static final ImmutableList POINTSWIDGETS = ImmutableList.of( - //Base - WidgetInfo.BA_BASE_POINTS, - //Attacker - WidgetInfo.BA_FAILED_ATTACKER_ATTACKS_POINTS, - WidgetInfo.BA_RANGERS_KILLED, - WidgetInfo.BA_FIGHTERS_KILLED, - //Defender - WidgetInfo.BA_RUNNERS_PASSED_POINTS, - WidgetInfo.BA_RUNNERS_KILLED, - //Collector - WidgetInfo.BA_EGGS_COLLECTED_POINTS, - //Healer - WidgetInfo.BA_HEALERS_KILLED, - WidgetInfo.BA_HITPOINTS_REPLENISHED_POINTS, - WidgetInfo.BA_WRONG_POISON_PACKS_POINTS - ); - - @Getter(AccessLevel.NONE) - private final Client client; - - private final Timer waveTimer; - - private boolean runnersKilled; - - private boolean rangersKilled; - - private boolean healersKilled; - - private boolean fightersKilled; - - private int collectedEggCount = 0; - - private int positiveEggCount = 0; - - private int wrongEggs = 0; - - private int hpHealed = 0; - - private int totalCollectedEggCount = 0; - - private int totalHpHealed = 0; - - private int[] amounts = new int[6]; - - private int[] allPointsList = new int[10]; - - private int[] points = new int[6]; - - private int[] otherRolesPointsList = new int[4]; - - private String[] descriptions = {" A: ", "; D: ", "; C: ", "; Vial: ", "; H packs: ", "; Total: "}; - - private String[] otherPointsDescriptions = {" A: ", " D: ", " C: ", " H: "}; - - Wave(Client client) - { - this.client = client; - this.waveTimer = new Timer(); - } - - void setAmounts() - { - for (int i = 0; i < WIDGETS.size(); i++) - { - Widget w = client.getWidget(WIDGETS.get(i)); - if (w != null) - { - amounts[i] = Integer.parseInt(w.getText()); - } - } - } - - void setPoints() - { - for (int i = 0; i < POINTSWIDGETS.size(); i++) - { - Widget w = client.getWidget(POINTSWIDGETS.get(i)); - allPointsList[i] = Integer.parseInt(w.getText()); - switch (i) - { - case 1: - points[0] += allPointsList[i]; - break; - case 4: - points[1] += allPointsList[i]; - break; - case 6: - points[2] += allPointsList[i]; - break; - case 8: - case 9: - points[3] += allPointsList[i]; - break; - default: - break; - } - } - points[5] = 0; - for (int i = 0; i < points.length - 1; i++) - { - points[5] += points[i]; - } - for (int i = 0; i < POINTSWIDGETS.size(); i++) - { - Widget w = client.getWidget(POINTSWIDGETS.get(i)); - switch (i) - { - case 0: - otherRolesPointsList[0] += Integer.parseInt(w.getText()); - otherRolesPointsList[1] += Integer.parseInt(w.getText()); - otherRolesPointsList[2] += Integer.parseInt(w.getText()); - otherRolesPointsList[3] += Integer.parseInt(w.getText()); - break; - case 1: - case 2: - case 3: - otherRolesPointsList[0] += Integer.parseInt(w.getText()); - break; - case 4: - case 5: - otherRolesPointsList[1] += Integer.parseInt(w.getText()); - break; - case 6: - otherRolesPointsList[2] += Integer.parseInt(w.getText()); - break; - case 7: - case 8: - case 9: - otherRolesPointsList[3] += Integer.parseInt(w.getText()); - break; - } - } - } - - ChatMessageBuilder getSummary() - { - ChatMessageBuilder message = new ChatMessageBuilder(); - message.append("Wave points:"); - for (int i = 0; i < descriptions.length; i++) - { - message.append(descriptions[i]); - if (i != 5) - { - message.append(String.valueOf(amounts[i])); - } - message.append("("); - if (points[i] < 0) - { - message.append(Color.RED, String.valueOf(points[i])); - } - else if (points[i] > 0) - { - message.append(Color.BLUE, String.valueOf(points[i])); - } - else - { - message.append(String.valueOf(points[i])); - } - message.append(")"); - } - message.append(System.getProperty("line.separator")); - message.append("All roles points this wave: "); - for (int i = 0; i < otherPointsDescriptions.length; i++) - { - message.append(otherPointsDescriptions[i]); - message.append(String.valueOf(otherRolesPointsList[i])); - } - return message; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrotherSlainOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrotherSlainOverlay.java deleted file mode 100644 index ae7877481e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrotherSlainOverlay.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.barrows; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.Varbits; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -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; -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; -import net.runelite.client.util.ColorUtil; - -@Singleton -public class BarrowsBrotherSlainOverlay extends Overlay -{ - private final Client client; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - private BarrowsBrotherSlainOverlay(final BarrowsPlugin plugin, final Client client) - { - super(plugin); - setPosition(OverlayPosition.TOP_LEFT); - setPriority(OverlayPriority.LOW); - this.client = client; - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Barrows overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - // Do not display overlay if potential is null/hidden - final Widget potential = client.getWidget(WidgetInfo.BARROWS_POTENTIAL); - if (potential == null || potential.isHidden()) - { - return null; - } - - // Hide original overlay - final Widget barrowsBrothers = client.getWidget(WidgetInfo.BARROWS_BROTHERS); - if (barrowsBrothers != null) - { - barrowsBrothers.setHidden(true); - potential.setHidden(true); - } - - panelComponent.getChildren().clear(); - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - for (BarrowsBrothers brother : BarrowsBrothers.values()) - { - final boolean brotherSlain = client.getVar(brother.getKilledVarbit()) > 0; - String slain = brotherSlain ? "\u2713" : "\u2717"; - tableComponent.addRow(brother.getName(), ColorUtil.prependColorTag(slain, brotherSlain ? Color.GREEN : Color.RED)); - } - - float rewardPercent = client.getVar(Varbits.BARROWS_REWARD_POTENTIAL) / 10.0f; - tableComponent.addRow("Potential", ColorUtil.prependColorTag(rewardPercent != 0 ? rewardPercent + "%" : "0%", rewardPercent >= 73.0f && rewardPercent <= 88.0f ? Color.GREEN : rewardPercent < 65.6f ? Color.WHITE : Color.YELLOW)); - - panelComponent.getChildren().add(tableComponent); - - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrothers.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrothers.java deleted file mode 100644 index c2053439e1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsBrothers.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.barrows; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.api.Varbits; -import net.runelite.api.coords.WorldPoint; - -@RequiredArgsConstructor -public enum BarrowsBrothers -{ - AHRIM("Ahrim", new WorldPoint(3566, 3289, 0), Varbits.BARROWS_KILLED_AHRIM), - DHAROK("Dharok", new WorldPoint(3575, 3298, 0), Varbits.BARROWS_KILLED_DHAROK), - GUTHAN("Guthan", new WorldPoint(3577, 3283, 0), Varbits.BARROWS_KILLED_GUTHAN), - KARIL("Karil", new WorldPoint(3566, 3275, 0), Varbits.BARROWS_KILLED_KARIL), - TORAG("Torag", new WorldPoint(3553, 3283, 0), Varbits.BARROWS_KILLED_TORAG), - VERAC("Verac", new WorldPoint(3557, 3298, 0), Varbits.BARROWS_KILLED_VERAC); - - @Getter(AccessLevel.PACKAGE) - private final String name; - @Getter(AccessLevel.PACKAGE) - private final WorldPoint location; - @Getter(AccessLevel.PACKAGE) - private final Varbits killedVarbit; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsConfig.java deleted file mode 100644 index 4c8f2a3dfb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsConfig.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.barrows; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("barrows") -public interface BarrowsConfig extends Config -{ - @ConfigItem( - keyName = "showMinimap", - name = "Show Minimap in tunnels", - description = "Configures whether or not the minimap is displayed", - position = 0 - ) - default boolean showMinimap() - { - return true; - } - - @ConfigItem( - keyName = "showBrotherLoc", - name = "Show Brothers location", - description = "Configures whether or not the brothers location is displayed", - position = 1 - ) - default boolean showBrotherLoc() - { - return true; - } - - @ConfigItem( - keyName = "brotherLocColor", - name = "Brother location color", - description = "Change the color of the name displayed on the minimap", - position = 2 - ) - default Color brotherLocColor() - { - return Color.CYAN; - } - - @ConfigItem( - keyName = "deadBrotherLocColor", - name = "Dead Brother loc. color", - description = "Change the color of the name displayed on the minimap for a dead brother", - position = 3 - ) - default Color deadBrotherLocColor() - { - return Color.RED; - } - - @ConfigItem( - keyName = "showPuzzleAnswer", - name = "Show Puzzle Answer", - description = "Configures if the puzzle answer should be shown.", - position = 4 - ) - default boolean showPuzzleAnswer() - { - return true; - } - - @ConfigItem( - keyName = "showPrayerDrainTimer", - name = "Show Prayer Drain Timer", - description = "Configure whether or not a countdown until the next prayer drain is displayed", - position = 5 - ) - default boolean showPrayerDrainTimer() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java deleted file mode 100644 index 12b3494af7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.barrows; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.NPC; -import net.runelite.api.NPCDefinition; -import net.runelite.api.ObjectDefinition; -import net.runelite.api.Perspective; -import net.runelite.api.Player; -import net.runelite.api.WallObject; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.widgets.Widget; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayPosition; - -@Singleton -class BarrowsOverlay extends Overlay -{ - private static final int MAX_DISTANCE = 2350; - - private final Client client; - private final BarrowsPlugin plugin; - - @Inject - private BarrowsOverlay(final Client client, final BarrowsPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - Player local = client.getLocalPlayer(); - final Color npcColor = getMinimapDotColor(1); - final Color playerColor = getMinimapDotColor(2); - Widget puzzleAnswer = plugin.getPuzzleAnswer(); - - // tunnels are only on z=0 - if (!plugin.getWalls().isEmpty() && client.getPlane() == 0 && plugin.isShowMinimap()) - { - // NPC dots - graphics.setColor(npcColor); - final List npcs = client.getNpcs(); - for (NPC npc : npcs) - { - final NPCDefinition composition = npc.getDefinition(); - - if (composition != null && !composition.isMinimapVisible()) - { - continue; - } - - net.runelite.api.Point minimapLocation = npc.getMinimapLocation(); - if (minimapLocation != null) - { - graphics.fillOval(minimapLocation.getX(), minimapLocation.getY(), 4, 4); - } - } - - // Player dots - graphics.setColor(playerColor); - final List players = client.getPlayers(); - for (Player player : players) - { - if (player == local) - { - // Skip local player as we draw square for it later - continue; - } - - net.runelite.api.Point minimapLocation = player.getMinimapLocation(); - if (minimapLocation != null) - { - graphics.fillOval(minimapLocation.getX(), minimapLocation.getY(), 4, 4); - } - } - - // Render barrows walls/doors - renderObjects(graphics, local); - - // Local player square - graphics.setColor(playerColor); - graphics.fillRect(local.getMinimapLocation().getX(), local.getMinimapLocation().getY(), 3, 3); - } - else if (plugin.isShowBrotherLoc()) - { - renderBarrowsBrothers(graphics); - } - - if (puzzleAnswer != null && plugin.isShowPuzzleAnswer() && !puzzleAnswer.isHidden()) - { - Rectangle answerRect = puzzleAnswer.getBounds(); - graphics.setColor(Color.GREEN); - graphics.draw(answerRect); - } - - return null; - } - - private void renderObjects(Graphics2D graphics, Player localPlayer) - { - LocalPoint localLocation = localPlayer.getLocalLocation(); - for (WallObject wall : plugin.getWalls()) - { - LocalPoint location = wall.getLocalLocation(); - if (localLocation.distanceTo(location) <= MAX_DISTANCE) - { - renderWalls(graphics, wall); - } - } - - for (GameObject ladder : plugin.getLadders()) - { - LocalPoint location = ladder.getLocalLocation(); - if (localLocation.distanceTo(location) <= MAX_DISTANCE) - { - renderLadders(graphics, ladder); - } - } - } - - private void renderWalls(Graphics2D graphics, WallObject wall) - { - net.runelite.api.Point minimapLocation = wall.getMinimapLocation(); - - if (minimapLocation == null) - { - return; - } - - ObjectDefinition objectComp = client.getObjectDefinition(wall.getId()); - ObjectDefinition impostor = objectComp.getImpostorIds() != null ? objectComp.getImpostor() : null; - - if (impostor != null && impostor.getActions()[0] != null) - { - graphics.setColor(Color.green); - } - else - { - graphics.setColor(Color.gray); - } - - graphics.fillRect(minimapLocation.getX(), minimapLocation.getY(), 3, 3); - } - - /** - * Get minimap dot color from client - * - * @param typeIndex index of minimap dot type (1 npcs, 2 players) - * @return color - */ - private Color getMinimapDotColor(int typeIndex) - { - final int pixel = client.getMapDots()[typeIndex].getPixels()[1]; - return new Color(pixel); - } - - private void renderLadders(Graphics2D graphics, GameObject ladder) - { - net.runelite.api.Point minimapLocation = ladder.getMinimapLocation(); - - if (minimapLocation == null) - { - return; - } - - ObjectDefinition objectComp = client.getObjectDefinition(ladder.getId()); - - if (objectComp.getImpostorIds() != null && objectComp.getImpostor() != null) - { - graphics.setColor(Color.orange); - graphics.fillRect(minimapLocation.getX(), minimapLocation.getY(), 6, 6); - } - } - - private void renderBarrowsBrothers(Graphics2D graphics) - { - for (BarrowsBrothers brother : BarrowsBrothers.values()) - { - LocalPoint localLocation = LocalPoint.fromWorld(client, brother.getLocation()); - - if (localLocation == null) - { - continue; - } - - String brotherLetter = Character.toString(brother.getName().charAt(0)); - net.runelite.api.Point minimapText = Perspective.getCanvasTextMiniMapLocation(client, graphics, - localLocation, brotherLetter); - - if (minimapText != null) - { - graphics.setColor(Color.black); - graphics.drawString(brotherLetter, minimapText.getX() + 1, minimapText.getY() + 1); - - if (client.getVar(brother.getKilledVarbit()) > 0) - { - graphics.setColor(plugin.getDeadBrotherLocColor()); - } - else - { - graphics.setColor(plugin.getBrotherLocColor()); - } - - graphics.drawString(brotherLetter, minimapText.getX(), minimapText.getY()); - } - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java deleted file mode 100644 index 6b8b102632..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.barrows; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Sets; -import com.google.inject.Provides; -import java.awt.Color; -import java.time.temporal.ChronoUnit; -import java.util.HashSet; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.GameState; -import net.runelite.api.NullObjectID; -import net.runelite.api.ObjectID; -import net.runelite.api.SpriteID; -import net.runelite.api.WallObject; -import net.runelite.api.events.GameObjectChanged; -import net.runelite.api.events.GameObjectDespawned; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.WallObjectChanged; -import net.runelite.api.events.WallObjectDespawned; -import net.runelite.api.events.WallObjectSpawned; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.widgets.Widget; -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.events.ConfigChanged; -import net.runelite.client.game.SpriteManager; -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.ui.overlay.infobox.InfoBoxManager; -import net.runelite.client.ui.overlay.infobox.InfoBoxPriority; -import net.runelite.client.ui.overlay.infobox.LoopTimer; - -@PluginDescriptor( - name = "Barrows Brothers", - description = "Show helpful information for the Barrows minigame", - tags = {"combat", "minigame", "minimap", "bosses", "pve", "pvm"}, - type = PluginType.MINIGAME -) -@Singleton -public class BarrowsPlugin extends Plugin -{ - @Getter(AccessLevel.PACKAGE) - private static final Set BARROWS_WALLS = Sets.newHashSet - ( - ObjectID.DOOR_20678, NullObjectID.NULL_20681, NullObjectID.NULL_20682, NullObjectID.NULL_20683, NullObjectID.NULL_20684, NullObjectID.NULL_20685, NullObjectID.NULL_20686, NullObjectID.NULL_20687, - NullObjectID.NULL_20688, NullObjectID.NULL_20689, NullObjectID.NULL_20690, NullObjectID.NULL_20691, NullObjectID.NULL_20692, NullObjectID.NULL_20693, NullObjectID.NULL_20694, NullObjectID.NULL_20695, - NullObjectID.NULL_20696, ObjectID.DOOR_20697, NullObjectID.NULL_20700, NullObjectID.NULL_20701, NullObjectID.NULL_20702, NullObjectID.NULL_20703, NullObjectID.NULL_20704, NullObjectID.NULL_20705, - NullObjectID.NULL_20706, NullObjectID.NULL_20707, NullObjectID.NULL_20708, NullObjectID.NULL_20709, NullObjectID.NULL_20710, NullObjectID.NULL_20711, NullObjectID.NULL_20712, NullObjectID.NULL_20713, - NullObjectID.NULL_20714, NullObjectID.NULL_20715, NullObjectID.NULL_20728, NullObjectID.NULL_20730 - ); - - private static final Set BARROWS_LADDERS = Sets.newHashSet(NullObjectID.NULL_20675, NullObjectID.NULL_20676, NullObjectID.NULL_20677); - private static final ImmutableList POSSIBLE_SOLUTIONS = ImmutableList.of( - WidgetInfo.BARROWS_PUZZLE_ANSWER1, - WidgetInfo.BARROWS_PUZZLE_ANSWER2, - WidgetInfo.BARROWS_PUZZLE_ANSWER3 - ); - - private static final long PRAYER_DRAIN_INTERVAL_MS = 18200; - private static final int CRYPT_REGION_ID = 14231; - - @Getter(AccessLevel.PACKAGE) - private final Set walls = new HashSet<>(); - - @Getter(AccessLevel.PACKAGE) - private final Set ladders = new HashSet<>(); - - private LoopTimer barrowsPrayerDrainTimer; - private boolean wasInCrypt = false; - - @Getter(AccessLevel.PACKAGE) - private Widget puzzleAnswer; - - @Inject - private OverlayManager overlayManager; - - @Inject - private BarrowsOverlay barrowsOverlay; - - @Inject - private BarrowsBrotherSlainOverlay brotherOverlay; - - @Inject - private Client client; - - @Inject - private SpriteManager spriteManager; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private BarrowsConfig config; - - @Getter(AccessLevel.PACKAGE) - private boolean showMinimap; - @Getter(AccessLevel.PACKAGE) - private boolean showBrotherLoc; - @Getter(AccessLevel.PACKAGE) - private Color brotherLocColor; - @Getter(AccessLevel.PACKAGE) - private Color deadBrotherLocColor; - @Getter(AccessLevel.PACKAGE) - private boolean showPuzzleAnswer; - private boolean showPrayerDrainTimer; - - @Provides - BarrowsConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(BarrowsConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(barrowsOverlay); - overlayManager.add(brotherOverlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(barrowsOverlay); - overlayManager.remove(brotherOverlay); - walls.clear(); - ladders.clear(); - puzzleAnswer = null; - wasInCrypt = false; - stopPrayerDrainTimer(); - - // Restore widgets - final Widget potential = client.getWidget(WidgetInfo.BARROWS_POTENTIAL); - if (potential != null) - { - potential.setHidden(false); - } - - final Widget barrowsBrothers = client.getWidget(WidgetInfo.BARROWS_BROTHERS); - if (barrowsBrothers != null) - { - barrowsBrothers.setHidden(false); - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("barrows")) - { - updateConfig(); - - if (!this.showPrayerDrainTimer) - { - stopPrayerDrainTimer(); - } - } - } - - private void updateConfig() - { - this.showMinimap = config.showMinimap(); - this.showBrotherLoc = config.showBrotherLoc(); - this.brotherLocColor = config.brotherLocColor(); - this.deadBrotherLocColor = config.deadBrotherLocColor(); - this.showPuzzleAnswer = config.showPuzzleAnswer(); - this.showPrayerDrainTimer = config.showPrayerDrainTimer(); - } - - @Subscribe - private void onWallObjectSpawned(WallObjectSpawned event) - { - WallObject wallObject = event.getWallObject(); - if (BARROWS_WALLS.contains(wallObject.getId())) - { - walls.add(wallObject); - } - } - - @Subscribe - private void onWallObjectChanged(WallObjectChanged event) - { - WallObject previous = event.getPrevious(); - WallObject wallObject = event.getWallObject(); - - walls.remove(previous); - if (BARROWS_WALLS.contains(wallObject.getId())) - { - walls.add(wallObject); - } - } - - @Subscribe - private void onWallObjectDespawned(WallObjectDespawned event) - { - WallObject wallObject = event.getWallObject(); - walls.remove(wallObject); - } - - @Subscribe - private void onGameObjectSpawned(GameObjectSpawned event) - { - GameObject gameObject = event.getGameObject(); - if (BARROWS_LADDERS.contains(gameObject.getId())) - { - ladders.add(gameObject); - } - } - - @Subscribe - private void onGameObjectChanged(GameObjectChanged event) - { - GameObject previous = event.getPrevious(); - GameObject gameObject = event.getGameObject(); - - ladders.remove(previous); - if (BARROWS_LADDERS.contains(gameObject.getId())) - { - ladders.add(gameObject); - } - } - - @Subscribe - private void onGameObjectDespawned(GameObjectDespawned event) - { - GameObject gameObject = event.getGameObject(); - ladders.remove(gameObject); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOADING) - { - wasInCrypt = isInCrypt(); - // on region changes the tiles get set to null - walls.clear(); - ladders.clear(); - puzzleAnswer = null; - } - else if (event.getGameState() == GameState.LOGGED_IN && client.getLocalPlayer() != null) - { - boolean isInCrypt = isInCrypt(); - if (wasInCrypt && !isInCrypt) - { - stopPrayerDrainTimer(); - } - else if (!wasInCrypt && isInCrypt) - { - startPrayerDrainTimer(); - } - } - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded event) - { - if (event.getGroupId() == WidgetID.BARROWS_PUZZLE_GROUP_ID) - { - final int answer = client.getWidget(WidgetInfo.BARROWS_FIRST_PUZZLE).getModelId() - 3; - puzzleAnswer = null; - - for (WidgetInfo puzzleNode : POSSIBLE_SOLUTIONS) - { - final Widget widgetToCheck = client.getWidget(puzzleNode); - - if (widgetToCheck != null && widgetToCheck.getModelId() == answer) - { - puzzleAnswer = client.getWidget(puzzleNode); - break; - } - } - } - } - - private void startPrayerDrainTimer() - { - if (this.showPrayerDrainTimer) - { - final LoopTimer loopTimer = new LoopTimer( - PRAYER_DRAIN_INTERVAL_MS, - ChronoUnit.MILLIS, - null, - this, - true); - - spriteManager.getSpriteAsync(SpriteID.TAB_PRAYER, 0, loopTimer); - - loopTimer.setPriority(InfoBoxPriority.MED); - loopTimer.setTooltip("Prayer Drain"); - - infoBoxManager.addInfoBox(loopTimer); - barrowsPrayerDrainTimer = loopTimer; - } - } - - private void stopPrayerDrainTimer() - { - infoBoxManager.removeInfoBox(barrowsPrayerDrainTimer); - barrowsPrayerDrainTimer = null; - } - - private boolean isInCrypt() - { - return client.getLocalPlayer().getWorldLocation().getRegionID() == CRYPT_REGION_ID; - } -} 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 deleted file mode 100644 index 48f4298d5f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blackjack/BlackjackConfig.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.", - position = 0 - ) - default boolean pickpocketOnAggro() - { - return false; - } - - @ConfigItem( - keyName = "random", - name = "Randomly Miss 1 Pickpocket", - description = "If enabled, this will randomly miss 1 pickpocket every so often." + - "
Not sure why'd you want to do that, but you can.", - position = 1 - ) - default boolean random() - { - 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 deleted file mode 100644 index f3faea9086..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blackjack/BlackjackPlugin.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) 2018 gazivodag - * Copyright (c) 2019 lucwousin - * Copyright (c) 2019 infinitay - * 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 com.google.inject.Provides; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.MenuEntry; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.util.Text; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.menus.AbstractComparableEntry; -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 org.apache.commons.lang3.ArrayUtils; -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 -) -@Singleton -@Slf4j -public class BlackjackPlugin extends Plugin -{ - private static final int POLLNIVNEACH_REGION = 13358; - - 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 String PICKPOCKET = "Pickpocket"; - private static final String KNOCK_OUT = "Knock-out"; - private static final String BANDIT = "Bandit"; - private static final String MENAPHITE = "Menaphite Thug"; - - private static final AbstractComparableEntry PICKPOCKET_BANDIT = new BJComparableEntry(BANDIT, true); - private static final AbstractComparableEntry KNOCKOUT_BANDIT = new BJComparableEntry(BANDIT, false); - private static final AbstractComparableEntry PICKPOCKET_MENAPHITE = new BJComparableEntry(MENAPHITE, true); - private static final AbstractComparableEntry KNOCKOUT_MENAPHITE = new BJComparableEntry(MENAPHITE, false); - - @Inject - private Client client; - - @Inject - private BlackjackConfig config; - - @Inject - private EventBus eventBus; - - @Inject - private MenuManager menuManager; - - private boolean pickpocketOnAggro; - private boolean random; - private long nextKnockOutTick = 0; - - @Provides - BlackjackConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(BlackjackConfig.class); - } - - @Override - protected void startUp() - { - menuManager.addPriorityEntry(KNOCKOUT_BANDIT); - menuManager.addPriorityEntry(KNOCKOUT_MENAPHITE); - this.pickpocketOnAggro = config.pickpocketOnAggro(); - } - - @Override - protected void shutDown() - { - menuManager.removePriorityEntry(PICKPOCKET_BANDIT); - menuManager.removePriorityEntry(PICKPOCKET_MENAPHITE); - menuManager.removePriorityEntry(KNOCKOUT_BANDIT); - menuManager.removePriorityEntry(KNOCKOUT_MENAPHITE); - eventBus.unregister("poll"); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() != GameState.LOGGED_IN || !ArrayUtils.contains(client.getMapRegions(), POLLNIVNEACH_REGION)) - { - eventBus.unregister("poll"); - return; - } - - eventBus.subscribe(GameTick.class, "poll", this::onGameTick); - eventBus.subscribe(ChatMessage.class, "poll", this::onChatMessage); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("blackjack")) - { - this.pickpocketOnAggro = config.pickpocketOnAggro(); - this.random = config.random(); - } - } - - private void onGameTick(GameTick event) - { - if (client.getTickCount() >= nextKnockOutTick) - { - menuManager.removePriorityEntry(PICKPOCKET_BANDIT); - menuManager.removePriorityEntry(PICKPOCKET_MENAPHITE); - menuManager.addPriorityEntry(KNOCKOUT_BANDIT); - menuManager.addPriorityEntry(KNOCKOUT_MENAPHITE); - } - } - - private void onChatMessage(ChatMessage event) - { - final String msg = event.getMessage(); - - if (event.getType() == ChatMessageType.SPAM && (msg.equals(SUCCESS_BLACKJACK) || (msg.equals(FAILED_BLACKJACK) && this.pickpocketOnAggro))) - { - menuManager.removePriorityEntry(KNOCKOUT_BANDIT); - menuManager.removePriorityEntry(KNOCKOUT_MENAPHITE); - menuManager.addPriorityEntry(PICKPOCKET_BANDIT); - menuManager.addPriorityEntry(PICKPOCKET_MENAPHITE); - final int ticks = this.random ? RandomUtils.nextInt(3, 4) : 4; - nextKnockOutTick = client.getTickCount() + ticks; - } - } - - private static class BJComparableEntry extends AbstractComparableEntry - { - private BJComparableEntry(final String npc, final boolean pickpocket) - { - if (!BANDIT.equals(npc) && !MENAPHITE.equals(npc)) - { - throw new IllegalArgumentException("Only bandits or menaphites are valid"); - } - - this.setTarget(npc.toLowerCase()); - this.setOption(pickpocket ? PICKPOCKET : KNOCK_OUT); - this.setPriority(100); - } - - @Override - public boolean matches(MenuEntry entry) - { - return entry.getOption().equalsIgnoreCase(this.getOption()) && - Text.removeTags(entry.getTarget(), true).equalsIgnoreCase(this.getTarget()); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BarsOres.java b/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BarsOres.java deleted file mode 100644 index d7b522e8a9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BarsOres.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.blastfurnace; - -import com.google.common.collect.ImmutableMap; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ItemID; -import net.runelite.api.Varbits; - -public enum BarsOres -{ - COPPER_ORE(Varbits.BLAST_FURNACE_COPPER_ORE, ItemID.COPPER_ORE), - TIN_ORE(Varbits.BLAST_FURNACE_TIN_ORE, ItemID.TIN_ORE), - IRON_ORE(Varbits.BLAST_FURNACE_IRON_ORE, ItemID.IRON_ORE), - COAL(Varbits.BLAST_FURNACE_COAL, ItemID.COAL), - MITHRIL_ORE(Varbits.BLAST_FURNACE_MITHRIL_ORE, ItemID.MITHRIL_ORE), - ADAMANTITE_ORE(Varbits.BLAST_FURNACE_ADAMANTITE_ORE, ItemID.ADAMANTITE_ORE), - RUNITE_ORE(Varbits.BLAST_FURNACE_RUNITE_ORE, ItemID.RUNITE_ORE), - SILVER_ORE(Varbits.BLAST_FURNACE_SILVER_ORE, ItemID.SILVER_ORE), - GOLD_ORE(Varbits.BLAST_FURNACE_GOLD_ORE, ItemID.GOLD_ORE), - BRONZE_BAR(Varbits.BLAST_FURNACE_BRONZE_BAR, ItemID.BRONZE_BAR), - IRON_BAR(Varbits.BLAST_FURNACE_IRON_BAR, ItemID.IRON_BAR), - STEEL_BAR(Varbits.BLAST_FURNACE_STEEL_BAR, ItemID.STEEL_BAR), - MITHRIL_BAR(Varbits.BLAST_FURNACE_MITHRIL_BAR, ItemID.MITHRIL_BAR), - ADAMANTITE_BAR(Varbits.BLAST_FURNACE_ADAMANTITE_BAR, ItemID.ADAMANTITE_BAR), - RUNITE_BAR(Varbits.BLAST_FURNACE_RUNITE_BAR, ItemID.RUNITE_BAR), - SILVER_BAR(Varbits.BLAST_FURNACE_SILVER_BAR, ItemID.SILVER_BAR), - GOLD_BAR(Varbits.BLAST_FURNACE_GOLD_BAR, ItemID.GOLD_BAR); - - private static final Map VARBIT; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (BarsOres s : values()) - { - builder.put(s.getVarbit(), s); - } - - VARBIT = builder.build(); - } - - @Getter(AccessLevel.PACKAGE) - private final Varbits varbit; - @Getter(AccessLevel.PACKAGE) - private final int itemID; - - BarsOres(Varbits varbit, int itemID) - { - this.varbit = varbit; - this.itemID = itemID; - } - - public static BarsOres getVarbit(Varbits varbit) - { - return VARBIT.get(varbit); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceClickBoxOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceClickBoxOverlay.java deleted file mode 100644 index 7d2dce821d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceClickBoxOverlay.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.blastfurnace; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Shape; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.EquipmentInventorySlot; -import net.runelite.api.GameObject; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemID; -import net.runelite.api.Point; -import net.runelite.api.Varbits; -import net.runelite.api.coords.LocalPoint; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; - -@Singleton -class BlastFurnaceClickBoxOverlay extends Overlay -{ - private static final int MAX_DISTANCE = 2350; - - private final Client client; - private final BlastFurnacePlugin plugin; - - @Inject - private BlastFurnaceClickBoxOverlay(final Client client, final BlastFurnacePlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - int dispenserState = client.getVar(Varbits.BAR_DISPENSER); - - if (plugin.isShowConveyorBelt() && plugin.getConveyorBelt() != null) - { - Color color = dispenserState == 1 ? Color.RED : Color.GREEN; - renderObject(plugin.getConveyorBelt(), graphics, color); - } - - if (plugin.isShowBarDispenser() && plugin.getBarDispenser() != null) - { - boolean hasIceGloves = hasIceGloves(); - Color color = dispenserState == 2 && hasIceGloves ? Color.GREEN : (dispenserState == 3 ? Color.GREEN : Color.RED); - - renderObject(plugin.getBarDispenser(), graphics, color); - } - - return null; - } - - private boolean hasIceGloves() - { - ItemContainer equipmentContainer = client.getItemContainer(InventoryID.EQUIPMENT); - if (equipmentContainer == null) - { - return false; - } - - Item[] items = equipmentContainer.getItems(); - int idx = EquipmentInventorySlot.GLOVES.getSlotIdx(); - - if (items == null || idx >= items.length) - { - return false; - } - - Item glove = items[idx]; - return glove != null && glove.getId() == ItemID.ICE_GLOVES; - } - - private void renderObject(GameObject object, Graphics2D graphics, Color color) - { - LocalPoint localLocation = client.getLocalPlayer().getLocalLocation(); - Point mousePosition = client.getMouseCanvasPosition(); - - LocalPoint location = object.getLocalLocation(); - - if (localLocation.distanceTo(location) <= MAX_DISTANCE) - { - Shape objectClickbox = object.getClickbox(); - if (objectClickbox != null) - { - if (objectClickbox.contains(mousePosition.getX(), mousePosition.getY())) - { - graphics.setColor(color.darker()); - } - else - { - graphics.setColor(color); - } - graphics.draw(objectClickbox); - graphics.setColor(new Color(0xFF, 0, 0, 20)); - graphics.fill(objectClickbox); - } - } - } -} 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 deleted file mode 100644 index 7714c9f2c0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceCofferOverlay.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.blastfurnace; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import static net.runelite.api.Varbits.BLAST_FURNACE_COFFER; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -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.table.TableAlignment; -import net.runelite.client.ui.overlay.components.table.TableComponent; -import net.runelite.client.util.QuantityFormatter; - -@Singleton -class BlastFurnaceCofferOverlay extends Overlay -{ - private final Client client; - private final BlastFurnacePlugin plugin; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - private BlastFurnaceCofferOverlay(final Client client, final BlastFurnacePlugin plugin) - { - super(plugin); - setPosition(OverlayPosition.TOP_LEFT); - this.client = client; - this.plugin = plugin; - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Coffer overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - 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(); - - if (sack != null) - { - sack.setHidden(true); - - tableComponent.addRow("Coffer:", QuantityFormatter.quantityToStackSize(client.getVar(BLAST_FURNACE_COFFER)) + " gp"); - } - - if (!tableComponent.isEmpty()) - { - 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/blastfurnace/BlastFurnaceConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceConfig.java deleted file mode 100644 index 8f55d44258..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceConfig.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.blastfurnace; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("blastfurnace") -public interface BlastFurnaceConfig extends Config -{ - @ConfigItem( - keyName = "showConveyorBelt", - name = "Show conveyor belt clickbox", - description = "Configures whether or not the clickbox for the conveyor belt is displayed", - position = 1 - ) - default boolean showConveyorBelt() - { - return false; - } - - @ConfigItem( - keyName = "showBarDispenser", - name = "Show bar dispenser clickbox", - description = "Configures whether or not the clickbox for the bar dispenser is displayed", - position = 2 - ) - default boolean showBarDispenser() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceOverlay.java deleted file mode 100644 index d1fad4b216..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceOverlay.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.blastfurnace; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.client.game.ItemManager; -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.ComponentOrientation; -import net.runelite.client.ui.overlay.components.ImageComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; - -@Singleton -class BlastFurnaceOverlay extends Overlay -{ - private final Client client; - private final BlastFurnacePlugin plugin; - private final PanelComponent imagePanelComponent = new PanelComponent(); - - @Inject - private ItemManager itemManager; - - @Inject - BlastFurnaceOverlay(final Client client, final BlastFurnacePlugin plugin) - { - super(plugin); - this.plugin = plugin; - this.client = client; - setPosition(OverlayPosition.TOP_LEFT); - imagePanelComponent.setOrientation(ComponentOrientation.HORIZONTAL); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Blast furnace overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.getConveyorBelt() == null) - { - return null; - } - - imagePanelComponent.getChildren().clear(); - - for (BarsOres varbit : BarsOres.values()) - { - int amount = client.getVar(varbit.getVarbit()); - - if (amount == 0) - { - continue; - } - - imagePanelComponent.getChildren().add(new ImageComponent(getImage(varbit.getItemID(), amount))); - } - - return imagePanelComponent.render(graphics); - } - - private BufferedImage getImage(int itemID, int amount) - { - return itemManager.getImage(itemID, amount, true); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnacePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnacePlugin.java deleted file mode 100644 index 7821ad9e0d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnacePlugin.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * Copyright (c) 2019, Brandon White - * 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.blastfurnace; - -import com.google.inject.Provides; -import java.time.Duration; -import java.time.Instant; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.GameState; -import static net.runelite.api.NullObjectID.NULL_9092; -import static net.runelite.api.ObjectID.CONVEYOR_BELT; -import net.runelite.api.Skill; -import net.runelite.api.events.GameObjectDespawned; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -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.ui.overlay.infobox.InfoBoxManager; - -@PluginDescriptor( - name = "Blast Furnace", - description = "Show helpful information for the Blast Furnace minigame", - tags = {"minigame", "overlay", "skilling", "smithing"}, - type = PluginType.MINIGAME -) -@Singleton -public class BlastFurnacePlugin extends Plugin -{ - private static final int BAR_DISPENSER = NULL_9092; - private static final String FOREMAN_PERMISSION_TEXT = "Okay, you can use the furnace for ten minutes. Remember, you only need half as much coal as with a regular furnace."; - - @Getter(AccessLevel.PACKAGE) - private GameObject conveyorBelt; - - @Getter(AccessLevel.PACKAGE) - private GameObject barDispenser; - - private ForemanTimer foremanTimer; - - @Inject - private OverlayManager overlayManager; - - @Inject - private BlastFurnaceOverlay overlay; - - @Inject - private BlastFurnaceCofferOverlay cofferOverlay; - - @Inject - private BlastFurnaceClickBoxOverlay clickBoxOverlay; - - @Inject - private Client client; - - @Inject - private ItemManager itemManager; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private BlastFurnaceConfig config; - - @Getter(AccessLevel.PACKAGE) - private boolean showConveyorBelt; - @Getter(AccessLevel.PACKAGE) - private boolean showBarDispenser; - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - overlayManager.add(cofferOverlay); - overlayManager.add(clickBoxOverlay); - } - - @Override - protected void shutDown() - { - infoBoxManager.removeIf(ForemanTimer.class::isInstance); - overlayManager.remove(overlay); - overlayManager.remove(cofferOverlay); - overlayManager.remove(clickBoxOverlay); - conveyorBelt = null; - barDispenser = null; - foremanTimer = null; - } - - @Provides - BlastFurnaceConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(BlastFurnaceConfig.class); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("blastfurnace")) - { - updateConfig(); - } - } - - @Subscribe - private void onGameObjectSpawned(GameObjectSpawned event) - { - GameObject gameObject = event.getGameObject(); - - switch (gameObject.getId()) - { - case CONVEYOR_BELT: - conveyorBelt = gameObject; - break; - - case BAR_DISPENSER: - barDispenser = gameObject; - break; - } - } - - @Subscribe - private void onGameObjectDespawned(GameObjectDespawned event) - { - GameObject gameObject = event.getGameObject(); - - switch (gameObject.getId()) - { - case CONVEYOR_BELT: - conveyorBelt = null; - break; - - case BAR_DISPENSER: - barDispenser = null; - break; - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOADING) - { - conveyorBelt = null; - barDispenser = null; - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - Widget npcDialog = client.getWidget(WidgetInfo.DIALOG_NPC_TEXT); - if (npcDialog == null) - { - return; - } - - // blocking dialog check until 5 minutes needed to avoid re-adding while dialog message still displayed - boolean shouldCheckForemanFee = client.getRealSkillLevel(Skill.SMITHING) < 60 - && (foremanTimer == null || Duration.between(Instant.now(), foremanTimer.getEndTime()).toMinutes() <= 5); - - if (shouldCheckForemanFee) - { - String npcText = Text.sanitizeMultilineText(npcDialog.getText()); - - if (npcText.equals(FOREMAN_PERMISSION_TEXT)) - { - infoBoxManager.removeIf(ForemanTimer.class::isInstance); - - foremanTimer = new ForemanTimer(this, itemManager); - infoBoxManager.addInfoBox(foremanTimer); - } - } - } - - private void updateConfig() - { - this.showBarDispenser = config.showBarDispenser(); - this.showConveyorBelt = config.showConveyorBelt(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/ForemanTimer.java b/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/ForemanTimer.java deleted file mode 100644 index 0a246b690c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/ForemanTimer.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2019, Brandon White - * 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.blastfurnace; - -import java.time.temporal.ChronoUnit; -import net.runelite.api.ItemID; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.overlay.infobox.Timer; - -class ForemanTimer extends Timer -{ - private static final String TOOLTIP_TEXT = "Foreman Fee"; - - ForemanTimer(BlastFurnacePlugin plugin, ItemManager itemManager) - { - super(10, ChronoUnit.MINUTES, itemManager.getImage(ItemID.COAL_BAG), plugin); - - setTooltip(TOOLTIP_TEXT); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMineOreCountOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMineOreCountOverlay.java deleted file mode 100644 index 714925ae3d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMineOreCountOverlay.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2018, Unmoon - * 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.blastmine; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.ItemID; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.Varbits; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.game.ItemManager; -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.ComponentOrientation; -import net.runelite.client.ui.overlay.components.ImageComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; - -@Singleton -class BlastMineOreCountOverlay extends Overlay -{ - private final Client client; - private final BlastMinePlugin plugin; - private final ItemManager itemManager; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - private BlastMineOreCountOverlay(final BlastMinePlugin plugin, final Client client, final ItemManager itemManager) - { - super(plugin); - setPosition(OverlayPosition.TOP_LEFT); - this.client = client; - this.plugin = plugin; - this.itemManager = itemManager; - panelComponent.setOrientation(ComponentOrientation.HORIZONTAL); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Blast mine overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - final Widget blastMineWidget = client.getWidget(WidgetInfo.BLAST_MINE); - - if (blastMineWidget == null) - { - return null; - } - - panelComponent.getChildren().clear(); - - if (plugin.isShowOreOverlay()) - { - blastMineWidget.setHidden(true); - panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.COAL, client.getVar(Varbits.BLAST_MINE_COAL)))); - panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.GOLD_ORE, client.getVar(Varbits.BLAST_MINE_GOLD)))); - panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.MITHRIL_ORE, client.getVar(Varbits.BLAST_MINE_MITHRIL)))); - panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.ADAMANTITE_ORE, client.getVar(Varbits.BLAST_MINE_ADAMANTITE)))); - panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.RUNITE_ORE, client.getVar(Varbits.BLAST_MINE_RUNITE)))); - } - else - { - blastMineWidget.setHidden(false); - } - - return panelComponent.render(graphics); - } - - private BufferedImage getImage(int itemID, int amount) - { - return itemManager.getImage(itemID, amount, true); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMinePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMinePlugin.java deleted file mode 100644 index 517c51b06d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMinePlugin.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2018, Unmoon - * 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.blastmine; - -import com.google.inject.Provides; -import java.awt.Color; -import java.util.HashMap; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.GameState; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -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; - -@PluginDescriptor( - name = "Blast Mine", - description = "Show helpful information for the Blast Mine minigame", - tags = {"explode", "explosive", "mining", "minigame", "skilling"}, - type = PluginType.MINIGAME -) -@Singleton -public class BlastMinePlugin extends Plugin -{ - @Getter(AccessLevel.PACKAGE) - private final Map rocks = new HashMap<>(); - - @Inject - private OverlayManager overlayManager; - - @Inject - private Client client; - - @Inject - private BlastMineRockOverlay blastMineRockOverlay; - - @Inject - private BlastMineOreCountOverlay blastMineOreCountOverlay; - - @Inject - private BlastMinePluginConfig config; - - @Getter(AccessLevel.PACKAGE) - private boolean showOreOverlay; - @Getter(AccessLevel.PACKAGE) - private boolean showRockIconOverlay; - @Getter(AccessLevel.PACKAGE) - private boolean showTimerOverlay; - @Getter(AccessLevel.PACKAGE) - private boolean showWarningOverlay; - @Getter(AccessLevel.PACKAGE) - private Color timerColor; - @Getter(AccessLevel.PACKAGE) - private Color warningColor; - - @Provides - BlastMinePluginConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(BlastMinePluginConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(blastMineRockOverlay); - overlayManager.add(blastMineOreCountOverlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(blastMineRockOverlay); - overlayManager.remove(blastMineOreCountOverlay); - final Widget blastMineWidget = client.getWidget(WidgetInfo.BLAST_MINE); - - if (blastMineWidget != null) - { - blastMineWidget.setHidden(false); - } - } - - @Subscribe - private void onGameObjectSpawned(GameObjectSpawned event) - { - final GameObject gameObject = event.getGameObject(); - BlastMineRockType blastMineRockType = BlastMineRockType.getRockType(gameObject.getId()); - if (blastMineRockType == null) - { - return; - } - - final BlastMineRock newRock = new BlastMineRock(gameObject, blastMineRockType); - final BlastMineRock oldRock = rocks.get(gameObject.getWorldLocation()); - - if (oldRock == null || oldRock.getType() != newRock.getType()) - { - rocks.put(gameObject.getWorldLocation(), newRock); - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOADING) - { - rocks.clear(); - } - } - - @Subscribe - private void onGameTick(GameTick gameTick) - { - if (rocks.isEmpty()) - { - return; - } - - rocks.values().removeIf(rock -> - (rock.getRemainingTimeRelative() == 1 && rock.getType() != BlastMineRockType.NORMAL) || - (rock.getRemainingFuseTimeRelative() == 1 && rock.getType() == BlastMineRockType.LIT)); - } - - private void updateConfig() - { - this.showOreOverlay = config.showOreOverlay(); - this.showRockIconOverlay = config.showRockIconOverlay(); - this.showTimerOverlay = config.showTimerOverlay(); - this.showWarningOverlay = config.showWarningOverlay(); - this.timerColor = config.getTimerColor(); - this.warningColor = config.getWarningColor(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMinePluginConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMinePluginConfig.java deleted file mode 100644 index 6368364949..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMinePluginConfig.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2018, Unmoon - * 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.blastmine; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("blastmine") -public interface BlastMinePluginConfig extends Config -{ - @ConfigItem( - position = 0, - keyName = "showOreOverlay", - name = "Show ore overlay", - description = "Configures whether or not the ore count overlay is displayed" - ) - default boolean showOreOverlay() - { - return true; - } - - @ConfigItem( - position = 1, - keyName = "showRockIconOverlay", - name = "Show icons overlay", - description = "Configures whether or not the icon overlay is displayed" - ) - default boolean showRockIconOverlay() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "showTimerOverlay", - name = "Show timer overlay", - description = "Configures whether or not the timer overlay is displayed" - ) - default boolean showTimerOverlay() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "showWarningOverlay", - name = "Show explosion warning", - description = "Configures whether or not the explosion warning overlay is displayed" - ) - default boolean showWarningOverlay() - { - return true; - } - - @ConfigItem( - position = 4, - keyName = "hexTimerColor", - name = "Timer color", - description = "Color of timer overlay" - ) - default Color getTimerColor() - { - return new Color(217, 54, 0); - } - - @ConfigItem( - position = 5, - keyName = "hexWarningColor", - name = "Warning color", - description = "Color of warning overlay" - ) - default Color getWarningColor() - { - return new Color(217, 54, 0); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMineRock.java b/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMineRock.java deleted file mode 100644 index 441d836f3b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMineRock.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2018, Unmoon - * 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.blastmine; - -import java.time.Duration; -import java.time.Instant; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.GameObject; - -class BlastMineRock -{ - private static final Duration PLANT_TIME = Duration.ofSeconds(30); - private static final Duration FUSE_TIME = Duration.ofMillis(4200); - - @Getter(AccessLevel.PACKAGE) - private final GameObject gameObject; - - @Getter(AccessLevel.PACKAGE) - private final BlastMineRockType type; - - private final Instant creationTime = Instant.now(); - - BlastMineRock(final GameObject gameObject, BlastMineRockType blastMineRockType) - { - this.gameObject = gameObject; - this.type = blastMineRockType; - } - - double getRemainingFuseTimeRelative() - { - Duration duration = Duration.between(creationTime, Instant.now()); - return duration.compareTo(FUSE_TIME) < 0 ? (double) duration.toMillis() / FUSE_TIME.toMillis() : 1; - } - - double getRemainingTimeRelative() - { - Duration duration = Duration.between(creationTime, Instant.now()); - return duration.compareTo(PLANT_TIME) < 0 ? (double) duration.toMillis() / PLANT_TIME.toMillis() : 1; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMineRockOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMineRockOverlay.java deleted file mode 100644 index 5199a9bd4f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMineRockOverlay.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) 2018, Unmoon - * 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.blastmine; - -import com.google.common.collect.ImmutableSet; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.image.BufferedImage; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.ItemID; -import net.runelite.api.NullObjectID; -import net.runelite.api.ObjectID; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.Tile; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.widgets.Widget; -import net.runelite.client.game.ItemManager; -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.components.ProgressPieComponent; - -@Singleton -public class BlastMineRockOverlay extends Overlay -{ - private static final int MAX_DISTANCE = 16; - private static final int WARNING_DISTANCE = 2; - private static final ImmutableSet WALL_OBJECTS = ImmutableSet.of( - NullObjectID.NULL_28570, NullObjectID.NULL_28571, NullObjectID.NULL_28572, NullObjectID.NULL_28573, NullObjectID.NULL_28574, - NullObjectID.NULL_28575, NullObjectID.NULL_28576, NullObjectID.NULL_28577, NullObjectID.NULL_28578, - ObjectID.HARD_ROCK, ObjectID.HARD_ROCK_28580, ObjectID.CAVITY, ObjectID.CAVITY_28582, - ObjectID.POT_OF_DYNAMITE, ObjectID.POT_OF_DYNAMITE_28584, ObjectID.POT_OF_DYNAMITE_28585, ObjectID.POT_OF_DYNAMITE_28586, - ObjectID.SHATTERED_ROCKFACE, ObjectID.SHATTERED_ROCKFACE_28588); - - private final Client client; - private final BlastMinePlugin plugin; - - private final BufferedImage chiselIcon; - private final BufferedImage dynamiteIcon; - private final BufferedImage tinderboxIcon; - - @Inject - private BlastMineRockOverlay(final Client client, final BlastMinePlugin plugin, final ItemManager itemManager) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.client = client; - this.plugin = plugin; - chiselIcon = itemManager.getImage(ItemID.CHISEL); - dynamiteIcon = itemManager.getImage(ItemID.DYNAMITE); - tinderboxIcon = itemManager.getImage(ItemID.TINDERBOX); - } - - @Override - public Dimension render(Graphics2D graphics) - { - Map rocks = plugin.getRocks(); - if (rocks.isEmpty()) - { - return null; - } - - final Tile[][][] tiles = client.getScene().getTiles(); - final Widget viewport = client.getViewportWidget(); - - for (final BlastMineRock rock : rocks.values()) - { - if (viewport == null || - rock.getGameObject().getCanvasLocation() == null || - rock.getGameObject().getWorldLocation().distanceTo(client.getLocalPlayer().getWorldLocation()) > MAX_DISTANCE) - { - continue; - } - - switch (rock.getType()) - { - case NORMAL: - drawIconOnRock(graphics, rock, chiselIcon); - break; - case CHISELED: - drawIconOnRock(graphics, rock, dynamiteIcon); - break; - case LOADED: - drawIconOnRock(graphics, rock, tinderboxIcon); - break; - case LIT: - drawTimerOnRock(graphics, rock, plugin.getTimerColor()); - drawAreaWarning(graphics, rock, plugin.getWarningColor(), tiles); - break; - } - } - - return null; - } - - private void drawIconOnRock(Graphics2D graphics, BlastMineRock rock, BufferedImage icon) - { - if (!plugin.isShowRockIconOverlay()) - { - return; - } - - Point loc = Perspective.getCanvasImageLocation(client, rock.getGameObject().getLocalLocation(), icon, 150); - - if (loc != null) - { - graphics.drawImage(icon, loc.getX(), loc.getY(), null); - } - } - - private void drawTimerOnRock(Graphics2D graphics, BlastMineRock rock, Color color) - { - if (!plugin.isShowTimerOverlay()) - { - return; - } - - Point loc = Perspective.localToCanvas(client, rock.getGameObject().getLocalLocation(), rock.getGameObject().getPlane(), 150); - - if (loc != null) - { - final double timeLeft = 1 - rock.getRemainingFuseTimeRelative(); - final ProgressPieComponent pie = new ProgressPieComponent(); - pie.setFill(color); - pie.setBorderColor(color); - pie.setPosition(loc); - pie.setProgress(timeLeft); - pie.render(graphics); - } - } - - private void drawAreaWarning(Graphics2D graphics, BlastMineRock rock, Color color, Tile[][][] tiles) - { - if (!plugin.isShowWarningOverlay()) - { - return; - } - - final int z = client.getPlane(); - int x = rock.getGameObject().getLocalLocation().getX() / Perspective.LOCAL_TILE_SIZE; - int y = rock.getGameObject().getLocalLocation().getY() / Perspective.LOCAL_TILE_SIZE; - final int orientation = tiles[z][x][y].getWallObject().getOrientationA(); - - switch (orientation) //calculate explosion around the tile in front of the wall - { - case 1: - x--; - break; - case 4: - x++; - break; - case 8: - y--; - break; - default: - y++; - } - - for (int i = -WARNING_DISTANCE; i <= WARNING_DISTANCE; i++) - { - for (int j = -WARNING_DISTANCE; j <= WARNING_DISTANCE; j++) - { - final GameObject gameObject = tiles[z][x + i][y + j].getGameObjects()[0]; - - //check if tile is empty, or is a wall... - if (gameObject == null || !WALL_OBJECTS.contains(gameObject.getId())) - { - final LocalPoint localTile = new LocalPoint( - (x + i) * Perspective.LOCAL_TILE_SIZE + Perspective.LOCAL_TILE_SIZE / 2, - (y + j) * Perspective.LOCAL_TILE_SIZE + Perspective.LOCAL_TILE_SIZE / 2); - final Polygon poly = Perspective.getCanvasTilePoly(client, localTile); - - if (poly != null) - { - graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 100)); - graphics.fillPolygon(poly); - } - } - } - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMineRockType.java b/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMineRockType.java deleted file mode 100644 index 0960fcfb5d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blastmine/BlastMineRockType.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2018, Unmoon - * 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.blastmine; - -import com.google.common.collect.ImmutableMap; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ObjectID; - -public enum BlastMineRockType -{ - NORMAL(ObjectID.HARD_ROCK, ObjectID.HARD_ROCK_28580), - CHISELED(ObjectID.CAVITY, ObjectID.CAVITY_28582), - LOADED(ObjectID.POT_OF_DYNAMITE, ObjectID.POT_OF_DYNAMITE_28584), - LIT(ObjectID.POT_OF_DYNAMITE_28585, ObjectID.POT_OF_DYNAMITE_28586), - EXPLODED(ObjectID.SHATTERED_ROCKFACE, ObjectID.SHATTERED_ROCKFACE_28588); - - private static final Map rockTypes; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (BlastMineRockType type : values()) - { - for (int spotId : type.getObjectIds()) - { - builder.put(spotId, type); - } - } - - rockTypes = builder.build(); - } - - @Getter(AccessLevel.PACKAGE) - private final int[] objectIds; - - BlastMineRockType(int... objectIds) - { - this.objectIds = objectIds; - } - - public static BlastMineRockType getRockType(int objectId) - { - return rockTypes.get(objectId); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostIndicator.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostIndicator.java deleted file mode 100644 index 50a1db0b8a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostIndicator.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2018 Kamiel - * 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.boosts; - -import java.awt.Color; -import java.awt.image.BufferedImage; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.Skill; -import net.runelite.client.ui.overlay.infobox.InfoBox; -import net.runelite.client.ui.overlay.infobox.InfoBoxPriority; - -public class BoostIndicator extends InfoBox -{ - private final BoostsPlugin plugin; - private final Client client; - - @Getter(AccessLevel.PACKAGE) - private final Skill skill; - - BoostIndicator(final Skill skill, final BufferedImage image, final BoostsPlugin plugin, final Client client) - { - super(image, plugin); - this.plugin = plugin; - this.client = client; - this.skill = skill; - setTooltip(skill.getName() + " boost"); - setPriority(InfoBoxPriority.HIGH); - } - - @Override - public String getText() - { - if (!plugin.isUseRelativeBoost()) - { - return String.valueOf(client.getBoostedSkillLevel(skill)); - } - - int boost = client.getBoostedSkillLevel(skill) - client.getRealSkillLevel(skill); - String text = String.valueOf(boost); - if (boost > 0) - { - text = "+" + text; - } - - return text; - } - - @Override - public Color getTextColor() - { - int boosted = client.getBoostedSkillLevel(skill), - base = client.getRealSkillLevel(skill); - - if (boosted < base) - { - return new Color(238, 51, 51); - } - - return boosted - base <= plugin.getBoostThreshold() ? Color.YELLOW : Color.GREEN; - } - - @Override - public boolean render() - { - if (plugin.isDisplayInfoboxes() && plugin.canShowBoosts() && plugin.getShownSkills().contains(getSkill())) - { - return client.getBoostedSkillLevel(skill) != client.getRealSkillLevel(skill); - } - - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsConfig.java deleted file mode 100644 index 1cd517308a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsConfig.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.boosts; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("boosts") -public interface BoostsConfig extends Config -{ - enum DisplayChangeMode - { - ALWAYS, - BOOSTED, - NEVER - } - - enum DisplayBoosts - { - NONE, - COMBAT, - NON_COMBAT, - BOTH - } - - @ConfigItem( - keyName = "displayBoosts", - name = "Display Boosts", - description = "Configures which skill boosts to display", - position = 1 - ) - default DisplayBoosts displayBoosts() - { - return DisplayBoosts.BOTH; - } - - @ConfigItem( - keyName = "relativeBoost", - name = "Use Relative Boosts", - description = "Configures whether or not relative boost is used", - position = 2 - ) - default boolean useRelativeBoost() - { - return false; - } - - @ConfigItem( - keyName = "displayIndicators", - name = "Display as infoboxes", - description = "Configures whether or not to display the boost as infoboxes", - position = 3 - ) - default boolean displayInfoboxes() - { - return false; - } - - @ConfigItem( - keyName = "displayIconPanel", - name = "Icons", - description = "Show boosts next to icons (transparent background)", - position = 4 - ) - default boolean displayIcons() - { - return false; - } - - @ConfigItem( - keyName = "boldIconFont", - name = "Bold Font for Icons", - description = "", - position = 5 - ) - default boolean boldIconFont() - { - return false; - } - - @ConfigItem( - keyName = "displayNextBuffChange", - name = "Display next buff change", - description = "Configures whether or not to display when the next buffed stat change will be", - position = 6 - ) - default DisplayChangeMode displayNextBuffChange() - { - return DisplayChangeMode.BOOSTED; - } - - @ConfigItem( - keyName = "displayNextDebuffChange", - name = "Display next debuff change", - description = "Configures whether or not to display when the next debuffed stat change will be", - position = 7 - ) - default DisplayChangeMode displayNextDebuffChange() - { - return DisplayChangeMode.NEVER; - } - - @ConfigItem( - keyName = "boostThreshold", - name = "Boost Amount Threshold", - description = "The amount of levels boosted to send a notification at. A value of 0 will disable notification.", - position = 8 - ) - default int boostThreshold() - { - return 0; - } - - @ConfigItem( - keyName = "groupNotifications", - name = "Group Notifications", - description = "Configures whether or not to group notifications for multiple skills into a single notification", - position = 9 - ) - default boolean groupNotifications() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsOverlay.java deleted file mode 100644 index 4dd412cf8a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsOverlay.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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.boosts; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.Skill; -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; -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; -import net.runelite.client.util.ColorUtil; - -@Singleton -class BoostsOverlay extends Overlay -{ - private final Client client; - private final PanelComponent panelComponent = new PanelComponent(); - private final BoostsPlugin plugin; - - @Inject - private BoostsOverlay(final Client client, final BoostsPlugin plugin) - { - super(plugin); - this.plugin = plugin; - this.client = client; - setPosition(OverlayPosition.TOP_LEFT); - setPriority(OverlayPriority.MED); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Boosts overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.isDisplayInfoboxes() || plugin.isDisplayIcons()) - { - return null; - } - - panelComponent.getChildren().clear(); - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - int nextChange = plugin.getChangeDownTicks(); - - if (nextChange != -1) - { - tableComponent.addRow("Next + restore:", String.valueOf(plugin.getChangeTime(nextChange))); - } - - nextChange = plugin.getChangeUpTicks(); - - if (nextChange != -1) - { - tableComponent.addRow("Next - restore:", String.valueOf(plugin.getChangeTime(nextChange))); - } - - if (plugin.canShowBoosts()) - { - for (Skill skill : plugin.getShownSkills()) - { - final int boosted = client.getBoostedSkillLevel(skill); - final int base = client.getRealSkillLevel(skill); - - if (boosted == base) - { - continue; - } - - final int boost = boosted - base; - final Color strColor = getTextColor(boost); - String str; - - if (plugin.isUseRelativeBoost()) - { - str = String.valueOf(boost); - if (boost > 0) - { - str = "+" + str; - } - } - else - { - str = ColorUtil.prependColorTag(Integer.toString(boosted), strColor) - + ColorUtil.prependColorTag("/" + base, Color.WHITE); - } - - tableComponent.addRow(skill.getName() + ":", str); - } - } - - panelComponent.getChildren().add(tableComponent); - - return panelComponent.render(graphics); - } - - private Color getTextColor(int boost) - { - if (boost < 0) - { - return new Color(238, 51, 51); - } - - return boost <= plugin.getBoostThreshold() ? Color.YELLOW : Color.GREEN; - - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsPlugin.java deleted file mode 100644 index 0c6241252b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/BoostsPlugin.java +++ /dev/null @@ -1,464 +0,0 @@ -/* - * Copyright (c) 2016-2017, 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.boosts; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Provides; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.Constants; -import net.runelite.api.Prayer; -import net.runelite.api.Skill; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.StatChanged; -import net.runelite.client.Notifier; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.SkillIconManager; -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.ui.overlay.infobox.InfoBoxManager; -import net.runelite.client.util.ImageUtil; - -@PluginDescriptor( - name = "Boosts Information", - description = "Show combat and/or skill boost information", - tags = {"combat", "notifications", "skilling", "overlay"}, - type = PluginType.UTILITY -) -@Singleton -public class BoostsPlugin extends Plugin -{ - private static final Set BOOSTABLE_COMBAT_SKILLS = ImmutableSet.of( - Skill.ATTACK, - Skill.STRENGTH, - Skill.DEFENCE, - Skill.RANGED, - Skill.MAGIC); - - private static final Set BOOSTABLE_NON_COMBAT_SKILLS = ImmutableSet.of( - Skill.MINING, Skill.AGILITY, Skill.SMITHING, Skill.HERBLORE, Skill.FISHING, Skill.THIEVING, - Skill.COOKING, Skill.CRAFTING, Skill.FIREMAKING, Skill.FLETCHING, Skill.WOODCUTTING, Skill.RUNECRAFT, - Skill.SLAYER, Skill.FARMING, Skill.CONSTRUCTION, Skill.HUNTER); - - @Getter - private final Set shownSkills = new LinkedHashSet<>(); - private final int[] lastSkillLevels = new int[Skill.values().length - 1]; - private final List boostedSkillsChanged = new ArrayList<>(); - - @Inject - private Notifier notifier; - - @Inject - private Client client; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private OverlayManager overlayManager; - - @Inject - private BoostsOverlay boostsOverlay; - - @Inject - private BoostsConfig config; - - @Inject - private SkillIconManager skillIconManager; - - @Inject - private CombatIconsOverlay combatIconsOverlay; - - private boolean isChangedDown = false; - private boolean isChangedUp = false; - private int lastChangeDown = -1; - private int lastChangeUp = -1; - private boolean preserveBeenActive = false; - private long lastTickMillis; - private BoostsConfig.DisplayBoosts displayBoosts; - @Getter(AccessLevel.PACKAGE) - private boolean useRelativeBoost; - @Getter(AccessLevel.PACKAGE) - private boolean displayInfoboxes; - @Getter(AccessLevel.PACKAGE) - private boolean displayIcons; - @Getter(AccessLevel.PACKAGE) - private boolean boldIconFont; - private BoostsConfig.DisplayChangeMode displayNextBuffChange; - private BoostsConfig.DisplayChangeMode displayNextDebuffChange; - @Getter(AccessLevel.PACKAGE) - private int boostThreshold; - private boolean groupNotifications; - - @Provides - BoostsConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(BoostsConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(boostsOverlay); - overlayManager.add(combatIconsOverlay); - updateShownSkills(); - updateBoostedStats(); - Arrays.fill(lastSkillLevels, -1); - - // Add infoboxes for everything at startup and then determine inside if it will be rendered - infoBoxManager.addInfoBox(new StatChangeIndicator(true, ImageUtil.getResourceStreamFromClass(getClass(), "debuffed.png"), this, config)); - infoBoxManager.addInfoBox(new StatChangeIndicator(false, ImageUtil.getResourceStreamFromClass(getClass(), "buffed.png"), this, config)); - - for (final Skill skill : Skill.values()) - { - if (skill != Skill.OVERALL) - { - infoBoxManager.addInfoBox(new BoostIndicator(skill, skillIconManager.getSkillImage(skill), this, client)); - } - } - } - - @Override - protected void shutDown() - { - overlayManager.remove(boostsOverlay); - overlayManager.remove(combatIconsOverlay); - infoBoxManager.removeIf(t -> t instanceof BoostIndicator || t instanceof StatChangeIndicator); - preserveBeenActive = false; - lastChangeDown = -1; - lastChangeUp = -1; - isChangedUp = false; - isChangedDown = false; - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - switch (event.getGameState()) - { - case LOGIN_SCREEN: - case HOPPING: - // After world hop and log out timers are in undefined state so just reset - lastChangeDown = -1; - lastChangeUp = -1; - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("boosts")) - { - return; - } - - updateConfig(); - updateShownSkills(); - - if (this.displayNextBuffChange == BoostsConfig.DisplayChangeMode.NEVER) - { - lastChangeDown = -1; - } - - if (this.displayNextDebuffChange == BoostsConfig.DisplayChangeMode.NEVER) - { - lastChangeUp = -1; - } - } - - @Subscribe - private void onStatChanged(StatChanged statChanged) - { - Skill skill = statChanged.getSkill(); - - if (!BOOSTABLE_COMBAT_SKILLS.contains(skill) && !BOOSTABLE_NON_COMBAT_SKILLS.contains(skill)) - { - return; - } - - int skillIdx = skill.ordinal(); - int last = lastSkillLevels[skillIdx]; - int cur = client.getBoostedSkillLevel(skill); - - if (cur == last - 1) - { - // Stat was restored down (from buff) - lastChangeDown = client.getTickCount(); - } - - if (cur == last + 1) - { - // Stat was restored up (from debuff) - lastChangeUp = client.getTickCount(); - } - - lastSkillLevels[skillIdx] = cur; - updateBoostedStats(); - - int boostThreshold = this.boostThreshold; - - if (boostThreshold != 0) - { - int real = client.getRealSkillLevel(skill); - int lastBoost = last - real; - int boost = cur - real; - if (boost <= boostThreshold && boostThreshold < lastBoost) - { - if (this.groupNotifications) - { - boostedSkillsChanged.add(skill.getName()); - } - else - { - notifier.notify(skill.getName() + " level is getting low!"); - } - } - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - lastTickMillis = System.currentTimeMillis(); - - if (this.groupNotifications && !boostedSkillsChanged.isEmpty()) - { - if (boostedSkillsChanged.size() == 1) - { - notifier.notify(boostedSkillsChanged.get(0) + " level is getting low!"); - } - else - { - String notification = ""; - for (int i = 0; i < boostedSkillsChanged.size(); i++) - { - if (i == 0) - { - notification = boostedSkillsChanged.get(i); - } - else if (i < boostedSkillsChanged.size() - 1) - { - notification = notification + ", " + boostedSkillsChanged.get(i); - } - else - { - notification = notification + " and " + boostedSkillsChanged.get(i) + " levels are getting low!"; - notifier.notify(notification); - } - } - } - boostedSkillsChanged.clear(); - } - - if (getChangeUpTicks() <= 0) - { - switch (this.displayNextDebuffChange) - { - case ALWAYS: - if (lastChangeUp != -1) - { - lastChangeUp = client.getTickCount(); - } - - break; - case BOOSTED: - case NEVER: - lastChangeUp = -1; - break; - } - } - - if (getChangeDownTicks() <= 0) - { - switch (this.displayNextBuffChange) - { - case ALWAYS: - if (lastChangeDown != -1) - { - lastChangeDown = client.getTickCount(); - } - - break; - case BOOSTED: - case NEVER: - lastChangeDown = -1; - break; - } - } - } - - private void updateShownSkills() - { - switch (this.displayBoosts) - { - case NONE: - shownSkills.removeAll(BOOSTABLE_COMBAT_SKILLS); - shownSkills.removeAll(BOOSTABLE_NON_COMBAT_SKILLS); - break; - case COMBAT: - shownSkills.addAll(BOOSTABLE_COMBAT_SKILLS); - shownSkills.removeAll(BOOSTABLE_NON_COMBAT_SKILLS); - break; - case NON_COMBAT: - shownSkills.removeAll(BOOSTABLE_COMBAT_SKILLS); - shownSkills.addAll(BOOSTABLE_NON_COMBAT_SKILLS); - break; - case BOTH: - shownSkills.addAll(BOOSTABLE_COMBAT_SKILLS); - shownSkills.addAll(BOOSTABLE_NON_COMBAT_SKILLS); - break; - } - } - - private void updateBoostedStats() - { - // Reset is boosted - isChangedDown = false; - isChangedUp = false; - - // Check if we are still boosted - for (final Skill skill : Skill.values()) - { - if (!BOOSTABLE_COMBAT_SKILLS.contains(skill) && !BOOSTABLE_NON_COMBAT_SKILLS.contains(skill)) - { - continue; - } - - final int boosted = client.getBoostedSkillLevel(skill); - final int base = client.getRealSkillLevel(skill); - - if (boosted > base) - { - isChangedUp = true; - } - else if (boosted < base) - { - isChangedDown = true; - } - } - } - - boolean canShowBoosts() - { - return isChangedDown || isChangedUp; - } - - /** - * Calculates the amount of time until boosted stats decay, - * accounting for the effect of preserve prayer. - * Preserve extends the time of boosted stats by 50% while active. - * The length of a boost is split into 4 sections of 15 seconds each. - * If the preserve prayer is active for the entire duration of the final - * section it will "activate" adding an additional 15 second section - * to the boost timing. If again the preserve prayer is active for that - * entire section a second 15 second section will be added. - *

- * Preserve is only required to be on for the 4th and 5th sections of the boost timer - * to gain full effect (seconds 45-75). - * - * @return integer value in ticks until next boost change - */ - int getChangeDownTicks() - { - if (lastChangeDown == -1 || - this.displayNextBuffChange == BoostsConfig.DisplayChangeMode.NEVER || - (this.displayNextBuffChange == BoostsConfig.DisplayChangeMode.BOOSTED && !isChangedUp)) - { - return -1; - } - - int ticksSinceChange = client.getTickCount() - lastChangeDown; - boolean isPreserveActive = client.isPrayerActive(Prayer.PRESERVE); - - if ((isPreserveActive && (ticksSinceChange < 75 || preserveBeenActive)) || ticksSinceChange > 125) - { - preserveBeenActive = true; - return 150 - ticksSinceChange; - } - - preserveBeenActive = false; - return (ticksSinceChange > 100) ? 125 - ticksSinceChange : 100 - ticksSinceChange; - } - - /** - * Restoration from debuff is separate timer as restoration from buff because of preserve messing up the buff timer. - * Restoration timer is always in 100 tick cycles. - * - * @return integer value in ticks until next stat restoration up - */ - int getChangeUpTicks() - { - if (lastChangeUp == -1 || - this.displayNextDebuffChange == BoostsConfig.DisplayChangeMode.NEVER || - (this.displayNextDebuffChange == BoostsConfig.DisplayChangeMode.BOOSTED && !isChangedDown)) - { - return -1; - } - - int ticksSinceChange = client.getTickCount() - lastChangeUp; - return 100 - ticksSinceChange; - } - - - /** - * Converts tick-based time to accurate second time - * - * @param time tick-based time - * @return second-based time - */ - int getChangeTime(final int time) - { - final long diff = System.currentTimeMillis() - lastTickMillis; - return time != -1 ? (int) ((time * Constants.GAME_TICK_LENGTH - diff) / 1000d) : time; - } - - private void updateConfig() - { - this.displayBoosts = config.displayBoosts(); - this.useRelativeBoost = config.useRelativeBoost(); - this.displayInfoboxes = config.displayInfoboxes(); - this.displayIcons = config.displayIcons(); - this.boldIconFont = config.boldIconFont(); - this.displayNextBuffChange = config.displayNextBuffChange(); - this.displayNextDebuffChange = config.displayNextDebuffChange(); - this.boostThreshold = config.boostThreshold(); - this.groupNotifications = config.groupNotifications(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/CombatIconsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/CombatIconsOverlay.java deleted file mode 100644 index ee15c1e851..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/CombatIconsOverlay.java +++ /dev/null @@ -1,143 +0,0 @@ -package net.runelite.client.plugins.boosts; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.Skill; -import net.runelite.client.game.SkillIconManager; -import net.runelite.client.ui.FontManager; -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; -import net.runelite.client.ui.overlay.components.ComponentOrientation; -import net.runelite.client.ui.overlay.components.ImageComponent; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.util.ColorUtil; -import net.runelite.client.util.ImageUtil; - -@Singleton -class CombatIconsOverlay extends Overlay -{ - private final Client client; - private final PanelComponent panelComponent = new PanelComponent(); - private final SkillIconManager iconManager; - private final BoostsPlugin plugin; - - @Inject - private CombatIconsOverlay(final Client client, final BoostsPlugin plugin, final SkillIconManager iconManager) - { - super(plugin); - this.plugin = plugin; - this.client = client; - this.iconManager = iconManager; - setPosition(OverlayPosition.TOP_LEFT); - setPriority(OverlayPriority.MED); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Boosts overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.isDisplayInfoboxes() || !plugin.isDisplayIcons()) - { - return null; - } - - if (plugin.isBoldIconFont()) - { - graphics.setFont(FontManager.getRunescapeBoldFont()); - } - - panelComponent.getChildren().clear(); - panelComponent.setPreferredSize(new Dimension(28, 0)); - panelComponent.setWrapping(2); - panelComponent.setBackgroundColor(null); - panelComponent.setBorder(new Rectangle()); - - if (plugin.canShowBoosts()) - { - for (Skill skill : plugin.getShownSkills()) - { - final int boosted = client.getBoostedSkillLevel(skill); - final int base = client.getRealSkillLevel(skill); - - if (boosted == base) - { - continue; - } - - final int boost = boosted - base; - final Color strColor = getTextColor(boost); - String str; - - if (plugin.isUseRelativeBoost()) - { - str = String.valueOf(boost); - if (boost > 0) - { - str = "+" + str; - } - } - else - { - str = ColorUtil.prependColorTag(Integer.toString(boosted), strColor); - } - - BufferedImage skillImage = iconManager.getSkillImage(skill, true); - panelComponent.setOrientation(ComponentOrientation.HORIZONTAL); - panelComponent.getChildren().add(new ImageComponent(skillImage)); - panelComponent.getChildren().add(LineComponent.builder() - .left("") - .right(str) - .rightColor(strColor) - .build()); - } - } - - int nextChange = plugin.getChangeDownTicks(); - - if (nextChange != -1) - { - BufferedImage buffImage = ImageUtil.getResourceStreamFromClass(getClass(), "buffedSmall.png"); - panelComponent.getChildren().add(new ImageComponent(buffImage)); - panelComponent.getChildren().add(LineComponent.builder() - .left("") - .right(String.valueOf(plugin.getChangeTime(nextChange))) - .build()); - } - - nextChange = plugin.getChangeUpTicks(); - - if (nextChange != -1) - { - BufferedImage debuffImage = ImageUtil.getResourceStreamFromClass(getClass(), "debuffedSmall.png"); - panelComponent.getChildren().add(new ImageComponent(debuffImage)); - panelComponent.getChildren().add(LineComponent.builder() - .left("") - .right(String.valueOf(plugin.getChangeTime(nextChange))) - .build()); - } - - return panelComponent.render(graphics); - } - - private Color getTextColor(int boost) - { - if (boost < 0) - { - return new Color(238, 51, 51); - } - - return boost <= plugin.getBoostThreshold() ? Color.YELLOW : Color.GREEN; - - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/StatChangeIndicator.java b/runelite-client/src/main/java/net/runelite/client/plugins/boosts/StatChangeIndicator.java deleted file mode 100644 index 946d6a6517..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/boosts/StatChangeIndicator.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.boosts; - -import java.awt.Color; -import java.awt.image.BufferedImage; -import net.runelite.client.ui.overlay.infobox.InfoBox; -import net.runelite.client.ui.overlay.infobox.InfoBoxPriority; - -class StatChangeIndicator extends InfoBox -{ - private final boolean up; - private final BoostsPlugin plugin; - private final BoostsConfig config; - - StatChangeIndicator(boolean up, BufferedImage image, BoostsPlugin plugin, BoostsConfig config) - { - super(image, plugin); - this.up = up; - this.plugin = plugin; - this.config = config; - setPriority(InfoBoxPriority.MED); - setTooltip(up ? "Next debuff change" : "Next buff change"); - } - - @Override - public String getText() - { - return String.format("%02d", plugin.getChangeTime(up ? plugin.getChangeUpTicks() : plugin.getChangeDownTicks())); - } - - @Override - public Color getTextColor() - { - return (up ? plugin.getChangeUpTicks() : plugin.getChangeDownTicks()) < 10 ? Color.RED.brighter() : Color.WHITE; - } - - @Override - public boolean render() - { - final int time = up ? plugin.getChangeUpTicks() : plugin.getChangeDownTicks(); - return config.displayInfoboxes() && time != -1; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bosstimer/Boss.java b/runelite-client/src/main/java/net/runelite/client/plugins/bosstimer/Boss.java deleted file mode 100644 index 4e85727f21..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bosstimer/Boss.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2016-2017, Cameron Moberg - * Copyright (c) 2017, 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.bosstimer; - -import com.google.common.collect.ImmutableMap; -import java.time.Duration; -import java.time.temporal.ChronoUnit; -import java.util.Map; -import net.runelite.api.ItemID; -import net.runelite.api.NpcID; - -enum Boss -{ - GENERAL_GRAARDOR(NpcID.GENERAL_GRAARDOR, 90, ChronoUnit.SECONDS, ItemID.PET_GENERAL_GRAARDOR), - KRIL_TSUTSAROTH(NpcID.KRIL_TSUTSAROTH, 90, ChronoUnit.SECONDS, ItemID.PET_KRIL_TSUTSAROTH), - KREEARRA(NpcID.KREEARRA, 90, ChronoUnit.SECONDS, ItemID.PET_KREEARRA), - COMMANDER_ZILYANA(NpcID.COMMANDER_ZILYANA, 90, ChronoUnit.SECONDS, ItemID.PET_ZILYANA), - CALLISTO(NpcID.CALLISTO_6609, 30, ChronoUnit.SECONDS, ItemID.CALLISTO_CUB), - CHAOS_ELEMENTAL(NpcID.CHAOS_ELEMENTAL, 60, ChronoUnit.SECONDS, ItemID.PET_CHAOS_ELEMENTAL), - CHAOS_FANATIC(NpcID.CHAOS_FANATIC, 30, ChronoUnit.SECONDS, ItemID.ANCIENT_STAFF), - CRAZY_ARCHAEOLOGIST(NpcID.CRAZY_ARCHAEOLOGIST, 30, ChronoUnit.SECONDS, ItemID.FEDORA), - KING_BLACK_DRAGON(NpcID.KING_BLACK_DRAGON, 9, ChronoUnit.SECONDS, ItemID.PRINCE_BLACK_DRAGON), - SCORPIA(NpcID.SCORPIA, 10, ChronoUnit.SECONDS, ItemID.SCORPIAS_OFFSPRING), - VENENATIS(NpcID.VENENATIS_6610, 30, ChronoUnit.SECONDS, ItemID.VENENATIS_SPIDERLING), - VETION(NpcID.VETION_REBORN, 30, ChronoUnit.SECONDS, ItemID.VETION_JR), - DAGANNOTH_PRIME(NpcID.DAGANNOTH_PRIME, 90, ChronoUnit.SECONDS, ItemID.PET_DAGANNOTH_PRIME), - DAGANNOTH_REX(NpcID.DAGANNOTH_REX, 90, ChronoUnit.SECONDS, ItemID.PET_DAGANNOTH_REX), - DAGANNOTH_SUPREME(NpcID.DAGANNOTH_SUPREME, 90, ChronoUnit.SECONDS, ItemID.PET_DAGANNOTH_SUPREME), - CORPOREAL_BEAST(NpcID.CORPOREAL_BEAST, 30, ChronoUnit.SECONDS, ItemID.PET_DARK_CORE), - GIANT_MOLE(NpcID.GIANT_MOLE, 9000, ChronoUnit.MILLIS, ItemID.BABY_MOLE), - DERANGED_ARCHAEOLOGIST(NpcID.DERANGED_ARCHAEOLOGIST, 29400, ChronoUnit.MILLIS, ItemID.UNIDENTIFIED_LARGE_FOSSIL), - CERBERUS(NpcID.CERBERUS, 8400, ChronoUnit.MILLIS, ItemID.HELLPUPPY), - THERMONUCLEAR_SMOKE_DEVIL(NpcID.THERMONUCLEAR_SMOKE_DEVIL, 8400, ChronoUnit.MILLIS, ItemID.PET_SMOKE_DEVIL), - KRAKEN(NpcID.KRAKEN, 8400, ChronoUnit.MILLIS, ItemID.PET_KRAKEN), - KALPHITE_QUEEN(NpcID.KALPHITE_QUEEN_965, 30, ChronoUnit.SECONDS, ItemID.KALPHITE_PRINCESS), - DUSK(NpcID.DUSK_7889, 2, ChronoUnit.MINUTES, ItemID.NOON), - ALCHEMICAL_HYDRA(NpcID.ALCHEMICAL_HYDRA_8622, 25200, ChronoUnit.MILLIS, ItemID.IKKLE_HYDRA), - SARACHNIS(NpcID.SARACHNIS, 30, ChronoUnit.SECONDS, ItemID.SRARACHA), - ZALCANO(NpcID.ZALCANO_9050, 21600, ChronoUnit.MILLIS, ItemID.SMOLCANO); - - private static final Map bosses; - - private final int id; - private final Duration spawnTime; - private final int itemSpriteId; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (Boss boss : values()) - { - builder.put(boss.getId(), boss); - } - - bosses = builder.build(); - } - - Boss(int id, long period, ChronoUnit unit, int itemSpriteId) - { - this.id = id; - this.spawnTime = Duration.of(period, unit); - this.itemSpriteId = itemSpriteId; - } - - public int getId() - { - return id; - } - - public Duration getSpawnTime() - { - return spawnTime; - } - - public int getItemSpriteId() - { - return itemSpriteId; - } - - public static Boss find(int id) - { - return bosses.get(id); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bosstimer/BossTimersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/bosstimer/BossTimersPlugin.java deleted file mode 100644 index 2ab37ba452..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bosstimer/BossTimersPlugin.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2016-2017, Cameron Moberg - * Copyright (c) 2017, 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.bosstimer; - -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.NPC; -import net.runelite.api.events.NpcDespawned; -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.plugins.PluginType; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; - -@PluginDescriptor( - name = "Boss Timers", - description = "Show boss spawn timer overlays", - tags = {"combat", "pve", "overlay", "spawn"}, - type = PluginType.PVM -) -@Singleton -@Slf4j -public class BossTimersPlugin extends Plugin -{ - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private ItemManager itemManager; - - @Override - protected void shutDown() - { - infoBoxManager.removeIf(t -> t instanceof RespawnTimer); - } - - @Subscribe - private void onNpcDespawned(NpcDespawned npcDespawned) - { - NPC npc = npcDespawned.getNpc(); - - if (!npc.isDead()) - { - return; - } - - int npcId = npc.getId(); - - Boss boss = Boss.find(npcId); - - if (boss == null) - { - return; - } - - // remove existing timer - infoBoxManager.removeIf(t -> t instanceof RespawnTimer && ((RespawnTimer) t).getBoss() == boss); - - log.debug("Creating spawn timer for {} ({} seconds)", npc.getName(), boss.getSpawnTime()); - - RespawnTimer timer = new RespawnTimer(boss, itemManager.getImage(boss.getItemSpriteId()), this); - timer.setTooltip(npc.getName()); - infoBoxManager.addInfoBox(timer); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bosstimer/RespawnTimer.java b/runelite-client/src/main/java/net/runelite/client/plugins/bosstimer/RespawnTimer.java deleted file mode 100644 index 6d3a03a85a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bosstimer/RespawnTimer.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2017, 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.bosstimer; - -import java.awt.image.BufferedImage; -import java.time.temporal.ChronoUnit; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.ui.overlay.infobox.Timer; - -class RespawnTimer extends Timer -{ - private final Boss boss; - - RespawnTimer(Boss boss, BufferedImage bossImage, Plugin plugin) - { - super(boss.getSpawnTime().toMillis(), ChronoUnit.MILLIS, bossImage, plugin); - this.boss = boss; - } - - public Boss getBoss() - { - return boss; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bosstimetracker/BossTimeTracker.java b/runelite-client/src/main/java/net/runelite/client/plugins/bosstimetracker/BossTimeTracker.java deleted file mode 100644 index ad6afee6cf..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bosstimetracker/BossTimeTracker.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2019, winterdaze - * 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.bosstimetracker; - -import java.awt.Color; -import java.awt.image.BufferedImage; -import java.time.Duration; -import java.time.Instant; -import java.time.LocalTime; -import java.time.format.DateTimeFormatter; -import net.runelite.client.ui.overlay.infobox.InfoBox; - -public class BossTimeTracker extends InfoBox -{ - private final Instant startTime; - private LocalTime time; - private final Instant lastTime; - - public BossTimeTracker(BufferedImage image, BossTimeTrackerPlugin plugin, Instant startTime, Instant lastTime) - { - super(image, plugin); - this.startTime = startTime; - this.lastTime = lastTime; - } - - @Override - public String getText() - { - if (startTime == null) - { - return ""; - } - - if (lastTime == null) - { - Duration elapsed = Duration.between(startTime, Instant.now()); - time = LocalTime.ofSecondOfDay(elapsed.getSeconds()); - } - else - { - Duration elapsed = Duration.between(startTime, lastTime); - 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() - { - return Color.WHITE; - } - - @Override - public String getTooltip() - { - return "Elapsed time: " + - time.format(DateTimeFormatter.ofPattern("HH:mm:ss")); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bosstimetracker/BossTimeTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/bosstimetracker/BossTimeTrackerPlugin.java deleted file mode 100644 index 5308c34802..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bosstimetracker/BossTimeTrackerPlugin.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright (c) 2019, winterdaze - * 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.bosstimetracker; - -import java.time.Duration; -import java.time.Instant; -import java.util.Arrays; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.inject.Inject; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import static net.runelite.api.ItemID.FIRE_CAPE; -import static net.runelite.api.ItemID.INFERNAL_CAPE; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.util.Text; -import net.runelite.client.config.ConfigManager; -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.plugins.PluginType; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; - -@PluginDescriptor( - name = "Boss Time Tracker", - description = "Display elapsed time in the Fight Caves and Inferno", - tags = {"inferno", "fight", "caves", "cape", "timer", "tzhaar", "pvm"}, - type = PluginType.PVM, - enabledByDefault = false -) -public class BossTimeTrackerPlugin extends Plugin -{ - private static final Pattern WAVE_MESSAGE = Pattern.compile("Wave: (\\d+)"); - private static final String DEFEATED_MESSAGE = "You have been defeated!"; - private static final Pattern COMPLETE_MESSAGE = Pattern.compile("Your (TzTok-Jad|TzKal-Zuk) kill count is:"); - private static final Pattern PAUSED_MESSAGE = Pattern.compile("The (Inferno|Fight Cave) has been paused. You may now log out."); - private static final String CONFIG_GROUP = "Boss Time Tracker"; - private static final String CONFIG_TIME = "time"; - private static final String CONFIG_STARTED = "started"; - private static final String CONFIG_LASTTIME = "lasttime"; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private Client client; - - @Inject - private ItemManager itemManager; - - @Inject - private ConfigManager configManager; - - @Getter(AccessLevel.PACKAGE) - private BossTimeTracker timer; - - private Instant startTime; - private Instant lastTime; - private Boolean started = false; - private boolean loggingIn; - - @Subscribe - public void onGameStateChanged(GameStateChanged event) - { - switch (event.getGameState()) - { - case LOGGED_IN: - if (loggingIn) - { - loggingIn = false; - loadConfig(); - resetConfig(); - } - break; - case LOGGING_IN: - loggingIn = true; - break; - case LOADING: - if (!loggingIn) - { - updateInfoBoxState(); - } - break; - case HOPPING: - loggingIn = true; - case LOGIN_SCREEN: - removeTimer(); - saveConfig(); - break; - default: - break; - } - } - - @Subscribe - public void onChatMessage(ChatMessage event) - { - if (event.getType() != ChatMessageType.GAMEMESSAGE && event.getType() != ChatMessageType.SPAM) - { - return; - } - - String message = Text.removeTags(event.getMessage()); - Matcher matcher = COMPLETE_MESSAGE.matcher(message); - - if (message.contains(DEFEATED_MESSAGE) || matcher.matches()) - { - removeTimer(); - resetConfig(); - resetVars(); - return; - } - - Instant now = Instant.now(); - matcher = PAUSED_MESSAGE.matcher(message); - if (matcher.matches()) - { - lastTime = now; - createTimer(startTime, now); - return; - } - - matcher = WAVE_MESSAGE.matcher(message); - if (!matcher.matches()) - { - return; - } - - if (!started) - { - int wave = Integer.parseInt(matcher.group(1)); - if (wave != 1) - { - return; - } - - started = true; - startTime = now; - } - else if (lastTime != null) - { - startTime = startTime.plus(Duration.between(startTime, now)).minus(Duration.between(startTime, lastTime)); - lastTime = null; - } - - createTimer(startTime, lastTime); - } - - private void updateInfoBoxState() - { - if (timer == null) - { - return; - } - - if (!checkInFightCaves() && !checkInInferno()) - { - removeTimer(); - resetConfig(); - resetVars(); - } - } - - private boolean checkInFightCaves() - { - return client.getMapRegions() != null && Arrays.stream(client.getMapRegions()) - .filter(x -> x == 9551) - .toArray().length > 0; - } - - private boolean checkInInferno() - { - return client.getMapRegions() != null && Arrays.stream(client.getMapRegions()) - .filter(x -> x == 9043) - .toArray().length > 0; - } - - private void resetVars() - { - startTime = null; - lastTime = null; - started = false; - } - - private void removeTimer() - { - infoBoxManager.removeInfoBox(timer); - timer = null; - } - - private void createTimer(Instant startTime, Instant lastTime) - { - if (timer != null) - { - infoBoxManager.removeInfoBox(timer); - } - - if (checkInFightCaves()) - { - timer = new BossTimeTracker(itemManager.getImage(FIRE_CAPE), this, startTime, lastTime); - infoBoxManager.addInfoBox(timer); - } - else if (checkInInferno()) - { - timer = new BossTimeTracker(itemManager.getImage(INFERNAL_CAPE), this, startTime, lastTime); - infoBoxManager.addInfoBox(timer); - } - } - - @Override - protected void shutDown() - { - removeTimer(); - resetConfig(); - resetVars(); - } - - private void loadConfig() - { - startTime = configManager.getConfiguration(CONFIG_GROUP, CONFIG_TIME, Instant.class); - started = configManager.getConfiguration(CONFIG_GROUP, CONFIG_STARTED, Boolean.class); - lastTime = configManager.getConfiguration(CONFIG_GROUP, CONFIG_LASTTIME, Instant.class); - if (started == null) - { - started = false; - } - } - - private void resetConfig() - { - configManager.unsetConfiguration(CONFIG_GROUP, CONFIG_TIME); - configManager.unsetConfiguration(CONFIG_GROUP, CONFIG_STARTED); - configManager.unsetConfiguration(CONFIG_GROUP, CONFIG_LASTTIME); - } - - private void saveConfig() - { - if (startTime == null) - { - return; - } - - if (lastTime == null) - { - lastTime = Instant.now(); - } - - configManager.setConfiguration(CONFIG_GROUP, CONFIG_TIME, startTime); - configManager.setConfiguration(CONFIG_GROUP, CONFIG_STARTED, started); - configManager.setConfiguration(CONFIG_GROUP, CONFIG_LASTTIME, lastTime); - resetVars(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bronzeman/BronzeManConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/bronzeman/BronzeManConfig.java deleted file mode 100644 index e3cdc0cb21..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bronzeman/BronzeManConfig.java +++ /dev/null @@ -1,139 +0,0 @@ -package net.runelite.client.plugins.bronzeman; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigSection; - -@ConfigGroup("bronzemanmode") -public interface BronzeManConfig extends Config -{ - @ConfigSection( - name = "Unlocked Notifications", - description = "", - position = 0, - keyName = "unlockNotifications" - ) - default boolean unlockNotifications() - { - return false; - } - - @ConfigSection( - name = "Game Mode Options", - description = "", - position = 1, - keyName = "gameModeOptions" - ) - default boolean gameModeOptions() - { - return false; - } - - @ConfigSection( - name = "Chat Commands", - description = "", - position = 2, - keyName = "chatCommands" - ) - default boolean chatCommands() - { - return false; - } - - @ConfigItem( - keyName = "notifyImgUnlock", - name = "image unlocked notification", - description = "Configure whether to send the notification image when you unlock a new item.", - position = 0, - section = "unlockNotifications" - ) - default boolean notifyImgUnlock() - { - return true; - } - - @ConfigItem( - keyName = "notifyChatUnlock", - name = "Chat unlocked notification", - description = "Configure whether to send the chat notification when you unlock a new item.", - position = 1, - section = "unlockNotifications" - ) - default boolean notifyChatUnlock() - { - return true; - } - - @ConfigItem( - keyName = "resetCommand", - name = "Enable resetunlocks command", - description = "Enables the !resetunlocks command used for wiping your unlocked items.", - position = 0, - section = "chatCommands" - ) - default boolean resetCommand() - { - return false; - } - - @ConfigItem( - keyName = "countCommand", - name = "Enable countunlocks command", - description = "Enables the !countunlocks command used for counting your unlocked items.", - position = 1, - section = "chatCommands" - ) - default boolean countCommand() - { - return true; - } - - @ConfigItem( - keyName = "backupCommand", - name = "Enable backupunlocks command", - description = "Enables the !backupunlocks command used for backing up your unlocked items.", - position = 2, - section = "chatCommands" - ) - default boolean backupCommand() - { - return true; - } - - @ConfigItem( - keyName = "restoreCommand", - name = "Enable restoreunlocks command", - description = "Enables the !restoreunlocks command used for restoring your unlocked items file.", - position = 3, - section = "chatCommands" - ) - default boolean restoreCommand() - { - return true; - } - - @ConfigItem( - keyName = "deleteCommand", - name = "Enable deleteunlocks command", - description = "Enables the !deleteunlocks command used for deleting your unlocked items file.", - position = 4, - section = "chatCommands" - ) - default boolean deleteCommand() - { - return false; - } - - @ConfigItem( - keyName = "hideTradeOption", - name = "Hide trade with option", - description = "Hides the trade with option from the player menu", - position = 0, - section = "gameModeOptions" - ) - default boolean hideTradeOption() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bronzeman/BronzeManOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/bronzeman/BronzeManOverlay.java deleted file mode 100644 index 6824f1a92d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bronzeman/BronzeManOverlay.java +++ /dev/null @@ -1,89 +0,0 @@ -package net.runelite.client.plugins.bronzeman; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; - - -/** - * @author Seth Davis - * @Email - * @Discord Reminisce#1707 - */ -public class BronzeManOverlay extends Overlay -{ - - private final Client client; - private final BronzemanPlugin plugin; - private final List itemUnlockList; - private ItemUnlock currentUnlock; - @Inject - private ItemManager itemManager; - - @Inject - public BronzeManOverlay(Client client, BronzemanPlugin plugin) - { - this.client = client; - this.plugin = plugin; - this.itemUnlockList = new CopyOnWriteArrayList<>(); - setPosition(OverlayPosition.TOP_CENTER); - } - - void addItemUnlock(int itemId) - { - itemUnlockList.add(new ItemUnlock(itemId)); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return null; - } - if (itemUnlockList.isEmpty()) - { - return null; - } - if (itemManager == null) - { - System.out.println("Item-manager is null"); - return null; - } - if (currentUnlock == null) - { - currentUnlock = itemUnlockList.get(0); - currentUnlock.display(); - return null; - } - - int drawY = currentUnlock.getLocationY(); - // Drawing unlock pop-up in a static location because this is how the game-mode is. - graphics.drawImage(plugin.getUnlockImage(), -62, drawY, null); - graphics.drawImage(getImage(currentUnlock.getItemId()), -50, drawY + 7, null); - if (drawY < 10) - { - currentUnlock.setLocationY(drawY + 1); - } - if (currentUnlock.displayed(itemUnlockList.size())) - { - itemUnlockList.remove(currentUnlock); - currentUnlock = null; - } - return null; - } - - private BufferedImage getImage(int itemID) - { - return itemManager.getImage(itemID, 1, false); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bronzeman/BronzemanPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/bronzeman/BronzemanPlugin.java deleted file mode 100644 index 6fb1d765f0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bronzeman/BronzemanPlugin.java +++ /dev/null @@ -1,504 +0,0 @@ -package net.runelite.client.plugins.bronzeman; - -import com.google.inject.Provides; -import java.awt.image.BufferedImage; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.PrintWriter; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; -import java.util.ArrayList; -import java.util.List; -import javax.inject.Inject; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.Item; -import net.runelite.api.ItemID; -import net.runelite.api.MenuEntry; -import net.runelite.api.Player; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.ClientTick; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.MenuOpened; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.util.Text; -import static net.runelite.api.util.Text.sanitize; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.RuneLite; -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.ConfigChanged; -import net.runelite.client.game.ItemManager; -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.ImageUtil; - -/** - * @author Seth Davis - * @Email - * @Discord Reminisce#1707 - */ -@PluginDescriptor( - name = "Bronze Man Mode", - description = "Restrict yourself as an Iron Meme with GE use for items you have unlocked.", - tags = {"Bronze", "pve", "restrict", "game", "challenge", "bronzeman", "ironman"}, - type = PluginType.GAMEMODE, - enabledByDefault = false -) -@Slf4j -public class BronzemanPlugin extends Plugin -{ - - private static final String BACKUP_CHAT_COMMAND = "!backupunlocks"; - private static final String COUNT_CHAT_COMMAND = "!countunlocks"; - private static final String DELETE_CHAT_COMMAND = "!deleteunlocks"; - private static final String RESET_CHAT_COMMAND = "!resetunlocks"; - private static final String RESTORE_CHAT_COMMAND = "!restoreunlocks"; - - private final BufferedImage UNLOCK_IMAGE = ImageUtil.getResourceStreamFromClass(getClass(), "item_unlocked.png"); - - @Inject - ItemManager itemManager; - @Inject - private Client client; - @Inject - private OverlayManager overlayManager; - @Inject - private BronzeManConfig config; - @Inject - private ChatMessageManager chatMessageManager; - @Inject - private BronzeManOverlay bronzemanOverlay; - private List unlockedItems; - @Getter(AccessLevel.PACKAGE) - private BufferedImage unlockImage = null; - private boolean notifyImgUnlock; - private boolean notifyChatUnlock; - private boolean resetCommand; - private boolean countCommand; - private boolean backupCommand; - private boolean deleteCommand; - private boolean restoreCommand; - private boolean hideTradeOption; - - /** - * Loads GrandExchange widgets for further manipulation of the interface - **/ - private Widget grandExchangeWindow; - private Widget grandExchangeChatBox; - - @Provides - BronzeManConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(BronzeManConfig.class); - } - - @Override - protected void startUp() - { - /** - * Downloads the item-unlock png file to display unlocks - **/ - unlockImage = UNLOCK_IMAGE; - - unlockedItems = new ArrayList<>(); - overlayManager.add(bronzemanOverlay); - updateConfig(); - loadPlayerUnlocks(); - } - - @Override - protected void shutDown() - { - unlockedItems = null; - overlayManager.remove(bronzemanOverlay); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getKey().equals("notifyImgUnlock")) - { - overlayManager.remove(bronzemanOverlay); - } - if (!event.getGroup().equals("bronzemanmode")) - { - return; - } - - updateConfig(); - } - - /** - * Loads players unlocks on login - **/ - @Subscribe - public void onGameStateChanged(GameStateChanged e) - { - if (e.getGameState() == GameState.LOGGED_IN) - { - loadPlayerUnlocks(); - } - } - - /** - * Unlocks all new items that are currently not unlocked - **/ - @Subscribe - public void onItemContainerChanged(ItemContainerChanged e) - { - for (Item i : e.getItemContainer().getItems()) - { - if (i == null) - { - continue; - } - if (i.getId() <= 1) - { - continue; - } - if (i.getQuantity() <= 0) - { - continue; - } - if (!unlockedItems.contains(i.getId())) - { - queueItemUnlock(i.getId()); - } - } - } - - @Subscribe - public void onWidgetLoaded(WidgetLoaded e) - { - switch (e.getGroupId()) - { - case WidgetID.GRAND_EXCHANGE_GROUP_ID: - grandExchangeWindow = client.getWidget(WidgetInfo.GRAND_EXCHANGE_OFFER_CONTAINER); - break; - case WidgetID.CHATBOX_GROUP_ID: - grandExchangeWindow = null; - grandExchangeChatBox = client.getWidget(WidgetInfo.CHATBOX); - break; - } - } - - /** - * Handles greying out items in the GrandExchange - **/ - @Subscribe - public void onClientTick(ClientTick e) - { - if (grandExchangeWindow == null || grandExchangeChatBox == null || grandExchangeWindow.isHidden()) - { - return; - } - if (client.getWidget(162, 53) == null) - { - return; - } - Widget[] children = client.getWidget(162, 53).getChildren(); - if (children == null) - { - return; - } - for (int i = 0; i < children.length; i += 3) - { - if (children[i] == null) - { - continue; - } - if (i + 2 > children.length - 1) - { - continue; - } - if (!unlockedItems.contains(children[i + 2].getItemId())) - { - children[i].setHidden(true); - children[i + 1].setOpacity(70); - children[i + 2].setOpacity(70); - } - } - } - - /** - * Queues a new unlock to be properly displayed - **/ - private void queueItemUnlock(int itemId) - { - unlockedItems.add(itemId); - savePlayerUnlocks();// Save after every item to fail-safe logging out - if (this.notifyChatUnlock) - { - sendMessage("You have successfully unlocked item: " + itemManager.getItemDefinition(itemId).getName()); - } - - if (!this.notifyImgUnlock) - { - return; - } - bronzemanOverlay.addItemUnlock(itemId); - - } - - /** - * Unlocks default items like a bond to a newly made profile - **/ - private void unlockDefaultItems() - { - queueItemUnlock(ItemID.COINS_995); - queueItemUnlock(ItemID.OLD_SCHOOL_BOND); - queueItemUnlock(ItemID.PLATINUM_TOKEN); - } - - /** - * Saves players unlocks to a .txt file every time they unlock a new item - **/ - private void savePlayerUnlocks() - { - try - { - File playerFolder = new File(RuneLite.PROFILES_DIR, client.getUsername()); - File playerFile = new File(playerFolder, "bronzeman-unlocks.txt"); - PrintWriter w = new PrintWriter(playerFile); - for (int itemId : unlockedItems) - { - w.println(itemId); - } - w.close(); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - /** - * Loads a players unlocks everytime they login - **/ - private void loadPlayerUnlocks() - { - unlockedItems.clear(); - try - { - File playerFolder = new File(RuneLite.PROFILES_DIR, client.getUsername()); - if (!playerFolder.exists()) - { - playerFolder.mkdirs(); - } - File playerFile = new File(playerFolder, "bronzeman-unlocks.txt"); - if (!playerFile.exists()) - { - playerFile.createNewFile(); - unlockDefaultItems(); - } - else - { - BufferedReader r = new BufferedReader(new FileReader(playerFile)); - String l; - while ((l = r.readLine()) != null) - { - unlockedItems.add(Integer.parseInt(l)); - } - r.close(); - } - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - - @Subscribe - public void onChatMessage(ChatMessage chatMessage) - { - final String playerName; - - if (chatMessage.equals(ChatMessageType.PRIVATECHATOUT)) - { - playerName = client.getLocalPlayer().getName(); - } - else - { - playerName = sanitize(chatMessage.getName()); - } - if (this.countCommand && chatMessage.getMessage().toLowerCase().equals(COUNT_CHAT_COMMAND)) - { - sendMessage("You have successfully unlocked " + unlockedItems.size() + " items."); - } - if (this.resetCommand && chatMessage.getMessage().toLowerCase().equals(RESET_CHAT_COMMAND)) - { - resetUnlocks(); - } - if (this.backupCommand && chatMessage.getMessage().toLowerCase().equals(BACKUP_CHAT_COMMAND)) - { - backupUnlocks(); - } - if (this.deleteCommand && chatMessage.getMessage().toLowerCase().equals(DELETE_CHAT_COMMAND)) - { - deleteUnlocks(); - } - if (this.restoreCommand && chatMessage.getMessage().toLowerCase().equals(RESTORE_CHAT_COMMAND)) - { - restoreUnlocks(); - } - } - - private void backupUnlocks() - { - File playerFolder = new File(RuneLite.PROFILES_DIR, client.getUsername()); - if (!playerFolder.exists()) - { - return; - } - File playerFile = new File(playerFolder, "bronzeman-unlocks.txt"); - if (!playerFile.exists()) - { - return; - } - - Path originalPath = playerFile.toPath(); - try - { - Files.copy(originalPath, Paths.get(playerFile.getPath().replace(".txt", ".backup")), - StandardCopyOption.REPLACE_EXISTING); - } - catch (Exception e) - { - e.printStackTrace(); - return; - } - sendMessage("Successfully backed up current unlock file!"); - } - - private void restoreUnlocks() - { - File playerFolder = new File(RuneLite.PROFILES_DIR, client.getUsername()); - if (!playerFolder.exists()) - { - return; - } - File playerFile = new File(playerFolder, "bronzeman-unlocks.backup"); - if (!playerFile.exists()) - { - return; - } - - Path originalPath = playerFile.toPath(); - try - { - Files.copy(originalPath, Paths.get(playerFile.getPath().replace(".backup", ".txt")), - StandardCopyOption.REPLACE_EXISTING); - } - catch (Exception e) - { - e.printStackTrace(); - return; - } - sendMessage("Successfully restored current unlock file!"); - } - - private void resetUnlocks() - { - try - { - File playerFolder = new File(RuneLite.PROFILES_DIR, client.getUsername()); - File playerFile = new File(playerFolder, "bronzeman-unlocks.txt"); - playerFile.delete(); - unlockedItems.clear(); - savePlayerUnlocks(); - unlockDefaultItems(); - } - catch (Exception e) - { - e.printStackTrace(); - return; - } - sendMessage("Current Unlock file succesfully reset!"); - } - - private void deleteUnlocks() - { - backupUnlocks(); - try - { - File playerFolder = new File(RuneLite.PROFILES_DIR, client.getUsername()); - File playerFile = new File(playerFolder, "bronzeman-unlocks.txt"); - playerFile.delete(); - } - catch (Exception e) - { - e.printStackTrace(); - return; - } - sendMessage("Current Unlock file succesfully deleted!"); - } - - @Subscribe - private void onMenuOpened(MenuOpened event) - { - Player localPlayer = client.getLocalPlayer(); - - if (localPlayer == null) - { - return; - } - - List menu_entries = new ArrayList<>(); - - for (MenuEntry entry : event.getMenuEntries()) - { - String option = Text.removeTags(entry.getOption()).toLowerCase(); - - if (option.contains("trade with") && this.hideTradeOption) - { - continue; - } - menu_entries.add(entry); - } - event.setMenuEntries(menu_entries.toArray(new MenuEntry[0])); - event.setModified(); - } - - private void sendMessage(String text) - { - final ChatMessageBuilder message = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append(text); - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.CONSOLE) - .runeLiteFormattedMessage(message.build()) - .build()); - } - - private void updateConfig() - { - this.notifyImgUnlock = config.notifyImgUnlock(); - this.resetCommand = config.resetCommand(); - this.countCommand = config.countCommand(); - this.backupCommand = config.backupCommand(); - this.notifyChatUnlock = config.notifyChatUnlock(); - this.deleteCommand = config.deleteCommand(); - this.restoreCommand = config.restoreCommand(); - this.hideTradeOption = config.hideTradeOption(); - } - -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bronzeman/ItemUnlock.java b/runelite-client/src/main/java/net/runelite/client/plugins/bronzeman/ItemUnlock.java deleted file mode 100644 index 2e2094f50a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bronzeman/ItemUnlock.java +++ /dev/null @@ -1,52 +0,0 @@ -package net.runelite.client.plugins.bronzeman; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; - -/** - * @author Seth Davis - * @Email - * @Discord Reminisce#1707 - */ -public class ItemUnlock -{ - - @Getter(AccessLevel.PACKAGE) - private final int itemId; - - @Getter(AccessLevel.PACKAGE) - private long initTime; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private int locationY; - - ItemUnlock(int itemId) - { - this.itemId = itemId; - this.locationY = -20; - this.initTime = -1; - } - - /** - * Starts the displaying of the item unlock - **/ - public void display() - { - this.initTime = System.currentTimeMillis(); - } - - /** - * Returns whether or not an items has been displayed as unlocked yet - **/ - public boolean displayed(int queue) - { - if (queue >= 2) - { - return System.currentTimeMillis() > initTime + (750); - } - return System.currentTimeMillis() > initTime + (5000); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/camera/CameraConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/camera/CameraConfig.java deleted file mode 100644 index b023f6e5d6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/camera/CameraConfig.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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.camera; - -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("zoom") -public interface CameraConfig extends Config -{ - int OUTER_LIMIT_MIN = -400; - int OUTER_LIMIT_MAX = 400; - /** - * The largest (most zoomed in) value that can be used without the client crashing. - *

- * Larger values trigger an overflow in the engine's fov to scale code. - */ - int INNER_ZOOM_LIMIT = 1004; - - @ConfigItem( - keyName = "inner", - name = "Inner limit", - description = "Configures whether or not the inner zoom limit is reduced", - position = 1 - ) - default boolean innerLimit() - { - return false; - } - - @Range( - min = OUTER_LIMIT_MIN, - max = OUTER_LIMIT_MAX - ) - @ConfigItem( - keyName = "outerLimit", - name = "Outer limit", - description = "Configures how much the outer zoom limit is adjusted", - position = 2 - ) - default int outerLimit() - { - return 0; - } - - @ConfigItem( - keyName = "relaxCameraPitch", - name = "Vertical camera", - description = "Relax the camera's upper pitch limit", - position = 3 - ) - default boolean relaxCameraPitch() - { - return false; - } - - @ConfigItem( - keyName = "controlFunction", - name = "Control Function", - description = "Configures the zoom function when control is pressed", - position = 4 - ) - default ControlFunction controlFunction() - { - return ControlFunction.NONE; - } - - @ConfigItem( - keyName = "ctrlZoomValue", - name = "Reset zoom position", - description = "Position of zoom when it is reset", - position = 5 - ) - @Range( - min = OUTER_LIMIT_MIN, - max = INNER_ZOOM_LIMIT - ) - default int ctrlZoomValue() - { - return 512; - } - - @ConfigItem( - keyName = "zoomIncrement", - name = "Zoom Speed", - description = "Speed of zoom", - position = 6 - ) - default int zoomIncrement() - { - return 25; - } - - @ConfigItem( - keyName = "rightClickMovesCamera", - name = "Right click moves camera", - description = "Remaps right click to middle mouse click if there are no menu options", - position = 7 - ) - default boolean rightClickMovesCamera() - { - return false; - } - - @ConfigItem( - keyName = "ignoreExamine", - name = "Ignore Examine", - description = "Ignore the Examine menu entry", - position = 8 - ) - default boolean ignoreExamine() - { - return false; - } - - @ConfigItem( - keyName = "middleClickMenu", - name = "Middle-button opens menu", - description = "Middle-mouse button always opens the menu", - position = 9 - ) - default boolean middleClickMenu() - { - return false; - } - - @ConfigItem( - keyName = "compassLook", - name = "Compass options", - description = "Adds Look South, East, and West options to the compass", - position = 10 - ) - default boolean compassLook() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/camera/CameraPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/camera/CameraPlugin.java deleted file mode 100644 index 538a4f4dea..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/camera/CameraPlugin.java +++ /dev/null @@ -1,454 +0,0 @@ -/* - * Copyright (c) 2018 Abex - * Copyright (c) 2018, Adam - * Copyright (c) 2019, Wynadorn - * 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.camera; - -import com.google.inject.Inject; -import com.google.inject.Provides; -import java.awt.event.KeyEvent; -import java.awt.event.MouseEvent; -import java.util.Arrays; -import javax.swing.SwingUtilities; -import net.runelite.api.Client; -import net.runelite.api.MenuEntry; -import net.runelite.api.MenuOpcode; -import net.runelite.api.ScriptID; -import net.runelite.api.VarPlayer; -import net.runelite.api.events.ClientTick; -import net.runelite.api.events.FocusChanged; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.input.KeyListener; -import net.runelite.client.input.KeyManager; -import net.runelite.client.input.MouseListener; -import net.runelite.client.input.MouseManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.util.MiscUtils; - -@PluginDescriptor( - name = "Camera Zoom", - description = "Expands zoom limit, provides vertical camera, and remaps mouse input keys", - tags = {"zoom", "limit", "vertical", "click", "mouse"}, - enabledByDefault = false, - type = PluginType.MISCELLANEOUS -) -public class CameraPlugin extends Plugin implements KeyListener, MouseListener -{ - private static final int DEFAULT_ZOOM_INCREMENT = 25; - private static final String LOOK_NORTH = "Look North"; - private static final String LOOK_SOUTH = "Look South"; - private static final String LOOK_EAST = "Look East"; - private static final String LOOK_WEST = "Look West"; - - private boolean controlDown; - // flags used to store the mousedown states - private boolean rightClick; - private boolean middleClick; - private boolean innerLimit; - private boolean relaxCameraPitch; - private boolean rightClickMovesCamera; - private boolean ignoreExamine; - private boolean middleClickMenu; - private boolean compassLook; - private ControlFunction controlFunction; - private int outerLimit; - private int ctrlZoomValue; - private int zoomIncrement; - - /** - * Whether or not the current menu has any non-ignored menu entries - */ - private boolean menuHasEntries; - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private CameraConfig config; - - @Inject - private KeyManager keyManager; - - @Inject - private MouseManager mouseManager; - - @Provides - CameraConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(CameraConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - rightClick = false; - middleClick = false; - menuHasEntries = false; - - client.setCameraPitchRelaxerEnabled(this.relaxCameraPitch); - keyManager.registerKeyListener(this); - mouseManager.registerMouseListener(this); - } - - @Override - protected void shutDown() - { - client.setCameraPitchRelaxerEnabled(false); - keyManager.unregisterKeyListener(this); - mouseManager.unregisterMouseListener(this); - controlDown = false; - } - - @Subscribe - public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded) - { - if (menuEntryAdded.getOpcode() == MenuOpcode.CC_OP.getId() && menuEntryAdded.getOption().equals(LOOK_NORTH) && this.compassLook) - { - MenuEntry[] menuEntries = client.getMenuEntries(); - int len = menuEntries.length; - MenuEntry north = menuEntries[len - 1]; - - menuEntries = Arrays.copyOf(menuEntries, len + 3); - - // The handling for these entries is done in ToplevelCompassOp.rs2asm - menuEntries[--len] = createCameraLookEntry(menuEntryAdded, 4, LOOK_WEST); - menuEntries[++len] = createCameraLookEntry(menuEntryAdded, 3, LOOK_EAST); - menuEntries[++len] = createCameraLookEntry(menuEntryAdded, 2, LOOK_SOUTH); - menuEntries[++len] = north; - - client.setMenuEntries(menuEntries); - } - } - - private MenuEntry createCameraLookEntry(MenuEntryAdded lookNorth, int identifier, String option) - { - MenuEntry m = new MenuEntry(); - m.setOption(option); - m.setTarget(lookNorth.getTarget()); - m.setIdentifier(identifier); - m.setOpcode(MenuOpcode.CC_OP.getId()); - m.setParam0(lookNorth.getParam0()); - m.setParam1(lookNorth.getParam1()); - return m; - } - - @Subscribe - private void onScriptCallbackEvent(ScriptCallbackEvent event) - { - if (client.getIndexScripts().isOverlayOutdated()) - { - // if any cache overlay fails to load then assume at least one of the zoom scripts is outdated - // and prevent zoom extending entirely. - return; - } - - int[] intStack = client.getIntStack(); - int intStackSize = client.getIntStackSize(); - - if (!controlDown && "scrollWheelZoom".equals(event.getEventName()) && this.controlFunction == ControlFunction.CONTROL_TO_ZOOM) - { - intStack[intStackSize - 1] = 1; - } - - if ("innerZoomLimit".equals(event.getEventName()) && this.innerLimit) - { - intStack[intStackSize - 1] = config.INNER_ZOOM_LIMIT; - return; - } - - if ("outerZoomLimit".equals(event.getEventName())) - { - int outerLimit = MiscUtils.clamp(this.outerLimit, CameraConfig.OUTER_LIMIT_MIN, CameraConfig.OUTER_LIMIT_MAX); - int outerZoomLimit = 128 - outerLimit; - intStack[intStackSize - 1] = outerZoomLimit; - return; - } - - if ("scrollWheelZoomIncrement".equals(event.getEventName()) && this.zoomIncrement != DEFAULT_ZOOM_INCREMENT) - { - intStack[intStackSize - 1] = this.zoomIncrement; - return; - } - - if (this.innerLimit) - { - // This lets the options panel's slider have an exponential rate - final double exponent = 2.d; - switch (event.getEventName()) - { - case "zoomLinToExp": - { - double range = intStack[intStackSize - 1]; - double value = intStack[intStackSize - 2]; - value = Math.pow(value / range, exponent) * range; - intStack[intStackSize - 2] = (int) value; - break; - } - case "zoomExpToLin": - { - double range = intStack[intStackSize - 1]; - double value = intStack[intStackSize - 2]; - value = Math.pow(value / range, 1.d / exponent) * range; - intStack[intStackSize - 2] = (int) value; - break; - } - } - } - } - - @Subscribe - private void onFocusChanged(FocusChanged event) - { - if (!event.isFocused()) - { - controlDown = false; - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("zoom")) - { - return; - } - client.setCameraPitchRelaxerEnabled(this.relaxCameraPitch); - updateConfig(); - } - - @Override - public void keyTyped(KeyEvent e) - { - } - - @Override - public void keyPressed(KeyEvent e) - { - if (e.getKeyCode() == KeyEvent.VK_CONTROL) - { - controlDown = true; - } - } - - @Override - public void keyReleased(KeyEvent e) - { - if (e.getKeyCode() == KeyEvent.VK_CONTROL) - { - controlDown = false; - - if (this.controlFunction == ControlFunction.CONTROL_TO_RESET) - { - final int zoomValue = MiscUtils.clamp(this.ctrlZoomValue, config.OUTER_LIMIT_MIN, config.INNER_ZOOM_LIMIT); - clientThread.invokeLater(() -> client.runScript(ScriptID.CAMERA_DO_ZOOM, zoomValue, zoomValue)); - } - } - } - - /** - * Checks if the menu has any non-ignored entries - */ - private boolean hasMenuEntries(MenuEntry[] menuEntries) - { - for (MenuEntry menuEntry : menuEntries) - { - switch (menuEntry.getMenuOpcode()) - { - case CANCEL: - case WALK: - break; - case EXAMINE_OBJECT: - case EXAMINE_NPC: - case EXAMINE_ITEM_GROUND: - case EXAMINE_ITEM: - case CC_OP_LOW_PRIORITY: - if (this.ignoreExamine) - { - break; - } - default: - return true; - } - } - return false; - } - - /** - * Checks if the menu has any options, because menu entries are built each - * tick and the MouseListener runs on the awt thread - */ - @Subscribe - public void onClientTick(ClientTick event) - { - menuHasEntries = hasMenuEntries(client.getMenuEntries()); - } - - /** - * The event that is triggered when a mouse button is pressed - * In this method the right click is changed to a middle-click to enable rotating the camera - *

- * This method also provides the config option to enable the middle-mouse button to always open the right click menu - */ - @Override - public MouseEvent mousePressed(MouseEvent mouseEvent) - { - if (SwingUtilities.isRightMouseButton(mouseEvent) && this.rightClickMovesCamera) - { - boolean oneButton = client.getVar(VarPlayer.MOUSE_BUTTONS) == 1; - // Only move the camera if there is nothing at the menu, or if - // in one-button mode. In one-button mode, left and right click always do the same thing, - // so always treat it as the menu is empty - if (!menuHasEntries || oneButton) - { - // Set the rightClick flag to true so we can release the button in mouseReleased() later - rightClick = true; - // Change the mousePressed() MouseEvent to the middle mouse button - mouseEvent = new MouseEvent((java.awt.Component) mouseEvent.getSource(), - mouseEvent.getID(), - mouseEvent.getWhen(), - mouseEvent.getModifiersEx(), - mouseEvent.getX(), - mouseEvent.getY(), - mouseEvent.getClickCount(), - mouseEvent.isPopupTrigger(), - MouseEvent.BUTTON2); - } - } - else if (SwingUtilities.isMiddleMouseButton((mouseEvent)) && this.middleClickMenu) - { - // Set the middleClick flag to true so we can release it later in mouseReleased() - middleClick = true; - // Chance the middle mouse button MouseEvent to a right-click - mouseEvent = new MouseEvent((java.awt.Component) mouseEvent.getSource(), - mouseEvent.getID(), - mouseEvent.getWhen(), - mouseEvent.getModifiersEx(), - mouseEvent.getX(), - mouseEvent.getY(), - mouseEvent.getClickCount(), - mouseEvent.isPopupTrigger(), - MouseEvent.BUTTON3); - } - return mouseEvent; - } - - /** - * Correct the MouseEvent to release the correct button - */ - @Override - public MouseEvent mouseReleased(MouseEvent mouseEvent) - { - if (rightClick) - { - rightClick = false; - // Change the MouseEvent to button 2 so the middle mouse button will be released - mouseEvent = new MouseEvent((java.awt.Component) mouseEvent.getSource(), - mouseEvent.getID(), - mouseEvent.getWhen(), - mouseEvent.getModifiersEx(), - mouseEvent.getX(), - mouseEvent.getY(), - mouseEvent.getClickCount(), - mouseEvent.isPopupTrigger(), - MouseEvent.BUTTON2); - - } - if (middleClick) - { - middleClick = false; - // Change the MouseEvent ot button 3 so the right mouse button will be released - mouseEvent = new MouseEvent((java.awt.Component) mouseEvent.getSource(), - mouseEvent.getID(), - mouseEvent.getWhen(), - mouseEvent.getModifiersEx(), - mouseEvent.getX(), - mouseEvent.getY(), - mouseEvent.getClickCount(), - mouseEvent.isPopupTrigger(), - MouseEvent.BUTTON3); - } - return mouseEvent; - } - - /* - * These methods are unused but required to be present in a MouseListener implementation - */ - // region Unused MouseListener methods - @Override - public MouseEvent mouseDragged(MouseEvent mouseEvent) - { - return mouseEvent; - } - - @Override - public MouseEvent mouseMoved(MouseEvent mouseEvent) - { - return mouseEvent; - } - - @Override - public MouseEvent mouseClicked(MouseEvent mouseEvent) - { - return mouseEvent; - } - - @Override - public MouseEvent mouseEntered(MouseEvent mouseEvent) - { - return mouseEvent; - } - - @Override - public MouseEvent mouseExited(MouseEvent mouseEvent) - { - return mouseEvent; - } - // endregion - - private void updateConfig() - { - this. innerLimit = config.innerLimit(); - this.relaxCameraPitch = config.relaxCameraPitch(); - this.rightClickMovesCamera = config.rightClickMovesCamera(); - this.ignoreExamine = config.ignoreExamine(); - this.middleClickMenu = config.middleClickMenu(); - this.compassLook = config.compassLook(); - this.controlFunction = config.controlFunction(); - this.outerLimit = config.outerLimit(); - this.ctrlZoomValue = config.ctrlZoomValue(); - this.zoomIncrement = config.zoomIncrement(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/camera/ControlFunction.java b/runelite-client/src/main/java/net/runelite/client/plugins/camera/ControlFunction.java deleted file mode 100644 index c55a6269b1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/camera/ControlFunction.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2019, Jacob M - * 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.client.plugins.camera; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter(AccessLevel.PACKAGE) -@AllArgsConstructor -public enum ControlFunction -{ - NONE("None"), - CONTROL_TO_ZOOM("Hold to zoom"), - CONTROL_TO_RESET("Reset zoom"); - - private final String name; - - @Override - public String toString() - { - return getName(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonConfig.java deleted file mode 100644 index c832ded86b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonConfig.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2016-2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.cannon; - -import java.awt.Color; -import net.runelite.client.config.Alpha; -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("cannon") -public interface CannonConfig extends Config -{ - @ConfigItem( - keyName = "showEmptyCannonNotification", - name = "Empty cannon notification", - description = "Configures whether to notify you that the cannon is empty" - ) - default boolean showEmptyCannonNotification() - { - return true; - } - - @ConfigItem( - keyName = "showInfobox", - name = "Show Cannonball infobox", - description = "Configures whether to show the cannonballs in an infobox" - ) - default boolean showInfobox() - { - return false; - } - - @ConfigItem( - keyName = "showDoubleHitSpot", - name = "Show double hit spots", - description = "Configures whether to show the NPC double hit spot" - ) - default boolean showDoubleHitSpot() - { - return false; - } - - @Alpha - @ConfigItem( - keyName = "highlightDoubleHitColor", - name = "Color of double hit spots", - description = "Configures the highlight color of double hit spots" - ) - default Color highlightDoubleHitColor() - { - return Color.RED; - } - - @ConfigItem( - keyName = "showCannonSpots", - name = "Show common cannon spots", - description = "Configures whether to show common cannon spots or not" - ) - default boolean showCannonSpots() - { - return true; - } - - @Range( - max = 29 - ) - @ConfigItem( - keyName = "ammoAmount", - name = "Ammo left", - description = "Configure to set the amount of ammo left to receive ammo left notification" - ) - default int ammoAmount() - { - return 5; - } - - @ConfigItem( - keyName = "notifyAmmoLeft", - name = "Ammo left notification", - description = "Sends a notification when cannon ammo is under the specified amount" - ) - default boolean notifyAmmoLeft() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonCounter.java deleted file mode 100644 index a4b8028e47..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonCounter.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018, 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.cannon; - -import java.awt.Color; -import java.awt.image.BufferedImage; -import net.runelite.client.ui.overlay.infobox.InfoBox; - -class CannonCounter extends InfoBox -{ - private final CannonPlugin plugin; - - CannonCounter(BufferedImage img, CannonPlugin plugin) - { - super(img, plugin); - this.plugin = plugin; - } - - @Override - public String getText() - { - return String.valueOf(plugin.getCballsLeft()); - } - - @Override - public Color getTextColor() - { - return plugin.getStateColor(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonOverlay.java deleted file mode 100644 index 84b7423ab3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonOverlay.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2016-2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.cannon; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import static net.runelite.api.Perspective.LOCAL_TILE_SIZE; -import net.runelite.api.Point; -import net.runelite.api.coords.LocalPoint; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.ui.overlay.components.TextComponent; - -@Singleton -class CannonOverlay extends Overlay -{ - private static final int MAX_DISTANCE = 2500; - - private final Client client; - private final CannonPlugin plugin; - private final TextComponent textComponent = new TextComponent(); - - @Inject - CannonOverlay(final Client client, final CannonPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.MED); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isCannonPlaced() || plugin.getCannonPosition() == null) - { - return null; - } - - LocalPoint cannonPoint = LocalPoint.fromWorld(client, plugin.getCannonPosition()); - - if (cannonPoint == null) - { - return null; - } - - LocalPoint localLocation = client.getLocalPlayer().getLocalLocation(); - - if (localLocation.distanceTo(cannonPoint) <= MAX_DISTANCE) - { - Point cannonLoc = Perspective.getCanvasTextLocation(client, - graphics, - cannonPoint, - String.valueOf(plugin.getCballsLeft()), 150); - - if (cannonLoc != null) - { - textComponent.setText(String.valueOf(plugin.getCballsLeft())); - textComponent.setPosition(new java.awt.Point(cannonLoc.getX(), cannonLoc.getY())); - textComponent.setColor(plugin.getStateColor()); - textComponent.render(graphics); - } - - if (plugin.isShowDoubleHitSpot()) - { - Color color = plugin.getHighlightDoubleHitColor(); - drawDoubleHitSpots(graphics, cannonPoint, color); - } - } - - return null; - } - - - /** - * Draw the double hit spots on a 6 by 6 grid around the cannon - * - * @param startTile The position of the cannon - */ - private void drawDoubleHitSpots(Graphics2D graphics, LocalPoint startTile, Color color) - { - for (int x = -3; x <= 3; x++) - { - for (int y = -3; y <= 3; y++) - { - if (y != 1 && x != 1 && y != -1 && x != -1) - { - continue; - } - - //Ignore center square - if (y >= -1 && y <= 1 && x >= -1 && x <= 1) - { - continue; - } - - int xPos = startTile.getX() - (x * LOCAL_TILE_SIZE); - int yPos = startTile.getY() - (y * LOCAL_TILE_SIZE); - - LocalPoint marker = new LocalPoint(xPos, yPos); - Polygon poly = Perspective.getCanvasTilePoly(client, marker); - - if (poly == null) - { - continue; - } - - OverlayUtil.renderPolygon(graphics, poly, color); - } - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonPlugin.java deleted file mode 100644 index 208b571559..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonPlugin.java +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Copyright (c) 2016-2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.cannon; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Provides; -import java.awt.Color; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.List; -import javax.inject.Inject; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.InventoryID; -import net.runelite.api.ItemID; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.CannonChanged; -import net.runelite.api.events.CannonPlaced; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.client.Notifier; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.task.Schedule; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; -import net.runelite.client.util.ItemUtil; - -@PluginDescriptor( - name = "Cannon", - description = "Show information about cannon placement and/or amount of cannonballs", - tags = {"combat", "notifications", "ranged", "overlay"}, - type = PluginType.UTILITY -) -public class CannonPlugin extends Plugin -{ - private static final ImmutableSet CANNON_PARTS = ImmutableSet.of( - ItemID.CANNON_BASE, ItemID.CANNON_STAND, ItemID.CANNON_BARRELS, ItemID.CANNON_FURNACE - ); - private CannonCounter counter; - - @Getter(AccessLevel.PACKAGE) - private int cballsLeft; - - @Getter(AccessLevel.PACKAGE) - private boolean cannonPlaced; - - @Getter(AccessLevel.PACKAGE) - private WorldPoint cannonPosition; - - @Getter(AccessLevel.PACKAGE) - private GameObject cannon; - - @Getter(AccessLevel.PACKAGE) - private List spotPoints = new ArrayList<>(); - - @Inject - private ItemManager itemManager; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private Notifier notifier; - - @Inject - private OverlayManager overlayManager; - - @Inject - private CannonOverlay cannonOverlay; - - @Inject - private CannonSpotOverlay cannonSpotOverlay; - - @Inject - private CannonConfig config; - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - private boolean lock; - private boolean showEmptyCannonNotification; - private boolean showInfobox; - @Getter(AccessLevel.PACKAGE) - private boolean showDoubleHitSpot; - @Getter(AccessLevel.PACKAGE) - private Color highlightDoubleHitColor; - @Getter(AccessLevel.PACKAGE) - private boolean showCannonSpots; - private int ammoAmount; - private boolean notifyAmmoLeft; - - @Provides - CannonConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(CannonConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(cannonOverlay); - overlayManager.add(cannonSpotOverlay); - lock = false; - } - - @Override - protected void shutDown() - { - cannonSpotOverlay.setHidden(true); - overlayManager.remove(cannonOverlay); - overlayManager.remove(cannonSpotOverlay); - cannonPlaced = false; - cannonPosition = null; - lock = false; - cballsLeft = 0; - removeCounter(); - spotPoints.clear(); - } - - @Subscribe - private void onItemContainerChanged(ItemContainerChanged event) - { - if (event.getItemContainer() != client.getItemContainer(InventoryID.INVENTORY)) - { - return; - } - - cannonSpotOverlay.setHidden(!ItemUtil.containsAllItemIds(event.getItemContainer().getItems(), CANNON_PARTS)); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("cannon")) - { - updateConfig(); - - if (!this.showInfobox) - { - removeCounter(); - } - else - { - if (cannonPlaced) - { - clientThread.invoke(this::addCounter); - } - } - } - } - - @Schedule( - period = 1, - unit = ChronoUnit.SECONDS - ) - public void checkSpots() - { - if (!config.showCannonSpots()) - { - return; - } - - spotPoints.clear(); - for (WorldPoint spot : CannonSpots.getCannonSpots()) - { - if (spot.getPlane() != client.getPlane() || !spot.isInScene(client)) - { - continue; - } - - spotPoints.add(spot); - } - } - - @Subscribe - private void onCannonPlaced(CannonPlaced cannonPlacedEvent) - { - cannonPlaced = cannonPlacedEvent.isPlaced(); - cannonPosition = cannonPlacedEvent.getCannonLocation(); - cannon = cannonPlacedEvent.getCannon(); - } - - @Subscribe - private void onCannonballFired(CannonChanged cannonChangedEvent) - { - cballsLeft = cannonChangedEvent.getCannonballs(); - } - - @Subscribe - private void onChatMessage(ChatMessage event) - { - if (event.getType() != ChatMessageType.SPAM && event.getType() != ChatMessageType.GAMEMESSAGE) - { - return; - } - - if (event.getMessage().equals("You add the furnace.")) - { - addCounter(); - } - - if (event.getMessage().contains("You pick up the cannon") - || event.getMessage().contains("Your cannon has decayed. Speak to Nulodion to get a new one!")) - { - removeCounter(); - } - } - - Color getStateColor() - { - if (cballsLeft > 15) - { - lock = false; - return Color.green; - } - else if (cballsLeft > 5) - { - return Color.orange; - } - else if (cballsLeft <= this.ammoAmount && this.notifyAmmoLeft && !lock) - { - notifier.notify("Your cannon has " + this.ammoAmount + " balls left!"); - lock = true; - } - - return Color.red; - } - - private void addCounter() - { - if (!this.showInfobox || counter != null) - { - return; - } - - counter = new CannonCounter(itemManager.getImage(ItemID.CANNONBALL), this); - counter.setTooltip("Cannonballs"); - - infoBoxManager.addInfoBox(counter); - } - - private void removeCounter() - { - if (counter == null) - { - return; - } - - infoBoxManager.removeInfoBox(counter); - counter = null; - } - - private void updateConfig() - { - this.showEmptyCannonNotification = config.showEmptyCannonNotification(); - this.showInfobox = config.showInfobox(); - this.showDoubleHitSpot = config.showDoubleHitSpot(); - this.highlightDoubleHitColor = config.highlightDoubleHitColor(); - this.showCannonSpots = config.showCannonSpots(); - this.ammoAmount = config.ammoAmount(); - this.notifyAmmoLeft = config.notifyAmmoLeft(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonSpotOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonSpotOverlay.java deleted file mode 100644 index 3bf377f2b0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonSpotOverlay.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.cannon; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Setter; -import net.runelite.api.Client; -import static net.runelite.api.ItemID.CANNONBALL; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayUtil; - -@Singleton -public class CannonSpotOverlay extends Overlay -{ - private static final int MAX_DISTANCE = 2350; - - private final Client client; - private final CannonPlugin plugin; - - @Inject - private ItemManager itemManager; - - @Setter(AccessLevel.PACKAGE) - private boolean hidden; - - @Inject - CannonSpotOverlay(final Client client, final CannonPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (hidden || !plugin.isShowCannonSpots() || plugin.isCannonPlaced()) - { - return null; - } - - for (WorldPoint spot : plugin.getSpotPoints()) - { - if (spot.getPlane() != client.getPlane()) - { - continue; - } - - LocalPoint spotPoint = LocalPoint.fromWorld(client, spot); - LocalPoint localLocation = client.getLocalPlayer().getLocalLocation(); - - if (spotPoint != null && localLocation.distanceTo(spotPoint) <= MAX_DISTANCE) - { - renderCannonSpot(graphics, client, spotPoint, itemManager.getImage(CANNONBALL), Color.RED); - } - } - - return null; - } - - private void renderCannonSpot(Graphics2D graphics, Client client, LocalPoint point, BufferedImage image, Color color) - { - //Render tile - Polygon poly = Perspective.getCanvasTilePoly(client, point); - - if (poly != null) - { - OverlayUtil.renderPolygon(graphics, poly, color); - } - - //Render icon - Point imageLoc = Perspective.getCanvasImageLocation(client, point, image, 0); - - if (imageLoc != null) - { - OverlayUtil.renderImageLocation(graphics, imageLoc, image); - } - } -} 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 deleted file mode 100644 index 2deec48ded..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonSpots.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.cannon; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.coords.WorldPoint; - -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)), - 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), new WorldPoint(1421, 10089, 1)), - ELVES(new WorldPoint(2044, 4635, 0), new WorldPoint(3278, 6098, 0)), - SUQAHS(new WorldPoint(2114, 3943, 0)), - TROLLS(new WorldPoint(2401, 3856, 0), new WorldPoint(1242, 3517, 0)), - GREATER_DEMONS(new WorldPoint(1435, 10086, 2)), - BRINE_RAT(new WorldPoint(2707, 10132, 0)), - DAGGANOTH(new WorldPoint(2524, 10020, 0)), - DARK_BEAST(new WorldPoint(1992, 4655, 0)), - DUST_DEVIL(new WorldPoint(3218, 9366, 0)), - KALPHITE(new WorldPoint(3307, 9528, 0)), - LESSER_DEMON(new WorldPoint(2838, 9559, 0), new WorldPoint(3163, 10114, 0)), - LIZARDMEN(new WorldPoint(1500, 3703, 0)), - MINIONS_OF_SCARABAS(new WorldPoint(3297, 9252, 0)), - SMOKE_DEVIL(new WorldPoint(2398, 9444, 0)), - CAVE_HORROR(new WorldPoint(3785, 9460, 0)), - BLUE_DRAGON(new WorldPoint(1933, 8973, 1)), - ANKOU(new WorldPoint(3177, 10193, 0)), - BLACK_DRAGON(new WorldPoint(3239, 10206, 0)), - ICE_GIANT(new WorldPoint(3207, 10164, 0)), - GREEN_DRAGON(new WorldPoint(3225, 10068, 0)), - SPIDER(new WorldPoint(3169, 3886, 0)), - ROGUE(new WorldPoint(3285, 3930, 0)), - MAMMOTH(new WorldPoint(3160, 3619, 0)), - SKELETON(new WorldPoint(3018, 3592, 0)), - DARK_WARRIOR(new WorldPoint(3030, 3632, 0)), - MAGIC_AXE(new WorldPoint(3190, 3960, 0)), - EARTH_WARRIOR(new WorldPoint(3120, 9987, 0)), - ICE_WARRIOR(new WorldPoint(2955, 3876, 0)), - BANDIT(new WorldPoint(3037, 3700, 0)); - - @Getter(AccessLevel.PACKAGE) - private static final List cannonSpots = new ArrayList<>(); - - static - { - for (CannonSpots cannonSpot : values()) - { - cannonSpots.addAll(Arrays.asList(cannonSpot.spots)); - } - } - - private final WorldPoint[] spots; - - CannonSpots(WorldPoint... spots) - { - this.spots = spots; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusGhost.java b/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusGhost.java deleted file mode 100644 index 28adddc615..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusGhost.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.cerberus; - -import com.google.common.collect.ImmutableMap; -import java.util.Map; -import java.util.Optional; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.Skill; - -@Getter(AccessLevel.PACKAGE) -@RequiredArgsConstructor -public enum CerberusGhost -{ - RANGE(NpcID.SUMMONED_SOUL, Skill.RANGED), - MAGE(NpcID.SUMMONED_SOUL_5868, Skill.MAGIC), - MELEE(NpcID.SUMMONED_SOUL_5869, Skill.ATTACK); - - private final int npcId; - private final Skill type; - - private static final Map MAP; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (final CerberusGhost ghost : values()) - { - builder.put(ghost.getNpcId(), ghost); - } - - MAP = builder.build(); - } - - /** - * Try to identify if NPC is ghost - * - * @param npc npc - * @return optional ghost - */ - public static Optional fromNPC(final NPC npc) - { - return npc == null ? Optional.empty() : Optional.ofNullable(MAP.get(npc.getId())); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusOverlay.java deleted file mode 100644 index 2f384fcd80..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusOverlay.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.cerberus; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.client.game.SkillIconManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.components.ComponentOrientation; -import net.runelite.client.ui.overlay.components.ImageComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; - -@Singleton -public class CerberusOverlay extends Overlay -{ - private final CerberusPlugin plugin; - private final SkillIconManager iconManager; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - CerberusOverlay(final CerberusPlugin plugin, final SkillIconManager iconManager) - { - this.plugin = plugin; - this.iconManager = iconManager; - setPosition(OverlayPosition.BOTTOM_RIGHT); - panelComponent.setOrientation(ComponentOrientation.HORIZONTAL); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.getGhosts().isEmpty()) - { - return null; - } - - panelComponent.getChildren().clear(); - - // Ghosts are already sorted - plugin.getGhosts().stream() - // Iterate only through the correct amount of ghosts - .limit(CerberusGhost.values().length) - .forEach(npc -> CerberusGhost - .fromNPC(npc) - .ifPresent(ghost -> panelComponent - .getChildren() - .add(new ImageComponent(iconManager.getSkillImage(ghost.getType()))))); - - - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java deleted file mode 100644 index 2dfb84c7ab..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.cerberus; - -import com.google.common.collect.ComparisonChain; -import java.util.ArrayList; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.GameState; -import net.runelite.api.NPC; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.client.eventbus.Subscribe; -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; - -@PluginDescriptor( - name = "Cerberus", - description = "Show what to pray against the summoned souls", - tags = {"bosses", "combat", "ghosts", "prayer", "pve", "overlay", "souls"}, - type = PluginType.PVM -) -@Singleton -public class CerberusPlugin extends Plugin -{ - @Getter(AccessLevel.PACKAGE) - private final List ghosts = new ArrayList<>(); - - @Inject - private OverlayManager overlayManager; - - @Inject - private CerberusOverlay overlay; - - @Override - protected void startUp() - { - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - ghosts.clear(); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - GameState gameState = event.getGameState(); - if (gameState == GameState.LOGIN_SCREEN || gameState == GameState.HOPPING || gameState == GameState.CONNECTION_LOST) - { - ghosts.clear(); - } - } - - @Subscribe - private void onNpcSpawned(final NpcSpawned event) - { - final NPC npc = event.getNpc(); - CerberusGhost.fromNPC(npc).ifPresent(ghost -> ghosts.add(npc)); - } - - @Subscribe - private void onNpcDespawned(final NpcDespawned event) - { - ghosts.remove(event.getNpc()); - } - - @Subscribe - void onGameTick(GameTick gameTick) - { - if (ghosts.isEmpty()) - { - return; - } - - ghosts.sort((a, b) -> ComparisonChain.start() - // First, sort by the southernmost ghost (e.g with lowest y) - .compare(a.getLocalLocation().getY(), b.getLocalLocation().getY()) - // Then, sort by the westernmost ghost (e.g with lowest x) - .compare(a.getLocalLocation().getX(), b.getLocalLocation().getX()) - // This will give use the current wave and order of the ghosts based on - // what ghost will attack first - .result()); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsConfig.java deleted file mode 100644 index 1e7d7b7cd7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsConfig.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2017, 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.chatcommands; - -import java.awt.event.InputEvent; -import java.awt.event.KeyEvent; -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("chatcommands") -public interface ChatCommandsConfig extends Config -{ - @ConfigItem( - position = 0, - keyName = "price", - name = "Price Command", - description = "Configures whether the Price command is enabled
!price [item]" - ) - default boolean price() - { - return true; - } - - @ConfigItem( - position = 1, - keyName = "lvl", - name = "Level Command", - description = "Configures whether the Level command is enabled
!lvl [skill]" - ) - default boolean lvl() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "clue", - name = "Clue Command", - description = "Configures whether the Clue command is enabled
!clues" - ) - default boolean clue() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "killcount", - name = "Killcount Command", - description = "Configures whether the Killcount command is enabled
!kc [boss]" - ) - default boolean killcount() - { - return true; - } - - @ConfigItem( - position = 4, - keyName = "qp", - name = "QP Command", - description = "Configures whether the quest point command is enabled
!qp" - ) - default boolean qp() - { - return true; - } - - @ConfigItem( - position = 5, - keyName = "pb", - name = "PB Command", - description = "Configures whether the personal best command is enabled
!pb" - ) - default boolean pb() - { - return true; - } - - @ConfigItem( - position = 6, - keyName = "gc", - name = "GC Command", - description = "Configures whether the Barbarian Assault High gamble count command is enabled
!gc" - ) - default boolean gc() - { - return true; - } - - @ConfigItem( - position = 7, - keyName = "duels", - name = "Duels Command", - description = "Configures whether the duel arena command is enabled
!duels" - ) - default boolean duels() - { - return true; - } - - @ConfigItem( - position = 8, - keyName = "clearSingleWord", - name = "Clear Single Word", - description = "Enable hot key to clear single word at a time" - ) - default Keybind clearSingleWord() - { - return new Keybind(KeyEvent.VK_W, InputEvent.CTRL_DOWN_MASK); - } - - @ConfigItem( - position = 9, - keyName = "clearEntireChatBox", - name = "Clear Chat Box", - description = "Enable hotkey to clear entire chat box" - ) - default Keybind clearChatBox() - { - return new Keybind(KeyEvent.VK_BACK_SPACE, InputEvent.CTRL_DOWN_MASK); - } - - @ConfigItem( - position = 10, - keyName = "clipboardShortcuts", - name = "Clipboard shortcuts", - description = "Enable clipboard shortcuts (ctrl+c and ctrl+v)" - ) - default boolean clipboardShortcuts() - { - return true; - } -} \ No newline at end of file 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 deleted file mode 100644 index ab4e716cf9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java +++ /dev/null @@ -1,1443 +0,0 @@ -/* - * Copyright (c) 2017. l2- - * Copyright (c) 2017, 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.chatcommands; - -import com.google.inject.Provides; -import io.reactivex.schedulers.Schedulers; -import java.io.IOException; -import java.util.EnumSet; -import java.util.List; -import java.util.concurrent.ScheduledExecutorService; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.Value; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.Experience; -import net.runelite.api.IconID; -import net.runelite.api.ItemDefinition; -import net.runelite.api.MessageNode; -import net.runelite.api.Player; -import net.runelite.api.VarPlayer; -import net.runelite.api.Varbits; -import net.runelite.api.WorldType; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.events.WidgetLoaded; -import static net.runelite.api.util.Text.sanitize; -import net.runelite.api.vars.AccountType; -import net.runelite.api.widgets.Widget; -import static net.runelite.api.widgets.WidgetID.KILL_LOGS_GROUP_ID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.chat.ChatColorType; -import net.runelite.client.chat.ChatCommandManager; -import net.runelite.client.chat.ChatMessageBuilder; -import net.runelite.client.chat.ChatMessageManager; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ChatInput; -import net.runelite.client.game.ItemManager; -import net.runelite.client.input.KeyManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.util.QuantityFormatter; -import net.runelite.http.api.chat.ChatClient; -import net.runelite.http.api.chat.Duels; -import net.runelite.http.api.hiscore.HiscoreClient; -import net.runelite.http.api.hiscore.HiscoreEndpoint; -import net.runelite.http.api.hiscore.HiscoreResult; -import net.runelite.http.api.hiscore.HiscoreSkill; -import net.runelite.http.api.hiscore.SingleHiscoreSkillResult; -import net.runelite.http.api.hiscore.Skill; -import net.runelite.http.api.item.ItemPrice; -import net.runelite.http.api.osbuddy.OSBGrandExchangeClient; -import org.apache.commons.text.WordUtils; - -@PluginDescriptor( - name = "Chat Commands", - description = "Enable chat commands", - tags = {"grand", "exchange", "level", "prices"}, - type = PluginType.UTILITY -) -@Singleton -@Slf4j -public class ChatCommandsPlugin extends Plugin -{ - private static final Pattern KILLCOUNT_PATTERN = Pattern.compile("Your (.+) (?:kill|harvest|lap|completion) count is: (\\d+)"); - private static final Pattern RAIDS_PATTERN = Pattern.compile("Your completed (.+) count is: (\\d+)"); - private static final Pattern RAIDS_DURATION_PATTERN = Pattern.compile("Congratulations - your raid is complete! Duration: ([0-9:]+)"); - private static final Pattern WINTERTODT_PATTERN = Pattern.compile("Your subdued Wintertodt count is: (\\d+)"); - private static final Pattern BARROWS_PATTERN = Pattern.compile("Your Barrows chest count is: (\\d+)"); - private static final Pattern KILL_DURATION_PATTERN = Pattern.compile("(?i)^(?:Fight |Lap |Challenge |Corrupted challenge )?duration: [0-9:]+\\. Personal best: ([0-9:]+)"); - private static final Pattern NEW_PB_PATTERN = Pattern.compile("(?i)^(?:Fight |Lap |Challenge |Corrupted challenge )?duration: ([0-9:]+) \\(new personal best\\)"); - private static final Pattern DUEL_ARENA_WINS_PATTERN = Pattern.compile("You (were defeated|won)! You have(?: now)? won (\\d+) duels?"); - private static final Pattern DUEL_ARENA_LOSSES_PATTERN = Pattern.compile("You have(?: now)? lost (\\d+) duels?"); - private static final String TOTAL_LEVEL_COMMAND_STRING = "!total"; - private static final String PRICE_COMMAND_STRING = "!price"; - private static final String LEVEL_COMMAND_STRING = "!lvl"; - private static final String CLUES_COMMAND_STRING = "!clues"; - private static final String KILLCOUNT_COMMAND_STRING = "!kc"; - private static final String CMB_COMMAND_STRING = "!cmb"; - private static final String QP_COMMAND_STRING = "!qp"; - private static final String GC_COMMAND_STRING = "!gc"; - private static final String PB_COMMAND = "!pb"; - private static final String DUEL_ARENA_COMMAND = "!duels"; - - private final HiscoreClient hiscoreClient = new HiscoreClient(); - private final ChatClient chatClient = new ChatClient(); - private final OSBGrandExchangeClient CLIENT = new OSBGrandExchangeClient(); - - private boolean logKills; - private HiscoreEndpoint hiscoreEndpoint; // hiscore endpoint for current player - private String lastBossKill; - private int lastPb = -1; - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private ChatCommandsConfig config; - - @Inject - private ConfigManager configManager; - - @Inject - private ItemManager itemManager; - - @Inject - private ChatMessageManager chatMessageManager; - - @Inject - private ChatCommandManager chatCommandManager; - - @Inject - private ScheduledExecutorService executor; - - @Inject - private KeyManager keyManager; - - @Inject - private ChatKeyboardListener chatKeyboardListener; - - /** - * Returns the ironman status based on the symbol in the name of the player. - * - * @param name player name - * @return hiscore endpoint - */ - private static HiscoreEndpoint getHiscoreEndpointByName(final String name) - { - if (name.contains(IconID.IRONMAN.toString())) - { - return toEndPoint(AccountType.IRONMAN); - } - else if (name.contains(IconID.ULTIMATE_IRONMAN.toString())) - { - return toEndPoint(AccountType.ULTIMATE_IRONMAN); - } - else if (name.contains(IconID.HARDCORE_IRONMAN.toString())) - { - return toEndPoint(AccountType.HARDCORE_IRONMAN); - } - else - { - return toEndPoint(AccountType.NORMAL); - } - } - - /** - * Converts account type to hiscore endpoint - * - * @param accountType account type - * @return hiscore endpoint - */ - private static HiscoreEndpoint toEndPoint(final AccountType accountType) - { - switch (accountType) - { - case IRONMAN: - return HiscoreEndpoint.IRONMAN; - case ULTIMATE_IRONMAN: - return HiscoreEndpoint.ULTIMATE_IRONMAN; - case HARDCORE_IRONMAN: - return HiscoreEndpoint.HARDCORE_IRONMAN; - default: - return HiscoreEndpoint.NORMAL; - } - } - - private static String longBossName(String boss) - { - switch (boss.toLowerCase()) - { - case "corp": - return "Corporeal Beast"; - - case "jad": - return "TzTok-Jad"; - - case "kq": - return "Kalphite Queen"; - - case "chaos ele": - return "Chaos Elemental"; - - case "dusk": - case "dawn": - case "gargs": - return "Grotesque Guardians"; - - case "crazy arch": - return "Crazy Archaeologist"; - - case "deranged arch": - return "Deranged Archaeologist"; - - case "mole": - return "Giant Mole"; - - case "vetion": - return "Vet'ion"; - - case "vene": - return "Venenatis"; - - case "kbd": - return "King Black Dragon"; - - case "vork": - return "Vorkath"; - - case "sire": - return "Abyssal Sire"; - - case "smoke devil": - case "thermy": - return "Thermonuclear Smoke Devil"; - - case "cerb": - return "Cerberus"; - - case "zuk": - case "inferno": - return "TzKal-Zuk"; - - case "hydra": - return "Alchemical Hydra"; - - // gwd - case "sara": - case "saradomin": - case "zilyana": - case "zily": - return "Commander Zilyana"; - case "zammy": - case "zamorak": - case "kril": - case "kril trutsaroth": - return "K'ril Tsutsaroth"; - case "arma": - case "kree": - case "kreearra": - case "armadyl": - return "Kree'arra"; - case "bando": - case "bandos": - case "graardor": - return "General Graardor"; - - // dks - case "supreme": - return "Dagannoth Supreme"; - case "rex": - return "Dagannoth Rex"; - case "prime": - return "Dagannoth Prime"; - - case "wt": - return "Wintertodt"; - case "barrows": - return "Barrows Chests"; - case "herbi": - return "Herbiboar"; - - // cox - case "cox": - case "xeric": - case "chambers": - case "olm": - case "raids": - return "Chambers of Xeric"; - - // cox cm - case "cox cm": - case "xeric cm": - case "chambers cm": - case "olm cm": - case "raids cm": - return "Chambers of Xeric Challenge Mode"; - - // tob - case "tob": - case "theatre": - case "verzik": - case "verzik vitur": - case "raids 2": - return "Theatre of Blood"; - - // agility course - case "prif": - case "prifddinas": - return "Prifddinas Agility Course"; - - // The Gauntlet - case "gaunt": - case "gauntlet": - return "Gauntlet"; - - // Corrupted Gauntlet - case "cgaunt": - case "cgauntlet": - return "Corrupted Gauntlet"; - - default: - return WordUtils.capitalize(boss); - } - } - - @Override - public void startUp() - { - - keyManager.registerKeyListener(chatKeyboardListener); - - chatCommandManager.registerCommandAsync(TOTAL_LEVEL_COMMAND_STRING, this::playerSkillLookup); - chatCommandManager.registerCommandAsync(CMB_COMMAND_STRING, this::combatLevelLookup); - chatCommandManager.registerCommand(PRICE_COMMAND_STRING, this::itemPriceLookup); - chatCommandManager.registerCommandAsync(LEVEL_COMMAND_STRING, this::playerSkillLookup); - chatCommandManager.registerCommandAsync(CLUES_COMMAND_STRING, this::clueLookup); - chatCommandManager.registerCommandAsync(KILLCOUNT_COMMAND_STRING, this::killCountLookup, this::killCountSubmit); - chatCommandManager.registerCommandAsync(QP_COMMAND_STRING, this::questPointsLookup, this::questPointsSubmit); - chatCommandManager.registerCommandAsync(GC_COMMAND_STRING, this::gambleCountLookup, this::gambleCountSubmit); - chatCommandManager.registerCommandAsync(PB_COMMAND, this::personalBestLookup, this::personalBestSubmit); - chatCommandManager.registerCommandAsync(DUEL_ARENA_COMMAND, this::duelArenaLookup, this::duelArenaSubmit); - } - - @Override - public void shutDown() - { - lastBossKill = null; - - keyManager.unregisterKeyListener(chatKeyboardListener); - - chatCommandManager.unregisterCommand(TOTAL_LEVEL_COMMAND_STRING); - chatCommandManager.unregisterCommand(CMB_COMMAND_STRING); - chatCommandManager.unregisterCommand(PRICE_COMMAND_STRING); - chatCommandManager.unregisterCommand(LEVEL_COMMAND_STRING); - chatCommandManager.unregisterCommand(CLUES_COMMAND_STRING); - chatCommandManager.unregisterCommand(KILLCOUNT_COMMAND_STRING); - chatCommandManager.unregisterCommand(QP_COMMAND_STRING); - chatCommandManager.unregisterCommand(PB_COMMAND); - chatCommandManager.unregisterCommand(GC_COMMAND_STRING); - chatCommandManager.unregisterCommand(DUEL_ARENA_COMMAND); - } - - @Provides - ChatCommandsConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(ChatCommandsConfig.class); - } - - private void setKc(String boss, int killcount) - { - configManager.setConfiguration("killcount." + client.getUsername().toLowerCase(), - boss.toLowerCase(), killcount); - } - - private int getKc(String boss) - { - Integer killCount = configManager.getConfiguration("killcount." + client.getUsername().toLowerCase(), - boss.toLowerCase(), int.class); - return killCount == null ? 0 : killCount; - } - - private void setPb(String boss, int seconds) - { - configManager.setConfiguration("personalbest." + client.getUsername().toLowerCase(), - boss.toLowerCase(), seconds); - } - - private int getPb(String boss) - { - Integer personalBest = configManager.getConfiguration("personalbest." + client.getUsername().toLowerCase(), - boss.toLowerCase(), int.class); - return personalBest == null ? 0 : personalBest; - } - - @Subscribe - void onChatMessage(ChatMessage chatMessage) - { - if (chatMessage.getType() != ChatMessageType.TRADE - && chatMessage.getType() != ChatMessageType.GAMEMESSAGE - && chatMessage.getType() != ChatMessageType.SPAM - && chatMessage.getType() != ChatMessageType.FRIENDSCHATNOTIFICATION) - { - return; - } - - String message = chatMessage.getMessage(); - Matcher matcher = KILLCOUNT_PATTERN.matcher(message); - if (matcher.find()) - { - String boss = matcher.group(1); - int kc = Integer.parseInt(matcher.group(2)); - - setKc(boss, kc); - // We either already have the pb, or need to remember the boss for the upcoming pb - if (lastPb > -1) - { - log.debug("Got out-of-order personal best for {}: {}", boss, lastPb); - setPb(boss, lastPb); - lastPb = -1; - } - else - { - lastBossKill = boss; - } - return; - } - - matcher = WINTERTODT_PATTERN.matcher(message); - if (matcher.find()) - { - int kc = Integer.parseInt(matcher.group(1)); - - setKc("Wintertodt", kc); - } - - matcher = RAIDS_PATTERN.matcher(message); - if (matcher.find()) - { - String boss = matcher.group(1); - int kc = Integer.parseInt(matcher.group(2)); - - setKc(boss, kc); - if (lastPb > -1) - { - // lastPb contains the last raid duration and not the personal best, because the raid - // complete message does not include the pb. We have to check if it is a new pb: - int currentPb = getPb(boss); - if (currentPb <= 0 || lastPb < currentPb) - { - setPb(boss, lastPb); - } - lastPb = -1; - } - lastBossKill = boss; - return; - } - - matcher = DUEL_ARENA_WINS_PATTERN.matcher(message); - if (matcher.find()) - { - final int oldWins = getKc("Duel Arena Wins"); - final int wins = Integer.parseInt(matcher.group(2)); - final String result = matcher.group(1); - int winningStreak = getKc("Duel Arena Win Streak"); - int losingStreak = getKc("Duel Arena Lose Streak"); - - if (result.equals("won") && wins > oldWins) - { - losingStreak = 0; - winningStreak += 1; - } - else if (result.equals("were defeated")) - { - losingStreak += 1; - winningStreak = 0; - } - else - { - log.warn("unrecognized duel streak chat message: {}", message); - } - - setKc("Duel Arena Wins", wins); - setKc("Duel Arena Win Streak", winningStreak); - setKc("Duel Arena Lose Streak", losingStreak); - } - - matcher = DUEL_ARENA_LOSSES_PATTERN.matcher(message); - if (matcher.find()) - { - int losses = Integer.parseInt(matcher.group(1)); - - setKc("Duel Arena Losses", losses); - } - - matcher = BARROWS_PATTERN.matcher(message); - if (matcher.find()) - { - int kc = Integer.parseInt(matcher.group(1)); - - setKc("Barrows Chests", kc); - } - - matcher = KILL_DURATION_PATTERN.matcher(message); - if (matcher.find()) - { - matchPb(matcher); - } - - matcher = NEW_PB_PATTERN.matcher(message); - if (matcher.find()) - { - matchPb(matcher); - } - - matcher = RAIDS_DURATION_PATTERN.matcher(message); - if (matcher.find()) - { - matchPb(matcher); - } - - lastBossKill = null; - } - - private static int timeStringToSeconds(String timeString) - { - String[] s = timeString.split(":"); - if (s.length == 2) // mm:ss - { - return Integer.parseInt(s[0]) * 60 + Integer.parseInt(s[1]); - } - else if (s.length == 3) // h:mm:ss - { - return Integer.parseInt(s[0]) * 60 * 60 + Integer.parseInt(s[1]) * 60 + Integer.parseInt(s[2]); - } - return Integer.parseInt(timeString); - } - - private void matchPb(Matcher matcher) - { - int seconds = timeStringToSeconds(matcher.group(1)); - if (lastBossKill != null) - { - // Most bosses sent boss kill message, and then pb message, so we - // use the remembered lastBossKill - log.debug("Got personal best for {}: {}", lastBossKill, seconds); - setPb(lastBossKill, seconds); - lastPb = -1; - } - else - { - // Some bosses send the pb message, and then the kill message! - lastPb = seconds; - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - if (!logKills) - { - return; - } - - logKills = false; - - Widget title = client.getWidget(WidgetInfo.KILL_LOG_TITLE); - Widget bossMonster = client.getWidget(WidgetInfo.KILL_LOG_MONSTER); - Widget bossKills = client.getWidget(WidgetInfo.KILL_LOG_KILLS); - - if (title == null || bossMonster == null || bossKills == null - || !"Boss Kill Log".equals(title.getText())) - { - return; - } - - Widget[] bossChildren = bossMonster.getChildren(); - Widget[] killsChildren = bossKills.getChildren(); - - for (int i = 0; i < bossChildren.length; ++i) - { - Widget boss = bossChildren[i]; - Widget kill = killsChildren[i]; - - String bossName = boss.getText().replace(":", ""); - int kc = Integer.parseInt(kill.getText().replace(",", "")); - if (kc != getKc(bossName)) - { - setKc(bossName, kc); - } - } - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded widget) - { - // don't load kc if in an instance, if the player is in another players poh - // and reading their boss log - if (widget.getGroupId() != KILL_LOGS_GROUP_ID || client.isInInstancedRegion()) - { - return; - } - - logKills = true; - } - - @Subscribe - private void onVarbitChanged(VarbitChanged varbitChanged) - { - hiscoreEndpoint = getLocalHiscoreEndpointType(); - } - - private boolean killCountSubmit(ChatInput chatInput, String value) - { - int idx = value.indexOf(' '); - final String boss = longBossName(value.substring(idx + 1)); - - final int kc = getKc(boss); - if (kc <= 0) - { - return false; - } - - final String playerName = client.getLocalPlayer().getName(); - - executor.execute(() -> - { - try - { - chatClient.submitKc(playerName, boss, kc); - } - catch (Exception ex) - { - log.warn("unable to submit killcount", ex); - } - finally - { - chatInput.resume(); - } - }); - - return true; - } - - private void killCountLookup(ChatMessage chatMessage, String message) - { - if (!config.killcount()) - { - return; - } - - if (message.length() <= KILLCOUNT_COMMAND_STRING.length()) - { - return; - } - - ChatMessageType type = chatMessage.getType(); - String search = message.substring(KILLCOUNT_COMMAND_STRING.length() + 1); - - final String player; - if (type.equals(ChatMessageType.PRIVATECHATOUT)) - { - player = client.getLocalPlayer().getName(); - } - else - { - player = sanitize(chatMessage.getName()); - } - - search = longBossName(search); - - final int kc; - try - { - kc = chatClient.getKc(player, search); - } - catch (IOException ex) - { - log.debug("unable to lookup killcount", ex); - return; - } - - String response = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append(search) - .append(ChatColorType.NORMAL) - .append(" kill count: ") - .append(ChatColorType.HIGHLIGHT) - .append(Integer.toString(kc)) - .build(); - - log.debug("Setting response {}", response); - final MessageNode messageNode = chatMessage.getMessageNode(); - messageNode.setRuneLiteFormatMessage(response); - chatMessageManager.update(messageNode); - client.refreshChat(); - } - - private boolean duelArenaSubmit(ChatInput chatInput, String value) - { - final int wins = getKc("Duel Arena Wins"); - final int losses = getKc("Duel Arena Losses"); - final int winningStreak = getKc("Duel Arena Win Streak"); - final int losingStreak = getKc("Duel Arena Lose Streak"); - - if (wins <= 0 && losses <= 0 && winningStreak <= 0 && losingStreak <= 0) - { - return false; - } - - final String playerName = client.getLocalPlayer().getName(); - - executor.execute(() -> - { - try - { - chatClient.submitDuels(playerName, wins, losses, winningStreak, losingStreak); - } - catch (Exception ex) - { - log.warn("unable to submit duels", ex); - } - finally - { - chatInput.resume(); - } - }); - - return true; - } - - private void duelArenaLookup(ChatMessage chatMessage, String message) - { - if (!config.duels()) - { - return; - } - - ChatMessageType type = chatMessage.getType(); - - final String player; - if (type == ChatMessageType.PRIVATECHATOUT) - { - player = client.getLocalPlayer().getName(); - } - else - { - player = sanitize(chatMessage.getName()); - } - - Duels duels; - try - { - duels = chatClient.getDuels(player); - } - catch (IOException ex) - { - log.debug("unable to lookup duels", ex); - return; - } - - final int wins = duels.getWins(); - final int losses = duels.getLosses(); - final int winningStreak = duels.getWinningStreak(); - final int losingStreak = duels.getLosingStreak(); - - String response = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Duel Arena wins: ") - .append(ChatColorType.HIGHLIGHT) - .append(Integer.toString(wins)) - .append(ChatColorType.NORMAL) - .append(" losses: ") - .append(ChatColorType.HIGHLIGHT) - .append(Integer.toString(losses)) - .append(ChatColorType.NORMAL) - .append(" streak: ") - .append(ChatColorType.HIGHLIGHT) - .append(Integer.toString((winningStreak != 0 ? winningStreak : -losingStreak))) - .build(); - - log.debug("Setting response {}", response); - final MessageNode messageNode = chatMessage.getMessageNode(); - messageNode.setRuneLiteFormatMessage(response); - chatMessageManager.update(messageNode); - client.refreshChat(); - } - - private void questPointsLookup(ChatMessage chatMessage, String message) - { - if (!config.qp()) - { - return; - } - - ChatMessageType type = chatMessage.getType(); - - final String player; - if (type.equals(ChatMessageType.PRIVATECHATOUT)) - { - player = client.getLocalPlayer().getName(); - } - else - { - player = sanitize(chatMessage.getName()); - } - - int qp; - try - { - qp = chatClient.getQp(player); - } - catch (IOException ex) - { - log.debug("unable to lookup quest points", ex); - return; - } - - String response = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Quest points: ") - .append(ChatColorType.HIGHLIGHT) - .append(Integer.toString(qp)) - .build(); - - log.debug("Setting response {}", response); - final MessageNode messageNode = chatMessage.getMessageNode(); - messageNode.setRuneLiteFormatMessage(response); - chatMessageManager.update(messageNode); - client.refreshChat(); - } - - private boolean questPointsSubmit(ChatInput chatInput, String value) - { - final int qp = client.getVar(VarPlayer.QUEST_POINTS); - final String playerName = client.getLocalPlayer().getName(); - - executor.execute(() -> - { - try - { - chatClient.submitQp(playerName, qp); - } - catch (Exception ex) - { - log.warn("unable to submit quest points", ex); - } - finally - { - chatInput.resume(); - } - }); - - return true; - } - - private void gambleCountLookup(ChatMessage chatMessage, String message) - { - if (!config.gc()) - { - return; - } - - ChatMessageType type = chatMessage.getType(); - - final String player; - if (type.equals(ChatMessageType.PRIVATECHAT)) - { - player = client.getLocalPlayer().getName(); - } - else - { - player = sanitize(chatMessage.getName()); - } - - int gc; - try - { - gc = chatClient.getGc(player); - log.info("gc lookup"); - } - catch (IOException ex) - { - log.debug("unable to lookup gamble count", ex); - log.info("gc lookup error"); - return; - } - - String response = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Barbarian Assault High-level gambles: ") - .append(ChatColorType.HIGHLIGHT) - .append(Integer.toString(gc)) - .build(); - - log.debug("Setting response {}", response); - final MessageNode messageNode = chatMessage.getMessageNode(); - messageNode.setRuneLiteFormatMessage(response); - chatMessageManager.update(messageNode); - client.refreshChat(); - } - - private boolean gambleCountSubmit(ChatInput chatInput, String value) - { - final int gc = client.getVar(Varbits.BA_GC); - final String playerName = client.getLocalPlayer().getName(); - - executor.execute(() -> - { - try - { - chatClient.submitGc(playerName, gc); - } - catch (Exception ex) - { - log.warn("unable to submit gamble count", ex); - } - finally - { - chatInput.resume(); - } - }); - - return true; - } - - private void personalBestLookup(ChatMessage chatMessage, String message) - { - if (!config.pb()) - { - return; - } - - if (message.length() <= PB_COMMAND.length()) - { - return; - } - - ChatMessageType type = chatMessage.getType(); - String search = message.substring(PB_COMMAND.length() + 1); - - final String player; - if (type.equals(ChatMessageType.PRIVATECHATOUT)) - { - player = client.getLocalPlayer().getName(); - } - else - { - player = sanitize(chatMessage.getName()); - } - - search = longBossName(search); - - final int pb; - try - { - pb = chatClient.getPb(player, search); - } - catch (IOException ex) - { - log.debug("unable to lookup personal best", ex); - return; - } - - int minutes = pb / 60; - int seconds = pb % 60; - - String response = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append(search) - .append(ChatColorType.NORMAL) - .append(" personal best: ") - .append(ChatColorType.HIGHLIGHT) - .append(String.format("%d:%02d", minutes, seconds)) - .build(); - - log.debug("Setting response {}", response); - final MessageNode messageNode = chatMessage.getMessageNode(); - messageNode.setRuneLiteFormatMessage(response); - chatMessageManager.update(messageNode); - client.refreshChat(); - } - - private boolean personalBestSubmit(ChatInput chatInput, String value) - { - int idx = value.indexOf(' '); - final String boss = longBossName(value.substring(idx + 1)); - - final int pb = getPb(boss); - if (pb <= 0) - { - return false; - } - - final String playerName = client.getLocalPlayer().getName(); - - executor.execute(() -> - { - try - { - chatClient.submitPb(playerName, boss, pb); - } - catch (Exception ex) - { - log.warn("unable to submit personal best", ex); - } - finally - { - chatInput.resume(); - } - }); - - return true; - } - - /** - * Looks up the item price and changes the original message to the - * response. - * - * @param chatMessage The chat message containing the command. - * @param message The chat message - */ - private void itemPriceLookup(ChatMessage chatMessage, String message) - { - if (!config.price()) - { - return; - } - - if (message.length() <= PRICE_COMMAND_STRING.length()) - { - return; - } - - MessageNode messageNode = chatMessage.getMessageNode(); - String search = message.substring(PRICE_COMMAND_STRING.length() + 1); - - List results = itemManager.search(search); - - if (!results.isEmpty()) - { - ItemPrice item = retrieveFromList(results, search); - CLIENT.lookupItem(item.getId()) - .subscribeOn(Schedulers.io()) - .observeOn(Schedulers.single()) - .subscribe( - (osbresult) -> - { - int itemId = item.getId(); - int itemPrice = itemManager.getItemPrice(itemId); - - final ChatMessageBuilder builder = new ChatMessageBuilder(); - builder.append(ChatColorType.NORMAL); - builder.append(ChatColorType.HIGHLIGHT); - builder.append(item.getName()); - builder.append(ChatColorType.NORMAL); - builder.append(": GE "); - builder.append(ChatColorType.HIGHLIGHT); - builder.append(QuantityFormatter.formatNumber(itemPrice)); - builder.append(ChatColorType.NORMAL); - builder.append(": OSB "); - builder.append(ChatColorType.HIGHLIGHT); - builder.append(QuantityFormatter.formatNumber(osbresult.getOverall_average())); - - ItemDefinition itemComposition = itemManager.getItemDefinition(itemId); - if (itemComposition != null) - { - int alchPrice = itemManager.getAlchValue(itemId); - builder - .append(ChatColorType.NORMAL) - .append(" HA value ") - .append(ChatColorType.HIGHLIGHT) - .append(QuantityFormatter.formatNumber(alchPrice)); - } - - String response = builder.build(); - - log.debug("Setting response {}", response); - messageNode.setRuneLiteFormatMessage(response); - chatMessageManager.update(messageNode); - client.refreshChat(); - } - ); - } - } - - /** - * Looks up the player skill and changes the original message to the - * response. - * - * @param chatMessage The chat message containing the command. - * @param message The chat message - */ - private void playerSkillLookup(ChatMessage chatMessage, String message) - { - if (!config.lvl()) - { - return; - } - - String search; - if (message.equalsIgnoreCase(TOTAL_LEVEL_COMMAND_STRING)) - { - search = "total"; - } - else - { - if (message.length() <= LEVEL_COMMAND_STRING.length()) - { - return; - } - - search = message.substring(LEVEL_COMMAND_STRING.length() + 1); - } - - search = SkillAbbreviations.getFullName(search); - final HiscoreSkill skill; - try - { - skill = HiscoreSkill.valueOf(search.toUpperCase()); - } - catch (IllegalArgumentException i) - { - return; - } - - final HiscoreLookup lookup = getCorrectLookupFor(chatMessage); - - try - { - final SingleHiscoreSkillResult result = hiscoreClient.lookup(lookup.getName(), skill, lookup.getEndpoint()); - - if (result == null) - { - log.warn("unable to look up skill {} for {}: not found", skill, search); - return; - } - - final Skill hiscoreSkill = result.getSkill(); - - final String response = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Level ") - .append(ChatColorType.HIGHLIGHT) - .append(skill.getName()).append(": ").append(String.valueOf(hiscoreSkill.getLevel())) - .append(ChatColorType.NORMAL) - .append(" Experience: ") - .append(ChatColorType.HIGHLIGHT) - .append(String.format("%,d", hiscoreSkill.getExperience())) - .append(ChatColorType.NORMAL) - .append(" Rank: ") - .append(ChatColorType.HIGHLIGHT) - .append(String.format("%,d", hiscoreSkill.getRank())) - .build(); - - log.debug("Setting response {}", response); - final MessageNode messageNode = chatMessage.getMessageNode(); - messageNode.setRuneLiteFormatMessage(response); - chatMessageManager.update(messageNode); - client.refreshChat(); - } - catch (IOException ex) - { - log.warn("unable to look up skill {} for {}", skill, search, ex); - } - } - - private void combatLevelLookup(ChatMessage chatMessage, String message) - { - if (!config.lvl()) - { - return; - } - - ChatMessageType type = chatMessage.getType(); - - String player; - if (type == ChatMessageType.PRIVATECHATOUT) - { - player = client.getLocalPlayer().getName(); - } - else - { - player = sanitize(chatMessage.getName()); - } - - try - { - HiscoreResult playerStats = hiscoreClient.lookup(player); - - if (playerStats == null) - { - log.warn("Error fetching hiscore data: not found"); - return; - } - - int attack = playerStats.getAttack().getLevel(); - int strength = playerStats.getStrength().getLevel(); - int defence = playerStats.getDefence().getLevel(); - int hitpoints = playerStats.getHitpoints().getLevel(); - int ranged = playerStats.getRanged().getLevel(); - int prayer = playerStats.getPrayer().getLevel(); - int magic = playerStats.getMagic().getLevel(); - int combatLevel = Experience.getCombatLevel(attack, strength, defence, hitpoints, magic, ranged, prayer); - - String response = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Combat Level: ") - .append(ChatColorType.HIGHLIGHT) - .append(String.valueOf(combatLevel)) - .append(ChatColorType.NORMAL) - .append(" A: ") - .append(ChatColorType.HIGHLIGHT) - .append(String.valueOf(attack)) - .append(ChatColorType.NORMAL) - .append(" S: ") - .append(ChatColorType.HIGHLIGHT) - .append(String.valueOf(strength)) - .append(ChatColorType.NORMAL) - .append(" D: ") - .append(ChatColorType.HIGHLIGHT) - .append(String.valueOf(defence)) - .append(ChatColorType.NORMAL) - .append(" H: ") - .append(ChatColorType.HIGHLIGHT) - .append(String.valueOf(hitpoints)) - .append(ChatColorType.NORMAL) - .append(" R: ") - .append(ChatColorType.HIGHLIGHT) - .append(String.valueOf(ranged)) - .append(ChatColorType.NORMAL) - .append(" P: ") - .append(ChatColorType.HIGHLIGHT) - .append(String.valueOf(prayer)) - .append(ChatColorType.NORMAL) - .append(" M: ") - .append(ChatColorType.HIGHLIGHT) - .append(String.valueOf(magic)) - .build(); - - log.debug("Setting response {}", response); - final MessageNode messageNode = chatMessage.getMessageNode(); - messageNode.setRuneLiteFormatMessage(response); - chatMessageManager.update(messageNode); - client.refreshChat(); - } - catch (IOException ex) - { - log.warn("Error fetching hiscore data", ex); - } - } - - private void clueLookup(ChatMessage chatMessage, String message) - { - if (!config.clue()) - { - return; - } - - String search; - - if (message.equalsIgnoreCase(CLUES_COMMAND_STRING)) - { - search = "total"; - } - else - { - search = message.substring(CLUES_COMMAND_STRING.length() + 1); - } - - try - { - final Skill hiscoreSkill; - final HiscoreLookup lookup = getCorrectLookupFor(chatMessage); - final HiscoreResult result = hiscoreClient.lookup(lookup.getName(), lookup.getEndpoint()); - - if (result == null) - { - log.warn("error looking up clues: not found"); - return; - } - - String level = search.toLowerCase(); - - switch (level) - { - case "beginner": - hiscoreSkill = result.getClueScrollBeginner(); - break; - case "easy": - hiscoreSkill = result.getClueScrollEasy(); - break; - case "medium": - hiscoreSkill = result.getClueScrollMedium(); - break; - case "hard": - hiscoreSkill = result.getClueScrollHard(); - break; - case "elite": - hiscoreSkill = result.getClueScrollElite(); - break; - case "master": - hiscoreSkill = result.getClueScrollMaster(); - break; - case "total": - hiscoreSkill = result.getClueScrollAll(); - break; - default: - return; - } - - int quantity = hiscoreSkill.getLevel(); - int rank = hiscoreSkill.getRank(); - if (quantity == -1) - { - return; - } - - ChatMessageBuilder chatMessageBuilder = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Clue scroll (" + level + ")").append(": ") - .append(ChatColorType.HIGHLIGHT) - .append(Integer.toString(quantity)); - - if (rank != -1) - { - chatMessageBuilder.append(ChatColorType.NORMAL) - .append(" Rank: ") - .append(ChatColorType.HIGHLIGHT) - .append(String.format("%,d", rank)); - } - - String response = chatMessageBuilder.build(); - - log.debug("Setting response {}", response); - final MessageNode messageNode = chatMessage.getMessageNode(); - messageNode.setRuneLiteFormatMessage(response); - chatMessageManager.update(messageNode); - client.refreshChat(); - } - catch (IOException ex) - { - log.warn("error looking up clues", ex); - } - } - - /** - * Gets correct lookup data for message - * - * @param chatMessage chat message - * @return hiscore lookup data - */ - private HiscoreLookup getCorrectLookupFor(final ChatMessage chatMessage) - { - Player localPlayer = client.getLocalPlayer(); - final String player = sanitize(chatMessage.getName()); - - // If we are sending the message then just use the local hiscore endpoint for the world - if (chatMessage.getType().equals(ChatMessageType.PRIVATECHATOUT) - || player.equals(localPlayer.getName())) - { - return new HiscoreLookup(localPlayer.getName(), hiscoreEndpoint); - } - - // Public chat on a leagues world is always league hiscores, regardless of icon - if (chatMessage.getType() == ChatMessageType.PUBLICCHAT || chatMessage.getType() == ChatMessageType.MODCHAT) - { - if (client.getWorldType().contains(WorldType.LEAGUE)) - { - return new HiscoreLookup(player, HiscoreEndpoint.LEAGUE); - } - } - - // Get ironman status from their icon in chat - HiscoreEndpoint endpoint = getHiscoreEndpointByName(chatMessage.getName()); - return new HiscoreLookup(player, endpoint); - } - - /** - * Compares the names of the items in the list with the original input. - * Returns the item if its name is equal to the original input or the - * shortest match if no exact match is found. - * - * @param items List of items. - * @param originalInput String with the original input. - * @return Item which has a name equal to the original input. - */ - private ItemPrice retrieveFromList(List items, String originalInput) - { - ItemPrice shortest = null; - for (ItemPrice item : items) - { - if (item.getName().equalsIgnoreCase(originalInput.toLowerCase())) - { - return item; - } - - if (shortest == null || item.getName().length() < shortest.getName().length()) - { - shortest = item; - } - } - - // Take a guess - return shortest; - } - - /** - * Looks up the ironman status of the local player. Does NOT work on other players. - * - * @return hiscore endpoint - */ - private HiscoreEndpoint getLocalHiscoreEndpointType() - { - EnumSet worldType = client.getWorldType(); - if (worldType.contains(WorldType.LEAGUE)) - { - return HiscoreEndpoint.LEAGUE; - } - - return toEndPoint(client.getAccountType()); - } - - @Value - private static class HiscoreLookup - { - private final String name; - private final HiscoreEndpoint endpoint; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatKeyboardListener.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatKeyboardListener.java deleted file mode 100644 index 2da4f1c12c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatKeyboardListener.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2018, 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.chatcommands; - -import java.awt.event.KeyEvent; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.ScriptID; -import net.runelite.api.VarClientInt; -import net.runelite.api.VarClientStr; -import net.runelite.api.vars.InputType; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.input.KeyListener; - -@Singleton -class ChatKeyboardListener implements KeyListener -{ - @Inject - private ChatCommandsConfig chatCommandsConfig; - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Override - public void keyTyped(KeyEvent e) - { - - } - - @Override - public void keyPressed(KeyEvent e) - { - if (chatCommandsConfig.clearSingleWord().matches(e)) - { - int inputTye = client.getVar(VarClientInt.INPUT_TYPE); - String input = inputTye == InputType.NONE.getType() - ? client.getVar(VarClientStr.CHATBOX_TYPED_TEXT) - : client.getVar(VarClientStr.INPUT_TEXT); - - if (input != null) - { - // remove trailing space - while (input.endsWith(" ")) - { - input = input.substring(0, input.length() - 1); - } - - // find next word - int idx = input.lastIndexOf(' '); - final String replacement; - if (idx != -1) - { - replacement = input.substring(0, idx); - } - else - { - replacement = ""; - } - - clientThread.invoke(() -> applyText(inputTye, replacement)); - } - } - else if (chatCommandsConfig.clearChatBox().matches(e)) - { - int inputTye = client.getVar(VarClientInt.INPUT_TYPE); - clientThread.invoke(() -> applyText(inputTye, "")); - } - } - - private void applyText(int inputType, String replacement) - { - if (inputType == InputType.NONE.getType()) - { - client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, replacement); - client.runScript(ScriptID.CHAT_PROMPT_INIT); - } - else if (inputType == InputType.PRIVATE_MESSAGE.getType()) - { - client.setVar(VarClientStr.INPUT_TEXT, replacement); - client.runScript(ScriptID.CHAT_TEXT_INPUT_REBUILD, ""); - } - } - - @Override - public void keyReleased(KeyEvent e) - { - - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/SkillAbbreviations.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/SkillAbbreviations.java deleted file mode 100644 index 754c2f869e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/SkillAbbreviations.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2017, 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.chatcommands; - -import com.google.common.collect.ImmutableMap; -import java.util.Map; -import net.runelite.api.Skill; - -class SkillAbbreviations -{ - private static final Map MAP; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - builder.put("ATK", Skill.ATTACK.getName()); - builder.put("ATT", Skill.ATTACK.getName()); - builder.put("DEF", Skill.DEFENCE.getName()); - builder.put("STR", Skill.STRENGTH.getName()); - builder.put("HEALTH", Skill.HITPOINTS.getName()); - builder.put("HIT", Skill.HITPOINTS.getName()); - builder.put("HITPOINT", Skill.HITPOINTS.getName()); - builder.put("HP", Skill.HITPOINTS.getName()); - builder.put("RANGE", Skill.RANGED.getName()); - builder.put("RANGING", Skill.RANGED.getName()); - builder.put("RNG", Skill.RANGED.getName()); - builder.put("PRAY", Skill.PRAYER.getName()); - builder.put("MAG", Skill.MAGIC.getName()); - builder.put("MAGE", Skill.MAGIC.getName()); - builder.put("COOK", Skill.COOKING.getName()); - builder.put("WC", Skill.WOODCUTTING.getName()); - builder.put("WOOD", Skill.WOODCUTTING.getName()); - builder.put("WOODCUT", Skill.WOODCUTTING.getName()); - builder.put("FLETCH", Skill.FLETCHING.getName()); - builder.put("FISH", Skill.FISHING.getName()); - builder.put("FM", Skill.FIREMAKING.getName()); - builder.put("FIRE", Skill.FIREMAKING.getName()); - builder.put("CRAFT", Skill.CRAFTING.getName()); - builder.put("SMITH", Skill.SMITHING.getName()); - builder.put("MINE", Skill.MINING.getName()); - builder.put("HL", Skill.HERBLORE.getName()); - builder.put("HERB", Skill.HERBLORE.getName()); - builder.put("AGI", Skill.AGILITY.getName()); - builder.put("AGIL", Skill.AGILITY.getName()); - builder.put("THIEF", Skill.THIEVING.getName()); - builder.put("SLAY", Skill.SLAYER.getName()); - builder.put("FARM", Skill.FARMING.getName()); - builder.put("RC", Skill.RUNECRAFT.getName()); - builder.put("RUNE", Skill.RUNECRAFT.getName()); - builder.put("RUNECRAFTING", Skill.RUNECRAFT.getName()); - builder.put("HUNT", Skill.HUNTER.getName()); - builder.put("CON", Skill.CONSTRUCTION.getName()); - builder.put("CONSTRUCT", Skill.CONSTRUCTION.getName()); - builder.put("ALL", Skill.OVERALL.getName()); - builder.put("TOTAL", Skill.OVERALL.getName()); - MAP = builder.build(); - } - - /** - * Takes a string representing the name of a skill, and if abbreviated, - * expands it into its full canonical name. Case-insensitive. - * - * @param abbrev Skill name that may be abbreviated. - * @return Full skill name if recognized, else the original string. - */ - static String getFullName(String abbrev) - { - return MAP.getOrDefault(abbrev.toUpperCase(), abbrev); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterConfig.java deleted file mode 100644 index dbdb4d6478..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterConfig.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2018, Magic fTail - * Copyright (c) 2019, osrs-music-map - * 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.chatfilter; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("chatfilter") -public interface ChatFilterConfig extends Config -{ - @ConfigItem( - keyName = "filterType", - name = "Filter type", - description = "Configures how the messages are filtered", - position = 1 - ) - default ChatFilterType filterType() - { - return ChatFilterType.CENSOR_WORDS; - } - - @ConfigItem( - keyName = "filteredWords", - name = "Filtered Words", - description = "List of filtered words, separated by commas", - position = 2 - ) - default String filteredWords() - { - return ""; - } - - @ConfigItem( - keyName = "filteredRegex", - name = "Filtered Regex", - description = "List of regular expressions to filter, one per line", - position = 3 - ) - default String filteredRegex() - { - return ""; - } - - @ConfigItem( - keyName = "filterFriends", - name = "Filter Friends", - description = "Filter your friends' messages", - position = 4 - ) - default boolean filterFriends() - { - return false; - } - - @ConfigItem( - keyName = "filterClan", - name = "Filter Clan Chat Members", - description = "Filter your clan chat members' messages", - position = 5 - ) - default boolean filterClan() - { - return false; - } - - @ConfigItem( - keyName = "filterLogin", - name = "Filter Logged In/Out Messages", - description = "Filter your private chat to remove logged in/out messages", - position = 6 - ) - default boolean filterLogin() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterPlugin.java deleted file mode 100644 index 9e84d1701b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterPlugin.java +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Copyright (c) 2018, Magic fTail - * Copyright (c) 2019, osrs-music-map - * 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.chatfilter; - -import com.google.common.base.CharMatcher; -import com.google.common.base.Splitter; -import com.google.inject.Provides; -import java.util.List; -import java.util.Objects; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Setter; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.MessageNode; -import net.runelite.api.Player; -import net.runelite.api.events.OverheadTextChanged; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.api.util.Text; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import org.apache.commons.lang3.StringUtils; - -@PluginDescriptor( - name = "Chat Filter", - description = "Censor user configurable words or patterns from chat", - enabledByDefault = false, - type = PluginType.MISCELLANEOUS -) -@Singleton -public class ChatFilterPlugin extends Plugin -{ - private static final Splitter NEWLINE_SPLITTER = Splitter - .on("\n") - .omitEmptyStrings() - .trimResults(); - - private static final String CENSOR_MESSAGE = "Hey, everyone, I just tried to say something very silly!"; - - private final CharMatcher jagexPrintableCharMatcher = Text.JAGEX_PRINTABLE_CHAR_MATCHER; - private final List filteredPatterns = new CopyOnWriteArrayList<>(); - - @Inject - private Client client; - - @Inject - private ChatFilterConfig config; - - @Setter(AccessLevel.PACKAGE) - private ChatFilterType filterType; - @Setter(AccessLevel.PACKAGE) - private String filteredWords; - @Setter(AccessLevel.PACKAGE) - private String filteredRegex; - @Setter(AccessLevel.PACKAGE) - private boolean filterFriends; - @Setter(AccessLevel.PACKAGE) - private boolean filterClan; - - @Provides - ChatFilterConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(ChatFilterConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - updateFilteredPatterns(); - client.refreshChat(); - } - - @Override - protected void shutDown() - { - filteredPatterns.clear(); - client.refreshChat(); - } - - @Subscribe - private void onScriptCallbackEvent(ScriptCallbackEvent event) - { - if (!"chatFilterCheck".equals(event.getEventName())) - { - return; - } - - int[] intStack = client.getIntStack(); - int intStackSize = client.getIntStackSize(); - int messageType = intStack[intStackSize - 2]; - int messageId = intStack[intStackSize - 1]; - - ChatMessageType chatMessageType = ChatMessageType.of(messageType); - - // Only filter public chat and private messages - switch (chatMessageType) - { - case PUBLICCHAT: - case MODCHAT: - case AUTOTYPER: - case PRIVATECHAT: - case MODPRIVATECHAT: - case FRIENDSCHAT: - case GAMEMESSAGE: - break; - case LOGINLOGOUTNOTIFICATION: - if (config.filterLogin()) - { - // Block the message - intStack[intStackSize - 3] = 0; - } - return; - default: - return; - } - - MessageNode messageNode = (MessageNode) client.getMessages().get(messageId); - - if (client.getLocalPlayer().getName().equals(messageNode.getName()) || - !this.filterFriends && messageNode.isFromFriend() || - !this.filterClan && messageNode.isFromClanMate()) - { - return; - } - - String[] stringStack = client.getStringStack(); - int stringStackSize = client.getStringStackSize(); - - String message = stringStack[stringStackSize - 1]; - String censoredMessage = censorMessage(message); - - if (censoredMessage == null) - { - // Block the message - intStack[intStackSize - 3] = 0; - } - else - { - // Replace the message - stringStack[stringStackSize - 1] = censoredMessage; - } - } - - @Subscribe - private void onOverheadTextChanged(OverheadTextChanged event) - { - if (!(event.getActor() instanceof Player) || event.getActor().getName() == null || !shouldFilterPlayerMessage(event.getActor().getName())) - { - return; - } - - String message = censorMessage(event.getOverheadText()); - - if (message == null) - { - message = " "; - } - - event.getActor().setOverheadText(message); - } - - boolean shouldFilterPlayerMessage(String playerName) - { - boolean isMessageFromSelf = playerName.equals(client.getLocalPlayer().getName()); - return !isMessageFromSelf && - (this.filterFriends || !client.isFriended(playerName, false)) && - (this.filterClan || !client.isClanMember(playerName)); - } - - String censorMessage(final String message) - { - String strippedMessage = jagexPrintableCharMatcher.retainFrom(message) - .replace('\u00A0', ' '); - boolean filtered = false; - for (Pattern pattern : filteredPatterns) - { - Matcher m = pattern.matcher(strippedMessage); - - StringBuffer sb = new StringBuffer(); - - while (m.find()) - { - switch (this.filterType) - { - case CENSOR_WORDS: - m.appendReplacement(sb, StringUtils.repeat("*", m.group(0).length())); - filtered = true; - break; - case CENSOR_MESSAGE: - return CENSOR_MESSAGE; - case REMOVE_MESSAGE: - return null; - } - } - m.appendTail(sb); - - strippedMessage = sb.toString(); - } - - return filtered ? strippedMessage : message; - } - - void updateFilteredPatterns() - { - filteredPatterns.clear(); - - Text.fromCSV(this.filteredWords).stream() - .map(s -> Pattern.compile(Pattern.quote(s), Pattern.CASE_INSENSITIVE)) - .forEach(filteredPatterns::add); - - NEWLINE_SPLITTER.splitToList(this.filteredRegex).stream() - .map(s -> - { - try - { - return Pattern.compile(s, Pattern.CASE_INSENSITIVE); - } - catch (PatternSyntaxException ex) - { - return null; - } - }) - .filter(Objects::nonNull) - .forEach(filteredPatterns::add); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!"chatfilter".equals(event.getGroup())) - { - return; - } - - updateConfig(); - updateFilteredPatterns(); - - //Refresh chat after config change to reflect current rules - client.refreshChat(); - } - - private void updateConfig() - { - this.filterType = config.filterType(); - this.filteredWords = config.filteredWords(); - this.filteredRegex = config.filteredRegex(); - this.filterFriends = config.filterFriends(); - this.filterClan = config.filterClan(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterType.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterType.java deleted file mode 100644 index f0aef43471..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatfilter/ChatFilterType.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2018, Magic fTail - * 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.chatfilter; - -public enum ChatFilterType -{ - CENSOR_WORDS, - CENSOR_MESSAGE, - REMOVE_MESSAGE -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryConfig.java deleted file mode 100644 index e30629c742..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryConfig.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.chathistory; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("chathistory") -public interface ChatHistoryConfig extends Config -{ - @ConfigItem( - keyName = "retainChatHistory", - name = "Retain Chat History", - description = "Retains chat history when logging in/out or world hopping", - position = 0 - ) - default boolean retainChatHistory() - { - return true; - } - - @ConfigItem( - keyName = "pmTargetCycling", - name = "PM Target Cycling", - description = "Pressing Tab while sending a PM will cycle the target username based on PM history", - position = 1 - ) - default boolean pmTargetCycling() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java deleted file mode 100644 index 7531e0aaa7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chathistory/ChatHistoryPlugin.java +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.chathistory; - -import com.google.common.collect.EvictingQueue; -import com.google.inject.Provides; -import java.awt.event.KeyEvent; -import java.util.ArrayDeque; -import java.util.Deque; -import java.util.Iterator; -import java.util.Queue; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.ScriptID; -import net.runelite.api.VarClientInt; -import net.runelite.api.VarClientStr; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.util.Text; -import net.runelite.api.vars.InputType; -import net.runelite.client.callback.ClientThread; -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.ConfigChanged; -import net.runelite.client.input.KeyListener; -import net.runelite.client.input.KeyManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import org.apache.commons.lang3.StringUtils; - -@PluginDescriptor( - name = "Chat History", - description = "Retain your chat history when logging in/out or world hopping", - tags = {"chat", "history", "retain", "cycle", "pm"}, - type = PluginType.MISCELLANEOUS -) -@Singleton -public class ChatHistoryPlugin extends Plugin implements KeyListener -{ - private static final String WELCOME_MESSAGE = "Welcome to Old School RuneScape"; - private static final String CLEAR_HISTORY = "Clear history"; - private static final String CLEAR_PRIVATE = "Private:"; - private static final int CYCLE_HOTKEY = KeyEvent.VK_TAB; - private static final int FRIENDS_MAX_SIZE = 5; - - private Queue messageQueue; - private Deque friends; - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private ChatHistoryConfig config; - - @Inject - private KeyManager keyManager; - - @Inject - private ChatMessageManager chatMessageManager; - - private boolean retainChatHistory; - private boolean pmTargetCycling; - - /** - * Small hack to prevent plugins checking for specific messages to match. This works because the "—" character - * cannot be seen in-game. This replacement preserves wrapping on chat history messages. - * - * @param message message - * @return message with invisible character before every space - */ - private static String tweakSpaces(final String message) - { - if (message != null) - { - // First replacement cleans up prior applications of this so as not to keep extending the message - return message.replace("— ", " ").replace(" ", "— "); - } - - return null; - } - - @Provides - ChatHistoryConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(ChatHistoryConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - messageQueue = EvictingQueue.create(100); - friends = new ArrayDeque<>(FRIENDS_MAX_SIZE + 1); - keyManager.registerKeyListener(this); - } - - @Override - protected void shutDown() - { - messageQueue.clear(); - messageQueue = null; - friends.clear(); - friends = null; - keyManager.unregisterKeyListener(this); - } - - @Subscribe - private void onChatMessage(ChatMessage chatMessage) - { - // Start sending old messages right after the welcome message, as that is most reliable source - // of information that chat history was reset - ChatMessageType chatMessageType = chatMessage.getType(); - if (chatMessageType == ChatMessageType.WELCOME && StringUtils.startsWithIgnoreCase(chatMessage.getMessage(), WELCOME_MESSAGE)) - { - if (!this.retainChatHistory) - { - return; - } - - QueuedMessage queuedMessage; - - while ((queuedMessage = messageQueue.poll()) != null) - { - chatMessageManager.queue(queuedMessage); - } - - return; - } - - switch (chatMessageType) - { - case PRIVATECHATOUT: - case PRIVATECHAT: - case MODPRIVATECHAT: - final String name = Text.removeTags(chatMessage.getName()); - // Remove to ensure uniqueness & its place in history - if (!friends.remove(name) && - // If the friend didn't previously exist ensure deque capacity doesn't increase by adding them - friends.size() >= FRIENDS_MAX_SIZE) - { - friends.remove(); - } - friends.add(name); - // intentional fall-through - case PUBLICCHAT: - case MODCHAT: - case FRIENDSCHAT: - case CONSOLE: - final QueuedMessage queuedMessage = QueuedMessage.builder() - .type(chatMessageType) - .name(chatMessage.getName()) - .sender(chatMessage.getSender()) - .value(tweakSpaces(chatMessage.getMessage())) - .runeLiteFormattedMessage(tweakSpaces(chatMessage.getMessageNode().getRuneLiteFormatMessage())) - .timestamp(chatMessage.getTimestamp()) - .build(); - - if (!messageQueue.contains(queuedMessage)) - { - messageQueue.offer(queuedMessage); - } - } - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked event) - { - String menuOption = event.getOption(); - - if (menuOption.contains(CLEAR_HISTORY)) - { - if (menuOption.startsWith(CLEAR_PRIVATE)) - { - messageQueue.removeIf(e -> e.getType() == ChatMessageType.PRIVATECHAT || - e.getType() == ChatMessageType.PRIVATECHATOUT || e.getType() == ChatMessageType.MODPRIVATECHAT); - friends.clear(); - } - else - { - messageQueue.removeIf(e -> e.getType() == ChatMessageType.PUBLICCHAT || e.getType() == ChatMessageType.MODCHAT); - } - } - } - - @Override - public void keyTyped(KeyEvent e) - { - } - - @Override - public void keyPressed(KeyEvent e) - { - if (e.getKeyCode() != CYCLE_HOTKEY || !this.pmTargetCycling) - { - return; - } - - if (client.getVar(VarClientInt.INPUT_TYPE) != InputType.PRIVATE_MESSAGE.getType()) - { - return; - } - - clientThread.invoke(() -> - { - final String target = findPreviousFriend(); - if (target == null) - { - return; - } - - final String currentMessage = client.getVar(VarClientStr.INPUT_TEXT); - - client.runScript(ScriptID.OPEN_PRIVATE_MESSAGE_INTERFACE, target); - - client.setVar(VarClientStr.INPUT_TEXT, currentMessage); - client.runScript(ScriptID.CHAT_TEXT_INPUT_REBUILD, ""); - }); - } - - @Override - public void keyReleased(KeyEvent e) - { - } - - private String findPreviousFriend() - { - final String currentTarget = client.getVar(VarClientStr.PRIVATE_MESSAGE_TARGET); - if (currentTarget == null || friends.isEmpty()) - { - return null; - } - - for (Iterator it = friends.descendingIterator(); it.hasNext(); ) - { - String friend = it.next(); - if (friend.equals(currentTarget)) - { - return it.hasNext() ? it.next() : friends.getLast(); - } - } - - return friends.getLast(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!"chathistory".equals(event.getGroup())) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.retainChatHistory = config.retainChatHistory(); - this.pmTargetCycling = config.pmTargetCycling(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsConfig.java deleted file mode 100644 index 5d9227c8f8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsConfig.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2018, Hydrox6 - * Copyright (c) 2018, 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.chatnotifications; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("chatnotification") -public interface ChatNotificationsConfig extends Config -{ - @ConfigItem( - position = 0, - keyName = "highlightOwnName", - name = "Highlight own name", - description = "Highlights any instance of your username in chat" - ) - default boolean highlightOwnName() - { - return true; - } - - @ConfigItem( - position = 1, - keyName = "highlightWordsString", - name = "Highlight words", - description = "Highlights the following words in chat" - ) - default String highlightWordsString() - { - return ""; - } - - @ConfigItem( - position = 2, - keyName = "notifyOnOwnName", - name = "Notify on own name", - description = "Notifies you whenever your name is mentioned" - ) - default boolean notifyOnOwnName() - { - return false; - } - - @ConfigItem( - position = 3, - keyName = "notifyOnHighlight", - name = "Notify on highlight", - description = "Notifies you whenever a highlighted word is matched" - ) - default boolean notifyOnHighlight() - { - return false; - } - - @ConfigItem( - position = 4, - keyName = "notifyOnTrade", - name = "Notify on trade", - description = "Notifies you whenever you are traded" - ) - default boolean notifyOnTrade() - { - return false; - } - - @ConfigItem( - position = 5, - keyName = "notifyOnDuel", - name = "Notify on duel", - description = "Notifies you whenever you are challenged to a duel" - ) - default boolean notifyOnDuel() - { - return false; - } - - @ConfigItem( - position = 6, - keyName = "notifyOnPm", - name = "Notify on private messsage", - description = "Notifies you whenever a private message was received" - ) - default boolean notifyOnPm() - { - return false; - } -} 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 deleted file mode 100644 index cd304fa09c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPlugin.java +++ /dev/null @@ -1,362 +0,0 @@ -/* - * Copyright (c) 2018, Hydrox6 - * Copyright (c) 2018, 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.chatnotifications; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Strings; -import com.google.inject.Provides; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import static java.util.regex.Pattern.quote; -import java.util.stream.Collectors; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.MessageNode; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.util.Text; -import net.runelite.client.Notifier; -import net.runelite.client.RuneLiteProperties; -import net.runelite.client.chat.ChatColorType; -import net.runelite.client.chat.ChatMessageManager; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Chat Notifications", - description = "Highlight and notify you of chat messages", - tags = {"duel", "messages", "notifications", "trade", "username"}, - enabledByDefault = false, - type = PluginType.MISCELLANEOUS -) -@Singleton -public class ChatNotificationsPlugin extends Plugin -{ - // Private message cache used to avoid duplicate notifications from ChatHistory. - private final Set privateMessageHashes = new HashSet<>(); - - @Inject - private Client client; - - @Inject - private ChatNotificationsConfig config; - - @Inject - private ChatMessageManager chatMessageManager; - - @Inject - private Notifier notifier; - - //Custom Highlights - private Pattern usernameMatcher = null; - private String usernameReplacer = ""; - private Pattern highlightMatcher = null; - private boolean highlightOwnName; - private String highlightWordsString; - private boolean notifyOnOwnName; - private boolean notifyOnHighlight; - private boolean notifyOnTrade; - private boolean notifyOnDuel; - private boolean notifyOnPm; - - /** - * Get the last color tag from a string, or null if there was none - * - * @param str - * @return - */ - private static String getLastColor(String str) - { - int colIdx = str.lastIndexOf(""); - - if (colEndIdx > colIdx) - { - // ends in a which resets the color to normal - return ""; - } - - if (colIdx == -1) - { - return null; // no color - } - - int closeIdx = str.indexOf('>', colIdx); - if (closeIdx == -1) - { - return null; // unclosed col tag - } - - return str.substring(colIdx, closeIdx + 1); // include the > - } - - /** - * Strip color tags from a string. - * - * @param str - * @return - */ - @VisibleForTesting - static String stripColor(String str) - { - return str.replaceAll("(|)", ""); - } - - @Provides - ChatNotificationsConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(ChatNotificationsConfig.class); - } - - @Override - public void startUp() - { - updateConfig(); - - updateHighlights(); - } - - @Override - public void shutDown() - { - this.privateMessageHashes.clear(); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - switch (event.getGameState()) - { - case LOGIN_SCREEN: - case HOPPING: - usernameMatcher = null; - break; - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("chatnotification")) - { - updateConfig(); - updateHighlights(); - } - } - - private void updateHighlights() - { - highlightMatcher = null; - - if (!this.highlightWordsString.trim().equals("")) - { - List items = Text.fromCSV(this.highlightWordsString); - String joined = items.stream() - .map(Text::escapeJagex) // we compare these strings to the raw Jagex ones - .map(this::quoteAndIgnoreColor) // regex escape and ignore nested colors in the target message - .collect(Collectors.joining("|")); - // 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); - } - } - - @Subscribe - void onChatMessage(ChatMessage chatMessage) - { - MessageNode messageNode = chatMessage.getMessageNode(); - boolean update = false; - - switch (chatMessage.getType()) - { - case TRADEREQ: - if (chatMessage.getMessage().contains("wishes to trade with you.") && this.notifyOnTrade) - { - notifier.notify(chatMessage.getMessage()); - } - break; - case CHALREQ_TRADE: - if (chatMessage.getMessage().contains("wishes to duel with you.") && this.notifyOnDuel) - { - notifier.notify(chatMessage.getMessage()); - } - break; - case CONSOLE: - // Don't notify for notification messages - if (chatMessage.getName().equals(RuneLiteProperties.getTitle())) - { - return; - } - break; - case PRIVATECHAT: - case MODPRIVATECHAT: - if (this.notifyOnPm) - { - int messageHash = this.buildMessageHash(chatMessage); - if (this.privateMessageHashes.contains(messageHash)) - { - return; - } - this.privateMessageHashes.add(messageHash); - notifier.notify("Private message received from " + chatMessage.getName()); - } - break; - } - - if (usernameMatcher == null && client.getLocalPlayer() != null && client.getLocalPlayer().getName() != null) - { - String username = client.getLocalPlayer().getName(); - usernameMatcher = Pattern.compile("\\b(" + quote(username) + ")\\b", Pattern.CASE_INSENSITIVE); - usernameReplacer = "" + username + ""; - } - - if (this.highlightOwnName && usernameMatcher != null) - { - Matcher matcher = usernameMatcher.matcher(messageNode.getValue()); - if (matcher.find()) - { - messageNode.setValue(matcher.replaceAll(usernameReplacer)); - update = true; - - if (this.notifyOnOwnName) - { - sendNotification(chatMessage); - } - } - } - - if (highlightMatcher != null) - { - String nodeValue = messageNode.getValue(); - Matcher matcher = highlightMatcher.matcher(nodeValue); - boolean found = false; - StringBuffer stringBuffer = new StringBuffer(); - - while (matcher.find()) - { - String value = matcher.group(); - - // Determine the ending color by: - // 1) use the color from value if it has one - // 2) use the last color from stringBuffer + - // To do #2 we just search for the last col tag after calling appendReplacement - String endColor = getLastColor(value); - - // Strip color tags from the highlighted region so that it remains highlighted correctly - value = stripColor(value); - - matcher.appendReplacement(stringBuffer, "' + value); - - if (endColor == null) - { - endColor = getLastColor(stringBuffer.toString()); - } - - // Append end color - stringBuffer.append(endColor == null ? "" : endColor); - - update = true; - found = true; - } - - if (found) - { - matcher.appendTail(stringBuffer); - messageNode.setValue(stringBuffer.toString()); - - if (this.notifyOnHighlight) - { - sendNotification(chatMessage); - } - } - } - - if (update) - { - messageNode.setRuneLiteFormatMessage(messageNode.getValue()); - chatMessageManager.update(messageNode); - } - } - - private int buildMessageHash(ChatMessage message) - { - return (message.getName() + message.getMessage()).hashCode(); - } - - private void sendNotification(ChatMessage message) - { - String name = Text.removeTags(message.getName()); - String sender = message.getSender(); - StringBuilder stringBuilder = new StringBuilder(); - - if (!Strings.isNullOrEmpty(sender)) - { - stringBuilder.append('[').append(sender).append("] "); - } - - if (!Strings.isNullOrEmpty(name)) - { - stringBuilder.append(name).append(": "); - } - - stringBuilder.append(Text.removeTags(message.getMessage())); - String notification = stringBuilder.toString(); - notifier.notify(notification); - } - - private void updateConfig() - { - this.highlightOwnName = config.highlightOwnName(); - this.highlightWordsString = config.highlightWordsString(); - this.notifyOnOwnName = config.notifyOnOwnName(); - this.notifyOnHighlight = config.notifyOnHighlight(); - this.notifyOnTrade = config.notifyOnTrade(); - this.notifyOnDuel = config.notifyOnDuel(); - this.notifyOnPm = config.notifyOnPm(); - } - - private String quoteAndIgnoreColor(String str) - { - StringBuilder stringBuilder = new StringBuilder(); - - for (int i = 0; i < str.length(); ++i) - { - char c = str.charAt(i); - stringBuilder.append(Pattern.quote(String.valueOf(c))); - stringBuilder.append("(?:]*?>)?"); - } - - return stringBuilder.toString(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java deleted file mode 100644 index 44809065a0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationConfig.java +++ /dev/null @@ -1,122 +0,0 @@ -package net.runelite.client.plugins.chattranslation; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigTitleSection; -import net.runelite.client.config.Title; - -@ConfigGroup("chattranslation") -public interface ChatTranslationConfig extends Config -{ - @ConfigTitleSection( - keyName = "chatTranslation", - name = "Chat Translation", - description = "", - position = 0 - ) - default Title chatTranslation() - { - return new Title(); - } - - @ConfigItem( - keyName = "translateOptionVisible", - name = "Show 'Translate' menu option", - description = "Adds 'Translate' to the right-click menu in the Chatbox.", - position = 1, - titleSection = "chatTranslation" - ) - default boolean translateOptionVisible() - { - return true; - } - - @ConfigItem( - keyName = "publicChat", - name = "Translate incoming Messages", - description = "Would you like to Translate Chat?", - position = 2, - titleSection = "chatTranslation", - hidden = true, - unhide = "translateOptionVisible" - ) - default boolean publicChat() - { - return false; - } - - @ConfigItem( - keyName = "playerNames", - name = "Translated Player list:", - description = "Players you add to this list will be Translated in chat.", - position = 3, - titleSection = "chatTranslation", - hidden = true, - unhide = "translateOptionVisible" - ) - default String playerNames() - { - return ""; - } - - @ConfigItem( - keyName = "playerNames", - name = "", - description = "", - hidden = true - ) - void playerNames(String names); - - @ConfigItem( - keyName = "publicTargetLanguage", - name = "Target Language", - description = "Language to translate others' messages to.", - position = 4, - titleSection = "chatTranslation", - hidden = true, - unhide = "publicChat" - ) - default Languages publicTargetLanguage() - { - return Languages.ENGLISH; - } - - @ConfigTitleSection( - keyName = "playerMessageTranslation", - name = "Player Message Translation", - description = "", - position = 5 - ) - default Title playerMessageTranslation() - { - return new Title(); - } - - @ConfigItem( - keyName = "playerChat", - name = "Translate outgoing Messages", - description = "Would you like to Translate your Messages?", - position = 6, - titleSection = "playerMessageTranslation" - ) - default boolean playerChat() - { - return false; - } - - @ConfigItem( - keyName = "playerTargetLanguage", - name = "Target Language", - description = "Language to translate your messages to.", - position = 7, - titleSection = "playerMessageTranslation", - hidden = true, - unhide = "playerChat" - ) - default Languages playerTargetLanguage() - { - return Languages.SPANISH; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java deleted file mode 100644 index 7a85bd3bb6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/ChatTranslationPlugin.java +++ /dev/null @@ -1,322 +0,0 @@ -package net.runelite.client.plugins.chattranslation; - -import com.google.common.collect.ImmutableList; -import com.google.inject.Provides; -import java.awt.event.KeyEvent; -import java.io.IOException; -import java.util.HashSet; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.MenuEntry; -import net.runelite.api.MenuOpcode; -import net.runelite.api.MessageNode; -import static net.runelite.api.ScriptID.CHATBOX_INPUT; -import net.runelite.api.VarClientStr; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.MenuOpened; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.chat.ChatMessageManager; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.input.KeyListener; -import net.runelite.client.input.KeyManager; -import net.runelite.client.menus.MenuManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Chat Translator", - description = "Translates messages from one Language to another.", - tags = {"translate", "language", "english", "spanish", "dutch", "french", "welsh", "german"}, - type = PluginType.MISCELLANEOUS -) -@Singleton -@Slf4j -public class ChatTranslationPlugin extends Plugin implements KeyListener -{ - private static final Object PUBLIC = new Object(); - private static final Object OPTION = new Object(); - private static final String TRANSLATE = "Translate"; - - // TODO: Find out if "Remove friend" is correct here, aka if clan tab should have the Translate option - private static final ImmutableList AFTER_OPTIONS = ImmutableList.of("Message", "Add ignore", "Remove friend", "Kick"); - - private final Translator translator = new Translator(); - private final Set playerNames = new HashSet<>(); - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private MenuManager menuManager; - - @Inject - private ChatMessageManager chatMessageManager; - - @Inject - private KeyManager keyManager; - - @Inject - private ChatTranslationConfig config; - - @Inject - private EventBus eventBus; - - @Provides - ChatTranslationConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(ChatTranslationConfig.class); - } - - @Override - protected void startUp() - { - translator.setInLang(config.publicTargetLanguage()); - translator.setOutLang(config.playerTargetLanguage()); - - if (config.playerChat()) - { - keyManager.registerKeyListener(this); - } - - if (config.publicChat()) - { - eventBus.subscribe(ChatMessage.class, PUBLIC, this::onChatMessage); - } - - if (config.translateOptionVisible()) - { - menuManager.addPlayerMenuItem(TRANSLATE); - eventBus.subscribe(MenuOpened.class, OPTION, this::onMenuOpened); - eventBus.subscribe(MenuOptionClicked.class, OPTION, this::onMenuOptionClicked); - } - - for (String name : Text.fromCSV(config.playerNames().toLowerCase())) - { - playerNames.add(Text.toJagexName(name)); - } - } - - @Override - protected void shutDown() - { - eventBus.unregister(OPTION); - eventBus.unregister(PUBLIC); - menuManager.removePlayerMenuItem(TRANSLATE); - keyManager.unregisterKeyListener(this); - playerNames.clear(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("chattranslation")) - { - return; - } - - switch (event.getKey()) - { - case "translateOptionVisible": - if (config.translateOptionVisible()) - { - menuManager.addPlayerMenuItem(TRANSLATE); - eventBus.subscribe(MenuOpened.class, TRANSLATE, this::onMenuOpened); - eventBus.subscribe(MenuOptionClicked.class, TRANSLATE, this::onMenuOptionClicked); - } - else - { - menuManager.removePlayerMenuItem(TRANSLATE); - eventBus.unregister(TRANSLATE); - } - break; - case "publicChat": - if (config.publicChat()) - { - eventBus.subscribe(ChatMessage.class, PUBLIC, this::onChatMessage); - } - else - { - eventBus.unregister(PUBLIC); - } - break; - case "playerNames": - playerNames.clear(); - for (String names : Text.fromCSV(config.playerNames().toLowerCase())) - { - playerNames.add(Text.toJagexName(names)); - } - break; - case "publicTargetLanguage": - translator.setInLang(config.publicTargetLanguage()); - break; - case "playerChat": - if (config.playerChat()) - { - keyManager.registerKeyListener(this); - } - else - { - keyManager.unregisterKeyListener(this); - } - break; - case "playerTargetLanguage": - translator.setOutLang(config.playerTargetLanguage()); - break; - } - } - - private void onMenuOpened(MenuOpened event) - { - MenuEntry[] entries = event.getMenuEntries(); - - for (int i = 0; i < event.getMenuEntries().length; i++) - { - if (!AFTER_OPTIONS.contains(entries[i].getOption())) - { - continue; - } - - MenuEntry[] newEntries = new MenuEntry[entries.length + 1]; - - System.arraycopy(entries, 0, newEntries, 0, i + 1); - System.arraycopy(entries, i, newEntries, i + 1, entries.length - i); - - newEntries[i] = newEntries[i].clone(); - newEntries[i].setOption(TRANSLATE); - newEntries[i].setOpcode(MenuOpcode.RUNELITE.getId()); - - event.setMenuEntries(newEntries); - event.setModified(); - - return; - } - } - - private void onMenuOptionClicked(MenuOptionClicked event) - { - if (event.getOpcode() != MenuOpcode.RUNELITE.getId() || - !event.getOption().equals(TRANSLATE)) - { - return; - } - - String name = - Text.toJagexName( - Text.removeTags(event.getTarget(), true) - .toLowerCase() - ); - - playerNames.add(name); - - config.playerNames(Text.toCSV(playerNames)); - } - - @Subscribe - private void onChatMessage(ChatMessage chatMessage) - { - if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN) - { - return; - } - switch (chatMessage.getType()) - { - case PUBLICCHAT: - case MODCHAT: - case FRIENDSCHAT: - break; - default: - return; - } - - if (!playerNames.contains(Text.toJagexName(Text.removeTags(chatMessage.getName().toLowerCase())))) - { - return; - } - - final String message = chatMessage.getMessage(); - - try - { - final String translation = translator.translateIncoming(message); - final MessageNode messageNode = chatMessage.getMessageNode(); - messageNode.setRuneLiteFormatMessage(translation); - chatMessageManager.update(messageNode); - } - catch (IOException e) - { - log.warn("Error translating message", e); - } - - client.refreshChat(); - } - - @Override - public void keyTyped(KeyEvent e) - { - // Nothing. - } - - @Override - public void keyPressed(KeyEvent event) - { - if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - final Widget chatboxParent = client.getWidget(WidgetInfo.CHATBOX_PARENT); - - if (chatboxParent == null || chatboxParent.getOnKeyListener() == null || event.getKeyCode() != 0xA) - { - return; - } - - final String message = client.getVar(VarClientStr.CHATBOX_TYPED_TEXT); - final String translated; - - try - { - translated = translator.translateOutgoing(message); - } - catch (IOException e) - { - log.warn("Error translating message", e); - return; - } - - if (message.startsWith("/")) - { - client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, translated.startsWith("/") ? translated : "/" + translated); - return; - } - - event.consume(); - - client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, translated); - - clientThread.invoke(() -> client.runScript(CHATBOX_INPUT, 0, translated)); - - client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, ""); - } - - @Override - public void keyReleased(KeyEvent e) - { - // Nothing. - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Languages.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Languages.java deleted file mode 100644 index d7bd91e1b0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Languages.java +++ /dev/null @@ -1,37 +0,0 @@ -package net.runelite.client.plugins.chattranslation; - -import lombok.AccessLevel; -import lombok.Getter; - -// TODO: Doesn't Locale pretty much do this as well? -public enum Languages -{ - ENGLISH("English", "en"), - WELSH("Welsh", "cy"), - DUTCH("Dutch", "nl"), - SPANISH("Spanish", "es"), - FRENCH("French", "fr"), - GERMAN("German", "de"); - - @Getter(AccessLevel.PACKAGE) - private final String name; - private final String shortName; - - Languages(String name, String shortName) - { - this.name = name; - this.shortName = shortName; - } - - public String toShortString() - { - return shortName; - } - - @Override - public String toString() - { - return name; - } - -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Translator.java b/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Translator.java deleted file mode 100644 index 5b0a4aa8c1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chattranslation/Translator.java +++ /dev/null @@ -1,74 +0,0 @@ -package net.runelite.client.plugins.chattranslation; - -import com.google.gson.JsonArray; -import com.google.gson.JsonParser; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.URL; -import java.net.URLEncoder; - -class Translator -{ - private static final String BASE_URL = "https://translate.googleapis.com/translate_a/single?client=gtx&sl="; - private static final String SOURCE = "auto"; - private static final String CENT_URL = "&tl="; - private static final String LAST_URL = "&dt=t&q="; - - private String incomingUrlBase; - private String outgoingUrlBase; - - void setInLang(Languages lang) - { - incomingUrlBase = BASE_URL + SOURCE + CENT_URL + lang.toShortString() + LAST_URL; - } - - void setOutLang(Languages lang) - { - outgoingUrlBase = BASE_URL + SOURCE + CENT_URL + lang.toShortString() + LAST_URL; - } - - String translateIncoming(String message) throws IOException - { - final String url = incomingUrlBase + URLEncoder.encode(message, "UTF-8"); - return translate(new URL(url)); - } - - String translateOutgoing(String message) throws IOException - { - final String url = outgoingUrlBase + URLEncoder.encode(message, "UTF-8"); - return translate(new URL(url)); - } - - private String translate(URL url) throws IOException - { - HttpURLConnection con = (HttpURLConnection) url.openConnection(); - con.setRequestProperty("User-Agent", "Mozilla/5.0"); - - try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) - { - String inputLine; - StringBuilder response = new StringBuilder(); - - while ((inputLine = in.readLine()) != null) - { - response.append(inputLine); - } - - return parseResult(response.toString()); - } - } - - private String parseResult(String inputJson) - { - String result; - JsonArray jsonArray = new JsonParser().parse(inputJson).getAsJsonArray(); - JsonArray jsonArray2 = jsonArray.get(0).getAsJsonArray(); - JsonArray jsonArray3 = jsonArray2.get(0).getAsJsonArray(); - result = jsonArray3.get(0).toString(); - - return result.substring(1, result.length() - 1); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanActivityType.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanActivityType.java deleted file mode 100644 index 86cc5e60a5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanActivityType.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2018, trimbe - * 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.clanchat; - -enum ClanActivityType -{ - JOINED, - LEFT -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatConfig.java deleted file mode 100644 index 9c99a369bc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatConfig.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2017, Ron - * 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.clanchat; - -import net.runelite.api.ClanMemberRank; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("clanchat") -public interface ClanChatConfig extends Config -{ - @ConfigItem( - keyName = "clanChatIcons", - name = "Clan Chat Icons", - description = "Show clan chat icons next to clan members.", - position = 1 - ) - default boolean clanChatIcons() - { - return true; - } - - @ConfigItem( - keyName = "recentChats", - name = "Recent Chats", - description = "Show recent clan chats.", - position = 2 - ) - default boolean recentChats() - { - return true; - } - - @ConfigItem( - keyName = "clanCounter", - name = "Clan Members Counter", - description = "Show the amount of clan members near you.", - position = 3 - ) - default boolean showClanCounter() - { - return false; - } - - @ConfigItem( - keyName = "chatsData", - name = "", - description = "", - hidden = true - ) - default String chatsData() - { - return ""; - } - - @ConfigItem( - keyName = "chatsData", - name = "", - description = "" - ) - void chatsData(String str); - - @ConfigItem( - keyName = "showJoinLeave", - name = "Show Join/Leave", - description = "Adds a temporary message notifying when a member joins or leaves.", - position = 4 - ) - default boolean showJoinLeave() - { - return false; - } - - @ConfigItem( - keyName = "joinLeaveRank", - name = "Join/Leave rank", - description = "Only show join/leave messages for members at or above this rank.", - position = 5 - ) - default ClanMemberRank joinLeaveRank() - { - return ClanMemberRank.UNRANKED; - } - - @ConfigItem( - keyName = "privateMessageIcons", - name = "Private Message Icons", - description = "Add clan chat rank icons to private messages received from clan mates.", - position = 6 - ) - default boolean privateMessageIcons() - { - return false; - } - - @ConfigItem( - keyName = "publicChatIcons", - name = "Public Chat Icons", - description = "Add clan chat rank icons to public chat messages from clan mates.", - position = 7 - ) - default boolean publicChatIcons() - { - return false; - } - - @ConfigItem( - keyName = "clanTabChat", - name = "Clan Tab Chat", - description = "Allows clan chat without prepending '/' to messages when on clan tab", - position = 8 - ) - default boolean clanTabChat() - { - return false; - } - - @ConfigItem( - position = 9, - keyName = "clanname", - name = "Default Clan Name", - description = "Clan name to always remember" - ) - default String clanname() - { - return ""; - } - - @ConfigItem( - keyName = "confirmKicks", - name = "Confirm Kicks", - description = "Shows a chat prompt to confirm kicks", - position = 10 - ) - default boolean confirmKicks() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatIndicator.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatIndicator.java deleted file mode 100644 index 38c86929dd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatIndicator.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2018 Sebastiaan - * 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.clanchat; - -import java.awt.Color; -import java.awt.image.BufferedImage; -import javax.inject.Singleton; -import net.runelite.client.ui.overlay.infobox.Counter; - -@Singleton -class ClanChatIndicator extends Counter -{ - private final ClanChatPlugin plugin; - - ClanChatIndicator(final BufferedImage image, final ClanChatPlugin plugin) - { - super(image, plugin, plugin.getClanAmount()); - this.plugin = plugin; - } - - @Override - public int getCount() - { - return plugin.getClanAmount(); - } - - @Override - public String getTooltip() - { - return plugin.getClanAmount() + " clan member(s) near you"; - } - - @Override - public Color getTextColor() - { - return Color.WHITE; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java deleted file mode 100644 index 4ba6f7dc81..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java +++ /dev/null @@ -1,719 +0,0 @@ -/* - * Copyright (c) 2017, Devin French - * Copyright (c) 2019, Adam - * Copyright (c) 2018, trimbe - * 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.clanchat; - -import com.google.common.base.Strings; -import com.google.common.collect.Lists; -import com.google.common.util.concurrent.Runnables; -import com.google.inject.Provides; -import java.awt.Color; -import java.awt.image.BufferedImage; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Deque; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CopyOnWriteArrayList; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.ChatLineBuffer; -import net.runelite.api.ChatMessageType; -import net.runelite.api.ClanMember; -import net.runelite.api.ClanMemberRank; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.MessageNode; -import net.runelite.api.Player; -import net.runelite.api.ScriptID; -import net.runelite.api.SpriteID; -import net.runelite.api.VarClientStr; -import net.runelite.api.Varbits; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.ClanChanged; -import net.runelite.api.events.ClanMemberJoined; -import net.runelite.api.events.ClanMemberLeft; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.PlayerDespawned; -import net.runelite.api.events.PlayerSpawned; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.api.events.VarClientStrChanged; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.api.widgets.WidgetType; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.chat.ChatMessageBuilder; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ClanManager; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.game.chatbox.ChatboxPanelManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import static net.runelite.client.ui.JagexColors.CHAT_CLAN_NAME_OPAQUE_BACKGROUND; -import static net.runelite.client.ui.JagexColors.CHAT_CLAN_NAME_TRANSPARENT_BACKGROUND; -import static net.runelite.client.ui.JagexColors.CHAT_CLAN_TEXT_OPAQUE_BACKGROUND; -import static net.runelite.client.ui.JagexColors.CHAT_CLAN_TEXT_TRANSPARENT_BACKGROUND; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; - -@PluginDescriptor( - name = "Clan Chat", - description = "Add rank icons to users talking in clan chat", - tags = {"icons", "rank", "recent"}, - type = PluginType.UTILITY -) -@Singleton -public class ClanChatPlugin extends Plugin -{ - private static final int MAX_CHATS = 20; - private static final String CLAN_CHAT_TITLE = "CC"; - private static final String RECENT_TITLE = "Recent CCs"; - private static final int JOIN_LEAVE_DURATION = 20; - private static final int MESSAGE_DELAY = 10; - private static final CopyOnWriteArrayList clanMembers = new CopyOnWriteArrayList<>(); - /** - * queue of temporary messages added to the client - */ - private final Deque clanJoinMessages = new ArrayDeque<>(); - private final Map activityBuffer = new HashMap<>(); - - @Inject - private Client client; - - @Inject - private ClanManager clanManager; - - @Inject - private ClanChatConfig config; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private SpriteManager spriteManager; - - @Inject - private ClientThread clientThread; - - @Inject - private ChatboxPanelManager chatboxPanelManager; - - private List chats = new ArrayList<>(); - private ClanChatIndicator clanMemberCounter; - private int clanJoinedTick; - private boolean clanChatIcons; - private boolean recentChats; - private boolean showClanCounter; - private String chatsData; - private boolean showJoinLeave; - private ClanMemberRank joinLeaveRank; - private boolean privateMessageIcons; - private boolean publicChatIcons; - private boolean clanTabChat; - private String clanname; - - private boolean kickConfirmed = false; - - @SuppressWarnings("unchecked") - public static CopyOnWriteArrayList getClanMembers() - { - return (CopyOnWriteArrayList) clanMembers.clone(); - } - - @Provides - ClanChatConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(ClanChatConfig.class); - } - - @Override - public void startUp() - { - updateConfig(); - - chats = new ArrayList<>(Text.fromCSV(this.chatsData)); - } - - @Override - public void shutDown() - { - clanMembers.clear(); - removeClanCounter(); - resetClanChats(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged configChanged) - { - if (configChanged.getGroup().equals("clanchat")) - { - updateConfig(); - - if (!this.recentChats) - { - resetClanChats(); - } - - if (this.showClanCounter) - { - clientThread.invoke(this::addClanCounter); - } - else - { - removeClanCounter(); - } - } - } - - @Subscribe - private void onClanMemberJoined(ClanMemberJoined event) - { - final ClanMember member = event.getMember(); - - if (member.getWorld() == client.getWorld()) - { - final Player local = client.getLocalPlayer(); - final String memberName = Text.toJagexName(member.getUsername()); - - for (final Player player : client.getPlayers()) - { - if (player != null && player != local && memberName.equals(Text.toJagexName(player.getName()))) - { - clanMembers.add(player); - addClanCounter(); - break; - } - } - } - - // clan members getting initialized isn't relevant - if (clanJoinedTick == client.getTickCount()) - { - return; - } - - if (!this.showJoinLeave || - member.getRank().getValue() < this.joinLeaveRank.getValue()) - { - return; - } - - // attempt to filter out world hopping joins - if (!activityBuffer.containsKey(member.getUsername())) - { - ClanMemberActivity joinActivity = new ClanMemberActivity(ClanActivityType.JOINED, - member, client.getTickCount()); - activityBuffer.put(member.getUsername(), joinActivity); - } - else - { - activityBuffer.remove(member.getUsername()); - } - } - - @Subscribe - private void onClanMemberLeft(ClanMemberLeft event) - { - final ClanMember member = event.getMember(); - - if (member.getWorld() == client.getWorld()) - { - final String memberName = Text.toJagexName(member.getUsername()); - - List toRemove = new ArrayList<>(); - for (Player each : clanMembers) - { - if (memberName.equals(Text.toJagexName(each.getName()))) - { - toRemove.add(each); - if (clanMembers.isEmpty()) - { - removeClanCounter(); - } - - break; - } - } - clanMembers.removeAll(toRemove); - } - - if (!this.showJoinLeave || - member.getRank().getValue() < this.joinLeaveRank.getValue()) - { - return; - } - - if (!activityBuffer.containsKey(member.getUsername())) - { - ClanMemberActivity leaveActivity = new ClanMemberActivity(ClanActivityType.LEFT, - member, client.getTickCount()); - activityBuffer.put(member.getUsername(), leaveActivity); - } - else - { - activityBuffer.remove(member.getUsername()); - } - } - - @Subscribe - private void onGameTick(GameTick gameTick) - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - client.setVar(VarClientStr.RECENT_CLAN_CHAT, this.clanname); - - Widget clanChatTitleWidget = client.getWidget(WidgetInfo.CLAN_CHAT_TITLE); - if (clanChatTitleWidget != null) - { - Widget clanChatList = client.getWidget(WidgetInfo.CLAN_CHAT_LIST); - Widget owner = client.getWidget(WidgetInfo.CLAN_CHAT_OWNER); - if (client.getClanChatCount() > 0) - { - clanChatTitleWidget.setText(CLAN_CHAT_TITLE + " (" + client.getClanChatCount() + "/100)"); - } - else if (this.recentChats && clanChatList.getChildren() == null && !Strings.isNullOrEmpty(owner.getText())) - { - clanChatTitleWidget.setText(RECENT_TITLE); - - loadClanChats(); - } - } - - if (!this.showJoinLeave) - { - return; - } - - timeoutClanMessages(); - - addClanActivityMessages(); - } - - private void timeoutClanMessages() - { - if (clanJoinMessages.isEmpty()) - { - return; - } - - boolean removed = false; - - for (Iterator it = clanJoinMessages.iterator(); it.hasNext(); ) - { - ClanJoinMessage clanJoinMessage = it.next(); - MessageNode messageNode = clanJoinMessage.getMessageNode(); - final int createdTick = clanJoinMessage.getTick(); - - if (client.getTickCount() > createdTick + JOIN_LEAVE_DURATION) - { - it.remove(); - - // If this message has been reused since, it will get a different id - if (clanJoinMessage.getGetMessageId() == messageNode.getId()) - { - ChatLineBuffer ccInfoBuffer = client.getChatLineMap().get(ChatMessageType.FRIENDSCHATNOTIFICATION.getType()); - if (ccInfoBuffer != null) - { - ccInfoBuffer.removeMessageNode(messageNode); - removed = true; - } - } - } - else - { - // Everything else in the deque is newer - break; - } - } - - if (removed) - { - clientThread.invoke(() -> client.runScript(ScriptID.BUILD_CHATBOX)); - } - } - - private void addClanActivityMessages() - { - Iterator activityIt = activityBuffer.values().iterator(); - - while (activityIt.hasNext()) - { - ClanMemberActivity activity = activityIt.next(); - - if (activity.getTick() < client.getTickCount() - MESSAGE_DELAY) - { - activityIt.remove(); - addActivityMessage(activity.getMember(), activity.getActivityType()); - } - } - } - - private void addActivityMessage(ClanMember member, ClanActivityType activityType) - { - final String activityMessage = activityType == ClanActivityType.JOINED ? " has joined." : " has left."; - final ClanMemberRank rank = member.getRank(); - Color textColor = CHAT_CLAN_TEXT_OPAQUE_BACKGROUND; - Color channelColor = CHAT_CLAN_NAME_OPAQUE_BACKGROUND; - int rankIcon = -1; - - if (client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1) - { - textColor = CHAT_CLAN_TEXT_TRANSPARENT_BACKGROUND; - channelColor = CHAT_CLAN_NAME_TRANSPARENT_BACKGROUND; - } - - if (this.clanChatIcons && rank != null && rank != ClanMemberRank.UNRANKED) - { - rankIcon = clanManager.getIconNumber(rank); - } - - ChatMessageBuilder message = new ChatMessageBuilder() - .append("[") - .append(channelColor, client.getClanChatName() == null ? "" : client.getClanChatName()); - - if (rankIcon > -1) - { - message - .append(" ") - .img(rankIcon); - } - message - .append("] ") - .append(textColor, member.getUsername() + activityMessage); - - final String messageString = message.build(); - client.addChatMessage(ChatMessageType.FRIENDSCHATNOTIFICATION, "", messageString, ""); - - final ChatLineBuffer chatLineBuffer = client.getChatLineMap().get(ChatMessageType.FRIENDSCHATNOTIFICATION.getType()); - final MessageNode[] lines = chatLineBuffer.getLines(); - final MessageNode line = lines[0]; - - ClanJoinMessage clanJoinMessage = new ClanJoinMessage(line, line.getId(), client.getTickCount()); - clanJoinMessages.addLast(clanJoinMessage); - } - - @Subscribe - private void onVarClientStrChanged(VarClientStrChanged strChanged) - { - if (strChanged.getIndex() == VarClientStr.RECENT_CLAN_CHAT.getIndex() && this.recentChats) - { - updateRecentChat(client.getVar(VarClientStr.RECENT_CLAN_CHAT)); - } - } - - @Subscribe - private void onChatMessage(ChatMessage chatMessage) - { - if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - if (client.getClanChatCount() <= 0) - { - return; - } - - switch (chatMessage.getType()) - { - case PRIVATECHAT: - case MODPRIVATECHAT: - if (!this.privateMessageIcons) - { - return; - } - break; - case PUBLICCHAT: - case MODCHAT: - if (!this.publicChatIcons) - { - return; - } - break; - case FRIENDSCHAT: - if (!this.clanChatIcons) - { - return; - } - break; - default: - return; - } - - insertClanRankIcon(chatMessage); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged state) - { - GameState gameState = state.getGameState(); - - if (gameState == GameState.LOGIN_SCREEN || gameState == GameState.CONNECTION_LOST || gameState == GameState.HOPPING) - { - clanMembers.clear(); - removeClanCounter(); - - clanJoinMessages.clear(); - } - } - - @Subscribe - private void onPlayerSpawned(PlayerSpawned event) - { - final Player local = client.getLocalPlayer(); - final Player player = event.getPlayer(); - - if (player != null && !player.equals(local) && player.isClanMember()) - { - clanMembers.add(player); - addClanCounter(); - } - } - - @Subscribe - private void onPlayerDespawned(PlayerDespawned event) - { - if (clanMembers.remove(event.getPlayer()) && clanMembers.isEmpty()) - { - removeClanCounter(); - } - } - - @Subscribe - private void onClanChanged(ClanChanged event) - { - if (event.isJoined()) - { - clanJoinedTick = client.getTickCount(); - } - else - { - clanMembers.clear(); - removeClanCounter(); - } - - activityBuffer.clear(); - } - - @Subscribe - private void onScriptCallbackEvent(ScriptCallbackEvent scriptCallbackEvent) - { - switch (scriptCallbackEvent.getEventName()) - { - case "clanchatInput": - { - final int[] intStack = client.getIntStack(); - final int size = client.getIntStackSize(); - // If the user accidentally adds a / when the config and the clan chat tab is active, handle it like a normal message - boolean alterClanChatDispatch = config.clanTabChat() && !client.getVar(VarClientStr.CHATBOX_TYPED_TEXT).startsWith("/"); - intStack[size - 1] = alterClanChatDispatch ? 1 : 0; - break; - } - case "confirmClanKick": - { - if (!config.confirmKicks() || kickConfirmed) - { - break; - } - - // Set a flag so the script doesn't instantly kick them - final int[] intStack = client.getIntStack(); - final int size = client.getIntStackSize(); - intStack[size - 1] = 1; - - // Get name of player we are trying to kick - final String[] stringStack = client.getStringStack(); - final int stringSize = client.getStringStackSize(); - final String kickPlayerName = stringStack[stringSize - 1]; - - // Show a chatbox panel confirming the kick - clientThread.invokeLater(() -> confirmKickPlayer(kickPlayerName)); - break; - } - } - } - - int getClanAmount() - { - return clanMembers.size(); - } - - private void insertClanRankIcon(final ChatMessage message) - { - final ClanMemberRank rank = clanManager.getRank(message.getName()); - - if (rank != null && rank != ClanMemberRank.UNRANKED) - { - int iconNumber = clanManager.getIconNumber(rank); - final String img = ""; - if (message.getType() == ChatMessageType.FRIENDSCHAT) - { - message.getMessageNode() - .setSender(message.getMessageNode().getSender() + " " + img); - } - else - { - message.getMessageNode() - .setName(img + message.getMessageNode().getName()); - } - client.refreshChat(); - } - } - - - private void resetClanChats() - { - Widget clanChatList = client.getWidget(WidgetInfo.CLAN_CHAT_LIST); - Widget clanChatTitleWidget = client.getWidget(WidgetInfo.CLAN_CHAT_TITLE); - - if (clanChatList == null) - { - return; - } - - if (client.getClanChatCount() == 0) - { - clanChatList.setChildren(null); - } - - clanChatTitleWidget.setText(CLAN_CHAT_TITLE); - } - - private void loadClanChats() - { - Widget clanChatList = client.getWidget(WidgetInfo.CLAN_CHAT_LIST); - if (clanChatList == null) - { - return; - } - - clanChatList.setScrollHeight(14 * chats.size()); - clanChatList.revalidateScroll(); - - int y = 2; - clanChatList.setChildren(null); - for (String chat : Lists.reverse(chats)) - { - Widget widget = clanChatList.createChild(-1, WidgetType.TEXT); - widget.setFontId(494); - widget.setHasListener(true); - - widget.setTextColor(0xffffff); - widget.setText(chat); - widget.setTextShadowed(true); - widget.setBorderType(1); - widget.setAction(0, String.format("Join %s", chat)); - widget.setOnOpListener(ScriptID.CUSTOM_JOIN_CLAN, widget.getText()); - widget.setOriginalHeight(14); - widget.setOriginalWidth(142); - widget.setOriginalY(y); - widget.setOriginalX(20); - widget.revalidate(); - - y += 14; - } - clanChatList.revalidateScroll(); - } - - private void updateRecentChat(String s) - { - if (Strings.isNullOrEmpty(s)) - { - return; - } - - s = Text.toJagexName(s); - - chats.removeIf(s::equalsIgnoreCase); - chats.add(s); - - while (chats.size() > MAX_CHATS) - { - chats.remove(0); - } - - String csvText = Text.toCSV(chats); - - config.chatsData(csvText); - this.chatsData = csvText; - } - - private void removeClanCounter() - { - infoBoxManager.removeInfoBox(clanMemberCounter); - clanMemberCounter = null; - } - - private void confirmKickPlayer(final String kickPlayerName) - { - chatboxPanelManager.openTextMenuInput("Attempting to kick: " + kickPlayerName) - .option("1. Confirm kick", () -> - clientThread.invoke(() -> - { - kickConfirmed = true; - client.runScript(ScriptID.CLAN_SEND_KICK, kickPlayerName); - kickConfirmed = false; - }) - ) - .option("2. Cancel", Runnables::doNothing) - .build(); - } - - private void addClanCounter() - { - if (!this.showClanCounter || clanMemberCounter != null || clanMembers.isEmpty()) - { - return; - } - - final BufferedImage image = spriteManager.getSprite(SpriteID.TAB_CLAN_CHAT, 0); - clanMemberCounter = new ClanChatIndicator(image, this); - infoBoxManager.addInfoBox(clanMemberCounter); - } - - private void updateConfig() - { - this.clanChatIcons = config.clanChatIcons(); - this.recentChats = config.recentChats(); - this.showClanCounter = config.showClanCounter(); - this.chatsData = config.chatsData(); - this.showJoinLeave = config.showJoinLeave(); - this.joinLeaveRank = config.joinLeaveRank(); - this.privateMessageIcons = config.privateMessageIcons(); - this.publicChatIcons = config.publicChatIcons(); - this.clanTabChat = config.clanTabChat(); - this.clanname = config.clanname(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanJoinMessage.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanJoinMessage.java deleted file mode 100644 index 8ac0b0069b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanJoinMessage.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.clanchat; - -import lombok.Value; -import net.runelite.api.MessageNode; - -@Value -class ClanJoinMessage -{ - private final MessageNode messageNode; - private final int getMessageId; - private final int tick; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanMemberActivity.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanMemberActivity.java deleted file mode 100644 index 1cea036a95..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanMemberActivity.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2018, trimbe - * 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.clanchat; - -import lombok.AllArgsConstructor; -import lombok.Value; -import net.runelite.api.ClanMember; - -@Value -@AllArgsConstructor -class ClanMemberActivity -{ - private ClanActivityType activityType; - private ClanMember member; - private Integer tick; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanmanmode/ClanManModeConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanmanmode/ClanManModeConfig.java deleted file mode 100644 index dc71d8108c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanmanmode/ClanManModeConfig.java +++ /dev/null @@ -1,175 +0,0 @@ -package net.runelite.client.plugins.clanmanmode; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("clanmanmode") -public interface ClanManModeConfig extends Config -{ - @ConfigItem( - position = 0, - keyName = "highlightattackable", - name = "Highlight attackable targets", - description = "Highlights targets attackable by all clan members" - ) - default boolean highlightAttackable() - { - return false; - } - - @ConfigItem( - position = 1, - keyName = "attackablecolor", - name = "Attackable target c olor", - description = "Color of targets all clan members can target" - ) - default Color getAttackableColor() - { - return new Color(0, 184, 212); - } - - @ConfigItem( - position = 2, - keyName = "highlightattacked", - name = "Highlight clan targets", - description = "Highlights people being attacked by your clan" - ) - default boolean highlightAttacked() - { - return false; - } - - @ConfigItem( - position = 3, - keyName = "attackedcolor", - name = "Clan target color", - description = "Color of players being attacked by clan" - ) - default Color getClanAttackableColor() - { - return new Color(0, 184, 212); - } - - @ConfigItem( - position = 4, - keyName = "drawPlayerTiles", - name = "Draw tiles under players", - description = "Configures whether or not tiles under highlighted players should be drawn" - ) - default boolean drawTiles() - { - return false; - } - - @ConfigItem( - position = 5, - keyName = "drawOverheadPlayerNames", - name = "Draw names above players", - description = "Configures whether or not player names should be drawn above players" - ) - default boolean drawOverheadPlayerNames() - { - return true; - } - - @ConfigItem( - position = 6, - keyName = "drawMinimapNames", - name = "Draw names on minimap", - description = "Configures whether or not minimap names for players with rendered names should be drawn" - ) - default boolean drawMinimapNames() - { - return false; - } - - @ConfigItem( - position = 7, - keyName = "showtargets", - name = "Highlight My Attackers", - description = "Shows players interacting with you" - ) - default boolean showAttackers() - { - return false; - } - - @ConfigItem( - position = 8, - keyName = "attackcolor", - name = "Attacker Color", - description = "Color of attackers" - ) - default Color getAttackerColor() - { - return new Color(255, 0, 0); - } - - @ConfigItem( - position = 9, - keyName = "showbold", - name = "Bold names of clan targets", - description = "Turns names of clan targets bold" - ) - default boolean ShowBold() - { - return false; - } - - @ConfigItem( - position = 10, - keyName = "hideafter", - name = "Hide attackable targets after login", - description = "Automatically disables attackable player highlighting after login" - ) - default boolean hideAttackable() - { - return false; - } - - @ConfigItem( - position = 11, - keyName = "hidetime", - name = "Ticks to hide", - description = "How many ticks after you are logged in that attackbles are hidden (1 tick = 0.6 seconds)" - ) - default int hideTime() - { - return 5; - } - - @ConfigItem( - position = 12, - keyName = "mycblvl", - name = "Calc targets on my own combat level", - description = "Calculates potential targets based off your own combat lvl instead of clans" - ) - default boolean CalcSelfCB() - { - return false; - } - - @ConfigItem( - position = 14, - keyName = "showclanmembers", - name = "Persistent Clan Members", - description = "Will highlight clan members even when not in clan chat" - ) - default boolean PersistentClan() - { - return false; - } - - @ConfigItem( - position = 15, - keyName = "clancolor", - name = "Clan Member Color", - description = "Color of clan members" - ) - default Color getClanMemberColor() - { - return new Color(255, 0, 0); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanmanmode/ClanManModeMinimapOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanmanmode/ClanManModeMinimapOverlay.java deleted file mode 100644 index 8f4a61c2b8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanmanmode/ClanManModeMinimapOverlay.java +++ /dev/null @@ -1,52 +0,0 @@ -package net.runelite.client.plugins.clanmanmode; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Player; -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; - -@Singleton -public class ClanManModeMinimapOverlay extends Overlay -{ - private final ClanManModeService ClanManModeService; - private final ClanManModePlugin plugin; - - @Inject - private ClanManModeMinimapOverlay(final ClanManModePlugin plugin, final ClanManModeService ClanManModeService) - { - this.plugin = plugin; - this.ClanManModeService = ClanManModeService; - setLayer(OverlayLayer.ABOVE_WIDGETS); - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGH); - } - - @Override - public Dimension render(Graphics2D graphics) - { - ClanManModeService.forEachPlayer((player, color) -> renderPlayerOverlay(graphics, player, color)); - return null; - } - - private void renderPlayerOverlay(Graphics2D graphics, Player actor, Color color) - { - final String name = actor.getName().replace('\u00A0', ' '); - - if (plugin.isDrawMinimapNames()) - { - final net.runelite.api.Point minimapLocation = actor.getMinimapLocation(); - - if (minimapLocation != null) - { - OverlayUtil.renderTextLocation(graphics, minimapLocation, name, color); - } - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanmanmode/ClanManModeOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanmanmode/ClanManModeOverlay.java deleted file mode 100644 index cd98f5fd46..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanmanmode/ClanManModeOverlay.java +++ /dev/null @@ -1,58 +0,0 @@ -package net.runelite.client.plugins.clanmanmode; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Player; -import net.runelite.api.Point; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; -import net.runelite.client.ui.overlay.OverlayUtil; - -@Singleton -public class ClanManModeOverlay extends Overlay -{ - private final ClanManModeService ClanManModeService; - private final ClanManModePlugin plugin; - - @Inject - private ClanManModeOverlay(final ClanManModePlugin plugin, final ClanManModeService ClanManModeService) - { - this.plugin = plugin; - this.ClanManModeService = ClanManModeService; - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.MED); - } - - @Override - public Dimension render(Graphics2D graphics) - { - ClanManModeService.forEachPlayer((player, color) -> renderPlayerOverlay(graphics, player, color)); - return null; - } - - private void renderPlayerOverlay(Graphics2D graphics, Player actor, Color color) - { - if (!plugin.isDrawOverheadPlayerNames()) - { - return; - } - - String name = actor.getName().replace('\u00A0', ' '); - int offset = actor.getLogicalHeight() + 40; - Point textLocation = actor.getCanvasTextLocation(graphics, name, offset); - - if (textLocation != null) - { - if (plugin.getGetClanAttackableColor().equals(color) && plugin.isShowBold()) - { - graphics.setFont(FontManager.getRunescapeBoldFont()); - } - OverlayUtil.renderTextLocation(graphics, textLocation, name, color); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanmanmode/ClanManModePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanmanmode/ClanManModePlugin.java deleted file mode 100644 index 43cce0cd77..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanmanmode/ClanManModePlugin.java +++ /dev/null @@ -1,182 +0,0 @@ -package net.runelite.client.plugins.clanmanmode; - -import com.google.inject.Provides; -import java.awt.Color; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.Player; -import net.runelite.api.Varbits; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "Clan Man Mode", - description = "Assists in clan PVP scenarios", - tags = {"highlight", "minimap", "overlay", "players"}, - type = PluginType.PVP, - enabledByDefault = false -) -@Singleton -public class ClanManModePlugin extends Plugin -{ - final Map clan = new HashMap<>(); - int wildernessLevel; - int clanmin; - int clanmax; - int inwildy; - int ticks; - - @Inject - private OverlayManager overlayManager; - - @Inject - private ClanManModeConfig config; - - @Inject - private ClanManModeOverlay ClanManModeOverlay; - - @Inject - private ClanManModeTileOverlay ClanManModeTileOverlay; - - @Inject - private ClanManModeMinimapOverlay ClanManModeMinimapOverlay; - - @Inject - private Client client; - - @Getter(AccessLevel.PACKAGE) - private boolean highlightAttackable; - @Getter(AccessLevel.PACKAGE) - private Color getAttackableColor; - @Getter(AccessLevel.PACKAGE) - private boolean highlightAttacked; - @Getter(AccessLevel.PACKAGE) - private Color getClanAttackableColor; - @Getter(AccessLevel.PACKAGE) - private boolean drawTiles; - @Getter(AccessLevel.PACKAGE) - private boolean drawOverheadPlayerNames; - @Getter(AccessLevel.PACKAGE) - private boolean drawMinimapNames; - @Getter(AccessLevel.PACKAGE) - private boolean showAttackers; - @Getter(AccessLevel.PACKAGE) - private Color getAttackerColor; - @Getter(AccessLevel.PACKAGE) - private boolean ShowBold; - @Getter(AccessLevel.PACKAGE) - private boolean hideAttackable; - @Getter(AccessLevel.PACKAGE) - private int hideTime; - @Getter(AccessLevel.PACKAGE) - private boolean CalcSelfCB; - @Getter(AccessLevel.PACKAGE) - private boolean PersistentClan; - @Getter(AccessLevel.PACKAGE) - private Color getClanMemberColor; - - @Provides - ClanManModeConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(ClanManModeConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(ClanManModeOverlay); - overlayManager.add(ClanManModeTileOverlay); - overlayManager.add(ClanManModeMinimapOverlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(ClanManModeOverlay); - overlayManager.remove(ClanManModeTileOverlay); - overlayManager.remove(ClanManModeMinimapOverlay); - clan.clear(); - ticks = 0; - wildernessLevel = 0; - clanmin = 0; - clanmax = 0; - inwildy = 0; - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!"clanmanmode".equals(event.getGroup())) - { - return; - } - - updateConfig(); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged gameStateChanged) - { - if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN || gameStateChanged.getGameState() == GameState.HOPPING) - { - ticks = 0; - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - ticks++; - final Player localPlayer = client.getLocalPlayer(); - if (!clan.containsKey(localPlayer.getName())) - { - clan.put(localPlayer.getName(), localPlayer.getCombatLevel()); - } - WorldPoint a = localPlayer.getWorldLocation(); - int underLevel = ((a.getY() - 9920) / 8) + 1; - int upperLevel = ((a.getY() - 3520) / 8) + 1; - wildernessLevel = a.getY() > 6400 ? underLevel : upperLevel; - inwildy = client.getVar(Varbits.IN_WILDERNESS); - if (clan.size() > 0) - { - clanmin = Collections.min(clan.values()); - clanmax = Collections.max(clan.values()); - } - } - - private void updateConfig() - { - this.highlightAttackable = config.highlightAttackable(); - this.getAttackableColor = config.getAttackableColor(); - this.highlightAttacked = config.highlightAttacked(); - this.getClanAttackableColor = config.getClanAttackableColor(); - this.drawTiles = config.drawTiles(); - this.drawOverheadPlayerNames = config.drawOverheadPlayerNames(); - this.drawMinimapNames = config.drawMinimapNames(); - this.showAttackers = config.showAttackers(); - this.getAttackerColor = config.getAttackerColor(); - this.ShowBold = config.ShowBold(); - this.hideAttackable = config.hideAttackable(); - this.hideTime = config.hideTime(); - this.CalcSelfCB = config.CalcSelfCB(); - this.PersistentClan = config.PersistentClan(); - this.getClanMemberColor = config.getClanMemberColor(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanmanmode/ClanManModeService.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanmanmode/ClanManModeService.java deleted file mode 100644 index 6ee96df85d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanmanmode/ClanManModeService.java +++ /dev/null @@ -1,173 +0,0 @@ -package net.runelite.client.plugins.clanmanmode; - -import java.awt.Color; -import java.util.HashMap; -import java.util.Map; -import java.util.function.BiConsumer; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Actor; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.Player; -import net.runelite.api.coords.WorldPoint; - -@Singleton -public class ClanManModeService -{ - private final Client client; - private final ClanManModePlugin plugin; - - @Inject - private ClanManModeService(final Client client, final ClanManModePlugin plugin) - { - this.client = client; - this.plugin = plugin; - } - - private final Map interactors = new HashMap<>(); - - public void forEachPlayer(final BiConsumer consumer) - { - int minatk = plugin.clanmax - plugin.wildernessLevel; - int maxatk = plugin.clanmin + plugin.wildernessLevel; - final Player localPlayer = client.getLocalPlayer(); - final String localName = localPlayer.getName(); - int selfmin = localPlayer.getCombatLevel() - plugin.wildernessLevel; - int selfmax = localPlayer.getCombatLevel() + plugin.wildernessLevel; - for (Player player : client.getPlayers()) - { - if (player == null || player.getName() == null || player.equals(localPlayer)) - { - continue; - } - - boolean isClanMember = player.isClanMember(); - Actor interacting = player.getInteracting(); - Player interactor = null; - if (interacting != null && !(interacting instanceof NPC)) - { - interactor = ((Player) interacting); - } - - if (plugin.isShowAttackers() && interactor != null && interactor.getName().equals(localName)) - { - consumer.accept(player, plugin.getGetAttackerColor()); - } - - if (plugin.inwildy == 1) - { - if (isClanMember) - { - if (!plugin.clan.containsKey(player.getName())) - { - plugin.clan.put(player.getName(), player.getCombatLevel()); - } - if (plugin.isHighlightAttacked() && interactor != null && !interactors.containsKey(interactor.getName())) - { - WorldPoint a = interactor.getWorldLocation(); - int underLevel = ((a.getY() - 9920) / 8) + 1; - int upperLevel = ((a.getY() - 3520) / 8) + 1; - int wildernessLevel = a.getY() > 6400 ? underLevel : upperLevel; - int wildydiff = plugin.wildernessLevel - wildernessLevel; - if (wildydiff < 0) - { - wildydiff = 0; - } - if (plugin.isCalcSelfCB()) - { - if (interacting.getCombatLevel() <= selfmax && interacting.getCombatLevel() - wildydiff >= selfmin && !interactor.isClanMember()) - { - interactors.put(interactor.getName(), player.getName()); - consumer.accept(interactor, plugin.getGetClanAttackableColor()); - } - } - else - { - if (interacting.getCombatLevel() <= maxatk && interacting.getCombatLevel() - wildydiff >= minatk && !interactor.isClanMember()) - { - interactors.put(interactor.getName(), player.getName()); - consumer.accept(interactor, plugin.getGetClanAttackableColor()); - } - } - } - } - else - { - if (plugin.isPersistentClan() && plugin.clan.containsKey(player.getName())) - { - consumer.accept(player, plugin.getGetClanMemberColor()); - } - if (plugin.isHighlightAttacked() && interactors.containsKey(player.getName())) - { - String attackername = interactors.get(player.getName()); - boolean found = false; - for (Player attacker : client.getPlayers()) - { - if (attacker == null || attacker.getName() == null) - { - continue; - } - if (attacker.getName().equals(attackername)) - { - found = true; - Actor ainteract = attacker.getInteracting(); - if (ainteract != null) - { - if (ainteract.getName().equals(player.getName())) - { - consumer.accept(player, plugin.getGetClanAttackableColor()); - } - else - { - interactors.remove(player.getName()); - } - } - else - { - interactors.remove(player.getName()); - } - break; - } - } - if (!found) - { - interactors.remove(player.getName()); - } - continue; - } - if (plugin.isHighlightAttackable()) - { - if ((plugin.isHideAttackable() && plugin.ticks >= plugin.getHideTime()) || plugin.clan.containsKey(player.getName())) - { - continue; - } - WorldPoint a = player.getWorldLocation(); - int underLevel = ((a.getY() - 9920) / 8) + 1; - int upperLevel = ((a.getY() - 3520) / 8) + 1; - int wildernessLevel = a.getY() > 6400 ? underLevel : upperLevel; - int wildydiff = plugin.wildernessLevel - wildernessLevel; - if (wildydiff < 0) - { - wildydiff = 0; - } - if (plugin.isCalcSelfCB()) - { - if (player.getCombatLevel() <= selfmax && player.getCombatLevel() - wildydiff >= selfmin) - { - consumer.accept(player, plugin.getGetAttackableColor()); - } - } - else - { - if (player.getCombatLevel() <= maxatk && player.getCombatLevel() - wildydiff >= minatk) - { - consumer.accept(player, plugin.getGetAttackableColor()); - } - } - } - } - } - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanmanmode/ClanManModeTileOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanmanmode/ClanManModeTileOverlay.java deleted file mode 100644 index 8a70eef7c6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanmanmode/ClanManModeTileOverlay.java +++ /dev/null @@ -1,50 +0,0 @@ -package net.runelite.client.plugins.clanmanmode; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import javax.inject.Inject; -import javax.inject.Singleton; -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; - -@Singleton -public class ClanManModeTileOverlay extends Overlay -{ - private final ClanManModeService ClanManModeService; - private final ClanManModeConfig config; - - @Inject - private ClanManModeTileOverlay(final ClanManModeConfig config, final ClanManModeService ClanManModeService) - { - this.config = config; - this.ClanManModeService = ClanManModeService; - setLayer(OverlayLayer.ABOVE_SCENE); - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.MED); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!config.drawTiles()) - { - return null; - } - - ClanManModeService.forEachPlayer((player, color) -> - { - final Polygon poly = player.getCanvasTilePoly(); - - if (poly != null) - { - OverlayUtil.renderPolygon(graphics, poly, color); - } - }); - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollConfig.java deleted file mode 100644 index f95341e50d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollConfig.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.cluescrolls; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("cluescroll") -public interface ClueScrollConfig extends Config -{ - @ConfigItem( - keyName = "displayHintArrows", - name = "Display hint arrows", - description = "Configures whether or not to display hint arrows for clues" - ) - default boolean displayHintArrows() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollEmoteOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollEmoteOverlay.java deleted file mode 100644 index bf6c3d85d5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollEmoteOverlay.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.plugins.cluescrolls.clues.ClueScroll; -import net.runelite.client.plugins.cluescrolls.clues.EmoteClue; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayPosition; - -@Singleton -class ClueScrollEmoteOverlay extends Overlay -{ - private final ClueScrollPlugin plugin; - private final Client client; - - private boolean hasScrolled; - - @Inject - private ClueScrollEmoteOverlay(final ClueScrollPlugin plugin, final Client client) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - this.plugin = plugin; - this.client = client; - } - - @Override - public Dimension render(Graphics2D graphics) - { - ClueScroll clue = plugin.getClue(); - - if (!(clue instanceof EmoteClue)) - { - hasScrolled = false; - return null; - } - - EmoteClue emoteClue = (EmoteClue) clue; - - if (!emoteClue.getFirstEmote().hasSprite()) - { - return null; - } - - Widget emoteContainer = client.getWidget(WidgetInfo.EMOTE_CONTAINER); - - if (emoteContainer == null || emoteContainer.isHidden()) - { - return null; - } - - Widget emoteWindow = client.getWidget(WidgetInfo.EMOTE_WINDOW); - - if (emoteWindow == null) - { - return null; - } - - Widget firstEmoteWidget = null; - Widget secondEmoteWidget = null; - - for (Widget emoteWidget : emoteContainer.getDynamicChildren()) - { - if (emoteWidget.getSpriteId() == emoteClue.getFirstEmote().getSpriteId()) - { - firstEmoteWidget = emoteWidget; - plugin.highlightWidget(graphics, emoteWidget, emoteWindow, null, - emoteClue.getSecondEmote() != null ? "1st" : null); - } - else if (emoteClue.getSecondEmote() != null - && emoteWidget.getSpriteId() == emoteClue.getSecondEmote().getSpriteId()) - { - secondEmoteWidget = emoteWidget; - plugin.highlightWidget(graphics, emoteWidget, emoteWindow, null, "2nd"); - } - } - if (!hasScrolled) - { - hasScrolled = true; - plugin.scrollToWidget(WidgetInfo.EMOTE_CONTAINER, WidgetInfo.EMOTE_SCROLLBAR, firstEmoteWidget, secondEmoteWidget); - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollMusicOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollMusicOverlay.java deleted file mode 100644 index 19e0b5b01e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollMusicOverlay.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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.cluescrolls; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.plugins.cluescrolls.clues.ClueScroll; -import net.runelite.client.plugins.cluescrolls.clues.MusicClue; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayPosition; - -@Singleton -class ClueScrollMusicOverlay extends Overlay -{ - private static final Rectangle PADDING = new Rectangle(2, 1, 0, 1); - - private final ClueScrollPlugin plugin; - private final Client client; - - private boolean hasScrolled; - - @Inject - private ClueScrollMusicOverlay(final ClueScrollPlugin plugin, final Client client) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - this.plugin = plugin; - this.client = client; - } - - @Override - public Dimension render(Graphics2D graphics) - { - ClueScroll clue = plugin.getClue(); - - if (!(clue instanceof MusicClue)) - { - hasScrolled = false; - return null; - } - - MusicClue musicClue = (MusicClue) clue; - - Widget musicContainer = client.getWidget(WidgetInfo.MUSIC_WINDOW); - - if (musicContainer == null || musicContainer.isHidden()) - { - return null; - } - - Widget trackList = client.getWidget(WidgetInfo.MUSIC_TRACK_LIST); - String trackToFind = musicClue.getSong(); - Widget found = null; - - if (trackList == null) - { - return null; - } - - for (Widget track : trackList.getDynamicChildren()) - { - if (track.getText().equals(trackToFind)) - { - found = track; - break; - } - } - - if (found == null) - { - return null; - } - - if (!hasScrolled) - { - hasScrolled = true; - plugin.scrollToWidget(WidgetInfo.MUSIC_TRACK_LIST, WidgetInfo.MUSIC_TRACK_SCROLLBAR, found); - } - plugin.highlightWidget(graphics, found, trackList, PADDING, null); - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollOverlay.java deleted file mode 100644 index 546ffa9817..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollOverlay.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2016-2017, Seth - * Copyright (c) 2018, 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.client.plugins.cluescrolls; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import static net.runelite.api.ItemID.SPADE; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.client.plugins.cluescrolls.clues.ClueScroll; -import net.runelite.client.plugins.cluescrolls.clues.item.ItemRequirement; -import net.runelite.client.plugins.cluescrolls.clues.item.SingleItemRequirement; -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.OverlayPriority; -import net.runelite.client.ui.overlay.components.ComponentConstants; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; - -@Singleton -public class ClueScrollOverlay extends Overlay -{ - private static final ItemRequirement HAS_SPADE = new SingleItemRequirement(SPADE); - - public static final Color TITLED_CONTENT_COLOR = new Color(190, 190, 190); - - private final ClueScrollPlugin plugin; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - private ClueScrollOverlay(final ClueScrollPlugin plugin) - { - super(plugin); - this.plugin = plugin; - setPriority(OverlayPriority.LOW); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Clue Scroll overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - ClueScroll clue = plugin.getClue(); - - if (clue == null) - { - return null; - } - - panelComponent.getChildren().clear(); - panelComponent.setPreferredSize(new Dimension(ComponentConstants.STANDARD_WIDTH, 0)); - - clue.makeOverlayHint(panelComponent, plugin); - - if (clue.isRequiresSpade() && plugin.getInventoryItems() != null && !HAS_SPADE.fulfilledBy(plugin.getInventoryItems())) - { - panelComponent.getChildren().add(LineComponent.builder().left("").build()); - panelComponent.getChildren().add(LineComponent.builder().left("Requires Spade!").leftColor(Color.RED).build()); - } - - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollPlugin.java deleted file mode 100644 index ed294fe177..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollPlugin.java +++ /dev/null @@ -1,862 +0,0 @@ -/* - * Copyright (c) 2016-2017, Seth - * Copyright (c) 2018, 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.client.plugins.cluescrolls; - -import com.google.common.base.MoreObjects; -import com.google.inject.Binder; -import com.google.inject.Provides; -import java.awt.Color; -import java.awt.FontMetrics; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.geom.Area; -import java.awt.image.BufferedImage; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.GameState; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemDefinition; -import net.runelite.api.ItemID; -import net.runelite.api.NPC; -import net.runelite.api.ObjectDefinition; -import net.runelite.api.Point; -import net.runelite.api.Scene; -import net.runelite.api.ScriptID; -import net.runelite.api.Tile; -import net.runelite.api.TileObject; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.Widget; -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.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.cluescrolls.clues.AnagramClue; -import net.runelite.client.plugins.cluescrolls.clues.BeginnerMapClue; -import net.runelite.client.plugins.cluescrolls.clues.CipherClue; -import net.runelite.client.plugins.cluescrolls.clues.ClueScroll; -import net.runelite.client.plugins.cluescrolls.clues.CoordinateClue; -import net.runelite.client.plugins.cluescrolls.clues.CrypticClue; -import net.runelite.client.plugins.cluescrolls.clues.EmoteClue; -import net.runelite.client.plugins.cluescrolls.clues.FairyRingClue; -import net.runelite.client.plugins.cluescrolls.clues.FaloTheBardClue; -import net.runelite.client.plugins.cluescrolls.clues.HotColdClue; -import net.runelite.client.plugins.cluescrolls.clues.LocationClueScroll; -import net.runelite.client.plugins.cluescrolls.clues.LocationsClueScroll; -import net.runelite.client.plugins.cluescrolls.clues.MapClue; -import net.runelite.client.plugins.cluescrolls.clues.MusicClue; -import net.runelite.client.plugins.cluescrolls.clues.NpcClueScroll; -import net.runelite.client.plugins.cluescrolls.clues.ObjectClueScroll; -import net.runelite.client.plugins.cluescrolls.clues.SkillChallengeClue; -import net.runelite.client.plugins.cluescrolls.clues.TextClueScroll; -import net.runelite.client.plugins.cluescrolls.clues.ThreeStepCrypticClue; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.ui.overlay.components.TextComponent; -import net.runelite.client.ui.overlay.worldmap.WorldMapPointManager; -import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.ItemUtil; - -@PluginDescriptor( - name = "Clue Scroll", - description = "Show answers to clue scroll riddles, anagrams, ciphers, and cryptic clues", - tags = {"arrow", "hints", "world", "map", "coordinates", "emotes"}, - type = PluginType.UTILITY -) -@Slf4j -@Singleton -public class ClueScrollPlugin extends Plugin -{ - private static final Color HIGHLIGHT_BORDER_COLOR = Color.ORANGE; - private static final Color HIGHLIGHT_HOVER_BORDER_COLOR = HIGHLIGHT_BORDER_COLOR.darker(); - private static final Color HIGHLIGHT_FILL_COLOR = new Color(0, 255, 0, 20); - private static final int[] REGION_MIRRORS = { - // Prifddinas - 12894, 8755, - 12895, 8756, - 13150, 9011, - 13151, 9012 - }; - @Getter(AccessLevel.PUBLIC) - private final List npcsToMark = new ArrayList<>(); - - @Getter(AccessLevel.PUBLIC) - private final List objectsToMark = new ArrayList<>(); - private final TextComponent textComponent = new TextComponent(); - - @Getter(AccessLevel.PACKAGE) - private ClueScroll clue; - - @Getter(AccessLevel.PUBLIC) - private Item[] equippedItems; - - @Getter(AccessLevel.PUBLIC) - private Item[] inventoryItems; - - @Inject - @Getter(AccessLevel.PUBLIC) - private Client client; - - @Inject - private ItemManager itemManager; - - @Inject - private OverlayManager overlayManager; - - @Inject - private ClueScrollOverlay clueScrollOverlay; - - @Inject - private ClueScrollEmoteOverlay clueScrollEmoteOverlay; - - @Inject - private ClueScrollMusicOverlay clueScrollMusicOverlay; - - @Inject - private ClueScrollWorldOverlay clueScrollWorldOverlay; - - @Inject - private ClueScrollConfig config; - - @Inject - private WorldMapPointManager worldMapPointManager; - - private BufferedImage emoteImage; - private BufferedImage mapArrow; - private Integer clueItemId; - private boolean worldMapPointsSet = false; - private boolean displayHintArrows; - - /** - * Translate a coordinate either between overworld and real, or real and overworld - * - * @param worldPoint - * @param toOverworld whether to convert to overworld coordinates, or to real coordinates - * @return - */ - public static WorldPoint getMirrorPoint(WorldPoint worldPoint, boolean toOverworld) - { - int region = worldPoint.getRegionID(); - for (int i = 0; i < REGION_MIRRORS.length; i += 2) - { - int real = REGION_MIRRORS[i]; - int overworld = REGION_MIRRORS[i + 1]; - - // Test against what we are converting from - if (region == (toOverworld ? real : overworld)) - { - return WorldPoint.fromRegion(toOverworld ? overworld : real, - worldPoint.getRegionX(), worldPoint.getRegionY(), worldPoint.getPlane()); - } - } - return worldPoint; - } - - @Provides - ClueScrollConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(ClueScrollConfig.class); - } - - @Override - public void configure(Binder binder) - { - binder.bind(ClueScrollService.class).to(ClueScrollServiceImpl.class); - } - - @Override - protected void startUp() - { - - this.displayHintArrows = config.displayHintArrows(); - overlayManager.add(clueScrollOverlay); - overlayManager.add(clueScrollEmoteOverlay); - overlayManager.add(clueScrollWorldOverlay); - overlayManager.add(clueScrollMusicOverlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(clueScrollOverlay); - overlayManager.remove(clueScrollEmoteOverlay); - overlayManager.remove(clueScrollWorldOverlay); - overlayManager.remove(clueScrollMusicOverlay); - npcsToMark.clear(); - inventoryItems = null; - equippedItems = null; - resetClue(true); - } - - @Subscribe - private void onChatMessage(ChatMessage event) - { - if (event.getType() != ChatMessageType.GAMEMESSAGE && event.getType() != ChatMessageType.SPAM) - { - return; - } - - if (clue instanceof HotColdClue && ((HotColdClue) clue).update(event.getMessage(), this)) - { - worldMapPointsSet = false; - } - - if (clue instanceof SkillChallengeClue) - { - String text = Text.removeTags(event.getMessage()); - if (text.equals("Skill challenge completed.") || - text.equals("You have completed your master level challenge!") || - text.startsWith("You have completed Charlie's task,") || - text.equals("You have completed this challenge scroll.")) - { - ((SkillChallengeClue) clue).setChallengeCompleted(true); - } - } - } - - @Subscribe - private void onMenuOptionClicked(final MenuOptionClicked event) - { - if ("read".equalsIgnoreCase(event.getOption())) - { - final ItemDefinition itemComposition = itemManager.getItemDefinition(event.getIdentifier()); - - if (itemComposition != null && (itemComposition.getName().startsWith("Clue scroll") || itemComposition.getName().startsWith("Challenge scroll"))) - { - clueItemId = itemComposition.getId(); - updateClue(MapClue.forItemId(clueItemId)); - } - } - } - - @Subscribe - private void onItemContainerChanged(final ItemContainerChanged event) - { - if (event.getItemContainer() == client.getItemContainer(InventoryID.EQUIPMENT)) - { - equippedItems = event.getItemContainer().getItems(); - return; - } - - if (event.getItemContainer() != client.getItemContainer(InventoryID.INVENTORY)) - { - return; - } - - inventoryItems = event.getItemContainer().getItems(); - - // Check if item was removed from inventory - if (clue != null && clueItemId != null) - { - // Check if clue was removed from inventory - if (!ItemUtil.containsItemId(event.getItemContainer().getItems(), clueItemId)) - { - resetClue(true); - } - } - - // if three step clue check for clue scroll pieces - if (clue instanceof ThreeStepCrypticClue && ((ThreeStepCrypticClue) clue).update(client, event, itemManager)) - { - worldMapPointsSet = false; - npcsToMark.clear(); - - if (this.displayHintArrows) - { - client.clearHintArrow(); - } - - checkClueNPCs(clue, client.getCachedNPCs()); - } - } - - @Subscribe - private void onNpcSpawned(final NpcSpawned event) - { - final NPC npc = event.getNpc(); - checkClueNPCs(clue, npc); - } - - @Subscribe - private void onNpcDespawned(final NpcDespawned event) - { - final boolean removed = npcsToMark.remove(event.getNpc()); - - if (removed) - { - if (npcsToMark.isEmpty()) - { - client.clearHintArrow(); - } - else - { - // Always set hint arrow to first seen NPC - client.setHintArrow(npcsToMark.get(0)); - } - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("cluescroll")) - { - this.displayHintArrows = config.displayHintArrows(); - if (!this.displayHintArrows) - { - client.clearHintArrow(); - } - } - } - - @Subscribe - private void onGameStateChanged(final GameStateChanged event) - { - if (event.getGameState() == GameState.LOGIN_SCREEN) - { - resetClue(true); - } - } - - @Subscribe - private void onGameTick(final GameTick event) - { - objectsToMark.clear(); - - if (clue instanceof LocationsClueScroll) - { - final WorldPoint[] locations = ((LocationsClueScroll) clue).getLocations(); - - if (locations.length > 0) - { - addMapPoints(locations); - } - - if (clue instanceof ObjectClueScroll) - { - int[] objectIds = ((ObjectClueScroll) clue).getObjectIds(); - - if (objectIds.length > 0) - { - for (WorldPoint location : locations) - { - if (location != null) - { - highlightObjectsForLocation(location, objectIds); - } - } - } - } - } - - if (clue instanceof LocationClueScroll) - { - final WorldPoint[] locations = ((LocationClueScroll) clue).getLocations(); - - for (WorldPoint location : locations) - { - if (location == null) - { - continue; - } - - // Only set the location hint arrow if we do not already have more accurate location - if (location.isInScene(client) - && this.displayHintArrows - && (client.getHintArrowNpc() == null - || !npcsToMark.contains(client.getHintArrowNpc()))) - { - client.setHintArrow(location); - } - - addMapPoints(location); - - if (clue instanceof ObjectClueScroll) - { - int[] objectIds = ((ObjectClueScroll) clue).getObjectIds(); - - if (objectIds.length > 0) - { - highlightObjectsForLocation(location, objectIds); - } - } - } - } - - // Reset clue when receiving a new beginner or master clue - // These clues use a single item ID, so we cannot detect step changes based on the item ID changing - final Widget chatDialogClueItem = client.getWidget(WidgetInfo.DIALOG_SPRITE_SPRITE); - if (chatDialogClueItem != null - && (chatDialogClueItem.getItemId() == ItemID.CLUE_SCROLL_BEGINNER || chatDialogClueItem.getItemId() == ItemID.CLUE_SCROLL_MASTER)) - { - resetClue(true); - } - - // If we have a clue, save that knowledge - // so the clue window doesn't have to be open. - updateClue(findClueScroll()); - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded event) - { - if (event.getGroupId() < WidgetID.BEGINNER_CLUE_MAP_CHAMPIONS_GUILD - || event.getGroupId() > WidgetID.BEGINNER_CLUE_MAP_WIZARDS_TOWER) - { - return; - } - - updateClue(BeginnerMapClue.forWidgetID(event.getGroupId())); - } - - public BufferedImage getClueScrollImage() - { - return itemManager.getImage(ItemID.CLUE_SCROLL_MASTER); - } - - public BufferedImage getEmoteImage() - { - if (emoteImage != null) - { - return emoteImage; - } - - emoteImage = ImageUtil.getResourceStreamFromClass(getClass(), "emote.png"); - - return emoteImage; - } - - public BufferedImage getSpadeImage() - { - return itemManager.getImage(ItemID.SPADE); - } - - BufferedImage getMapArrow() - { - if (mapArrow != null) - { - return mapArrow; - } - - mapArrow = ImageUtil.getResourceStreamFromClass(getClass(), "/util/clue_arrow.png"); - - return mapArrow; - } - - private void resetClue(boolean withItemId) - { - if (clue instanceof LocationsClueScroll) - { - ((LocationsClueScroll) clue).reset(); - } - - if (withItemId) - { - clueItemId = null; - } - - clue = null; - worldMapPointManager.removeIf(ClueScrollWorldMapPoint.class::isInstance); - worldMapPointsSet = false; - npcsToMark.clear(); - - if (this.displayHintArrows) - { - client.clearHintArrow(); - } - } - - private ClueScroll findClueScroll() - { - final Widget clueScrollText = client.getWidget(WidgetInfo.CLUE_SCROLL_TEXT); - - if (clueScrollText == null) - { - return null; - } - - // Remove line breaks and also the rare occasion where there are double line breaks - final String text = Text.sanitizeMultilineText(clueScrollText.getText()).toLowerCase(); - - // Early return if this is same clue as already existing one - if (clue instanceof TextClueScroll && ((TextClueScroll) clue).getText().equalsIgnoreCase(text)) - { - return clue; - } - - if (text.startsWith("i'd like to hear some music.")) - { - return MusicClue.forText(clueScrollText.getText()); - } - - if (text.contains("degrees") && text.contains("minutes")) - { - return coordinatesToWorldPoint(text); - } - - final AnagramClue anagramClue = AnagramClue.forText(text); - if (anagramClue != null) - { - return anagramClue; - } - - final CipherClue cipherClue = CipherClue.forText(text); - if (cipherClue != null) - { - return cipherClue; - } - - final CrypticClue crypticClue = CrypticClue.forText(text); - - if (crypticClue != null) - { - return crypticClue; - } - - final EmoteClue emoteClue = EmoteClue.forText(text); - - if (emoteClue != null) - { - return emoteClue; - } - - final FairyRingClue fairyRingClue = FairyRingClue.forText(text); - - if (fairyRingClue != null) - { - return fairyRingClue; - } - - final FaloTheBardClue faloTheBardClue = FaloTheBardClue.forText(text); - - if (faloTheBardClue != null) - { - return faloTheBardClue; - } - - final HotColdClue hotColdClue = HotColdClue.forText(text); - - if (hotColdClue != null) - { - return hotColdClue; - } - - final SkillChallengeClue skillChallengeClue = SkillChallengeClue.forText(text, clueScrollText.getText()); - - if (skillChallengeClue != null) - { - return skillChallengeClue; - } - - // three step cryptic clues need unedited text to check which steps are already done - final ThreeStepCrypticClue threeStepCrypticClue = ThreeStepCrypticClue.forText(text, clueScrollText.getText()); - - if (threeStepCrypticClue != null) - { - return threeStepCrypticClue; - } - - // We have unknown clue, reset - log.warn("Encountered unhandled clue text: {}", clueScrollText.getText()); - resetClue(true); - return null; - } - - /** - * Example input: "00 degrees 00 minutes north 07 degrees 13 minutes west" - * Note: some clues use "1 degree" instead of "01 degrees" - */ - private CoordinateClue coordinatesToWorldPoint(String text) - { - String[] splitText = text.split(" "); - - if (splitText.length != 10) - { - log.warn("Splitting \"" + text + "\" did not result in an array of 10 cells"); - return null; - } - - if (!splitText[1].startsWith("degree") || !splitText[3].startsWith("minute")) - { - log.warn("\"" + text + "\" is not a well formed coordinate string"); - return null; - } - - int degY = Integer.parseInt(splitText[0]); - int minY = Integer.parseInt(splitText[2]); - - if (splitText[4].equals("south")) - { - degY *= -1; - minY *= -1; - } - - int degX = Integer.parseInt(splitText[5]); - int minX = Integer.parseInt(splitText[7]); - - if (splitText[9].equals("west")) - { - degX *= -1; - minX *= -1; - } - - WorldPoint coordinate = coordinatesToWorldPoint(degX, minX, degY, minY); - // Convert from overworld to real - WorldPoint mirrorPoint = getMirrorPoint(coordinate, false); - // Use mirror point as mirrorLocation if there is one - return new CoordinateClue(text, coordinate, coordinate == mirrorPoint ? null : mirrorPoint); - } - - /** - * This conversion is explained on - * https://oldschool.runescape.wiki/w/Treasure_Trails/Guide/Coordinates - */ - private WorldPoint coordinatesToWorldPoint(int degX, int minX, int degY, int minY) - { - // Center of the Observatory - int x2 = 2440; - int y2 = 3161; - - x2 += degX * 32 + Math.round(minX / 1.875); - y2 += degY * 32 + Math.round(minY / 1.875); - - return new WorldPoint(x2, y2, 0); - } - - private void addMapPoints(WorldPoint... points) - { - if (worldMapPointsSet) - { - return; - } - - worldMapPointsSet = true; - worldMapPointManager.removeIf(ClueScrollWorldMapPoint.class::isInstance); - - for (final WorldPoint point : points) - { - worldMapPointManager.add(new ClueScrollWorldMapPoint(point, this)); - } - } - - private void highlightObjectsForLocation(final WorldPoint location, final int... objectIds) - { - final LocalPoint localLocation = LocalPoint.fromWorld(client, location); - - if (localLocation == null) - { - return; - } - - final Scene scene = client.getScene(); - final Tile[][][] tiles = scene.getTiles(); - final Tile tile = tiles[client.getPlane()][localLocation.getSceneX()][localLocation.getSceneY()]; - objectsToMark.clear(); - - if (tile == null || tile.getGameObjects() == null) - { - return; - } - - for (GameObject object : tile.getGameObjects()) - { - if (object == null) - { - continue; - } - - for (int id : objectIds) - { - if (object.getId() == id) - { - objectsToMark.add(object); - continue; - } - - // Check impostors - final ObjectDefinition comp = client.getObjectDefinition(object.getId()); - final ObjectDefinition impostor = comp.getImpostorIds() != null ? comp.getImpostor() : comp; - - if (impostor != null && impostor.getId() == id) - { - objectsToMark.add(object); - } - } - } - } - - private void checkClueNPCs(ClueScroll clue, final NPC... npcs) - { - if (!(clue instanceof NpcClueScroll)) - { - return; - } - - final NpcClueScroll npcClueScroll = (NpcClueScroll) clue; - - if (npcClueScroll.getNpcs() == null || npcClueScroll.getNpcs().length == 0) - { - return; - } - - for (NPC npc : npcs) - { - if (npc == null || npc.getName() == null) - { - continue; - } - - for (String npcName : npcClueScroll.getNpcs()) - { - if (!Objects.equals(npc.getName(), npcName)) - { - continue; - } - - npcsToMark.add(npc); - } - } - - if (!npcsToMark.isEmpty() && this.displayHintArrows) - { - // Always set hint arrow to first seen NPC - client.setHintArrow(npcsToMark.get(0)); - } - } - - private void updateClue(final ClueScroll clue) - { - if (clue == null || clue == this.clue) - { - return; - } - - resetClue(false); - checkClueNPCs(clue, client.getCachedNPCs()); - this.clue = clue; - } - - void highlightWidget(Graphics2D graphics, Widget toHighlight, Widget container, Rectangle padding, String text) - { - padding = MoreObjects.firstNonNull(padding, new Rectangle()); - - Point canvasLocation = toHighlight.getCanvasLocation(); - - if (canvasLocation == null) - { - return; - } - - Point windowLocation = container.getCanvasLocation(); - - if (windowLocation.getY() > canvasLocation.getY() + toHighlight.getHeight() - || windowLocation.getY() + container.getHeight() < canvasLocation.getY()) - { - return; - } - - // Visible area of widget - Area widgetArea = new Area( - new Rectangle( - canvasLocation.getX() - padding.x, - Math.max(canvasLocation.getY(), windowLocation.getY()) - padding.y, - toHighlight.getWidth() + padding.x + padding.width, - Math.min( - Math.min(windowLocation.getY() + container.getHeight() - canvasLocation.getY(), toHighlight.getHeight()), - Math.min(canvasLocation.getY() + toHighlight.getHeight() - windowLocation.getY(), toHighlight.getHeight())) + padding.y + padding.height - )); - - OverlayUtil.renderHoverableArea(graphics, widgetArea, client.getMouseCanvasPosition(), - HIGHLIGHT_FILL_COLOR, HIGHLIGHT_BORDER_COLOR, HIGHLIGHT_HOVER_BORDER_COLOR); - - if (text == null) - { - return; - } - - FontMetrics fontMetrics = graphics.getFontMetrics(); - - textComponent.setPosition(new java.awt.Point( - canvasLocation.getX() + toHighlight.getWidth() / 2 - fontMetrics.stringWidth(text) / 2, - canvasLocation.getY() + fontMetrics.getHeight())); - textComponent.setText(text); - textComponent.render(graphics); - } - - void scrollToWidget(WidgetInfo list, WidgetInfo scrollbar, Widget... toHighlight) - { - final Widget parent = client.getWidget(list); - int averageCentralY = 0; - int nonnullCount = 0; - for (Widget widget : toHighlight) - { - if (widget != null) - { - averageCentralY += widget.getRelativeY() + widget.getHeight() / 2; - nonnullCount += 1; - } - } - if (nonnullCount == 0) - { - return; - } - averageCentralY /= nonnullCount; - final int newScroll = Math.max(0, Math.min(parent.getScrollHeight(), - averageCentralY - parent.getHeight() / 2)); - - client.runScript( - ScriptID.UPDATE_SCROLLBAR, - scrollbar.getId(), - list.getId(), - newScroll - ); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollService.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollService.java deleted file mode 100644 index e84c77808f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollService.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2018, Ron Young - * 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.cluescrolls; - -import net.runelite.client.plugins.cluescrolls.clues.ClueScroll; - -public interface ClueScrollService -{ - /** - * Get the clue scroll - * - * @return ClueScroll - */ - ClueScroll getClue(); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollServiceImpl.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollServiceImpl.java deleted file mode 100644 index 53887d80c6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollServiceImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, Ron Young - * 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.cluescrolls; - -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.client.plugins.cluescrolls.clues.ClueScroll; - -@Singleton -class ClueScrollServiceImpl implements ClueScrollService -{ - private final ClueScrollPlugin plugin; - - @Inject - private ClueScrollServiceImpl(final ClueScrollPlugin plugin) - { - this.plugin = plugin; - } - - @Override - public ClueScroll getClue() - { - return plugin.getClue(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollWorldMapPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollWorldMapPoint.java deleted file mode 100644 index 0ee530285c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollWorldMapPoint.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2018, Morgan Lewis - * 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.cluescrolls; - -import java.awt.Graphics; -import java.awt.image.BufferedImage; -import net.runelite.api.Point; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; - -class ClueScrollWorldMapPoint extends WorldMapPoint -{ - private final ClueScrollPlugin plugin; - private final BufferedImage clueScrollWorldImage; - private final Point clueScrollWorldImagePoint; - - ClueScrollWorldMapPoint(final WorldPoint worldPoint, final ClueScrollPlugin plugin) - { - super(worldPoint, null); - - clueScrollWorldImage = new BufferedImage(plugin.getMapArrow().getWidth(), plugin.getMapArrow().getHeight(), BufferedImage.TYPE_INT_ARGB); - Graphics graphics = clueScrollWorldImage.getGraphics(); - graphics.drawImage(plugin.getMapArrow(), 0, 0, null); - graphics.drawImage(plugin.getClueScrollImage(), 0, 0, null); - clueScrollWorldImagePoint = new Point( - clueScrollWorldImage.getWidth() / 2, - clueScrollWorldImage.getHeight()); - - this.plugin = plugin; - this.setSnapToEdge(true); - this.setJumpOnClick(true); - this.setImage(clueScrollWorldImage); - this.setImagePoint(clueScrollWorldImagePoint); - } - - @Override - public void onEdgeSnap() - { - this.setImage(plugin.getClueScrollImage()); - this.setImagePoint(null); - } - - @Override - public void onEdgeUnsnap() - { - this.setImage(clueScrollWorldImage); - this.setImagePoint(clueScrollWorldImagePoint); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollWorldOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollWorldOverlay.java deleted file mode 100644 index 0c4598043b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/ClueScrollWorldOverlay.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.client.plugins.cluescrolls.clues.ClueScroll; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayPosition; - -@Singleton -public class ClueScrollWorldOverlay extends Overlay -{ - public static final int IMAGE_Z_OFFSET = 30; - - public static final Color CLICKBOX_BORDER_COLOR = Color.ORANGE; - public static final Color CLICKBOX_HOVER_BORDER_COLOR = CLICKBOX_BORDER_COLOR.darker(); - public static final Color CLICKBOX_FILL_COLOR = new Color(0, 255, 0, 20); - - private final ClueScrollPlugin plugin; - - @Inject - private ClueScrollWorldOverlay(final ClueScrollPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - ClueScroll clue = plugin.getClue(); - - if (clue != null) - { - clue.makeWorldOverlayHint(graphics, plugin); - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/AnagramClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/AnagramClue.java deleted file mode 100644 index 35abffe0ee..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/AnagramClue.java +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls.clues; - -import com.google.common.collect.ImmutableSet; -import java.awt.Color; -import java.awt.Graphics2D; -import java.util.Set; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.NPC; -import net.runelite.api.ObjectID; -import net.runelite.api.TileObject; -import net.runelite.api.coords.WorldPoint; -import static net.runelite.client.plugins.cluescrolls.ClueScrollOverlay.TITLED_CONTENT_COLOR; -import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin; -import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.CLICKBOX_BORDER_COLOR; -import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.CLICKBOX_FILL_COLOR; -import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.CLICKBOX_HOVER_BORDER_COLOR; -import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.IMAGE_Z_OFFSET; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -@Getter(AccessLevel.PUBLIC) -public class AnagramClue extends ClueScroll implements TextClueScroll, NpcClueScroll, ObjectClueScroll -{ - private static final String ANAGRAM_TEXT = "This anagram reveals who to speak to next: "; - private static final String ANAGRAM_TEXT_BEGINNER = "The anagram reveals who to speak to next: "; - - private static final Set CLUES = ImmutableSet.of( - new AnagramClue("A BAKER", "Baraek", new WorldPoint(3217, 3434, 0), "Varrock square", "How many stalls are there in Varrock Square?", "5"), - new AnagramClue("A BASIC ANTI POT", "Captain Tobias", new WorldPoint(3026, 3216, 0), "Port Sarim", "How many ships are there docked at Port Sarim currently?", "6"), - new AnagramClue("A ELF KNOWS", "Snowflake", new WorldPoint(2872, 3934, 0), "Weiss"), - new AnagramClue("A HEART", "Aretha", new WorldPoint(1814, 3851, 0), "Soul altar", "32 - 5x = 22, what is x?", "2"), - new AnagramClue("A ZEN SHE", "Zenesha", new WorldPoint(2652, 3295, 0), "Platebody Southern Ardougne centre square"), - new AnagramClue("ACE MATCH ELM", "Cam The Camel", new WorldPoint(3300, 3231, 0), "North of the glider in Al Kharid"), - new AnagramClue("AHA JAR", "Jaraah", new WorldPoint(3359, 3276, 0), "Duel Arena hospital"), - new AnagramClue("AN PAINT TONIC", "Captain Ninto", new WorldPoint(2865, 9877, 0), "Bar under White Wolf Mountain"), - new AnagramClue("ARC O LINE", "Caroline", new WorldPoint(2715, 3302, 0), "North Witchaven next to the row boat", "How many fishermen are there on the fishing platform?", "11"), - new AnagramClue("ARE COL", "Oracle", new WorldPoint(3013, 3501, 0), "Ice Mountain West of Edgeville", "If x is 15 and y is 3 what is 3x + y?", "48"), - new AnagramClue("ARMCHAIR THE PELT", "Charlie the Tramp", new WorldPoint(3209, 3392, 0), "South entrance of Varrock", "How many coins would I have if I had 0 coins and attempted to buy 3 loaves of bread?", "0"), - new AnagramClue("ARR! SO I AM A CRUST, AND?", "Ramara du Croissant", new WorldPoint(2339, 3677, 0), "Piscatoris Fishing Colony"), - new AnagramClue("AT HERG", "Regath", new WorldPoint(1719, 3723, 0), "General Store, Arceuus, Zeah", "What is -5 to the power of 2?", "25"), - new AnagramClue("A BAS", "Saba", new WorldPoint(2858, 3577, 0), "Death Plateau"), - new AnagramClue("AREA CHEF TREK", "Father Aereck", new WorldPoint(3243, 3208, 0), "Lumbridge Church", "How many gravestones are in the church graveyard?", "19 or 20"), - new AnagramClue("BAIL TRIMS", "Brimstail", new WorldPoint(2402, 3419, 0), "West of Stronghold Slayer Cave"), - new AnagramClue("BAKER CLIMB", "Brambickle", new WorldPoint(2783, 3861, 0), "Trollweiss mountain"), - new AnagramClue("BLUE GRIM GUIDED", "Lumbridge Guide", new WorldPoint(3232, 3232, 0), "Lumbridge"), - new AnagramClue("BY LOOK", "Bolkoy", new WorldPoint(2529, 3162, 0), "Tree Gnome Village general store", "How many flowers are there in the clearing below this platform?", "13"), - new AnagramClue("CALAMARI MADE MUD", "Madame Caldarium", new WorldPoint(2553, 2868, 0), "Corsair Cove", "What is 3(5-3)?", "6"), - new AnagramClue("CAR IF ICES", "Sacrifice", new WorldPoint(2209, 3056, 0), "Zul-Andra"), - new AnagramClue("CAREER IN MOON", "Oneiromancer", new WorldPoint(2150, 3866, 0), "Astral altar", "How many Suqah inhabit Lunar isle?", "25"), - new AnagramClue("CLASH ION", "Nicholas", new WorldPoint(1841, 3803, 0), "North of Port Piscarilius fishing shop", "How many windows are in Tynan's shop?", "4"), - new AnagramClue("C ON GAME HOC", "Gnome Coach", new WorldPoint(2395, 3486, 0), "Gnome Ball course", "How many gnomes on the Gnome ball field have red patches on their uniforms?", "6"), - new AnagramClue("COOL NERD", "Old crone", new WorldPoint(3462, 3557, 0), "East of the Slayer Tower", "What is the combined combat level of each species that live in Slayer tower?", "619"), - new AnagramClue("COPPER ORE CRYPTS", "Prospector Percy", new WorldPoint(3061, 3377, 0), "Motherlode Mine", "During a party, everyone shook hands with everyone else. There were 66 handshakes. How many people were at the party?", "12"), - new AnagramClue("DED WAR", "Edward", new WorldPoint(3284, 3943, 0), "Inside Rogue's Castle"), - new AnagramClue("DEKAGRAM", "Dark mage", new WorldPoint(3039, 4835, 0), "Centre of the Abyss", "How many rifts are found here in the abyss?", "13"), - new AnagramClue("DO SAY MORE", "Doomsayer", new WorldPoint(3230, 3230, 0), "East of Lumbridge Castle", "What is 40 divided by 1/2 plus 15?", "95"), - new AnagramClue("DIM THARN", "Mandrith", new WorldPoint(3182, 3946, 0), "Wilderness Resource Area"), - new AnagramClue("DR HITMAN", "Mandrith", new WorldPoint(3182, 3946, 0), "Wilderness Resource Area", "How many scorpions live under the pit?", "28"), - new AnagramClue("DR WARDEN FUNK", "Drunken Dwarf", new WorldPoint(2913, 10221, 0), "East Side of Keldagrim"), - new AnagramClue("DRAGONS LAMENT", "Strange Old Man", new WorldPoint(3564, 3288, 0), "Barrows", "One pipe fills a barrel in 1 hour while another pipe can fill the same barrel in 2 hours. How many minutes will it take to fill the take if both pipes are used?", "40"), - new AnagramClue("DT RUN B", "Brundt the Chieftain", new WorldPoint(2658, 3670, 0), "Rellekka, main hall", "How many people are waiting for the next bard to perform?", "4"), - new AnagramClue("DUO PLUG", "Dugopul", new WorldPoint(2803, 2744, 0), "Graveyard on Ape Atoll"), - new AnagramClue("EEK ZERO OP", "Zoo keeper", new WorldPoint(2613, 3269, 0), "Ardougne Zoo", "How many animals are in the Ardougne Zoo?", "40"), - new AnagramClue("EL OW", "Lowe", new WorldPoint(3233, 3423, 0), "Varrock archery store"), - new AnagramClue("ERR CURE IT", "Recruiter", new WorldPoint(2541, 3305, 0), "West Ardougne centre square", "How many houses have a cross on the door?", "20"), - new AnagramClue("FORLUN", "Runolf", new WorldPoint(2512, 10256, 0), "Miscellania & Etceteria Dungeon"), - new AnagramClue("GOBLIN KERN", "King Bolren", new WorldPoint(2541, 3170, 0), "Tree Gnome Village"), - new AnagramClue("GOT A BOY", "Gabooty", new WorldPoint(2790, 3066, 0), "Centre of Tai Bwo Wannai", "How many buildings in the village?", "11"), - new AnagramClue("GULAG RUN", "Uglug Nar", new WorldPoint(2442, 3051, 0), "West of Jiggig"), - new AnagramClue("GOBLETS ODD TOES", "Otto Godblessed", new WorldPoint(2501, 3487, 0), "Otto's Grotto", "How many types of dragon are there beneath the whirlpool's cavern?", "2"), - new AnagramClue("HALT US", "Luthas", new WorldPoint(2938, 3152, 0), "Banana plantation, Karamja"), - new AnagramClue("HE DO POSE. IT IS CULTRRL, MK?", "Riki the sculptor's model", new WorldPoint(2904, 10206, 0), "East Keldagrim, south of kebab seller."), - new AnagramClue("HEORIC", "Eohric", new WorldPoint(2900, 3565, 0), "Top floor of Burthorpe Castle", "King Arthur and Merlin sit down at the Round Table with 8 knights. How many degrees does each get?", "36"), - new AnagramClue("HIS PHOR", "Horphis", new WorldPoint(1639, 3812, 0), "Arceuus Library, Zeah", "On a scale of 1-10, how helpful is Logosia?", "1"), - new AnagramClue("I AM SIR", "Marisi", new WorldPoint(1737, 3557, 0), "Allotment patch, South of Hosidius chapel", "How many cities form the Kingdom of Great Kourend?", "5"), - new AnagramClue("ICY FE", "Fycie", new WorldPoint(2630, 2997, 0), "East Feldip Hills"), - new AnagramClue("I DOOM ICON INN", "Dominic Onion", new WorldPoint(2609, 3116, 0), "Nightmare Zone", "How many reward points does a herb box cost?", "9,500"), - new AnagramClue("I EAT ITS CHART HINTS DO U", "Shiratti the Custodian", new WorldPoint(3427, 2927, 0), "North of fountain, Nardah"), - new AnagramClue("I EVEN", "Nieve", new WorldPoint(2432, 3422, 0), "The slayer master in Gnome Stronghold", "How many farming patches are there in Gnome stronghold?", "2"), - new AnagramClue("I FAFFY RUN", "Fairy Nuff", new WorldPoint(3201, 3169, 0), "North of the bank in Zanaris"), - new AnagramClue("IM N ZEZIM", "Impling", new WorldPoint(2592, 4324, 0), "The Imp inside Puro-Puro"), - new AnagramClue("KAY SIR", "Sir Kay", new WorldPoint(2760, 3496, 0), "The courtyard in Camelot Castle", "How many fountains are there within the grounds of Camelot castle.", "6"), - new AnagramClue("LEAKEY", "Kaylee", new WorldPoint(2957, 3370, 0), "Rising Sun Inn in Falador", "How many chairs are there in the Rising Sun?", "18"), - new AnagramClue("LAND DOOMD", "Odd Old Man", new WorldPoint(3359, 3506, 0), "Limestone mine northeast of Varrock"), - new AnagramClue("LARK IN DOG", "King Roald", new WorldPoint(3220, 3476, 0), "Ground floor of Varrock castle", "How many bookcases are there in the Varrock palace library?", "24"), - new AnagramClue("LOW LAG", "Gallow", new WorldPoint(1805, 3566, 0), "Vinery in the Great Kourend", "How many vine patches can you find in this vinery?", "12"), - new AnagramClue("LADDER MEMO GUV", "Guard Vemmeldo", new WorldPoint(2447, 3418, 1), "Gnome Stronghold Bank", "How many magic trees can you find inside the Gnome Stronghold?", "3"), - new AnagramClue("MAL IN TAU", "Luminata", new WorldPoint(3508, 3237, 0), "Near Burgh de Rott entrance"), - new AnagramClue("ME AM THE CALC", "Cam the Camel", new WorldPoint(3300, 3231, 0), "Outside Duel Arena"), - new AnagramClue("MACHETE CLAM", "Cam the Camel", new WorldPoint(3300, 3231, 0), "Outside Duel Arena", "How many items can carry water in RuneScape?", "6"), - new AnagramClue("ME IF", "Femi", new WorldPoint(2461, 3382, 0), "Gates of Tree Gnome Stronghold"), - new AnagramClue("MOLD LA RAN", "Old Man Ral", new WorldPoint(3602, 3209, 0), "Meiyerditch"), - new AnagramClue("MOTHERBOARD", "Brother Omad", new WorldPoint(2606, 3211, 0), "Monastery south of Ardougne", "What is the next number? 12, 13, 15, 17, 111, 113, 117, 119, 123....?", "129"), - new AnagramClue("MUS KIL READER", "Radimus Erkle", new WorldPoint(2726, 3368, 0), "Legends' Guild"), - new AnagramClue("MY MANGLE LAL", "Lammy Langle", new WorldPoint(1688, 3540, 0), "Hosidius spirit tree patch"), - new AnagramClue("NO OWNER", "Oronwen", new WorldPoint(1162, 3178, 0), "Lletya Seamstress shop in Lletya", "What is the minimum amount of quest points required to reach Lletya?", "20"), - new AnagramClue("NOD MED", "Edmond", new WorldPoint(2566, 3332, 0), "Behind the most NW house in East Ardougne", "How many pigeon cages are there around the back of Jerico's house?", "3"), - new AnagramClue("O BIRDZ A ZANY EN PC", "Cap'n Izzy No-Beard", new WorldPoint(2807, 3191, 0), "Brimhaven Agility Arena", "How many Banana Trees are there in the plantation?", "33"), - new AnagramClue("OK CO", "Cook", new WorldPoint(3207, 3214, 0), "Ground floor of Lumbridge Castle", "How many cannons does Lumbridge Castle have?", "9"), - new AnagramClue("OR ZINC FUMES WARD", "Wizard Frumscone", new WorldPoint(2594, 3086, 0), "Downstairs in the Wizards' Guild"), - new AnagramClue("OUR OWN NEEDS", "Nurse Wooned", new WorldPoint(1575, 3590, 0), "Shayzien Infirmary", "How many injured soldiers are in this tent?", "19"), - new AnagramClue("PACINNG A TAIE", "Captain Ginea", new WorldPoint(1561, 3602, 0), "Building east of Shayzien combat ring", "1 soldier can deal with 6 lizardmen. How many soldiers do we need for an army of 678 lizardmen?", "113"), - new AnagramClue("PEAK REFLEX", "Flax keeper", new WorldPoint(2744, 3444, 0), "Flax field south of Seers Village", "If I have 1014 flax, and I spin a third of them into bowstring, how many flax do I have left?", "676"), - new AnagramClue("PEATY PERT", "Party Pete", new WorldPoint(3047, 3376, 0), "Falador Party Room"), - new AnagramClue("PROFS LOSE WRONG PIE", "Professor Onglewip", new WorldPoint(3113, 3162, 0), "Ground floor of Wizards Tower"), - new AnagramClue("QUIT HORRIBLE TYRANT", "Brother Tranquility", new WorldPoint(3681, 2963, 0), "Mos Le'Harmless or Harmony Island", "If I have 49 bottles of rum to share between 7 pirates, how many would each pirate get?", "7"), - new AnagramClue("QUE SIR", "Squire", new WorldPoint(2975, 3343, 0), "Falador Castle Courtyard", "White knights are superior to black knights. 2 white knights can handle 3 black knights. How many knights do we need for an army of 981 black knights?", "654"), - new AnagramClue("R AK MI", "Karim", new WorldPoint(3273, 3181, 0), "Al Kharid Kebab shop", "I have 16 kebabs, I eat one myself and share the rest equally between 3 friends. How many do they have each?", "5"), - new AnagramClue("RAT MAT WITHIN", "Martin Thwait", new WorldPoint(2906, 3537, 0), "Rogues' Den", "How many natural fires burn in Rogue's Den?", "2"), - new AnagramClue("RED ART TANS", "Trader Stan", new WorldPoint(3041, 3193, 0), "Port Sarim Charter ship"), - new AnagramClue("RATAI", "Taria", new WorldPoint(2940, 3223, 0), "Rimmington bush patch", "How many buildings are there in Rimmington?", "7"), - new AnagramClue("R SLICER", "Clerris", new WorldPoint(1761, 3850, 0), "Arceuus mine, Zeah", "If I have 1,000 blood runes, and cast 131 ice barrage spells, how many blood runes do I have left?", "738"), - new AnagramClue("RIP MAUL", "Primula", new WorldPoint(2454, 2853, 1), "Myth's Guild, first floor"), - new AnagramClue("SAND NUT", "Dunstan", new WorldPoint(2919, 3574, 0), "Anvil in north east Burthorpe", "How much smithing experience does one receive for smelting a blurite bar?", "8"), - new AnagramClue("SEQUIN DIRGE", "Queen Sigrid", new WorldPoint(2612, 3867, 0), "Throne room of Etceteria Castle."), - new AnagramClue("SLAM DUSTER GRAIL", "Guildmaster Lars", new WorldPoint(1649, 3498, 0), "Woodcutting guild, Zeah"), - new AnagramClue("SLIDE WOMAN", "Wise Old Man", new WorldPoint(3088, 3253, 0), "Draynor Village", "How many bookcases are in the Wise Old Man's house?", "28"), - new AnagramClue("SNAH", "Hans", new WorldPoint(3218, 3219, 0), "Lumbridge Castle courtyard"), - new AnagramClue("SNAKES SO I SAIL", "Lisse Isaakson", new WorldPoint(2351, 3801, 0), "Neitiznot", "How many arctic logs are required to make a large fremennik round shield?", "2"), - new AnagramClue("TAMED ROCKS", "Dockmaster", new WorldPoint(1822, 3739, 0), "Port Piscarilius, NE of General store", "What is the cube root of 125?", "5"), - new AnagramClue("TEN WIGS ON", "Wingstone", new WorldPoint(3389, 2877, 0), "Between Nardah & Agility Pyramid"), - new AnagramClue("THEM CAL CAME", "Cam the Camel", new WorldPoint(3300, 3231, 0), "Just outside of the Duel Arena"), - new AnagramClue("THICKNO", "Hickton", new WorldPoint(2822, 3442, 0), "Catherby fletching shop", "How many ranges are there in Catherby?", "2"), - new AnagramClue("TWENTY CURE IRON", "New recruit Tony", new WorldPoint(1498, 3544, 0), "Shayzien Graveyard"), - new AnagramClue("UNLEASH NIGHT MIST", "Sigli the Huntsman", new WorldPoint(2660, 3654, 0), "Rellekka", "What is the combined slayer requirement of every monster in the slayer cave?", "302"), - new AnagramClue("VESTE", "Steve", new WorldPoint(2432, 3423, 0), "Upstairs Wyvern Area or Stronghold Slayer Cave", "How many farming patches are there in Gnome stronghold?", "2"), - new AnagramClue("VEIL VEDA", "Evil Dave", new WorldPoint(3079, 9892, 0), "Doris' basement, Edgeville", "What is 333 multiplied by 2?", "666"), - new AnagramClue("WOO AN EGG KIWI", "Awowogei", ObjectID.AWOWOGEI, new WorldPoint(2802, 2765, 0), "Ape Atoll", "If I have 303 bananas, and share them between 31 friends evenly, only handing out full bananas. How many will I have left over?", "24"), - new AnagramClue("YAWNS GY", "Ysgawyn", new WorldPoint(2340, 3167, 0), "Lletya"), - new AnagramClue("MAJORS LAVA BADS AIR", "Ambassador Alvijar", new WorldPoint(2736, 5351, 1), "Dorgesh-Kaan, NE Middle Level", "Double the miles before the initial Dorgeshuun veteran.", "2505"), - new AnagramClue("AN EARL", "Ranael", new WorldPoint(3315, 3163, 0), "Al Kharid skirt shop"), - new AnagramClue("CARPET AHOY", "Apothecary", new WorldPoint(3195, 3404, 0), "Southwest Varrock"), - new AnagramClue("DISORDER", "Sedridor", new WorldPoint(3102, 9570, 0), "Wizards' Tower basement"), - new AnagramClue("I CORD", "Doric", new WorldPoint(2951, 3450, 0), "North of Falador"), - new AnagramClue("IN BAR", "Brian", new WorldPoint(3026, 3246, 0), "Port Sarim battleaxe shop"), - new AnagramClue("RAIN COVE", "Veronica", new WorldPoint(3110, 3330, 0), "Outside Draynor Manor"), - new AnagramClue("RUG DETER", "Gertrude", new WorldPoint(3151, 3412, 0), "West of Varrock, south of the Cooks' Guild"), - new AnagramClue("SIR SHARE RED", "Hairdresser", new WorldPoint(2944, 3381, 0), "Western Falador"), - new AnagramClue("TAUNT ROOF", "Fortunato", new WorldPoint(3080, 3250, 0), "Draynor Village Market"), - new AnagramClue("HICK JET", "Jethick", new WorldPoint(2541, 3305, 0), "West Ardougne", "How many graves are there in the city graveyard?", "38"), - new AnagramClue("RUE GO", "Goreu", new WorldPoint(2335, 3162, 0), "Lletya") - ); - - private final String text; - private final String npc; - private final WorldPoint location; - private final String area; - private final String question; - private final String answer; - private int objectId; - - private AnagramClue(String text, String npc, WorldPoint location, String area) - { - this(text, npc, location, area, "", null); - } - - private AnagramClue(String text, String npc, WorldPoint location, String area, String question, String answer) - { - this.text = text; - this.npc = npc; - this.location = location; - this.area = area; - this.question = question; - this.answer = answer; - this.objectId = -1; - } - - private AnagramClue(String text, String npc, int objectId, WorldPoint location, String area, String question, String answer) - { - this(text, npc, location, area, question, answer); - this.objectId = objectId; - } - - @Override - public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin) - { - panelComponent.getChildren().add(TitleComponent.builder().text("Anagram Clue").build()); - panelComponent.getChildren().add(LineComponent.builder().left("NPC:").build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(getNpc()) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - - panelComponent.getChildren().add(LineComponent.builder().left("Location:").build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(getArea()) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - - if (getAnswer() != null) - { - panelComponent.getChildren().add(LineComponent.builder().left("Answer:").build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(getAnswer()) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - } - } - - @Override - public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) - { - if (!getLocation().isInScene(plugin.getClient())) - { - return; - } - - // Mark NPC - if (objectId == -1 && plugin.getNpcsToMark() != null) - { - for (NPC npc : plugin.getNpcsToMark()) - { - OverlayUtil.renderActorOverlayImage(graphics, npc, plugin.getClueScrollImage(), Color.ORANGE, IMAGE_Z_OFFSET); - } - } - - // Mark game object - if (objectId != -1) - { - net.runelite.api.Point mousePosition = plugin.getClient().getMouseCanvasPosition(); - - for (TileObject gameObject : plugin.getObjectsToMark()) - { - OverlayUtil.renderHoverableArea(graphics, gameObject.getClickbox(), mousePosition, - CLICKBOX_FILL_COLOR, CLICKBOX_BORDER_COLOR, CLICKBOX_HOVER_BORDER_COLOR); - - OverlayUtil.renderImageLocation(plugin.getClient(), graphics, gameObject.getLocalLocation(), plugin.getClueScrollImage(), IMAGE_Z_OFFSET); - } - } - } - - public static AnagramClue forText(String text) - { - for (AnagramClue clue : CLUES) - { - if (text.equalsIgnoreCase(ANAGRAM_TEXT + clue.text) - || text.equalsIgnoreCase(ANAGRAM_TEXT_BEGINNER + clue.text) - || text.equalsIgnoreCase(clue.question)) - { - return clue; - } - } - - return null; - } - - @Override - public String[] getNpcs() - { - return new String[]{npc}; - } - - @Override - public int[] getObjectIds() - { - return new int[]{objectId}; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/BeginnerMapClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/BeginnerMapClue.java deleted file mode 100644 index 0e84f596c0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/BeginnerMapClue.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.cluescrolls.clues; - -import com.google.common.collect.ImmutableList; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.widgets.WidgetID; - -@Getter(AccessLevel.PUBLIC) -public class BeginnerMapClue extends MapClue implements LocationClueScroll -{ - private static final ImmutableList CLUES = ImmutableList.of( - new BeginnerMapClue(WidgetID.BEGINNER_CLUE_MAP_CHAMPIONS_GUILD, new WorldPoint(3166, 3361, 0), "South West of the Champion's Guild"), - new BeginnerMapClue(WidgetID.BEGINNER_CLUE_MAP_VARROCK_EAST_MINE, new WorldPoint(3290, 3374, 0), "Outside Varrock East Mine"), - new BeginnerMapClue(WidgetID.BEGINNER_CLUE_MAP_DRAYNOR, new WorldPoint(3093, 3226, 0), "South of Draynor Village Bank"), - new BeginnerMapClue(WidgetID.BEGINNER_CLUE_MAP_NORTH_OF_FALADOR, new WorldPoint(3043, 3398, 0), "In the standing stones north of Falador"), - new BeginnerMapClue(WidgetID.BEGINNER_CLUE_MAP_WIZARDS_TOWER, new WorldPoint(3110, 3152, 0), "On the south side of the Wizard's Tower") - ); - - private final int widgetGroupID; - - private BeginnerMapClue(int widgetGroupID, WorldPoint location, String description) - { - super(-1, location, description); - this.widgetGroupID = widgetGroupID; - setRequiresSpade(true); - } - - // Beginner Map Clues all use the same ItemID, but the WidgetID used to display them is unique - public static BeginnerMapClue forWidgetID(int widgetGroupID) - { - for (BeginnerMapClue clue : CLUES) - { - if (clue.widgetGroupID == widgetGroupID) - { - return clue; - } - } - - return null; - } -} - diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CipherClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CipherClue.java deleted file mode 100644 index 0ed8b0652a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CipherClue.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls.clues; - -import com.google.common.collect.ImmutableSet; -import java.awt.Color; -import java.awt.Graphics2D; -import java.util.Set; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.NPC; -import net.runelite.api.coords.WorldPoint; -import static net.runelite.client.plugins.cluescrolls.ClueScrollOverlay.TITLED_CONTENT_COLOR; -import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin; -import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.IMAGE_Z_OFFSET; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -@Getter(AccessLevel.PUBLIC) -public class CipherClue extends ClueScroll implements TextClueScroll, NpcClueScroll, LocationClueScroll -{ - private static final Set CLUES = ImmutableSet.of( - new CipherClue("BMJ UIF LFCBC TFMMFS", "Ali the Kebab seller", new WorldPoint(3354, 2974, 0), "Pollnivneach", "How many coins would you need to purchase 133 kebabs from me?", "399"), - new CipherClue("GUHCHO", "Drezel", new WorldPoint(3440, 9895, 0), "Paterdomus", "Please solve this for x: 7x - 28=21", "7"), - new CipherClue("ZCZL", "Adam", new WorldPoint(3227, 3227, 0), "Outside Lumbridge castle", "How many snakeskins are needed in order to craft 44 boots, 29 vambraces and 34 bandanas?", "666"), - new CipherClue("ZHLUG ROG PDQ", "Weird Old Man", new WorldPoint(3224, 3112, 0), "Kalphite Lair entrance. Fairy ring BIQ", "SIX LEGS! All of them have 6! There are 25 of them! How many legs?", "150"), - new CipherClue("ECRVCKP MJCNGF", "Captain Khaled", new WorldPoint(1845, 3754, 0), "Large eastern building in Port Piscarilius", "How many fishing cranes can you find around here?", "5"), - new CipherClue("OVEXON", "Eluned", new WorldPoint(2289, 3144, 0), "Outside Lletya", "A question on elven crystal math. I have 5 and 3 crystals, large and small respectively. A large crystal is worth 10,000 coins and a small is worth but 1,000. How much are all my crystals worth?", "53,000"), - new CipherClue("VTYR APCNTGLW", "King Percival", new WorldPoint(2634, 4682, 1), "Fisher Realm, first floor. Fairy ring BJR", "How many cannons are on this here castle?", "5"), - new CipherClue("UZZU MUJHRKYYKJ", "Otto Godblessed", new WorldPoint(2501, 3487, 0), "Otto's Grotto", "How many pyre sites are found around this lake?", "3"), - new CipherClue("USBJCPSO", "Traiborn", new WorldPoint(3112, 3162, 0), "First floor of Wizards Tower", "How many air runes would I need to cast 630 wind waves?", "3150"), - new CipherClue("HCKTA IQFHCVJGT", "Fairy Godfather", new WorldPoint(2446, 4428, 0), "Zanaris throne room", "There are 3 inputs and 4 letters on each ring How many total individual fairy ring codes are possible?", "64"), - new CipherClue("ZSBKDO ZODO", "Pirate Pete", new WorldPoint(3680, 3537, 0), "Dock northeast of the Ectofunctus"), - new CipherClue("GBJSZ RVFFO", "Fairy Queen", new WorldPoint(2347, 4435, 0), "Fairy Resistance Hideout"), - new CipherClue("QSPGFTTPS HSBDLMFCPOF", "Professor Gracklebone", new WorldPoint(1625, 3802, 0), "Ground floor of Arceuus Library", "How many round tables can be found on this floor of the library?", "9"), - new CipherClue("IWPPLQTP", "Gunnjorn", new WorldPoint(2541, 3548, 0), "Barbarian Outpost Agility course"), - new CipherClue("BSOPME MZETQPS", "Arnold Lydspor", new WorldPoint(2329, 3689, 0), "Piscatoris Fishing Colony general store/bank") - ); - - private String text; - private String npc; - private WorldPoint location; - private String area; - private String question; - private String answer; - - private CipherClue(String text, String npc, WorldPoint location, String area) - { - this(text, npc, location, area, "", null); - } - - private CipherClue(String text, String npc, WorldPoint location, String area, String question, String answer) - { - this.text = "The cipher reveals who to speak to next: " + text; - this.npc = npc; - this.location = location; - this.area = area; - this.question = question; - this.answer = answer; - } - - @Override - public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin) - { - panelComponent.getChildren().add(TitleComponent.builder().text("Cipher Clue").build()); - panelComponent.getChildren().add(LineComponent.builder().left("NPC:").build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(getNpc()) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - - panelComponent.getChildren().add(LineComponent.builder().left("Location:").build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(getArea()) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - - if (getAnswer() != null) - { - panelComponent.getChildren().add(LineComponent.builder().left("Answer:").build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(getAnswer()) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - } - } - - @Override - public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) - { - if (!getLocation().isInScene(plugin.getClient())) - { - return; - } - - if (plugin.getNpcsToMark() != null) - { - for (NPC npc : plugin.getNpcsToMark()) - { - OverlayUtil.renderActorOverlayImage(graphics, npc, plugin.getClueScrollImage(), Color.ORANGE, IMAGE_Z_OFFSET); - } - } - } - - public static CipherClue forText(String text) - { - for (CipherClue clue : CLUES) - { - if (clue.text.equalsIgnoreCase(text) || clue.question.equalsIgnoreCase(text)) - { - return clue; - } - } - - return null; - } - - public String[] getNpcs() - { - return new String[]{npc}; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/ClueScroll.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/ClueScroll.java deleted file mode 100644 index 0b6bf8f724..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/ClueScroll.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls.clues; - -import java.awt.Graphics2D; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin; -import net.runelite.client.ui.overlay.components.PanelComponent; - -public abstract class ClueScroll -{ - @Setter(AccessLevel.PROTECTED) - @Getter(AccessLevel.PUBLIC) - private boolean requiresSpade; - - public abstract void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin); - - public abstract void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClue.java deleted file mode 100644 index da7a816e2f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClue.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls.clues; - -import com.google.common.collect.ImmutableMap; -import java.awt.Color; -import java.awt.Graphics2D; -import javax.annotation.Nullable; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -@Getter(AccessLevel.PUBLIC) -public class CoordinateClue extends ClueScroll implements TextClueScroll, LocationClueScroll -{ - private static final ImmutableMap CLUES = new ImmutableMap.Builder() - // Medium - .put(new WorldPoint(2479, 3158, 0), "South of fruit tree patch, west of Tree Gnome Village.") - .put(new WorldPoint(2887, 3154, 0), "West of Banana plantation on Karamja.") - .put(new WorldPoint(2743, 3151, 0), "Entrance of Brimhaven dungeon.") - .put(new WorldPoint(3184, 3150, 0), "South of Lumbridge Swamp.") - .put(new WorldPoint(3217, 3177, 0), "East of Lumbridge Swamp.") - .put(new WorldPoint(3007, 3144, 0), "Near the entrance to the Asgarnian Ice Dungeon, south of Port Sarim (AIQ).") - .put(new WorldPoint(2896, 3119, 0), "Near Karambwan fishing spot (DKP).") - .put(new WorldPoint(2697, 3207, 0), "Centre of Moss Giant Island, west of Brimhaven.") - .put(new WorldPoint(2679, 3110, 0), "North of Hazelmere's house (CLS).") - .put(new WorldPoint(3510, 3074, 0), "East of Uzer (DLQ).") - .put(new WorldPoint(3160, 3251, 0), "West of trapdoor leading to H.A.M Hideout.") - .put(new WorldPoint(2643, 3252, 0), "South of Ardougne Zoo, North of Tower of Life (DJP).") - .put(new WorldPoint(2322, 3061, 0), "South-west of Castle wars (BKP).") - .put(new WorldPoint(2875, 3046, 0), "North of nature altar, north of Shilo Village (CKR).") - .put(new WorldPoint(2849, 3033, 0), "West of nature altar, north of Shilo Village (CKR).") - .put(new WorldPoint(2848, 3296, 0), "North of Crandor island.") - .put(new WorldPoint(2583, 2990, 0), "Feldip Hills, south-east of Gu'Thanoth (AKS).") - .put(new WorldPoint(3179, 3344, 0), "In the cow pen north of the Lumbridge windmill.") - .put(new WorldPoint(2383, 3370, 0), "West of the outpost") - .put(new WorldPoint(3312, 3375, 0), "North-west of Exam Centre, on the hill.") - .put(new WorldPoint(3121, 3384, 0), "North-east of Draynor Manor, near River Lum.") - .put(new WorldPoint(3430, 3388, 0), "West of Mort Myre Swamp (BKR).") - .put(new WorldPoint(2920, 3403, 0), "South-east of Taverley, near Lady of the Lake.") - .put(new WorldPoint(2594, 2899, 0), "South-east of Feldip Hills, by the crimson swifts (AKS).") - .put(new WorldPoint(2387, 3435, 0), "West of Tree Gnome Stronghold, near the pen containing terrorbirds.") - .put(new WorldPoint(2512, 3467, 0), "Baxtorian Falls (Bring rope).") - .put(new WorldPoint(2381, 3468, 0), "West of Tree Gnome Stronghold, north of the pen with terrorbirds.") - .put(new WorldPoint(3005, 3475, 0), "Ice Mountain, west of Edgeville.") - .put(new WorldPoint(2585, 3505, 0), "By the shore line north of the Coal Trucks.") - .put(new WorldPoint(3443, 3515, 0), "South of Slayer Tower (CKS).") - .put(new WorldPoint(2416, 3516, 0), "Tree Gnome Stronghold, west of Grand Tree, near swamp.") - .put(new WorldPoint(3429, 3523, 0), "South of Slayer Tower (CKS).") - .put(new WorldPoint(2363, 3531, 0), "North-east of Eagles' Peak (AKQ).") - .put(new WorldPoint(2919, 3535, 0), "East of Burthorpe pub.") - .put(new WorldPoint(3548, 3560, 0), "Inside Fenkenstrain's Castle.") - .put(new WorldPoint(1456, 3620, 0), "Graveyard west of Shayzien (DJR).") - .put(new WorldPoint(2735, 3638, 0), "East of Rellekka, north-west of Golden Apple Tree (AJR).") - .put(new WorldPoint(2681, 3653, 0), "Rellekka, in the garden of the south-east house.") - .put(new WorldPoint(2537, 3881, 0), "Miscellania (CIP).") - .put(new WorldPoint(2828, 3234, 0), "Southern coast of Crandor.") - .put(new WorldPoint(1247, 3726, 0), "Just inside the Farming Guild") - .put(new WorldPoint(3770, 3898, 0), "On the small island north-east of Fossil Island's mushroom forest.") - // Hard - .put(new WorldPoint(2209, 3161, 0), "North-east of Tyras Camp (BJS).") - .put(new WorldPoint(2181, 3206, 0), "South of Iorwerth Camp.") - .put(new WorldPoint(3081, 3209, 0), "Small Island (CLP).") - .put(new WorldPoint(3399, 3246, 0), "Behind the Duel Arena.") - .put(new WorldPoint(2699, 3251, 0), "Little island (AIR).") - .put(new WorldPoint(3546, 3251, 0), "North-east of Burgh de Rott.") - .put(new WorldPoint(3544, 3256, 0), "North-east of Burgh de Rott.") - .put(new WorldPoint(2841, 3267, 0), "Crandor island.") - .put(new WorldPoint(3168, 3041, 0), "Bedabin Camp.") - .put(new WorldPoint(2542, 3031, 0), "Gu'Tanoth, may require 20gp.") - .put(new WorldPoint(2581, 3030, 0), "Gu'Tanoth island, enter cave north-west of Feldip Hills (AKS).") - .put(new WorldPoint(2961, 3024, 0), "Ship yard (DKP).") - .put(new WorldPoint(2339, 3311, 0), "East of Prifddinas on Arandar mountain pass.") - .put(new WorldPoint(3440, 3341, 0), "Nature Spirit's grotto (BIP).") - .put(new WorldPoint(2763, 2974, 0), "Cairn Isle, west of Shilo Village (CKR).") - .put(new WorldPoint(3138, 2969, 0), "West of Bandit Camp in Kharidian Desert.") - .put(new WorldPoint(2924, 2963, 0), "On the southern part of eastern Karamja.") - .put(new WorldPoint(2838, 2914, 0), "Kharazi Jungle, near water pool (CKR).") - .put(new WorldPoint(3441, 3419, 0), "Mort Myre Swamp (BKR).") - .put(new WorldPoint(2950, 2902, 0), "South-east of Kharazi Jungle.") - .put(new WorldPoint(2775, 2891, 0), "South-west of Kharazi Jungle.") - .put(new WorldPoint(3113, 3602, 0), "Wilderness. North of Edgeville (level 11).") - .put(new WorldPoint(2892, 3675, 0), "On the summit of Trollheim.") - .put(new WorldPoint(3168, 3677, 0), "Wilderness. Graveyard of Shadows.") - .put(new WorldPoint(2853, 3690, 0), "Entrance to the troll Stronghold.") - .put(new WorldPoint(3305, 3692, 0), "Wilderness. West of eastern green dragon.") - .put(new WorldPoint(3055, 3696, 0), "Wilderness. Bandit Camp.") - .put(new WorldPoint(3302, 3696, 0), "Wilderness. West of eastern green dragon.") - .put(new WorldPoint(1479, 3696, 0), "Lizardman Canyon (DJR).") - .put(new WorldPoint(2712, 3732, 0), "North-east of Rellekka (DKS).") - .put(new WorldPoint(2970, 3749, 0), "Wilderness. Forgotten Cemetery.") - .put(new WorldPoint(3094, 3764, 0), "Wilderness. Mining site north of Bandit Camp.") - .put(new WorldPoint(3311, 3769, 0), "Wilderness. North of Venenatis.") - .put(new WorldPoint(1460, 3782, 0), "Lovakengj, near burning man.") - .put(new WorldPoint(3244, 3792, 0), "Wilderness. South-east of Lava Dragon Isle by some Chaos Dwarves.") - .put(new WorldPoint(3140, 3804, 0), "Wilderness. North of Ruins.") - .put(new WorldPoint(2946, 3819, 0), "Wilderness. Chaos Temple (level 38).") - .put(new WorldPoint(3771, 3825, 0), "Fossil Island. East of Museum Camp.") - .put(new WorldPoint(3013, 3846, 0), "Wilderness. West of Lava Maze, before KBD's lair.") - .put(new WorldPoint(3058, 3884, 0), "Wilderness. Near runite ore north of Lava Maze.") - .put(new WorldPoint(3290, 3889, 0), "Wilderness. Demonic Ruins.") - .put(new WorldPoint(3770, 3897, 0), "Small Island north of Fossil Island.") - .put(new WorldPoint(2505, 3899, 0), "Small Island north-west of Miscellania (AJS).") - .put(new WorldPoint(3285, 3942, 0), "Wilderness. Rogues' Castle.") - .put(new WorldPoint(3159, 3959, 0), "Wilderness. North of Deserted Keep, west of Resource Area.") - .put(new WorldPoint(3039, 3960, 0), "Wilderness. Pirates' Hideout.") - .put(new WorldPoint(2987, 3963, 0), "Wilderness. West of Wilderness Agility Course.") - .put(new WorldPoint(3189, 3963, 0), "Wilderness. North of Resource Area, near magic axe hut.") - .put(new WorldPoint(2341, 3697, 0), "North-east of the Piscatoris Fishing Colony bank.") - .put(new WorldPoint(3143, 3774, 0), "In level 32 Wilderness, by the black chinchompa hunting area.") - .put(new WorldPoint(2992, 3941, 0), "Wilderness Agility Course, past the log balance.") - // Elite - .put(new WorldPoint(2357, 3151, 0), "Lletya.") - .put(new WorldPoint(3587, 3180, 0), "Meiyerditch.") - .put(new WorldPoint(2820, 3078, 0), "Tai Bwo Wannai. Hardwood Grove.") - .put(new WorldPoint(3811, 3060, 0), "Small island north-east of Mos Le'Harmless.") - .put(new WorldPoint(2180, 3282, 0), "North of Iorwerth Camp.") - .put(new WorldPoint(2870, 2997, 0), "North-east of Shilo Village.") - .put(new WorldPoint(3302, 2988, 0), "On top of a cliff to the west of Pollnivneach.") - .put(new WorldPoint(2511, 2980, 0), "Just south of Gu'Tanoth, west of gnome glider.") - .put(new WorldPoint(2732, 3372, 0), "Legends' Guild.") - .put(new WorldPoint(3573, 3425, 0), "North of Dessous's tomb from Desert Treasure.") - .put(new WorldPoint(3828, 2848, 0), "East of Harmony Island.") - .put(new WorldPoint(3225, 2838, 0), "South of Desert Treasure pyramid.") - .put(new WorldPoint(1773, 3510, 0), "Ruins north of the Hosidius mine.") - .put(new WorldPoint(3822, 3562, 0), "North-east of Dragontooth Island.") - .put(new WorldPoint(3603, 3564, 0), "North of the wrecked ship, outside of Port Phasmatys.") - .put(new WorldPoint(2936, 2721, 0), "Eastern shore of Crash Island.") - .put(new WorldPoint(2697, 2705, 0), "South-west of Ape Atoll.") - .put(new WorldPoint(2778, 3678, 0), "Mountain Camp.") - .put(new WorldPoint(2827, 3740, 0), "West of the entrance to the Ice Path, where the Troll child resides.") - .put(new WorldPoint(2359, 3799, 0), "Neitiznot.") - .put(new WorldPoint(2194, 3807, 0), "Pirates' Cove.") - .put(new WorldPoint(2700, 3808, 0), "Northwestern part of the Trollweiss and Rellekka Hunter area (DKS).") - .put(new WorldPoint(3215, 3835, 0), "Wilderness. Lava Dragon Isle.") - .put(new WorldPoint(3369, 3894, 0), "Wilderness. Fountain of Rune.") - .put(new WorldPoint(2065, 3923, 0), "Outside the western wall on Lunar Isle.") - .put(new WorldPoint(3188, 3933, 0), "Wilderness. Resource Area.") - .put(new WorldPoint(2997, 3953, 0), "Wilderness. Inside Agility Training Area.") - .put(new WorldPoint(3380, 3963, 0), "Wilderness. North of Volcano.") - .put(new WorldPoint(3051, 3736, 0), "East of the Wilderness Obelisk in 28 Wilderness.") - .put(new WorldPoint(2316, 3814, 0), "West of Neitiznot, near the bridge.") - .put(new WorldPoint(2872, 3937, 0), "Weiss.") - .put(new WorldPoint(2484, 4016, 0), "Northeast corner of the Island of Stone.") - // Master - .put(new WorldPoint(2178, 3209, 0), "South of Iorwerth Camp.") - .put(new WorldPoint(2155, 3100, 0), "South of Port Tyras (BJS).") - .put(new WorldPoint(2217, 3092, 0), "Poison Waste island (DLR).") - .put(new WorldPoint(3830, 3060, 0), "Small island located north-east of Mos Le'Harmless.") - .put(new WorldPoint(2834, 3271, 0), "Crandor island.") - .put(new WorldPoint(2732, 3284, 0), "Witchaven.") - .put(new WorldPoint(3622, 3320, 0), "Meiyerditch. Outside mine.") - .put(new WorldPoint(2303, 3328, 0), "East of Prifddinas.") - .put(new WorldPoint(3570, 3405, 0), "North of Dessous's tomb from Desert Treasure.") - .put(new WorldPoint(2840, 3423, 0), "Water Obelisk Island.") - .put(new WorldPoint(3604, 3564, 0), "North of the wrecked ship, outside of Port Phasmatys (ALQ).") - .put(new WorldPoint(3085, 3569, 0), "Wilderness. Obelisk of Air.") - .put(new WorldPoint(2934, 2727, 0), "Eastern shore of Crash Island.") - .put(new WorldPoint(1451, 3695, 0), "West side of Lizardman Canyon with Lizardman shaman.") - .put(new WorldPoint(2538, 3739, 0), "Waterbirth Island. Bring a pet rock and rune thrownaxe.") - .put(new WorldPoint(1698, 3792, 0), "Arceuus church.") - .put(new WorldPoint(2951, 3820, 0), "Wilderness. Chaos Temple (level 38).") - .put(new WorldPoint(2202, 3825, 0), "Pirates' Cove, between Lunar Isle and Rellekka.") - .put(new WorldPoint(1761, 3853, 0), "Arceuus essence mine (CIS).") - .put(new WorldPoint(2090, 3863, 0), "South of Lunar Isle, west of Astral altar.") - .put(new WorldPoint(1442, 3878, 0), "Sulphur Mine.") - .put(new WorldPoint(3380, 3929, 0), "Wilderness. Near Volcano.") - .put(new WorldPoint(3188, 3939, 0), "Wilderness. Resource Area.") - .put(new WorldPoint(3304, 3941, 0), "Wilderness. East of Rogues' Castle.") - .put(new WorldPoint(2994, 3961, 0), "Wilderness. Inside Agility Training Area.") - .put(new WorldPoint(1248, 3751, 0), "In the north wing of the Farming Guild.") - .build(); - - private final String text; - private final WorldPoint location; - /** - * For regions which are mirrored, the location of the the clue in the mirrored region. - */ - @Nullable - private final WorldPoint mirrorLocation; - - public CoordinateClue(String text, WorldPoint location, @Nullable WorldPoint mirrorLocation) - { - this.text = text; - this.location = location; - this.mirrorLocation = mirrorLocation; - setRequiresSpade(true); - } - - @Override - public WorldPoint[] getLocations() - { - if (mirrorLocation != null) - { - return new WorldPoint[]{location, mirrorLocation}; - } - else - { - return new WorldPoint[]{location}; - } - } - - @Override - public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin) - { - panelComponent.getChildren().add(TitleComponent.builder().text("Coordinate Clue").build()); - - String solution = CLUES.get(location); - - if (solution != null) - { - panelComponent.getChildren().add(LineComponent.builder() - .left(solution) - .build()); - panelComponent.getChildren().add(LineComponent.builder().build()); - } - - panelComponent.getChildren().add(LineComponent.builder() - .left("Click the clue scroll on your world map to see dig location.") - .build()); - } - - @Override - public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) - { - for (WorldPoint worldPoint : getLocations()) - { - LocalPoint localLocation = LocalPoint.fromWorld(plugin.getClient(), worldPoint); - - if (localLocation != null) - { - OverlayUtil.renderTileOverlay(plugin.getClient(), graphics, localLocation, plugin.getSpadeImage(), Color.ORANGE); - } - } - } -} 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 deleted file mode 100644 index 210e54d4a0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java +++ /dev/null @@ -1,483 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls.clues; - -import com.google.common.collect.ImmutableSet; -import java.awt.Color; -import java.awt.Graphics2D; -import java.util.Set; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.NPC; -import static net.runelite.api.NullObjectID.NULL_1293; -import net.runelite.api.ObjectDefinition; -import static net.runelite.api.ObjectID.*; -import net.runelite.api.TileObject; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import static net.runelite.client.plugins.cluescrolls.ClueScrollOverlay.TITLED_CONTENT_COLOR; -import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin; -import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.CLICKBOX_BORDER_COLOR; -import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.CLICKBOX_FILL_COLOR; -import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.CLICKBOX_HOVER_BORDER_COLOR; -import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.IMAGE_Z_OFFSET; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -@Getter(AccessLevel.PUBLIC) -public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueScroll, ObjectClueScroll -{ - public static final Set CLUES = ImmutableSet.of( - new CrypticClue("Show this to Sherlock.", "Sherlock", new WorldPoint(2733, 3415, 0), "Sherlock is located to the east of the Sorcerer's tower in Seers' Village."), - new CrypticClue("Talk to the bartender of the Rusty Anchor in Port Sarim.", "Bartender", new WorldPoint(3045, 3256, 0), "The Rusty Anchor is located in the north of Port Sarim."), - new CrypticClue("The keeper of Melzars... Spare? Skeleton? Anar?", "Oziach", new WorldPoint(3068, 3516, 0), "Speak to Oziach in Edgeville"), - new CrypticClue("Speak to Ulizius.", "Ulizius", new WorldPoint(3444, 3461, 0), "Ulizius is the monk who guards the gate into Mort Myre Swamp. South of fairy ring CKS"), - new CrypticClue("Search for a crate in a building in Hemenster.", CRATE_357, new WorldPoint(2636, 3453, 0), "House north of the Fishing Contest quest area. West of Grandpa Jack."), - new CrypticClue("A reck you say; let's pray there aren't any ghosts.", "Father Aereck", new WorldPoint(3242, 3207, 0), "Speak to Father Aereck in Lumbridge."), - new CrypticClue("Search the bucket in the Port Sarim jail.", BUCKET_9568, new WorldPoint(3013, 3179, 0), "Talk to Shantay & identify yourself as an outlaw, refuse to pay the 5gp fine twice and you will be sent to the Port Sarim jail."), - new CrypticClue("Search the crates in a bank in Varrock.", CRATE_5107, new WorldPoint(3187, 9825, 0), "Search in the basement of the West Varrock bank."), - new CrypticClue("Falo the bard wants to see you.", "Falo the Bard", new WorldPoint(2689, 3550, 0), "Speak to Falo the Bard located between Seer's Village and Rellekka. Southwest of fairy ring CJR."), - new CrypticClue("Search a bookcase in the Wizards tower.", BOOKCASE_12539, new WorldPoint(3113, 3159, 0), "The bookcase located on the ground floor."), - new CrypticClue("Come have a cip with this great soot covered denizen.", "Miner Magnus", new WorldPoint(2527, 3891, 0), "Talk to Miner Magnus east of the fairy ring CIP. Answer: 8", "How many coal rocks are around here?"), - new CrypticClue("Citric cellar.", "Heckel Funch", new WorldPoint(2490, 3488, 0), "Speak to Heckel Funch on the first floor in the Grand Tree."), - new CrypticClue("I burn between heroes and legends.", "Candle maker", new WorldPoint(2799, 3438, 0), "Speak to the Candle maker in Catherby."), - new CrypticClue("Speak to Sarah at Falador farm.", "Sarah", new WorldPoint(3038, 3292, 0), "Talk to Sarah at Falador farm, north of Port Sarim."), - new CrypticClue("Search for a crate on the ground floor of a house in Seers' Village.", CRATE_25775, new WorldPoint(2699, 3470, 0), "Search inside Phantuwti Fanstuwi Farsight's house, located south of the pub in Seers' Village."), - new CrypticClue("Snah? I feel all confused, like one of those cakes...", "Hans", new WorldPoint(3211, 3219, 0), "Talk to Hans roaming around Lumbridge Castle."), - new CrypticClue("Speak to Sir Kay in Camelot Castle.", "Sir Kay", new WorldPoint(2759, 3497, 0), "Sir Kay can be found in the courtyard at Camelot castle."), - new CrypticClue("Gold I see, yet gold I require. Give me 875 if death you desire.", "Saniboch", new WorldPoint(2745, 3151, 0), "Speak to Saniboch at the Brimhaven Dungeon entrance."), - new CrypticClue("Find a crate close to the monks that like to paaarty!", CRATE_354, new WorldPoint(2614, 3204, 0), "The crate is in the east side of the Kandarin monastery, near Brother Omad"), - new CrypticClue("Identify the back of this over-acting brother. (He's a long way from home.)", "Hamid", new WorldPoint(3376, 3284, 0), "Talk to Hamid, the monk at the altar in the Duel Arena"), - new CrypticClue("In a town where thieves steal from stalls, search for some drawers in the upstairs of a house near the bank.", "Guard", DRAWERS, new WorldPoint(2611, 3324, 1), "Kill any Guard located around East Ardougne for a medium key. Then search the drawers in the upstairs hallway of Jerico's house, which is the house with pigeon cages located south of the northern East Ardougne bank."), - new CrypticClue("His bark is worse than his bite.", "Barker", new WorldPoint(3499, 3503, 0), "Speak to the Barker at Canifis's Barkers' Haberdashery."), - new CrypticClue("The beasts to my east snap claws and tails, The rest to my west can slide and eat fish. The force to my north will jump and they'll wail, Come dig by my fire and make a wish.", new WorldPoint(2598, 3267, 0), "Dig by the torch in the Ardougne Zoo, between the penguins and the scorpions."), - new CrypticClue("A town with a different sort of night-life is your destination. Search for some crates in one of the houses.", CRATE_24344, new WorldPoint(3498, 3507, 0), "Search the crate inside of the clothes shop in Canifis."), - new CrypticClue("Stop crying! Talk to the head.", "Head mourner", new WorldPoint(2042, 4630, 0), "Talk to the Head mourner in the mourner headquarters in West Ardougne"), - new CrypticClue("Search the crate near a cart in Port Khazard.", CRATE_366, new WorldPoint(2660, 3149, 0), "Search by the southern Khazard General Store in Port Khazard."), - new CrypticClue("Speak to the bartender of the Blue Moon Inn in Varrock.", "Bartender", new WorldPoint(3226, 3399, 0), "Talk to the bartender in Blue Moon Inn in Varrock."), - new CrypticClue("This aviator is at the peak of his profession.", "Captain Bleemadge", new WorldPoint(2846, 1749, 0), "Captain Bleemadge, the gnome glider pilot, is found at the top of White Wolf Mountain."), - new CrypticClue("Search the crates in the shed just north of East Ardougne.", CRATE_355, new WorldPoint(2617, 3347, 0), "The crates in the shed north of the northern Ardougne bank."), - new CrypticClue("I wouldn't wear this jean on my legs.", "Father Jean", new WorldPoint(1734, 3576, 0), "Talk to father Jean in the Hosidius church"), - new CrypticClue("Search the crate in the Toad and Chicken pub.", CRATE_354, new WorldPoint(2913, 3536, 0), "The Toad and Chicken pub is located in Burthorpe."), - new CrypticClue("Search chests found in the upstairs of shops in Port Sarim.", CLOSED_CHEST_375, new WorldPoint(3016, 3205, 1), "Search the chest in the upstairs of Wydin's Food Store, on the east wall."), - new CrypticClue("Right on the blessed border, cursed by the evil ones. On the spot inaccessible by both; I will be waiting. The bugs' imminent possession holds the answer.", new WorldPoint(3410, 3324, 0), "B I P. Dig right under the fairy ring."), - new CrypticClue("The dead, red dragon watches over this chest. He must really dig the view.", "Barbarian", 375, new WorldPoint(3353, 3332, 0), "Search the chest underneath the Red Dragon's head in the Exam Centre. Kill a MALE Barbarian in Barbarian Village or Barbarian Outpost to receive the key."), - new CrypticClue("My home is grey, and made of stone; A castle with a search for a meal. Hidden in some drawers I am, across from a wooden wheel.", DRAWERS_5618, new WorldPoint(3213, 3216, 1), "Open the drawers inside the room with the spinning wheel on the first floor of Lumbridge Castle."), - new CrypticClue("Come to the evil ledge, Yew know yew want to. Try not to get stung.", new WorldPoint(3089, 3468, 0), "Dig in Edgeville, just east of the Southern Yew tree."), - new CrypticClue("Look in the ground floor crates of houses in Falador.", CRATES_24088, new WorldPoint(3029, 3355, 0), "The house east of the east bank."), - new CrypticClue("You were 3 and I was the 6th. Come speak to me.", "Vannaka", new WorldPoint(3146, 9913, 0), "Speak to Vannaka in Edgeville Dungeon."), - new CrypticClue("Search the crates in Draynor Manor.", CRATE_11485, new WorldPoint(3106, 3369, 2), "Top floor of the manor"), - new CrypticClue("Search the crates near a cart in Varrock.", CRATE_5107, new WorldPoint(3226, 3452, 0), "South east of Varrock Palace, south of the tree farming patch."), - new CrypticClue("A Guthixian ring lies between two peaks. Search the stones and you'll find what you seek.", STONES_26633, new WorldPoint(2922, 3484, 0), "Search the stones several steps west of the Guthixian stone circle in Taverley"), - new CrypticClue("Search the boxes in the house near the south entrance to Varrock.", BOXES_5111, new WorldPoint(3203, 3384, 0), "The first house on the left when entering the city from the southern entrance."), - new CrypticClue("His head might be hollow, but the crates nearby are filled with surprises.", CRATE_354, new WorldPoint(3478, 3091, 0), "Search the crates near the Clay golem in the ruins of Uzer."), - new CrypticClue("One of the sailors in Port Sarim is your next destination.", "Captain Tobias", new WorldPoint(3026, 3216, 0), "Speak to Captain Tobias on the docks of Port Sarim."), - new CrypticClue("THEY'RE EVERYWHERE!!!! But they were here first. Dig for treasure where the ground is rich with ore.", new WorldPoint(3081, 3421, 0), "Dig at Barbarian Village, next to the Stronghold of Security."), - new CrypticClue("Talk to the mother of a basement dwelling son.", "Doris", new WorldPoint(3079, 3493, 0), "Evil Dave's mother, Doris is located in the house west of Edgeville bank."), - new CrypticClue("Speak to Ned in Draynor Village.", "Ned", new WorldPoint(3098, 3258, 0), "Ned is found north of the Draynor bank."), - new CrypticClue("Speak to Hans to solve the clue.", "Hans", new WorldPoint(3211, 3219, 0), "Hans can be found at Lumbridge Castle."), - new CrypticClue("Search the crates in Canifis.", CRATE_24344, new WorldPoint(3509, 3497, 0), "Search inside the shop, Rufus' Meat Emporium."), - new CrypticClue("Search the crates in the Dwarven mine.", CRATE_357, new WorldPoint(3035, 9849, 0), "Search the crate in the room east of the Ice Mountain ladder entrance in the Drogo's Mining Emporium."), - new CrypticClue("A crate found in the tower of a church is your next location.", CRATE_357, new WorldPoint(2612, 3304, 1), "Climb the ladder and search the crates on the first floor in the Church in Ardougne"), - new CrypticClue("Covered in shadows, the centre of the circle is where you will find the answer.", new WorldPoint(3488, 3289, 0), "Dig in the centre of Mort'ton, where the roads intersect"), - new CrypticClue("I lie lonely and forgotten in mid wilderness, where the dead rise from their beds. Feel free to quarrel and wind me up, and dig while you shoot their heads.", new WorldPoint(3174, 3663, 0), "Directly under the crossbow respawn in the Graveyard of Shadows in level 18 Wilderness."), - new CrypticClue("In the city where merchants are said to have lived, talk to a man with a splendid cape, but a hat dropped by goblins.", "Head chef", new WorldPoint(3143, 3445, 0), "Talk to the Head chef in Cooks' Guild west of Varrock."), - new CrypticClue("The mother of the reptilian sacrifice.", "Zul-Cheray", new WorldPoint(2204, 3050, 0), "Talk to Zul-Cheray in a house near the sacrificial boat at Zul-Andra."), - new CrypticClue("I watch the sea. I watch you fish. I watch your tree.", "Ellena", new WorldPoint(2860, 3431, 0), "Speak to Ellena at Catherby fruit tree patch."), - new CrypticClue("Dig between some ominous stones in Falador.", new WorldPoint(3040, 3399, 0), "Three standing stones inside a walled area. East of the northern Falador gate."), - new CrypticClue("Speak to Rusty north of Falador.", "Rusty", new WorldPoint(2979, 3435, 0), "Rusty can be found northeast of Falador on the way to the Mind altar."), - new CrypticClue("Search a wardrobe in Draynor.", WARDROBE_5622, new WorldPoint(3087, 3261, 0), "Go to Aggie's house and search the wardrobe in northern wall."), - new CrypticClue("I have many arms but legs, I have just one. I have little family but my seed you can grow on, I am not dead, yet I am but a spirit, and my power, on your quests, you will earn the right to free it.", NULL_1293, new WorldPoint(2544, 3170, 0), "Spirit Tree in Tree Gnome Village. Answer: 13112221", "What is the next number in the sequence? 1, 11, 21, 1211, 111221, 312211"), - new CrypticClue("I am the one who watches the giants. The giants in turn watch me. I watch with two while they watch with one. Come seek where I may be.", "Kamfreena", new WorldPoint(2845, 3539, 0), "Speak to Kamfreena on the top floor of the Warriors' Guild."), - new CrypticClue("In a town where wizards are known to gather, search upstairs in a large house to the north.", "Man", 375, new WorldPoint(2593, 3108, 1), "Search the chest upstairs in the house north of Yanille Wizard's Guild. Kill a man for the key."), - new CrypticClue("Probably filled with wizards socks.", "Wizard", DRAWERS_350, new WorldPoint(3116, 9562, 0), "Search the drawers in the basement of the Wizard's Tower south of Draynor Village. Kill one of the Wizards for the key. Fairy ring DIS"), - new CrypticClue("Even the seers say this clue goes right over their heads.", CRATE_14934, new WorldPoint(2707, 3488, 2), "Search the crate on the Seers Agility Course in Seers Village"), - new CrypticClue("Speak to a Wyse man.", "Wyson the gardener", new WorldPoint(3026, 3378, 0), "Talk to Wyson the gardener at Falador Park."), - new CrypticClue("You'll need to look for a town with a central fountain. Look for a locked chest in the town's chapel.", "Monk", CLOSED_CHEST_5108, new WorldPoint(3256, 3487, 0), "Search the chest by the stairs in the Varrock church. Kill a Monk in Ardougne Monastery to obtain the key."), - new CrypticClue("Talk to Ambassador Spanfipple in the White Knights Castle.", "Ambassador Spanfipple", new WorldPoint(2979, 3340, 0), "Ambassador Spanfipple can be found roaming on the first floor of the White Knights Castle."), - new CrypticClue("Mine was the strangest birth under the sun. I left the crimson sack, yet life had not begun. Entered the world, and yet was seen by none.", new WorldPoint(2832, 9586, 0), "Inside Karamja Volcano, dig directly underneath the Red spiders' eggs respawn."), - new CrypticClue("Search for a crate in Varrock Castle.", CRATE_5113, new WorldPoint(3224, 3492, 0), "Search the crate in the corner of the kitchen in Varrock Castle."), - new CrypticClue("And so on, and so on, and so on. Walking from the land of many unimportant things leads to a choice of paths.", new WorldPoint(2591, 3879, 0), "Dig on Etceteria next to the Evergreen tree in front of the castle walls."), - new CrypticClue("Speak to Donovan, the Family Handyman.", "Donovan the Family Handyman", new WorldPoint(2743, 3578, 0), "Donovan the Family Handyman is found on the first floor of Sinclair Mansion."), - new CrypticClue("Search the crates in the Barbarian Village helmet shop.", CRATES_11600, new WorldPoint(3073, 3430, 0), "Peksa's Helmet Shop in Barbarian Village."), - new CrypticClue("Search the boxes of Falador's general store.", CRATES_24088, new WorldPoint(2955, 3390, 0), "Falador general store."), - new CrypticClue("In a village made of bamboo, look for some crates under one of the houses.", CRATE_356, new WorldPoint(2800, 3074, 0), "Search the crate by the house at the northern point of the broken jungle fence in Tai Bwo Wannai."), - new CrypticClue("This crate is mine, all mine, even if it is in the middle of the desert.", CRATE_18889, new WorldPoint(3289, 3022, 0), "Center of desert Mining Camp. Search the crates. Requires the metal key from Tourist Trap to enter."), - new CrypticClue("Dig where 4 siblings and I all live with our evil overlord.", new WorldPoint(3195, 3357, 0), "Dig in the chicken pen inside the Champions' Guild"), - new CrypticClue("In a town where the guards are armed with maces, search the upstairs rooms of the Public House.", "Guard dog", 348, new WorldPoint(2574, 3326, 1), "Search the drawers upstairs in the pub north of Ardougne Castle. Kill a Guard dog at Handelmort Mansion to obtain the key."), - new CrypticClue("Four blades I have, yet draw no blood; Still I turn my prey to powder. If you are brave, come search my roof; It is there my blades are louder.", CRATE_12963, new WorldPoint(3166, 3309, 2), "Lumbridge windmill, search the crates on the top floor."), - new CrypticClue("Search through some drawers in the upstairs of a house in Rimmington.", DRAWERS_352, new WorldPoint(2970, 3214, 1), "On the first floor of the house north of Hetty the Witch's house in Rimmington."), - new CrypticClue("Probably filled with books on magic.", BOOKCASE_380, new WorldPoint(3096, 9572, 0), "Search the bookcase in the basement of Wizard's Tower. Fairy ring DIS"), - new CrypticClue("If you look closely enough, it seems that the archers have lost more than their needles.", HAYSTACK, new WorldPoint(2672, 3416, 0), "Search the haystack by the south corner of the Rangers' Guild"), - new CrypticClue("Search the crate in the left-hand tower of Lumbridge Castle.", CRATE_357, new WorldPoint(3228, 3212, 1), "Located on the first floor of the southern tower at the Lumbridge Castle entrance."), - new CrypticClue("'Small shoe.' Often found with rod on mushroom.", "Gnome trainer", new WorldPoint(2476, 3428, 0), "Talk to any Gnome trainer in the agility area of the Tree Gnome Stronghold."), - new CrypticClue("I live in a deserted crack collecting soles.", "Genie", new WorldPoint(3371, 9320, 0), "Enter the crack west of Nardah Rug merchant, and talk to the Genie. You'll need a light source and a rope."), - new CrypticClue("46 is my number. My body is the colour of burnt orange and crawls among those with eight. Three mouths I have, yet I cannot eat. My blinking blue eye hides my grave.", new WorldPoint(3170, 3885, 0), "Sapphire respawn in the Spider's Nest, lvl 46 Wilderness. Dig under the sapphire spawn."), - new CrypticClue("Green is the colour of my death as the winter-guise, I swoop towards the ground.", new WorldPoint(2780, 3783, 0), "Players need to slide down to where Trollweiss grows on Trollweiss Mountain."), - new CrypticClue("Talk to a party-goer in Falador.", "Lucy", new WorldPoint(3046, 3382, 0), "Lucy is the bartender on the first floor of the party room."), - new CrypticClue("He knows just how easy it is to lose track of time.", "Brother Kojo", new WorldPoint(2570, 3250, 0), "Speak to Brother Kojo in the Clock Tower. Answer: 22", "On a clock, how many times a day do the minute hand and the hour hand overlap?"), - new CrypticClue("A great view - watch the rapidly drying hides get splashed. Check the box you are sitting on.", BOXES, new WorldPoint(2523, 3493, 1), "Almera's House north of Baxtorian Falls, search boxes on the first floor."), - new CrypticClue("Search the Coffin in Edgeville.", COFFIN, new WorldPoint(3091, 3477, 0), "Search the coffin located by the Wilderness teleport lever."), - new CrypticClue("When no weapons are at hand, then is the time to reflect. In Saradomin's name, redemption draws closer...", DRAWERS_350, new WorldPoint(2818, 3351, 0), "On Entrana, search the southern drawer in the house with the cooking range."), - new CrypticClue("Search the crates in a house in Yanille that has a piano.", CRATE_357, new WorldPoint(2598, 3105, 0), "The house is located northwest of the bank."), - new CrypticClue("Speak to the staff of Sinclair mansion.", "Louisa", new WorldPoint(2736, 3578, 0), "Speak to Louisa, on the ground floor, found at the Sinclair Mansion. Fairy ring CJR"), - new CrypticClue("I am a token of the greatest love. I have no beginning or end. My eye is red, I can fit like a glove. Go to the place where it's money they lend, And dig by the gate to be my friend.", new WorldPoint(3191, 9825, 0), "Dig by the gate in the basement of the West Varrock bank."), - new CrypticClue("Speak to Kangai Mau.", "Kangai Mau", new WorldPoint(2791, 3183, 0), "Kangai Mau is found in the Shrimp and Parrot in Brimhaven."), - new CrypticClue("Speak to Hajedy.", "Hajedy", new WorldPoint(2779, 3211, 0), "Hajedy is found by the cart, located just south of the Brimhaven docks."), - new CrypticClue("Must be full of railings.", BOXES_6176, new WorldPoint(2576, 3464, 0), "Search the boxes around the hut where the broken Dwarf Cannon is, close to the start of the Dwarf Cannon quest."), - new CrypticClue("I wonder how many bronze swords he has handed out.", "Vannaka", new WorldPoint(3164, 9913, 0), "Talk to Vannaka. He can be found in Edgeville Dungeon."), - new CrypticClue("Read 'How to breed scorpions.' By O.W.Thathurt.", BOOKCASE_380, new WorldPoint(2703, 3409, 1), "Search the northern bookcase on the first floor of the Sorcerer's Tower."), - new CrypticClue("Search the crates in the Port Sarim Fishing shop.", CRATE_9534, new WorldPoint(3012, 3222, 0), "Search the crates, by the door, in Gerrant's Fishy Business in Port Sarim."), - new CrypticClue("Speak to The Lady of the Lake.", "The Lady of the Lake", new WorldPoint(2924, 3405, 0), "Talk to The Lady of the Lake in Taverley."), - new CrypticClue("Rotting next to a ditch. Dig next to the fish.", new WorldPoint(3547, 3183, 0), "Dig next to a fishing spot on the south-east side of Burgh de Rott."), - new CrypticClue("The King's magic won't be wasted by me.", "Guardian Mummy", new WorldPoint(1934, 4427, 0), "Talk to the Guardian mummy inside the Pyramid Plunder minigame in Sophanem"), - new CrypticClue("Dig where the forces of Zamorak and Saradomin collide.", new WorldPoint(3049, 4839, 0), "Dig next to the law rift in the Abyss"), - new CrypticClue("Search the boxes in the goblin house near Lumbridge.", BOXES, new WorldPoint(3245, 3245, 0), "Goblin house on the eastern side of the river."), - new CrypticClue("W marks the spot.", new WorldPoint(2867, 3546, 0), "Dig in the middle of the Warriors' Guild entrance hall"), - new CrypticClue("There is no 'worthier' lord.", "Lord Iorwerth", new WorldPoint(2205, 3252, 0), "Speak to Lord Iorwerth in the elven camp near Prifddinas"), - new CrypticClue("Surviving.", "Sir Vyvin", new WorldPoint(2983, 3338, 0), "Talk to Sir Vyvin on the second floor of Falador castle."), - new CrypticClue("My name is like a tree, yet it is spelt with a 'g'. Come see the fur which is right near me.", "Wilough", new WorldPoint(3221, 3435, 0), "Speak to Wilough, next to the Fur Merchant in Varrock Square."), - new CrypticClue("Speak to Jatix in Taverley.", "Jatix", new WorldPoint(2898, 3428, 0), "Jatix is found in the middle of Taverley."), - new CrypticClue("Speak to Gaius in Taverley.", "Gaius", new WorldPoint(2884, 3450, 0), "Gaius is found at the northwest corner in Taverley."), - new CrypticClue("If a man carried my burden, he would break his back. I am not rich, but leave silver in my track. Speak to the keeper of my trail.", "Gerrant", new WorldPoint(3014, 3222, 0), "Speak to Gerrant in the fish shop in Port Sarim."), - new CrypticClue("Search the drawers in Falador's chain mail shop.", DRAWERS, new WorldPoint(2969, 3311, 0), "Wayne's Chains - Chainmail Specialist store at the southern Falador walls."), - new CrypticClue("Talk to the barber in the Falador barber shop.", "Hairdresser", new WorldPoint(2945, 3379, 0), "The Hairdresser can be found in the barber shop, north of the west Falador bank."), - new CrypticClue("Often sought out by scholars of histories past, find me where words of wisdom speak volumes.", "Examiner", new WorldPoint(3362, 3341, 0), "Speak to an examiner at the Exam Centre."), - new CrypticClue("Generally speaking, his nose was very bent.", "General Bentnoze", new WorldPoint(2957, 3511, 0), "Talk to General Bentnoze"), - new CrypticClue("Search the bush at the digsite centre.", BUSH_2357, new WorldPoint(3345, 3378, 0), "The bush is on the east side of the first pathway towards the digsite from the Exam Centre."), - new CrypticClue("Someone watching the fights in the Duel Arena is your next destination.", "Jeed", new WorldPoint(3360, 3242, 0), "Talk to Jeed, found on the upper floors, at the Duel Arena."), - new CrypticClue("It seems to have reached the end of the line, and it's still empty.", MINE_CART_6045, new WorldPoint(3041, 9820, 0), "Search the carts in the northern part of the Dwarven Mine."), - new CrypticClue("You'll have to plug your nose if you use this source of herbs.", null, "Kill an Aberrant or Deviant spectre."), - new CrypticClue("When you get tired of fighting, go deep, deep down until you need an antidote.", CRATE_357, new WorldPoint(2576, 9583, 0), "Go to Yanille Agility dungeon and fall into the place with the poison spiders. Search the crate by the stairs leading up."), - new CrypticClue("Search the bookcase in the monastery.", BOOKCASE_380, new WorldPoint(3054, 3484, 0), "Search the southeastern bookcase at Edgeville Monastery."), - new CrypticClue("Surprising? I bet he is...", "Sir Prysin", new WorldPoint(3205, 3474, 0), "Talk to Sir Prysin in Varrock Palace."), - new CrypticClue("Search upstairs in the houses of Seers' Village for some drawers.", DRAWERS_25766, new WorldPoint(2716, 3471, 1), "Located in the house with the spinning wheel. South of the Seers' Village bank."), - new CrypticClue("Leader of the Yak City.", "Mawnis Burowgar", new WorldPoint(2336, 3799, 0), "Talk to Mawnis Burowgar in Neitiznot."), - new CrypticClue("Speak to Arhein in Catherby.", "Arhein", new WorldPoint(2803, 3430, 0), "Arhein is just south of the Catherby bank."), - new CrypticClue("Speak to Doric, who lives north of Falador.", "Doric", new WorldPoint(2951, 3451, 0), "Doric is found north of Falador and east of the Taverley gate."), - new CrypticClue("Between where the best are commemorated for a year, and a celebratory cup, not just for beer.", new WorldPoint(3388, 3152, 0), "Dig at the Clan Cup Trophy at Clan Wars."), - new CrypticClue("'See you in your dreams' said the vegetable man.", "Dominic Onion", new WorldPoint(2608, 3116, 0), "Speak to Dominic Onion at the Nightmare Zone teleport spot."), - new CrypticClue("Try not to step on any aquatic nasties while searching this crate.", CRATE_18204, new WorldPoint(2764, 3273, 0), "Search the crate in Bailey's house on the Fishing Platform."), - new CrypticClue("The cheapest water for miles around, but they react badly to religious icons.", CRATE_354, new WorldPoint(3178, 2987, 0), "Search the crates in the General Store tent in the Bandit Camp"), - new CrypticClue("This village has a problem with cartloads of the undead. Try checking the bookcase to find an answer.", BOOKCASE_394, new WorldPoint(2833, 2992, 0), "Search the bookcase by the doorway of the building just south east of the Shilo Village Gem Mine."), - new CrypticClue("Dobson is my last name, and with gardening I seek fame.", "Horacio", new WorldPoint(2635, 3310, 0), "Horacio, located in the garden of the Handelmort Mansion in East Ardougne."), - new CrypticClue("The magic of 4 colours, an early experience you could learn. The large beast caged up top, rages, as his demised kin's loot now returns.", "Wizard Mizgog", new WorldPoint(3103, 3163, 2), "Speak to Wizard Mizgog at the top of the Wizard's Tower south of Draynor."), - new CrypticClue("Aggie I see. Lonely and southern I feel. I am neither inside nor outside the house, yet no home would be complete without me. The treasure lies beneath me!", new WorldPoint(3085, 3255, 0), "Dig outside the window of Aggie's house in Draynor Village."), - new CrypticClue("Search the chest in Barbarian Village.", CLOSED_CHEST_375, new WorldPoint(3085, 3429, 0), "The chest located in the house with a spinning wheel."), - new CrypticClue("Search the crates in the outhouse of the long building in Taverley.", CRATE_357, new WorldPoint(2914, 3433, 0), "Located in the small building attached by a fence to the main building. Climb over the stile."), - new CrypticClue("Talk to Ermin.", "Ermin", new WorldPoint(2488, 3409, 1), "Ermin can be found on the first floor of the tree house south-east of the Gnome Agility Course."), - new CrypticClue("Ghostly bones.", null, "Kill an Ankou."), - new CrypticClue("Search through chests found in the upstairs of houses in eastern Falador.", CLOSED_CHEST_375, new WorldPoint(3041, 3364, 1), "The house is located southwest of the Falador Party Room. There are two chests in the room, search the northern chest."), - new CrypticClue("Let's hope you don't meet a watery death when you encounter this fiend.", null, "Kill a waterfiend."), - new CrypticClue("Reflection is the weakness for these eyes of evil.", null, "Kill a basilisk."), - new CrypticClue("Search a bookcase in Lumbridge swamp.", BOOKCASE_9523, new WorldPoint(3146, 3177, 0), "Located in Father Urhney's house."), - new CrypticClue("Surround my bones in fire, ontop the wooden pyre. Finally lay me to rest, before my one last test.", null, "Kill a confused/lost barbarian to receive mangled bones. Construct and burn a pyre ship. Kill the ferocious barbarian spirit that spawns to receive a clue casket."), - new CrypticClue("Fiendish cooks probably won't dig the dirty dishes.", new WorldPoint(3043, 4974, 1), "Dig by the fire in the Rogues' Den."), - new CrypticClue("My life was spared but these voices remain, now guarding these iron gates is my bane.", "Key Master", new WorldPoint(1310, 1251, 0), "Speak to the Key Master in Cerberus' Lair."), - new CrypticClue("Search the boxes in one of the tents in Al Kharid.", BOXES_361, new WorldPoint(3308, 3206, 0), "Search the boxes in the tent east of the Silk trader."), - new CrypticClue("One of several rhyming brothers, in business attire with an obsession for paper work.", "Piles", new WorldPoint(3186, 3936, 0), "Speak to Piles in the Wilderness Resource Area. An entry fee of 7,500 coins is required, or less if Wilderness Diaries have been completed."), - new CrypticClue("Search the drawers on the first floor of a building overlooking Ardougne's Market.", DRAWERS_352, new WorldPoint(2657, 3322, 1), "Climb the ladder in the house north of the market."), - new CrypticClue("'A bag belt only?', he asked his balding brothers.", "Abbot Langley", new WorldPoint(3058, 3487, 0), "Talk-to Abbot Langley in Monastery west of Edgeville"), - new CrypticClue("Search the drawers upstairs in Falador's shield shop.", DRAWERS, new WorldPoint(2971, 3386, 1), "Cassie's Shield Shop at the northern Falador entrance."), - new CrypticClue("Go to this building to be illuminated, and check the drawers while you are there.", "Market Guard", DRAWERS_350, new WorldPoint(2512, 3641, 1), "Search the drawers in the first floor of the Lighthouse. Kill a Rellekka marketplace guard to obtain the key."), - new CrypticClue("Dig near some giant mushrooms, behind the Grand Tree.", new WorldPoint(2458, 3504, 0), "Dig near the red mushrooms northwest of the Grand Tree."), - new CrypticClue("Pentagrams and demons, burnt bones and remains, I wonder what the blood contains.", new WorldPoint(3297, 3890, 0), "Dig under the blood rune spawn next to the Demonic Ruins."), - new CrypticClue("Search the drawers above Varrock's shops.", DRAWERS_7194, new WorldPoint(3206, 3419, 1), "Located upstairs in Thessalia's Fine Clothes shop in Varrock."), - new CrypticClue("Search the drawers in one of Gertrude's bedrooms.", DRAWERS_7194, new WorldPoint(3156, 3406, 0), "Kanel's bedroom (southeastern room), outside of west Varrock."), - new CrypticClue("Under a giant robotic bird that cannot fly.", new WorldPoint(1756, 4940, 0), "Dig next to the terrorbird display in the south exhibit of Varrock Museum's basement."), - new CrypticClue("Great demons, dragons and spiders protect this blue rock, beneath which, you may find what you seek.", new WorldPoint(3045, 10265, 0), "Dig by the runite rock in the Lava Maze Dungeon"), - new CrypticClue("My giant guardians below the market streets would be fans of rock and roll, if only they could grab hold of it. Dig near my green bubbles!", new WorldPoint(3161, 9904, 0), "Dig near the cauldron by Moss Giants under Varrock Sewers"), - new CrypticClue("Varrock is where I reside, not the land of the dead, but I am so old, I should be there instead. Let's hope your reward is as good as it says, just 1 gold one and you can have it read.", "Gypsy Aris", new WorldPoint(3203, 3424, 0), "Talk to Gypsy Aris, West of varrock main square."), - new CrypticClue("Speak to a referee.", "Gnome ball referee", new WorldPoint(2386, 3487, 0), "Talk to a Gnome ball referee found on the Gnome ball field in the Gnome Stronghold. Answer: 5096", "What is 57 x 89 + 23?"), - new CrypticClue("This crate holds a better reward than a broken arrow.", CRATE_356, new WorldPoint(2671, 3437, 0), "Inside the Ranging Guild. Search the crate behind the northern most building."), - new CrypticClue("Search the drawers in the house next to the Port Sarim mage shop.", DRAWERS, new WorldPoint(3024, 3259, 0), "House east of Betty's. Contains a cooking sink."), - new CrypticClue("With a name like that, you'd expect a little more than just a few scimitars.", "Daga", new WorldPoint(2759, 2775, 0), "Speak to Daga on Ape Atoll."), - new CrypticClue("Strength potions with red spiders' eggs? He is quite a herbalist.", "Apothecary", new WorldPoint(3194, 3403, 0), "Talk to Apothecary in the South-western Varrock. (the) apothecary is just north-west of the Varrock Swordshop."), - new CrypticClue("Robin wishes to see your finest ranged equipment.", "Robin", new WorldPoint(3673, 3492, 0), "Robin at the inn in Port Phasmatys. Speak to him with +182 in ranged attack bonus. Bonus granted by the toxic blowpipe is ignored."), - new CrypticClue("You will need to under-cook to solve this one.", CRATE_357, new WorldPoint(3219, 9617, 0), "Search the crate in the Lumbridge basement."), - new CrypticClue("Search through some drawers found in Taverley's houses.", DRAWERS_350, new WorldPoint(2894, 3418, 0), "The south-eastern most house, south of Jatix's Herblore Shop."), - new CrypticClue("Anger Abbot Langley.", "Abbot Langley", new WorldPoint(3058, 3487, 0), "Speak to Abbot Langley in the Edgeville Monastery while you have a negative prayer bonus (currently only possible with an Ancient staff)."), - new CrypticClue("Dig where only the skilled, the wealthy, or the brave can choose not to visit again.", new WorldPoint(3221, 3219, 0), "Dig at Lumbridge spawn"), - new CrypticClue("Scattered coins and gems fill the floor. The chest you seek is in the north east.", "King Black Dragon", CLOSED_CHEST_375, new WorldPoint(2288, 4702, 0), "Kill the King Black Dragon for a key (elite), and then open the closed chest in the NE corner of the lair."), - new CrypticClue("A ring of water surrounds 4 powerful rings, dig above the ladder located there.", new WorldPoint(1910, 4367, 0), "Dig by the ladder leading to the Dagannoth Kings room in the Waterbirth Island Dungeon."), - new CrypticClue("This place sure is a mess.", "Ewesey", new WorldPoint(1646, 3631, 0), "Ewesey is located in the mess hall in Hosidius."), - new CrypticClue("Here, there are tears, but nobody is crying. Speak to the guardian and show off your alignment to balance.", "Juna", JUNA, new WorldPoint(3252, 9517, 2), "Talk to Juna while wearing three Guthix related items."), - new CrypticClue("You might have to turn over a few stones to progress.", null, "Kill a rock crab."), - new CrypticClue("Dig under Razorlor's toad batta.", new WorldPoint(3139, 4554, 0), "Dig on the toad batta spawn in Tarn's Lair."), - new CrypticClue("Talk to Cassie in Falador.", "Cassie", new WorldPoint(2975, 3383, 0), "Cassie is found just south-east of the northern Falador gate."), - new CrypticClue("Faint sounds of 'Arr', fire giants found deep, the eastern tip of a lake, are the rewards you could reap.", new WorldPoint(3055, 10338, 0), "Dig south of the pillar at the end of the Deep Wilderness Dungeon."), - new CrypticClue("If you're feeling brave, dig beneath the dragon's eye.", new WorldPoint(2410, 4714, 0), "Dig below the mossy rock under the Viyeldi caves (Legend's Quest). Items needed: Pickaxe, unpowered orb, lockpick, spade, and any charge orb spell."), - new CrypticClue("Search the tents in the Imperial Guard camp in Burthorpe for some boxes.", BOXES_3686, new WorldPoint(2885, 3540, 0), "Search in the tents in northwest corner of the camp."), - new CrypticClue("A dwarf, approaching death, but very much in the light.", "Thorgel", new WorldPoint(1863, 4639, 0), "Thorgel at the entrance to the Death altar"), - new CrypticClue("You must be 100 to play with me.", "Squire (Veteran)", new WorldPoint(2638, 2656, 0), "Speak to the Veteran boat squire at Pest Control"), - new CrypticClue("Three rule below and three sit at top. Come dig at my entrance.", new WorldPoint(2523, 3739, 0), "Dig in front of the entrance to the Waterbirth Island Dungeon."), - new CrypticClue("Search the drawers in the ground floor of a shop in Yanille.", DRAWERS_350, new WorldPoint(2570, 3085, 0), "Search the drawers in Yanille's hunting shop."), - new CrypticClue("Search the drawers of houses in Burthorpe.", DRAWERS, new WorldPoint(2929, 3570, 0), "Inside Hild's house in the northeast corner of Burthorpe."), - new CrypticClue("Where safe to speak, the man who offers the pouch of smallest size wishes to see your alignment.", "Mage of Zamorak", new WorldPoint(3260, 3385, 0), "Speak to the Mage of Zamorak south of the Rune Shop in Varrock while wearing three zamorakian items"), - new CrypticClue("Search the crates in the guard house of the northern gate of East Ardougne.", CRATE_356, new WorldPoint(2645, 3338, 0), "The guard house is northeast of the Handelmort Mansion."), - new CrypticClue("Go to the village being attacked by trolls, search the drawers in one of the houses.", "Penda", DRAWERS_350, new WorldPoint(2921, 3577, 0), "Go to Dunstan's house in the northeast corner of Burthorpe. Kill Penda in the Toad and Chicken to obtain the key."), - new CrypticClue("You'll get licked.", null, "Kill a Bloodveld."), - new CrypticClue("She's small but can build both literally and figuratively, as long as you have their favour.", "Lovada", new WorldPoint(1486, 3834, 0), "Speak to Lovada by the entrance to the blast mine in Lovakengj."), - new CrypticClue("Dig in front of the icy arena where 1 of 4 was fought.", new WorldPoint(2874, 3757, 0), "Where you fought Kamil from Desert Treasure."), - new CrypticClue("Speak to Roavar.", "Roavar", new WorldPoint(3494, 3474, 0), "Talk to Roavar in the Canifis tavern."), - new CrypticClue("Search the drawers upstairs of houses in the eastern part of Falador.", DRAWERS_350, new WorldPoint(3035, 3347, 1), "House is located east of the eastern Falador bank and south of the fountain. The house is indicated by the icon on the minimap."), - new CrypticClue("Search the drawers found upstairs in East Ardougne's houses.", DRAWERS, new WorldPoint(2574, 3326, 1), "Upstairs of the pub north of the Ardougne Castle."), - new CrypticClue("The far north eastern corner where 1 of 4 was defeated, the shadows still linger.", new WorldPoint(2744, 5116, 0), "Dig on the northeastern-most corner of the Shadow Dungeon. Bring a ring of visibility."), - new CrypticClue("Search the drawers in a house in Draynor Village.", DRAWERS_350, new WorldPoint(3097, 3277, 0), "The drawer is located in the northernmost house in Draynor Village."), - new CrypticClue("Search the boxes in a shop in Taverley.", BOXES_360, new WorldPoint(2886, 3449, 0), "The box inside Gaius' Two Handed Shop."), - new CrypticClue("I lie beneath the first descent to the holy encampment.", new WorldPoint(2914, 5300, 1), "Dig immediately after climbing down the first set of rocks towards Saradomin's encampment within the God Wars Dungeon."), - new CrypticClue("Search the upstairs drawers of a house in a village where pirates are known to have a good time.", "Pirate", 348, new WorldPoint(2809, 3165, 1), "The house in the southeast corner of Brimhaven, northeast of Davon's Amulet Store. Kill any Pirate located around Brimhaven to obtain the key."), - new CrypticClue("Search the chest in the Duke of Lumbridge's bedroom.", CLOSED_CHEST_375, new WorldPoint(3209, 3218, 1), "The Duke's room is on the first floor in Lumbridge Castle."), - new CrypticClue("Talk to the Doomsayer.", "Doomsayer", new WorldPoint(3232, 3228, 0), "Doomsayer can be found just north of Lumbridge Castle entrance."), - new CrypticClue("Search the chests upstairs in Al Kharid Palace.", CLOSED_CHEST_375, new WorldPoint(3301, 3169, 1), "The chest is located, in the northeast corner, on the first floor of the Al Kharid Palace"), - new CrypticClue("Search the boxes just outside the Armour shop in East Ardougne.", BOXES_361, new WorldPoint(2654, 3299, 0), "Outside Zenesha's Plate Mail Body Shop"), - new CrypticClue("Surrounded by white walls and gems.", "Herquin", new WorldPoint(2945, 3335, 0), "Talk to Herquin, the gem store owner in Falador."), - new CrypticClue("Monk's residence in the far west. See robe storage device.", DRAWERS_350, new WorldPoint(1746, 3490, 0), "Search the drawers in the south tent of the monk's camp on the southern coast of Hosidius, directly south of the player-owned house portal."), - 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("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."), - new CrypticClue("Thanks, Grandma!", "Tynan", new WorldPoint(1836, 3786, 0), "Tynan can be found in the north-east corner of Port Piscarilius."), - new CrypticClue("In a town where everyone has perfect vision, seek some locked drawers in a house that sits opposite a workshop.", "Chicken", DRAWERS_25766, new WorldPoint(2709, 3478, 0), "The Seers' Village house south of the Elemental Workshop entrance. Kill any Chicken to obtain a key."), - new CrypticClue("The treasure is buried in a small building full of bones. Here is a hint: it's not near a graveyard.", new WorldPoint(3356, 3507, 0), "In the western building near the Limestone quarry east of Varrock. Dig south of the box of bones in the smaller building."), - new CrypticClue("Search the crates in East Ardougne's general store.", CRATE_357, new WorldPoint(2615, 3291, 0), "Located south of the Ardougne church."), - new CrypticClue("Come brave adventurer, your sense is on fire. If you talk to me, it's an old god you desire.", "Viggora", null, "Speak to Viggora"), - new CrypticClue("2 musical birds. Dig in front of the spinning light.", new WorldPoint(2671, 10396, 0), "Dig in front of the spinning light in Ping and Pong's room inside the Iceberg"), - new CrypticClue("Search the wheelbarrow in Rimmington mine.", WHEELBARROW_9625, new WorldPoint(2978, 3239, 0), "The Rimmington mining site is located north of Rimmington."), - new CrypticClue("Belladonna, my dear. If only I had gloves, then I could hold you at last.", "Tool Leprechaun", new WorldPoint(3088, 3357, 0), "Talk to Tool Leprechaun at Draynor Manor"), - new CrypticClue("Impossible to make angry", "Abbot Langley", new WorldPoint(3059, 3486, 0), "Speak to Abbot Langley at the Edgeville Monastery."), - new CrypticClue("Search the crates in Horvik's armoury.", CRATE_5106, new WorldPoint(3228, 3433, 0), "Horvik's in Varrock"), - new CrypticClue("Ghommal wishes to be impressed by how strong your equipment is.", "Ghommal", new WorldPoint(2878, 3546, 0), "Speak to Ghommal at the Warriors' Guild with a total Melee Strength bonus of over 100."), - new CrypticClue("Shhhh!", "Logosia", new WorldPoint(1633, 3808, 0), "Speak to Logosia in the Arceuus Library's ground floor."), - new CrypticClue("Salty peter.", "Konoo", new WorldPoint(1703, 3524, 0), "Talk to Konoo who is digging saltpetre in Hosidius, north-east of the Woodcutting Guild."), - new CrypticClue("Talk to Zeke in Al Kharid.", "Zeke", new WorldPoint(3287, 3190, 0), "Zeke is the owner of the scimitar shop in Al Kharid."), - new CrypticClue("Guthix left his mark in a fiery lake, dig at the tip of it.", new WorldPoint(3069, 3935, 0), "Dig at the tip of the lava lake that is shaped like a Guthixian symbol, west of the Mage Arena."), - new CrypticClue("Search the drawers in the upstairs of a house in Catherby.", DRAWERS_350, new WorldPoint(2809, 3451, 1), "Perdu's house in Catherby."), - new CrypticClue("Search a crate in the Haymaker's arms.", CRATE_27532, new WorldPoint(1720, 3652, 1), "Search the crate in the north-east corner of The Haymaker's Arms tavern east of Kourend Castle."), - new CrypticClue("Desert insects is what I see. Taking care of them was my responsibility. Your solution is found by digging near me.", new WorldPoint(3307, 9505, 0), "Dig next to the Entomologist, Kalphite area, near Shantay Pass."), - new CrypticClue("Search the crates in the most north-western house in Al Kharid.", CRATE_358, new WorldPoint(3289, 3202, 0), "Search the crates in the house, marked with a icon, southeast of the gem stall."), - new CrypticClue("You will have to fly high where a sword cannot help you.", null, "Kill an Aviansie."), - new CrypticClue("A massive battle rages beneath so be careful when you dig by the large broken crossbow.", new WorldPoint(2927, 3761, 0), "NE of the God Wars Dungeon entrance, climb the rocky handholds & dig by large crossbow."), - new CrypticClue("Mix yellow with blue and add heat, make sure you bring protection.", null, "Kill a green dragon."), - new CrypticClue("Speak to Ellis in Al Kharid.", "Ellis", new WorldPoint(3276, 3191, 0), "Ellis is tanner just north of Al Kharid bank."), - new CrypticClue("Search the chests in the Dwarven Mine.", CLOSED_CHEST_375, new WorldPoint(3000, 9798, 0), "The chest is on the western wall, where Hura's Crossbow Shop is, in the Dwarven Mine."), - new CrypticClue("In a while...", null, "Kill a crocodile."), - new CrypticClue("A chisel and hammer reside in his home, strange for one of magic. Impress him with your magical equipment.", "Wizard Cromperty", new WorldPoint(2682, 3325, 0), "Wizard Cromperty, NE corner of East Ardougne. +100 magic attack bonus needed"), - new CrypticClue("You have all of the elements available to solve this clue. Fortunately you do not have to go as far as to stand in a draft.", CRATE_18506, new WorldPoint(2723, 9891, 0), "Search the crate, west of the Air Elementals, inside the Elemental Workshop."), - new CrypticClue("A demon's best friend holds the next step of this clue.", null, "Kill a hellhound."), - new CrypticClue("Dig in the centre of a great kingdom of 5 cities.", new WorldPoint(1639, 3673, 0), "Dig in front of the large statue in the centre of Great Kourend."), - new CrypticClue("Hopefully this set of armour will help you to keep surviving.", "Sir Vyvin", new WorldPoint(2982, 3336, 2), "Speak to Sir Vyvin while wearing a white platebody, and platelegs."), - new CrypticClue("The beasts retreat, for their Queen is gone; the song of this town still plays on. Dig near the birthplace of a blade, be careful not to melt your spade.", new WorldPoint(2342, 3677, 0), "Dig in front of the small furnace in the Piscatoris Fishing Colony."), - new CrypticClue("Darkness wanders around me, but fills my mind with knowledge.", "Biblia", new WorldPoint(1633, 3825, 2), "Speak to Biblia on the Arceuus Library's top floor."), - new CrypticClue("I would make a chemistry joke, but I'm afraid I wouldn't get a reaction.", "Chemist", new WorldPoint(2932, 3212, 0), "Talk to the Chemist in Rimmington"), - new CrypticClue("Show this to Hazelmere.", "Hazelmere", new WorldPoint(2677, 3088, 1), "Hazelmere is found upstairs on the island located just east of Yanille."), - new CrypticClue("Does one really need a fire to stay warm here?", new WorldPoint(3816, 3810, 0), "Dig next to the fire near the Volcanic Mine entrance."), - new CrypticClue("Search the open crate found in the Hosidius kitchens.", CRATE_27533, new WorldPoint(1683, 3616, 0), "The kitchens are north-west of the town in Hosidius."), - new CrypticClue("Dig under Ithoi's cabin.", new WorldPoint(2529, 2838, 0), "Dig under Ithoi's cabin in the Corsair Cove."), - new CrypticClue("Search the drawers, upstairs in the bank to the East of Varrock.", DRAWERS_7194, new WorldPoint(3250, 3420, 1), "Search the drawers upstairs in Varrock east bank."), - new CrypticClue("Speak to Hazelmere.", "Hazelmere", new WorldPoint(2677, 3088, 1), "Located upstairs in the house to the north of fairy ring CLS. Answer: 6859", "What is 19 to the power of 3?"), - new CrypticClue("The effects of this fire are magnified.", new WorldPoint(1179, 3626, 0), "Dig by the fire beside Ket'sal K'uk in the westernmost part of the Kebos Swamp. "), - new CrypticClue("Always walking around the castle grounds and somehow knows everyone's age.", "Hans", new WorldPoint(3221, 3218, 0), "Talk to Hans walking around Lumbridge Castle."), - new CrypticClue("In the place Duke Horacio calls home, talk to a man with a hat dropped by goblins.", "Cook", new WorldPoint(3208, 3213, 0), "Talk to the Cook in Lumbridge Castle."), - new CrypticClue("In a village of barbarians, I am the one who guards the village from up high.", "Hunding", new WorldPoint(3097, 3432, 2), "Talk to Hunding atop the tower on the east side of Barbarian Village."), - new CrypticClue("Talk to Charlie the Tramp in Varrock.", "Charlie the Tramp", new WorldPoint(3209, 3390, 0), "Talk to Charlie the Tramp by the southern entrance to Varrock. He will give you a task."), - new CrypticClue("Near the open desert I reside, to get past me you must abide. Go forward if you dare, for when you pass me, you'll be sweating by your hair.", "Shantay", new WorldPoint(3303, 3123, 0), "Talk to Shantay at the Shantay Pass south of Al Kharid."), - new CrypticClue("Search the chest in Fred the Farmer's bedroom.", CLOSED_CHEST_375, new WorldPoint(3185, 3274, 0), "Search the chest by Fred the Farmer's bed in his house north-west of Lumbridge."), - new CrypticClue("Search the eastern bookcase in Father Urhney's house.", BOOKCASE_9523, new WorldPoint(3149, 3177, 0), "Father Urhney's house is found in the western end of the Lumbridge Swamp."), - new CrypticClue("Talk to Morgan in his house at Draynor Village.", "Morgan", new WorldPoint(3098, 3268, 0), "Morgan can be found in the house with the quest start map icon."), - new CrypticClue("Talk to Charles at Port Piscarilius.", "Charles", new WorldPoint(1821, 3690, 0), "Charles is found by Veos' ship in Port Piscarilius."), - new CrypticClue("Search the crate in Rommiks crafting shop in Rimmington.", CRATE_9533, new WorldPoint(2946, 3207, 0), "The crates in Rommik's Crafty Supplies in Rimmington."), - new CrypticClue("Talk to Ali the Leaflet Dropper north of the Al Kharid mine.", "Ali the Leaflet Dropper", new WorldPoint(3283, 3329, 0), "Ali the Leaflet Dropper can be found roaming north of the Al Kharid mine."), - new CrypticClue("Talk to the cook in the Blue Moon Inn in Varrock.", "Cook", new WorldPoint(3230, 3401, 0), "The Blue Moon Inn can be found by the southern entrance to Varrock."), - new CrypticClue("Search the single crate in Horvik's smithy in Varrock.", CRATE_5106, new WorldPoint(3228, 3433, 0), "Horvik's Smithy is found north-east of of Varrock Square."), - new CrypticClue("Search the crates in Falador General store.", CRATES_24088, new WorldPoint(2955, 3390, 0), "The Falador General Store can be found by the northern entrance to the city."), - new CrypticClue("Talk to Wayne at Wayne's Chains in Falador.", "Wayne", new WorldPoint(2972, 3312, 0), "Wayne's shop is found directly south of the White Knights' Castle."), - new CrypticClue("Search the boxes next to a chest that needs a crystal key.", BOXES_360, new WorldPoint(2915, 3452, 0), "The Crystal chest can be found in the house directly south of the Witch's house in Taverley."), - new CrypticClue("Talk to Turael in Burthorpe.", "Turael", new WorldPoint(2930, 3536, 0), "Turael is located in the small house east of the Toad and Chicken inn."), - new CrypticClue("More resources than I can handle, but in a very dangerous area. Can't wait to strike gold!", new WorldPoint(3183, 3941, 0), "Dig between the three gold ores in the Wilderness Resource Area."), - new CrypticClue("Observing someone in a swamp, under the telescope lies treasure.", new WorldPoint(2221, 3091, 0), "Dig next to the telescope on Broken Handz's island in the poison wastes. (Accessible only through fairy ring DLR)"), - new CrypticClue("A general who sets a 'shining' example.", "General Hining", new WorldPoint(2186, 3148, 0), "Talk to General Hining in Tyras Camp."), - new CrypticClue("Has no one told you it is rude to ask a lady her age?", "Mawrth", new WorldPoint(2333, 3165, 0), "Talk to Mawrth in Lletya."), - new CrypticClue("Elvish onions.", new WorldPoint(3303, 6092, 0), "Dig in the onion patch east of the Prifddinas allotments.") - ); - - private final String text; - private final String npc; - private final int objectId; - private final WorldPoint location; - private final String solution; - private final String questionText; - - private CrypticClue(String text, WorldPoint location, String solution) - { - this(text, null, -1, location, solution); - } - - private CrypticClue(String text, int objectId, WorldPoint location, String solution) - { - this(text, null, objectId, location, solution, ""); - } - - private CrypticClue(String text, String npc, WorldPoint location, String solution) - { - this(text, npc, -1, location, solution, ""); - } - - private CrypticClue(String text, int objectId, WorldPoint location, String solution, String questionText) - { - this(text, null, objectId, location, solution, questionText); - } - - private CrypticClue(String text, String npc, WorldPoint location, String solution, String questionText) - { - this(text, npc, -1, location, solution, questionText); - } - - private CrypticClue(String text, String npc, int objectId, WorldPoint location, String solution) - { - this(text, npc, objectId, location, solution, ""); - } - - private CrypticClue(String text, String npc, int objectId, WorldPoint location, String solution, String questionText) - { - this.text = text; - this.npc = npc; - this.objectId = objectId; - this.location = location; - this.solution = solution; - this.questionText = questionText; - setRequiresSpade(getLocation() != null && getNpc() == null && objectId == -1); - } - - @Override - public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin) - { - panelComponent.getChildren().add(TitleComponent.builder().text("Cryptic Clue").build()); - - if (getNpc() != null) - { - panelComponent.getChildren().add(LineComponent.builder().left("NPC:").build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(getNpc()) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - } - - if (objectId != -1) - { - ObjectDefinition object = plugin.getClient().getObjectDefinition(objectId); - - if (object != null && object.getImpostorIds() != null) - { - object = object.getImpostor(); - } - - if (object != null) - { - panelComponent.getChildren().add(LineComponent.builder().left("Object:").build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(object.getName()) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - } - } - - panelComponent.getChildren().add(LineComponent.builder().left("Solution:").build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(getSolution()) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - } - - @Override - public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) - { - // Mark dig location - if (getLocation() != null && getNpc() == null && objectId == -1) - { - LocalPoint localLocation = LocalPoint.fromWorld(plugin.getClient(), getLocation()); - - if (localLocation != null) - { - OverlayUtil.renderTileOverlay(plugin.getClient(), graphics, localLocation, plugin.getSpadeImage(), Color.ORANGE); - } - } - - // Mark NPC - if (plugin.getNpcsToMark() != null) - { - for (NPC npc : plugin.getNpcsToMark()) - { - OverlayUtil.renderActorOverlayImage(graphics, npc, plugin.getClueScrollImage(), Color.ORANGE, IMAGE_Z_OFFSET); - } - } - - // Mark game object - if (objectId != -1) - { - net.runelite.api.Point mousePosition = plugin.getClient().getMouseCanvasPosition(); - - if (plugin.getObjectsToMark() != null) - { - for (TileObject gameObject : plugin.getObjectsToMark()) - { - OverlayUtil.renderHoverableArea(graphics, gameObject.getClickbox(), mousePosition, - CLICKBOX_FILL_COLOR, CLICKBOX_BORDER_COLOR, CLICKBOX_HOVER_BORDER_COLOR); - - OverlayUtil.renderImageLocation(plugin.getClient(), graphics, gameObject.getLocalLocation(), plugin.getClueScrollImage(), IMAGE_Z_OFFSET); - } - } - } - } - - public static CrypticClue forText(String text) - { - for (CrypticClue clue : CLUES) - { - if (clue.text.equalsIgnoreCase(text) || clue.questionText.equalsIgnoreCase(text)) - { - return clue; - } - } - - return null; - } - - @Override - public int[] getObjectIds() - { - return new int[]{objectId}; - } - - @Override - public String[] getNpcs() - { - return new String[]{npc}; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/EmoteClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/EmoteClue.java deleted file mode 100644 index 76760d8d91..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/EmoteClue.java +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls.clues; - -import com.google.common.collect.ImmutableSet; -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.util.Set; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import static net.runelite.api.EquipmentInventorySlot.LEGS; -import static net.runelite.api.EquipmentInventorySlot.*; -import net.runelite.api.Item; -import net.runelite.api.ItemID; -import static net.runelite.api.ItemID.*; -import net.runelite.api.Perspective; -import net.runelite.api.ScriptID; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import static net.runelite.client.plugins.cluescrolls.ClueScrollOverlay.TITLED_CONTENT_COLOR; -import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin; -import net.runelite.client.plugins.cluescrolls.clues.emote.Emote; -import static net.runelite.client.plugins.cluescrolls.clues.emote.Emote.BULL_ROARER; -import static net.runelite.client.plugins.cluescrolls.clues.emote.Emote.*; -import net.runelite.client.plugins.cluescrolls.clues.emote.STASHUnit; -import static net.runelite.client.plugins.cluescrolls.clues.emote.STASHUnit.SHANTAY_PASS; -import static net.runelite.client.plugins.cluescrolls.clues.emote.STASHUnit.*; -import net.runelite.client.plugins.cluescrolls.clues.item.ItemRequirement; -import static net.runelite.client.plugins.cluescrolls.clues.item.ItemRequirements.all; -import static net.runelite.client.plugins.cluescrolls.clues.item.ItemRequirements.any; -import static net.runelite.client.plugins.cluescrolls.clues.item.ItemRequirements.emptySlot; -import static net.runelite.client.plugins.cluescrolls.clues.item.ItemRequirements.item; -import static net.runelite.client.plugins.cluescrolls.clues.item.ItemRequirements.range; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -@Getter(AccessLevel.PUBLIC) -public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClueScroll -{ - private static final Set CLUES = ImmutableSet.of( - new EmoteClue("Beckon on the east coast of the Kharazi Jungle. Beware of double agents! Equip any vestment stole and a heraldic rune shield.", "Kharazi Jungle", NORTHEAST_CORNER_OF_THE_KHARAZI_JUNGLE, new WorldPoint(2954, 2933, 0), BECKON, any("Any stole", item(GUTHIX_STOLE), item(SARADOMIN_STOLE), item(ZAMORAK_STOLE), item(ARMADYL_STOLE), item(BANDOS_STOLE), item(ANCIENT_STOLE)), any("Any heraldic rune shield", item(RUNE_SHIELD_H1), item(RUNE_SHIELD_H2), item(RUNE_SHIELD_H3), item(RUNE_SHIELD_H4), item(RUNE_SHIELD_H5))), - new EmoteClue("Cheer in the Barbarian Agility Arena. Headbang before you talk to me. Equip a steel platebody, maple shortbow and a Wilderness cape.", "Barbarian Outpost", BARBARIAN_OUTPOST_OBSTACLE_COURSE, new WorldPoint(2552, 3556, 0), CHEER, HEADBANG, item(STEEL_PLATEBODY), item(MAPLE_SHORTBOW), range("Any team cape", TEAM1_CAPE, TEAM50_CAPE)), - new EmoteClue("Bow upstairs in the Edgeville Monastery. Equip a completed prayer book.", "Edgeville Monastery", SOUTHEAST_CORNER_OF_THE_MONASTERY, new WorldPoint(3056, 3484, 1), BOW, any("Any god book", item(HOLY_BOOK), item(BOOK_OF_BALANCE), item(UNHOLY_BOOK), item(BOOK_OF_LAW), item(BOOK_OF_WAR), item(BOOK_OF_DARKNESS))), - new EmoteClue("Cheer in the Shadow dungeon. Equip a rune crossbow, climbing boots and any mitre.", "Shadow dungeon", ENTRANCE_OF_THE_CAVE_OF_DAMIS, new WorldPoint(2629, 5071, 0), CHEER, any("Any mitre", item(GUTHIX_MITRE), item(SARADOMIN_MITRE), item(ZAMORAK_MITRE), item(ANCIENT_MITRE), item(BANDOS_MITRE), item(ARMADYL_MITRE)), item(RUNE_CROSSBOW), item(CLIMBING_BOOTS), item(RING_OF_VISIBILITY)), - new EmoteClue("Cheer at the top of the agility pyramid. Beware of double agents! Equip a blue mystic robe top, and any rune heraldic shield.", "Agility Pyramid", AGILITY_PYRAMID, new WorldPoint(3043, 4697, 3), CHEER, item(MYSTIC_ROBE_TOP), any("Any rune heraldic shield", item(RUNE_SHIELD_H1), item(RUNE_SHIELD_H2), item(RUNE_SHIELD_H3), item(RUNE_SHIELD_H4), item(RUNE_SHIELD_H5))), - new EmoteClue("Dance in Iban's temple. Beware of double agents! Equip Iban's staff, a black mystic top and a black mystic bottom.", "Iban's temple", WELL_OF_VOYAGE, new WorldPoint(2011, 4712, 0), DANCE, any("Any iban's staff", item(IBANS_STAFF), item(IBANS_STAFF_U)), item(MYSTIC_ROBE_TOP_DARK), item(MYSTIC_ROBE_BOTTOM_DARK)), - new EmoteClue("Dance on the Fishing Platform. Equip barrows gloves, an amulet of glory and a dragon med helm.", "Fishing Platform", SOUTHEAST_CORNER_OF_THE_FISHING_PLATFORM, new WorldPoint(2782, 3273, 0), DANCE, any("Any amulet of glory", item(AMULET_OF_GLORY), item(AMULET_OF_GLORY1), item(AMULET_OF_GLORY2), item(AMULET_OF_GLORY3), item(AMULET_OF_GLORY4), item(AMULET_OF_GLORY5), item(AMULET_OF_GLORY6)), item(BARROWS_GLOVES), item(DRAGON_MED_HELM)), - new EmoteClue("Flap at the death altar. Beware of double agents! Equip a death tiara, a legend's cape and any ring of wealth.", "Death altar", DEATH_ALTAR, new WorldPoint(2205, 4838, 0), FLAP, any("Any ring of wealth", item(RING_OF_WEALTH), item(RING_OF_WEALTH_1), item(RING_OF_WEALTH_2), item(RING_OF_WEALTH_3), item(RING_OF_WEALTH_4), item(RING_OF_WEALTH_5), item(RING_OF_WEALTH_I), item(RING_OF_WEALTH_I1), item(RING_OF_WEALTH_I2), item(RING_OF_WEALTH_I3), item(RING_OF_WEALTH_I4), item(RING_OF_WEALTH_I5)), item(DEATH_TIARA), item(CAPE_OF_LEGENDS)), - new EmoteClue("Headbang in the Fight Arena pub. Equip a pirate bandana, a dragonstone necklace and and a magic longbow.", "Fight Arena pub", OUTSIDE_THE_BAR_BY_THE_FIGHT_ARENA, new WorldPoint(2568, 3149, 0), HEADBANG, any("Any pirate bandana", item(PIRATE_BANDANA), item(PIRATE_BANDANA_7124), item(PIRATE_BANDANA_7130), item(PIRATE_BANDANA_7136)), item(DRAGON_NECKLACE), item(MAGIC_LONGBOW)), - new EmoteClue("Do a jig at the barrows chest. Beware of double agents! Equip any full barrows set.", "Barrows chest", BARROWS_CHEST, new WorldPoint(3551, 9694, 0), JIG, any("Any full barrows set", all(range(AHRIMS_HOOD_100, AHRIMS_HOOD_0), range(AHRIMS_STAFF_100, AHRIMS_STAFF_0), range(AHRIMS_ROBETOP_100, AHRIMS_ROBETOP_0), range(AHRIMS_ROBESKIRT_100, AHRIMS_ROBESKIRT_0)), all(range(DHAROKS_HELM_100, DHAROKS_HELM_0), range(DHAROKS_GREATAXE_100, DHAROKS_GREATAXE_0), range(DHAROKS_PLATEBODY_100, DHAROKS_PLATEBODY_0), range(DHAROKS_PLATELEGS_100, DHAROKS_PLATELEGS_0)), all(range(GUTHANS_HELM_100, GUTHANS_HELM_0), range(GUTHANS_WARSPEAR_100, GUTHANS_WARSPEAR_0), range(GUTHANS_PLATEBODY_100, GUTHANS_PLATEBODY_0), range(GUTHANS_CHAINSKIRT_100, GUTHANS_CHAINSKIRT_0)), all(range(KARILS_COIF_100, KARILS_COIF_0), range(KARILS_CROSSBOW_100, KARILS_CROSSBOW_0), range(KARILS_LEATHERTOP_100, KARILS_LEATHERTOP_0), range(KARILS_LEATHERSKIRT_100, KARILS_LEATHERSKIRT_0)), all(range(TORAGS_HELM_100, TORAGS_HELM_0), range(TORAGS_HAMMERS_100, TORAGS_HAMMERS_0), range(TORAGS_PLATEBODY_100, TORAGS_PLATEBODY_0), range(TORAGS_PLATELEGS_100, TORAGS_PLATELEGS_0)), all(range(VERACS_HELM_100, VERACS_HELM_0), range(VERACS_FLAIL_100, VERACS_FLAIL_0), range(VERACS_BRASSARD_100, VERACS_BRASSARD_0), range(VERACS_PLATESKIRT_100, VERACS_PLATESKIRT_0)))), - new EmoteClue("Jig at Jiggig. Beware of double agents! Equip a Rune spear, rune platelegs and any rune heraldic helm.", "Jiggig", IN_THE_MIDDLE_OF_JIGGIG, new WorldPoint(2477, 3047, 0), JIG, range("Any rune heraldic helm", RUNE_HELM_H1, RUNE_HELM_H5), item(RUNE_SPEAR), item(RUNE_PLATELEGS)), - new EmoteClue("Cheer at the games room. Have nothing equipped at all when you do.", "Games room", null, new WorldPoint(2207, 4952, 0), CHEER, emptySlot("Nothing at all", HEAD, CAPE, AMULET, WEAPON, BODY, SHIELD, LEGS, GLOVES, BOOTS, RING, AMMO)), - new EmoteClue("Panic on the pier where you catch the Fishing trawler. Have nothing equipped at all when you do.", "Fishing trawler", null, new WorldPoint(2676, 3169, 0), PANIC, emptySlot("Nothing at all", HEAD, CAPE, AMULET, WEAPON, BODY, SHIELD, LEGS, GLOVES, BOOTS, RING, AMMO)), - new EmoteClue("Panic in the heart of the Haunted Woods. Beware of double agents! Have no items equipped when you do.", "Haunted Woods", null, new WorldPoint(3611, 3492, 0), PANIC, emptySlot("Nothing at all", HEAD, CAPE, AMULET, WEAPON, BODY, SHIELD, LEGS, GLOVES, BOOTS, RING, AMMO)), - new EmoteClue("Show your anger towards the Statue of Saradomin in Ellamaria's garden. Beware of double agents! Equip a zamorak godsword.", "Varrock Castle", BY_THE_BEAR_CAGE_IN_VARROCK_PALACE_GARDENS, new WorldPoint(3230, 3478, 0), ANGRY, item(ZAMORAK_GODSWORD)), - new EmoteClue("Show your anger at the Wise old man. Beware of double agents! Equip an abyssal whip, a legend's cape and some spined chaps.", "Draynor Village", BEHIND_MISS_SCHISM_IN_DRAYNOR_VILLAGE, new WorldPoint(3088, 3254, 0), ANGRY, any("Abyssal whip", item(ABYSSAL_WHIP), item(VOLCANIC_ABYSSAL_WHIP), item(FROZEN_ABYSSAL_WHIP)), item(CAPE_OF_LEGENDS), item(SPINED_CHAPS)), - new EmoteClue("Beckon by a collection of crystalline maple trees. Beware of double agents! Equip Bryophyta's staff and a nature tiara.", "North of Prifddinas", CRYSTALLINE_MAPLE_TREES, new WorldPoint(2211, 3427, 0), BECKON, range("Bryophyta's staff", BRYOPHYTAS_STAFF_UNCHARGED, BRYOPHYTAS_STAFF), item(NATURE_TIARA)), - new EmoteClue("Beckon in the Digsite, near the eastern winch. Bow before you talk to me. Equip a green gnome hat, snakeskin boots and an iron pickaxe.", "Digsite", DIGSITE, new WorldPoint(3370, 3425, 0), BECKON, BOW, item(GREEN_HAT), item(SNAKESKIN_BOOTS), item(IRON_PICKAXE)), - new EmoteClue("Beckon in Tai Bwo Wannai. Clap before you talk to me. Equip green dragonhide chaps, a ring of dueling and a mithril medium helmet.", "Tai Bwo Wannai", SOUTH_OF_THE_SHRINE_IN_TAI_BWO_WANNAI_VILLAGE, new WorldPoint(2803, 3073, 0), BECKON, CLAP, item(GREEN_DHIDE_CHAPS), any("Ring of dueling", item(RING_OF_DUELING1), item(RING_OF_DUELING2), item(RING_OF_DUELING3), item(RING_OF_DUELING4), item(RING_OF_DUELING5), item(RING_OF_DUELING6), item(RING_OF_DUELING7), item(RING_OF_DUELING8)), item(MITHRIL_MED_HELM)), - new EmoteClue("Beckon in the combat ring of Shayzien. Show your anger before you talk to me. Equip an adamant platebody, adamant full helm and adamant platelegs.", "Shayzien combat ring", WEST_OF_THE_SHAYZIEN_COMBAT_RING, new WorldPoint(1545, 3594, 0), BECKON, ANGRY, item(ADAMANT_PLATELEGS), item(ADAMANT_PLATEBODY), item(ADAMANT_FULL_HELM)), - new EmoteClue("Bow near Lord Iorwerth. Beware of double agents! Equip a charged crystal bow.", "Lord Iorwerth's camp", TENT_IN_LORD_IORWERTHS_ENCAMPMENT, new WorldPoint(2205, 3252, 0), BOW, any("Crystal Bow", item(CRYSTAL_BOW), item(CRYSTAL_BOW_24123))), - new EmoteClue("Bow in the Iorwerth Camp. Beware of double agents! Equip a charged crystal bow.", "Lord Iorwerth's camp", TENT_IN_LORD_IORWERTHS_ENCAMPMENT, new WorldPoint(2205, 3252, 0), BOW, any("Crystal Bow", item(CRYSTAL_BOW), item(CRYSTAL_BOW_24123))), - new EmoteClue("Bow outside the entrance to the Legends' Guild. Equip iron platelegs, an emerald amulet and an oak longbow.", "Legend's Guild", OUTSIDE_THE_LEGENDS_GUILD_GATES, new WorldPoint(2729, 3349, 0), BOW, item(IRON_PLATELEGS), item(OAK_LONGBOW), item(EMERALD_AMULET)), - new EmoteClue("Bow on the ground floor of the Legend's guild. Equip Legend's cape, a dragon battleaxe and an amulet of glory.", "Legend's Guild", OUTSIDE_THE_LEGENDS_GUILD_DOOR, new WorldPoint(2728, 3377, 0), BOW, item(CAPE_OF_LEGENDS), item(DRAGON_BATTLEAXE), any("Any amulet of glory", item(AMULET_OF_GLORY), item(AMULET_OF_GLORY1), item(AMULET_OF_GLORY2), item(AMULET_OF_GLORY3), item(AMULET_OF_GLORY4), item(AMULET_OF_GLORY5), item(AMULET_OF_GLORY6))), - new EmoteClue("Bow in the ticket office of the Duel Arena. Equip an iron chain body, leather chaps and coif.", "Duel Arena", MUBARIZS_ROOM_AT_THE_DUEL_ARENA, new WorldPoint(3314, 3241, 0), BOW, item(IRON_CHAINBODY), item(LEATHER_CHAPS), item(COIF)), - new EmoteClue("Bow at the top of the lighthouse. Beware of double agents! Equip a blue dragonhide body, blue dragonhide vambraces and no jewelry.", "Lighthouse", TOP_FLOOR_OF_THE_LIGHTHOUSE, new WorldPoint(2511, 3641, 2), BOW, item(BLUE_DHIDE_BODY), item(BLUE_DHIDE_VAMB), emptySlot("No jewelry", AMULET, RING)), - new EmoteClue("Blow a kiss between the tables in Shilo Village bank. Beware of double agents! Equip a blue mystic hat, bone spear and rune platebody.", "Shilo Village", SHILO_VILLAGE_BANK, new WorldPoint(2851, 2954, 0), BLOW_KISS, item(MYSTIC_HAT), item(BONE_SPEAR), item(RUNE_PLATEBODY)), - new EmoteClue("Blow a kiss in the heart of the lava maze. Equip black dragonhide chaps, a spotted cape and a rolling pin.", "Lava maze", NEAR_A_LADDER_IN_THE_WILDERNESS_LAVA_MAZE, new WorldPoint(3069, 3861, 0), BLOW_KISS, item(BLACK_DHIDE_CHAPS), any("Spotted cape", item(SPOTTED_CAPE), item(SPOTTED_CAPE_10073)), item(ROLLING_PIN)), - new EmoteClue("Blow a kiss outside K'ril Tsutsaroth's chamber. Beware of double agents! Equip a zamorak full helm and the shadow sword.", "K'ril's chamber", OUTSIDE_KRIL_TSUTSAROTHS_ROOM, new WorldPoint(2925, 5333, 0), BLOW_KISS, item(ZAMORAK_FULL_HELM), item(SHADOW_SWORD)), - new EmoteClue("Cheer at the Druids' Circle. Equip a blue wizard hat, a bronze two-handed sword and HAM boots.", "Taverley stone circle", TAVERLEY_STONE_CIRCLE, new WorldPoint(2924, 3478, 0), CHEER, item(BLUE_WIZARD_HAT), item(BRONZE_2H_SWORD), item(HAM_BOOTS)), - new EmoteClue("Cheer in the Edgeville general store. Dance before you talk to me. Equip a brown apron, leather boots and leather gloves.", "Edgeville", NORTH_OF_EVIL_DAVES_HOUSE_IN_EDGEVILLE, new WorldPoint(3080, 3509, 0), CHEER, DANCE, item(BROWN_APRON), item(LEATHER_BOOTS), item(LEATHER_GLOVES)), - new EmoteClue("Cheer in the Ogre Pen in the Training Camp. Show you are angry before you talk to me. Equip a green dragonhide body and chaps and a steel square shield.", "King Lathas' camp", OGRE_CAGE_IN_KING_LATHAS_TRAINING_CAMP, new WorldPoint(2527, 3375, 0), CHEER, ANGRY, item(GREEN_DHIDE_BODY), item(GREEN_DHIDE_CHAPS), item(STEEL_SQ_SHIELD)), - new EmoteClue("Cheer in the Entrana church. Beware of double agents! Equip a full set of black dragonhide armour.", "Entrana church", ENTRANA_CHAPEL, new WorldPoint(2852, 3349, 0), CHEER, item(BLACK_DHIDE_VAMB), item(BLACK_DHIDE_CHAPS), item(BLACK_DHIDE_BODY)), - new EmoteClue("Cheer for the monks at Port Sarim. Equip a coif, steel plateskirt and a sapphire necklace.", "Port Sarim", NEAR_THE_ENTRANA_FERRY_IN_PORT_SARIM, new WorldPoint(3047, 3237, 0), CHEER, item(COIF), item(STEEL_PLATESKIRT), item(SAPPHIRE_NECKLACE)), - new EmoteClue("Clap in the main exam room in the Exam Centre. Equip a white apron, green gnome boots and leather gloves.", "Digsite", OUTSIDE_THE_DIGSITE_EXAM_CENTRE, new WorldPoint(3361, 3339, 0), CLAP, item(WHITE_APRON), item(GREEN_BOOTS), item(LEATHER_GLOVES)), - new EmoteClue("Clap on the causeway to the Wizards' Tower. Equip an iron medium helmet, emerald ring and a white apron.", "Wizards' Tower", ON_THE_BRIDGE_TO_THE_MISTHALIN_WIZARDS_TOWER, new WorldPoint(3113, 3196, 0), CLAP, item(IRON_MED_HELM), item(EMERALD_RING), item(WHITE_APRON)), - new EmoteClue("Clap on the top level of the mill, north of East Ardougne. Equip a blue gnome robe top, HAM robe bottom and an unenchanted tiara.", "East Ardougne", UPSTAIRS_IN_THE_ARDOUGNE_WINDMILL, new WorldPoint(2635, 3385, 3), CLAP, item(BLUE_ROBE_TOP), item(HAM_ROBE), item(TIARA)), - new EmoteClue("Clap in Seers court house. Spin before you talk to me. Equip an adamant halberd, blue mystic robe bottom and a diamond ring.", "Seers Village", OUTSIDE_THE_SEERS_VILLAGE_COURTHOUSE, new WorldPoint(2735, 3469, 0), CLAP, SPIN, item(ADAMANT_HALBERD), item(MYSTIC_ROBE_BOTTOM), item(DIAMOND_RING)), - new EmoteClue("Clap in the magic axe hut. Beware of double agents! Equip only some flared trousers.", "Magic axe hut", OUTSIDE_THE_WILDERNESS_AXE_HUT, new WorldPoint(3191, 3960, 0), CLAP, item(FLARED_TROUSERS), item(LOCKPICK), emptySlot("Nothing else", HEAD, CAPE, AMULET, WEAPON, BODY, SHIELD, GLOVES, BOOTS, RING, AMMO)), - new EmoteClue("Clap your hands north of Mount Karuulm Spin before you talk to me. Equip an adamant warhammer, a ring of life and a pair of mithril boots.", "Mount Karuulm", NORTH_OF_MOUNT_KARUULM, new WorldPoint(1306, 3839, 0), CLAP, SPIN, item(ADAMANT_WARHAMMER), item(RING_OF_LIFE), item(MITHRIL_BOOTS)), - new EmoteClue("Cry in the Catherby Ranging shop. Bow before you talk to me. Equip blue gnome boots, a hard leather body and an unblessed silver sickle.", "Catherby", HICKTONS_ARCHERY_EMPORIUM, new WorldPoint(2823, 3443, 0), CRY, BOW, item(BLUE_BOOTS), item(HARDLEATHER_BODY), item(SILVER_SICKLE)), - new EmoteClue("Cry on the shore of Catherby beach. Laugh before you talk to me, equip an adamant sq shield, a bone dagger and mithril platebody.", "Catherby", OUTSIDE_HARRYS_FISHING_SHOP_IN_CATHERBY, new WorldPoint(2852, 3429, 0), CRY, LAUGH, item(ADAMANT_SQ_SHIELD), item(BONE_DAGGER), item(MITHRIL_PLATEBODY)), - new EmoteClue("Cry on top of the western tree in the Gnome Agility Arena. Indicate 'no' before you talk to me. Equip a steel kiteshield, ring of forging and green dragonhide chaps.", "Gnome Stronghold", GNOME_STRONGHOLD_BALANCING_ROPE, new WorldPoint(2473, 3420, 2), CRY, NO, item(STEEL_KITESHIELD), item(RING_OF_FORGING), item(GREEN_DHIDE_CHAPS)), - new EmoteClue("Cry in the TzHaar gem store. Beware of double agents! Equip a fire cape and TokTz-Xil-Ul.", "Tzhaar gem store", TZHAAR_GEM_STORE, new WorldPoint(2463, 5149, 0), CRY, any("Fire cape", item(FIRE_CAPE), item(FIRE_MAX_CAPE), item(INFERNAL_CAPE), item(INFERNAL_MAX_CAPE)), item(TOKTZXILUL)), - new EmoteClue("Cry in the Draynor Village jail. Jump for joy before you talk to me. Equip an adamant sword, a sapphire amulet and an adamant plateskirt.", "Draynor Village jail", OUTSIDE_DRAYNOR_VILLAGE_JAIL, new WorldPoint(3128, 3245, 0), CRY, JUMP_FOR_JOY, item(ADAMANT_SWORD), item(SAPPHIRE_AMULET), item(ADAMANT_PLATESKIRT)), - new EmoteClue("Dance at the crossroads north of Draynor. Equip an iron chain body, a sapphire ring and a longbow.", "Draynor Village", CROSSROADS_NORTH_OF_DRAYNOR_VILLAGE, new WorldPoint(3109, 3294, 0), DANCE, item(IRON_CHAINBODY), item(SAPPHIRE_RING), item(LONGBOW)), - new EmoteClue("Dance in the Party Room. Equip a steel full helmet, steel platebody and an iron plateskirt.", "Falador Party Room", OUTSIDE_THE_FALADOR_PARTY_ROOM, new WorldPoint(3045, 3376, 0), DANCE, item(STEEL_FULL_HELM), item(STEEL_PLATEBODY), item(IRON_PLATESKIRT)), - new EmoteClue("Dance in the shack in Lumbridge Swamp. Equip a bronze dagger, iron full helmet and a gold ring.", "Lumbridge swamp", NEAR_A_SHED_IN_LUMBRIDGE_SWAMP, new WorldPoint(3203, 3169, 0), DANCE, item(BRONZE_DAGGER), item(IRON_FULL_HELM), item(GOLD_RING)), - new EmoteClue("Dance in the dark caves beneath Lumbridge Swamp. Blow a kiss before you talk to me. Equip an air staff, Bronze full helm and an amulet of power.", "Lumbridge swamp", LUMBRIDGE_SWAMP_CAVES, new WorldPoint(3168, 9571, 0), DANCE, BLOW_KISS, item(STAFF_OF_AIR), item(BRONZE_FULL_HELM), item(AMULET_OF_POWER)), - new EmoteClue("Dance at the cat-doored pyramid in Sophanem. Beware of double agents! Equip a ring of life, an uncharged amulet of glory and an adamant two-handed sword.", "Pyramid Of Sophanem", OUTSIDE_THE_GREAT_PYRAMID_OF_SOPHANEM, new WorldPoint(3294, 2781, 0), DANCE, item(RING_OF_LIFE), item(AMULET_OF_GLORY), item(ADAMANT_2H_SWORD)), - new EmoteClue("Dance in the centre of Canifis. Bow before you talk to me. Equip a green gnome robe top, mithril plate legs and an iron two-handed sword.", "Canifis", CENTRE_OF_CANIFIS, new WorldPoint(3492, 3488, 0), DANCE, BOW, item(GREEN_ROBE_TOP), item(MITHRIL_PLATELEGS), item(IRON_2H_SWORD)), - new EmoteClue("Dance in the King Black Dragon's lair. Beware of double agents! Equip a black dragonhide body, black dragonhide vambs and a black dragon mask.", "King black dragon's lair", KING_BLACK_DRAGONS_LAIR, new WorldPoint(2271, 4680, 0), DANCE, item(BLACK_DHIDE_BODY), item(BLACK_DHIDE_VAMB), item(BLACK_DRAGON_MASK)), - new EmoteClue("Dance at the entrance to the Grand Exchange. Equip a pink skirt, pink robe top and a body tiara.", "Grand Exchange", SOUTH_OF_THE_GRAND_EXCHANGE, new WorldPoint(3165, 3467, 0), DANCE, item(PINK_SKIRT), item(PINK_ROBE_TOP), item(BODY_TIARA)), - new EmoteClue("Goblin Salute in the Goblin Village. Beware of double agents! Equip a bandos godsword, a bandos cloak and a bandos platebody.", "Goblin Village", OUTSIDE_MUDKNUCKLES_HUT, new WorldPoint(2956, 3505, 0), GOBLIN_SALUTE, item(BANDOS_PLATEBODY), item(BANDOS_CLOAK), item(BANDOS_GODSWORD)), - new EmoteClue("Headbang in the mine north of Al Kharid. Equip a desert shirt, leather gloves and leather boots.", "Al Kharid mine", AL_KHARID_SCORPION_MINE, new WorldPoint(3299, 3289, 0), HEADBANG, item(DESERT_SHIRT), item(LEATHER_GLOVES), item(LEATHER_BOOTS)), - new EmoteClue("Headbang at the exam center. Beware of double agents! Equip a mystic fire staff, a diamond bracelet and rune boots.", "Digsite", INSIDE_THE_DIGSITE_EXAM_CENTRE, new WorldPoint(3362, 3340, 0), HEADBANG, item(MYSTIC_FIRE_STAFF), item(DIAMOND_BRACELET), item(RUNE_BOOTS)), - new EmoteClue("Headbang at the top of Slayer Tower. Equip a seercull, a combat bracelet and helm of Neitiznot.", "Slayer Tower", OUTSIDE_THE_SLAYER_TOWER_GARGOYLE_ROOM, new WorldPoint(3421, 3537, 2), HEADBANG, item(SEERCULL), range("Combat bracelet", COMBAT_BRACELET4, COMBAT_BRACELET), item(HELM_OF_NEITIZNOT)), - new EmoteClue("Dance a jig by the entrance to the Fishing Guild. Equip an emerald ring, a sapphire amulet, and a bronze chain body.", "Fishing Guild", OUTSIDE_THE_FISHING_GUILD, new WorldPoint(2610, 3391, 0), JIG, item(EMERALD_RING), item(SAPPHIRE_AMULET), item(BRONZE_CHAINBODY)), - new EmoteClue("Dance a jig under Shantay's Awning. Bow before you talk to me. Equip a pointed blue snail helmet, an air staff and a bronze square shield.", "Shantay Pass", SHANTAY_PASS, new WorldPoint(3304, 3124, 0), JIG, BOW, any("Bruise blue snelm (pointed)", item(BRUISE_BLUE_SNELM_3343)), item(STAFF_OF_AIR), item(BRONZE_SQ_SHIELD)), - new EmoteClue("Do a jig in Varrock's rune store. Equip an air tiara and a staff of water.", "Varrock rune store", AUBURYS_SHOP_IN_VARROCK, new WorldPoint(3253, 3401, 0), JIG, item(AIR_TIARA), item(STAFF_OF_WATER)), - new EmoteClue("Jump for joy at the beehives. Equip a desert shirt, green gnome robe bottoms and a steel axe.", "Catherby", CATHERBY_BEEHIVE_FIELD, new WorldPoint(2759, 3445, 0), JUMP_FOR_JOY, item(DESERT_SHIRT), item(GREEN_ROBE_BOTTOMS), item(STEEL_AXE)), - new EmoteClue("Jump for joy in Yanille bank. Dance a jig before you talk to me. Equip a brown apron, adamantite medium helmet and snakeskin chaps.", "Yanille", OUTSIDE_YANILLE_BANK, new WorldPoint(2610, 3092, 0), JUMP_FOR_JOY, JIG, item(BROWN_APRON), item(ADAMANT_MED_HELM), item(SNAKESKIN_CHAPS)), - new EmoteClue("Jump for joy in the TzHaar sword shop. Shrug before you talk to me. Equip a Steel longsword, Blue D'hide body and blue mystic gloves.", "Tzhaar weapon store", TZHAAR_WEAPONS_STORE, new WorldPoint(2477, 5146, 0), JUMP_FOR_JOY, SHRUG, item(STEEL_LONGSWORD), item(BLUE_DHIDE_BODY), item(MYSTIC_GLOVES)), - new EmoteClue("Jump for joy in the Ancient Cavern. Equip a granite shield, splitbark body and any rune heraldic helm.", "Ancient cavern", ENTRANCE_OF_THE_CAVERN_UNDER_THE_WHIRLPOOL, new WorldPoint(1768, 5366, 1), JUMP_FOR_JOY, item(GRANITE_SHIELD), item(SPLITBARK_BODY), range("Any rune heraldic helm", RUNE_HELM_H1, RUNE_HELM_H5)), - new EmoteClue("Jump for joy at the Neitiznot rune rock. Equip Rune boots, a proselyte hauberk and a dragonstone ring.", "Fremennik Isles", NEAR_A_RUNITE_ROCK_IN_THE_FREMENNIK_ISLES, new WorldPoint(2375, 3850, 0), JUMP_FOR_JOY, item(RUNE_BOOTS), item(PROSELYTE_HAUBERK), item(DRAGONSTONE_RING)), - new EmoteClue("Jump for joy in the centre of Zul-Andra. Beware of double agents! Equip a dragon 2h sword, bandos boots and an obsidian cape.", "Zul-Andra", NEAR_THE_PIER_IN_ZULANDRA, new WorldPoint(2199, 3056, 0), JUMP_FOR_JOY, item(DRAGON_2H_SWORD), item(BANDOS_BOOTS), item(OBSIDIAN_CAPE)), - new EmoteClue("Laugh by the fountain of heroes. Equip splitbark legs, dragon boots and a Rune longsword.", "Fountain of heroes", FOUNTAIN_OF_HEROES, new WorldPoint(2920, 9893, 0), LAUGH, item(SPLITBARK_LEGS), item(DRAGON_BOOTS), item(RUNE_LONGSWORD)), - new EmoteClue("Laugh in Jokul's tent in the Mountain Camp. Beware of double agents! Equip a rune full helmet, blue dragonhide chaps and a fire battlestaff.", "Mountain Camp", MOUNTAIN_CAMP_GOAT_ENCLOSURE, new WorldPoint(2812, 3681, 0), LAUGH, item(RUNE_FULL_HELM), item(BLUE_DHIDE_CHAPS), item(FIRE_BATTLESTAFF)), - new EmoteClue("Laugh at the crossroads south of the Sinclair Mansion. Equip a cowl, a blue wizard robe top and an iron scimitar.", "Sinclair Mansion", ROAD_JUNCTION_SOUTH_OF_SINCLAIR_MANSION, new WorldPoint(2741, 3536, 0), LAUGH, item(LEATHER_COWL), item(BLUE_WIZARD_ROBE), item(IRON_SCIMITAR)), - new EmoteClue("Laugh in front of the gem store in Ardougne market. Equip a Castlewars bracelet, a dragonstone amulet and a ring of forging.", "Ardougne", NEAR_THE_GEM_STALL_IN_ARDOUGNE_MARKET, new WorldPoint(2666, 3304, 0), LAUGH, any("Castle wars bracelet", range(CASTLE_WARS_BRACELET3, CASTLE_WARS_BRACELET1)), item(DRAGONSTONE_AMULET), item(RING_OF_FORGING)), - new EmoteClue("Panic in the Limestone Mine. Equip bronze platelegs, a steel pickaxe and a steel medium helmet.", "Limestone Mine", LIMESTONE_MINE, new WorldPoint(3372, 3498, 0), PANIC, item(BRONZE_PLATELEGS), item(STEEL_PICKAXE), item(STEEL_MED_HELM)), - new EmoteClue("Panic by the mausoleum in Morytania. Wave before you speak to me. Equip a mithril plate skirt, a maple longbow and no boots.", "Morytania mausoleum, access via the experiments cave", MAUSOLEUM_OFF_THE_MORYTANIA_COAST, new WorldPoint(3504, 3576, 0), PANIC, WAVE, item(MITHRIL_PLATESKIRT), item(MAPLE_LONGBOW), emptySlot("No boots", BOOTS)), - new EmoteClue("Panic on the Wilderness volcano bridge. Beware of double agents! Equip any headband and crozier.", "Wilderness volcano", VOLCANO_IN_THE_NORTHEASTERN_WILDERNESS, new WorldPoint(3368, 3935, 0), PANIC, any("Any headband", range(RED_HEADBAND, BROWN_HEADBAND), range(WHITE_HEADBAND, GREEN_HEADBAND)), any("Any crozier", item(ANCIENT_CROZIER), item(ARMADYL_CROZIER), item(BANDOS_CROZIER), range(SARADOMIN_CROZIER, ZAMORAK_CROZIER))), - new EmoteClue("Panic by the pilot on White Wolf Mountain. Beware of double agents! Equip mithril platelegs, a ring of life and a rune axe.", "White Wolf Mountain", GNOME_GLIDER_ON_WHITE_WOLF_MOUNTAIN, new WorldPoint(2847, 3499, 0), PANIC, item(MITHRIL_PLATELEGS), item(RING_OF_LIFE), item(RUNE_AXE)), - new EmoteClue("Panic by the big egg where no one dare goes and the ground is burnt. Beware of double agents! Equip a dragon med helm, a TokTz-Ket-Xil, a brine sabre, rune platebody and an uncharged amulet of glory.", "Lava dragon isle", SOUTHEAST_CORNER_OF_LAVA_DRAGON_ISLE, new WorldPoint(3227, 3831, 0), PANIC, item(DRAGON_MED_HELM), item(TOKTZKETXIL), item(BRINE_SABRE), item(RUNE_PLATEBODY), item(AMULET_OF_GLORY)), - new EmoteClue("Panic at the area flowers meet snow. Equip Blue D'hide vambs, a dragon spear and a rune plateskirt.", "Trollweiss mountain", HALFWAY_DOWN_TROLLWEISS_MOUNTAIN, new WorldPoint(2776, 3781, 0), PANIC, item(BLUE_DHIDE_VAMB), item(DRAGON_SPEAR), item(RUNE_PLATESKIRT), item(SLED_4084)), - new EmoteClue("Do a push up at the bank of the Warrior's guild. Beware of double agents! Equip a dragon battleaxe, a dragon defender and a slayer helm of any kind.", "Warriors' guild", WARRIORS_GUILD_BANK_29047, new WorldPoint(2843, 3543, 0), PUSH_UP, item(DRAGON_BATTLEAXE), item(DRAGON_DEFENDER), any("Any slayer helmet", item(SLAYER_HELMET), item(BLACK_SLAYER_HELMET), item(GREEN_SLAYER_HELMET), item(PURPLE_SLAYER_HELMET), item(RED_SLAYER_HELMET), item(TURQUOISE_SLAYER_HELMET), item(SLAYER_HELMET_I), item(BLACK_SLAYER_HELMET_I), item(GREEN_SLAYER_HELMET_I), item(PURPLE_SLAYER_HELMET_I), item(RED_SLAYER_HELMET_I), item(TURQUOISE_SLAYER_HELMET_I), item(HYDRA_SLAYER_HELMET), item(HYDRA_SLAYER_HELMET_I))), - new EmoteClue("Blow a raspberry in the bank of the Warriors' Guild. Beware of double agents! Equip a dragon battleaxe, a slayer helm of any kind and a dragon defender or avernic defender.", "Warriors' guild", WARRIORS_GUILD_BANK_29047, new WorldPoint(2843, 3543, 0), RASPBERRY, item(DRAGON_BATTLEAXE), any("Dragon defender or Avernic defender", item(DRAGON_DEFENDER), item(AVERNIC_DEFENDER)), any("Any slayer helmet", item(SLAYER_HELMET), item(BLACK_SLAYER_HELMET), item(GREEN_SLAYER_HELMET), item(PURPLE_SLAYER_HELMET), item(RED_SLAYER_HELMET), item(TURQUOISE_SLAYER_HELMET), item(SLAYER_HELMET_I), item(BLACK_SLAYER_HELMET_I), item(GREEN_SLAYER_HELMET_I), item(PURPLE_SLAYER_HELMET_I), item(RED_SLAYER_HELMET_I), item(TURQUOISE_SLAYER_HELMET_I), item(HYDRA_SLAYER_HELMET), item(HYDRA_SLAYER_HELMET_I))), - new EmoteClue("Blow a raspberry at the monkey cage in Ardougne Zoo. Equip a studded leather body, bronze platelegs and a normal staff with no orb.", "Ardougne Zoo", NEAR_THE_PARROTS_IN_ARDOUGNE_ZOO, new WorldPoint(2607, 3282, 0), RASPBERRY, item(STUDDED_BODY), item(BRONZE_PLATELEGS), item(STAFF)), - new EmoteClue("Blow raspberries outside the entrance to Keep Le Faye. Equip a coif, an iron platebody and leather gloves.", "Keep Le Faye", OUTSIDE_KEEP_LE_FAYE, new WorldPoint(2757, 3401, 0), RASPBERRY, item(COIF), item(IRON_PLATEBODY), item(LEATHER_GLOVES)), - new EmoteClue("Blow a raspberry in the Fishing Guild bank. Beware of double agents! Equip an elemental shield, blue dragonhide chaps and a rune warhammer.", "Fishing Guild", FISHING_GUILD_BANK, new WorldPoint(2588, 3419, 0), RASPBERRY, item(ELEMENTAL_SHIELD), item(BLUE_DHIDE_CHAPS), item(RUNE_WARHAMMER)), - new EmoteClue("Salute in the banana plantation. Beware of double agents! Equip a diamond ring, amulet of power, and nothing on your chest and legs.", "Karamja", WEST_SIDE_OF_THE_KARAMJA_BANANA_PLANTATION, new WorldPoint(2914, 3168, 0), SALUTE, item(DIAMOND_RING), item(AMULET_OF_POWER), emptySlot("Nothing on chest & legs", BODY, LEGS)), - new EmoteClue("Salute in the Warriors' guild bank. Equip only a black salamander.", "Warriors' guild", WARRIORS_GUILD_BANK, new WorldPoint(2844, 3542, 0), SALUTE, item(BLACK_SALAMANDER), emptySlot("Nothing else", HEAD, CAPE, AMULET, BODY, SHIELD, LEGS, GLOVES, BOOTS, RING, AMMO)), - new EmoteClue("Salute in the centre of the mess hall. Beware of double agents! Equip a rune halberd rune platebody, and an amulet of strength.", "Hosidius mess hall", HOSIDIUS_MESS, new WorldPoint(1646, 3631, 0), SALUTE, item(RUNE_HALBERD), item(RUNE_PLATEBODY), item(AMULET_OF_STRENGTH)), - new EmoteClue("Shrug in the mine near Rimmington. Equip a gold necklace, a gold ring and a bronze spear.", "Rimmington mine", RIMMINGTON_MINE, new WorldPoint(2976, 3238, 0), SHRUG, item(GOLD_NECKLACE), item(GOLD_RING), item(BRONZE_SPEAR)), - new EmoteClue("Shrug in Catherby bank. Yawn before you talk to me. Equip a maple longbow, green d'hide chaps and an iron med helm.", "Catherby", OUTSIDE_CATHERBY_BANK, new WorldPoint(2808, 3440, 0), SHRUG, YAWN, item(MAPLE_LONGBOW), item(GREEN_DHIDE_CHAPS), item(IRON_MED_HELM)), - new EmoteClue("Shrug in the Zamorak temple found in the Eastern Wilderness. Beware of double agents! Equip rune platelegs, an iron platebody and blue dragonhide vambraces.", "Chaos temple", CHAOS_TEMPLE_IN_THE_SOUTHEASTERN_WILDERNESS, new WorldPoint(3239, 3611, 0), SHRUG, item(RUNE_PLATELEGS), item(IRON_PLATEBODY), item(BLUE_DHIDE_VAMB)), - new EmoteClue("Shrug in the Shayzien command tent. Equip a blue mystic robe bottom, a rune kiteshield and any bob shirt.", "Shayzien command tent", SHAYZIEN_WAR_TENT, new WorldPoint(1555, 3537, 0), SHRUG, item(MYSTIC_ROBE_BOTTOM), item(RUNE_KITESHIELD), range("Any bob shirt", BOBS_RED_SHIRT, BOBS_PURPLE_SHIRT)), - new EmoteClue("Slap your head in the centre of the Kourend catacombs. Beware of double agents! Equip the arclight and the amulet of the damned.", "Kourend catacombs", CENTRE_OF_THE_CATACOMBS_OF_KOUREND, new WorldPoint(1663, 10045, 0), SLAP_HEAD, item(ARCLIGHT), any("Amulet of the damned", item(AMULET_OF_THE_DAMNED), item(AMULET_OF_THE_DAMNED_FULL))), - new EmoteClue("Spin at the crossroads north of Rimmington. Equip a green gnome hat, cream gnome top and leather chaps.", "Rimmington", ROAD_JUNCTION_NORTH_OF_RIMMINGTON, new WorldPoint(2981, 3276, 0), SPIN, item(GREEN_HAT), item(CREAM_ROBE_TOP), item(LEATHER_CHAPS)), - new EmoteClue("Spin in Draynor Manor by the fountain. Equip an iron platebody, studded leather chaps and a bronze full helmet.", "Draynor Manor", DRAYNOR_MANOR_BY_THE_FOUNTAIN, new WorldPoint(3088, 3336, 0), SPIN, item(IRON_PLATEBODY), item(STUDDED_CHAPS), item(BRONZE_FULL_HELM)), - new EmoteClue("Spin in front of the Soul altar. Beware of double agents! Equip a dragon pickaxe, helm of neitiznot and a pair of rune boots.", "Soul altar", SOUL_ALTAR, new WorldPoint(1815, 3856, 0), SPIN, any("Dragon or Crystal pickaxe", item(DRAGON_PICKAXE), item(DRAGON_PICKAXE_12797), item(INFERNAL_PICKAXE), item(INFERNAL_PICKAXE_UNCHARGED), item(DRAGON_PICKAXEOR), item(CRYSTAL_PICKAXE), item(CRYSTAL_PICKAXE_INACTIVE)), item(HELM_OF_NEITIZNOT), item(RUNE_BOOTS)), - new EmoteClue("Spin in the Varrock Castle courtyard. Equip a black axe, a coif and a ruby ring.", "Varrock Castle", OUTSIDE_VARROCK_PALACE_COURTYARD, new WorldPoint(3213, 3463, 0), SPIN, item(BLACK_AXE), item(COIF), item(RUBY_RING)), - new EmoteClue("Spin in West Ardougne Church. Equip a dragon spear and red dragonhide chaps.", "Ardougne", CHAPEL_IN_WEST_ARDOUGNE, new WorldPoint(2530, 3290, 0), SPIN, item(DRAGON_SPEAR), item(RED_DHIDE_CHAPS)), - new EmoteClue("Spin on the bridge by the Barbarian Village. Salute before you talk to me. Equip purple gloves, a steel kiteshield and a mithril full helmet.", "Barbarian Village", EAST_OF_THE_BARBARIAN_VILLAGE_BRIDGE, new WorldPoint(3105, 3420, 0), SPIN, SALUTE, item(PURPLE_GLOVES), item(STEEL_KITESHIELD), item(MITHRIL_FULL_HELM)), - new EmoteClue("Stamp in the Enchanted valley west of the waterfall. Beware of double agents! Equip a dragon axe.", "Enchanted Valley", NORTHWESTERN_CORNER_OF_THE_ENCHANTED_VALLEY, new WorldPoint(3030, 4522, 0), STAMP, item(DRAGON_AXE)), - new EmoteClue("Think in middle of the wheat field by the Lumbridge mill. Equip a blue gnome robetop, a turquoise gnome robe bottom and an oak shortbow.", "Lumbridge mill", WHEAT_FIELD_NEAR_THE_LUMBRIDGE_WINDMILL, new WorldPoint(3159, 3298, 0), THINK, item(BLUE_ROBE_TOP), item(TURQUOISE_ROBE_BOTTOMS), item(OAK_SHORTBOW)), - new EmoteClue("Think in the centre of the Observatory. Spin before you talk to me. Equip a mithril chain body, green dragonhide chaps and a ruby amulet.", "Observatory", OBSERVATORY, new WorldPoint(2439, 3161, 0), THINK, SPIN, item(MITHRIL_CHAINBODY), item(GREEN_DHIDE_CHAPS), item(RUBY_AMULET)), - new EmoteClue("Wave along the south fence of the Lumber Yard. Equip a hard leather body, leather chaps and a bronze axe.", "Lumber Yard", NEAR_THE_SAWMILL_OPERATORS_BOOTH, new WorldPoint(3307, 3491, 0), WAVE, item(HARDLEATHER_BODY), item(LEATHER_CHAPS), item(BRONZE_AXE)), - new EmoteClue("Wave in the Falador gem store. Equip a Mithril pickaxe, Black platebody and an Iron Kiteshield.", "Falador", NEAR_HERQUINS_SHOP_IN_FALADOR, new WorldPoint(2945, 3335, 0), WAVE, item(MITHRIL_PICKAXE), item(BLACK_PLATEBODY), item(IRON_KITESHIELD)), - new EmoteClue("Wave on Mudskipper Point. Equip a black cape, leather chaps and a steel mace.", "Mudskipper Point", MUDSKIPPER_POINT, new WorldPoint(2989, 3110, 0), WAVE, item(BLACK_CAPE), item(LEATHER_CHAPS), item(STEEL_MACE)), - new EmoteClue("Wave on the northern wall of Castle Drakan. Beware of double agents! Wear a dragon sq shield, splitbark body and any boater.", "Castle Drakan", NORTHERN_WALL_OF_CASTLE_DRAKAN, new WorldPoint(3560, 3385, 0), WAVE, item(DRAGON_SQ_SHIELD), item(SPLITBARK_BODY), any("Any boater", item(RED_BOATER), item(ORANGE_BOATER), item(GREEN_BOATER), item(BLUE_BOATER), item(BLACK_BOATER), item(PINK_BOATER), item(PURPLE_BOATER), item(WHITE_BOATER))), - new EmoteClue("Yawn in the 7th room of Pyramid Plunder. Beware of double agents! Equip a pharaoh sceptre and a full set of menaphite robes.", "Pyramid Plunder", _7TH_CHAMBER_OF_JALSAVRAH, new WorldPoint(1944, 4427, 0), YAWN, any("Pharaoh's sceptre", item(PHARAOHS_SCEPTRE), item(PHARAOHS_SCEPTRE_1), item(PHARAOHS_SCEPTRE_2), item(PHARAOHS_SCEPTRE_3), item(PHARAOHS_SCEPTRE_4), item(PHARAOHS_SCEPTRE_5), item(PHARAOHS_SCEPTRE_6), item(PHARAOHS_SCEPTRE_7), item(PHARAOHS_SCEPTRE_8)), any("Full set of menaphite robes", all(item(MENAPHITE_PURPLE_HAT), item(MENAPHITE_PURPLE_TOP), range(MENAPHITE_PURPLE_ROBE, MENAPHITE_PURPLE_KILT)), all(item(MENAPHITE_RED_HAT), item(MENAPHITE_RED_TOP), range(MENAPHITE_RED_ROBE, MENAPHITE_RED_KILT)))), - new EmoteClue("Yawn in the Varrock library. Equip a green gnome robe top, HAM robe bottom and an iron warhammer.", "Varrock Castle", VARROCK_PALACE_LIBRARY, new WorldPoint(3209, 3492, 0), YAWN, item(GREEN_ROBE_TOP), item(HAM_ROBE), item(IRON_WARHAMMER)), - new EmoteClue("Yawn in Draynor Marketplace. Equip studded leather chaps, an iron kiteshield and a steel longsword.", "Draynor", DRAYNOR_VILLAGE_MARKET, new WorldPoint(3083, 3253, 0), YAWN, item(STUDDED_CHAPS), item(IRON_KITESHIELD), item(STEEL_LONGSWORD)), - new EmoteClue("Yawn in the Castle Wars lobby. Shrug before you talk to me. Equip a ruby amulet, a mithril scimitar and a Wilderness cape.", "Castle Wars", CASTLE_WARS_BANK, new WorldPoint(2440, 3092, 0), YAWN, SHRUG, item(RUBY_AMULET), item(MITHRIL_SCIMITAR), range("Any team cape", TEAM1_CAPE, TEAM50_CAPE)), - new EmoteClue("Yawn in the rogues' general store. Beware of double agents! Equip an adamant square shield, blue dragon vambraces and a rune pickaxe.", "Rogues general store", NOTERAZZOS_SHOP_IN_THE_WILDERNESS, new WorldPoint(3026, 3701, 0), YAWN, item(ADAMANT_SQ_SHIELD), item(BLUE_DHIDE_VAMB), item(RUNE_PICKAXE)), - new EmoteClue("Yawn at the top of Trollheim. Equip a lava battlestaff, black dragonhide vambraces and a mind shield.", "Trollheim Mountain", ON_TOP_OF_TROLLHEIM_MOUNTAIN, new WorldPoint(2887, 3676, 0), YAWN, any("Lava battlestaff", item(LAVA_BATTLESTAFF), item(LAVA_BATTLESTAFF_21198)), item(BLACK_DHIDE_VAMB), item(MIND_SHIELD)), - new EmoteClue("Yawn in the centre of Arceuus library. Nod your head before you talk to me. Equip blue dragonhide vambraces, adamant boots and an adamant dagger.", "Arceuus library", ENTRANCE_OF_THE_ARCEUUS_LIBRARY, new WorldPoint(1632, 3807, 0), YAWN, YES, item(BLUE_DHIDE_VAMB), item(ADAMANT_BOOTS), item(ADAMANT_DAGGER)), - new EmoteClue("Swing a bullroarer at the top of the watchtower. Beware of double agents! Equip a dragon plateskirt, climbing boots and a dragon chainbody.", "Yanille watchtower", TOP_FLOOR_OF_THE_YANILLE_WATCHTOWER, new WorldPoint(2932, 4712, 0), BULL_ROARER, item(DRAGON_PLATESKIRT), item(CLIMBING_BOOTS), item(DRAGON_CHAINBODY_3140), item(ItemID.BULL_ROARER)), - new EmoteClue("Blow a raspberry at Gypsy Aris in her tent. Equip a gold ring and a gold necklace.", "Varrock", GYPSY_TENT_ENTRANCE, new WorldPoint(3203, 3424, 0), RASPBERRY, item(GOLD_RING), item(GOLD_NECKLACE)), - new EmoteClue("Bow to Brugsen Bursen at the Grand Exchange.", "Grand Exchange", null, new WorldPoint(3164, 3477, 0), BOW), - new EmoteClue("Cheer at Iffie Nitter. Equip a chef hat and a red cape.", "Varrock", FINE_CLOTHES_ENTRANCE, new WorldPoint(3205, 3416, 0), CHEER, item(CHEFS_HAT), item(RED_CAPE)), - new EmoteClue("Clap at Bob's Brilliant Axes. Equip a bronze axe and leather boots.", "Lumbridge", BOB_AXES_ENTRANCE, new WorldPoint(3231, 3203, 0), CLAP, item(BRONZE_AXE), item(LEATHER_BOOTS)), - new EmoteClue("Panic at Al Kharid mine.", "Al Kharid mine", null, new WorldPoint(3300, 3314, 0), PANIC), - new EmoteClue("Spin at Flynn's Mace Shop.", "Falador", null, new WorldPoint(2950, 3387, 0), SPIN)); - - private static final String UNICODE_CHECK_MARK = "\u2713"; - private static final String UNICODE_BALLOT_X = "\u2717"; - - private final String text; - private final String locationName; - @Nullable - private final STASHUnit stashUnit; - private final WorldPoint location; - private final Emote firstEmote; - private final Emote secondEmote; - private final ItemRequirement[] itemRequirements; - - private EmoteClue(String text, String locationName, STASHUnit stashUnit, WorldPoint location, Emote firstEmote, @Nonnull ItemRequirement... itemRequirements) - { - this(text, locationName, stashUnit, location, firstEmote, null, itemRequirements); - } - - private EmoteClue(String text, String locationName, @Nullable STASHUnit stashUnit, WorldPoint location, Emote firstEmote, Emote secondEmote, @Nonnull ItemRequirement... itemRequirements) - { - this.text = text; - this.locationName = locationName; - this.stashUnit = stashUnit; - this.location = location; - this.firstEmote = firstEmote; - this.secondEmote = secondEmote; - this.itemRequirements = itemRequirements; - } - - @Override - public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin) - { - panelComponent.getChildren().add(TitleComponent.builder().text("Emote Clue").build()); - panelComponent.getChildren().add(LineComponent.builder().left("Emotes:").build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(getFirstEmote().getName()) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - - if (getSecondEmote() != null) - { - panelComponent.getChildren().add(LineComponent.builder() - .left(getSecondEmote().getName()) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - } - - panelComponent.getChildren().add(LineComponent.builder().left("Location:").build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(getLocationName()) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - - if (itemRequirements.length > 0) - { - Client client = plugin.getClient(); - - if (stashUnit != null) - { - client.runScript(ScriptID.WATSON_STASH_UNIT_CHECK, stashUnit.getObjectId(), 0, 0, 0); - int[] intStack = client.getIntStack(); - boolean stashUnitBuilt = intStack[0] == 1; - - panelComponent.getChildren().add(LineComponent.builder() - .left("STASH Unit:") - .right(stashUnitBuilt ? UNICODE_CHECK_MARK : UNICODE_BALLOT_X) - .rightColor(stashUnitBuilt ? Color.GREEN : Color.RED) - .build()); - } - - panelComponent.getChildren().add(LineComponent.builder().left("Equip:").build()); - - Item[] equipment = plugin.getEquippedItems(); - Item[] inventory = plugin.getInventoryItems(); - - // If equipment is null, the player is wearing nothing - if (equipment == null) - { - equipment = new Item[0]; - } - - // If inventory is null, the player has nothing in their inventory - if (inventory == null) - { - inventory = new Item[0]; - } - - Item[] combined = new Item[equipment.length + inventory.length]; - System.arraycopy(equipment, 0, combined, 0, equipment.length); - System.arraycopy(inventory, 0, combined, equipment.length, inventory.length); - - for (ItemRequirement requirement : itemRequirements) - { - boolean equipmentFulfilled = requirement.fulfilledBy(equipment); - boolean combinedFulfilled = requirement.fulfilledBy(combined); - - panelComponent.getChildren().add(LineComponent.builder() - .left(requirement.getCollectiveName(client)) - .leftColor(TITLED_CONTENT_COLOR) - .right(combinedFulfilled ? UNICODE_CHECK_MARK : UNICODE_BALLOT_X) - .rightColor(equipmentFulfilled ? Color.GREEN : (combinedFulfilled ? Color.ORANGE : Color.RED)) - .build()); - } - } - } - - @Override - public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) - { - LocalPoint localPoint = LocalPoint.fromWorld(plugin.getClient(), getLocation()); - - if (localPoint != null) - { - OverlayUtil.renderTileOverlay(plugin.getClient(), graphics, localPoint, plugin.getEmoteImage(), Color.ORANGE); - } - - if (stashUnit != null) - { - final WorldPoint[] worldPoints = stashUnit.getWorldPoints(); - - for (final WorldPoint worldPoint : worldPoints) - { - final LocalPoint stashUnitLocalPoint = LocalPoint.fromWorld(plugin.getClient(), worldPoint); - - if (stashUnitLocalPoint != null) - { - final Polygon poly = Perspective.getCanvasTilePoly(plugin.getClient(), stashUnitLocalPoint); - if (poly != null) - { - OverlayUtil.renderPolygon(graphics, poly, Color.RED); - } - } - } - } - } - - public static EmoteClue forText(String text) - { - for (EmoteClue clue : CLUES) - { - if (clue.getText().equalsIgnoreCase(text)) - { - return clue; - } - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/FairyRingClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/FairyRingClue.java deleted file mode 100644 index fb4662cc22..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/FairyRingClue.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls.clues; - -import com.google.common.collect.ImmutableSet; -import java.awt.Color; -import java.awt.Graphics2D; -import java.util.Set; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import static net.runelite.client.plugins.cluescrolls.ClueScrollOverlay.TITLED_CONTENT_COLOR; -import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -@Getter(AccessLevel.PUBLIC) -public class FairyRingClue extends ClueScroll implements TextClueScroll, LocationClueScroll -{ - private static final Set CLUES = ImmutableSet.of( - new FairyRingClue("A I R 2 3 3 1", new WorldPoint(2702, 3246, 0)), - new FairyRingClue("A I Q 0 4 4 0", new WorldPoint(3000, 3110, 0)), - new FairyRingClue("A L P 1 1 4 0", new WorldPoint(2504, 3633, 0)), - new FairyRingClue("B L P 6 2 0 0", new WorldPoint(2439, 5132, 0)), - new FairyRingClue("B J R 1 1 2 3", new WorldPoint(2648, 4729, 0)), - new FairyRingClue("B I P 7 0 1 3", new WorldPoint(3407, 3330, 0)), - new FairyRingClue("C I S 0 0 0 9", new WorldPoint(1630, 3868, 0)), - new FairyRingClue("C K P 0 2 2 4", new WorldPoint(2073, 4846, 0)), - new FairyRingClue("D I P 8 5 1 1", new WorldPoint(3041, 4770, 0)), - new FairyRingClue("D K S 2 3 1 0", new WorldPoint(2747, 3720, 0)) - ); - - private String text; - private WorldPoint location; - - private FairyRingClue(String text, WorldPoint location) - { - this.text = text; - this.location = location; - setRequiresSpade(true); - } - - @Override - public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin) - { - panelComponent.getChildren().add(TitleComponent.builder().text("Fairy Ring Clue").build()); - panelComponent.getChildren().add(LineComponent.builder().left("Code:").build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(getText().substring(0, 5)) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - - panelComponent.getChildren().add(LineComponent.builder() - .left("Travel to the fairy ring to see where to dig.") - .build()); - } - - @Override - public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) - { - LocalPoint localLocation = LocalPoint.fromWorld(plugin.getClient(), getLocation()); - - if (localLocation == null) - { - return; - } - - OverlayUtil.renderTileOverlay(plugin.getClient(), graphics, localLocation, plugin.getSpadeImage(), Color.ORANGE); - } - - public static FairyRingClue forText(String text) - { - for (FairyRingClue clue : CLUES) - { - if (clue.text.equalsIgnoreCase(text)) - { - return clue; - } - } - - return null; - } -} 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 deleted file mode 100644 index bbb1a4bf8a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/FaloTheBardClue.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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.plugins.cluescrolls.clues; - -import com.google.common.collect.ImmutableList; -import java.awt.Color; -import java.awt.Graphics2D; -import java.util.List; -import javax.annotation.Nonnull; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Item; -import static net.runelite.api.ItemID.*; -import net.runelite.api.NPC; -import net.runelite.api.coords.WorldPoint; -import static net.runelite.client.plugins.cluescrolls.ClueScrollOverlay.TITLED_CONTENT_COLOR; -import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin; -import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.IMAGE_Z_OFFSET; -import net.runelite.client.plugins.cluescrolls.clues.item.AnyRequirementCollection; -import net.runelite.client.plugins.cluescrolls.clues.item.ItemRequirement; -import net.runelite.client.plugins.cluescrolls.clues.item.RangeItemRequirement; -import net.runelite.client.plugins.cluescrolls.clues.item.SingleItemRequirement; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -@Getter(AccessLevel.PUBLIC) -public class FaloTheBardClue extends ClueScroll implements TextClueScroll, NpcClueScroll -{ - private static final List CLUES = ImmutableList.of( - new FaloTheBardClue("A blood red weapon, a strong curved sword, found on the island of primate lords.", item(DRAGON_SCIMITAR)), - new FaloTheBardClue("A book that preaches of some great figure, lending strength, might and vigour.", any("Any god book (must be complete)", item(HOLY_BOOK), item(BOOK_OF_BALANCE), item(UNHOLY_BOOK), item(BOOK_OF_LAW), item(BOOK_OF_WAR), item(BOOK_OF_DARKNESS))), - new FaloTheBardClue("A bow of elven craft was made, it shimmers bright, but will soon fade.", any("Crystal Bow", item(CRYSTAL_BOW), item(CRYSTAL_BOW_24123))), - new FaloTheBardClue("A fiery axe of great inferno, when you use it, you'll wonder where the logs go.", item(INFERNAL_AXE)), - new FaloTheBardClue("A mark used to increase one's grace, found atop a seer's place.", item(MARK_OF_GRACE)), - new FaloTheBardClue("A molten beast with fiery breath, you acquire these with its death.", item(LAVA_DRAGON_BONES)), - 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 hopes of a blade or just for an xp feast.", item(WARRIOR_GUILD_TOKEN)), - new FaloTheBardClue("Green is my favourite, 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("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)), - new FaloTheBardClue("They come from some time ago, from a land unto the east. Fossilised they have become, this small and gentle beast.", item(NUMULITE)), - new FaloTheBardClue("To slay a dragon you must first do, before this chest piece can be put on you.", item(RUNE_PLATEBODY)), - new FaloTheBardClue("Vampyres are agile opponents, damaged best with a weapon of many components.", any("Rod of Ivandis or Ivandis flail", range(ROD_OF_IVANDIS_10, ROD_OF_IVANDIS_1), item(IVANDIS_FLAIL))) - ); - - private static final WorldPoint LOCATION = new WorldPoint(2689, 3550, 0); - private static final String FALO_THE_BARD = "Falo the Bard"; - - private static SingleItemRequirement item(int itemId) - { - return new SingleItemRequirement(itemId); - } - - private static AnyRequirementCollection any(String name, ItemRequirement... requirements) - { - return new AnyRequirementCollection(name, requirements); - } - - private static RangeItemRequirement range(int startItemId, int endItemId) - { - return range(null, startItemId, endItemId); - } - - private static RangeItemRequirement range(String name, int startItemId, int endItemId) - { - return new RangeItemRequirement(name, startItemId, endItemId); - } - - private final String text; - @Nonnull - private final ItemRequirement[] itemRequirements; - - private FaloTheBardClue(String text, @Nonnull ItemRequirement... itemRequirements) - { - this.text = text; - this.itemRequirements = itemRequirements; - } - - @Override - public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin) - { - panelComponent.getChildren().add(TitleComponent.builder().text("Falo the Bard Clue").build()); - - panelComponent.getChildren().add(LineComponent.builder().left("NPC:").build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(FALO_THE_BARD) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - - panelComponent.getChildren().add(LineComponent.builder().left("Item:").build()); - - Item[] inventory = plugin.getInventoryItems(); - - // If inventory is null, the player has nothing in their inventory - if (inventory == null) - { - inventory = new Item[0]; - } - - for (ItemRequirement requirement : itemRequirements) - { - boolean inventoryFulfilled = requirement.fulfilledBy(inventory); - - panelComponent.getChildren().add(LineComponent.builder() - .left(requirement.getCollectiveName(plugin.getClient())) - .leftColor(TITLED_CONTENT_COLOR) - .right(inventoryFulfilled ? "\u2713" : "\u2717") - .rightColor(inventoryFulfilled ? Color.GREEN : Color.RED) - .build()); - } - } - - @Override - public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) - { - if (!LOCATION.isInScene(plugin.getClient())) - { - return; - } - - for (NPC npc : plugin.getNpcsToMark()) - { - OverlayUtil.renderActorOverlayImage(graphics, npc, plugin.getClueScrollImage(), Color.ORANGE, IMAGE_Z_OFFSET); - } - } - - @Override - public String[] getNpcs() - { - return new String[]{FALO_THE_BARD}; - } - - public static FaloTheBardClue forText(String text) - { - for (FaloTheBardClue clue : CLUES) - { - if (clue.text.equalsIgnoreCase(text)) - { - return clue; - } - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/HotColdClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/HotColdClue.java deleted file mode 100644 index 6c1b1f248c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/HotColdClue.java +++ /dev/null @@ -1,372 +0,0 @@ -/* - * Copyright (c) 2018, Eadgars Ruse - * Copyright (c) 2019, 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.cluescrolls.clues; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.Arrays; -import java.util.Collection; -import java.util.EnumMap; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; -import javax.annotation.Nullable; -import lombok.AccessLevel; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.NPC; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import static net.runelite.client.plugins.cluescrolls.ClueScrollOverlay.TITLED_CONTENT_COLOR; -import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin; -import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.IMAGE_Z_OFFSET; -import net.runelite.client.plugins.cluescrolls.clues.hotcold.HotColdArea; -import net.runelite.client.plugins.cluescrolls.clues.hotcold.HotColdLocation; -import net.runelite.client.plugins.cluescrolls.clues.hotcold.HotColdSolver; -import net.runelite.client.plugins.cluescrolls.clues.hotcold.HotColdTemperature; -import net.runelite.client.plugins.cluescrolls.clues.hotcold.HotColdTemperatureChange; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -@EqualsAndHashCode(callSuper = false, exclude = {"hotColdSolver", "location"}) -@Getter(AccessLevel.PUBLIC) -@Slf4j -public class HotColdClue extends ClueScroll implements LocationClueScroll, LocationsClueScroll, TextClueScroll, NpcClueScroll -{ - private static final int HOT_COLD_PANEL_WIDTH = 200; - private static final HotColdClue BEGINNER_CLUE = new HotColdClue("Buried beneath the ground, who knows where it's found. Lucky for you, A man called Reldo may have a clue.", - "Reldo", - "Speak to Reldo to receive a strange device.", - new WorldPoint(3211, 3494, 0)); - private static final HotColdClue MASTER_CLUE = new HotColdClue("Buried beneath the ground, who knows where it's found. Lucky for you, A man called Jorral may have a clue.", - "Jorral", - "Speak to Jorral to receive a strange device.", - new WorldPoint(2436, 3347, 0)); - private static final HotColdClue MASTER_CLUE_LEAGUE = new HotColdClue("Buried beneath the ground, who knows where it's found. Lucky for you, A man called Watson may have a clue.", - "Watson", - "Speak to Watson to receive a strange device.", - new WorldPoint(1645, 3572, 0)); - - private final String text; - private final String npc; - private final String solution; - private final WorldPoint npcLocation; - @Nullable - private HotColdSolver hotColdSolver; - private WorldPoint location; - - public static HotColdClue forText(String text) - { - if (BEGINNER_CLUE.text.equalsIgnoreCase(text)) - { - BEGINNER_CLUE.reset(); - return BEGINNER_CLUE; - } - else if (MASTER_CLUE.text.equalsIgnoreCase(text)) - { - MASTER_CLUE.reset(); - return MASTER_CLUE; - } - else if (MASTER_CLUE_LEAGUE.text.equalsIgnoreCase(text)) - { - MASTER_CLUE_LEAGUE.reset(); - return MASTER_CLUE_LEAGUE; - } - - return null; - } - - private HotColdClue(String text, String npc, String solution, WorldPoint npcLocation) - { - this.text = text; - this.npc = npc; - this.solution = solution; - this.npcLocation = npcLocation; - setRequiresSpade(true); - initializeSolver(); - } - - @Override - public WorldPoint[] getLocations() - { - if (hotColdSolver == null) - { - return new WorldPoint[0]; - } - - if (hotColdSolver.getLastWorldPoint() == null) - { - return new WorldPoint[]{npcLocation}; - } - else - { - return hotColdSolver.getPossibleLocations().stream().map(HotColdLocation::getWorldPoint).toArray(WorldPoint[]::new); - } - } - - @Override - public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin) - { - if (hotColdSolver == null) - { - return; - } - - panelComponent.getChildren().add(TitleComponent.builder() - .text("Hot/Cold Clue") - .build()); - panelComponent.setPreferredSize(new Dimension(HOT_COLD_PANEL_WIDTH, 0)); - - // strange device has not been tested yet, show how to get it - if (hotColdSolver.getLastWorldPoint() == null && location == null) - { - if (getNpc() != null) - { - panelComponent.getChildren().add(LineComponent.builder() - .left("NPC:") - .build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(getNpc()) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - } - - panelComponent.getChildren().add(LineComponent.builder() - .left("Solution:") - .build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(getSolution()) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - } - // strange device has been tested, show possible locations for final dig spot - else - { - panelComponent.getChildren().add(LineComponent.builder() - .left("Possible locations:") - .build()); - - final Map locationCounts = new EnumMap<>(HotColdArea.class); - final Collection digLocations = hotColdSolver.getPossibleLocations(); - - for (HotColdLocation hotColdLocation : digLocations) - { - HotColdArea hotColdArea = hotColdLocation.getHotColdArea(); - - if (locationCounts.containsKey(hotColdArea)) - { - locationCounts.put(hotColdArea, locationCounts.get(hotColdArea) + 1); - } - else - { - locationCounts.put(hotColdArea, 1); - } - } - - if (digLocations.size() > 10) - { - for (Map.Entry locationCount : locationCounts.entrySet()) - { - panelComponent.getChildren().add(LineComponent.builder() - .left(locationCount.getKey().getName()) - .right(Integer.toString(locationCount.getValue())) - .build()); - } - } - else - { - for (HotColdArea area : locationCounts.keySet()) - { - panelComponent.getChildren().add(LineComponent.builder() - .left(area.getName() + ':') - .build()); - - for (HotColdLocation hotColdLocation : digLocations) - { - if (hotColdLocation.getHotColdArea() == area) - { - panelComponent.getChildren().add(LineComponent.builder() - .left("- " + hotColdLocation.getArea()) - .leftColor(Color.LIGHT_GRAY) - .build()); - } - } - } - } - } - } - - @Override - public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) - { - if (hotColdSolver == null) - { - return; - } - - // when final location has been found - if (location != null) - { - LocalPoint localLocation = LocalPoint.fromWorld(plugin.getClient(), getLocation()); - - if (localLocation != null) - { - OverlayUtil.renderTileOverlay(plugin.getClient(), graphics, localLocation, plugin.getSpadeImage(), Color.ORANGE); - } - - return; - } - - // when strange device hasn't been activated yet, show npc who gives you the strange device - if (hotColdSolver.getLastWorldPoint() == null && plugin.getNpcsToMark() != null) - { - for (NPC npcToMark : plugin.getNpcsToMark()) - { - OverlayUtil.renderActorOverlayImage(graphics, npcToMark, plugin.getClueScrollImage(), Color.ORANGE, IMAGE_Z_OFFSET); - } - } - - // once the number of possible dig locations is below 10, show the dig spots - final Collection digLocations = hotColdSolver.getPossibleLocations(); - if (digLocations.size() < 10) - { - // Mark potential dig locations - for (HotColdLocation hotColdLocation : digLocations) - { - WorldPoint wp = hotColdLocation.getWorldPoint(); - LocalPoint localLocation = LocalPoint.fromWorld(plugin.getClient(), wp.getX(), wp.getY()); - - if (localLocation == null) - { - return; - } - - OverlayUtil.renderTileOverlay(plugin.getClient(), graphics, localLocation, plugin.getSpadeImage(), Color.ORANGE); - } - } - } - - public boolean update(final String message, final ClueScrollPlugin plugin) - { - if (hotColdSolver == null) - { - return false; - } - - final Set temperatureSet; - - if (this == BEGINNER_CLUE) - { - temperatureSet = HotColdTemperature.BEGINNER_HOT_COLD_TEMPERATURES; - } - else if (this == MASTER_CLUE || this == MASTER_CLUE_LEAGUE) - { - temperatureSet = HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES; - } - else - { - temperatureSet = null; - } - - final HotColdTemperature temperature = HotColdTemperature.getFromTemperatureSet(temperatureSet, message); - - if (temperature == null) - { - return false; - } - - // Convert from real to overworld - final WorldPoint localWorld = ClueScrollPlugin.getMirrorPoint(plugin.getClient().getLocalPlayer().getWorldLocation(), true); - - if (localWorld == null) - { - return false; - } - - boolean master = this == MASTER_CLUE || this == MASTER_CLUE_LEAGUE; - if ((this == BEGINNER_CLUE && temperature == HotColdTemperature.BEGINNER_VISIBLY_SHAKING) - || (master && temperature == HotColdTemperature.MASTER_VISIBLY_SHAKING)) - { - markFinalSpot(localWorld); - } - else - { - location = null; - } - - final HotColdTemperatureChange temperatureChange = HotColdTemperatureChange.of(message); - hotColdSolver.signal(localWorld, temperature, temperatureChange); - - return true; - } - - @Override - public void reset() - { - location = null; - initializeSolver(); - } - - private void initializeSolver() - { - final boolean isBeginner; - - if (this == BEGINNER_CLUE) - { - isBeginner = true; - } - else if (this == MASTER_CLUE || this == MASTER_CLUE_LEAGUE) - { - isBeginner = false; - } - else - { - log.warn("Hot cold solver could not be initialized, clue type is unknown; text: {}, npc: {}, solution: {}", - text, npc, solution); - hotColdSolver = null; - return; - } - - final Set locations = Arrays.stream(HotColdLocation.values()) - .filter(l -> l.isBeginnerClue() == isBeginner) - .collect(Collectors.toSet()); - hotColdSolver = new HotColdSolver(locations); - } - - private void markFinalSpot(WorldPoint wp) - { - this.location = wp; - } - - public String[] getNpcs() - { - return new String[]{npc}; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/LocationClueScroll.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/LocationClueScroll.java deleted file mode 100644 index 194aefcb5a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/LocationClueScroll.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.cluescrolls.clues; - -import net.runelite.api.coords.WorldPoint; - -public interface LocationClueScroll -{ - WorldPoint getLocation(); - - default WorldPoint[] getLocations() - { - WorldPoint location = getLocation(); - return location == null ? new WorldPoint[0] : new WorldPoint[]{location}; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/LocationsClueScroll.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/LocationsClueScroll.java deleted file mode 100644 index eff9d9efd7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/LocationsClueScroll.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.cluescrolls.clues; - -import net.runelite.api.coords.WorldPoint; - -public interface LocationsClueScroll -{ - void reset(); - - WorldPoint[] getLocations(); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/MapClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/MapClue.java deleted file mode 100644 index 87cd2c5c31..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/MapClue.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls.clues; - -import com.google.common.collect.ImmutableSet; -import java.awt.Color; -import java.awt.Graphics2D; -import java.util.Set; -import lombok.AccessLevel; -import lombok.Getter; -import static net.runelite.api.ItemID.*; -import net.runelite.api.ObjectDefinition; -import static net.runelite.api.ObjectID.CRATE_18506; -import static net.runelite.api.ObjectID.CRATE_2620; -import static net.runelite.api.ObjectID.CRATE_354; -import static net.runelite.api.ObjectID.CRATE_357; -import static net.runelite.api.ObjectID.CRATE_6616; -import net.runelite.api.TileObject; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin; -import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.CLICKBOX_BORDER_COLOR; -import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.CLICKBOX_FILL_COLOR; -import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.CLICKBOX_HOVER_BORDER_COLOR; -import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.IMAGE_Z_OFFSET; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -@Getter(AccessLevel.PUBLIC) -public class MapClue extends ClueScroll implements ObjectClueScroll -{ - private static final Set CLUES = ImmutableSet.of( - new MapClue(CLUE_SCROLL_EASY_12179, new WorldPoint(3300, 3291, 0)), - new MapClue(CLUE_SCROLL_EASY_2713, new WorldPoint(3166, 3361, 0)), - new MapClue(CLUE_SCROLL_EASY_2716, new WorldPoint(3290, 3374, 0)), - new MapClue(CLUE_SCROLL_EASY_2719, new WorldPoint(3043, 3398, 0)), - new MapClue(CLUE_SCROLL_EASY_3516, new WorldPoint(2612, 3482, 0)), - new MapClue(CLUE_SCROLL_EASY_3518, new WorldPoint(3110, 3152, 0)), - new MapClue(CLUE_SCROLL_EASY_7236, new WorldPoint(2970, 3415, 0)), - new MapClue(CLUE_SCROLL_MEDIUM_2827, new WorldPoint(3091, 3227, 0)), - new MapClue(CLUE_SCROLL_MEDIUM_3596, new WorldPoint(2907, 3295, 0)), - new MapClue(CLUE_SCROLL_MEDIUM_3598, new WorldPoint(2658, 3488, 0), CRATE_357), - new MapClue(CLUE_SCROLL_MEDIUM_3599, new WorldPoint(2651, 3231, 0)), - new MapClue(CLUE_SCROLL_MEDIUM_3601, new WorldPoint(2565, 3248, 0), CRATE_354), - new MapClue(CLUE_SCROLL_MEDIUM_3602, new WorldPoint(2924, 3210, 0)), - new MapClue(CLUE_SCROLL_MEDIUM_7286, new WorldPoint(2536, 3865, 0)), - new MapClue(CLUE_SCROLL_MEDIUM_7288, new WorldPoint(3434, 3265, 0)), - new MapClue(CLUE_SCROLL_MEDIUM_7290, new WorldPoint(2454, 3230, 0)), - new MapClue(CLUE_SCROLL_MEDIUM_7292, new WorldPoint(2578, 3597, 0)), - new MapClue(CLUE_SCROLL_MEDIUM_7294, new WorldPoint(2666, 3562, 0)), - new MapClue(CLUE_SCROLL_HARD, new WorldPoint(3309, 3503, 0), CRATE_2620), - new MapClue(CLUE_SCROLL_HARD_2729, new WorldPoint(3190, 3963, 0)), - new MapClue(CLUE_SCROLL_HARD_3520, new WorldPoint(2615, 3078, 0)), - new MapClue(CLUE_SCROLL_HARD_3522, new WorldPoint(2488, 3308, 0)), - new MapClue(CLUE_SCROLL_HARD_3524, new WorldPoint(2457, 3182, 0), CRATE_18506), - new MapClue(CLUE_SCROLL_HARD_3525, new WorldPoint(3026, 3628, 0), CRATE_354), - new MapClue(CLUE_SCROLL_HARD_7239, new WorldPoint(3021, 3912, 0)), - new MapClue(CLUE_SCROLL_HARD_7241, new WorldPoint(2722, 3338, 0)), - new MapClue(CLUE_SCROLL_ELITE_12130, new WorldPoint(2449, 3130, 0)), - new MapClue(CLUE_SCROLL_ELITE_19782, new WorldPoint(2953, 9523, 1), "In the Mogre Camp, near Port Khazard. You require a Diving Apparatus and a Fishbowl Helmet"), - new MapClue(CLUE_SCROLL_ELITE_19783, new WorldPoint(2202, 3062, 0)), - new MapClue(CLUE_SCROLL_ELITE_19784, new WorldPoint(1815, 3852, 0)), - new MapClue(CLUE_SCROLL_ELITE_19785, new WorldPoint(3538, 3208, 0)), - new MapClue(CLUE_SCROLL_ELITE_19786, new WorldPoint(2703, 2716, 0), CRATE_6616) - ); - - private final int itemId; - private final WorldPoint location; - private final int objectId; - private final String description; - - private MapClue(int itemId, WorldPoint location) - { - this(itemId, location, -1); - } - - private MapClue(int itemId, WorldPoint location, int objectId) - { - this(itemId, location, objectId, null); - } - - MapClue(int itemId, WorldPoint location, String description) - { - this(itemId, location, -1, description); - } - - private MapClue(int itemId, WorldPoint location, int objectId, String description) - { - this.itemId = itemId; - this.location = location; - this.objectId = objectId; - this.description = description; - setRequiresSpade(objectId == -1); - } - - @Override - public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin) - { - panelComponent.getChildren().add(TitleComponent.builder().text("Map Clue").build()); - - panelComponent.getChildren().add(LineComponent.builder() - .left("Click the clue scroll along the edge of your world map to see your destination.") - .build()); - - if (objectId != -1) - { - ObjectDefinition objectToClick = plugin.getClient().getObjectDefinition(getObjectId()); - - String objectName = "N/A"; - - if (objectToClick != null) - { - objectName = objectToClick.getName(); - } - - panelComponent.getChildren().add(LineComponent.builder() - .left("Travel to the destination and click the " + objectName + ".") - .build()); - } - else - { - panelComponent.getChildren().add(LineComponent.builder() - .left("Travel to the destination and dig on the marked tile.") - .build()); - } - - if (description != null) - { - panelComponent.getChildren().add(LineComponent.builder().build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(description) - .build()); - } - } - - @Override - public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) - { - LocalPoint localLocation = LocalPoint.fromWorld(plugin.getClient(), getLocation()); - - if (localLocation == null) - { - return; - } - - // Mark game object - if (objectId != -1) - { - net.runelite.api.Point mousePosition = plugin.getClient().getMouseCanvasPosition(); - - if (plugin.getObjectsToMark() != null) - { - for (TileObject gameObject : plugin.getObjectsToMark()) - { - OverlayUtil.renderHoverableArea(graphics, gameObject.getClickbox(), mousePosition, - CLICKBOX_FILL_COLOR, CLICKBOX_BORDER_COLOR, CLICKBOX_HOVER_BORDER_COLOR); - - OverlayUtil.renderImageLocation(plugin.getClient(), graphics, gameObject.getLocalLocation(), plugin.getClueScrollImage(), IMAGE_Z_OFFSET); - } - } - } - // Mark tile - else - { - OverlayUtil.renderTileOverlay(plugin.getClient(), graphics, localLocation, plugin.getSpadeImage(), Color.ORANGE); - } - } - - public static MapClue forItemId(int itemId) - { - for (MapClue clue : CLUES) - { - if (clue.itemId == itemId) - { - return clue; - } - } - - return null; - } - - public int[] getObjectIds() - { - return new int[]{objectId}; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/MusicClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/MusicClue.java deleted file mode 100644 index 32e9ed61f9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/MusicClue.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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.cluescrolls.clues; - -import java.awt.Color; -import java.awt.Graphics2D; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.NPC; -import net.runelite.api.coords.WorldPoint; -import static net.runelite.client.plugins.cluescrolls.ClueScrollOverlay.TITLED_CONTENT_COLOR; -import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin; -import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.IMAGE_Z_OFFSET; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -@AllArgsConstructor(access = AccessLevel.PRIVATE) -@Getter(AccessLevel.PUBLIC) -public class MusicClue extends ClueScroll implements NpcClueScroll -{ - private static final WorldPoint LOCATION = new WorldPoint(2990, 3384, 0); - private static final String CECILIA = "Cecilia"; - private static final Pattern SONG_PATTERN = Pattern.compile("([A-Za-z !&',.]+)"); - - private final String song; - - @Override - public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin) - { - panelComponent.getChildren().add(TitleComponent.builder().text("Music Clue").build()); - panelComponent.getChildren().add(LineComponent.builder().left("NPC:").build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(CECILIA) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - - panelComponent.getChildren().add(LineComponent.builder().left("Location:").build()); - panelComponent.getChildren().add(LineComponent.builder() - .left("Falador Park") - .leftColor(TITLED_CONTENT_COLOR) - .build()); - - panelComponent.getChildren().add(LineComponent.builder().left("Song:").build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(song) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - } - - @Override - public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) - { - if (!LOCATION.isInScene(plugin.getClient())) - { - return; - } - - for (NPC npc : plugin.getNpcsToMark()) - { - OverlayUtil.renderActorOverlayImage(graphics, npc, plugin.getClueScrollImage(), Color.ORANGE, IMAGE_Z_OFFSET); - } - } - - @Override - public String[] getNpcs() - { - return new String[]{CECILIA}; - } - - public static MusicClue forText(String text) - { - final Matcher m = SONG_PATTERN.matcher(text); - if (m.find()) - { - final String song = m.group(1); - return new MusicClue(song); - } - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/NpcClueScroll.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/NpcClueScroll.java deleted file mode 100644 index d343693e0a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/NpcClueScroll.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls.clues; - -public interface NpcClueScroll -{ - String[] getNpcs(); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/ObjectClueScroll.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/ObjectClueScroll.java deleted file mode 100644 index c832cb23ae..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/ObjectClueScroll.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls.clues; - -public interface ObjectClueScroll extends LocationClueScroll -{ - int[] getObjectIds(); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/SkillChallengeClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/SkillChallengeClue.java deleted file mode 100644 index 7da0669dcd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/SkillChallengeClue.java +++ /dev/null @@ -1,367 +0,0 @@ -/* - * 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.cluescrolls.clues; - -import com.google.common.collect.ImmutableSet; -import java.awt.Color; -import java.awt.Graphics2D; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.EquipmentInventorySlot; -import net.runelite.api.Item; -import net.runelite.api.ItemID; -import net.runelite.api.NPC; -import static net.runelite.client.plugins.cluescrolls.ClueScrollOverlay.TITLED_CONTENT_COLOR; -import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin; -import static net.runelite.client.plugins.cluescrolls.ClueScrollWorldOverlay.IMAGE_Z_OFFSET; -import net.runelite.client.plugins.cluescrolls.clues.item.AnyRequirementCollection; -import net.runelite.client.plugins.cluescrolls.clues.item.ItemRequirement; -import static net.runelite.client.plugins.cluescrolls.clues.item.ItemRequirements.all; -import static net.runelite.client.plugins.cluescrolls.clues.item.ItemRequirements.any; -import static net.runelite.client.plugins.cluescrolls.clues.item.ItemRequirements.emptySlot; -import static net.runelite.client.plugins.cluescrolls.clues.item.ItemRequirements.item; -import static net.runelite.client.plugins.cluescrolls.clues.item.ItemRequirements.range; -import static net.runelite.client.plugins.cluescrolls.clues.item.ItemRequirements.xOfItem; -import net.runelite.client.plugins.cluescrolls.clues.item.SingleItemRequirement; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -@Getter(AccessLevel.PUBLIC) -public class SkillChallengeClue extends ClueScroll implements NpcClueScroll -{ - @AllArgsConstructor - @Getter(AccessLevel.PRIVATE) - enum ChallengeType - { - CHARLIE("Charlie the Tramp", "Southern Entrance to Varrock"), - SHERLOCK("Sherlock", "East of the Sorcerer's Tower in Seers' Village"); - - private String name; - private String location; - } - - private static final AnyRequirementCollection ANY_PICKAXE = any("Any Pickaxe", - item(ItemID.BRONZE_PICKAXE), - item(ItemID.IRON_PICKAXE), - item(ItemID.STEEL_PICKAXE), - item(ItemID.BLACK_PICKAXE), - item(ItemID.MITHRIL_PICKAXE), - item(ItemID.ADAMANT_PICKAXE), - item(ItemID.RUNE_PICKAXE), - item(ItemID.DRAGON_PICKAXE), - item(ItemID.DRAGON_PICKAXE_12797), - item(ItemID.DRAGON_PICKAXEOR), - item(ItemID.INFERNAL_PICKAXE), - item(ItemID.INFERNAL_PICKAXE_UNCHARGED), - item(ItemID.GILDED_PICKAXE), - item(ItemID._3RD_AGE_PICKAXE), - item(ItemID.CRYSTAL_PICKAXE) - ); - - private static final AnyRequirementCollection ANY_AXE = any("Any Axe", - item(ItemID.BRONZE_AXE), - item(ItemID.IRON_AXE), - item(ItemID.STEEL_AXE), - item(ItemID.BLACK_AXE), - item(ItemID.MITHRIL_AXE), - item(ItemID.ADAMANT_AXE), - item(ItemID.RUNE_AXE), - item(ItemID.DRAGON_AXE), - item(ItemID.INFERNAL_AXE), - item(ItemID.INFERNAL_AXE_UNCHARGED), - item(ItemID.GILDED_AXE), - item(ItemID._3RD_AGE_AXE), - item(ItemID.CRYSTAL_AXE) - ); - - private static final AnyRequirementCollection ANY_HARPOON = any("Harpoon", - item(ItemID.HARPOON), - item(ItemID.BARBTAIL_HARPOON), - item(ItemID.DRAGON_HARPOON), - item(ItemID.INFERNAL_HARPOON), - item(ItemID.INFERNAL_HARPOON_UNCHARGED), - item(ItemID.CRYSTAL_HARPOON) - ); - - private static final Set CLUES = ImmutableSet.of( - // Charlie Tasks - new SkillChallengeClue("Cook a Pike", "i need to cook charlie a pike.", "i need to take the cooked pike to charlie.", item(ItemID.PIKE), item(ItemID.RAW_PIKE)), - new SkillChallengeClue("Cook a Trout", "i need to cook charlie a trout.", "i need to take the cooked trout to charlie.", item(ItemID.TROUT), item(ItemID.RAW_TROUT)), - new SkillChallengeClue("Craft a Leather Body", "i need to craft charlie a leather body.", "i need to take the leather body i crafted to charlie.", item(ItemID.LEATHER_BODY), item(ItemID.LEATHER), item(ItemID.NEEDLE), item(ItemID.THREAD)), - new SkillChallengeClue("Craft some Leather Chaps", "i need to craft charlie some leather chaps.", "i need to take the leather chaps i crafted to charlie.", item(ItemID.LEATHER_CHAPS), item(ItemID.LEATHER), item(ItemID.NEEDLE), item(ItemID.THREAD)), - new SkillChallengeClue("Fish a Herring", "i need to fish charlie a herring.", "i need to take a raw herring to charlie.", item(ItemID.RAW_HERRING), any("Fishing rod", item(ItemID.FISHING_ROD), item(ItemID.PEARL_FISHING_ROD)), item(ItemID.FISHING_BAIT)), - new SkillChallengeClue("Fish a Trout", "i need to fish charlie a trout.", "i need to take a raw trout to charlie.", item(ItemID.RAW_TROUT), any("Fly fishing rod", item(ItemID.FLY_FISHING_ROD), item(ItemID.PEARL_FLY_FISHING_ROD)), item(ItemID.FEATHER)), - new SkillChallengeClue("Mine a piece of Iron Ore", "i need to mine charlie a piece of iron ore from an iron vein.", "i need to take the iron ore to charlie.", item(ItemID.IRON_ORE), ANY_PICKAXE), - new SkillChallengeClue("Smith an Iron Dagger", "i need to smith charlie one iron dagger.", "i need to take the iron dagger i smithed to charlie.", item(ItemID.IRON_DAGGER), item(ItemID.IRON_BAR), item(ItemID.HAMMER)), - // Elite Sherlock Tasks - new SkillChallengeClue("Equip a Dragon Scimitar.", true, any("Any Dragon Scimitar", item(ItemID.DRAGON_SCIMITAR), item(ItemID.DRAGON_SCIMITAR_OR))), - new SkillChallengeClue("Enchant some Dragonstone Jewellery.", "enchant a piece of dragonstone jewellery.", - xOfItem(ItemID.COSMIC_RUNE, 1), - any("Water Rune x15", xOfItem(ItemID.WATER_RUNE, 15), xOfItem(ItemID.MIST_RUNE, 15), xOfItem(ItemID.MUD_RUNE, 15), xOfItem(ItemID.STEAM_RUNE, 15), item(ItemID.STAFF_OF_WATER), item(ItemID.WATER_BATTLESTAFF), item(ItemID.MYSTIC_WATER_STAFF), item(ItemID.MUD_BATTLESTAFF), item(ItemID.MYSTIC_MUD_STAFF), item(ItemID.MIST_BATTLESTAFF), item(ItemID.MYSTIC_MIST_STAFF), item(ItemID.STEAM_BATTLESTAFF), item(ItemID.MYSTIC_STEAM_STAFF), item(ItemID.STEAM_BATTLESTAFF_12795), item(ItemID.MYSTIC_STEAM_STAFF_12796), item(ItemID.KODAI_WAND)), - any("Earth Rune x15", xOfItem(ItemID.EARTH_RUNE, 15), xOfItem(ItemID.DUST_RUNE, 15), xOfItem(ItemID.MUD_RUNE, 15), xOfItem(ItemID.LAVA_RUNE, 15), item(ItemID.STAFF_OF_EARTH), item(ItemID.EARTH_BATTLESTAFF), item(ItemID.MYSTIC_EARTH_STAFF), item(ItemID.MUD_BATTLESTAFF), item(ItemID.MYSTIC_MUD_STAFF), item(ItemID.DUST_BATTLESTAFF), item(ItemID.MYSTIC_DUST_STAFF), item(ItemID.LAVA_BATTLESTAFF), item(ItemID.MYSTIC_LAVA_STAFF), item(ItemID.LAVA_BATTLESTAFF_21198), item(ItemID.MYSTIC_LAVA_STAFF_21200)), - any("Unenchanted Dragonstone Jewellery", item(ItemID.DRAGONSTONE_RING), item(ItemID.DRAGON_NECKLACE), item(ItemID.DRAGON_BRACELET), item(ItemID.DRAGONSTONE_AMULET))), - new SkillChallengeClue("Craft a nature rune.", item(ItemID.PURE_ESSENCE)), - new SkillChallengeClue("Catch a mottled eel with aerial fishing in Lake Molch.", any("Fish chunks or King worms", item(ItemID.FISH_CHUNKS), item(ItemID.KING_WORM)), emptySlot("No Gloves", EquipmentInventorySlot.GLOVES), emptySlot("No Weapon", EquipmentInventorySlot.WEAPON), emptySlot("No Shield", EquipmentInventorySlot.SHIELD)), - new SkillChallengeClue("Score a goal in skullball.", true, any("Ring of Charos", item(ItemID.RING_OF_CHAROS), item(ItemID.RING_OF_CHAROSA))), - new SkillChallengeClue("Complete a lap of Ape atoll agility course.", true, any("Ninja Monkey Greegree", item(ItemID.NINJA_MONKEY_GREEGREE), item(ItemID.NINJA_MONKEY_GREEGREE_4025), item(ItemID.KRUK_MONKEY_GREEGREE))), - new SkillChallengeClue("Create a super defence potion.", item(ItemID.CADANTINE_POTION_UNF), item(ItemID.WHITE_BERRIES)), - new SkillChallengeClue("Steal from a chest in King Lathas' castle in East Ardougne."), - new SkillChallengeClue("Craft a green d'hide body.", xOfItem(ItemID.GREEN_DRAGON_LEATHER, 3), item(ItemID.NEEDLE), item(ItemID.THREAD)), - new SkillChallengeClue("String a yew longbow.", item(ItemID.YEW_LONGBOW_U), item(ItemID.BOW_STRING)), - new SkillChallengeClue("Kill a Dust Devil.", "slay a dust devil.", true, any("Facemask or Slayer Helmet", item(ItemID.FACEMASK), item(ItemID.SLAYER_HELMET), item(ItemID.SLAYER_HELMET_I), item(ItemID.BLACK_SLAYER_HELMET), item(ItemID.BLACK_SLAYER_HELMET_I), item(ItemID.PURPLE_SLAYER_HELMET), item(ItemID.PURPLE_SLAYER_HELMET_I), item(ItemID.RED_SLAYER_HELMET), item(ItemID.RED_SLAYER_HELMET_I), item(ItemID.GREEN_SLAYER_HELMET), item(ItemID.GREEN_SLAYER_HELMET_I), item(ItemID.TURQUOISE_SLAYER_HELMET), item(ItemID.TURQUOISE_SLAYER_HELMET_I), item(ItemID.HYDRA_SLAYER_HELMET), item(ItemID.HYDRA_SLAYER_HELMET_I))), - new SkillChallengeClue("Catch a black warlock.", item(ItemID.BUTTERFLY_JAR), any("Butterfly Net", item(ItemID.BUTTERFLY_NET), item(ItemID.MAGIC_BUTTERFLY_NET))), - new SkillChallengeClue("Catch a red chinchompa.", item(ItemID.BOX_TRAP)), - new SkillChallengeClue("Mine a piece of mithril ore.", ANY_PICKAXE), - new SkillChallengeClue("Smith a mithril 2h sword.", item(ItemID.HAMMER), xOfItem(ItemID.MITHRIL_BAR, 3)), - new SkillChallengeClue("Catch a raw shark.", ANY_HARPOON), - new SkillChallengeClue("Cut a yew log.", ANY_AXE), - new SkillChallengeClue("Fix a magical lamp in Dorgesh-Kaan.", item(ItemID.LIGHT_ORB)), - new SkillChallengeClue("Burn a yew log.", item(ItemID.YEW_LOGS), item(ItemID.TINDERBOX)), - new SkillChallengeClue("Cook a swordfish", "cook a swordfish", item(ItemID.RAW_SWORDFISH)), - new SkillChallengeClue("Craft multiple cosmic runes from a single essence.", item(ItemID.PURE_ESSENCE)), - new SkillChallengeClue("Plant a watermelon seed.", item(ItemID.RAKE), item(ItemID.SEED_DIBBER), xOfItem(ItemID.WATERMELON_SEED, 3)), - new SkillChallengeClue("Activate the Chivalry prayer."), - new SkillChallengeClue("Hand in a Tier 2 or higher set of Shayzien supply armour", "take the lovakengj armourers a boxed set of shayzien supply armour at tier 2 or above.", any("Shayzien Supply Set (Tier 2 or higher)", item(ItemID.SHAYZIEN_SUPPLY_SET_2), item(ItemID.SHAYZIEN_SUPPLY_SET_3), item(ItemID.SHAYZIEN_SUPPLY_SET_4), item(ItemID.SHAYZIEN_SUPPLY_SET_5))), - // Master Sherlock Tasks - new SkillChallengeClue("Equip an abyssal whip in front of the abyssal demons of the Slayer Tower.", true, any("Abyssal Whip", item(ItemID.ABYSSAL_WHIP), item(ItemID.FROZEN_ABYSSAL_WHIP), item(ItemID.VOLCANIC_ABYSSAL_WHIP))), - new SkillChallengeClue("Smith a runite med helm.", item(ItemID.HAMMER), item(ItemID.RUNITE_BAR)), - new SkillChallengeClue("Teleport to a spirit tree you planted yourself."), - new SkillChallengeClue("Create a Barrows teleport tablet.", item(ItemID.DARK_ESSENCE_BLOCK), xOfItem(ItemID.BLOOD_RUNE, 1), xOfItem(ItemID.LAW_RUNE, 2), xOfItem(ItemID.SOUL_RUNE, 2)), - new SkillChallengeClue("Kill a Nechryael.", "slay a nechryael"), - new SkillChallengeClue("Kill a Spiritual Mage while wearing something from their god.", "kill the spiritual, magic and godly whilst representing their own god."), - new SkillChallengeClue("Create an unstrung dragonstone amulet at a furnace.", item(ItemID.GOLD_BAR), item(ItemID.DRAGONSTONE), item(ItemID.AMULET_MOULD)), - new SkillChallengeClue("Burn a magic log.", item(ItemID.MAGIC_LOGS), item(ItemID.TINDERBOX)), - new SkillChallengeClue("Burn a redwood log.", item(ItemID.REDWOOD_LOGS), item(ItemID.TINDERBOX)), - new SkillChallengeClue("Complete a lap of Rellekka's Rooftop Agility Course", "complete a lap of the rellekka rooftop agility course whilst sporting the finest amount of grace.", true, - all("A full Graceful set", - any("", item(ItemID.GRACEFUL_HOOD), item(ItemID.GRACEFUL_HOOD_11851), item(ItemID.GRACEFUL_HOOD_13579), item(ItemID.GRACEFUL_HOOD_13580), item(ItemID.GRACEFUL_HOOD_13591), item(ItemID.GRACEFUL_HOOD_13592), item(ItemID.GRACEFUL_HOOD_13603), item(ItemID.GRACEFUL_HOOD_13604), item(ItemID.GRACEFUL_HOOD_13615), item(ItemID.GRACEFUL_HOOD_13616), item(ItemID.GRACEFUL_HOOD_13627), item(ItemID.GRACEFUL_HOOD_13628), item(ItemID.GRACEFUL_HOOD_13667), item(ItemID.GRACEFUL_HOOD_13668), item(ItemID.GRACEFUL_HOOD_21061), item(ItemID.GRACEFUL_HOOD_21063)), - any("", item(ItemID.GRACEFUL_CAPE), item(ItemID.GRACEFUL_CAPE_11853), item(ItemID.GRACEFUL_CAPE_13581), item(ItemID.GRACEFUL_CAPE_13582), item(ItemID.GRACEFUL_CAPE_13593), item(ItemID.GRACEFUL_CAPE_13594), item(ItemID.GRACEFUL_CAPE_13605), item(ItemID.GRACEFUL_CAPE_13606), item(ItemID.GRACEFUL_CAPE_13617), item(ItemID.GRACEFUL_CAPE_13618), item(ItemID.GRACEFUL_CAPE_13629), item(ItemID.GRACEFUL_CAPE_13630), item(ItemID.GRACEFUL_CAPE_13669), item(ItemID.GRACEFUL_CAPE_13670), item(ItemID.GRACEFUL_CAPE_21064), item(ItemID.GRACEFUL_CAPE_21066), item(ItemID.AGILITY_CAPE), item(ItemID.AGILITY_CAPET), item(ItemID.MAX_CAPE)), - any("", item(ItemID.GRACEFUL_TOP), item(ItemID.GRACEFUL_TOP_11855), item(ItemID.GRACEFUL_TOP_13583), item(ItemID.GRACEFUL_TOP_13584), item(ItemID.GRACEFUL_TOP_13595), item(ItemID.GRACEFUL_TOP_13596), item(ItemID.GRACEFUL_TOP_13607), item(ItemID.GRACEFUL_TOP_13608), item(ItemID.GRACEFUL_TOP_13619), item(ItemID.GRACEFUL_TOP_13620), item(ItemID.GRACEFUL_TOP_13631), item(ItemID.GRACEFUL_TOP_13632), item(ItemID.GRACEFUL_TOP_13671), item(ItemID.GRACEFUL_TOP_13672), item(ItemID.GRACEFUL_TOP_21067), item(ItemID.GRACEFUL_TOP_21069)), - any("", item(ItemID.GRACEFUL_LEGS), item(ItemID.GRACEFUL_LEGS_11857), item(ItemID.GRACEFUL_LEGS_13585), item(ItemID.GRACEFUL_LEGS_13586), item(ItemID.GRACEFUL_LEGS_13597), item(ItemID.GRACEFUL_LEGS_13598), item(ItemID.GRACEFUL_LEGS_13609), item(ItemID.GRACEFUL_LEGS_13610), item(ItemID.GRACEFUL_LEGS_13621), item(ItemID.GRACEFUL_LEGS_13622), item(ItemID.GRACEFUL_LEGS_13633), item(ItemID.GRACEFUL_LEGS_13634), item(ItemID.GRACEFUL_LEGS_13673), item(ItemID.GRACEFUL_LEGS_13674), item(ItemID.GRACEFUL_LEGS_21070), item(ItemID.GRACEFUL_LEGS_21072)), - any("", item(ItemID.GRACEFUL_GLOVES), item(ItemID.GRACEFUL_GLOVES_11859), item(ItemID.GRACEFUL_GLOVES_13587), item(ItemID.GRACEFUL_GLOVES_13588), item(ItemID.GRACEFUL_GLOVES_13599), item(ItemID.GRACEFUL_GLOVES_13600), item(ItemID.GRACEFUL_GLOVES_13611), item(ItemID.GRACEFUL_GLOVES_13612), item(ItemID.GRACEFUL_GLOVES_13623), item(ItemID.GRACEFUL_GLOVES_13624), item(ItemID.GRACEFUL_GLOVES_13635), item(ItemID.GRACEFUL_GLOVES_13636), item(ItemID.GRACEFUL_GLOVES_13675), item(ItemID.GRACEFUL_GLOVES_13676), item(ItemID.GRACEFUL_GLOVES_21073), item(ItemID.GRACEFUL_GLOVES_21075)), - any("", item(ItemID.GRACEFUL_BOOTS), item(ItemID.GRACEFUL_BOOTS_11861), item(ItemID.GRACEFUL_BOOTS_13589), item(ItemID.GRACEFUL_BOOTS_13590), item(ItemID.GRACEFUL_BOOTS_13601), item(ItemID.GRACEFUL_BOOTS_13602), item(ItemID.GRACEFUL_BOOTS_13613), item(ItemID.GRACEFUL_BOOTS_13614), item(ItemID.GRACEFUL_BOOTS_13625), item(ItemID.GRACEFUL_BOOTS_13626), item(ItemID.GRACEFUL_BOOTS_13637), item(ItemID.GRACEFUL_BOOTS_13638), item(ItemID.GRACEFUL_BOOTS_13677), item(ItemID.GRACEFUL_BOOTS_13678), item(ItemID.GRACEFUL_BOOTS_21076), item(ItemID.GRACEFUL_BOOTS_21078)))), - new SkillChallengeClue("Mix an anti-venom potion.", item(ItemID.ANTIDOTE4_5952), xOfItem(ItemID.ZULRAHS_SCALES, 20)), - new SkillChallengeClue("Mine a piece of Runite ore", "mine a piece of runite ore whilst sporting the finest mining gear.", true, ANY_PICKAXE, all("Prospector kit", item(ItemID.PROSPECTOR_HELMET), item(ItemID.PROSPECTOR_JACKET), item(ItemID.PROSPECTOR_LEGS), item(ItemID.PROSPECTOR_BOOTS))), - new SkillChallengeClue("Steal a gem from the Ardougne market."), - new SkillChallengeClue("Pickpocket an elf."), - new SkillChallengeClue("Bind a blood rune at the blood altar.", item(ItemID.DARK_ESSENCE_FRAGMENTS)), - new SkillChallengeClue("Create a ranging mix potion.", item(ItemID.RANGING_POTION2), item(ItemID.CAVIAR)), - new SkillChallengeClue("Fletch a rune dart.", item(ItemID.RUNE_DART_TIP), item(ItemID.FEATHER)), - new SkillChallengeClue("Cremate a set of fiyr remains.", any("Magic or Redwood Pyre Logs", item(ItemID.MAGIC_PYRE_LOGS), item(ItemID.REDWOOD_PYRE_LOGS)), item(ItemID.TINDERBOX), item(ItemID.FIYR_REMAINS)), - new SkillChallengeClue("Dissect a sacred eel.", item(ItemID.KNIFE), any("Fishing rod", item(ItemID.FISHING_ROD), item(ItemID.PEARL_FISHING_ROD)), item(ItemID.FISHING_BAIT)), - new SkillChallengeClue("Kill a lizardman shaman."), - new SkillChallengeClue("Catch an Anglerfish.", "angle for an anglerfish whilst sporting the finest fishing gear.", true, any("Fishing rod", item(ItemID.FISHING_ROD), item(ItemID.PEARL_FISHING_ROD)), item(ItemID.SANDWORMS), all("Angler's outfit", item(ItemID.ANGLER_HAT), item(ItemID.ANGLER_TOP), item(ItemID.ANGLER_WADERS), item(ItemID.ANGLER_BOOTS))), - new SkillChallengeClue("Chop a redwood log.", "chop a redwood log whilst sporting the finest lumberjack gear.", true, ANY_AXE, all("Lumberjack outfit", item(ItemID.LUMBERJACK_HAT), item(ItemID.LUMBERJACK_TOP), item(ItemID.LUMBERJACK_LEGS), item(ItemID.LUMBERJACK_BOOTS))), - new SkillChallengeClue("Craft a light orb in the Dorgesh-Kaan bank.", item(ItemID.CAVE_GOBLIN_WIRE), item(ItemID.EMPTY_LIGHT_ORB)), - new SkillChallengeClue("Kill a reanimated Abyssal Demon.", "kill a reanimated abyssal.", xOfItem(ItemID.SOUL_RUNE, 4), xOfItem(ItemID.BLOOD_RUNE, 1), any("Nature Rune x4", xOfItem(ItemID.NATURE_RUNE, 4), item(ItemID.BRYOPHYTAS_STAFF)), range("Ensouled abyssal head", ItemID.ENSOULED_ABYSSAL_HEAD, ItemID.ENSOULED_ABYSSAL_HEAD_13508)), - new SkillChallengeClue("Kill a Fiyr shade inside Mort'tons shade catacombs.", any("Any Silver Shade Key", item(ItemID.SILVER_KEY_RED), item(ItemID.SILVER_KEY_BROWN), item(ItemID.SILVER_KEY_CRIMSON), item(ItemID.SILVER_KEY_BLACK), item(ItemID.SILVER_KEY_PURPLE))) - ); - - private final ChallengeType type; - private final String challenge; - private final String rawChallenge; - private final String returnText; - private final ItemRequirement[] itemRequirements; - private final SingleItemRequirement returnItem; - private final boolean requireEquip; - @Setter - private boolean challengeCompleted; - - // Charlie Tasks - private SkillChallengeClue(String challenge, String rawChallenge, String returnText, SingleItemRequirement returnItem, ItemRequirement... itemRequirements) - { - this.type = ChallengeType.CHARLIE; - this.challenge = challenge; - this.rawChallenge = rawChallenge; - this.returnText = returnText; - this.itemRequirements = itemRequirements; - this.returnItem = returnItem; - this.challengeCompleted = false; - this.requireEquip = false; - } - - // Non-cryptic Sherlock Tasks - private SkillChallengeClue(String challenge, ItemRequirement... itemRequirements) - { - this(challenge, challenge.toLowerCase(), itemRequirements); - } - - // Non-cryptic Sherlock Tasks - private SkillChallengeClue(String challenge, boolean requireEquip, ItemRequirement... itemRequirements) - { - this(challenge, challenge.toLowerCase(), requireEquip, itemRequirements); - } - - // Sherlock Tasks - private SkillChallengeClue(String challenge, String rawChallenge, ItemRequirement... itemRequirements) - { - this(challenge, rawChallenge, false, itemRequirements); - } - - // Sherlock Tasks - private SkillChallengeClue(String challenge, String rawChallenge, boolean requireEquip, ItemRequirement... itemRequirements) - { - this.type = ChallengeType.SHERLOCK; - this.challenge = challenge; - this.rawChallenge = rawChallenge; - this.itemRequirements = itemRequirements; - this.challengeCompleted = false; - this.requireEquip = requireEquip; - this.returnText = "" + rawChallenge + ""; - - this.returnItem = null; - } - - @Override - public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin) - { - panelComponent.getChildren().add(TitleComponent.builder().text("Skill Challenge Clue").build()); - - if (!challengeCompleted) - { - panelComponent.getChildren().add(LineComponent.builder().left("Challenge:").build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(challenge) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - - if (itemRequirements.length > 0) - { - panelComponent.getChildren().add(LineComponent.builder().left(requireEquip ? "Equipment:" : "Items Required:").build()); - - for (LineComponent line : getRequirements(plugin, requireEquip, itemRequirements)) - { - panelComponent.getChildren().add(line); - } - } - } - else - { - panelComponent.getChildren().add(LineComponent.builder().left("NPC:").build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(type.getName()) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - - panelComponent.getChildren().add(LineComponent.builder().left("Location:").build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(type.getLocation()) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - - if (returnItem != null) - { - panelComponent.getChildren().add(LineComponent.builder().left("Item:").build()); - for (LineComponent line : getRequirements(plugin, false, returnItem)) - { - panelComponent.getChildren().add(line); - } - } - } - } - - @Override - public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) - { - // Mark NPC - if (plugin.getNpcsToMark() != null) - { - for (NPC npc : plugin.getNpcsToMark()) - { - OverlayUtil.renderActorOverlayImage(graphics, npc, plugin.getClueScrollImage(), Color.ORANGE, IMAGE_Z_OFFSET); - } - } - } - - private static List getRequirements(ClueScrollPlugin plugin, boolean requireEquipped, ItemRequirement... requirements) - { - List components = new ArrayList<>(); - - Item[] equipment = plugin.getEquippedItems(); - Item[] inventory = plugin.getInventoryItems(); - - // If equipment is null, the player is wearing nothing - if (equipment == null) - { - equipment = new Item[0]; - } - - // If inventory is null, the player has nothing in their inventory - if (inventory == null) - { - inventory = new Item[0]; - } - - Item[] combined = new Item[equipment.length + inventory.length]; - System.arraycopy(equipment, 0, combined, 0, equipment.length); - System.arraycopy(inventory, 0, combined, equipment.length, inventory.length); - - for (ItemRequirement requirement : requirements) - { - boolean equipmentFulfilled = requirement.fulfilledBy(equipment); - boolean combinedFulfilled = requirement.fulfilledBy(combined); - - components.add(LineComponent.builder() - .left(requirement.getCollectiveName(plugin.getClient())) - .leftColor(TITLED_CONTENT_COLOR) - .right(combinedFulfilled ? "\u2713" : "\u2717") - .rightColor(equipmentFulfilled || (combinedFulfilled && !requireEquipped) ? Color.GREEN : (combinedFulfilled ? Color.ORANGE : Color.RED)) - .build()); - } - - return components; - } - - public static SkillChallengeClue forText(String text, String rawText) - { - for (SkillChallengeClue clue : CLUES) - { - if (rawText.equalsIgnoreCase(clue.returnText)) - { - clue.setChallengeCompleted(true); - return clue; - } - else if (text.equals(clue.rawChallenge)) - { - clue.setChallengeCompleted(false); - return clue; - } - } - return null; - } - - @Override - public String[] getNpcs() - { - return new String[]{type.getName()}; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/TextClueScroll.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/TextClueScroll.java deleted file mode 100644 index d402606618..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/TextClueScroll.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls.clues; - -public interface TextClueScroll -{ - String getText(); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/ThreeStepCrypticClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/ThreeStepCrypticClue.java deleted file mode 100644 index c5cf8289e7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/ThreeStepCrypticClue.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (c) 2018, Eadgars Ruse - * 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.cluescrolls.clues; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.stream.Stream; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.api.Client; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import static net.runelite.api.ItemID.TORN_CLUE_SCROLL_PART_1; -import static net.runelite.api.ItemID.TORN_CLUE_SCROLL_PART_2; -import static net.runelite.api.ItemID.TORN_CLUE_SCROLL_PART_3; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.util.Text; -import net.runelite.client.game.ItemManager; -import static net.runelite.client.plugins.cluescrolls.ClueScrollOverlay.TITLED_CONTENT_COLOR; -import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -@Getter(AccessLevel.PUBLIC) -@RequiredArgsConstructor -public class ThreeStepCrypticClue extends ClueScroll implements TextClueScroll, ObjectClueScroll, NpcClueScroll, LocationsClueScroll -{ - public static ThreeStepCrypticClue forText(String plainText, String text) - { - final String[] split = text.split("
\\s*
"); - final List> steps = new ArrayList<>(split.length); - - for (String part : split) - { - boolean isDone = part.contains(""); - final String rawText = Text.sanitizeMultilineText(part); - - for (CrypticClue clue : CrypticClue.CLUES) - { - if (!rawText.equalsIgnoreCase(clue.getText())) - { - continue; - } - - steps.add(new AbstractMap.SimpleEntry<>(clue, isDone)); - break; - } - } - - if (steps.isEmpty() || steps.size() < 3) - { - return null; - } - - return new ThreeStepCrypticClue(steps, plainText); - } - - private final List> clueSteps; - private final String text; - - @Override - public void makeOverlayHint(PanelComponent panelComponent, ClueScrollPlugin plugin) - { - panelComponent.setPreferredSize(new Dimension(200, 0)); - - for (int i = 0; i < clueSteps.size(); i++) - { - final Map.Entry e = clueSteps.get(i); - - if (!e.getValue()) - { - CrypticClue c = e.getKey(); - - panelComponent.getChildren().add(TitleComponent.builder().text("Cryptic Clue #" + (i + 1)).build()); - panelComponent.getChildren().add(LineComponent.builder().left("Solution:").build()); - panelComponent.getChildren().add(LineComponent.builder() - .left(c.getSolution()) - .leftColor(TITLED_CONTENT_COLOR) - .build()); - } - } - } - - @Override - public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) - { - for (Map.Entry e : clueSteps) - { - if (!e.getValue()) - { - e.getKey().makeWorldOverlayHint(graphics, plugin); - } - } - } - - public boolean update(Client client, final ItemContainerChanged event, ItemManager itemManager) - { - if (event.getItemContainer() == client.getItemContainer(InventoryID.INVENTORY)) - { - boolean success = false; - success |= checkForPart(event, itemManager, TORN_CLUE_SCROLL_PART_1, 0); - success |= checkForPart(event, itemManager, TORN_CLUE_SCROLL_PART_2, 1); - success |= checkForPart(event, itemManager, TORN_CLUE_SCROLL_PART_3, 2); - return success; - } - - return false; - } - - private boolean checkForPart(final ItemContainerChanged event, ItemManager itemManager, int clueScrollPart, int index) - { - final Stream items = Arrays.stream(event.getItemContainer().getItems()); - - // If we have the part then that step is done - if (items.anyMatch(item -> itemManager.getItemDefinition(item.getId()).getId() == clueScrollPart)) - { - final Map.Entry entry = clueSteps.get(index); - - if (!entry.getValue()) - { - entry.setValue(true); - return true; - } - } - - return false; - } - - @Override - public void reset() - { - for (Map.Entry clueStep : clueSteps) - { - clueStep.setValue(false); - } - } - - @Override - public WorldPoint getLocation() - { - return null; - } - - @Override - public WorldPoint[] getLocations() - { - return clueSteps.stream() - .filter(s -> !s.getValue()) - .map(s -> s.getKey().getLocation()) - .toArray(WorldPoint[]::new); - } - - @Override - public String[] getNpcs() - { - return clueSteps.stream() - .filter(s -> !s.getValue()) - .map(s -> s.getKey().getNpc()) - .toArray(String[]::new); - } - - @Override - public int[] getObjectIds() - { - return clueSteps.stream() - .filter(s -> !s.getValue()) - .mapToInt(s -> s.getKey().getObjectId()) - .toArray(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/emote/Emote.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/emote/Emote.java deleted file mode 100644 index 004f9fe6a2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/emote/Emote.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls.clues.emote; - -import lombok.AccessLevel; -import lombok.Getter; -import static net.runelite.api.SpriteID.*; - -@Getter(AccessLevel.PUBLIC) -public enum Emote -{ - BULL_ROARER("Bull Roarer", -1), - YES("Yes", EMOTE_YES), - NO("No", EMOTE_NO), - THINK("Think", EMOTE_THINK), - BOW("Bow", EMOTE_BOW), - ANGRY("Angry", EMOTE_ANGRY), - CRY("Cry", EMOTE_CRY), - LAUGH("Laugh", EMOTE_LAUGH), - CHEER("Cheer", EMOTE_CHEER), - WAVE("Wave", EMOTE_WAVE), - BECKON("Beckon", EMOTE_BECKON), - DANCE("Dance", EMOTE_DANCE), - CLAP("Clap", EMOTE_CLAP), - PANIC("Panic", EMOTE_PANIC), - JIG("Jig", EMOTE_JIG), - SPIN("Spin", EMOTE_SPIN), - HEADBANG("Headbang", EMOTE_HEADBANG), - JUMP_FOR_JOY("Jump for Joy", EMOTE_JUMP_FOR_JOY), - RASPBERRY("Raspberry", EMOTE_RASPBERRY), - YAWN("Yawn", EMOTE_YAWN), - SALUTE("Salute", EMOTE_SALUTE), - SHRUG("Shrug", EMOTE_SHRUG), - BLOW_KISS("Blow Kiss", EMOTE_BLOW_KISS), - GOBLIN_SALUTE("Goblin Salute", EMOTE_GOBLIN_SALUTE), - SLAP_HEAD("Slap Head", EMOTE_SLAP_HEAD), - STAMP("Stamp", EMOTE_STAMP), - FLAP("Flap", EMOTE_FLAP), - PUSH_UP("Push up", EMOTE_PUSH_UP); - - private String name; - private int spriteId; - - Emote(String name, int spriteId) - { - this.name = name; - this.spriteId = spriteId; - } - - public boolean hasSprite() - { - return spriteId != -1; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/emote/STASHUnit.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/emote/STASHUnit.java deleted file mode 100644 index 26d397422d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/emote/STASHUnit.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * 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.cluescrolls.clues.emote; - -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.NullObjectID; -import net.runelite.api.coords.WorldPoint; - -@Getter(AccessLevel.PUBLIC) -public enum STASHUnit -{ - NEAR_A_SHED_IN_LUMBRIDGE_SWAMP(NullObjectID.NULL_28958, new WorldPoint(3201, 3171, 0)), - ON_THE_BRIDGE_TO_THE_MISTHALIN_WIZARDS_TOWER(NullObjectID.NULL_28959, new WorldPoint(3115, 3194, 0)), - DRAYNOR_VILLAGE_MARKET(NullObjectID.NULL_28960, new WorldPoint(3083, 3254, 0)), - LIMESTONE_MINE(NullObjectID.NULL_28961, new WorldPoint(3373, 3498, 0)), - OUTSIDE_THE_LEGENDS_GUILD_GATES(NullObjectID.NULL_28962, new WorldPoint(2735, 3350, 0)), - MUDSKIPPER_POINT(NullObjectID.NULL_28963, new WorldPoint(2988, 3111, 0)), - NEAR_THE_ENTRANA_FERRY_IN_PORT_SARIM(NullObjectID.NULL_28964, new WorldPoint(3050, 3237, 0)), - AL_KHARID_SCORPION_MINE(NullObjectID.NULL_28965, new WorldPoint(3303, 3289, 0)), - DRAYNOR_MANOR_BY_THE_FOUNTAIN(NullObjectID.NULL_28966, new WorldPoint(3089, 3331, 0)), - WHEAT_FIELD_NEAR_THE_LUMBRIDGE_WINDMILL(NullObjectID.NULL_28967, new WorldPoint(3163, 3297, 0)), - CROSSROADS_NORTH_OF_DRAYNOR_VILLAGE(NullObjectID.NULL_28968, new WorldPoint(3111, 3289, 0)), - RIMMINGTON_MINE(NullObjectID.NULL_28969, new WorldPoint(2976, 3239, 0)), - VARROCK_PALACE_LIBRARY(NullObjectID.NULL_28970, new WorldPoint(3214, 3490, 0)), - UPSTAIRS_IN_THE_ARDOUGNE_WINDMILL(NullObjectID.NULL_28971, new WorldPoint(2635, 3386, 2)), - OUTSIDE_THE_FALADOR_PARTY_ROOM(NullObjectID.NULL_28972, new WorldPoint(3043, 3371, 0)), - TAVERLEY_STONE_CIRCLE(NullObjectID.NULL_28973, new WorldPoint(2924, 3477, 0)), - CATHERBY_BEEHIVE_FIELD(NullObjectID.NULL_28974, new WorldPoint(2764, 3438, 0)), - NEAR_THE_PARROTS_IN_ARDOUGNE_ZOO(NullObjectID.NULL_28975, new WorldPoint(2608, 3284, 0)), - ROAD_JUNCTION_NORTH_OF_RIMMINGTON(NullObjectID.NULL_28976, new WorldPoint(2981, 3278, 0)), - OUTSIDE_THE_FISHING_GUILD(NullObjectID.NULL_28977, new WorldPoint(2608, 3393, 0)), - OUTSIDE_KEEP_LE_FAYE(NullObjectID.NULL_28978, new WorldPoint(2756, 3399, 0)), - ROAD_JUNCTION_SOUTH_OF_SINCLAIR_MANSION(NullObjectID.NULL_28979, new WorldPoint(2735, 3534, 0)), - OUTSIDE_THE_DIGSITE_EXAM_CENTRE(NullObjectID.NULL_28980, new WorldPoint(3353, 3343, 0)), - NEAR_THE_SAWMILL_OPERATORS_BOOTH(NullObjectID.NULL_28981, new WorldPoint(3298, 3490, 0)), - MUBARIZS_ROOM_AT_THE_DUEL_ARENA(NullObjectID.NULL_28982, new WorldPoint(3316, 3242, 0)), - OUTSIDE_VARROCK_PALACE_COURTYARD(NullObjectID.NULL_28983, new WorldPoint(3211, 3456, 0)), - NEAR_HERQUINS_SHOP_IN_FALADOR(NullObjectID.NULL_28984, new WorldPoint(2941, 3339, 0)), - SOUTH_OF_THE_GRAND_EXCHANGE(NullObjectID.NULL_28985, new WorldPoint(3159, 3464, 0)), - AUBURYS_SHOP_IN_VARROCK(NullObjectID.NULL_28986, new WorldPoint(3252, 3404, 0)), - CENTRE_OF_CANIFIS(NullObjectID.NULL_28987, new WorldPoint(3491, 3489, 0)), - MAUSOLEUM_OFF_THE_MORYTANIA_COAST(NullObjectID.NULL_28988, new WorldPoint(3500, 3575, 0)), - EAST_OF_THE_BARBARIAN_VILLAGE_BRIDGE(NullObjectID.NULL_28989, new WorldPoint(3110, 3422, 0)), - SOUTH_OF_THE_SHRINE_IN_TAI_BWO_WANNAI_VILLAGE(NullObjectID.NULL_28990, new WorldPoint(2802, 3081, 0)), - CASTLE_WARS_BANK(NullObjectID.NULL_28991, new WorldPoint(2444, 3093, 0)), - BARBARIAN_OUTPOST_OBSTACLE_COURSE(NullObjectID.NULL_28992, new WorldPoint(2541, 3550, 0)), - GNOME_STRONGHOLD_BALANCING_ROPE(NullObjectID.NULL_28993, new WorldPoint(2473, 3418, 2)), - OUTSIDE_YANILLE_BANK(NullObjectID.NULL_28994, new WorldPoint(2603, 3091, 0)), - OBSERVATORY(NullObjectID.NULL_28995, new WorldPoint(2439, 3166, 0)), - OGRE_CAGE_IN_KING_LATHAS_TRAINING_CAMP(NullObjectID.NULL_28996, new WorldPoint(2533, 3377, 0)), - DIGSITE(NullObjectID.NULL_28997, new WorldPoint(3370, 3420, 0)), - HICKTONS_ARCHERY_EMPORIUM(NullObjectID.NULL_28998, new WorldPoint(2825, 3441, 0)), - SHANTAY_PASS(NullObjectID.NULL_28999, new WorldPoint(3308, 3125, 0)), - LUMBRIDGE_SWAMP_CAVES(NullObjectID.NULL_29000, new WorldPoint(3222, 9584, 0), new WorldPoint(3167, 9570, 0)), - OUTSIDE_CATHERBY_BANK(NullObjectID.NULL_29001, new WorldPoint(2807, 3437, 0)), - OUTSIDE_THE_SEERS_VILLAGE_COURTHOUSE(NullObjectID.NULL_29002, new WorldPoint(2731, 3475, 0)), - OUTSIDE_HARRYS_FISHING_SHOP_IN_CATHERBY(NullObjectID.NULL_29003, new WorldPoint(2837, 3436, 0)), - TZHAAR_WEAPONS_STORE(NullObjectID.NULL_29004, new WorldPoint(2479, 5146, 0)), - NORTH_OF_EVIL_DAVES_HOUSE_IN_EDGEVILLE(NullObjectID.NULL_29005, new WorldPoint(3077, 3503, 0)), - WEST_OF_THE_SHAYZIEN_COMBAT_RING(NullObjectID.NULL_29006, new WorldPoint(1534, 3591, 0)), - ENTRANCE_OF_THE_ARCEUUS_LIBRARY(NullObjectID.NULL_29007, new WorldPoint(1642, 3809, 0)), - OUTSIDE_DRAYNOR_VILLAGE_JAIL(NullObjectID.NULL_29008, new WorldPoint(3130, 3250, 0)), - CHAOS_TEMPLE_IN_THE_SOUTHEASTERN_WILDERNESS(NullObjectID.NULL_29009, new WorldPoint(3245, 3609, 0)), - FISHING_GUILD_BANK(NullObjectID.NULL_29010, new WorldPoint(2593, 3409, 0)), - TOP_FLOOR_OF_THE_LIGHTHOUSE(NullObjectID.NULL_29011, new WorldPoint(2512, 3640, 2)), - OUTSIDE_THE_GREAT_PYRAMID_OF_SOPHANEM(NullObjectID.NULL_29012, new WorldPoint(3291, 2780, 0)), - NOTERAZZOS_SHOP_IN_THE_WILDERNESS(NullObjectID.NULL_29013, new WorldPoint(3027, 3699, 0)), - WEST_SIDE_OF_THE_KARAMJA_BANANA_PLANTATION(NullObjectID.NULL_29014, new WorldPoint(2909, 3169, 0)), - MOUNTAIN_CAMP_GOAT_ENCLOSURE(NullObjectID.NULL_29015, new WorldPoint(2810, 3677, 0)), - GNOME_GLIDER_ON_WHITE_WOLF_MOUNTAIN(NullObjectID.NULL_29016, new WorldPoint(2849, 3496, 0)), - SHILO_VILLAGE_BANK(NullObjectID.NULL_29017, new WorldPoint(2853, 2952, 0)), - INSIDE_THE_DIGSITE_EXAM_CENTRE(NullObjectID.NULL_29018, new WorldPoint(3356, 3333, 0)), - NORTHEAST_CORNER_OF_THE_KHARAZI_JUNGLE(NullObjectID.NULL_29019, new WorldPoint(2952, 2932, 0)), - VOLCANO_IN_THE_NORTHEASTERN_WILDERNESS(NullObjectID.NULL_29020, new WorldPoint(3368, 3930, 0)), - IN_THE_MIDDLE_OF_JIGGIG(NullObjectID.NULL_29021, new WorldPoint(2478, 3048, 0)), - AGILITY_PYRAMID(NullObjectID.NULL_29022, new WorldPoint(3357, 2830, 0)), - HOSIDIUS_MESS(NullObjectID.NULL_29023, new WorldPoint(1646, 3632, 0)), - CHAPEL_IN_WEST_ARDOUGNE(NullObjectID.NULL_29024, new WorldPoint(2527, 3294, 0)), - NEAR_A_RUNITE_ROCK_IN_THE_FREMENNIK_ISLES(NullObjectID.NULL_29025, new WorldPoint(2374, 3847, 0)), - NEAR_A_LADDER_IN_THE_WILDERNESS_LAVA_MAZE(NullObjectID.NULL_29026, new WorldPoint(3069, 3862, 0)), - ENTRANCE_OF_THE_CAVE_OF_DAMIS(NullObjectID.NULL_29027, new WorldPoint(2629, 5070, 0)), - WARRIORS_GUILD_BANK(NullObjectID.NULL_29028, new WorldPoint(2844, 3537, 0)), - SOUTHEAST_CORNER_OF_THE_MONASTERY(NullObjectID.NULL_29029, new WorldPoint(3056, 3482, 0)), - SOUTHEAST_CORNER_OF_THE_FISHING_PLATFORM(NullObjectID.NULL_29030, new WorldPoint(2787, 3277, 0)), - OUTSIDE_THE_SLAYER_TOWER_GARGOYLE_ROOM(NullObjectID.NULL_29031, new WorldPoint(3423, 3534, 2)), - ON_TOP_OF_TROLLHEIM_MOUNTAIN(NullObjectID.NULL_29032, new WorldPoint(2886, 3676, 0)), - FOUNTAIN_OF_HEROES(NullObjectID.NULL_29033, new WorldPoint(2916, 9891, 0)), - ENTRANCE_OF_THE_CAVERN_UNDER_THE_WHIRLPOOL(NullObjectID.NULL_29034, new WorldPoint(1764, 5367, 1), new WorldPoint(1636, 5367, 1)), - HALFWAY_DOWN_TROLLWEISS_MOUNTAIN(NullObjectID.NULL_29035, new WorldPoint(2782, 3787, 0)), - SHAYZIEN_WAR_TENT(NullObjectID.NULL_29036, new WorldPoint(1550, 3541, 0)), - OUTSIDE_THE_LEGENDS_GUILD_DOOR(NullObjectID.NULL_29037, new WorldPoint(2727, 3371, 0)), - NEAR_THE_GEM_STALL_IN_ARDOUGNE_MARKET(NullObjectID.NULL_29038, new WorldPoint(2672, 3302, 0)), - OUTSIDE_THE_BAR_BY_THE_FIGHT_ARENA(NullObjectID.NULL_29039, new WorldPoint(2571, 3150, 0)), - SOUTHEAST_CORNER_OF_LAVA_DRAGON_ISLE(NullObjectID.NULL_29040, new WorldPoint(3228, 3830, 0)), - NEAR_THE_PIER_IN_ZULANDRA(NullObjectID.NULL_29041, new WorldPoint(2203, 3059, 0)), - BARROWS_CHEST(NullObjectID.NULL_29042, new WorldPoint(3547, 9690, 0)), - WELL_OF_VOYAGE(NullObjectID.NULL_29043, new WorldPoint(2006, 4709, 1)), - NORTHERN_WALL_OF_CASTLE_DRAKAN(NullObjectID.NULL_29044, new WorldPoint(3559, 3385, 1)), - _7TH_CHAMBER_OF_JALSAVRAH(NullObjectID.NULL_29045, new WorldPoint(1951, 4431, 0)), - SOUL_ALTAR(NullObjectID.NULL_29046, new WorldPoint(1810, 3855, 0)), - WARRIORS_GUILD_BANK_29047(NullObjectID.NULL_29047, new WorldPoint(2845, 3545, 0)), - ENTRANA_CHAPEL(NullObjectID.NULL_29048, new WorldPoint(2851, 3355, 0)), - TZHAAR_GEM_STORE(NullObjectID.NULL_29049, new WorldPoint(2466, 5150, 0)), - TENT_IN_LORD_IORWERTHS_ENCAMPMENT(NullObjectID.NULL_29050, new WorldPoint(2198, 3257, 0)), - OUTSIDE_MUDKNUCKLES_HUT(NullObjectID.NULL_29051, new WorldPoint(2959, 3502, 0)), - CENTRE_OF_THE_CATACOMBS_OF_KOUREND(NullObjectID.NULL_29052, new WorldPoint(1661, 10045, 0)), - KING_BLACK_DRAGONS_LAIR(NullObjectID.NULL_29053, new WorldPoint(2286, 4680, 0)), - OUTSIDE_KRIL_TSUTSAROTHS_ROOM(NullObjectID.NULL_29054, new WorldPoint(2931, 5337, 2)), - BY_THE_BEAR_CAGE_IN_VARROCK_PALACE_GARDENS(NullObjectID.NULL_29055, new WorldPoint(3232, 3494, 0)), - OUTSIDE_THE_WILDERNESS_AXE_HUT(NullObjectID.NULL_29056, new WorldPoint(3186, 3958, 0)), - TOP_FLOOR_OF_THE_YANILLE_WATCHTOWER(NullObjectID.NULL_29057, new WorldPoint(2930, 4718, 2)), - DEATH_ALTAR(NullObjectID.NULL_29058, new WorldPoint(2210, 4842, 0)), - BEHIND_MISS_SCHISM_IN_DRAYNOR_VILLAGE(NullObjectID.NULL_29059, new WorldPoint(3095, 3254, 0)), - NORTHWESTERN_CORNER_OF_THE_ENCHANTED_VALLEY(NullObjectID.NULL_29060, new WorldPoint(3022, 4517, 0)), - NORTH_OF_MOUNT_KARUULM(NullObjectID.NULL_34647, new WorldPoint(1308, 3840, 0)), - GYPSY_TENT_ENTRANCE(NullObjectID.NULL_34736, new WorldPoint(3206, 3422, 0)), - FINE_CLOTHES_ENTRANCE(NullObjectID.NULL_34737, new WorldPoint(3209, 3416, 0)), - BOB_AXES_ENTRANCE(NullObjectID.NULL_34738, new WorldPoint(3233, 3200, 0)), - CRYSTALLINE_MAPLE_TREES(NullObjectID.NULL_34953, new WorldPoint(2213, 3427, 0)); - - private final int objectId; - private final WorldPoint[] worldPoints; - - STASHUnit(int objectId, WorldPoint... worldPoints) - { - this.objectId = objectId; - this.worldPoints = worldPoints; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdArea.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdArea.java deleted file mode 100644 index a73bef8900..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdArea.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, 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.cluescrolls.clues.hotcold; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@AllArgsConstructor -@Getter(AccessLevel.PUBLIC) -public enum HotColdArea -{ - ASGARNIA("Asgarnia"), - DESERT("Desert"), - FELDIP_HILLS("Feldip Hills"), - FREMENNIK_PROVINCE("Fremennik Province"), - KANDARIN("Kandarin"), - KARAMJA("Karamja"), - MISTHALIN("Misthalin"), - MORYTANIA("Morytania"), - WESTERN_PROVINCE("Western Province"), - WILDERNESS("Wilderness"), - ZEAH("Zeah"); - - private final String name; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java deleted file mode 100644 index 8a6975abfd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 2018, Eadgars Ruse - * Copyright (c) 2018, Adam - * Copyright (c) 2019, 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.cluescrolls.clues.hotcold; - -import java.awt.Rectangle; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.coords.WorldPoint; -import static net.runelite.client.plugins.cluescrolls.clues.hotcold.HotColdArea.*; - -// The locations contains all hot/cold points and their descriptions according to the wiki -// these central points were obtained by checking wiki location pictures against a coordinate map -// some central points points may be slightly off-center -// calculations are done considering the 9x9 grid around the central point where the strange device shakes -// because the calculations consider the 9x9 grid, slightly off-center points should still be found by the calculations -@AllArgsConstructor -@Getter(AccessLevel.PUBLIC) -public enum HotColdLocation -{ - ASGARNIA_WARRIORS(new WorldPoint(2860, 3562, 0), ASGARNIA, "North of the Warriors' Guild in Burthorpe."), - ASGARNIA_JATIX(new WorldPoint(2914, 3429, 0), ASGARNIA, "East of Jatix's Herblore Shop in Taverley."), - ASGARNIA_BARB(new WorldPoint(3036, 3439, 0), ASGARNIA, "West of Barbarian Village."), - ASGARNIA_MIAZRQA(new WorldPoint(2973, 3489, 0), ASGARNIA, "North of Miazrqa's tower, outside Goblin Village."), - ASGARNIA_COW(new WorldPoint(3033, 3308, 0), ASGARNIA, "In the cow pen north of Sarah's Farming Shop."), - ASGARNIA_PARTY_ROOM(new WorldPoint(3026, 3363, 0), ASGARNIA, "Outside the Falador Party Room."), - ASGARNIA_CRAFT_GUILD(new WorldPoint(2917, 3295, 0), ASGARNIA, "Outside the Crafting Guild cow pen."), - ASGARNIA_RIMMINGTON(new WorldPoint(2978, 3241, 0), ASGARNIA, "In the centre of the Rimmington mine."), - ASGARNIA_MUDSKIPPER(new WorldPoint(2984, 3109, 0), ASGARNIA, "Mudskipper Point, on the starfish in the south-west corner."), - ASGARNIA_TROLL(new WorldPoint(2910, 3616, 0), ASGARNIA, "The Troll arena, where the player fights Dad during the Troll Stronghold quest. Bring climbing boots if travelling from Burthorpe."), - DESERT_GENIE(new WorldPoint(3364, 2910, 0), DESERT, "West of Nardah genie cave."), - DESERT_ALKHARID_MINE(new WorldPoint(3282, 3270, 0), DESERT, "West of Al Kharid mine."), - DESERT_MENAPHOS_GATE(new WorldPoint(3224, 2816, 0), DESERT, "North of Menaphos gate."), - DESERT_BEDABIN_CAMP(new WorldPoint(3164, 3050, 0), DESERT, "Bedabin Camp, dig around the north tent."), - DESERT_UZER(new WorldPoint(3431, 3106, 0), DESERT, "West of Uzer."), - DESERT_POLLNIVNEACH(new WorldPoint(3287, 2975, 0), DESERT, "West of Pollnivneach."), - DESERT_MTA(new WorldPoint(3350, 3293, 0), DESERT, "Next to Mage Training Arena."), - DESERT_SHANTY(new WorldPoint(3294, 3106, 0), DESERT, "South-west of Shantay Pass."), - DRAYNOR_MANOR_MUSHROOMS(true, new WorldPoint(3096, 3379, 0), MISTHALIN, "Patch of mushrooms just northwest of Draynor Manor"), - DRAYNOR_WHEAT_FIELD(true, new WorldPoint(3120, 3282, 0), MISTHALIN, "Inside the wheat field next to Draynor Village"), - FELDIP_HILLS_JIGGIG(new WorldPoint(2413, 3055, 0), FELDIP_HILLS, "West of Jiggig, east of the fairy ring bkp."), - FELDIP_HILLS_SW(new WorldPoint(2582, 2895, 0), FELDIP_HILLS, "West of the southeasternmost lake in Feldip Hills."), - FELDIP_HILLS_GNOME_GLITER(new WorldPoint(2553, 2972, 0), FELDIP_HILLS, "East of the gnome glider (Lemantolly Undri)."), - FELDIP_HILLS_RANTZ(new WorldPoint(2611, 2946, 0), FELDIP_HILLS, "South of Rantz, six steps west of the empty glass bottles."), - FELDIP_HILLS_SOUTH(new WorldPoint(2487, 3005, 0), FELDIP_HILLS, "South of Jiggig."), - FELDIP_HILLS_RED_CHIN(new WorldPoint(2532, 2900, 0), FELDIP_HILLS, "Outside the red chinchompa hunting ground entrance, south of the Hunting expert's hut."), - FELDIP_HILLS_SE(new WorldPoint(2567, 2916, 0), FELDIP_HILLS, "South-east of the ∩-shaped lake, near the icon."), - FELDIP_HILLS_CW_BALLOON(new WorldPoint(2452, 3108, 0), FELDIP_HILLS, "Directly west of the Castle Wars balloon."), - FREMENNIK_PROVINCE_MTN_CAMP(new WorldPoint(2804, 3672, 0), FREMENNIK_PROVINCE, "At the Mountain Camp."), - FREMENNIK_PROVINCE_RELLEKKA_HUNTER(new WorldPoint(2724, 3783, 0), FREMENNIK_PROVINCE, "At the Rellekka Hunter area, near the icon."), - FREMENNIK_PROVINCE_KELGADRIM_ENTRANCE(new WorldPoint(2715, 3689, 0), FREMENNIK_PROVINCE, "West of the Keldagrim entrance mine."), - FREMENNIK_PROVINCE_SW(new WorldPoint(2605, 3648, 0), FREMENNIK_PROVINCE, "Outside the fence in the south-western corner of Rellekka."), - FREMENNIK_PROVINCE_LIGHTHOUSE(new WorldPoint(2589, 3598, 0), FREMENNIK_PROVINCE, "South-east of the Lighthouse."), - FREMENNIK_PROVINCE_ETCETERIA_CASTLE(new WorldPoint(2614, 3867, 0), FREMENNIK_PROVINCE, "Inside Etceteria's castle, in the southern staircase."), - FREMENNIK_PROVINCE_MISC_COURTYARD(new WorldPoint(2529, 3867, 0), FREMENNIK_PROVINCE, "Outside Miscellania's courtyard."), - FREMENNIK_PROVINCE_FREMMY_ISLES_MINE(new WorldPoint(2378, 3849, 0), FREMENNIK_PROVINCE, "Central Fremennik Isles mine."), - FREMENNIK_PROVINCE_WEST_ISLES_MINE(new WorldPoint(2313, 3854, 0), FREMENNIK_PROVINCE, "West Fremennik Isles mine."), - FREMENNIK_PROVINCE_WEST_JATIZSO_ENTRANCE(new WorldPoint(2391, 3813, 0), FREMENNIK_PROVINCE, "West of the Jatizso mine entrance."), - FREMENNIK_PROVINCE_PIRATES_COVE(new WorldPoint(2210, 3814, 0), FREMENNIK_PROVINCE, "Pirates' Cove"), - FREMENNIK_PROVINCE_ASTRAL_ALTER(new WorldPoint(2147, 3862, 0), FREMENNIK_PROVINCE, "Astral altar"), - FREMENNIK_PROVINCE_LUNAR_VILLAGE(new WorldPoint(2087, 3915, 0), FREMENNIK_PROVINCE, "Lunar Isle, inside the village."), - FREMENNIK_PROVINCE_LUNAR_NORTH(new WorldPoint(2106, 3949, 0), FREMENNIK_PROVINCE, "Lunar Isle, north of the village."), - ICE_MOUNTAIN(true, new WorldPoint(3007, 3475, 0), MISTHALIN, "Atop Ice Mountain"), - KANDARIN_SINCLAR_MANSION(new WorldPoint(2726, 3588, 0), KANDARIN, "North-west of the Sinclair Mansion, near the log balance shortcut."), - KANDARIN_CATHERBY(new WorldPoint(2774, 3433, 0), KANDARIN, "Catherby, between the bank and the beehives, near small rock formation."), - KANDARIN_GRAND_TREE(new WorldPoint(2444, 3503, 0), KANDARIN, "Grand Tree, just east of the terrorchick gnome enclosure."), - KANDARIN_SEERS(new WorldPoint(2735, 3486, 0), KANDARIN, "Between the Seers' Village bank and Camelot."), - KANDARIN_MCGRUBORS_WOOD(new WorldPoint(2653, 3485, 0), KANDARIN, "McGrubor's Wood"), - KANDARIN_FISHING_BUILD(new WorldPoint(2586, 3372, 0), KANDARIN, "South of Fishing Guild"), - KANDARIN_WITCHHAVEN(new WorldPoint(2708, 3304, 0), KANDARIN, "Outside Witchaven, west of Jeb, Holgart, and Caroline."), - KANDARIN_NECRO_TOWER(new WorldPoint(2669, 3242, 0), KANDARIN, "Ground floor inside the Necromancer Tower. Easily accessed by using fairy ring code djp."), - KANDARIN_FIGHT_ARENA(new WorldPoint(2587, 3134, 0), KANDARIN, "South of the Fight Arena, north-west of the Nightmare Zone."), - KANDARIN_TREE_GNOME_VILLAGE(new WorldPoint(2526, 3160, 0), KANDARIN, "Tree Gnome Village, near the general store icon."), - KANDARIN_GRAVE_OF_SCORPIUS(new WorldPoint(2464, 3228, 0), KANDARIN, "Grave of Scorpius"), - KANDARIN_KHAZARD_BATTLEFIELD(new WorldPoint(2518, 3249, 0), KANDARIN, "Khazard Battlefield, in the small ruins south of tracker gnome 2."), - KANDARIN_WEST_ARDY(new WorldPoint(2533, 3320, 0), KANDARIN, "West Ardougne, near the staircase outside the Civic Office."), - KANDARIN_SW_TREE_GNOME_STRONGHOLD(new WorldPoint(2411, 3431, 0), KANDARIN, "South-west Tree Gnome Stronghold"), - KANDARIN_OUTPOST(new WorldPoint(2458, 3364, 0), KANDARIN, "South of the Tree Gnome Stronghold, north-east of the Outpost."), - KANDARIN_BAXTORIAN_FALLS(new WorldPoint(2534, 3479, 0), KANDARIN, "South-east of Almera's house on Baxtorian Falls."), - KANDARIN_BA_AGILITY_COURSE(new WorldPoint(2536, 3546, 0), KANDARIN, "Inside the Barbarian Agility Course. Completion of Alfred Grimhand's Barcrawl is required."), - KARAMJA_MUSA_POINT(new WorldPoint(2914, 3168, 0), KARAMJA, "Musa Point, banana plantation."), - KARAMJA_BRIMHAVEN_FRUIT_TREE(new WorldPoint(2783, 3214, 0), KARAMJA, "Brimhaven, east of the fruit tree patch."), - KARAMJA_WEST_BRIMHAVEN(new WorldPoint(2721, 3169, 0), KARAMJA, "West of Brimhaven."), - KARAMJA_GLIDER(new WorldPoint(2966, 2975, 0), KARAMJA, "West of the gnome glider."), - KARAMJA_KHARAZI_NE(new WorldPoint(2904, 2925, 0), KARAMJA, "North-eastern part of Kharazi Jungle."), - KARAMJA_KHARAZI_SW(new WorldPoint(2783, 2898, 0), KARAMJA, "South-western part of Kharazi Jungle."), - KARAMJA_CRASH_ISLAND(new WorldPoint(2910, 2737, 0), KARAMJA, "Northern part of Crash Island."), - LUMBRIDGE_COW_FIELD(true, new WorldPoint(3174, 3336, 0), MISTHALIN, "Cow field north of Lumbridge"), - MISTHALIN_VARROCK_STONE_CIRCLE(new WorldPoint(3225, 3355, 0), MISTHALIN, "South of the stone circle near Varrock's entrance."), - MISTHALIN_LUMBRIDGE(new WorldPoint(3238, 3169, 0), MISTHALIN, "Just north-west of the Lumbridge Fishing tutor."), - MISTHALIN_LUMBRIDGE_2(new WorldPoint(3170, 3278, 0), MISTHALIN, "North of the pond between Lumbridge and Draynor Village."), - MISTHALIN_GERTUDES(new WorldPoint(3158, 3421, 0), MISTHALIN, "North-east of Gertrude's house west of Varrock."), - MISTHALIN_DRAYNOR_BANK(new WorldPoint(3096, 3235, 0), MISTHALIN, "South of Draynor Village bank."), - MISTHALIN_LUMBER_YARD(new WorldPoint(3303, 3483, 0), MISTHALIN, "South of Lumber Yard, east of Assistant Serf."), - MORYTANIA_BURGH_DE_ROTT(new WorldPoint(3545, 3253, 0), MORYTANIA, "In the north-east area of Burgh de Rott, by the reverse-L-shaped ruins."), - MORYTANIA_PORT_PHASMATYS(new WorldPoint(3613, 3485, 0), MORYTANIA, "West of Port Phasmatys, south-east of fairy ring."), - MORYTANIA_HOLLOWS(new WorldPoint(3500, 3423, 0), MORYTANIA, "Inside The Hollows, south of the bridge which was repaired in a quest."), - MORYTANIA_SWAMP(new WorldPoint(3422, 3374, 0), MORYTANIA, "Inside the Mort Myre Swamp, north-west of the Nature Grotto."), - MORYTANIA_HAUNTED_MINE(new WorldPoint(3441, 3259, 0), MORYTANIA, "At Haunted Mine quest start."), - MORYTANIA_MAUSOLEUM(new WorldPoint(3499, 3539, 0), MORYTANIA, "South of the Mausoleum."), - MORYTANIA_MOS_LES_HARMLESS(new WorldPoint(3744, 3041, 0), MORYTANIA, "Northern area of Mos Le'Harmless, between the lakes."), - MORYTANIA_MOS_LES_HARMLESS_BAR(new WorldPoint(3670, 2974, 0), MORYTANIA, "Near Mos Le'Harmless southern bar."), - MORYTANIA_DRAGONTOOTH_NORTH(new WorldPoint(3813, 3567, 0), MORYTANIA, "Northern part of Dragontooth Island."), - MORYTANIA_DRAGONTOOTH_SOUTH(new WorldPoint(3803, 3532, 0), MORYTANIA, "Southern part of Dragontooth Island."), - NORTHEAST_OF_AL_KHARID_MINE(true, new WorldPoint(3332, 3313, 0), MISTHALIN, "Northeast of Al Kharid Mine"), - WESTERN_PROVINCE_EAGLES_PEAK(new WorldPoint(2297, 3530, 0), WESTERN_PROVINCE, "North-west of Eagles' Peak."), - WESTERN_PROVINCE_PISCATORIS(new WorldPoint(2337, 3689, 0), WESTERN_PROVINCE, "Piscatoris Fishing Colony"), - WESTERN_PROVINCE_PISCATORIS_HUNTER_AREA(new WorldPoint(2359, 3564, 0), WESTERN_PROVINCE, "Eastern part of Piscatoris Hunter area, south-west of the Falconry."), - WESTERN_PROVINCE_ARANDAR(new WorldPoint(2366, 3318, 0), WESTERN_PROVINCE, "South-west of the crystal gate to Arandar."), - WESTERN_PROVINCE_ELF_CAMP_EAST(new WorldPoint(2270, 3244, 0), WESTERN_PROVINCE, "East of Iorwerth Camp."), - WESTERN_PROVINCE_ELF_CAMP_NW(new WorldPoint(2174, 3280, 0), WESTERN_PROVINCE, "North-west of Iorwerth Camp."), - WESTERN_PROVINCE_LLETYA(new WorldPoint(2335, 3166, 0), WESTERN_PROVINCE, "In Lletya."), - WESTERN_PROVINCE_TYRAS(new WorldPoint(2204, 3157, 0), WESTERN_PROVINCE, "Near Tyras Camp."), - WESTERN_PROVINCE_ZULANDRA(new WorldPoint(2196, 3057, 0), WESTERN_PROVINCE, "The northern house at Zul-Andra."), - WILDERNESS_5(new WorldPoint(3173, 3556, 0), WILDERNESS, "North of the Grand Exchange, level 5 Wilderness."), - WILDERNESS_12(new WorldPoint(3038, 3612, 0), WILDERNESS, "South-east of the Dark Warriors' Fortress, level 12 Wilderness."), - WILDERNESS_20(new WorldPoint(3225, 3676, 0), WILDERNESS, "East of the Corporeal Beast's lair, level 20 Wilderness."), - WILDERNESS_27(new WorldPoint(3174, 3735, 0), WILDERNESS, "Inside the Ruins north of the Graveyard of Shadows, level 27 Wilderness."), - WILDERNESS_28(new WorldPoint(3374, 3734, 0), WILDERNESS, "East of Venenatis' nest, level 28 Wilderness."), - WILDERNESS_32(new WorldPoint(3311, 3773, 0), WILDERNESS, "North of Venenatis' nest, level 32 Wilderness."), - WILDERNESS_35(new WorldPoint(3153, 3795, 0), WILDERNESS, "East of the Wilderness canoe exit, level 35 Wilderness."), - WILDERNESS_37(new WorldPoint(2975, 3811, 0), WILDERNESS, "South-east of the Chaos Temple, level 37 Wilderness."), - WILDERNESS_38(new WorldPoint(3293, 3813, 0), WILDERNESS, "South of Callisto, level 38 Wilderness."), - WILDERNESS_49(new WorldPoint(3140, 3910, 0), WILDERNESS, "South-west of the Deserted Keep, level 49 Wilderness."), - WILDERNESS_54(new WorldPoint(2983, 3946, 0), WILDERNESS, "West of the Wilderness Agility Course, level 54 Wilderness."), - ZEAH_BLASTMINE_BANK(new WorldPoint(1507, 3856, 0), ZEAH, "Next to the bank in the Lovakengj blast mine."), - ZEAH_BLASTMINE_NORTH(new WorldPoint(1488, 3881, 0), ZEAH, "Northern part of the Lovakengj blast mine."), - ZEAH_LOVAKITE_FURNACE(new WorldPoint(1507, 3819, 0), ZEAH, "Next to the lovakite furnace in Lovakengj."), - ZEAH_LOVAKENGJ_MINE(new WorldPoint(1477, 3779, 0), ZEAH, "Next to mithril rock in the Lovakengj mine."), - ZEAH_SULPHR_MINE(new WorldPoint(1428, 3866, 0), ZEAH, "Western entrance in the Lovakengj sulphur mine."), - ZEAH_SHAYZIEN_BANK(new WorldPoint(1517, 3603, 0), ZEAH, "South-east of the bank in Shayzien."), - ZEAH_OVERPASS(new WorldPoint(1467, 3714, 0), ZEAH, "Overpass between Lovakengj and Shayzien."), - ZEAH_LIZARDMAN(new WorldPoint(1493, 3694, 0), ZEAH, "Within Lizardman Canyon, east of the ladder. Requires 5% favour with Shayzien."), - ZEAH_COMBAT_RING(new WorldPoint(1557, 3580, 0), ZEAH, "Shayzien, south-east of the Combat Ring."), - ZEAH_SHAYZIEN_BANK_2(new WorldPoint(1494, 3622, 0), ZEAH, "North-west of the bank in Shayzien."), - ZEAH_LIBRARY(new WorldPoint(1601, 3842, 0), ZEAH, "North-west of the Arceuus Library."), - ZEAH_HOUSECHURCH(new WorldPoint(1682, 3792, 0), ZEAH, "By the entrance to the Arceuus church."), - ZEAH_DARK_ALTAR(new WorldPoint(1699, 3879, 0), ZEAH, "West of the Dark Altar."), - ZEAH_ARCEUUS_HOUSE(new WorldPoint(1708, 3701, 0), ZEAH, "By the southern entrance to Arceuus."), - ZEAH_ESSENCE_MINE(new WorldPoint(1762, 3852, 0), ZEAH, "By the Arceuus essence mine."), - ZEAH_ESSENCE_MINE_NE(new WorldPoint(1772, 3866, 0), ZEAH, "North-east of the Arceuus essence mine."), - ZEAH_PISCARILUS_MINE(new WorldPoint(1768, 3705, 0), ZEAH, "South of the Piscarilius mine."), - ZEAH_GOLDEN_FIELD_TAVERN(new WorldPoint(1718, 3647, 0), ZEAH, "South of The Golden Field tavern in the northern area of Hosidius."), - ZEAH_MESS_HALL(new WorldPoint(1658, 3621, 0), ZEAH, "East of the Mess hall."), - ZEAH_WATSONS_HOUSE(new WorldPoint(1653, 3573, 0), ZEAH, "East of Watson's house."), - ZEAH_VANNAHS_FARM_STORE(new WorldPoint(1806, 3521, 0), ZEAH, "North of Vannah's Farm Store, between the chicken coop and willow trees."), - ZEAH_FARMING_GUILD_W(new WorldPoint(1208, 3736, 0), ZEAH, "West of the Farming Guild."), - ZEAH_DAIRY_COW(new WorldPoint(1320, 3718, 0), ZEAH, "North-east of the Kebos Lowlands, east of the dairy cow."), - ZEAH_CRIMSON_SWIFTS(new WorldPoint(1186, 3583, 0), ZEAH, "South-west of the Kebos Swamp, below the crimson swifts."); - - private final boolean beginnerClue; - private final WorldPoint worldPoint; - private final HotColdArea hotColdArea; - private final String area; - - HotColdLocation(WorldPoint worldPoint, HotColdArea hotColdArea, String areaDescription) - { - this(false, worldPoint, hotColdArea, areaDescription); - } - - public Rectangle getRect() - { - final int digRadius = beginnerClue ? HotColdTemperature.BEGINNER_VISIBLY_SHAKING.getMaxDistance() : - HotColdTemperature.MASTER_VISIBLY_SHAKING.getMaxDistance(); - return new Rectangle(worldPoint.getX() - digRadius, worldPoint.getY() - digRadius, digRadius * 2 + 1, digRadius * 2 + 1); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdSolver.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdSolver.java deleted file mode 100644 index 1169e2f6c7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdSolver.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2018, Eadgars Ruse - * Copyright (c) 2019, 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.cluescrolls.clues.hotcold; - -import com.google.common.annotations.VisibleForTesting; -import java.awt.Rectangle; -import java.util.Set; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.coords.WorldPoint; - -/** - * Solution finder for hot-cold style puzzles. - *

- * These puzzles are established by having some way to test the distance from the solution via "warmth", where being - * colder means one is farther away from the target, and being warmer means one is closer to it, with the goal being to - * reach the most warm value to discover the solution point. Hot-cold puzzles in Old School RuneScape are implemented - * with specific set of solution points, so this solver will filter from a provided set of possible solutions as new - * signals of temperatures and temperature changes are provided. - */ -@Getter(AccessLevel.PUBLIC) -public class HotColdSolver -{ - private final Set possibleLocations; - @Nullable - private WorldPoint lastWorldPoint; - - public HotColdSolver(Set possibleLocations) - { - this.possibleLocations = possibleLocations; - } - - /** - * Process a hot-cold update given a {@link WorldPoint} where a check occurred and the resulting temperature and - * temperature change discovered at that point. This will filter the set of possible locations which can be the - * solution. - * - * @param worldPoint The point where a hot-cold check occurred - * @param temperature The temperature of the checked point - * @param temperatureChange The change of temperature of the checked point compared to the previously-checked point - * @return A set of {@link HotColdLocation}s which are still possible after the filtering occurs. This return value - * is the same as would be returned by {@code getPossibleLocations()}. - */ - public Set signal(@Nonnull final WorldPoint worldPoint, @Nonnull final HotColdTemperature temperature, @Nullable final HotColdTemperatureChange temperatureChange) - { - // when the strange device reads a temperature, that means that the center of the final dig location - // is a range of squares away from the player's current location (Chebyshev AKA Chess-board distance) - int maxSquaresAway = temperature.getMaxDistance(); - int minSquaresAway = temperature.getMinDistance(); - - // maxDistanceArea encompasses all of the points that are within the max possible distance from the player - final Rectangle maxDistanceArea = new Rectangle( - worldPoint.getX() - maxSquaresAway, - worldPoint.getY() - maxSquaresAway, - 2 * maxSquaresAway + 1, - 2 * maxSquaresAway + 1); - // minDistanceArea encompasses all of the points that are within the min possible distance from the player - final Rectangle minDistanceArea = new Rectangle( - worldPoint.getX() - minSquaresAway, - worldPoint.getY() - minSquaresAway, - 2 * minSquaresAway + 1, - 2 * minSquaresAway + 1); - - // eliminate from consideration dig spots that lie entirely within the min range or entirely outside of the max range - possibleLocations.removeIf(entry -> minDistanceArea.contains(entry.getRect()) || !maxDistanceArea.intersects(entry.getRect())); - - // if a previous world point has been recorded, we can consider the warmer/colder result from the strange device - if (lastWorldPoint != null && temperatureChange != null) - { - switch (temperatureChange) - { - case COLDER: - // eliminate spots that are absolutely warmer - possibleLocations.removeIf(entry -> isFirstPointCloserRect(worldPoint, lastWorldPoint, entry.getRect())); - break; - case WARMER: - // eliminate spots that are absolutely colder - possibleLocations.removeIf(entry -> isFirstPointCloserRect(lastWorldPoint, worldPoint, entry.getRect())); - break; - case SAME: - // I couldn't figure out a clean implementation for this case - // not necessary for quickly determining final location - } - } - - lastWorldPoint = worldPoint; - return getPossibleLocations(); - } - - /** - * Determines whether the first point passed is closer to each corner of the given rectangle than the second point. - * - * @param firstPoint First point to test. Return result will be relating to this point's location. - * @param secondPoint Second point to test - * @param rect Rectangle, whose corner points will be compared to the first and second points passed - * @return {@code true} if {@code firstPoint} is closer to each of {@code rect}'s four corner points than - * {@code secondPoint}, {@code false} otherwise. - * @see WorldPoint#distanceTo2D - */ - @VisibleForTesting - private static boolean isFirstPointCloserRect(final WorldPoint firstPoint, final WorldPoint secondPoint, final Rectangle rect) - { - final WorldPoint nePoint = new WorldPoint((rect.x + rect.width), (rect.y + rect.height), 0); - - if (!isFirstPointCloser(firstPoint, secondPoint, nePoint)) - { - return false; - } - - final WorldPoint sePoint = new WorldPoint((rect.x + rect.width), rect.y, 0); - - if (!isFirstPointCloser(firstPoint, secondPoint, sePoint)) - { - return false; - } - - final WorldPoint nwPoint = new WorldPoint(rect.x, (rect.y + rect.height), 0); - - if (!isFirstPointCloser(firstPoint, secondPoint, nwPoint)) - { - return false; - } - - final WorldPoint swPoint = new WorldPoint(rect.x, rect.y, 0); - return (isFirstPointCloser(firstPoint, secondPoint, swPoint)); - } - - /** - * Determines whether the first point passed is closer to the given point of comparison than the second point. - * - * @param firstPoint First point to test. Return result will be relating to this point's location. - * @param secondPoint Second point to test - * @param worldPoint Point to compare to the first and second points passed - * @return {@code true} if {@code firstPoint} is closer to {@code worldPoint} than {@code secondPoint}, - * {@code false} otherwise. - * @see WorldPoint#distanceTo2D - */ - @VisibleForTesting - private static boolean isFirstPointCloser(final WorldPoint firstPoint, final WorldPoint secondPoint, final WorldPoint worldPoint) - { - return firstPoint.distanceTo2D(worldPoint) < secondPoint.distanceTo2D(worldPoint); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperature.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperature.java deleted file mode 100644 index 923da763e3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperature.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2019, 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.cluescrolls.clues.hotcold; - -import com.google.common.collect.Sets; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.Set; -import javax.annotation.Nullable; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.util.Text; - -@AllArgsConstructor -@Getter(AccessLevel.PUBLIC) -public enum HotColdTemperature -{ - ICE_COLD("ice cold", 500, 5000), - VERY_COLD("very cold", 200, 499), - COLD("cold", 150, 199), - WARM("warm", 100, 149), - HOT("hot", 70, 99), - VERY_HOT("very hot", 30, 69), - BEGINNER_INCREDIBLY_HOT("incredibly hot", 4, 29), - BEGINNER_VISIBLY_SHAKING("visibly shaking", 0, 3), - MASTER_INCREDIBLY_HOT("incredibly hot", 5, 29), - MASTER_VISIBLY_SHAKING("visibly shaking", 0, 4); - - public static final Set BEGINNER_HOT_COLD_TEMPERATURES = Sets.immutableEnumSet( - ICE_COLD, - VERY_COLD, - COLD, - WARM, - HOT, - VERY_HOT, - BEGINNER_INCREDIBLY_HOT, - BEGINNER_VISIBLY_SHAKING - ); - public static final Set MASTER_HOT_COLD_TEMPERATURES = Sets.immutableEnumSet( - ICE_COLD, - VERY_COLD, - COLD, - WARM, - HOT, - VERY_HOT, - MASTER_INCREDIBLY_HOT, - MASTER_VISIBLY_SHAKING - ); - - private final String text; - private final int minDistance; - private final int maxDistance; - - private static final String DEVICE_USED_START_TEXT = "The device is "; - - /** - * Gets the temperature from a set of temperatures corresponding to the passed string. - * - * @param temperatureSet A set of temperature values to select from - * @param message A string containing a temperature value - * @return The corresponding enum from the given temperature set. - *

- * Note that in cases where two temperature values in the given set are equally likely to be the given - * temperature (say, two temperatures with identical text values), the behavior is undefined. - */ - @Nullable - public static HotColdTemperature getFromTemperatureSet(final Set temperatureSet, final String message) - { - if (!message.startsWith(DEVICE_USED_START_TEXT) || temperatureSet == null) - { - return null; - } - - final String messageStart = Text.fromCSV(message).get(0); - final List possibleTemperatures = new ArrayList<>(); - - for (final HotColdTemperature temperature : temperatureSet) - { - if (messageStart.contains(temperature.getText())) - { - possibleTemperatures.add(temperature); - } - } - - return possibleTemperatures.stream() - // For messages such as "The device is very cold", this will choose the Enum with text of greatest length so - // that VERY_COLD would be selected over COLD, though both Enums have matching text for this message. - .max(Comparator.comparingInt(x -> (x.getText()).length())) - .orElse(null); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperatureChange.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperatureChange.java deleted file mode 100644 index e9077bc9e1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperatureChange.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2019, 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.cluescrolls.clues.hotcold; - -import lombok.AllArgsConstructor; - -@AllArgsConstructor -public enum HotColdTemperatureChange -{ - WARMER("and warmer than"), - SAME("and the same temperature as"), - COLDER("but colder than"); - - private final String text; - - public static HotColdTemperatureChange of(final String message) - { - if (!message.endsWith(" last time.")) - { - return null; - } - - for (final HotColdTemperatureChange change : values()) - { - if (message.contains(change.text)) - { - return change; - } - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/AllRequirementsCollection.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/AllRequirementsCollection.java deleted file mode 100644 index bfe7a773ab..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/AllRequirementsCollection.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls.clues.item; - -import net.runelite.api.Client; -import net.runelite.api.Item; - -public class AllRequirementsCollection implements ItemRequirement -{ - private final String name; - private final ItemRequirement[] requirements; - - public AllRequirementsCollection(final String name, final ItemRequirement... requirements) - { - this.name = name; - this.requirements = requirements; - } - - public AllRequirementsCollection(final ItemRequirement... requirements) - { - this("N/A", requirements); - } - - @Override - public boolean fulfilledBy(final int itemId) - { - for (ItemRequirement requirement : requirements) - { - if (requirement.fulfilledBy(itemId)) - { - return true; - } - } - - return false; - } - - @Override - public boolean fulfilledBy(final Item[] items) - { - for (ItemRequirement requirement : requirements) - { - if (!requirement.fulfilledBy(items)) - { - return false; - } - } - - return true; - } - - @Override - public String getCollectiveName(final Client client) - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/AnyRequirementCollection.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/AnyRequirementCollection.java deleted file mode 100644 index ae223285c5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/AnyRequirementCollection.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls.clues.item; - -import net.runelite.api.Client; -import net.runelite.api.Item; - -public class AnyRequirementCollection implements ItemRequirement -{ - private final String name; - private final ItemRequirement[] requirements; - - public AnyRequirementCollection(String name, ItemRequirement... requirements) - { - this.name = name; - this.requirements = requirements; - } - - @Override - public boolean fulfilledBy(int itemId) - { - for (ItemRequirement requirement : requirements) - { - if (requirement.fulfilledBy(itemId)) - { - return true; - } - } - - return false; - } - - @Override - public boolean fulfilledBy(Item[] items) - { - for (ItemRequirement requirement : requirements) - { - if (requirement.fulfilledBy(items)) - { - return true; - } - } - - return false; - } - - @Override - public String getCollectiveName(Client client) - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/ItemRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/ItemRequirement.java deleted file mode 100644 index 0f55c90c28..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/ItemRequirement.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls.clues.item; - -import net.runelite.api.Client; -import net.runelite.api.Item; - -public interface ItemRequirement -{ - boolean fulfilledBy(int itemId); - - boolean fulfilledBy(Item[] items); - - String getCollectiveName(Client client); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/ItemRequirements.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/ItemRequirements.java deleted file mode 100644 index c97fd5cf97..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/ItemRequirements.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls.clues.item; - -import net.runelite.api.EquipmentInventorySlot; - -public class ItemRequirements -{ - public static SingleItemRequirement item(int itemId) - { - return new SingleItemRequirement(itemId); - } - - public static RangeItemRequirement range(int startItemId, int endItemId) - { - return range(null, startItemId, endItemId); - } - - public static RangeItemRequirement range(String name, int startItemId, int endItemId) - { - return new RangeItemRequirement(name, startItemId, endItemId); - } - - public static AnyRequirementCollection any(String name, ItemRequirement... requirements) - { - return new AnyRequirementCollection(name, requirements); - } - - public static AllRequirementsCollection all(ItemRequirement... requirements) - { - return new AllRequirementsCollection(requirements); - } - - public static AllRequirementsCollection all(String name, ItemRequirement... requirements) - { - return new AllRequirementsCollection(name, requirements); - } - - public static SlotLimitationRequirement emptySlot(String description, EquipmentInventorySlot... slots) - { - return new SlotLimitationRequirement(description, slots); - } - - public static MultipleOfItemRequirement xOfItem(int itemId, int quantity) - { - return new MultipleOfItemRequirement(itemId, quantity); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/MultipleOfItemRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/MultipleOfItemRequirement.java deleted file mode 100644 index 152840c027..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/MultipleOfItemRequirement.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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.cluescrolls.clues.item; - -import net.runelite.api.Client; -import net.runelite.api.Item; -import net.runelite.api.ItemDefinition; - -public class MultipleOfItemRequirement implements ItemRequirement -{ - private final int itemId; - private final int quantity; - - public MultipleOfItemRequirement(int itemId, int quantity) - { - this.itemId = itemId; - this.quantity = quantity; - } - - @Override - public boolean fulfilledBy(int itemId) - { - return itemId == this.itemId && this.quantity == 1; - } - - @Override - public boolean fulfilledBy(Item[] items) - { - int quantityFound = 0; - for (Item item : items) - { - if (item.getId() == itemId) - { - quantityFound += item.getQuantity(); - if (quantityFound >= quantity) - { - return true; - } - } - } - - return false; - } - - @Override - public String getCollectiveName(Client client) - { - ItemDefinition definition = client.getItemDefinition(itemId); - - if (definition == null) - { - return "N/A"; - } - - return definition.getName() + " x" + this.quantity; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/RangeItemRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/RangeItemRequirement.java deleted file mode 100644 index ef81ced371..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/RangeItemRequirement.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls.clues.item; - -import net.runelite.api.Client; -import net.runelite.api.Item; - -public class RangeItemRequirement implements ItemRequirement -{ - private final String name; - private final int startItemId; - private final int endItemId; - - public RangeItemRequirement(String name, int startItemId, int endItemId) - { - this.name = name; - this.startItemId = startItemId; - this.endItemId = endItemId; - } - - @Override - public boolean fulfilledBy(int itemId) - { - return itemId >= startItemId && itemId <= endItemId; - } - - @Override - public boolean fulfilledBy(Item[] items) - { - for (Item item : items) - { - if (item.getId() >= startItemId && item.getId() <= endItemId) - { - return true; - } - } - - return false; - } - - @Override - public String getCollectiveName(Client client) - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/SingleItemRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/SingleItemRequirement.java deleted file mode 100644 index 7c1e02e6e0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/SingleItemRequirement.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls.clues.item; - -import net.runelite.api.Client; -import net.runelite.api.Item; -import net.runelite.api.ItemDefinition; - -public class SingleItemRequirement implements ItemRequirement -{ - private final int itemId; - - public SingleItemRequirement(int itemId) - { - this.itemId = itemId; - } - - @Override - public boolean fulfilledBy(int itemId) - { - return this.itemId == itemId; - } - - @Override - public boolean fulfilledBy(Item[] items) - { - for (Item item : items) - { - if (item.getId() == itemId) - { - return true; - } - } - - return false; - } - - @Override - public String getCollectiveName(Client client) - { - ItemDefinition definition = client.getItemDefinition(itemId); - - if (definition == null) - { - return "N/A"; - } - - return definition.getName(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/SlotLimitationRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/SlotLimitationRequirement.java deleted file mode 100644 index f52f0ee19d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/item/SlotLimitationRequirement.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.cluescrolls.clues.item; - -import net.runelite.api.Client; -import net.runelite.api.EquipmentInventorySlot; -import net.runelite.api.Item; - -public class SlotLimitationRequirement implements ItemRequirement -{ - private final String description; - private final EquipmentInventorySlot[] slots; - - public SlotLimitationRequirement(String description, EquipmentInventorySlot... slots) - { - this.description = description; - this.slots = slots; - } - - @Override - public boolean fulfilledBy(int itemId) - { - return false; - } - - @Override - public boolean fulfilledBy(Item[] items) - { - for (EquipmentInventorySlot slot : slots) - { - if (slot.getSlotIdx() >= items.length) - { - continue; //We can't check the slot, because there is nothing in it, the array hasn't been resized - } - - if (items[slot.getSlotIdx()].getId() != -1) - { - return false; - } - } - - return true; - } - - @Override - public String getCollectiveName(Client client) - { - return description; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/CombatCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/CombatCounter.java deleted file mode 100644 index 415aed3e9d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/CombatCounter.java +++ /dev/null @@ -1,677 +0,0 @@ -/* - * Copyright (c) 2017, Devin French - * 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.combatcounter; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.inject.Provides; -import java.awt.Color; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Actor; -import static net.runelite.api.AnimationID.BARRAGE_ANIMATION; -import static net.runelite.api.AnimationID.BLOWPIPE_ATTACK; -import static net.runelite.api.AnimationID.CHIN_ANIMATION; -import net.runelite.api.Client; -import net.runelite.api.Hitsplat; -import net.runelite.api.NPC; -import net.runelite.api.NPCDefinition; -import net.runelite.api.Player; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.AnimationChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.HitsplatApplied; -import net.runelite.api.kit.KitType; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "Tick Counter", - description = "Count the amount of perfect combat ticks performed by each player.", - tags = {"combat", "counter", "tick"}, - type = PluginType.UTILITY, - enabledByDefault = false -) -@Singleton -@Slf4j -public class CombatCounter extends Plugin -{ - - @Inject - private Client client; - - @Inject - private CombatOverlay tickOverlay; - - @Inject - private DamageOverlay damageOverlay; - - @Inject - private OverlayManager overlayManager; - - @Inject - private CombatCounterConfig config; - - @Inject - private EventBus eventBus; - - private boolean instanced = false; - @Setter(AccessLevel.PACKAGE) - @Getter(AccessLevel.PACKAGE) - private Map counter = new HashMap<>(); - - private final Map blowpipe = new HashMap<>(); - - private final Map npcDamageMap = new HashMap<>(); - Map playerDamage = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private boolean showTickCounter; - @Getter(AccessLevel.PACKAGE) - private boolean showDamageCounter; - private boolean resetOnNewInstance; - @Getter(AccessLevel.PACKAGE) - private Color selfColor; - @Getter(AccessLevel.PACKAGE) - private Color totalColor; - @Getter(AccessLevel.PACKAGE) - private Color otherColor; - @Getter(AccessLevel.PACKAGE) - private Color bgColor; - @Getter(AccessLevel.PACKAGE) - private Color titleColor; - - @Provides - CombatCounterConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(CombatCounterConfig.class); - } - - private static final Map VARIABLES = ImmutableMap.builder() - .put(422, 4) // Unarmed Punch, Block - .put(423, 4) // Unarmed Kick - - .put(8145, 4) // Rapier Stab, Lunge, Block - .put(390, 4) // Rapier Slash - - .put(7552, 5) // Armadyl Crossbow Accurate, Rapid, Longrange, Special - - .put(1167, 4) // Trident Accurate, Accurate, Longrange - - .put(401, 6) // Dragon Warhammer Pound, Pummel, Block - .put(1378, 6) // Dragon Warhammer Special - - .put(393, 4) // Dragon Claws Chop, Slash, Block - .put(1067, 4) // Dragon Claws Lunge - .put(7514, 4) // Dragon Claws Special - - .put(8288, 4) // Dragon Hunter Lance Lunge, Block - .put(8289, 4) // Dragon Hunter Lance Swipe - .put(8290, 4) // Dragon Hunter Lance Pound - - .put(7516, 6) // Elder maul Pound, Pummel, Block - - .put(8056, 5) // Scythe of Vitur Reap, Chop, Jab, Block - - .put(7045, 6) // Bandos Godsword Chop, Slash - .put(7054, 6) // Bandos Godsword Smash - .put(7055, 6) // Bandos Godsword Block - .put(7642, 6) // Bandos Godsword Special - .put(7643, 6) // Bandos Godsword Special (Ornamate) - - .put(426, 5) // Twisted Bow Accurate, Rapid, Longrange - - .put(414, 5) // Kodai Bash, Pound, Focus - - // .put(428, 4) // Staff of Light Jab - .put(440, 4) // Staff of Light Swipe - //.put(419, 4) // Staff of Light Fend - .put(7967, 4) // Staff of Light Special - - .put(428, 7) // Crystal Halberd Jab, Fend - .put(419, 7) // Crystal Halberd Swipe - .put(1203, 7) // Crystal Halberd Special - - .put(5061, 2) // Toxic Blowpipe Accurate, Rapid, Longrange, Special - - .put(1979, 5) // Ancient Magicks Barrage - .put(1978, 5) // Ancient Magicks Blitz - - .put(7618, 3) // Chinchompa Short, Medium, Long Fuse - .put(1658, 4) // Whip Flick, Lash, Deflect - - .put(7555, 6) // Ballista Accurate, Rapid, Longrange - .build(); - - - private static final Set MELEE_ANIMATIONS = ImmutableSet.builder() - .add(422) // Unarmed Punch, Block - .add(423) // Unarmed Kick - - .add(8145) // Rapier Stab, Lunge, Block - .add(390) // Rapier Slash - - .add(401) // Dragon Warhammer Pound, Pummel, Block - .add(1378) // Dragon Warhammer Special - - .add(393) // Dragon Claws Chop, Slash, Block - .add(1067) // Dragon Claws Lunge - .add(7514) // Dragon Claws Special - - .add(8288) // Dragon Hunter Lance Lunge, Block - .add(8289) // Dragon Hunter Lance Swipe - .add(8290) // Dragon Hunter Lance Pound - - .add(7516) // Elder maul Pound, Pummel, Block - - .add(8056) // Scythe of Vitur Reap, Chop, Jab, Block - - .add(7045) // Bandos Godsword Chop, Slash - .add(7054) // Bandos Godsword Smash - .add(7055) // Bandos Godsword Block - .add(7642) // Bandos Godsword Special - .add(7643) // Bandos Godsword Special (Ornamate) - - .add(414) // Kodai Bash, Pound, Focus - - .add(428) // Staff of Light Jab - .add(440) // Staff of Light Swipe - .add(419) // Staff of Light Fend - - .add(428) // Crystal Halberd Jab, Fend - .add(419) // Crystal Halberd Swipe - .add(1203) // Crystal Halberd Special - - .add(1658) // Whip Flick, Lash, Deflect - .build(); - - private static final Set RANGE_ANIMATIONS = ImmutableSet.of( - 7552, // Armadyl Crossbow Accurate, Rapid, Longrange, Special - 426, // Twisted Bow Accurate, Rapid, Longrange - 7618, // Chinchompa Short, Medium, Long Fuse - 7555 // Ballista Accurate, Rapid, Longrange - ); - - private static final Set MAGE_ANIMATIONS = ImmutableSet.of( - 1167, // Trident Accurate, Accurate, Longrange - 1978, // Ancient Magicks Blitz - 1979 // Ancient Magicks Barrage - ); - - @Override - protected void startUp() - { - updateConfig(); - addSubscriptions(); - - overlayManager.add(tickOverlay); - overlayManager.add(damageOverlay); - - this.counter.clear(); - this.blowpipe.clear(); - this.npcDamageMap.clear(); - this.playerDamage.clear(); - } - - @Override - protected void shutDown() - { - eventBus.unregister(this); - - overlayManager.remove(tickOverlay); - overlayManager.remove(damageOverlay); - - this.counter.clear(); - this.blowpipe.clear(); - this.npcDamageMap.clear(); - this.playerDamage.clear(); - } - - private void addSubscriptions() - { - eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged); - eventBus.subscribe(GameTick.class, this, this::onGameTick); - eventBus.subscribe(HitsplatApplied.class, this, this::onHitsplatApplied); - } - - private void onAnimationChanged(AnimationChanged event) - { - Actor actor = event.getActor(); - - if (actor instanceof Player) - { - Player p = (Player) actor; - String name = actor.getName(); - if (name != null) - { - int animation = p.getAnimation(); - if (animation != -1) - { - if (VARIABLES.containsKey(animation)) - { - /* - * This part handles the Tick Counter. - */ - long ticks = VARIABLES.get(animation); - if (((Player) actor).getPlayerAppearance().getEquipmentId(KitType.WEAPON) == 23360) - { - ticks = 3; - } - if (counter.containsKey(name)) - { - ticks += counter.get(name); - } - counter.put(name, ticks); - counter = sortByValue(counter); - - if (animation == BLOWPIPE_ATTACK) - { - this.blowpipe.put(name, -4L); - } - - /* - * This part handles the Damage Counter. - */ - Actor interacting = actor.getInteracting(); - if (interacting instanceof NPC) - { - NPC npc = (NPC) interacting; - - List actives = new ArrayList<>(); - actives.add(npc); - - if (BARRAGE_ANIMATION == 1979 || CHIN_ANIMATION == 7618) - { // Barrage or chin. - for (NPC nearby : this.client.getNpcs()) - { - int distance = npc.getWorldLocation().distanceTo(nearby.getWorldLocation()); - if (distance <= 1 && npc != nearby) - { - actives.add(nearby); - } - } - } - - int distance = calculateDistance(p, npc); - - int delay = -1; - boolean canFarcast = false; - - if (animation == 7618) - { - delay = this.calculateChinDelay(distance); - canFarcast = true; - } - else if (animation == 5061) - { - delay = this.calculateBPDelay(distance); - canFarcast = true; - } - else if (RANGE_ANIMATIONS.contains(animation)) - { - delay = this.calculateRangedDelay(distance); - canFarcast = true; - } - else if (MELEE_ANIMATIONS.contains(animation)) - { - delay = 1; - } - else if (MAGE_ANIMATIONS.contains(animation)) - { - delay = this.calculateMageDelay(distance); - canFarcast = true; - } - else - { - log.debug("Unclassified Animation: {}", animation); - } - - if (delay != -1) - { - List ticksToAdd = new ArrayList<>(); - ticksToAdd.add(delay); - - if (canFarcast && delay > 2) - { - ticksToAdd.add(delay - 1); - } - - /* - * Dragon Claw Specials are 2 ticks long. - */ - if (animation == 7514) - { - ticksToAdd.add(delay + 1); - } - - for (NPC target : actives) - { - NPCDamageCounter dc = new NPCDamageCounter(); - if (this.npcDamageMap.containsKey(target)) - { - dc = this.npcDamageMap.get(target); - } - - for (Integer tick : ticksToAdd) - { - List attackers = new ArrayList<>(); - if (dc.attackers.containsKey(tick)) - { - attackers = dc.attackers.get(tick); - } - - attackers.add(name); - dc.attackers.put(tick, attackers); - } - - this.npcDamageMap.put(target, dc); - } - } - } - } - } - else - { - this.blowpipe.remove(name); - } - } - } - } - - private void onGameTick(GameTick event) - { - if (this.resetOnNewInstance) - { - boolean prevInstance = instanced; - instanced = client.isInInstancedRegion(); - if (!prevInstance && instanced) - { - this.counter.clear(); - this.blowpipe.clear(); - this.npcDamageMap.clear(); - this.playerDamage.clear(); - } - } - - Map visible = new HashMap<>(); - for (Player p : this.client.getPlayers()) - { - if (p.getName() != null) - { - visible.put(p.getName(), p); - } - } - - for (NPC npc : new ArrayList<>(this.npcDamageMap.keySet())) - { - NPCDamageCounter counter = this.npcDamageMap.get(npc); - - Map> attackers = counter.attackers; - for (Integer i : new ArrayList<>(attackers.keySet())) - { - List p = attackers.get(i); - attackers.put(i - 1, p); - attackers.remove(i); - } - - double totalDamage = 0d; - for (Integer damage : counter.damage) - { - totalDamage += damage; - } - - if (attackers.containsKey(-1)) - { - List players = attackers.get(-1); - double totalPlayers = players.size(); - - double damagePerPlayer = totalDamage / totalPlayers; - for (String name : players) - { - double count = 0d; - if (this.playerDamage.containsKey(name)) - { - count = this.playerDamage.get(name); - } - - count += damagePerPlayer; - this.playerDamage.put(name, count); - } - - counter.damage.clear(); - } -// else if (totalDamage > 0){ -// counter.damage.clear(); -// -// String name = "[Unknown]"; -// double count = 0d; -// if (this.playerDamage.containsKey(name)) -// count = this.playerDamage.get(name); -// -// count += totalDamage; -// this.playerDamage.put(name, count); -// } - - for (Integer i : new ArrayList<>(attackers.keySet())) - { - if (i <= -1) - { - attackers.remove(i); - } - } - - if (attackers.isEmpty()) - { - this.npcDamageMap.remove(npc); - } - } - - this.playerDamage = sortByValue(this.playerDamage); - - for (String user : new ArrayList<>(blowpipe.keySet())) - { - if (visible.containsKey(user)) - { - long count = blowpipe.get(user); - count++; - blowpipe.replace(user, count); - - if (count % 2 == 0 && count >= 0 && counter.containsKey(user)) - { - long ticks = counter.get(user); - counter.replace(user, ticks + 2); - counter = sortByValue(counter); - - Player p = visible.get(user); - Actor interacting = p.getInteracting(); - if (interacting instanceof NPC) - { - NPC npc = (NPC) interacting; - - int distance = calculateDistance(p, npc); - - NPCDamageCounter dc = new NPCDamageCounter(); - if (this.npcDamageMap.containsKey(npc)) - { - dc = this.npcDamageMap.get(npc); - } - - int delay = this.calculateBPDelay(distance); - - List counts = new ArrayList<>(); - counts.add(delay); - if (delay > 2) - { - counts.add(delay - 1); - } - - for (int tick : counts) - { - List attackers = new ArrayList<>(); - if (dc.attackers.containsKey(tick)) - { - attackers = dc.attackers.get(tick); - } - - attackers.add(user); - dc.attackers.put(tick, attackers); - } - - this.npcDamageMap.put(npc, dc); - } - } - } - else - { - blowpipe.remove(user); - } - } - } - - private void onHitsplatApplied(HitsplatApplied event) - { - Actor actor = event.getActor(); - - if (!(actor instanceof NPC)) - { - return; - } - - NPC npc = (NPC) actor; - - if (!this.npcDamageMap.containsKey(npc)) - { - return; - } - - Hitsplat splat = event.getHitsplat(); - NPCDamageCounter dc = this.npcDamageMap.get(npc); - - dc.damage.add(splat.getAmount()); - } - - private > Map sortByValue(Map map) - { - List> list = new ArrayList<>(map.entrySet()); - list.sort(Map.Entry.comparingByValue()); - - Map result = new LinkedHashMap<>(); - for (Map.Entry entry : list) - { - result.put(entry.getKey(), entry.getValue()); - } - - return result; - } - - private int calculateDistance(Player p, NPC npc) - { - int size = 1; - NPCDefinition comp = npc.getTransformedDefinition(); - if (comp != null) - { - size = comp.getSize(); - } - - WorldPoint wpPlayer = p.getWorldLocation(); - WorldPoint wpNPC = npc.getWorldLocation(); - int distance = wpNPC.distanceTo(wpPlayer); - - if (size > 1) - { - for (int x = 0; x < size; x++) - { - for (int y = 0; y < size; y++) - { - WorldPoint wpNPCB = WorldPoint.fromRegion(wpNPC.getRegionID(), wpNPC.getRegionX() + x, wpNPC.getRegionY() + y, wpNPC.getPlane()); - int distB = wpNPCB.distanceTo(wpPlayer); - if (distB >= 1 && distB < distance) - { - distance = distB; - } - } - } - } - - return distance; - } - - private int calculateBPDelay(double distance) - { - return 2 + (int) Math.floor(distance / 6d); - } - - private int calculateChinDelay(double distance) - { - return 2 + (int) Math.floor(distance / 6d); - } - - private int calculateMageDelay(double distance) - { - return 2 + (int) Math.floor((1d + distance) / 3d); - } - - private int calculateRangedDelay(double distance) - { - return 2 + (int) Math.floor((3d + distance) / 6d); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("combatcounter")) - { - updateConfig(); - } - } - - private void updateConfig() - { - this.showTickCounter = config.showTickCounter(); - this.showDamageCounter = config.showDamageCounter(); - this.resetOnNewInstance = config.resetOnNewInstance(); - this.selfColor = config.selfColor(); - this.totalColor = config.totalColor(); - this.otherColor = config.otherColor(); - this.bgColor = config.bgColor(); - this.titleColor = config.titleColor(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/CombatCounterConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/CombatCounterConfig.java deleted file mode 100644 index 74966f963b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/CombatCounterConfig.java +++ /dev/null @@ -1,146 +0,0 @@ -package net.runelite.client.plugins.combatcounter; - -import java.awt.Color; -import net.runelite.client.config.Alpha; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigTitleSection; -import net.runelite.client.config.Title; - -@ConfigGroup("combatcounter") -public interface CombatCounterConfig extends Config -{ - @ConfigTitleSection( - keyName = "counterTitle", - name = "Counters", - description = "", - position = 1 - ) - default Title counterTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "Show Tick Counter", - name = "Show Tick Counter", - description = "Turn the tick counter on", - position = 2, - titleSection = "counterTitle" - ) - default boolean showTickCounter() - { - return false; - } - - @ConfigItem( - keyName = "Show Damage Counter", - name = "Show Damage Counter", - description = "Turn the damage counter on", - position = 3, - titleSection = "counterTitle" - ) - default boolean showDamageCounter() - { - return false; - } - - @ConfigTitleSection( - keyName = "colorsTitle", - name = "Colors", - description = "", - position = 4 - ) - default Title colorsTitle() - { - return new Title(); - } - - @Alpha - @ConfigItem( - keyName = "selfColor", - name = "Your color", - description = "", - position = 5, - titleSection = "colorsTitle" - ) - default Color selfColor() - { - return Color.green; - } - - @Alpha - @ConfigItem( - keyName = "totalColor", - name = "Total color", - description = "", - position = 6, - titleSection = "colorsTitle" - ) - default Color totalColor() - { - return Color.RED; - } - - @Alpha - @ConfigItem( - keyName = "otherColor", - name = "Other players color", - description = "", - position = 7, - titleSection = "colorsTitle" - ) - default Color otherColor() - { - return Color.white; - } - - @Alpha - @ConfigItem( - keyName = "bgColor", - name = "Background color", - description = "", - position = 8, - titleSection = "colorsTitle" - ) - default Color bgColor() - { - return new Color(70, 61, 50, 156); - } - - @Alpha - @ConfigItem( - keyName = "titleColor", - name = "Title color", - description = "", - position = 9, - titleSection = "colorsTitle" - ) - default Color titleColor() - { - return Color.white; - } - - @ConfigTitleSection( - keyName = "miscTitle", - name = "Miscellaneous", - description = "", - position = 10 - ) - default Title miscTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "Reset on New Instance", - name = "Reset On New Instance", - description = "Resets counter when entering a new instance", - position = 11 - ) - default boolean resetOnNewInstance() - { - return false; - } -} \ No newline at end of file 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 deleted file mode 100644 index 71ce46c70b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/CombatOverlay.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.combatcounter; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.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.TableAlignment; -import net.runelite.client.ui.overlay.components.table.TableComponent; -import net.runelite.client.util.ColorUtil; - -@Singleton -class CombatOverlay extends Overlay -{ - - private final Client client; - private final CombatCounter plugin; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - public CombatOverlay(final Client client, final CombatCounter plugin) - { - super(plugin); - - setPosition(OverlayPosition.DYNAMIC); - setPosition(OverlayPosition.DETACHED); - setPosition(OverlayPosition.BOTTOM_RIGHT); - - this.client = client; - this.plugin = plugin; - - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Tick Counter")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.isShowTickCounter()) - { - panelComponent.getChildren().clear(); - - Player local = client.getLocalPlayer(); - if (local == null || local.getName() == null) - { - return null; - } - panelComponent.setBackgroundColor(plugin.getBgColor()); - panelComponent.getChildren().add(TitleComponent.builder().text("Tick Counter").color(plugin.getTitleColor()).build()); - int total = 0; - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - if (plugin.getCounter().isEmpty()) - { - tableComponent.addRow(local.getName(), "0"); - } - else - { - Map map = this.plugin.getCounter(); - if (map == null) - { - return null; - } - - for (Map.Entry counter : map.entrySet()) - { - String name = counter.getKey(); - if (client.getLocalPlayer().getName().contains(name)) - { - tableComponent.addRow(ColorUtil.prependColorTag(name, plugin.getSelfColor()), ColorUtil.prependColorTag(Long.toString(counter.getValue()), plugin.getSelfColor())); - } - else - { - tableComponent.addRow(ColorUtil.prependColorTag(name, plugin.getOtherColor()), ColorUtil.prependColorTag(Long.toString(counter.getValue()), plugin.getOtherColor())); - } - total += counter.getValue(); - } - - if (!map.containsKey(local.getName())) - { - tableComponent.addRow(ColorUtil.prependColorTag(local.getName(), plugin.getSelfColor()), ColorUtil.prependColorTag("0", plugin.getSelfColor())); - } - } - - tableComponent.addRow(ColorUtil.prependColorTag("Total:", plugin.getTotalColor()), ColorUtil.prependColorTag(String.valueOf(total), plugin.getTotalColor())); - - if (!tableComponent.isEmpty()) - { - panelComponent.getChildren().add(tableComponent); - } - - return panelComponent.render(graphics); - } - else - { - return null; - } - } -} 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 deleted file mode 100644 index 2a7cc38dc2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/DamageOverlay.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.combatcounter; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.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.TableAlignment; -import net.runelite.client.ui.overlay.components.table.TableComponent; -import net.runelite.client.util.ColorUtil; - -@Singleton -class DamageOverlay extends Overlay -{ - - private final Client client; - - private final CombatCounter plugin; - - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - public DamageOverlay(final Client client, final CombatCounter plugin) - { - super(plugin); - - setPosition(OverlayPosition.DYNAMIC); - setPosition(OverlayPosition.DETACHED); - setPosition(OverlayPosition.BOTTOM_RIGHT); - - this.client = client; - this.plugin = plugin; - - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Damage Counter Overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.isShowDamageCounter()) - { - panelComponent.getChildren().clear(); - - Player local = client.getLocalPlayer(); - if (local == null || local.getName() == null) - { - return null; - } - panelComponent.setBackgroundColor(plugin.getBgColor()); - panelComponent.getChildren().add(TitleComponent.builder().text("Damage Counter").color(plugin.getTitleColor()).build()); - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - if (plugin.getCounter().isEmpty()) - { - tableComponent.addRow(local.getName(), "0"); - } - else - { - Map map = this.plugin.playerDamage; - if (map == null) - { - return null; - } - - for (Map.Entry damage : map.entrySet()) - { - String val = String.format("%.1f", damage.getValue()); - if (client.getLocalPlayer().getName().contains(damage.getKey())) - { - tableComponent.addRow(ColorUtil.prependColorTag(damage.getKey(), plugin.getSelfColor()), ColorUtil.prependColorTag(val, plugin.getSelfColor())); - } - else - { - tableComponent.addRow(ColorUtil.prependColorTag(damage.getKey(), plugin.getOtherColor()), ColorUtil.prependColorTag(val, plugin.getOtherColor())); - } - } - - if (!map.containsKey(local.getName())) - { - tableComponent.addRow(ColorUtil.prependColorTag(local.getName(), plugin.getSelfColor()), ColorUtil.prependColorTag("0", plugin.getSelfColor())); - } - } - - if (!tableComponent.isEmpty()) - { - panelComponent.getChildren().add(tableComponent); - } - - return panelComponent.render(graphics); - } - else - { - return null; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/NPCDamageCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/NPCDamageCounter.java deleted file mode 100644 index 8e9d96e24e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/NPCDamageCounter.java +++ /dev/null @@ -1,22 +0,0 @@ -package net.runelite.client.plugins.combatcounter; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; -import javax.inject.Singleton; - -@Singleton -class NPCDamageCounter -{ - - final Map> attackers; - - final List damage; - - NPCDamageCounter() - { - this.attackers = new TreeMap<>(); - this.damage = new ArrayList<>(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelConfig.java deleted file mode 100644 index cc82bcea65..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelConfig.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2018, Brett Middle - * 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.combatlevel; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("combatlevel") -public interface CombatLevelConfig extends Config -{ - @ConfigItem( - keyName = "showLevelsUntil", - name = "Calculate next level", - description = "Mouse over the combat level to calculate what skill levels will increase combat." - ) - default boolean showLevelsUntil() - { - return true; - } - - @ConfigItem( - keyName = "wildernessAttackLevelRange", - name = "Show level range in wilderness", - description = "Displays a PVP-world-like attack level range in the wilderness" - ) - default boolean wildernessAttackLevelRange() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelOverlay.java deleted file mode 100644 index 92c567aab9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelOverlay.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2018, Brett Middle - * 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.combatlevel; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Experience; -import net.runelite.api.Skill; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.tooltip.Tooltip; -import net.runelite.client.ui.overlay.tooltip.TooltipManager; -import net.runelite.client.util.ColorUtil; - -@Singleton -class CombatLevelOverlay extends Overlay -{ - private static final Color COMBAT_LEVEL_COLOUR = new Color(0xff981f); - - private final Client client; - private final CombatLevelPlugin plugin; - private final TooltipManager tooltipManager; - - @Inject - private CombatLevelOverlay(final Client client, final CombatLevelPlugin plugin, final TooltipManager tooltipManager) - { - this.client = client; - this.plugin = plugin; - this.tooltipManager = tooltipManager; - } - - @Override - public Dimension render(Graphics2D graphics) - { - Widget combatLevelWidget = client.getWidget(WidgetInfo.COMBAT_LEVEL); - if (!plugin.isShowLevelsUntil() - || client.getLocalPlayer().getCombatLevel() == Experience.MAX_COMBAT_LEVEL - || combatLevelWidget == null || combatLevelWidget.isHidden()) - { - return null; - } - - Rectangle combatCanvas = combatLevelWidget.getBounds(); - - if (combatCanvas == null) - { - return null; - } - - if (combatCanvas.contains(client.getMouseCanvasPosition().getX(), client.getMouseCanvasPosition().getY())) - { - tooltipManager.add(new Tooltip(getLevelsUntilTooltip())); - } - - return null; - } - - private String getLevelsUntilTooltip() - { - // grab combat skills from player - int attackLevel = client.getRealSkillLevel(Skill.ATTACK); - int strengthLevel = client.getRealSkillLevel(Skill.STRENGTH); - int defenceLevel = client.getRealSkillLevel(Skill.DEFENCE); - int hitpointsLevel = client.getRealSkillLevel(Skill.HITPOINTS); - int magicLevel = client.getRealSkillLevel(Skill.MAGIC); - int rangeLevel = client.getRealSkillLevel(Skill.RANGED); - int prayerLevel = client.getRealSkillLevel(Skill.PRAYER); - - // find the needed levels until level up - int meleeNeed = Experience.getNextCombatLevelMelee(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int hpDefNeed = Experience.getNextCombatLevelHpDef(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int rangeNeed = Experience.getNextCombatLevelRange(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int magicNeed = Experience.getNextCombatLevelMagic(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - - // create tooltip string - StringBuilder sb = new StringBuilder(); - sb.append(ColorUtil.wrapWithColorTag("Next combat level:
", COMBAT_LEVEL_COLOUR)); - - if ((attackLevel + strengthLevel + meleeNeed) <= Experience.MAX_REAL_LEVEL * 2) - { - sb.append(meleeNeed).append(" Attack/Strength
"); - } - if ((hitpointsLevel + defenceLevel + hpDefNeed) <= Experience.MAX_REAL_LEVEL * 2) - { - sb.append(hpDefNeed).append(" Defence/Hitpoints
"); - } - if ((rangeLevel + rangeNeed) <= Experience.MAX_REAL_LEVEL) - { - sb.append(rangeNeed).append(" Ranged
"); - } - if ((magicLevel + magicNeed) <= Experience.MAX_REAL_LEVEL) - { - sb.append(magicNeed).append(" Magic
"); - } - if ((prayerLevel + prayerNeed) <= Experience.MAX_REAL_LEVEL) - { - sb.append(prayerNeed).append(" Prayer"); - } - return sb.toString(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelPlugin.java deleted file mode 100644 index 02e825cbb9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/combatlevel/CombatLevelPlugin.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright (c) 2017, Devin French - * Copyright (c) 2019, 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.combatlevel; - -import com.google.inject.Provides; -import java.text.DecimalFormat; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.Experience; -import net.runelite.api.GameState; -import net.runelite.api.Skill; -import net.runelite.api.WorldType; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "Combat Level", - description = "Show a more accurate combat level in Combat Options panel and other combat level functions", - tags = {"wilderness", "attack", "range"}, - type = PluginType.UTILITY -) -@Singleton -public class CombatLevelPlugin extends Plugin -{ - private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.###"); - private static final String CONFIG_GROUP = "combatlevel"; - private static final String ATTACK_RANGE_CONFIG_KEY = "wildernessAttackLevelRange"; - private static final Pattern WILDERNESS_LEVEL_PATTERN = Pattern.compile("^Level: (\\d+)$"); - private static final int SKULL_CONTAINER_ADJUSTED_ORIGINAL_Y = 6; - private static final int WILDERNESS_LEVEL_TEXT_ADJUSTED_ORIGINAL_Y = 3; - private static final int MIN_COMBAT_LEVEL = 3; - - private int originalWildernessLevelTextPosition = -1; - private int originalSkullContainerPosition = -1; - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private CombatLevelConfig config; - - @Inject - private CombatLevelOverlay overlay; - - @Inject - private OverlayManager overlayManager; - - @Getter(AccessLevel.PACKAGE) - private boolean showLevelsUntil; - private boolean wildernessAttackLevelRange; - - @Provides - CombatLevelConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(CombatLevelConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - - if (this.wildernessAttackLevelRange) - { - appendAttackLevelRangeText(); - } - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - Widget combatLevelWidget = client.getWidget(WidgetInfo.COMBAT_LEVEL); - - if (combatLevelWidget != null) - { - String widgetText = combatLevelWidget.getText(); - - if (widgetText.contains(".")) - { - combatLevelWidget.setText(widgetText.substring(0, widgetText.indexOf('.'))); - } - } - - shutDownAttackLevelRange(); - } - - @Subscribe - private void onGameTick(GameTick event) - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - Widget combatLevelWidget = client.getWidget(WidgetInfo.COMBAT_LEVEL); - if (combatLevelWidget == null) - { - return; - } - - double combatLevelPrecise = Experience.getCombatLevelPrecise( - client.getRealSkillLevel(Skill.ATTACK), - client.getRealSkillLevel(Skill.STRENGTH), - client.getRealSkillLevel(Skill.DEFENCE), - client.getRealSkillLevel(Skill.HITPOINTS), - client.getRealSkillLevel(Skill.MAGIC), - client.getRealSkillLevel(Skill.RANGED), - client.getRealSkillLevel(Skill.PRAYER) - ); - - combatLevelWidget.setText("Combat Lvl: " + DECIMAL_FORMAT.format(combatLevelPrecise)); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!CONFIG_GROUP.equals(event.getGroup()) || !ATTACK_RANGE_CONFIG_KEY.equals(event.getKey())) - { - return; - } - - updateConfig(); - - if (this.wildernessAttackLevelRange) - { - appendAttackLevelRangeText(); - } - else - { - shutDownAttackLevelRange(); - } - } - - @Subscribe - private void onScriptCallbackEvent(ScriptCallbackEvent event) - { - if (this.wildernessAttackLevelRange - && "wildernessWidgetTextSet".equals(event.getEventName())) - { - appendAttackLevelRangeText(); - } - } - - private void appendAttackLevelRangeText() - { - final Widget wildernessLevelWidget = client.getWidget(WidgetInfo.PVP_WILDERNESS_LEVEL); - if (wildernessLevelWidget == null) - { - return; - } - - final String wildernessLevelText = wildernessLevelWidget.getText(); - final Matcher m = WILDERNESS_LEVEL_PATTERN.matcher(wildernessLevelText); - if (!m.matches() - || WorldType.isPvpWorld(client.getWorldType())) - { - return; - } - - final Widget skullContainer = client.getWidget(WidgetInfo.PVP_SKULL_CONTAINER); - if (originalWildernessLevelTextPosition == -1) - { - originalWildernessLevelTextPosition = wildernessLevelWidget.getOriginalY(); - } - if (originalSkullContainerPosition == -1) - { - originalSkullContainerPosition = skullContainer.getRelativeY(); - } - - final int wildernessLevel = Integer.parseInt(m.group(1)); - final int combatLevel = client.getLocalPlayer().getCombatLevel(); - - wildernessLevelWidget.setText(wildernessLevelText + "
" + combatAttackRange(combatLevel, wildernessLevel)); - wildernessLevelWidget.setOriginalY(WILDERNESS_LEVEL_TEXT_ADJUSTED_ORIGINAL_Y); - skullContainer.setOriginalY(SKULL_CONTAINER_ADJUSTED_ORIGINAL_Y); - - clientThread.invoke(wildernessLevelWidget::revalidate); - clientThread.invoke(skullContainer::revalidate); - } - - private void shutDownAttackLevelRange() - { - if (WorldType.isPvpWorld(client.getWorldType())) - { - return; - } - - final Widget wildernessLevelWidget = client.getWidget(WidgetInfo.PVP_WILDERNESS_LEVEL); - if (wildernessLevelWidget != null) - { - String wildernessLevelText = wildernessLevelWidget.getText(); - if (wildernessLevelText.contains("
")) - { - wildernessLevelWidget.setText(wildernessLevelText.substring(0, wildernessLevelText.indexOf("
"))); - } - wildernessLevelWidget.setOriginalY(originalWildernessLevelTextPosition); - clientThread.invoke(wildernessLevelWidget::revalidate); - } - originalWildernessLevelTextPosition = -1; - - final Widget skullContainer = client.getWidget(WidgetInfo.PVP_SKULL_CONTAINER); - if (skullContainer != null) - { - skullContainer.setOriginalY(originalSkullContainerPosition); - clientThread.invoke(skullContainer::revalidate); - } - originalSkullContainerPosition = -1; - } - - private static String combatAttackRange(final int combatLevel, final int wildernessLevel) - { - return Math.max(MIN_COMBAT_LEVEL, combatLevel - wildernessLevel) + "-" + Math.min(Experience.MAX_COMBAT_LEVEL, combatLevel + wildernessLevel); - } - - private void updateConfig() - { - this.showLevelsUntil = config.showLevelsUntil(); - this.wildernessAttackLevelRange = config.showLevelsUntil(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cooking/CookingConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/cooking/CookingConfig.java deleted file mode 100644 index 2a12ac1ede..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cooking/CookingConfig.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2018, Joris K - * Copyright (c) 2018, Lasse - * 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.cooking; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("cooking") -public interface CookingConfig extends Config -{ - @ConfigItem( - position = 1, - keyName = "statTimeout", - name = "Reset stats (minutes)", - description = "Configures the time until the session resets and the overlay is hidden (0 = Disable feature)" - ) - default int statTimeout() - { - return 5; - } - - @ConfigItem( - position = 2, - keyName = "fermentTimer", - name = "Show wine ferment timer", - description = "Configures if the timer before wines are fermented is shown" - ) - default boolean fermentTimer() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cooking/CookingOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/cooking/CookingOverlay.java deleted file mode 100644 index f3fbadee3f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cooking/CookingOverlay.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2018, Joris K - * Copyright (c) 2018, Lasse - * 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.cooking; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.text.DecimalFormat; -import java.time.Duration; -import java.time.Instant; -import javax.inject.Inject; -import javax.inject.Singleton; -import static net.runelite.api.AnimationID.COOKING_FIRE; -import static net.runelite.api.AnimationID.COOKING_RANGE; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.Skill; -import net.runelite.client.plugins.xptracker.XpTrackerService; -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.TableAlignment; -import net.runelite.client.ui.overlay.components.table.TableComponent; - -@Singleton -class CookingOverlay extends Overlay -{ - private static final int COOK_TIMEOUT = 3; - private static final DecimalFormat FORMAT = new DecimalFormat("#.#"); - static final String COOKING_RESET = "Reset"; - - private final Client client; - private final CookingPlugin plugin; - private final XpTrackerService xpTrackerService; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - private CookingOverlay(final Client client, final CookingPlugin plugin, final XpTrackerService xpTrackerService) - { - super(plugin); - setPosition(OverlayPosition.TOP_LEFT); - this.client = client; - this.plugin = plugin; - this.xpTrackerService = xpTrackerService; - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Cooking overlay")); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY, COOKING_RESET, "Cooking overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - CookingSession session = plugin.getSession(); - if (session == null) - { - return null; - } - - panelComponent.getChildren().clear(); - - if (isCooking() || Duration.between(session.getLastCookingAction(), Instant.now()).getSeconds() < COOK_TIMEOUT) - { - panelComponent.getChildren().add(TitleComponent.builder() - .text("Cooking") - .color(Color.GREEN) - .build()); - } - else - { - panelComponent.getChildren().add(TitleComponent.builder() - .text("NOT cooking") - .color(Color.RED) - .build()); - } - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - tableComponent.addRow("Cooked:", session.getCookAmount() + (session.getCookAmount() >= 1 ? " (" + xpTrackerService.getActionsHr(Skill.COOKING) + "/hr)" : "")); - tableComponent.addRow("Burnt:", session.getBurnAmount() + (session.getBurnAmount() >= 1 ? " (" + FORMAT.format(session.getBurntPercentage()) + "%)" : "")); - - panelComponent.getChildren().add(tableComponent); - - return panelComponent.render(graphics); - } - - private boolean isCooking() - { - switch (client.getLocalPlayer().getAnimation()) - { - case COOKING_FIRE: - case COOKING_RANGE: - return true; - default: - return false; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cooking/CookingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/cooking/CookingPlugin.java deleted file mode 100644 index 498927c7ae..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cooking/CookingPlugin.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (c) 2018, Joris K - * Copyright (c) 2018, Lasse - * 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.cooking; - -import com.google.inject.Provides; -import java.time.Duration; -import java.time.Instant; -import java.util.Optional; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GraphicID; -import net.runelite.api.ItemID; -import net.runelite.api.MenuOpcode; -import net.runelite.api.Player; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.SpotAnimationChanged; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.events.OverlayMenuClicked; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDependency; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.xptracker.XpTrackerPlugin; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.ui.overlay.OverlayMenuEntry; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; - -@PluginDescriptor( - name = "Cooking", - description = "Show cooking statistics", - tags = {"overlay", "skilling", "cook"}, - type = PluginType.SKILLING -) -@Singleton -@PluginDependency(XpTrackerPlugin.class) -public class CookingPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private CookingConfig config; - - @Inject - private CookingOverlay overlay; - - @Inject - private OverlayManager overlayManager; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private ItemManager itemManager; - - @Getter(AccessLevel.PACKAGE) - private CookingSession session; - - private int statTimeout; - @Setter(AccessLevel.PACKAGE) - private boolean fermentTimer; - - @Provides - CookingConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(CookingConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - session = null; - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - infoBoxManager.removeIf(FermentTimer.class::isInstance); - overlayManager.remove(overlay); - session = null; - } - - @Subscribe - private void onOverlayMenuClicked(OverlayMenuClicked overlayMenuClicked) - { - OverlayMenuEntry overlayMenuEntry = overlayMenuClicked.getEntry(); - if (overlayMenuEntry.getMenuOpcode() == MenuOpcode.RUNELITE_OVERLAY - && overlayMenuClicked.getEntry().getOption().equals(CookingOverlay.COOKING_RESET) - && overlayMenuClicked.getOverlay() == overlay) - { - session = null; - } - } - - @Subscribe - private void onGameTick(GameTick gameTick) - { - if (session == null || this.statTimeout == 0) - { - return; - } - - Duration statTimeout = Duration.ofMinutes(this.statTimeout); - Duration sinceCut = Duration.between(session.getLastCookingAction(), Instant.now()); - - if (sinceCut.compareTo(statTimeout) >= 0) - { - session = null; - } - } - - @Subscribe - void onSpotAnimationChanged(SpotAnimationChanged graphicChanged) - { - Player player = client.getLocalPlayer(); - - if (graphicChanged.getActor() != player) - { - return; - } - - if (player.getSpotAnimation() == GraphicID.WINE_MAKE && this.fermentTimer) - { - Optional fermentTimerOpt = infoBoxManager.getInfoBoxes().stream() - .filter(FermentTimer.class::isInstance) - .map(FermentTimer.class::cast) - .findAny(); - - if (fermentTimerOpt.isPresent()) - { - FermentTimer fermentTimer = fermentTimerOpt.get(); - fermentTimer.reset(); - } - else - { - FermentTimer fermentTimer = new FermentTimer(itemManager.getImage(ItemID.JUG_OF_WINE), this); - infoBoxManager.addInfoBox(fermentTimer); - } - } - } - - @Subscribe - void onChatMessage(ChatMessage event) - { - if (event.getType() != ChatMessageType.SPAM) - { - return; - } - - final String message = event.getMessage(); - - if (message.startsWith("You successfully cook") - || message.startsWith("You successfully bake") - || message.startsWith("You manage to cook") - || message.startsWith("You roast a") - || message.startsWith("You cook")) - { - if (session == null) - { - session = new CookingSession(); - } - - session.updateLastCookingAction(); - session.increaseCookAmount(); - - } - else if (message.startsWith("You accidentally burn") - || message.startsWith("You accidentally spoil")) - { - if (session == null) - { - session = new CookingSession(); - } - - session.updateLastCookingAction(); - session.increaseBurnAmount(); - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged configChanged) - { - if (configChanged.getGroup().equals("cooking")) - { - updateConfig(); - } - } - - private void updateConfig() - { - this.statTimeout = config.statTimeout(); - this.fermentTimer = config.fermentTimer(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cooking/CookingSession.java b/runelite-client/src/main/java/net/runelite/client/plugins/cooking/CookingSession.java deleted file mode 100644 index 14ad6a2722..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cooking/CookingSession.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2018, Joris K - * Copyright (c) 2018, Lasse - * 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.cooking; - -import java.time.Instant; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; - -@Singleton -class CookingSession -{ - @Getter(AccessLevel.PACKAGE) - private Instant lastCookingAction; - @Getter(AccessLevel.PACKAGE) - private int cookAmount; - @Getter(AccessLevel.PACKAGE) - private int burnAmount; - - void updateLastCookingAction() - { - this.lastCookingAction = Instant.now(); - } - - void increaseCookAmount() - { - this.cookAmount++; - } - - void increaseBurnAmount() - { - this.burnAmount++; - } - - double getBurntPercentage() - { - return ((double) getBurnAmount() / (getCookAmount() + getBurnAmount())) * 100; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cooking/FermentTimer.java b/runelite-client/src/main/java/net/runelite/client/plugins/cooking/FermentTimer.java deleted file mode 100644 index bede4b7236..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cooking/FermentTimer.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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.cooking; - -import java.awt.Color; -import java.awt.image.BufferedImage; -import java.time.Duration; -import java.time.Instant; -import javax.inject.Singleton; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.ui.overlay.infobox.InfoBox; - -@Singleton -final class FermentTimer extends InfoBox -{ - private static final Duration FERMENT_TIME = Duration.ofMillis(13_800); - - private Instant fermentTime; - - FermentTimer(BufferedImage image, Plugin plugin) - { - super(image, plugin); - reset(); - } - - @Override - public String getText() - { - int seconds = timeUntilFerment(); - return Integer.toString(seconds); - } - - @Override - public Color getTextColor() - { - int seconds = timeUntilFerment(); - return seconds <= 3 ? Color.RED : Color.WHITE; - } - - @Override - public boolean cull() - { - int seconds = timeUntilFerment(); - return seconds <= 0; - } - - void reset() - { - fermentTime = Instant.now().plus(FERMENT_TIME); - } - - private int timeUntilFerment() - { - return (int) Duration.between(Instant.now(), fermentTime).getSeconds(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/corp/CoreOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/corp/CoreOverlay.java deleted file mode 100644 index 51eb6a8d88..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/corp/CoreOverlay.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2018, 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.corp; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.NPC; -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; - -@Singleton -class CoreOverlay extends Overlay -{ - private final CorpPlugin corpPlugin; - - @Inject - private CoreOverlay(final CorpPlugin corpPlugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.corpPlugin = corpPlugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - NPC core = corpPlugin.getCore(); - if (core != null) - { - Polygon canvasTilePoly = core.getCanvasTilePoly(); - if (canvasTilePoly != null) - { - OverlayUtil.renderPolygon(graphics, canvasTilePoly, Color.RED.brighter()); - } - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpConfig.java deleted file mode 100644 index 4b2fe5bb9c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpConfig.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2018, 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.corp; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("corp") -public interface CorpConfig extends Config -{ - @ConfigItem( - keyName = "leftClickCore", - name = "Left click walk on core", - description = "Prioritizes Walk here over Attack on the Dark energy core", - position = 1 - ) - default boolean leftClickCore() - { - return true; - } - - @ConfigItem( - keyName = "showDamage", - name = "Show damage overlay", - description = "Show total damage overlay", - position = 2 - ) - default boolean showDamage() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpDamageOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpDamageOverlay.java deleted file mode 100644 index 7892b731ec..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpDamageOverlay.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2018, 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.corp; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FontMetrics; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.NPC; -import net.runelite.api.Varbits; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetID; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -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.PanelComponent; -import net.runelite.client.ui.overlay.components.table.TableAlignment; -import net.runelite.client.ui.overlay.components.table.TableComponent; -import net.runelite.client.util.ColorUtil; - -@Singleton -class CorpDamageOverlay extends Overlay -{ - private final Client client; - private final CorpPlugin corpPlugin; - - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - private CorpDamageOverlay(final Client client, final CorpPlugin corpPlugin) - { - super(corpPlugin); - setPosition(OverlayPosition.TOP_LEFT); - setLayer(OverlayLayer.UNDER_WIDGETS); - setPriority(OverlayPriority.LOW); - this.client = client; - this.corpPlugin = corpPlugin; - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Corp overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - Widget damageWidget = client.getWidget(WidgetID.CORP_DAMAGE, 0); - if (damageWidget != null) - { - damageWidget.setHidden(true); - } - - NPC corp = corpPlugin.getCorp(); - if (corp == null) - { - return null; - } - - int myDamage = client.getVar(Varbits.CORP_DAMAGE); - int totalDamage = corpPlugin.getTotalDamage(); - int players = corpPlugin.getPlayers().size(); - - // estimate how much damage is required for kill based on number of players - int damageForKill = players != 0 ? totalDamage / players : 0; - - panelComponent.getChildren().clear(); - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - NPC core = corpPlugin.getCore(); - if (core != null) - { - WorldPoint corePoint = core.getWorldLocation(); - WorldPoint myPoint = client.getLocalPlayer().getWorldLocation(); - - String text = null; - - if (core.getInteracting() == client.getLocalPlayer()) - { - text = "The core is targeting you!"; - } - else if (corePoint.distanceTo(myPoint) <= 1) - { - text = "Stay away from the core!"; - } - - if (text != null) - { - final FontMetrics fontMetrics = graphics.getFontMetrics(); - int textWidth = Math.max(ComponentConstants.STANDARD_WIDTH, fontMetrics.stringWidth(text)); - - panelComponent.setPreferredSize(new Dimension(textWidth, 0)); - tableComponent.addRow(ColorUtil.prependColorTag(text, Color.RED), ""); - } - } - - if (corpPlugin.isShowDamage()) - { - tableComponent.addRow("Your damage", ColorUtil.prependColorTag(Integer.toString(myDamage), damageForKill > 0 && myDamage >= damageForKill ? Color.GREEN : Color.RED)); - tableComponent.addRow("Total damage:", Integer.toString(totalDamage)); - } - - panelComponent.getChildren().add(tableComponent); - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpPlugin.java deleted file mode 100644 index f1da1d2bb1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpPlugin.java +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright (c) 2018, 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.corp; - -import com.google.inject.Provides; -import java.util.HashSet; -import java.util.Set; -import javax.inject.Inject; -import lombok.AccessLevel; -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.GameState; -import static net.runelite.api.MenuOpcode.MENU_ACTION_DEPRIORITIZE_OFFSET; -import static net.runelite.api.MenuOpcode.NPC_SECOND_OPTION; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.Varbits; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.HitsplatApplied; -import net.runelite.api.events.InteractingChanged; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -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.ConfigChanged; -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; - -@PluginDescriptor( - name = "Corporeal Beast", - description = "Show damage statistics and highlight dark energy cores", - tags = {"bosses", "combat", "pve", "overlay"}, - type = PluginType.PVM -) -@Slf4j -public class CorpPlugin extends Plugin -{ - private static final String ATTACK = "Attack"; - private static final String DARK_ENERGY_CORE = "Dark energy core"; - - @Getter(AccessLevel.PACKAGE) - private NPC corp; - - @Getter(AccessLevel.PACKAGE) - private NPC core; - - private int yourDamage; - - @Getter(AccessLevel.PACKAGE) - private int totalDamage; - - @Getter(AccessLevel.PACKAGE) - private final Set players = new HashSet<>(); - - @Inject - private Client client; - - @Inject - private ChatMessageManager chatMessageManager; - - @Inject - private OverlayManager overlayManager; - - @Inject - private CorpDamageOverlay corpOverlay; - - @Inject - private CoreOverlay coreOverlay; - - @Inject - private CorpConfig config; - - private boolean leftClickCore; - @Getter(AccessLevel.PACKAGE) - private boolean showDamage; - - @Provides - CorpConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(CorpConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(corpOverlay); - overlayManager.add(coreOverlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(corpOverlay); - overlayManager.remove(coreOverlay); - - corp = core = null; - yourDamage = 0; - totalDamage = 0; - players.clear(); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged gameStateChanged) - { - if (gameStateChanged.getGameState() == GameState.LOADING) - { - players.clear(); - } - } - - @Subscribe - private void onNpcSpawned(NpcSpawned npcSpawned) - { - NPC npc = npcSpawned.getNpc(); - - switch (npc.getId()) - { - case NpcID.CORPOREAL_BEAST: - log.debug("Corporeal beast spawn: {}", npc); - corp = npc; - yourDamage = 0; - totalDamage = 0; - players.clear(); - break; - case NpcID.DARK_ENERGY_CORE: - core = npc; - break; - } - } - - @Subscribe - private void onNpcDespawned(NpcDespawned npcDespawned) - { - NPC npc = npcDespawned.getNpc(); - - if (npc == corp) - { - log.debug("Corporeal beast despawn: {}", npc); - corp = null; - players.clear(); - - if (npc.isDead()) - { - // Show kill stats - String message = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Corporeal Beast: Your damage: ") - .append(ChatColorType.HIGHLIGHT) - .append(Integer.toString(yourDamage)) - .append(ChatColorType.NORMAL) - .append(", Total damage: ") - .append(ChatColorType.HIGHLIGHT) - .append(Integer.toString(totalDamage)) - .build(); - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.CONSOLE) - .runeLiteFormattedMessage(message) - .build()); - } - } - else if (npc == core) - { - core = null; - } - } - - @Subscribe - private void onHitsplatApplied(HitsplatApplied hitsplatApplied) - { - Actor actor = hitsplatApplied.getActor(); - - if (actor != corp) - { - return; - } - - int myDamage = client.getVar(Varbits.CORP_DAMAGE); - // sometimes hitsplats are applied after the damage counter has been reset - if (myDamage > 0) - { - yourDamage = myDamage; - } - totalDamage += hitsplatApplied.getHitsplat().getAmount(); - } - - @Subscribe - private void onInteractingChanged(InteractingChanged interactingChanged) - { - Actor source = interactingChanged.getSource(); - Actor target = interactingChanged.getTarget(); - - if (target != corp) - { - return; - } - - players.add(source); - } - - @Subscribe - private void onMenuEntryAdded(MenuEntryAdded event) - { - if (event.getOpcode() != NPC_SECOND_OPTION.getId() - || !this.leftClickCore || !event.getOption().equals(ATTACK)) - { - return; - } - - final int npcIndex = event.getIdentifier(); - final NPC npc = client.getCachedNPCs()[npcIndex]; - if (npc == null || !npc.getName().equals(DARK_ENERGY_CORE)) - { - return; - } - - event.setOpcode(NPC_SECOND_OPTION.getId() + MENU_ACTION_DEPRIORITIZE_OFFSET); - event.setModified(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged configChanged) - { - if (configChanged.getGroup().equals("corp")) - { - updateConfig(); - } - } - - private void updateConfig() - { - this.leftClickCore = config.leftClickCore(); - this.showDamage = config.showDamage(); - } -} 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 deleted file mode 100644 index 705c7cd6db..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxConfig.java +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Copyright (c) 2019, xzact - * 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.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.ConfigTitleSection; -import net.runelite.client.config.Range; -import net.runelite.client.config.Title; - -@ConfigGroup("Cox") - -public interface CoxConfig extends Config -{ - @Getter - @AllArgsConstructor - 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(); - } - } - - @ConfigTitleSection( - keyName = "muttadileTitle", - position = 1, - name = "Muttadile", - description = "" - ) - default Title muttadileTitle() - { - return new Title(); - } - - @ConfigItem( - position = 2, - keyName = "muttadile", - name = "Muttadile Marker", - description = "Places an overlay around muttadiles showing their melee range.", - titleSection = "muttadileTitle" - ) - default boolean muttadile() - { - return true; - } - - @ConfigTitleSection( - keyName = "tektonTitle", - position = 3, - name = "Tekton", - description = "" - ) - default Title tektonTitle() - { - return new Title(); - } - - @ConfigItem( - position = 4, - keyName = "tekton", - name = "Tekton Marker", - description = "Places an overlay around Tekton showing his melee range.", - titleSection = "tektonTitle" - ) - default boolean tekton() - { - return true; - } - - @ConfigItem( - position = 4, - keyName = "tektonTickCounter", - name = "Tekton Tick Counters", - description = "Counts down current phase timer, and attack ticks.", - titleSection = "tektonTitle" - ) - default boolean tektonTickCounter() - { - return true; - } - - @ConfigTitleSection( - keyName = "guardiansTitle", - position = 5, - name = "Guardians", - description = "" - ) - default Title guardiansTitle() - { - return new Title(); - } - - @ConfigItem( - position = 6, - keyName = "guardians", - name = "Guardians Overlay", - description = "Places an overlay near Guardians showing safespot.", - titleSection = "guardiansTitle" - ) - default boolean guardians() - { - return true; - } - - @ConfigItem( - position = 6, - keyName = "guardinTickCounter", - name = "Guardians Tick Timing", - description = "Places an overlay on Guardians showing attack tick timers.", - titleSection = "guardiansTitle" - ) - default boolean guardinTickCounter() - { - return true; - } - - @ConfigTitleSection( - keyName = "vanguardsTitle", - position = 7, - name = "Vanguards", - description = "" - ) - default Title vanguardsTitle() - { - return new Title(); - } - - @ConfigItem( - position = 8, - keyName = "vangHighlight", - name = "Highlight Vanguards", - description = "Color is based on their attack style.", - titleSection = "vanguardsTitle" - ) - default boolean vangHighlight() - { - return true; - } - - @ConfigItem( - position = 9, - keyName = "vangHealth", - name = "Show Vanguards Current HP", - description = "This will create an infobox with vanguards current hp.", - titleSection = "vanguardsTitle" - ) - default boolean vangHealth() - { - return true; - } - - @ConfigTitleSection( - keyName = "olmTitle", - position = 10, - name = "Olm", - description = "" - ) - default Title olmTitle() - { - return new Title(); - } - - @ConfigItem( - position = 11, - keyName = "prayAgainstOlm", - name = "Olm Show Prayer", - description = "Shows what prayer to use during olm.", - titleSection = "olmTitle" - ) - default boolean prayAgainstOlm() - { - return true; - } - - @Range( - min = 40, - max = 100 - ) - @ConfigItem( - position = 11, - keyName = "prayAgainstOlmSize", - name = "Olm Prayer Size", - description = "Change the Size of the Olm Infobox.", - titleSection = "olmTitle" - ) - default int prayAgainstOlmSize() - { - return 40; - } - - @ConfigItem( - position = 12, - keyName = "timers", - name = "Olm Show Burn/Acid Timers", - description = "Shows tick timers for burns/acids.", - titleSection = "olmTitle" - ) - default boolean timers() - { - return true; - } - - @ConfigItem( - position = 13, - keyName = "tpOverlay", - name = "Olm Show Teleport Overlays", - description = "Shows Overlays for targeted teleports.", - titleSection = "olmTitle" - ) - default boolean tpOverlay() - { - return true; - } - - @ConfigItem( - position = 14, - keyName = "olmTick", - name = "Olm Tick Counter", - description = "Show Tick Counter on Olm", - titleSection = "olmTitle" - ) - default boolean olmTick() - { - return true; - } - - @ConfigTitleSection( - keyName = "colors", - position = 15, - name = "Colors", - description = "" - ) - default Title colors() - { - return new Title(); - } - - @ConfigItem( - position = 16, - keyName = "muttaColor", - name = "Muttadile Tile Color", - description = "Change hit area tile color for muttadiles", - titleSection = "colors", - hidden = true, - unhide = "Muttadile" - ) - default Color muttaColor() - { - return new Color(0, 255, 99); - } - - @ConfigItem( - position = 17, - keyName = "guardColor", - name = "Guardians Tile Color", - description = "Change safespot area tile color for Guardians", - titleSection = "colors", - hidden = true, - unhide = "Guardians" - ) - default Color guardColor() - { - return new Color(0, 255, 99); - } - - @ConfigItem( - position = 18, - keyName = "tektonColor", - name = "Tekton Tile Color", - description = "Change hit area tile color for Tekton", - titleSection = "colors", - hidden = true, - unhide = "Tekton" - ) - default Color tektonColor() - { - return new Color(193, 255, 245); - } - - @ConfigItem( - position = 19, - keyName = "burnColor", - name = "Burn Victim Color", - description = "Changes tile color for burn victim.", - titleSection = "colors", - hidden = true, - unhide = "timers" - ) - default Color burnColor() - { - return new Color(255, 100, 0); - } - - @ConfigItem( - position = 20, - keyName = "acidColor", - name = "Acid Victim Color", - description = "Changes tile color for acid victim.", - titleSection = "colors", - hidden = true, - unhide = "timers" - ) - default Color acidColor() - { - return new Color(69, 241, 44); - } - - @ConfigItem( - position = 21, - keyName = "tpColor", - name = "Teleport Target Color", - description = "Changes tile color for teleport target.", - titleSection = "colors", - hidden = true, - unhide = "tpOverlay" - ) - default Color tpColor() - { - return new Color(193, 255, 245); - } - - @ConfigTitleSection( - keyName = "text", - position = 22, - name = "Text", - description = "" - ) - default Title text() - { - return new Title(); - } - - @ConfigItem( - position = 23, - keyName = "fontStyle", - name = "Font Style", - description = "Bold/Italics/Plain", - titleSection = "text" - ) - default FontStyle fontStyle() - { - return FontStyle.BOLD; - } - - @Range( - min = 9, - max = 20 - ) - @ConfigItem( - position = 24, - keyName = "textSize", - name = "Text Size", - description = "Text Size for Timers.", - titleSection = "text" - ) - default int textSize() - { - return 14; - } - - @ConfigItem( - position = 25, - keyName = "shadows", - name = "Shadows", - description = "Adds Shadows to text.", - titleSection = "text" - ) - default boolean shadows() - { - return true; - } -} 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 deleted file mode 100644 index 3e2c2a0c9a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxInfoBox.java +++ /dev/null @@ -1,160 +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 java.awt.Rectangle; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -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.OverlayPriority; -import net.runelite.client.ui.overlay.components.ComponentConstants; -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; -import net.runelite.client.util.ImageUtil; - -@Singleton -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 Client client; - private final SpriteManager spriteManager; - private final PanelComponent prayAgainstPanel = new PanelComponent(); - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - CoxInfoBox(CoxPlugin plugin, Client client, SpriteManager spriteManager) - { - this.plugin = plugin; - this.client = client; - this.spriteManager = spriteManager; - setPosition(OverlayPosition.BOTTOM_RIGHT); - setPriority(OverlayPriority.HIGH); - } - - @Override - public Dimension render(Graphics2D graphics) - { - panelComponent.getChildren().clear(); - if (plugin.inRaid()) - { - prayAgainstPanel.getChildren().clear(); - - final PrayAgainst prayAgainst = plugin.getPrayAgainstOlm(); - - if (System.currentTimeMillis() < plugin.getLastPrayTime() + 120000 && prayAgainst != null && plugin.isConfigPrayAgainstOlm()) - { - final int scale = plugin.getPrayAgainstSize(); - InfoBoxComponent prayComponent = new InfoBoxComponent(); - BufferedImage prayImg = ImageUtil.resizeImage( - getPrayerImage(plugin.getPrayAgainstOlm()), scale, scale - ); - 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(scale + 4, scale + 4)); - prayAgainstPanel.getChildren().add(prayComponent); - - prayAgainstPanel.setPreferredSize(new Dimension(scale + 4, scale + 4)); - prayAgainstPanel.setBorder(new Rectangle(0, 0, 0, 0)); - return prayAgainstPanel.render(graphics); - } - else - { - plugin.setPrayAgainstOlm(null); - } - - if (plugin.isVangHealth() && plugin.getVanguards() > 0) - { - 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; - } - - private BufferedImage getPrayerImage(PrayAgainst prayAgainst) - { - switch (prayAgainst) - { - case MAGIC: - return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MAGIC, 0); - case MELEE: - return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MELEE, 0); - case RANGED: - return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MISSILES, 0); - default: - return spriteManager.getSprite(SpriteID.BARBARIAN_ASSAULT_EAR_ICON, 0); - } - } -} 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 deleted file mode 100644 index fd7cf99a31..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxOverlay.java +++ /dev/null @@ -1,428 +0,0 @@ -/* - * Copyright (c) 2019, xzact - * 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 com.google.common.collect.ImmutableSet; -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.util.List; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Actor; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldArea; -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.OverlayPriority; -import net.runelite.client.ui.overlay.OverlayUtil; - -@Singleton -public class CoxOverlay extends Overlay -{ - private static final Set GAP = ImmutableSet.of(34, 33, 26, 25, 18, 17, 10, 9, 2, 1); - private final Client client; - private final CoxPlugin plugin; - - @Inject - private CoxOverlay(final Client client, final CoxPlugin plugin) - { - this.client = client; - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGH); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D graphics) - { - for (WorldPoint point : plugin.getOlm_Heal()) - { - drawTile(graphics, point, plugin.getTpColor(), 2, 150); - } - - for (WorldPoint point : plugin.getOlm_TP()) - { - client.setHintArrow(point); - drawTile(graphics, point, plugin.getTpColor(), 2, 150); - } - - if (plugin.inRaid()) - { - for (NPCContainer npcs : plugin.getNpcContainer().values()) - { - Color color; - List hitSquares; - int ticksLeft; - switch (npcs.getNpc().getId()) - { - 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 (plugin.isTekton()) - { - hitSquares = getHitSquares(npcs.getNpc().getWorldLocation(), npcs.getNpcSize(), 1, false); - for (WorldPoint p : hitSquares) - { - drawTile(graphics, p, plugin.getTektonColor(), 0, 0); - } - if (plugin.isTektonTickCounter()) - { - ticksLeft = npcs.getTicksUntilAttack(); - final int attackTicksleft = plugin.getTektonAttackTicks(); - String attacksLeftStr; - Color attackcolor; - 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, plugin.getTextSize(), plugin.getFontStyle().getFont(), color, canvasPoint); - } - 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, plugin.getTextSize(), plugin.getFontStyle().getFont(), attackcolor, canvasPoint); - } - } - } - } - break; - case NpcID.MUTTADILE: - case NpcID.MUTTADILE_7562: - case NpcID.MUTTADILE_7563: - if (plugin.isMuttadile()) - { - hitSquares = getHitSquares(npcs.getNpc().getWorldLocation(), npcs.getNpcSize(), 1, false); - for (WorldPoint p : hitSquares) - { - drawTile(graphics, p, plugin.getMuttaColor(), 0, 0); - } - } - break; - case NpcID.GUARDIAN: - case NpcID.GUARDIAN_7570: - case NpcID.GUARDIAN_7571: - case NpcID.GUARDIAN_7572: - if (plugin.isGuardians()) - { - hitSquares = getHitSquares(npcs.getNpc().getWorldLocation(), npcs.getNpcSize(), 2, true); - for (WorldPoint p : hitSquares) - { - drawTile(graphics, p, plugin.getGuardColor(), 0, 0); - } - } - if (plugin.isGuardinTickCounter()) - { - 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, plugin.getTextSize(), plugin.getFontStyle().getFont(), color, canvasPoint); - } - } - break; - case NpcID.VANGUARD_7526: - case NpcID.VANGUARD_7527: - case NpcID.VANGUARD_7528: - case NpcID.VANGUARD_7529: - if (plugin.isVangHighlight()) - { - OverlayUtil.renderPolygon(graphics, npcs.getNpc().getConvexHull(), npcs.getAttackStyle().getColor()); - } - break; - } - } - - if (plugin.isHandCripple()) - { - int tick = plugin.getCrippleTimer(); - NPC olmHand = plugin.getHand(); - final String tickStr = String.valueOf(tick); - Point canvasPoint = olmHand.getCanvasTextLocation(graphics, tickStr, 50); - renderTextLocation(graphics, tickStr, plugin.getTextSize(), plugin.getFontStyle().getFont(), Color.GRAY, canvasPoint); - } - - if (plugin.isTimers()) - { - if (plugin.getVictims().size() > 0) - { - plugin.getVictims().forEach(victim -> - { - final int ticksLeft = victim.getTicks(); - String ticksLeftStr = String.valueOf(ticksLeft); - Color tickcolor; - switch (victim.getType()) - { - case ACID: - if (ticksLeft > 0) - { - if (ticksLeft > 1) - { - tickcolor = new Color(69, 241, 44, 255); - } - else - { - tickcolor = new Color(255, 255, 255, 255); - } - Point canvasPoint = victim.getPlayer().getCanvasTextLocation(graphics, ticksLeftStr, 0); - renderTextLocation(graphics, ticksLeftStr, plugin.getTextSize(), plugin.getFontStyle().getFont(), tickcolor, canvasPoint); - } - break; - case BURN: - if (ticksLeft > 0) - { - if (GAP.contains(ticksLeft)) - { - tickcolor = new Color(255, 0, 0, 255); - ticksLeftStr = "GAP"; - } - else - { - tickcolor = new Color(255, 255, 255, 255); - } - Point canvasPoint = victim.getPlayer().getCanvasTextLocation(graphics, ticksLeftStr, 0); - renderTextLocation(graphics, ticksLeftStr, plugin.getTextSize(), plugin.getFontStyle().getFont(), tickcolor, canvasPoint); - } - break; - case TELEPORT: - if (plugin.isTpOverlay()) - { - if (ticksLeft > 0) - { - if (ticksLeft > 1) - { - tickcolor = new Color(193, 255, 245, 255); - } - else - { - tickcolor = new Color(255, 255, 255, 255); - } - Point canvasPoint = victim.getPlayer().getCanvasTextLocation(graphics, ticksLeftStr, 0); - renderTextLocation(graphics, ticksLeftStr, plugin.getTextSize(), plugin.getFontStyle().getFont(), tickcolor, canvasPoint); - } - renderActorOverlay(graphics, victim.getPlayer(), new Color(193, 255, 245, 255)); - } - break; - } - }); - } - } - - if (plugin.isRunOlm()) - { - NPC boss = plugin.getOlm_NPC(); - - if (plugin.isOlmTick()) - { - if (boss != null) - { - final int tick = plugin.getOlm_TicksUntilAction(); - final int cycle = plugin.getOlm_ActionCycle(); - final 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, plugin.getTextSize(), plugin.getFontStyle().getFont(), Color.WHITE, canvasPoint); - } - } - } - } - - return null; - } - - private void drawTile(Graphics2D graphics, WorldPoint point, Color color, int strokeWidth, int outlineAlpha) - { - WorldPoint playerLocation = client.getLocalPlayer().getWorldLocation(); - if (point.distanceTo(playerLocation) >= 32) - { - return; - } - LocalPoint lp = LocalPoint.fromWorld(client, point); - if (lp == null) - { - return; - } - - Polygon poly = Perspective.getCanvasTilePoly(client, lp); - if (poly == null) - { - 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(), 50)); - graphics.fill(poly); - } - - private void renderActorOverlay(Graphics2D graphics, Actor actor, Color color) - { - final int size = 1; - final LocalPoint lp = actor.getLocalLocation(); - final Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size); - - if (tilePoly != null) - { - graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 100)); - graphics.setStroke(new BasicStroke(2)); - graphics.draw(tilePoly); - graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 10)); - 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 (plugin.isShadows()) - { - 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 (plugin.isShadows()) - { - 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) - { - final List little = new WorldArea(npcLoc, npcSize, npcSize).toWorldPointList(); - final List big = new WorldArea(npcLoc.getX() - thickness, npcLoc.getY() - thickness, npcSize + (thickness * 2), npcSize + (thickness * 2), npcLoc.getPlane()).toWorldPointList(); - if (!includeUnder) - { - big.removeIf(little::contains); - } - return big; - } -} 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 deleted file mode 100644 index 6648fc4e53..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxPlugin.java +++ /dev/null @@ -1,666 +0,0 @@ -/* - * Copyright (c) 2019, xzact - * Copyright (c) 2019, ganom - * Copyright (c) 2019, gazivodag - * Copyright (c) 2019, lyzrds - * 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 com.google.inject.Provides; -import java.awt.Color; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Actor; -import net.runelite.api.AnimationID; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GraphicID; -import net.runelite.api.GraphicsObject; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.Player; -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.ChatMessage; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.events.ProjectileSpawned; -import net.runelite.api.events.SpotAnimationChanged; -import net.runelite.api.util.Text; -import net.runelite.client.chat.ChatMessageManager; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "CoX Helper", - description = "All-in-one plugin for Chambers of Xeric", - tags = {"CoX", "chamber", "xeric", "helper"}, - type = PluginType.PVM, - enabledByDefault = false -) - -@Slf4j -@Singleton -@Getter(AccessLevel.PACKAGE) -public class CoxPlugin extends Plugin -{ - private static final int ANIMATION_ID_G1 = 430; - private static final Pattern TP_REGEX = Pattern.compile("You have been paired with (.*)! The magical power will enact soon..."); - - @Inject - @Getter(AccessLevel.NONE) - private Client client; - - @Inject - @Getter(AccessLevel.NONE) - private ChatMessageManager chatMessageManager; - - @Inject - @Getter(AccessLevel.NONE) - private CoxOverlay coxOverlay; - - @Inject - @Getter(AccessLevel.NONE) - private CoxInfoBox coxInfoBox; - - @Inject - @Getter(AccessLevel.NONE) - private CoxConfig config; - - @Inject - @Getter(AccessLevel.NONE) - private OverlayManager overlayManager; - - @Inject - @Getter(AccessLevel.NONE) - private EventBus eventBus; - - private boolean handCripple; - private boolean runOlm; - private int vanguards; - private boolean tektonActive; - private NPC hand; - private NPC Olm_NPC; - private List Olm_Heal = new ArrayList<>(); - private List Olm_TP = new ArrayList<>(); - private Set victims = new HashSet<>(); - private Actor acidTarget; - private int crippleTimer = 45; - private int teleportTicks = 10; - private int tektonAttackTicks; - private int OlmPhase = 0; - private int Olm_TicksUntilAction = -1; - private int Olm_ActionCycle = -1; //4:0 = auto 3:0 = null 2:0 = auto 1:0 = spec + actioncycle =4 - private int Olm_NextSpec = -1; // 1= crystals 2=lightnig 3=portals 4= heal hand if p4 - private Map npcContainer = new HashMap<>(); - @Setter(AccessLevel.PACKAGE) - private PrayAgainst prayAgainstOlm; - private long lastPrayTime; - private int sleepcount = 0; - private boolean muttadile; - private boolean tekton; - private boolean tektonTickCounter; - private boolean guardians; - private boolean guardinTickCounter; - private boolean vangHighlight; - private boolean vangHealth; - private boolean configPrayAgainstOlm; - private boolean timers; - private boolean tpOverlay; - private boolean olmTick; - private int prayAgainstSize; - private Color muttaColor; - private Color guardColor; - private Color tektonColor; - private Color burnColor; - private Color acidColor; - private Color tpColor; - private CoxConfig.FontStyle fontStyle; - private int textSize; - private boolean shadows; - - @Provides - CoxConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(CoxConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - overlayManager.add(coxOverlay); - overlayManager.add(coxInfoBox); - handCripple = false; - hand = null; - Olm_TP.clear(); - prayAgainstOlm = null; - victims.clear(); - crippleTimer = 45; - teleportTicks = 10; - vanguards = 0; - } - - @Override - protected void shutDown() - { - overlayManager.remove(coxOverlay); - overlayManager.remove(coxInfoBox); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("Cox")) - { - updateConfig(); - } - } - - @Subscribe - private void onChatMessage(ChatMessage event) - { - if (!inRaid()) - { - return; - } - - if (event.getType() == ChatMessageType.GAMEMESSAGE) - { - final Matcher tpMatcher = TP_REGEX.matcher(event.getMessage()); - - if (tpMatcher.matches()) - { - for (Player player : client.getPlayers()) - { - final String rawPlayerName = player.getName(); - - if (rawPlayerName != null) - { - final String fixedPlayerName = Text.sanitize(rawPlayerName); - - if (fixedPlayerName.equals(Text.sanitize(tpMatcher.group(1)))) - { - victims.add(new Victim(player, Victim.Type.TELEPORT)); - } - } - } - } - - switch (Text.standardize(event.getMessageNode().getValue())) - { - 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; - crippleTimer = 45; - Olm_NextSpec = -1; - break; - case "the great olm fires a sphere of aggression your way. your prayers have been sapped.": - case "the great olm fires a sphere of aggression your way.": - prayAgainstOlm = PrayAgainst.MELEE; - lastPrayTime = System.currentTimeMillis(); - break; - case "the great olm fires a sphere of magical power your way. your prayers have been sapped.": - case "the great olm fires a sphere of magical power your way.": - 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.": - case "the great olm fires a sphere of accuracy and dexterity your way.": - prayAgainstOlm = PrayAgainst.RANGED; - lastPrayTime = System.currentTimeMillis(); - break; - case "the great olm's left claw clenches to protect itself temporarily.": - handCripple = true; - - } - } - } - - @Subscribe - private void onProjectileSpawned(ProjectileSpawned event) - { - if (!inRaid()) - { - return; - } - - final Projectile projectile = event.getProjectile(); - - switch (projectile.getId()) - { - case ProjectileID.OLM_MAGE_ATTACK: - prayAgainstOlm = PrayAgainst.MAGIC; - lastPrayTime = System.currentTimeMillis(); - break; - case ProjectileID.OLM_RANGE_ATTACK: - prayAgainstOlm = PrayAgainst.RANGED; - lastPrayTime = System.currentTimeMillis(); - break; - case ProjectileID.OLM_ACID_TRAIL: - acidTarget = projectile.getInteracting(); - break; - } - } - - @Subscribe - private void onSpotAnimationChanged(SpotAnimationChanged event) - { - if (!inRaid()) - { - return; - } - - if (!(event.getActor() instanceof Player)) - { - return; - } - - final Player player = (Player) event.getActor(); - - if (player.getSpotAnimation() == GraphicID.OLM_BURN) - { - int add = 0; - - for (Victim victim : victims) - { - if (victim.getPlayer().getName().equals(player.getName())) - { - add++; - } - } - - if (add == 0) - { - victims.add(new Victim(player, Victim.Type.BURN)); - } - } - } - - @Subscribe - private void onNpcSpawned(NpcSpawned event) - { - if (!inRaid()) - { - return; - } - - final NPC npc = event.getNpc(); - - switch (npc.getId()) - { - case NpcID.TEKTON: - case NpcID.TEKTON_7541: - case NpcID.TEKTON_7542: - case NpcID.TEKTON_7545: - case NpcID.TEKTON_ENRAGED: - case NpcID.TEKTON_ENRAGED_7544: - npcContainer.put(npc, new NPCContainer(npc)); - tektonAttackTicks = 27; - break; - case NpcID.MUTTADILE: - case NpcID.MUTTADILE_7562: - case NpcID.MUTTADILE_7563: - case NpcID.GUARDIAN: - case NpcID.GUARDIAN_7570: - 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: - vanguards++; - npcContainer.put(npc, new NPCContainer(npc)); - break; - case NpcID.GREAT_OLM_LEFT_CLAW: - case NpcID.GREAT_OLM_LEFT_CLAW_7555: - hand = npc; - break; - case NpcID.GREAT_OLM: - Olm_NPC = npc; - } - } - - @Subscribe - private void onNpcDespawned(NpcDespawned event) - { - if (!inRaid()) - { - return; - } - - final NPC npc = event.getNpc(); - - switch (npc.getId()) - { - case NpcID.TEKTON: - case NpcID.TEKTON_7541: - case NpcID.TEKTON_7542: - case NpcID.TEKTON_7545: - case NpcID.TEKTON_ENRAGED: - case NpcID.TEKTON_ENRAGED_7544: - case NpcID.MUTTADILE: - case NpcID.MUTTADILE_7562: - case NpcID.MUTTADILE_7563: - case NpcID.GUARDIAN: - case NpcID.GUARDIAN_7570: - case NpcID.GUARDIAN_7571: - case NpcID.GUARDIAN_7572: - 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()); - } - vanguards--; - break; - case NpcID.GREAT_OLM_RIGHT_CLAW_7553: - case NpcID.GREAT_OLM_RIGHT_CLAW: - handCripple = false; - break; - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - if (!inRaid()) - { - OlmPhase = 0; - sleepcount = 0; - Olm_Heal.clear(); - npcContainer.clear(); - victims.clear(); - Olm_NPC = null; - hand = null; - prayAgainstOlm = null; - runOlm = false; - return; - } - - handleNpcs(); - handleVictims(); - - if (handCripple) - { - crippleTimer--; - if (crippleTimer <= 0) - { - handCripple = false; - crippleTimer = 45; - } - } - - if (runOlm) - { - handleOlm(); - } - } - - private void handleVictims() - { - if (victims.size() > 0) - { - victims.forEach(Victim::updateTicks); - victims.removeIf(victim -> victim.getTicks() <= 0); - } - } - - private void handleNpcs() - { - for (NPCContainer npcs : getNpcContainer().values()) - { - switch (npcs.getNpc().getId()) - { - 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()) - { - 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: - if (npcs.getAttackStyle() == NPCContainer.Attackstyle.UNKNOWN) - { - npcs.setAttackStyle(NPCContainer.Attackstyle.MAGE); - } - break; - case NpcID.VANGUARD_7528: - if (npcs.getAttackStyle() == NPCContainer.Attackstyle.UNKNOWN) - { - npcs.setAttackStyle(NPCContainer.Attackstyle.RANGE); - } - break; - case NpcID.VANGUARD_7527: - if (npcs.getAttackStyle() == NPCContainer.Attackstyle.UNKNOWN) - { - npcs.setAttackStyle(NPCContainer.Attackstyle.MELEE); - } - break; - } - } - if (tektonActive && tektonAttackTicks > 0) - { - tektonAttackTicks--; - } - } - - private void handleOlm() - { - 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 = 3; - } - } - else - { - Olm_NextSpec--; - } - } - else - { - if (Olm_ActionCycle != -1) - { - Olm_ActionCycle--; - } - Olm_TicksUntilAction = 4; - } - } - else - { - Olm_TicksUntilAction--; - } - - for (GraphicsObject o : client.getGraphicsObjects()) - { - if (sleepcount <= 0) - { - 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; - } - } - 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) - { - client.clearHintArrow(); - teleportTicks = 10; - } - } - } - } - - boolean inRaid() - { - return client.getVar(Varbits.IN_RAID) == 1; - } - - private void updateConfig() - { - this.muttadile = config.muttadile(); - this.tekton = config.tekton(); - this.tektonTickCounter = config.tektonTickCounter(); - this.guardians = config.guardians(); - this.guardinTickCounter = config.guardinTickCounter(); - this.vangHighlight = config.vangHighlight(); - this.vangHealth = config.vangHealth(); - this.configPrayAgainstOlm = config.prayAgainstOlm(); - this.timers = config.timers(); - this.tpOverlay = config.tpOverlay(); - this.olmTick = config.olmTick(); - this.muttaColor = config.muttaColor(); - this.guardColor = config.guardColor(); - this.tektonColor = config.tektonColor(); - this.burnColor = config.burnColor(); - this.acidColor = config.acidColor(); - this.tpColor = config.tpColor(); - this.fontStyle = config.fontStyle(); - this.textSize = config.textSize(); - this.shadows = config.shadows(); - this.prayAgainstSize = config.prayAgainstOlmSize(); - } -} 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 deleted file mode 100644 index 2faf9df5a2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/NPCContainer.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.Actor; -import net.runelite.api.NPC; -import net.runelite.api.NPCDefinition; - -@Getter(AccessLevel.PACKAGE) -class NPCContainer -{ - - private NPC npc; - private int npcIndex; - private String npcName; - private int npcSize; - @Setter(AccessLevel.PACKAGE) - private int ticksUntilAttack; - @Setter(AccessLevel.PACKAGE) - private int intermissionPeriod; - @Setter(AccessLevel.PACKAGE) - private int npcSpeed; - @Setter(AccessLevel.PACKAGE) - private Actor npcInteracting; - @Setter(AccessLevel.PACKAGE) - 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; - final NPCDefinition composition = npc.getTransformedDefinition(); - - if (composition != null) - { - this.npcSize = composition.getSize(); - } - } - - @AllArgsConstructor - @Getter(AccessLevel.PACKAGE) - 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/PrayAgainst.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/PrayAgainst.java deleted file mode 100644 index 30942bb461..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/PrayAgainst.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2019, gazivodag - * 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 lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.Prayer; - -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -public enum PrayAgainst -{ - MELEE(Prayer.PROTECT_FROM_MELEE), - MAGIC(Prayer.PROTECT_FROM_MAGIC), - RANGED(Prayer.PROTECT_FROM_MISSILES); - - private final Prayer prayer; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/Victim.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/Victim.java deleted file mode 100644 index b5b3684b3e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/Victim.java +++ /dev/null @@ -1,40 +0,0 @@ -package net.runelite.client.plugins.coxhelper; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.Player; - -@Getter(AccessLevel.PACKAGE) -class Victim -{ - private Player player; - private Type type; - private int ticks; - - Victim(Player player, Type type) - { - this.player = player; - this.type = type; - this.ticks = type.getTicks(); - } - - void updateTicks() - { - if (ticks > 0) - { - ticks--; - } - } - - @AllArgsConstructor - @Getter(AccessLevel.PACKAGE) - enum Type - { - BURN(41), - ACID(23), - TELEPORT(10); - - private int ticks; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/crystalmathlabs/CrystalMathLabs.java b/runelite-client/src/main/java/net/runelite/client/plugins/crystalmathlabs/CrystalMathLabs.java deleted file mode 100644 index e066f8b57a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/crystalmathlabs/CrystalMathLabs.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2018, 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.crystalmathlabs; - -import java.io.IOException; -import java.util.Objects; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.Player; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.http.api.RuneLiteAPI; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import org.jetbrains.annotations.NotNull; - -@PluginDescriptor( - name = "Crystal Math Labs", - description = "Automatically updates your stats on Crystal Math Labs when you log out", - tags = {"cml", "external", "integration"}, - enabledByDefault = false, - type = PluginType.MISCELLANEOUS -) -@Slf4j -@Singleton -public class CrystalMathLabs extends Plugin -{ - /** - * Amount of EXP that must be gained for an update to be submitted. - */ - private static final int XP_THRESHOLD = 10000; - - @Inject - private Client client; - - @Inject - private EventBus eventBus; - - private String lastUsername; - private boolean fetchXp; - private long lastXp; - - @Override - protected void startUp() - { - fetchXp = true; - - eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged); - eventBus.subscribe(GameTick.class, this, this::onGameTick); - } - - @Override - protected void shutDown() - { - eventBus.unregister(this); - } - - private void onGameStateChanged(GameStateChanged gameStateChanged) - { - GameState state = gameStateChanged.getGameState(); - if (state == GameState.LOGGED_IN) - { - if (!Objects.equals(client.getUsername(), lastUsername)) - { - lastUsername = client.getUsername(); - fetchXp = true; - } - } - else if (state == GameState.LOGIN_SCREEN) - { - Player local = client.getLocalPlayer(); - if (local == null) - { - return; - } - - long totalXp = client.getOverallExperience(); - // Don't submit update unless xp threshold is reached - if (Math.abs(totalXp - lastXp) > XP_THRESHOLD) - { - log.debug("Submitting update for {}", local.getName()); - sendUpdateRequest(local.getName()); - lastXp = totalXp; - } - } - } - - private void onGameTick(GameTick gameTick) - { - if (fetchXp) - { - lastXp = client.getOverallExperience(); - fetchXp = false; - } - } - - private void sendUpdateRequest(String username) - { - String reformedUsername = username.replace(" ", "_"); - OkHttpClient httpClient = RuneLiteAPI.CLIENT; - - HttpUrl httpUrl = new HttpUrl.Builder() - .scheme("https") - .host("crystalmathlabs.com") - .addPathSegment("tracker") - .addPathSegment("api.php") - .addQueryParameter("type", "update") - .addQueryParameter("player", reformedUsername) - .build(); - - Request request = new Request.Builder() - .header("User-Agent", "RuneLite") - .url(httpUrl) - .build(); - - httpClient.newCall(request).enqueue(new Callback() - { - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) - { - log.warn("Error submitting CML update, caused by {}.", e.getMessage()); - } - - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - { - response.close(); - } - }); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/customclientresizing/CustomClientResizingConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/customclientresizing/CustomClientResizingConfig.java deleted file mode 100644 index 16c243ce7d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/customclientresizing/CustomClientResizingConfig.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.runelite.client.plugins.customclientresizing; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; - -@ConfigGroup(CustomClientResizingPlugin.CONFIG_GROUP) -public interface CustomClientResizingConfig extends Config -{ -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/customclientresizing/CustomClientResizingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/customclientresizing/CustomClientResizingPlugin.java deleted file mode 100644 index c125fd1be4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/customclientresizing/CustomClientResizingPlugin.java +++ /dev/null @@ -1,203 +0,0 @@ -package net.runelite.client.plugins.customclientresizing; - -import com.google.common.base.Strings; -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; -import com.google.inject.Provides; -import java.awt.Dimension; -import java.awt.Rectangle; -import java.awt.image.BufferedImage; -import java.time.Instant; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Stream; -import javax.inject.Inject; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.customclientresizing.ui.CustomClientResizingPluginPanel; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.ClientUI; -import net.runelite.client.ui.ContainableFrame; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.util.ImageUtil; - -@PluginDescriptor( - name = "Custom Client Resizing", - description = "Resize the window to saved profiles", - tags = {"resize", "window", "position", "layout", "manage"}, - type = PluginType.MISCELLANEOUS, - enabledByDefault = false -) -public class CustomClientResizingPlugin extends Plugin -{ - public static final String CONFIG_GROUP = "customclientresizing"; - private static final String CONFIG_KEY = "customclientresizingprofiles"; - private static final String PLUGIN_NAME = "Custom Client Resizing"; - private static final String ICON_FILE = "panel_icon.png"; - - @Getter - private final List customclientresizingProfiles = new ArrayList<>(); - - @Inject - private Client client; - - @Inject - private CustomClientResizingConfig config; - - @Inject - private ClientToolbar clientToolbar; - - @Inject - private ConfigManager configManager; - - @Inject - private ClientUI clientUi; - - private CustomClientResizingPluginPanel pluginPanel; - private NavigationButton navigationButton; - private NavigationButton titleBarButton; - - @Provides - CustomClientResizingConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(CustomClientResizingConfig.class); - } - - @Override - protected void startUp() - { - loadConfig(configManager.getConfiguration(CONFIG_GROUP, CONFIG_KEY)).forEach(customclientresizingProfiles::add); - - pluginPanel = injector.getInstance(CustomClientResizingPluginPanel.class); - pluginPanel.rebuild(); - - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), ICON_FILE); - - navigationButton = NavigationButton.builder() - .tooltip(PLUGIN_NAME) - .icon(icon) - .priority(1) - .panel(pluginPanel) - .build(); - - titleBarButton = NavigationButton.builder() - .tab(false) - .tooltip("Set resize profile") - .icon(icon) - .onClick(() -> - { - ContainableFrame frame = clientUi.getFrame(); - - - CustomClientResizingProfile active = customclientresizingProfiles.stream().filter(CustomClientResizingProfile::isVisible).findFirst().orElse(null); - if (active == null) - { - return; - } - Rectangle bounds = new Rectangle( - active.getPosition().width, active.getPosition().height, - active.getSize().width, active.getSize().height - ); - if (!clientUi.isSidebarOpen()) - { - bounds.width -= clientUi.getPluginToolbar().getWidth(); - } - if (clientUi.getPluginPanel() == null) - { - bounds.width -= pluginPanel.getWrappedPanel().getPreferredSize().width; - } - frame.setBounds(bounds); - frame.revalidateMinimumSize(); - }) - .build(); - - clientToolbar.addNavigation(titleBarButton); - clientToolbar.addNavigation(navigationButton); - } - - @Override - protected void shutDown() - { - customclientresizingProfiles.clear(); - clientToolbar.removeNavigation(navigationButton); - clientToolbar.removeNavigation(titleBarButton); - - pluginPanel = null; - navigationButton = null; - } - - @Subscribe - public void onConfigChanged(ConfigChanged event) - { - if (customclientresizingProfiles.isEmpty() && event.getGroup().equals(CONFIG_GROUP) && event.getKey().equals(CONFIG_KEY)) - { - loadConfig(event.getNewValue()).forEach(customclientresizingProfiles::add); - } - - - } - - public void updateConfig() - { - if (customclientresizingProfiles.isEmpty()) - { - configManager.unsetConfiguration(CONFIG_GROUP, CONFIG_KEY); - return; - } - - final Gson gson = new Gson(); - final String json = gson - .toJson(customclientresizingProfiles); - configManager.setConfiguration(CONFIG_GROUP, CONFIG_KEY, json); - } - - private Stream loadConfig(String json) - { - if (Strings.isNullOrEmpty(json)) - { - return Stream.empty(); - } - - final Gson gson = new Gson(); - final List customclientresizingProfileData = gson.fromJson(json, new TypeToken>() - { - }.getType()); - - return customclientresizingProfileData.stream(); - } - - public void addProfile() - { - ContainableFrame frame = clientUi.getFrame(); - CustomClientResizingProfile profile = new CustomClientResizingProfile( - Instant.now().toEpochMilli(), - "Profile " + (customclientresizingProfiles.size() + 1), - new Dimension(frame.getX(), frame.getY()), - new Dimension(frame.getWidth(), frame.getHeight()), - false - ); - - customclientresizingProfiles.add(profile); - pluginPanel.updateProfiles(); - updateConfig(); - } - - public void deleteProfile(final CustomClientResizingProfile profile) - { - customclientresizingProfiles.remove(profile); - pluginPanel.updateProfiles(); - updateConfig(); - } - - public void disableProfiles() - { - customclientresizingProfiles.forEach(e -> e.setVisible(false)); - pluginPanel.updateProfiles(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/customclientresizing/CustomClientResizingProfile.java b/runelite-client/src/main/java/net/runelite/client/plugins/customclientresizing/CustomClientResizingProfile.java deleted file mode 100644 index a6052f7b12..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/customclientresizing/CustomClientResizingProfile.java +++ /dev/null @@ -1,18 +0,0 @@ -package net.runelite.client.plugins.customclientresizing; - -import java.awt.Dimension; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class CustomClientResizingProfile -{ - private long id; - private String name; - private Dimension position; - private Dimension size; - private boolean visible; -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/customclientresizing/ui/CustomClientResizingPluginPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/customclientresizing/ui/CustomClientResizingPluginPanel.java deleted file mode 100644 index 8ece7ef7a8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/customclientresizing/ui/CustomClientResizingPluginPanel.java +++ /dev/null @@ -1,136 +0,0 @@ -package net.runelite.client.plugins.customclientresizing.ui; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; -import javax.swing.Box; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; -import lombok.Getter; -import net.runelite.client.plugins.customclientresizing.CustomClientResizingPlugin; -import net.runelite.client.plugins.customclientresizing.CustomClientResizingProfile; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.util.ImageUtil; - -@Singleton -public class CustomClientResizingPluginPanel extends PluginPanel -{ - private static final ImageIcon ADD_ICON; - private static final ImageIcon ADD_HOVER_ICON; - - private static final Color DEFAULT_BORDER_COLOR = Color.GREEN; - private static final Color DEFAULT_FILL_COLOR = new Color(0, 255, 0, 0); - - private static final int DEFAULT_BORDER_THICKNESS = 3; - - static - { - final BufferedImage addIcon = ImageUtil.getResourceStreamFromClass(CustomClientResizingPlugin.class, "add_icon.png"); - ADD_ICON = new ImageIcon(addIcon); - ADD_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(addIcon, 0.53f)); - } - - private final JLabel addMarker = new JLabel(ADD_ICON); - private final JLabel title = new JLabel(); - private final JPanel markerView = new JPanel(new GridBagLayout()); - @Inject - private CustomClientResizingPlugin plugin; - @Getter - private Color selectedColor = DEFAULT_BORDER_COLOR; - @Getter - private Color selectedFillColor = DEFAULT_FILL_COLOR; - @Getter - private int selectedBorderThickness = DEFAULT_BORDER_THICKNESS; - - public void init() - { - setLayout(new BorderLayout()); - setBorder(new EmptyBorder(10, 10, 10, 10)); - - JPanel northPanel = new JPanel(new BorderLayout()); - northPanel.setBorder(new EmptyBorder(1, 0, 10, 0)); - - title.setText("Resize Profiles"); - title.setForeground(Color.WHITE); - - northPanel.add(title, BorderLayout.WEST); - northPanel.add(addMarker, BorderLayout.EAST); - - JPanel centerPanel = new JPanel(new BorderLayout()); - centerPanel.setBackground(ColorScheme.DARK_GRAY_COLOR); - - markerView.setBackground(ColorScheme.DARK_GRAY_COLOR); - - updateProfiles(); - - addMarker.setToolTipText("Add new screen marker"); - addMarker.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - plugin.addProfile(); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - addMarker.setIcon(ADD_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - addMarker.setIcon(ADD_ICON); - } - }); - - centerPanel.add(markerView, BorderLayout.CENTER); - - add(northPanel, BorderLayout.NORTH); - add(centerPanel, BorderLayout.CENTER); - } - - public void rebuild() - { - removeAll(); - repaint(); - revalidate(); - init(); - } - - public void updateProfiles() - { - markerView.removeAll(); - - GridBagConstraints constraints = new GridBagConstraints(); - constraints.fill = GridBagConstraints.HORIZONTAL; - constraints.weightx = 1; - constraints.gridx = 0; - constraints.gridy = 0; - - for (final CustomClientResizingProfile marker : plugin.getCustomclientresizingProfiles()) - { - markerView.add(new CustomClientResizingProfilePanel(plugin, marker), constraints); - constraints.gridy++; - - markerView.add(Box.createRigidArea(new Dimension(0, 10)), constraints); - constraints.gridy++; - } - - repaint(); - revalidate(); - } - -} - diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/customclientresizing/ui/CustomClientResizingProfilePanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/customclientresizing/ui/CustomClientResizingProfilePanel.java deleted file mode 100644 index 475aee9d88..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/customclientresizing/ui/CustomClientResizingProfilePanel.java +++ /dev/null @@ -1,349 +0,0 @@ -package net.runelite.client.plugins.customclientresizing.ui; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; -import javax.swing.BorderFactory; -import javax.swing.ImageIcon; -import javax.swing.JFormattedTextField; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JSpinner; -import javax.swing.SpinnerModel; -import javax.swing.SpinnerNumberModel; -import javax.swing.border.Border; -import javax.swing.border.CompoundBorder; -import javax.swing.border.EmptyBorder; -import javax.swing.event.ChangeListener; -import net.runelite.client.plugins.customclientresizing.CustomClientResizingPlugin; -import net.runelite.client.plugins.customclientresizing.CustomClientResizingProfile; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.components.FlatTextField; -import net.runelite.client.util.ImageUtil; - -public class CustomClientResizingProfilePanel extends JPanel -{ - private static final int DEFAULT_FILL_OPACITY = 75; - - private static final Border NAME_BOTTOM_BORDER = new CompoundBorder( - BorderFactory.createMatteBorder(0, 0, 1, 0, ColorScheme.DARK_GRAY_COLOR), - BorderFactory.createLineBorder(ColorScheme.DARKER_GRAY_COLOR)); - - private static final ImageIcon VISIBLE_ICON; - private static final ImageIcon VISIBLE_HOVER_ICON; - private static final ImageIcon INVISIBLE_ICON; - private static final ImageIcon INVISIBLE_HOVER_ICON; - private static final ImageIcon DELETE_ICON; - private static final ImageIcon DELETE_HOVER_ICON; - - static - { - final BufferedImage visibleImg = ImageUtil.getResourceStreamFromClass(CustomClientResizingPlugin.class, "visible_icon.png"); - VISIBLE_ICON = new ImageIcon(visibleImg); - VISIBLE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(visibleImg, -100)); - - final BufferedImage invisibleImg = ImageUtil.getResourceStreamFromClass(CustomClientResizingPlugin.class, "invisible_icon.png"); - INVISIBLE_ICON = new ImageIcon(invisibleImg); - INVISIBLE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(invisibleImg, -100)); - - final BufferedImage deleteImg = ImageUtil.getResourceStreamFromClass(CustomClientResizingPlugin.class, "delete_icon.png"); - DELETE_ICON = new ImageIcon(deleteImg); - DELETE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(deleteImg, -100)); - } - - private final CustomClientResizingPlugin plugin; - private final CustomClientResizingProfile profile; - private final JLabel visibilityLabel = new JLabel(); - private final JLabel deleteLabel = new JLabel(); - private final FlatTextField nameInput = new FlatTextField(); - private final JLabel save = new JLabel("Save"); - private final JLabel cancel = new JLabel("Cancel"); - private final JLabel rename = new JLabel("Rename"); - - CustomClientResizingProfilePanel(CustomClientResizingPlugin plugin, CustomClientResizingProfile profile) - { - this.plugin = plugin; - this.profile = profile; - - setLayout(new BorderLayout()); - setBackground(ColorScheme.DARKER_GRAY_COLOR); - - JPanel nameWrapper = new JPanel(new BorderLayout()); - nameWrapper.setBackground(ColorScheme.DARKER_GRAY_COLOR); - nameWrapper.setBorder(NAME_BOTTOM_BORDER); - - JPanel nameActions = new JPanel(new BorderLayout(3, 0)); - nameActions.setBorder(new EmptyBorder(0, 0, 0, 8)); - nameActions.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - save.setVisible(false); - save.setFont(FontManager.getRunescapeSmallFont()); - save.setForeground(ColorScheme.PROGRESS_COMPLETE_COLOR); - save.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - profile.setName(nameInput.getText()); - plugin.updateConfig(); - - nameInput.setEditable(false); - updateNameActions(false); - requestFocusInWindow(); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - save.setForeground(ColorScheme.PROGRESS_COMPLETE_COLOR.darker()); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - save.setForeground(ColorScheme.PROGRESS_COMPLETE_COLOR); - } - }); - - cancel.setVisible(false); - cancel.setFont(FontManager.getRunescapeSmallFont()); - cancel.setForeground(ColorScheme.PROGRESS_ERROR_COLOR); - cancel.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - nameInput.setEditable(false); - nameInput.setText(profile.getName()); - updateNameActions(false); - requestFocusInWindow(); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - cancel.setForeground(ColorScheme.PROGRESS_ERROR_COLOR.darker()); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - cancel.setForeground(ColorScheme.PROGRESS_ERROR_COLOR); - } - }); - - rename.setFont(FontManager.getRunescapeSmallFont()); - rename.setForeground(ColorScheme.LIGHT_GRAY_COLOR.darker()); - rename.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - nameInput.setEditable(true); - updateNameActions(true); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - rename.setForeground(ColorScheme.LIGHT_GRAY_COLOR.darker().darker()); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - rename.setForeground(ColorScheme.LIGHT_GRAY_COLOR.darker()); - } - }); - - nameActions.add(save, BorderLayout.EAST); - nameActions.add(cancel, BorderLayout.WEST); - nameActions.add(rename, BorderLayout.CENTER); - - nameInput.setText(profile.getName()); - nameInput.setBorder(null); - nameInput.setEditable(false); - nameInput.setBackground(ColorScheme.DARKER_GRAY_COLOR); - nameInput.setPreferredSize(new Dimension(0, 24)); - nameInput.getTextField().setForeground(Color.WHITE); - nameInput.getTextField().setBorder(new EmptyBorder(0, 8, 0, 0)); - - nameWrapper.add(nameInput, BorderLayout.CENTER); - nameWrapper.add(nameActions, BorderLayout.EAST); - - JPanel bottomContainer = new JPanel(new BorderLayout()); - bottomContainer.setBorder(new EmptyBorder(8, 0, 8, 0)); - bottomContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - JPanel leftActions = new JPanel(new BorderLayout()); - leftActions.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - JPanel positionPanel = createPositionPanel(profile.getPosition().width, profile.getPosition().height); - JPanel sizePanel = createSizePanel(profile.getSize().width, profile.getSize().height); - - leftActions.add(positionPanel, BorderLayout.NORTH); - leftActions.add(sizePanel, BorderLayout.SOUTH); - - JPanel rightActions = new JPanel(new FlowLayout(FlowLayout.RIGHT, 8, 0)); - rightActions.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - visibilityLabel.setToolTipText(profile.isVisible() ? "Deactivated" : "Activate resize profile"); - visibilityLabel.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - if (profile.isVisible()) - { - return; - } - plugin.disableProfiles(); - profile.setVisible(true); - updateVisibility(); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - visibilityLabel.setIcon(profile.isVisible() ? VISIBLE_HOVER_ICON : INVISIBLE_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - updateVisibility(); - } - }); - - deleteLabel.setIcon(DELETE_ICON); - deleteLabel.setToolTipText("Delete resize profile"); - deleteLabel.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - int confirm = JOptionPane.showConfirmDialog(CustomClientResizingProfilePanel.this, - "Are you sure you want to permanently delete this resize profile?", - "Warning", JOptionPane.OK_CANCEL_OPTION); - - if (confirm == 0) - { - plugin.deleteProfile(profile); - } - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - deleteLabel.setIcon(DELETE_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - deleteLabel.setIcon(DELETE_ICON); - } - }); - - rightActions.add(visibilityLabel); - rightActions.add(deleteLabel); - - bottomContainer.add(leftActions, BorderLayout.WEST); - bottomContainer.add(rightActions, BorderLayout.EAST); - - add(nameWrapper, BorderLayout.NORTH); - add(bottomContainer, BorderLayout.CENTER); - - updateVisibility(); - } - - private JPanel createPositionPanel(int width, int height) - { - JPanel dimensionPanel = new JPanel(); - dimensionPanel.setLayout(new BorderLayout()); - - JSpinner widthSpinner = createSpinner(width); - JSpinner heightSpinner = createSpinner(height); - - ChangeListener listener = e -> updatePosition((Integer) widthSpinner.getValue(), (Integer) heightSpinner.getValue()); - - widthSpinner.addChangeListener(listener); - heightSpinner.addChangeListener(listener); - - dimensionPanel.add(widthSpinner, BorderLayout.WEST); - dimensionPanel.add(new JLabel(" x "), BorderLayout.CENTER); - dimensionPanel.add(heightSpinner, BorderLayout.EAST); - - return dimensionPanel; - } - - private JPanel createSizePanel(int width, int height) - { - JPanel dimensionPanel = new JPanel(); - dimensionPanel.setLayout(new BorderLayout()); - - JSpinner widthSpinner = createSpinner(width); - JSpinner heightSpinner = createSpinner(height); - - ChangeListener listener = e -> updateSize((Integer) widthSpinner.getValue(), (Integer) heightSpinner.getValue()); - - widthSpinner.addChangeListener(listener); - heightSpinner.addChangeListener(listener); - - dimensionPanel.add(widthSpinner, BorderLayout.WEST); - dimensionPanel.add(new JLabel(" x "), BorderLayout.CENTER); - dimensionPanel.add(heightSpinner, BorderLayout.EAST); - - return dimensionPanel; - } - - private JSpinner createSpinner(int value) - { - SpinnerModel model = new SpinnerNumberModel(value, Integer.MIN_VALUE, Integer.MAX_VALUE, 1); - JSpinner spinner = new JSpinner(model); - Component editor = spinner.getEditor(); - JFormattedTextField spinnerTextField = ((JSpinner.DefaultEditor) editor).getTextField(); - spinnerTextField.setColumns(4); - - return spinner; - } - - private void updateNameActions(boolean saveAndCancel) - { - save.setVisible(saveAndCancel); - cancel.setVisible(saveAndCancel); - rename.setVisible(!saveAndCancel); - - if (saveAndCancel) - { - nameInput.getTextField().requestFocusInWindow(); - nameInput.getTextField().selectAll(); - } - } - - private void updateVisibility() - { - visibilityLabel.setIcon(profile.isVisible() ? VISIBLE_ICON : INVISIBLE_ICON); - plugin.updateConfig(); - } - - private void updatePosition(int x, int y) - { - profile.setPosition(new Dimension(x, y)); - plugin.updateConfig(); - } - - private void updateSize(int w, int h) - { - profile.setSize(new Dimension(w, h)); - plugin.updateConfig(); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/customcursor/CustomCursor.java b/runelite-client/src/main/java/net/runelite/client/plugins/customcursor/CustomCursor.java deleted file mode 100644 index d2d36f67aa..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/customcursor/CustomCursor.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2018, Kruithne - * 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.customcursor; - -import java.awt.image.BufferedImage; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.util.ImageUtil; - -public enum CustomCursor -{ - RS3_GOLD("RS3 Gold", "cursor-rs3-gold.png"), - RS3_SILVER("RS3 Silver", "cursor-rs3-silver.png"), - DRAGON_DAGGER("Dragon Dagger", "cursor-dragon-dagger.png"), - DRAGON_DAGGER_POISON("Dragon Dagger (p)", "cursor-dragon-dagger-p.png"), - TROUT("Trout", "cursor-trout.png"), - DRAGON_SCIMITAR("Dragon Scimitar", "cursor-dragon-scimitar.png"), - ARMADYL_GODSWORD("Armadyl Godsword", "cursor-armadyl-godsword.png"), - BANDOS_GODSWORD("Bandos Godsword", "cursor-bandos-godsword.png"), - MOUSE("Mouse", "cursor-mouse.png"), - SARADOMIN_GODSWORD("Saradomin Godsword", "cursor-saradomin-godsword.png"), - ZAMORAK_GODSWORD("Zamorak Godsword", "cursor-zamorak-godsword.png"), - SKILL_SPECS("Skill Specs", "cursor-skill-specs.png"); - - private final String name; - @Getter(AccessLevel.PUBLIC) - private final BufferedImage cursorImage; - - CustomCursor(final String name, final String icon) - { - this.name = name; - this.cursorImage = ImageUtil.getResourceStreamFromClass(CustomCursorPlugin.class, icon); - } - - @Override - public String toString() - { - return name; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/customcursor/CustomCursorConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/customcursor/CustomCursorConfig.java deleted file mode 100644 index cf7075a393..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/customcursor/CustomCursorConfig.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2018, Kruithne - * 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.customcursor; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("customcursor") -public interface CustomCursorConfig extends Config -{ - @ConfigItem( - keyName = "cursorStyle", - name = "Cursor", - description = "Select which cursor you wish to use" - ) - default CustomCursor selectedCursor() - { - return CustomCursor.RS3_GOLD; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/customcursor/CustomCursorPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/customcursor/CustomCursorPlugin.java deleted file mode 100644 index 723b17e7cf..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/customcursor/CustomCursorPlugin.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2018, Kruithne - * 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.customcursor; - -import com.google.inject.Provides; -import java.io.IOException; -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.sound.sampled.AudioInputStream; -import javax.sound.sampled.AudioSystem; -import javax.sound.sampled.Clip; -import javax.sound.sampled.FloatControl; -import javax.sound.sampled.LineUnavailableException; -import javax.sound.sampled.UnsupportedAudioFileException; -import lombok.extern.slf4j.Slf4j; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.ui.ClientUI; - -@Slf4j -@PluginDescriptor( - name = "Custom Cursor", - description = "Replaces your mouse cursor image", - enabledByDefault = false, - type = PluginType.MISCELLANEOUS -) -@Singleton -public class CustomCursorPlugin extends Plugin -{ - @Inject - private ClientUI clientUI; - - @Inject - private CustomCursorConfig config; - - private Clip skillSpecsRage; - private int volume = 35; - - @Provides - CustomCursorConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(CustomCursorConfig.class); - } - - @Override - protected void startUp() - { - updateCursor(); - - try (AudioInputStream ais = AudioSystem.getAudioInputStream(this.getClass().getResourceAsStream("specs-rage.wav"))) - { - skillSpecsRage = AudioSystem.getClip(); - skillSpecsRage.open(ais); - FloatControl gain = (FloatControl) skillSpecsRage.getControl(FloatControl.Type.MASTER_GAIN); - float gainVal = (((float) volume) * 40f / 100f) - 35f; - gain.setValue(gainVal); - } - catch (UnsupportedAudioFileException | IOException | LineUnavailableException e) - { - log.warn("Error opening audiostream from specs-rage.wav", e); - skillSpecsRage = null; - } - } - - @Override - protected void shutDown() - { - clientUI.resetCursor(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("customcursor") && event.getKey().equals("cursorStyle")) - { - updateCursor(); - } - - if (event.getGroup().equals("metronome") && event.getKey().equals("volume")) - { - this.volume = Integer.parseInt(event.getNewValue()); - } - } - - private void updateCursor() - { - CustomCursor selectedCursor = config.selectedCursor(); - - if (selectedCursor == CustomCursor.SKILL_SPECS) - { - if (skillSpecsRage != null) - { - if (skillSpecsRage.isRunning()) - { - skillSpecsRage.stop(); - } - - skillSpecsRage.setFramePosition(0); - skillSpecsRage.start(); - } - } - - clientUI.setCursor(selectedCursor.getCursorImage(), selectedCursor.toString()); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dailytaskindicators/DailyTasksConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/dailytaskindicators/DailyTasksConfig.java deleted file mode 100644 index fedef51060..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dailytaskindicators/DailyTasksConfig.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2018, Infinitay - * Copyright (c) 2018, Shaun Dreclin - * - * 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.dailytaskindicators; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("dailytaskindicators") -public interface DailyTasksConfig extends Config -{ - @ConfigItem( - position = 1, - keyName = "showHerbBoxes", - name = "Show Herb Boxes", - description = "Show a message when you can collect your daily herb boxes at NMZ." - ) - default boolean showHerbBoxes() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "showStaves", - name = "Show Claimable Staves", - description = "Show a message when you can collect your daily battlestaves from Zaff." - ) - default boolean showStaves() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "showEssence", - name = "Show Claimable Essence", - description = "Show a message when you can collect your daily pure essence from Wizard Cromperty." - ) - default boolean showEssence() - { - return false; - } - - @ConfigItem( - position = 4, - keyName = "showRunes", - name = "Show Claimable Random Runes", - description = "Show a message when you can collect your daily random runes from Lundail." - ) - default boolean showRunes() - { - return false; - } - - @ConfigItem( - position = 5, - keyName = "showSand", - name = "Show Claimable Sand", - description = "Show a message when you can collect your daily sand from Bert." - ) - default boolean showSand() - { - return false; - } - - @ConfigItem( - position = 6, - keyName = "showFlax", - name = "Show Claimable Bow Strings", - description = "Show a message when you can convert noted flax to bow strings with the Flax keeper." - ) - default boolean showFlax() - { - return false; - } - - @ConfigItem( - position = 7, - keyName = "showBonemeal", - name = "Show Claimable Bonemeal & Slime", - description = "Show a message when you can collect bonemeal & slime from Robin." - ) - default boolean showBonemeal() - { - return false; - } - - @ConfigItem( - position = 8, - keyName = "showArrows", - name = "Show Claimable Ogre Arrows", - description = "Show a message when you can collect ogre arrows from Rantz." - ) - default boolean showArrows() - { - return true; - } - - @ConfigItem( - position = 9, - keyName = "showDynamite", - name = "Show Claimable Dynamite", - description = "Show a message when you can collect Dynamite from Thirus." - ) - default boolean showDynamite() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dailytaskindicators/DailyTasksPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/dailytaskindicators/DailyTasksPlugin.java deleted file mode 100644 index cf4269c4a7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dailytaskindicators/DailyTasksPlugin.java +++ /dev/null @@ -1,324 +0,0 @@ -/* - * Copyright (c) 2018, Infinitay - * Copyright (c) 2018-2019, Shaun Dreclin - * 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.dailytaskindicators; - -import com.google.inject.Provides; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.VarClientInt; -import net.runelite.api.VarPlayer; -import net.runelite.api.Varbits; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.vars.AccountType; -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.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Daily Task Indicator", - description = "Show chat notifications for daily tasks upon login", - type = PluginType.UTILITY -) -@Singleton -public class DailyTasksPlugin extends Plugin -{ - private static final int ONE_DAY = 86400000; - - private static final String HERB_BOX_MESSAGE = "You have herb boxes waiting to be collected at NMZ."; - private static final int HERB_BOX_MAX = 15; - private static final int HERB_BOX_COST = 9500; - private static final String STAVES_MESSAGE = "You have battlestaves waiting to be collected from Zaff."; - private static final String ESSENCE_MESSAGE = "You have essence waiting to be collected from Wizard Cromperty."; - private static final String RUNES_MESSAGE = "You have random runes waiting to be collected from Lundail."; - private static final String SAND_MESSAGE = "You have sand waiting to be collected from Bert."; - private static final int SAND_QUEST_COMPLETE = 160; - private static final String FLAX_MESSAGE = "You have bowstrings waiting to be converted from flax from the Flax keeper."; - private static final String ARROWS_MESSAGE = "You have ogre arrows waiting to be collected from Rantz."; - private static final String BONEMEAL_MESSAGE = "You have bonemeal and slime waiting to be collected from Robin."; - private static final int BONEMEAL_PER_DIARY = 13; - private static final String DYNAMITE_MESSAGE = "You have dynamite waiting to be collected from Thirus."; - - @Inject - private Client client; - - @Inject - private DailyTasksConfig config; - - @Inject - private ChatMessageManager chatMessageManager; - - private long lastReset; - private boolean loggingIn; - - private boolean showHerbBoxes; - private boolean showStaves; - private boolean showEssence; - private boolean showRunes; - private boolean showSand; - private boolean showFlax; - private boolean showBonemeal; - private boolean showArrows; - private boolean showDynamite; - - @Provides - DailyTasksConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(DailyTasksConfig.class); - } - - @Override - public void startUp() - { - updateConfig(); - - loggingIn = true; - } - - @Override - public void shutDown() - { - lastReset = 0L; - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGGING_IN) - { - loggingIn = true; - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - long currentTime = System.currentTimeMillis(); - boolean dailyReset = !loggingIn && currentTime - lastReset > ONE_DAY; - - if ((dailyReset || loggingIn) - && client.getVar(VarClientInt.MEMBERSHIP_STATUS) == 1) - { - // Round down to the nearest day - lastReset = (long) Math.floor(currentTime / ONE_DAY) * ONE_DAY; - loggingIn = false; - - if (this.showHerbBoxes) - { - checkHerbBoxes(dailyReset); - } - - if (this.showStaves) - { - checkStaves(dailyReset); - } - - if (this.showEssence) - { - checkEssence(dailyReset); - } - - if (this.showRunes) - { - checkRunes(dailyReset); - } - - if (this.showSand) - { - checkSand(dailyReset); - } - - if (this.showFlax) - { - checkFlax(dailyReset); - } - - if (this.showBonemeal) - { - checkBonemeal(dailyReset); - } - - if (this.showArrows) - { - checkArrows(dailyReset); - } - - if (this.showDynamite) - { - checkDynamite(dailyReset); - } - } - } - - private void checkHerbBoxes(boolean dailyReset) - { - - if (client.getAccountType() == AccountType.NORMAL - && client.getVar(VarPlayer.NMZ_REWARD_POINTS) >= HERB_BOX_COST - && (client.getVar(Varbits.DAILY_HERB_BOXES_COLLECTED) < HERB_BOX_MAX - || dailyReset)) - { - sendChatMessage(HERB_BOX_MESSAGE); - } - } - - private void checkStaves(boolean dailyReset) - { - if (client.getVar(Varbits.DIARY_VARROCK_EASY) == 1 - && (client.getVar(Varbits.DAILY_STAVES_COLLECTED) == 0 - || dailyReset)) - { - sendChatMessage(STAVES_MESSAGE); - } - } - - private void checkEssence(boolean dailyReset) - { - if (client.getVar(Varbits.DIARY_ARDOUGNE_MEDIUM) == 1 - && (client.getVar(Varbits.DAILY_ESSENCE_COLLECTED) == 0 - || dailyReset)) - { - sendChatMessage(ESSENCE_MESSAGE); - } - } - - private void checkRunes(boolean dailyReset) - { - if (client.getVar(Varbits.DIARY_WILDERNESS_EASY) == 1 - && (client.getVar(Varbits.DAILY_RUNES_COLLECTED) == 0 - || dailyReset)) - { - sendChatMessage(RUNES_MESSAGE); - } - } - - private void checkSand(boolean dailyReset) - { - if (client.getVar(Varbits.QUEST_THE_HAND_IN_THE_SAND) >= SAND_QUEST_COMPLETE - && (client.getVar(Varbits.DAILY_SAND_COLLECTED) == 0 - || dailyReset)) - { - sendChatMessage(SAND_MESSAGE); - } - } - - private void checkFlax(boolean dailyReset) - { - if ((client.getVar(Varbits.DIARY_KANDARIN_EASY) == 1) - && (dailyReset || client.getVar(Varbits.DAILY_FLAX_STATE) == 0)) - { - sendChatMessage(FLAX_MESSAGE); - } - } - - private void checkArrows(boolean dailyReset) - { - if (client.getVar(Varbits.DIARY_WESTERN_EASY) == 1 - && (client.getVar(Varbits.DAILY_ARROWS_STATE) == 0 - || dailyReset)) - { - sendChatMessage(ARROWS_MESSAGE); - } - } - - private void checkBonemeal(boolean dailyReset) - { - if (client.getVar(Varbits.DIARY_MORYTANIA_MEDIUM) == 1) - { - int collected = client.getVar(Varbits.DAILY_BONEMEAL_STATE); - int max = BONEMEAL_PER_DIARY; - if (client.getVar(Varbits.DIARY_MORYTANIA_HARD) == 1) - { - max += BONEMEAL_PER_DIARY; - if (client.getVar(Varbits.DIARY_MORYTANIA_ELITE) == 1) - { - max += BONEMEAL_PER_DIARY; - } - } - if (dailyReset || collected < max) - { - sendChatMessage(BONEMEAL_MESSAGE); - } - } - } - - private void checkDynamite(boolean dailyReset) - { - if (client.getVar(Varbits.DIARY_KOUREND_MEDIUM) == 1 - && (client.getVar(Varbits.DAILY_DYNAMITE_COLLECTED) == 0 - || dailyReset)) - { - sendChatMessage(DYNAMITE_MESSAGE); - } - } - - private void sendChatMessage(String chatMessage) - { - final String message = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append(chatMessage) - .build(); - - chatMessageManager.queue( - QueuedMessage.builder() - .type(ChatMessageType.CONSOLE) - .runeLiteFormattedMessage(message) - .build()); - } - - @Subscribe - private void onConfigChanged(ConfigChanged configChanged) - { - if (configChanged.getGroup().equals("dailytaskindicators")) - { - updateConfig(); - } - } - - private void updateConfig() - { - this.showHerbBoxes = config.showHerbBoxes(); - this.showStaves = config.showStaves(); - this.showEssence = config.showEssence(); - this.showRunes = config.showRunes(); - this.showSand = config.showSand(); - this.showFlax = config.showFlax(); - this.showBonemeal = config.showBonemeal(); - this.showArrows = config.showArrows(); - this.showDynamite = config.showDynamite(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/deathindicator/Bone.java b/runelite-client/src/main/java/net/runelite/client/plugins/deathindicator/Bone.java deleted file mode 100644 index 4144632a40..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/deathindicator/Bone.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.runelite.client.plugins.deathindicator; - -import java.time.Duration; -import java.time.Instant; -import lombok.AccessLevel; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.Scene; -import net.runelite.api.coords.WorldPoint; -import static net.runelite.client.plugins.deathindicator.DeathIndicatorPlugin.HIJACKED_ITEMID; -import net.runelite.client.util.ColorUtil; -import net.runelite.client.util.MiscUtils; - -@EqualsAndHashCode -@Getter(AccessLevel.PACKAGE) -@Setter(AccessLevel.PACKAGE) -class Bone -{ - private String name; - private WorldPoint loc; - private Instant time; - - void addToScene(Scene scene) - { - scene.addItem(HIJACKED_ITEMID, 1, loc); - } - - void removeFromScene(Scene scene) - { - scene.removeItem(HIJACKED_ITEMID, 1, loc); - } - - String getName() - { - return ColorUtil.colorStartTag(0xff9040) + "Bones (" + name + ")"; - } - - String getExamine() - { - return name + " died here " + MiscUtils.formatTimeAgo(Duration.between(time, Instant.now())); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/deathindicator/Bones.java b/runelite-client/src/main/java/net/runelite/client/plugins/deathindicator/Bones.java deleted file mode 100644 index 5d886b56a3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/deathindicator/Bones.java +++ /dev/null @@ -1,190 +0,0 @@ -package net.runelite.client.plugins.deathindicator; - -import com.google.common.collect.ImmutableMap; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Consumer; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.Scene; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.config.ConfigManager; -import static net.runelite.http.api.RuneLiteAPI.GSON; - -@Slf4j -class Bones -{ - private static final String CONFIG_GROUP = "deathIndicator"; - private static final String BONES_PREFIX = "bones_"; - - private ImmutableMap>> map; - - void init(Client client, ConfigManager configManager) - { - // Clone is important here as the normal array changes - int[] regions = client.getMapRegions().clone(); - Bone[][] bones = getBones(configManager, regions); - if (log.isDebugEnabled()) - { - log.trace("Regions are now {}", Arrays.toString(regions)); - - int n = 0; - for (Bone[] ar : bones) - { - n += ar.length; - } - log.debug("Loaded {} Bones", n); - } - - initMap(regions, bones); - - showBones(client.getScene()); - } - - private Bone[][] getBones(ConfigManager configManager, int[] regions) - { - Bone[][] bones = new Bone[regions.length][]; - - for (int i = 0; i < regions.length; i++) - { - int region = regions[i]; - bones[i] = getBones(configManager, region); - } - - return bones; - } - - private Bone[] getBones(ConfigManager configManager, int regionId) - { - String json = configManager.getConfiguration(CONFIG_GROUP, BONES_PREFIX + regionId); - if (json == null) - { - return new Bone[0]; - } - - return GSON.fromJson(json, Bone[].class); - } - - @SuppressWarnings("unchecked") - private void initMap(int[] regions, Bone[][] bones) - { - ImmutableMap.Builder>> builder = ImmutableMap.builder(); - - for (int i = 0; i < regions.length; i++) - { - int region = regions[i]; - Bone[] boneA = bones[i]; - if (boneA.length == 0) - { - builder.put(region, new HashMap<>()); - continue; - } - - Map> map = new HashMap(boneA.length); - for (Bone b : boneA) - { - List list = map.computeIfAbsent(b.getLoc(), wp -> new ArrayList<>()); - list.add(b); - } - - builder.put(region, map); - } - - this.map = builder.build(); - } - - private void showBones(Scene scene) - { - this.forEach(bone -> bone.addToScene(scene)); - } - - void save(ConfigManager configManager, int region) - { - final Map> regionBones = this.map.get(region); - if (regionBones == null) - { - return; - } - - final String key = BONES_PREFIX + region; - - if (regionBones.size() == 0) - { - configManager.unsetConfiguration(CONFIG_GROUP, key); - } - - List list = new ArrayList<>(regionBones.values().size()); - for (List lb : regionBones.values()) - { - list.addAll(lb); - } - - String val = GSON.toJson(list.toArray(new Bone[0])); - configManager.setConfiguration(CONFIG_GROUP, key, val); - } - - public boolean add(Bone bone) - { - if (this.map == null || bone == null) - { - return false; - } - - final int region = bone.getLoc().getRegionID(); - final Map> map = this.map.get(region); - final List list = map.computeIfAbsent(bone.getLoc(), wp -> new ArrayList<>()); - list.add(bone); - return true; - } - - public void remove(Bone bone) - { - final int region = bone.getLoc().getRegionID(); - final Map> map = this.map.get(region); - final List list = map.get(bone.getLoc()); - list.remove(bone); - } - - public void clear(Scene scene) - { - if (map == null) - { - return; - } - - this.forEach(bone -> bone.removeFromScene(scene)); - } - - public Bone get(WorldPoint point, int i) - { - return get(point).get(i); - } - - public List get(WorldPoint point) - { - final int reg = point.getRegionID(); - final Map> map = this.map.get(reg); - if (map == null) - { - return null; - } - return map.get(point); - } - - private void forEach(Consumer consumer) - { - for (Map> map : this.map.values()) - { - for (Map.Entry> entry : map.entrySet()) - { - for (Bone bone : entry.getValue()) - { - consumer.accept(bone); - } - } - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/deathindicator/DeathIndicatorConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/deathindicator/DeathIndicatorConfig.java deleted file mode 100644 index f03ff689d9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/deathindicator/DeathIndicatorConfig.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2018, Danny - * 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.deathindicator; - -import java.time.Instant; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("deathIndicator") -public interface DeathIndicatorConfig extends Config -{ - @ConfigItem( - position = 1, - keyName = "deathHintArrow", - name = "Death Hint Arrow", - description = "Configures whether or not to show a hint arrow to death location" - ) - default boolean showDeathHintArrow() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "deathInfoBox", - name = "Death InfoBox", - description = "Configures whether or not to show item reclaim timer and death world infobox" - ) - default boolean showDeathInfoBox() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "deathOnWorldMap", - name = "Mark on World Map", - description = "Configures whether or not to show death location on the world map" - ) - default boolean showDeathOnWorldMap() - { - return true; - } - - // Stored Data - @ConfigItem( - keyName = "deathWorld", - name = "", - description = "", - hidden = true - ) - default int deathWorld() - { - return -1; - } - - @ConfigItem( - keyName = "deathWorld", - name = "", - description = "" - ) - void deathWorld(int deathWorld); - - @ConfigItem( - keyName = "deathLocationX", - name = "", - description = "", - hidden = true - ) - default int deathLocationX() - { - return -1; - } - - @ConfigItem( - keyName = "deathLocationX", - name = "", - description = "" - ) - void deathLocationX(int deathLocationX); - - @ConfigItem( - keyName = "deathLocationY", - name = "", - description = "", - hidden = true - ) - default int deathLocationY() - { - return -1; - } - - @ConfigItem( - keyName = "deathLocationY", - name = "", - description = "" - ) - void deathLocationY(int deathLocationY); - - @ConfigItem( - keyName = "deathLocationPlane", - name = "", - description = "", - hidden = true - ) - default int deathLocationPlane() - { - return -1; - } - - @ConfigItem( - keyName = "deathLocationPlane", - name = "", - description = "" - ) - void deathLocationPlane(int deathLocationPlane); - - @ConfigItem( - keyName = "timeOfDeath", - name = "", - description = "", - hidden = true - ) - Instant timeOfDeath(); - - @ConfigItem( - keyName = "timeOfDeath", - name = "", - description = "" - ) - void timeOfDeath(Instant timeOfDeath); - - @ConfigItem( - keyName = "permaBones", - name = "Permanent bones", - description = "Show right clickable bones with the name of who died permanently, after seeing someone die" - ) - default boolean permaBones() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/deathindicator/DeathIndicatorPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/deathindicator/DeathIndicatorPlugin.java deleted file mode 100644 index 5470e9aedb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/deathindicator/DeathIndicatorPlugin.java +++ /dev/null @@ -1,548 +0,0 @@ -/* - * Copyright (c) 2018, Danny - * 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.deathindicator; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Provides; -import java.awt.image.BufferedImage; -import java.time.Duration; -import java.time.Instant; -import java.time.temporal.ChronoUnit; -import java.util.List; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.ItemDefinition; -import net.runelite.api.ItemID; -import net.runelite.api.MenuEntry; -import net.runelite.api.MenuOpcode; -import net.runelite.api.Player; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.ItemDespawned; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.MenuOpened; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.PlayerDeath; -import net.runelite.api.events.PostItemDefinition; -import net.runelite.api.util.Text; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; -import net.runelite.client.ui.overlay.infobox.Timer; -import net.runelite.client.ui.overlay.worldmap.WorldMapPointManager; -import net.runelite.client.util.ImageUtil; - -@PluginDescriptor( - name = "Death Indicator", - description = "Show where you last died, and on what world", - tags = {"arrow", "hints", "world", "map", "overlay"}, - type = PluginType.UTILITY -) -@Singleton -@Slf4j -public class DeathIndicatorPlugin extends Plugin -{ - private static final Object BONES = new Object(); - // A random number, that jagex probably won't actually use in the near future - static final int HIJACKED_ITEMID = 0x69696969; - - private static final Set RESPAWN_REGIONS = ImmutableSet.of( - 6457, // Kourend - 12850, // Lumbridge - 11828, // Falador - 12342, // Edgeville - 11062, // Camelot - 13150, // Prifddinas (it's possible to spawn in 2 adjacent regions) - 12894 // Prifddinas - ); - - @Inject - private Client client; - - @Inject - private DeathIndicatorConfig config; - - @Inject - private WorldMapPointManager worldMapPointManager; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private ItemManager itemManager; - - @Inject - private EventBus eventBus; - - @Inject - private ConfigManager configManager; - - @Inject - private ClientThread clientThread; - - private final Bones bones = new Bones(); - - private BufferedImage mapArrow; - - private Timer deathTimer; - - private WorldPoint lastDeath; - private Instant lastDeathTime; - private int lastDeathWorld; - private int despawnIdx = 0; - - @Provides - DeathIndicatorConfig deathIndicatorConfig(ConfigManager configManager) - { - return configManager.getConfig(DeathIndicatorConfig.class); - } - - @Override - protected void startUp() - { - if (config.permaBones()) - { - addBoneSubs(); - } - - if (!hasDied()) - { - return; - } - - resetInfobox(); - - if (client.getWorld() != config.deathWorld()) - { - return; - } - - if (config.showDeathHintArrow() && !client.hasHintArrow()) - { - client.setHintArrow(new WorldPoint(config.deathLocationX(), config.deathLocationY(), config.deathLocationPlane())); - } - - if (config.showDeathOnWorldMap()) - { - worldMapPointManager.removeIf(DeathWorldMapPoint.class::isInstance); - worldMapPointManager.add(new DeathWorldMapPoint(new WorldPoint(config.deathLocationX(), config.deathLocationY(), config.deathLocationPlane()), this)); - } - - if (config.permaBones() && client.getGameState() == GameState.LOGGED_IN) - { - clientThread.invokeLater(this::initBones); - } - } - - @Override - protected void shutDown() - { - eventBus.unregister(BONES); - - if (client.hasHintArrow()) - { - client.clearHintArrow(); - } - - if (deathTimer != null) - { - infoBoxManager.removeInfoBox(deathTimer); - deathTimer = null; - } - - worldMapPointManager.removeIf(DeathWorldMapPoint.class::isInstance); - - clientThread.invokeLater(this::clearBones); - } - - private void initBones() - { - bones.init(client, configManager); - } - - private void clearBones() - { - bones.clear(client.getScene()); - } - - private void addBoneSubs() - { - eventBus.subscribe(ItemDespawned.class, BONES, this::onItemDespawn); - eventBus.subscribe(MenuEntryAdded.class, BONES, this::onMenuEntryAdded); - eventBus.subscribe(MenuOptionClicked.class, BONES, this::onMenuOptionClicked); - eventBus.subscribe(MenuOpened.class, BONES, this::onMenuOpened); - eventBus.subscribe(PostItemDefinition.class, BONES, this::onPostItemDefinition); - } - - private void onPostItemDefinition(PostItemDefinition def) - { - ItemDefinition itemDef = def.getItemDefinition(); - if (itemDef.getId() == HIJACKED_ITEMID) - { - itemDef.setModelOverride(ItemID.BONES); - itemDef.setName("Bones"); - // This is so never hide untradeables doesn't not hide it - itemDef.setTradeable(true); - } - } - - @Subscribe - private void onPlayerDeath(PlayerDeath death) - { - if (client.isInInstancedRegion()) - { - return; - } - - final Player player = death.getPlayer(); - - if (config.permaBones() && player.getWorldLocation().getRegionID() != 13362) - { - newBoneFor(player); - } - - if (player != client.getLocalPlayer()) - { - return; - } - - lastDeath = player.getWorldLocation(); - lastDeathWorld = client.getWorld(); - lastDeathTime = Instant.now(); - } - - private void newBoneFor(Player player) - { - Bone b = new Bone(); - - b.setName(Text.sanitize(player.getName())); - b.setTime(Instant.now()); - b.setLoc(player.getWorldLocation()); - - while (!bones.add(b)) - { - initBones(); - } - - b.addToScene(client.getScene()); - bones.save(configManager, b.getLoc().getRegionID()); - } - - private void onMenuEntryAdded(MenuEntryAdded event) - { - if (event.getIdentifier() == HIJACKED_ITEMID) - { - if (event.getOpcode() == MenuOpcode.GROUND_ITEM_THIRD_OPTION.getId()) - { - client.setMenuOptionCount(client.getMenuOptionCount() - 1); - } - } - } - - private void onMenuOpened(MenuOpened event) - { - int idx = 0; - - for (MenuEntry entry : event) - { - if (entry.getIdentifier() != HIJACKED_ITEMID) - { - continue; - } - - // Only entries with appropriate identifier here will be examine so that's easy - // Add idx to id field, so we can find that back from clicked event - entry.setIdentifier(HIJACKED_ITEMID + idx); - - Bone bone = bones.get( - WorldPoint.fromScene(client, entry.getParam0(), entry.getParam1(), client.getPlane()), - idx++ - ); - - entry.setTarget(bone.getName()); - event.setModified(); - } - } - - private void onMenuOptionClicked(MenuOptionClicked event) - { - if (event.getIdentifier() >= HIJACKED_ITEMID - && event.getOpcode() == MenuOpcode.EXAMINE_ITEM_GROUND.getId()) - { - Bone b = bones.get( - WorldPoint.fromScene(client, event.getParam0(), event.getParam1(), client.getPlane()), - event.getIdentifier() - HIJACKED_ITEMID - ); - - client.addChatMessage(ChatMessageType.ITEM_EXAMINE, "", b.getExamine(), ""); - event.consume(); - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - // Check if player respawned in a death respawn location - if (lastDeath != null && !client.getLocalPlayer().getWorldLocation().equals(lastDeath)) - { - if (!RESPAWN_REGIONS.contains(client.getLocalPlayer().getWorldLocation().getRegionID())) - { - log.debug("Died, but did not respawn in a known respawn location: {}", - client.getLocalPlayer().getWorldLocation().getRegionID()); - - lastDeath = null; - lastDeathTime = null; - return; - } - - log.debug("Died! Grave at {}", lastDeath); - - // Save death to config - config.deathLocationX(lastDeath.getX()); - config.deathLocationY(lastDeath.getY()); - config.deathLocationPlane(lastDeath.getPlane()); - config.timeOfDeath(lastDeathTime); - config.deathWorld(lastDeathWorld); - - if (config.showDeathHintArrow()) - { - client.setHintArrow(lastDeath); - } - - if (config.showDeathOnWorldMap()) - { - worldMapPointManager.removeIf(DeathWorldMapPoint.class::isInstance); - worldMapPointManager.add(new DeathWorldMapPoint(lastDeath, this)); - } - - resetInfobox(); - - lastDeath = null; - lastDeathTime = null; - } - - if (!hasDied() || client.getWorld() != config.deathWorld()) - { - return; - } - - // Check if the player is at their death location, or timer has passed - WorldPoint deathPoint = new WorldPoint(config.deathLocationX(), config.deathLocationY(), config.deathLocationPlane()); - if (deathPoint.equals(client.getLocalPlayer().getWorldLocation()) || (deathTimer != null && deathTimer.cull())) - { - client.clearHintArrow(); - - if (deathTimer != null) - { - infoBoxManager.removeInfoBox(deathTimer); - deathTimer = null; - } - - worldMapPointManager.removeIf(DeathWorldMapPoint.class::isInstance); - - resetDeath(); - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("deathIndicator")) - { - if ("permaBones".equals(event.getKey())) - { - if (config.permaBones()) - { - addBoneSubs(); - - if (client.getGameState() == GameState.LOGGED_IN) - { - clientThread.invokeLater(this::initBones); - } - } - else - { - eventBus.unregister(BONES); - - if (client.getGameState() == GameState.LOGGED_IN) - { - clientThread.invokeLater(this::clearBones); - } - } - return; - } - if (!config.showDeathHintArrow() && hasDied()) - { - client.clearHintArrow(); - } - - if (!config.showDeathInfoBox() && deathTimer != null) - { - infoBoxManager.removeInfoBox(deathTimer); - deathTimer = null; - } - - if (!config.showDeathOnWorldMap()) - { - worldMapPointManager.removeIf(DeathWorldMapPoint.class::isInstance); - } - - if (!hasDied()) - { - client.clearHintArrow(); - - resetInfobox(); - - worldMapPointManager.removeIf(DeathWorldMapPoint.class::isInstance); - } - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - switch (event.getGameState()) - { - case LOADING: - clearBones(); - break; - case LOGGED_IN: - if (config.permaBones()) - { - initBones(); - } - - if (!hasDied()) - { - return; - } - - if (client.getWorld() == config.deathWorld()) - { - WorldPoint deathPoint = new WorldPoint(config.deathLocationX(), config.deathLocationY(), config.deathLocationPlane()); - - if (config.showDeathHintArrow()) - { - client.setHintArrow(deathPoint); - } - - if (config.showDeathOnWorldMap()) - { - worldMapPointManager.removeIf(DeathWorldMapPoint.class::isInstance); - worldMapPointManager.add(new DeathWorldMapPoint(deathPoint, this)); - } - } - else - { - worldMapPointManager.removeIf(DeathWorldMapPoint.class::isInstance); - } - break; - } - - } - - private void onItemDespawn(ItemDespawned event) - { - if (event.getItem().getId() == HIJACKED_ITEMID) - { - List list = bones.get(event.getTile().getWorldLocation()); - if (list == null) - { - return; - } - if (list.size() <= despawnIdx) - { - despawnIdx = 0; - } - Bone bone = list.get(despawnIdx++); - bone.addToScene(client.getScene()); - } - } - - private boolean hasDied() - { - return config.timeOfDeath() != null; - } - - private void resetDeath() - { - config.deathLocationX(0); - config.deathLocationY(0); - config.deathLocationPlane(0); - config.deathWorld(0); - config.timeOfDeath(null); - } - - private void resetInfobox() - { - if (deathTimer != null) - { - infoBoxManager.removeInfoBox(deathTimer); - deathTimer = null; - } - - if (hasDied() && config.showDeathInfoBox()) - { - Instant now = Instant.now(); - Duration timeLeft = Duration.ofHours(1).minus(Duration.between(config.timeOfDeath(), now)); - if (!timeLeft.isNegative() && !timeLeft.isZero()) - { - deathTimer = new Timer(timeLeft.getSeconds(), ChronoUnit.SECONDS, getBonesImage(), this); - deathTimer.setTooltip("Died on world: " + config.deathWorld()); - infoBoxManager.addInfoBox(deathTimer); - } - } - } - - BufferedImage getMapArrow() - { - if (mapArrow != null) - { - return mapArrow; - } - - mapArrow = ImageUtil.getResourceStreamFromClass(getClass(), "/util/clue_arrow.png"); - - return mapArrow; - } - - BufferedImage getBonesImage() - { - return itemManager.getImage(ItemID.BONES); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/deathindicator/DeathWorldMapPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/deathindicator/DeathWorldMapPoint.java deleted file mode 100644 index e6368d87ce..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/deathindicator/DeathWorldMapPoint.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2018, Danny - * 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.deathindicator; - -import java.awt.Graphics; -import java.awt.image.BufferedImage; -import net.runelite.api.Point; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; - -class DeathWorldMapPoint extends WorldMapPoint -{ - private final DeathIndicatorPlugin plugin; - private final BufferedImage worldmapHintArrow; - private final Point worldmapHintArrowPoint; - - DeathWorldMapPoint(final WorldPoint worldPoint, final DeathIndicatorPlugin plugin) - { - super(worldPoint, null); - - worldmapHintArrow = new BufferedImage(plugin.getMapArrow().getWidth(), plugin.getMapArrow().getHeight(), BufferedImage.TYPE_INT_ARGB); - Graphics graphics = worldmapHintArrow.getGraphics(); - graphics.drawImage(plugin.getMapArrow(), 0, 0, null); - graphics.drawImage(plugin.getBonesImage(), 0, 0, null); - worldmapHintArrowPoint = new Point( - worldmapHintArrow.getWidth() / 2, - worldmapHintArrow.getHeight()); - - this.plugin = plugin; - this.setSnapToEdge(true); - this.setJumpOnClick(true); - this.setImage(worldmapHintArrow); - this.setImagePoint(worldmapHintArrowPoint); - this.setTooltip("Death Location"); - } - - @Override - public void onEdgeSnap() - { - this.setImage(plugin.getBonesImage()); - this.setImagePoint(null); - this.setTooltip(null); - } - - @Override - public void onEdgeUnsnap() - { - this.setImage(worldmapHintArrow); - this.setImagePoint(worldmapHintArrowPoint); - this.setTooltip("Death Location"); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldConfig.java deleted file mode 100644 index d53ede7a7b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldConfig.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.defaultworld; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup(DefaultWorldConfig.GROUP) -public interface DefaultWorldConfig extends Config -{ - String GROUP = "defaultworld"; - - @ConfigItem( - keyName = "defaultWorld", - name = "Default world", - description = "World to use as default one" - ) - default int getWorld() - { - return 0; - } - - @ConfigItem( - keyName = "useLastWorld", - name = "Use Last World", - description = "Use the last world you used as the default" - ) - default boolean useLastWorld() - { - return false; - } - - @ConfigItem( - keyName = "lastWorld", - name = "", - description = "", - hidden = true - ) - default int lastWorld() - { - return 0; - } - - @ConfigItem( - keyName = "lastWorld", - name = "", - description = "" - ) - void lastWorld(int lastWorld); -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldPlugin.java deleted file mode 100644 index d069019388..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldPlugin.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.defaultworld; - -import com.google.inject.Provides; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.events.GameStateChanged; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.SessionOpen; -import net.runelite.client.game.WorldService; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.util.WorldUtil; -import net.runelite.http.api.worlds.World; -import net.runelite.http.api.worlds.WorldResult; - -@PluginDescriptor( - name = "Default World", - description = "Enable a default world to be selected when launching the client", - tags = {"home"}, - type = PluginType.UTILITY -) -@Slf4j -@Singleton -public class DefaultWorldPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private DefaultWorldConfig config; - - @Inject - private WorldService worldService; - - private int worldCache; - private boolean worldChangeRequired; - - @Override - protected void startUp() - { - - worldChangeRequired = true; - applyWorld(); - } - - @Override - protected void shutDown() - { - worldChangeRequired = true; - changeWorld(worldCache); - } - - @Provides - DefaultWorldConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(DefaultWorldConfig.class); - } - - @Subscribe - private void onSessionOpen(SessionOpen event) - { - worldChangeRequired = true; - applyWorld(); - } - - @Subscribe(takeUntil = 2) - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGGED_IN) - { - config.lastWorld(client.getWorld()); - } - - applyWorld(); - } - - private void changeWorld(int newWorld) - { - if (!worldChangeRequired || client.getGameState() != GameState.LOGIN_SCREEN) - { - return; - } - - worldChangeRequired = false; - int correctedWorld = newWorld < 300 ? newWorld + 300 : newWorld; - - // Old School RuneScape worlds start on 301 so don't even bother trying to find lower id ones - // and also do not try to set world if we are already on it - if (correctedWorld <= 300 || client.getWorld() == correctedWorld) - { - return; - } - - final WorldResult worldResult = worldService.getWorlds(); - - if (worldResult == null) - { - log.warn("Failed to lookup worlds."); - return; - } - - final World world = worldResult.findWorld(correctedWorld); - - if (world != null) - { - final net.runelite.api.World rsWorld = client.createWorld(); - rsWorld.setActivity(world.getActivity()); - rsWorld.setAddress(world.getAddress()); - rsWorld.setId(world.getId()); - rsWorld.setPlayerCount(world.getPlayers()); - rsWorld.setLocation(world.getLocation()); - rsWorld.setTypes(WorldUtil.toWorldTypes(world.getTypes())); - - client.changeWorld(rsWorld); - log.debug("Applied new world {}", correctedWorld); - } - else - { - log.warn("World {} not found.", correctedWorld); - } - } - - private void applyWorld() - { - if (worldCache == 0) - { - worldCache = client.getWorld(); - log.debug("Stored old world {}", worldCache); - } - - if (System.getProperty("cli.world") != null) - { - return; - } - - final int newWorld = !config.useLastWorld() ? config.getWorld() : config.lastWorld(); - changeWorld(newWorld); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/demonicgorilla/DemonicGorilla.java b/runelite-client/src/main/java/net/runelite/client/plugins/demonicgorilla/DemonicGorilla.java deleted file mode 100644 index fb0e30f048..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/demonicgorilla/DemonicGorilla.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * 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.demonicgorilla; - -import java.util.Arrays; -import java.util.List; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.Actor; -import net.runelite.api.HeadIcon; -import net.runelite.api.NPC; -import net.runelite.api.NPCDefinition; -import net.runelite.api.coords.WorldArea; - -class DemonicGorilla -{ - static final int MAX_ATTACK_RANGE = 10; // Needs <= 10 tiles to reach target - static final int ATTACK_RATE = 5; // 5 ticks between each attack - static final int ATTACKS_PER_SWITCH = 3; // 3 unsuccessful attacks per style switch - - static final int PROJECTILE_MAGIC_SPEED = 8; // Travels 8 tiles per tick - static final int PROJECTILE_RANGED_SPEED = 6; // Travels 6 tiles per tick - static final int PROJECTILE_MAGIC_DELAY = 12; // Requires an extra 12 tiles - static final int PROJECTILE_RANGED_DELAY = 9; // Requires an extra 9 tiles - - static final AttackStyle[] ALL_REGULAR_ATTACK_STYLES = - { - AttackStyle.MELEE, - AttackStyle.RANGED, - AttackStyle.MAGIC - }; - - enum AttackStyle - { - MAGIC, - RANGED, - MELEE, - BOULDER - } - - @Getter(AccessLevel.PACKAGE) - private NPC npc; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private List nextPosibleAttackStyles; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private int attacksUntilSwitch; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private int nextAttackTick; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private int lastTickAnimation; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private WorldArea lastWorldArea; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private boolean initiatedCombat; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private Actor lastTickInteracting; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private boolean takenDamageRecently; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private int recentProjectileId; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private boolean changedPrayerThisTick; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private boolean changedAttackStyleThisTick; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private boolean changedAttackStyleLastTick; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private HeadIcon lastTickOverheadIcon; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private int disabledMeleeMovementForTicks; - - DemonicGorilla(NPC npc) - { - this.npc = npc; - this.nextPosibleAttackStyles = Arrays.asList(ALL_REGULAR_ATTACK_STYLES); - this.nextAttackTick = -100; - this.attacksUntilSwitch = ATTACKS_PER_SWITCH; - this.recentProjectileId = -1; - } - - HeadIcon getOverheadIcon() - { - NPCDefinition composition = this.npc.getDefinition(); - if (composition != null) - { - return composition.getOverheadIcon(); - } - return null; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/demonicgorilla/DemonicGorillaOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/demonicgorilla/DemonicGorillaOverlay.java deleted file mode 100644 index 7d841afb5c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/demonicgorilla/DemonicGorillaOverlay.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * 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.demonicgorilla; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.geom.Arc2D; -import java.awt.image.BufferedImage; -import java.util.ArrayList; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.Skill; -import net.runelite.api.coords.LocalPoint; -import net.runelite.client.game.SkillIconManager; -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; - -@Singleton -public class DemonicGorillaOverlay extends Overlay -{ - private static final Color COLOR_ICON_BACKGROUND = new Color(0, 0, 0, 128); - private static final Color COLOR_ICON_BORDER = new Color(0, 0, 0, 255); - private static final Color COLOR_ICON_BORDER_FILL = new Color(219, 175, 0, 255); - private static final int OVERLAY_ICON_DISTANCE = 50; - private static final int OVERLAY_ICON_MARGIN = 8; - - private final Client client; - private final DemonicGorillaPlugin plugin; - - @Inject - private SkillIconManager iconManager; - - @Inject - public DemonicGorillaOverlay(final Client client, final DemonicGorillaPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.client = client; - this.plugin = plugin; - } - - private BufferedImage getIcon(DemonicGorilla.AttackStyle attackStyle) - { - switch (attackStyle) - { - case MELEE: - return iconManager.getSkillImage(Skill.ATTACK); - case RANGED: - return iconManager.getSkillImage(Skill.RANGED); - case MAGIC: - return iconManager.getSkillImage(Skill.MAGIC); - } - return null; - } - - @Override - public Dimension render(Graphics2D graphics) - { - for (DemonicGorilla gorilla : plugin.getGorillas().values()) - { - if (gorilla.getNpc().getInteracting() == null) - { - continue; - } - - LocalPoint lp = gorilla.getNpc().getLocalLocation(); - if (lp != null) - { - Point point = Perspective.localToCanvas(client, lp, client.getPlane(), - gorilla.getNpc().getLogicalHeight() + 16); - if (point != null) - { - point = new Point(point.getX(), point.getY()); - - List attackStyles = gorilla.getNextPosibleAttackStyles(); - List icons = new ArrayList<>(); - int totalWidth = (attackStyles.size() - 1) * OVERLAY_ICON_MARGIN; - for (DemonicGorilla.AttackStyle attackStyle : attackStyles) - { - BufferedImage icon = getIcon(attackStyle); - icons.add(icon); - if (icon != null) - { - totalWidth += icon.getWidth(); - } - } - - int bgPadding = 4; - int currentPosX = 0; - for (BufferedImage icon : icons) - { - OverlayUtil.setProgressIcon(graphics, point, icon, totalWidth, bgPadding, currentPosX, - COLOR_ICON_BACKGROUND, OVERLAY_ICON_DISTANCE, COLOR_ICON_BORDER, COLOR_ICON_BORDER_FILL); - Arc2D.Double arc = new Arc2D.Double( - point.getX() - totalWidth / 2 + currentPosX - bgPadding, - point.getY() - (float) (icon.getHeight() / 2) - OVERLAY_ICON_DISTANCE - bgPadding, - icon.getWidth() + bgPadding * 2, - icon.getHeight() + bgPadding * 2, - 90.0, - -360.0 * (DemonicGorilla.ATTACKS_PER_SWITCH - - gorilla.getAttacksUntilSwitch()) / DemonicGorilla.ATTACKS_PER_SWITCH, - Arc2D.OPEN); - graphics.draw(arc); - - currentPosX += icon.getWidth() + OVERLAY_ICON_MARGIN; - } - } - } - } - - return null; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/demonicgorilla/DemonicGorillaPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/demonicgorilla/DemonicGorillaPlugin.java deleted file mode 100644 index 6c0dbeffd5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/demonicgorilla/DemonicGorillaPlugin.java +++ /dev/null @@ -1,714 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * 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.demonicgorilla; - -import com.google.common.collect.ImmutableSet; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.AnimationID; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.HeadIcon; -import net.runelite.api.Hitsplat; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.Player; -import net.runelite.api.Projectile; -import net.runelite.api.ProjectileID; -import net.runelite.api.coords.WorldArea; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.HitsplatApplied; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.events.PlayerDespawned; -import net.runelite.api.events.PlayerSpawned; -import net.runelite.api.events.ProjectileSpawned; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.eventbus.Subscribe; -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; - -@PluginDescriptor( - name = "Demonic Gorillas", - description = "Count demonic gorilla attacks and display their next possible attack styles", - tags = {"combat", "overlay", "pve", "pvm"}, - type = PluginType.PVM -) -@Singleton -public class DemonicGorillaPlugin extends Plugin -{ - private static final Set DEMONIC_PROJECTILES = ImmutableSet.of(ProjectileID.DEMONIC_GORILLA_RANGED, ProjectileID.DEMONIC_GORILLA_MAGIC, ProjectileID.DEMONIC_GORILLA_BOULDER); - - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private DemonicGorillaOverlay overlay; - - @Inject - private ClientThread clientThread; - - @Getter(AccessLevel.PACKAGE) - private Map gorillas; - - private List recentBoulders; - - private List pendingAttacks; - - private Map memorizedPlayers; - - @Override - protected void startUp() - { - overlayManager.add(overlay); - gorillas = new HashMap<>(); - recentBoulders = new ArrayList<>(); - pendingAttacks = new ArrayList<>(); - memorizedPlayers = new HashMap<>(); - clientThread.invoke(this::reset); // Updates the list of gorillas and players - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - gorillas = null; - recentBoulders = null; - pendingAttacks = null; - memorizedPlayers = null; - } - - private void clear() - { - recentBoulders.clear(); - pendingAttacks.clear(); - memorizedPlayers.clear(); - gorillas.clear(); - } - - private void reset() - { - recentBoulders.clear(); - pendingAttacks.clear(); - resetGorillas(); - resetPlayers(); - } - - private void resetGorillas() - { - gorillas.clear(); - for (NPC npc : client.getNpcs()) - { - if (isNpcGorilla(npc.getId())) - { - gorillas.put(npc, new DemonicGorilla(npc)); - } - } - } - - private void resetPlayers() - { - memorizedPlayers.clear(); - for (Player player : client.getPlayers()) - { - memorizedPlayers.put(player, new MemorizedPlayer(player)); - } - } - - private static boolean isNpcGorilla(int npcId) - { - return npcId == NpcID.DEMONIC_GORILLA || - npcId == NpcID.DEMONIC_GORILLA_7145 || - npcId == NpcID.DEMONIC_GORILLA_7146 || - npcId == NpcID.DEMONIC_GORILLA_7147 || - npcId == NpcID.DEMONIC_GORILLA_7148 || - npcId == NpcID.DEMONIC_GORILLA_7149; - } - - private void checkGorillaAttackStyleSwitch(DemonicGorilla gorilla, final DemonicGorilla.AttackStyle... protectedStyles) - { - if (gorilla.getAttacksUntilSwitch() <= 0 || - gorilla.getNextPosibleAttackStyles().isEmpty()) - { - gorilla.setNextPosibleAttackStyles(Arrays - .stream(DemonicGorilla.ALL_REGULAR_ATTACK_STYLES) - .filter(x -> Arrays.stream(protectedStyles).noneMatch(y -> x == y)) - .collect(Collectors.toList())); - gorilla.setAttacksUntilSwitch(DemonicGorilla.ATTACKS_PER_SWITCH); - gorilla.setChangedAttackStyleThisTick(true); - } - } - - private DemonicGorilla.AttackStyle getProtectedStyle(Player player) - { - HeadIcon headIcon = player.getOverheadIcon(); - if (headIcon == null) - { - return null; - } - switch (headIcon) - { - case MELEE: - return DemonicGorilla.AttackStyle.MELEE; - case RANGED: - return DemonicGorilla.AttackStyle.RANGED; - case MAGIC: - return DemonicGorilla.AttackStyle.MAGIC; - default: - return null; - } - } - - private void onGorillaAttack(DemonicGorilla gorilla, final DemonicGorilla.AttackStyle attackStyle) - { - gorilla.setInitiatedCombat(true); - - Player target = (Player) gorilla.getNpc().getInteracting(); - - DemonicGorilla.AttackStyle protectedStyle = null; - if (target != null) - { - protectedStyle = getProtectedStyle(target); - } - boolean correctPrayer = - target == null || // If player is out of memory, assume prayer was correct - (attackStyle != null && - attackStyle.equals(protectedStyle)); - - if (attackStyle == DemonicGorilla.AttackStyle.BOULDER) - { - // The gorilla can't throw boulders when it's meleeing - gorilla.setNextPosibleAttackStyles(gorilla - .getNextPosibleAttackStyles() - .stream() - .filter(x -> x != DemonicGorilla.AttackStyle.MELEE) - .collect(Collectors.toList())); - } - else - { - if (correctPrayer) - { - gorilla.setAttacksUntilSwitch(gorilla.getAttacksUntilSwitch() - 1); - } - else - { - // We're not sure if the attack will hit a 0 or not, - // so we don't know if we should decrease the counter or not, - // so we keep track of the attack here until the damage splat - // has appeared on the player. - - int damagesOnTick = client.getTickCount(); - if (attackStyle == DemonicGorilla.AttackStyle.MAGIC) - { - MemorizedPlayer mp = memorizedPlayers.get(target); - WorldArea lastPlayerArea = mp.getLastWorldArea(); - if (lastPlayerArea != null) - { - int dist = gorilla.getNpc().getWorldArea().distanceTo(lastPlayerArea); - damagesOnTick += (dist + DemonicGorilla.PROJECTILE_MAGIC_DELAY) / - DemonicGorilla.PROJECTILE_MAGIC_SPEED; - } - } - else if (attackStyle == DemonicGorilla.AttackStyle.RANGED) - { - MemorizedPlayer mp = memorizedPlayers.get(target); - WorldArea lastPlayerArea = mp.getLastWorldArea(); - if (lastPlayerArea != null) - { - int dist = gorilla.getNpc().getWorldArea().distanceTo(lastPlayerArea); - damagesOnTick += (dist + DemonicGorilla.PROJECTILE_RANGED_DELAY) / - DemonicGorilla.PROJECTILE_RANGED_SPEED; - } - } - pendingAttacks.add(new PendingGorillaAttack(gorilla, attackStyle, target, damagesOnTick)); - } - - gorilla.setNextPosibleAttackStyles(gorilla - .getNextPosibleAttackStyles() - .stream() - .filter(x -> x == attackStyle) - .collect(Collectors.toList())); - - if (gorilla.getNextPosibleAttackStyles().isEmpty()) - { - // Sometimes the gorilla can switch attack style before it's supposed to - // if someone was fighting it earlier and then left, so we just - // reset the counter in that case. - - gorilla.setNextPosibleAttackStyles(Arrays - .stream(DemonicGorilla.ALL_REGULAR_ATTACK_STYLES) - .filter(x -> x == attackStyle) - .collect(Collectors.toList())); - gorilla.setAttacksUntilSwitch(DemonicGorilla.ATTACKS_PER_SWITCH - - (correctPrayer ? 1 : 0)); - } - } - - checkGorillaAttackStyleSwitch(gorilla, protectedStyle); - - int tickCounter = client.getTickCount(); - gorilla.setNextAttackTick(tickCounter + DemonicGorilla.ATTACK_RATE); - } - - private void checkGorillaAttacks() - { - int tickCounter = client.getTickCount(); - for (DemonicGorilla gorilla : gorillas.values()) - { - Player interacting = (Player) gorilla.getNpc().getInteracting(); - MemorizedPlayer mp = memorizedPlayers.get(interacting); - - if (gorilla.getLastTickInteracting() != null && interacting == null) - { - gorilla.setInitiatedCombat(false); - } - else if (mp != null && mp.getLastWorldArea() != null && - !gorilla.isInitiatedCombat() && - tickCounter < gorilla.getNextAttackTick() && - gorilla.getNpc().getWorldArea().isInMeleeDistance(mp.getLastWorldArea())) - { - gorilla.setInitiatedCombat(true); - gorilla.setNextAttackTick(tickCounter + 1); - } - - int animationId = gorilla.getNpc().getAnimation(); - - if (gorilla.isTakenDamageRecently() && - tickCounter >= gorilla.getNextAttackTick() + 4) - { - // The gorilla was flinched, so its next attack gets delayed - gorilla.setNextAttackTick(tickCounter + DemonicGorilla.ATTACK_RATE / 2); - gorilla.setInitiatedCombat(true); - - if (mp != null && mp.getLastWorldArea() != null && - !gorilla.getNpc().getWorldArea().isInMeleeDistance(mp.getLastWorldArea()) && - !gorilla.getNpc().getWorldArea().intersectsWith(mp.getLastWorldArea())) - { - // Gorillas stop meleeing when they get flinched - // and the target isn't in melee distance - gorilla.setNextPosibleAttackStyles(gorilla - .getNextPosibleAttackStyles() - .stream() - .filter(x -> x != DemonicGorilla.AttackStyle.MELEE) - .collect(Collectors.toList())); - if (interacting != null) - { - checkGorillaAttackStyleSwitch(gorilla, DemonicGorilla.AttackStyle.MELEE, - getProtectedStyle(interacting)); - } - } - } - else if (animationId != gorilla.getLastTickAnimation()) - { - if (animationId == AnimationID.DEMONIC_GORILLA_MELEE_ATTACK) - { - onGorillaAttack(gorilla, DemonicGorilla.AttackStyle.MELEE); - } - else if (animationId == AnimationID.DEMONIC_GORILLA_MAGIC_ATTACK) - { - onGorillaAttack(gorilla, DemonicGorilla.AttackStyle.MAGIC); - } - else if (animationId == AnimationID.DEMONIC_GORILLA_RANGED_ATTACK) - { - onGorillaAttack(gorilla, DemonicGorilla.AttackStyle.RANGED); - } - else if (animationId == AnimationID.DEMONIC_GORILLA_AOE_ATTACK && interacting != null) - { - // Note that AoE animation is the same as prayer switch animation - // so we need to check if the prayer was switched or not. - // It also does this animation when it spawns, so - // we need the interacting != null check. - - if (gorilla.getOverheadIcon() == gorilla.getLastTickOverheadIcon()) - { - // Confirmed, the gorilla used the AoE attack - onGorillaAttack(gorilla, DemonicGorilla.AttackStyle.BOULDER); - } - else - { - if (tickCounter >= gorilla.getNextAttackTick()) - { - gorilla.setChangedPrayerThisTick(true); - - // This part is more complicated because the gorilla may have - // used an attack, but the prayer switch animation takes - // priority over normal attack animations. - - int projectileId = gorilla.getRecentProjectileId(); - if (projectileId == ProjectileID.DEMONIC_GORILLA_MAGIC) - { - onGorillaAttack(gorilla, DemonicGorilla.AttackStyle.MAGIC); - } - else if (projectileId == ProjectileID.DEMONIC_GORILLA_RANGED) - { - onGorillaAttack(gorilla, DemonicGorilla.AttackStyle.RANGED); - } - else if (mp != null) - { - WorldArea lastPlayerArea = mp.getLastWorldArea(); - if (lastPlayerArea != null && recentBoulders.stream() - .anyMatch(x -> x.distanceTo(lastPlayerArea) == 0)) - { - // A boulder started falling on the gorillas target, - // so we assume it was the gorilla who shot it - onGorillaAttack(gorilla, DemonicGorilla.AttackStyle.BOULDER); - } - else if (!mp.getRecentHitsplats().isEmpty()) - { - // It wasn't any of the three other attacks, - // but the player took damage, so we assume - // it's a melee attack - onGorillaAttack(gorilla, DemonicGorilla.AttackStyle.MELEE); - } - } - } - - // The next attack tick is always delayed if the - // gorilla switched prayer - gorilla.setNextAttackTick(tickCounter + DemonicGorilla.ATTACK_RATE); - gorilla.setChangedPrayerThisTick(true); - } - } - } - - if (gorilla.getDisabledMeleeMovementForTicks() > 0) - { - gorilla.setDisabledMeleeMovementForTicks(gorilla.getDisabledMeleeMovementForTicks() - 1); - } - else if (gorilla.isInitiatedCombat() && - gorilla.getNpc().getInteracting() != null && - !gorilla.isChangedAttackStyleThisTick() && - gorilla.getNextPosibleAttackStyles().size() >= 2 && - gorilla.getNextPosibleAttackStyles().stream() - .anyMatch(x -> x == DemonicGorilla.AttackStyle.MELEE)) - { - // If melee is a possibility, we can check if the gorilla - // is or isn't moving toward the player to determine if - // it is actually attempting to melee or not. - // We only run this check if the gorilla is in combat - // because otherwise it attempts to travel to melee - // distance before attacking its target. - - if (mp != null && mp.getLastWorldArea() != null && gorilla.getLastWorldArea() != null) - { - WorldArea predictedNewArea = gorilla.getLastWorldArea().calculateNextTravellingPoint( - client, mp.getLastWorldArea(), true, x -> - { - // Gorillas can't normally walk through other gorillas - // or other players - final WorldArea area1 = new WorldArea(x, 1, 1); - return gorillas.values().stream().noneMatch(y -> - { - if (y == gorilla) - { - return false; - } - final WorldArea area2 = - y.getNpc().getIndex() < gorilla.getNpc().getIndex() ? - y.getNpc().getWorldArea() : y.getLastWorldArea(); - return area2 != null && area1.intersectsWith(area2); - }) && memorizedPlayers.values().stream().noneMatch(y -> - { - final WorldArea area2 = y.getLastWorldArea(); - return area2 != null && area1.intersectsWith(area2); - }); - - // There is a special case where if a player walked through - // a gorilla, or a player walked through another player, - // the tiles that were walked through becomes - // walkable, but I didn't feel like it's necessary to handle - // that special case as it should rarely happen. - }); - if (predictedNewArea != null) - { - int distance = gorilla.getNpc().getWorldArea().distanceTo(mp.getLastWorldArea()); - WorldPoint predictedMovement = predictedNewArea.toWorldPoint(); - if (distance <= DemonicGorilla.MAX_ATTACK_RANGE && mp.getLastWorldArea().hasLineOfSightTo(client, gorilla.getLastWorldArea())) - { - if (predictedMovement.distanceTo(gorilla.getLastWorldArea().toWorldPoint()) != 0) - { - if (predictedMovement.distanceTo(gorilla.getNpc().getWorldLocation()) == 0) - { - gorilla.setNextPosibleAttackStyles(gorilla - .getNextPosibleAttackStyles() - .stream() - .filter(x -> x == DemonicGorilla.AttackStyle.MELEE) - .collect(Collectors.toList())); - } - else - { - gorilla.setNextPosibleAttackStyles(gorilla - .getNextPosibleAttackStyles() - .stream() - .filter(x -> x != DemonicGorilla.AttackStyle.MELEE) - .collect(Collectors.toList())); - } - } - else if (tickCounter >= gorilla.getNextAttackTick() && - gorilla.getRecentProjectileId() == -1 && - recentBoulders.stream().noneMatch(x -> x.distanceTo(mp.getLastWorldArea()) == 0)) - { - gorilla.setNextPosibleAttackStyles(gorilla - .getNextPosibleAttackStyles() - .stream() - .filter(x -> x == DemonicGorilla.AttackStyle.MELEE) - .collect(Collectors.toList())); - } - } - } - } - } - - if (gorilla.isTakenDamageRecently()) - { - gorilla.setInitiatedCombat(true); - } - - if (gorilla.getOverheadIcon() != gorilla.getLastTickOverheadIcon()) - { - if (gorilla.isChangedAttackStyleLastTick() || - gorilla.isChangedAttackStyleThisTick()) - { - // Apparently if it changes attack style and changes - // prayer on the same tick or 1 tick apart, it won't - // be able to move for the next 2 ticks if it attempts - // to melee - gorilla.setDisabledMeleeMovementForTicks(2); - } - else - { - // If it didn't change attack style lately, - // it's only for the next 1 tick - gorilla.setDisabledMeleeMovementForTicks(1); - } - } - gorilla.setLastTickAnimation(gorilla.getNpc().getAnimation()); - gorilla.setLastWorldArea(gorilla.getNpc().getWorldArea()); - gorilla.setLastTickInteracting(gorilla.getNpc().getInteracting()); - gorilla.setTakenDamageRecently(false); - gorilla.setChangedPrayerThisTick(false); - gorilla.setChangedAttackStyleLastTick(gorilla.isChangedAttackStyleThisTick()); - gorilla.setChangedAttackStyleThisTick(false); - gorilla.setLastTickOverheadIcon(gorilla.getOverheadIcon()); - gorilla.setRecentProjectileId(-1); - } - } - - @Subscribe - private void onProjectileSpawned(ProjectileSpawned event) - { - final Projectile projectile = event.getProjectile(); - final int projectileId = projectile.getId(); - - if (!DEMONIC_PROJECTILES.contains(projectileId)) - { - return; - } - - final WorldPoint loc = WorldPoint.fromLocal(client, projectile.getX1(), projectile.getY1(), client.getPlane()); - - if (projectileId == ProjectileID.DEMONIC_GORILLA_BOULDER) - { - recentBoulders.add(loc); - } - else - { - for (DemonicGorilla gorilla : gorillas.values()) - { - if (gorilla.getNpc().getWorldLocation().distanceTo(loc) == 0) - { - gorilla.setRecentProjectileId(projectile.getId()); - } - } - } - } - - private void checkPendingAttacks() - { - Iterator it = pendingAttacks.iterator(); - int tickCounter = client.getTickCount(); - while (it.hasNext()) - { - PendingGorillaAttack attack = it.next(); - if (tickCounter >= attack.getFinishesOnTick()) - { - boolean shouldDecreaseCounter = false; - DemonicGorilla gorilla = attack.getAttacker(); - MemorizedPlayer target = memorizedPlayers.get(attack.getTarget()); - if (target == null) - { - // Player went out of memory, so assume the hit was a 0 - shouldDecreaseCounter = true; - } - else if (target.getRecentHitsplats().isEmpty()) - { - // No hitsplats was applied. This may happen in some cases - // where the player was out of memory while the - // projectile was travelling. So we assume the hit was a 0. - shouldDecreaseCounter = true; - } - else if (target.getRecentHitsplats().stream() - .anyMatch(x -> x.getHitsplatType() == Hitsplat.HitsplatType.BLOCK)) - { - // A blue hitsplat appeared, so we assume the gorilla hit a 0 - shouldDecreaseCounter = true; - } - - if (shouldDecreaseCounter) - { - gorilla.setAttacksUntilSwitch(gorilla.getAttacksUntilSwitch() - 1); - checkGorillaAttackStyleSwitch(gorilla); - } - - it.remove(); - } - } - } - - private void updatePlayers() - { - for (MemorizedPlayer mp : memorizedPlayers.values()) - { - mp.setLastWorldArea(mp.getPlayer().getWorldArea()); - mp.getRecentHitsplats().clear(); - } - } - - @Subscribe - private void onHitsplatApplied(HitsplatApplied event) - { - if (gorillas.isEmpty()) - { - return; - } - - if (event.getActor() instanceof Player) - { - Player player = (Player) event.getActor(); - MemorizedPlayer mp = memorizedPlayers.get(player); - if (mp != null) - { - mp.getRecentHitsplats().add(event.getHitsplat()); - } - } - else if (event.getActor() instanceof NPC) - { - DemonicGorilla gorilla = gorillas.get(event.getActor()); - Hitsplat.HitsplatType hitsplatType = event.getHitsplat().getHitsplatType(); - if (gorilla != null && (hitsplatType == Hitsplat.HitsplatType.BLOCK || - hitsplatType == Hitsplat.HitsplatType.DAMAGE)) - { - gorilla.setTakenDamageRecently(true); - } - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - GameState gs = event.getGameState(); - if (gs == GameState.LOGGING_IN || - gs == GameState.CONNECTION_LOST || - gs == GameState.HOPPING) - { - reset(); - } - } - - @Subscribe - private void onPlayerSpawned(PlayerSpawned event) - { - if (gorillas.isEmpty()) - { - return; - } - - Player player = event.getPlayer(); - memorizedPlayers.put(player, new MemorizedPlayer(player)); - } - - @Subscribe - private void onPlayerDespawned(PlayerDespawned event) - { - if (gorillas.isEmpty()) - { - return; - } - - memorizedPlayers.remove(event.getPlayer()); - } - - @Subscribe - private void onNpcSpawned(NpcSpawned event) - { - NPC npc = event.getNpc(); - if (isNpcGorilla(npc.getId())) - { - if (gorillas.isEmpty()) - { - // Players are not kept track of when there are no gorillas in - // memory, so we need to add the players that were already in memory. - resetPlayers(); - } - - gorillas.put(npc, new DemonicGorilla(npc)); - } - } - - @Subscribe - private void onNpcDespawned(NpcDespawned event) - { - if (gorillas.remove(event.getNpc()) != null && gorillas.isEmpty()) - { - clear(); - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - checkGorillaAttacks(); - checkPendingAttacks(); - updatePlayers(); - recentBoulders.clear(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/demonicgorilla/MemorizedPlayer.java b/runelite-client/src/main/java/net/runelite/client/plugins/demonicgorilla/MemorizedPlayer.java deleted file mode 100644 index 262042b7e1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/demonicgorilla/MemorizedPlayer.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * 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.demonicgorilla; - -import java.util.ArrayList; -import java.util.List; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.Hitsplat; -import net.runelite.api.Player; -import net.runelite.api.coords.WorldArea; - -class MemorizedPlayer -{ - @Getter(AccessLevel.PACKAGE) - private Player player; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private WorldArea lastWorldArea; - - @Getter(AccessLevel.PACKAGE) - private List recentHitsplats; - - MemorizedPlayer(final Player player) - { - this.player = player; - this.recentHitsplats = new ArrayList<>(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/demonicgorilla/PendingGorillaAttack.java b/runelite-client/src/main/java/net/runelite/client/plugins/demonicgorilla/PendingGorillaAttack.java deleted file mode 100644 index 405f889469..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/demonicgorilla/PendingGorillaAttack.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * 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.demonicgorilla; - -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Player; - -class PendingGorillaAttack -{ - @Getter(AccessLevel.PACKAGE) - private DemonicGorilla attacker; - - @Getter(AccessLevel.PACKAGE) - private DemonicGorilla.AttackStyle attackStyle; - - @Getter(AccessLevel.PACKAGE) - private Player target; - - @Getter(AccessLevel.PACKAGE) - private int finishesOnTick; - - PendingGorillaAttack(final DemonicGorilla attacker, final DemonicGorilla.AttackStyle attackStyle, final Player target, final int finishesOnTick) - { - this.attacker = attacker; - this.attackStyle = attackStyle; - this.target = target; - this.finishesOnTick = finishesOnTick; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/CameraOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/CameraOverlay.java deleted file mode 100644 index ee0f83811b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/CameraOverlay.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2018, Matthew Steglinski - * 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.devtools; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import net.runelite.api.Client; -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.table.TableAlignment; -import net.runelite.client.ui.overlay.components.table.TableComponent; - -public class CameraOverlay extends Overlay -{ - private final Client client; - private final DevToolsPlugin plugin; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - CameraOverlay(Client client, DevToolsPlugin plugin) - { - this.client = client; - this.plugin = plugin; - panelComponent.setPreferredSize(new Dimension(150, 0)); - setPosition(OverlayPosition.TOP_LEFT); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.getCameraPosition().isActive()) - { - return null; - } - - panelComponent.getChildren().clear(); - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - tableComponent.addRow("X", "" + client.getCameraX()); - tableComponent.addRow("Y", "" + client.getCameraY()); - tableComponent.addRow("Z", "" + client.getCameraZ()); - tableComponent.addRow("Pitch", "" + client.getCameraPitch()); - tableComponent.addRow("Yaw", "" + client.getCameraYaw()); - tableComponent.addRow("Scale", "" + client.getScale()); - - panelComponent.getChildren().add(tableComponent); - - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsButton.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsButton.java deleted file mode 100644 index eb56041e48..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsButton.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.devtools; - -import java.awt.Color; -import javax.swing.JButton; -import lombok.AccessLevel; -import lombok.Getter; - -class DevToolsButton extends JButton -{ - @Getter(AccessLevel.PACKAGE) - private boolean active; - - DevToolsButton(String title) - { - super(title); - addActionListener((ev) -> setActive(!active)); - this.setToolTipText(title); - } - - void setActive(boolean active) - { - this.active = active; - - if (active) - { - setBackground(Color.GREEN); - } - else - { - setBackground(null); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsConfig.java deleted file mode 100644 index a08edfd26c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsConfig.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.devtools; - -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("devtools") -public interface DevToolsConfig -{ - @ConfigItem( - keyName = "inspectorAlwaysOnTop", - name = "", - description = "", - hidden = true - ) - default boolean inspectorAlwaysOnTop() - { - return false; - } - - @ConfigItem( - keyName = "inspectorAlwaysOnTop", - name = "", - description = "" - ) - void inspectorAlwaysOnTop(boolean value); -} 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 deleted file mode 100644 index 1b4d6c3828..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java +++ /dev/null @@ -1,497 +0,0 @@ -/* - * Copyright (c) 2017, Kronos - * Copyright (c) 2017, 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.devtools; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.Rectangle; -import java.awt.Shape; -import java.awt.geom.Rectangle2D; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -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.Entity; -import net.runelite.api.GameObject; -import net.runelite.api.GraphicsObject; -import net.runelite.api.GroundObject; -import net.runelite.api.NPC; -import net.runelite.api.NPCDefinition; -import net.runelite.api.Node; -import net.runelite.api.Perspective; -import net.runelite.api.Player; -import net.runelite.api.Point; -import net.runelite.api.Projectile; -import net.runelite.api.Scene; -import net.runelite.api.Tile; -import net.runelite.api.TileItem; -import net.runelite.api.TileItemPile; -import net.runelite.api.WallObject; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.api.widgets.WidgetItem; -import net.runelite.client.ui.FontManager; -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; -import net.runelite.client.ui.overlay.tooltip.Tooltip; -import net.runelite.client.ui.overlay.tooltip.TooltipManager; - -@Singleton -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); - private static final Color BLUE = new Color(41, 98, 255); - private static final Color DEEP_PURPLE = new Color(98, 0, 234); - private static final Color PURPLE = new Color(170, 0, 255); - private static final Color GRAY = new Color(158, 158, 158); - - private static final int MAX_DISTANCE = 2400; - - private final Client client; - private final DevToolsPlugin plugin; - private final TooltipManager toolTipManager; - - @Inject - private DevToolsOverlay(Client client, DevToolsPlugin plugin, TooltipManager toolTipManager) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - setPriority(OverlayPriority.HIGHEST); - this.client = client; - this.plugin = plugin; - this.toolTipManager = toolTipManager; - } - - @Override - public Dimension render(Graphics2D graphics) - { - graphics.setFont(FONT); - - if (plugin.getPlayers().isActive()) - { - renderPlayers(graphics); - } - - if (plugin.getNpcs().isActive()) - { - renderNpcs(graphics); - } - - if (plugin.getGroundItems().isActive() || plugin.getGroundObjects().isActive() || plugin.getGameObjects().isActive() || plugin.getWalls().isActive() || plugin.getDecorations().isActive() || plugin.getTileLocation().isActive()) - { - renderTileObjects(graphics); - } - - if (plugin.getInventory().isActive()) - { - renderInventory(graphics); - } - - if (plugin.getProjectiles().isActive()) - { - renderProjectiles(graphics); - } - - if (plugin.getGraphicsObjects().isActive()) - { - renderGraphicsObjects(graphics); - } - - if (plugin.getCursorPos().isActive()) - { - renderCursorTooltip(graphics); - } - - return null; - } - - private void renderPlayers(Graphics2D graphics) - { - List players = client.getPlayers(); - Player local = client.getLocalPlayer(); - - for (Player p : players) - { - if (!p.equals(local)) - { - String text = p.getName() + " (A: " + p.getAnimation() + ") (G: " + p.getSpotAnimation() + ")"; - OverlayUtil.renderActorOverlay(graphics, p, text, BLUE); - } - } - - String text = local.getName() + " (A: " + local.getAnimation() + ") (G: " + local.getSpotAnimation() + ")"; - OverlayUtil.renderActorOverlay(graphics, local, text, CYAN); - renderPlayerWireframe(graphics, local, CYAN); - } - - private void renderNpcs(Graphics2D graphics) - { - List npcs = client.getNpcs(); - for (NPC npc : npcs) - { - NPCDefinition composition = npc.getDefinition(); - Color color = composition.getCombatLevel() > 1 ? YELLOW : ORANGE; - if (composition.getConfigs() != null) - { - NPCDefinition transformedComposition = composition.transform(); - if (transformedComposition == null) - { - color = GRAY; - } - else - { - composition = transformedComposition; - } - } - - String text = String.format("%s (ID: %d) (A: %d) (G: %d) (IDX: %d)", - composition.getName(), - composition.getId(), - npc.getAnimation(), - npc.getSpotAnimation(), - npc.getIndex()); - - OverlayUtil.renderActorOverlay(graphics, npc, text, color); - } - } - - private void renderTileObjects(Graphics2D graphics) - { - Scene scene = client.getScene(); - Tile[][][] tiles = scene.getTiles(); - - int z = client.getPlane(); - - for (int x = 0; x < Constants.SCENE_SIZE; ++x) - { - for (int y = 0; y < Constants.SCENE_SIZE; ++y) - { - Tile tile = tiles[z][x][y]; - - if (tile == null) - { - continue; - } - - Player player = client.getLocalPlayer(); - if (player == null) - { - continue; - } - - if (plugin.getGroundItems().isActive()) - { - renderGroundItems(graphics, tile, player); - } - - if (plugin.getGroundObjects().isActive()) - { - renderGroundObject(graphics, tile, player); - } - - if (plugin.getGameObjects().isActive()) - { - renderGameObjects(graphics, tile, player); - - } - - if (plugin.getWalls().isActive()) - { - renderWallObject(graphics, tile, player); - } - - if (plugin.getDecorations().isActive()) - { - renderDecorObject(graphics, tile, player); - } - - if (plugin.getTileLocation().isActive()) - { - renderTileTooltip(graphics, tile); - } - } - } - } - - private void renderCursorTooltip(Graphics2D graphics) - { - if (client.getMouseCanvasPosition().getX() >= 0 && client.getMouseCanvasPosition().getY() >= 0) - { - toolTipManager.add(new Tooltip("Cursor Point: " + client.getMouseCanvasPosition().getX() + ", " + client.getMouseCanvasPosition().getY())); - } - } - - private void renderTileTooltip(Graphics2D graphics, Tile tile) - { - Polygon poly = Perspective.getCanvasTilePoly(client, tile.getLocalLocation()); - if (poly != null && poly.contains(client.getMouseCanvasPosition().getX(), client.getMouseCanvasPosition().getY())) - { - toolTipManager.add(new Tooltip("World Location: " + tile.getWorldLocation().getX() + ", " + tile.getWorldLocation().getY() + ", " + client.getPlane())); - OverlayUtil.renderPolygon(graphics, poly, GREEN); - } - } - - private void renderGroundItems(Graphics2D graphics, Tile tile, Player player) - { - TileItemPile tileItemPile = tile.getItemLayer(); - if (tileItemPile != null) - { - if (player.getLocalLocation().distanceTo(tileItemPile.getLocalLocation()) <= MAX_DISTANCE) - { - Node current = tileItemPile.getBottom(); - while (current instanceof TileItem) - { - TileItem item = (TileItem) current; - OverlayUtil.renderTileOverlay(graphics, tileItemPile, "ID: " + item.getId() + " Qty:" + item.getQuantity(), RED); - current = current.getNext(); - } - } - } - } - - private void renderGameObjects(Graphics2D graphics, Tile tile, Player player) - { - GameObject[] gameObjects = tile.getGameObjects(); - if (gameObjects != null) - { - for (GameObject gameObject : gameObjects) - { - if (gameObject != null) - { - if (player.getLocalLocation().distanceTo(gameObject.getLocalLocation()) <= MAX_DISTANCE) - { - Entity entity = gameObject.getEntity(); - if (entity instanceof DynamicObject) - { - OverlayUtil.renderTileOverlay(graphics, gameObject, "ID: " + gameObject.getId() + " Anim: " + ((DynamicObject) entity).getAnimationID(), TURQOISE); - } - else - { - OverlayUtil.renderTileOverlay(graphics, gameObject, "ID: " + gameObject.getId(), GREEN); - } - } - - // Draw a polygon around the convex hull - // of the model vertices - Shape p = gameObject.getConvexHull(); - if (p != null) - { - graphics.draw(p); - } - // This is incredibly taxing to run, only uncomment if you know what you're doing. - /*renderGameObjectWireframe(graphics, gameObject, Color.CYAN);*/ - } - } - } - } - - private void renderGroundObject(Graphics2D graphics, Tile tile, Player player) - { - GroundObject groundObject = tile.getGroundObject(); - if (groundObject != null) - { - if (player.getLocalLocation().distanceTo(groundObject.getLocalLocation()) <= MAX_DISTANCE) - { - OverlayUtil.renderTileOverlay(graphics, groundObject, "ID: " + groundObject.getId(), PURPLE); - } - } - } - - private void renderWallObject(Graphics2D graphics, Tile tile, Player player) - { - WallObject wallObject = tile.getWallObject(); - if (wallObject != null) - { - if (player.getLocalLocation().distanceTo(wallObject.getLocalLocation()) <= MAX_DISTANCE) - { - OverlayUtil.renderTileOverlay(graphics, wallObject, "ID: " + wallObject.getId(), GRAY); - } - } - } - - private void renderDecorObject(Graphics2D graphics, Tile tile, Player player) - { - DecorativeObject decorObject = tile.getDecorativeObject(); - if (decorObject != null) - { - if (player.getLocalLocation().distanceTo(decorObject.getLocalLocation()) <= MAX_DISTANCE) - { - OverlayUtil.renderTileOverlay(graphics, decorObject, "ID: " + decorObject.getId(), DEEP_PURPLE); - } - - Shape p = decorObject.getConvexHull(); - if (p != null) - { - graphics.draw(p); - } - - p = decorObject.getConvexHull2(); - if (p != null) - { - graphics.draw(p); - } - } - } - - private void renderInventory(Graphics2D graphics) - { - Widget inventoryWidget = client.getWidget(WidgetInfo.INVENTORY); - if (inventoryWidget == null || inventoryWidget.isHidden()) - { - return; - } - - for (WidgetItem item : inventoryWidget.getWidgetItems()) - { - Rectangle slotBounds = item.getCanvasBounds(); - - String idText = "" + item.getId(); - FontMetrics fm = graphics.getFontMetrics(); - Rectangle2D textBounds = fm.getStringBounds(idText, graphics); - - int textX = (int) (slotBounds.getX() + (slotBounds.getWidth() / 2) - (textBounds.getWidth() / 2)); - int textY = (int) (slotBounds.getY() + (slotBounds.getHeight() / 2) + (textBounds.getHeight() / 2)); - - graphics.setColor(new Color(255, 255, 255, 65)); - graphics.fill(slotBounds); - - graphics.setColor(Color.BLACK); - graphics.drawString(idText, textX + 1, textY + 1); - graphics.setColor(YELLOW); - graphics.drawString(idText, textX, textY); - } - } - - private void renderProjectiles(Graphics2D graphics) - { - List projectiles = client.getProjectiles(); - - for (Projectile projectile : projectiles) - { - int originX = projectile.getX1(); - int originY = projectile.getY1(); - - LocalPoint tilePoint = new LocalPoint(originX, originY); - Polygon poly = Perspective.getCanvasTilePoly(client, tilePoint); - - if (poly != null) - { - OverlayUtil.renderPolygon(graphics, poly, Color.RED); - } - - int projectileId = projectile.getId(); - Actor projectileInteracting = projectile.getInteracting(); - - String infoString = ""; - - if (projectileInteracting == null) - { - infoString += "AoE"; - } - else - { - infoString += "Targeted (T: " + projectileInteracting.getName() + ")"; - } - - infoString += " (ID: " + projectileId + ")"; - - if (projectileInteracting != null) - { - OverlayUtil.renderActorOverlay(graphics, projectile.getInteracting(), infoString, Color.RED); - } - else - { - LocalPoint projectilePoint = new LocalPoint((int) projectile.getX(), (int) projectile.getY()); - Point textLocation = Perspective.getCanvasTextLocation(client, graphics, projectilePoint, infoString, 0); - - if (textLocation != null) - { - OverlayUtil.renderTextLocation(graphics, textLocation, infoString, Color.RED); - } - } - } - } - - private void renderGraphicsObjects(Graphics2D graphics) - { - List graphicsObjects = client.getGraphicsObjects(); - - for (GraphicsObject graphicsObject : graphicsObjects) - { - LocalPoint lp = graphicsObject.getLocation(); - Polygon poly = Perspective.getCanvasTilePoly(client, lp); - - if (poly != null) - { - OverlayUtil.renderPolygon(graphics, poly, Color.MAGENTA); - } - - String infoString = "(ID: " + graphicsObject.getId() + ")"; - Point textLocation = Perspective.getCanvasTextLocation( - client, graphics, lp, infoString, 0); - if (textLocation != null) - { - OverlayUtil.renderTextLocation(graphics, textLocation, infoString, Color.WHITE); - } - } - } - - private void renderPlayerWireframe(Graphics2D graphics, Player player, Color color) - { - Polygon[] polys = player.getPolygons(); - - if (polys == null) - { - return; - } - - graphics.setColor(color); - - for (Polygon p : polys) - { - graphics.drawPolygon(p); - } - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPanel.java deleted file mode 100644 index fd46f60843..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPanel.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2017, Kronos - * Copyright (c) 2017, 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.devtools; - -import java.awt.GridLayout; -import java.awt.TrayIcon; -import javax.inject.Inject; -import javax.swing.JButton; -import javax.swing.JPanel; -import net.runelite.api.Client; -import net.runelite.client.Notifier; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.PluginPanel; - -class DevToolsPanel extends PluginPanel -{ - private final Client client; - private final Notifier notifier; - private final DevToolsPlugin plugin; - - private final WidgetInspector widgetInspector; - private final VarInspector varInspector; - - @Inject - private DevToolsPanel(Client client, DevToolsPlugin plugin, WidgetInspector widgetInspector, VarInspector varInspector, Notifier notifier) - { - super(); - this.client = client; - this.plugin = plugin; - this.widgetInspector = widgetInspector; - this.varInspector = varInspector; - this.notifier = notifier; - - setBackground(ColorScheme.DARK_GRAY_COLOR); - - add(createOptionsPanel()); - } - - private JPanel createOptionsPanel() - { - final JPanel container = new JPanel(); - container.setBackground(ColorScheme.DARK_GRAY_COLOR); - container.setLayout(new GridLayout(0, 2, 3, 3)); - - container.add(plugin.getPlayers()); - container.add(plugin.getNpcs()); - - container.add(plugin.getGroundItems()); - container.add(plugin.getGroundObjects()); - container.add(plugin.getGameObjects()); - container.add(plugin.getGraphicsObjects()); - container.add(plugin.getWalls()); - container.add(plugin.getDecorations()); - - container.add(plugin.getInventory()); - container.add(plugin.getProjectiles()); - - container.add(plugin.getLocation()); - container.add(plugin.getWorldMapLocation()); - container.add(plugin.getTileLocation()); - container.add(plugin.getCursorPos()); - container.add(plugin.getCameraPosition()); - - container.add(plugin.getChunkBorders()); - container.add(plugin.getMapSquares()); - - container.add(plugin.getLineOfSight()); - container.add(plugin.getValidMovement()); - container.add(plugin.getInteracting()); - container.add(plugin.getExamine()); - - container.add(plugin.getDetachedCamera()); - plugin.getDetachedCamera().addActionListener((ev) -> - { - client.setOculusOrbState(!plugin.getDetachedCamera().isActive() ? 1 : 0); - client.setOculusOrbNormalSpeed(!plugin.getDetachedCamera().isActive() ? 36 : 12); - }); - - container.add(plugin.getWidgetInspector()); - plugin.getWidgetInspector().addActionListener((ev) -> - { - if (plugin.getWidgetInspector().isActive()) - { - widgetInspector.close(); - } - else - { - widgetInspector.open(); - } - }); - - container.add(plugin.getVarInspector()); - plugin.getVarInspector().addActionListener((ev) -> - { - if (plugin.getVarInspector().isActive()) - { - varInspector.close(); - } - else - { - varInspector.open(); - } - }); - - container.add(plugin.getLogMenuActions()); - plugin.getLogMenuActions().addActionListener((ev) -> - { - if (plugin.getLogMenuActions().isActive()) - { - client.setPrintMenuActions(false); - } - else - { - client.setPrintMenuActions(true); - } - }); - - container.add(plugin.getSoundEffects()); - - final JButton notificationBtn = new JButton("Notification"); - notificationBtn.addActionListener(e -> - { - notifier.notify("Wow!", TrayIcon.MessageType.ERROR); - }); - container.add(notificationBtn); - - return container; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java deleted file mode 100644 index 861d4440c5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java +++ /dev/null @@ -1,433 +0,0 @@ -/* - * Copyright (c) 2017, Kronos - * 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.devtools; - -import ch.qos.logback.classic.Level; -import ch.qos.logback.classic.Logger; -import com.google.common.collect.ImmutableList; -import com.google.inject.Provides; -import java.awt.image.BufferedImage; -import static java.lang.Math.min; -import java.util.List; -import javax.inject.Inject; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.Experience; -import net.runelite.api.MenuOpcode; -import net.runelite.api.NPC; -import net.runelite.api.Player; -import net.runelite.api.Skill; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.AreaSoundEffectPlayed; -import net.runelite.api.events.CommandExecuted; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.SoundEffectPlayed; -import net.runelite.api.events.StatChanged; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.kit.KitType; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.JagexColors; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.util.ColorUtil; -import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.MiscUtils; -import org.slf4j.LoggerFactory; - -@PluginDescriptor( - name = "Developer Tools", - tags = {"panel"}, - developerPlugin = true, - type = PluginType.MISCELLANEOUS -) -@Getter(AccessLevel.PACKAGE) -public class DevToolsPlugin extends Plugin -{ - private static final List EXAMINE_MENU_ACTIONS = ImmutableList.of(MenuOpcode.EXAMINE_ITEM, - MenuOpcode.EXAMINE_ITEM_GROUND, MenuOpcode.EXAMINE_NPC, MenuOpcode.EXAMINE_OBJECT); - - @Inject - private Client client; - - @Inject - private ClientToolbar clientToolbar; - - @Inject - private OverlayManager overlayManager; - - @Inject - private DevToolsOverlay overlay; - - @Inject - private LocationOverlay locationOverlay; - - @Inject - private SceneOverlay sceneOverlay; - - @Inject - private CameraOverlay cameraOverlay; - - @Inject - private WorldMapLocationOverlay worldMapLocationOverlay; - - @Inject - private WorldMapRegionOverlay mapRegionOverlay; - - @Inject - private SoundEffectOverlay soundEffectOverlay; - - @Inject - private EventBus eventBus; - - private DevToolsButton players; - private DevToolsButton npcs; - private DevToolsButton groundItems; - private DevToolsButton groundObjects; - private DevToolsButton gameObjects; - private DevToolsButton graphicsObjects; - private DevToolsButton walls; - private DevToolsButton decorations; - private DevToolsButton inventory; - private DevToolsButton projectiles; - private DevToolsButton location; - private DevToolsButton chunkBorders; - private DevToolsButton mapSquares; - private DevToolsButton validMovement; - private DevToolsButton lineOfSight; - private DevToolsButton cameraPosition; - private DevToolsButton worldMapLocation; - private DevToolsButton tileLocation; - private DevToolsButton cursorPos; - private DevToolsButton interacting; - private DevToolsButton examine; - private DevToolsButton detachedCamera; - private DevToolsButton widgetInspector; - private DevToolsButton varInspector; - private DevToolsButton logMenuActions; - private DevToolsButton soundEffects; - private NavigationButton navButton; - - @Provides - DevToolsConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(DevToolsConfig.class); - } - - @Override - protected void startUp() - { - - players = new DevToolsButton("Players"); - npcs = new DevToolsButton("NPCs"); - - groundItems = new DevToolsButton("Ground Items"); - groundObjects = new DevToolsButton("Ground Objects"); - gameObjects = new DevToolsButton("Game Objects"); - graphicsObjects = new DevToolsButton("Graphics Objects"); - walls = new DevToolsButton("Walls"); - decorations = new DevToolsButton("Decorations"); - - inventory = new DevToolsButton("Inventory"); - projectiles = new DevToolsButton("Projectiles"); - - location = new DevToolsButton("Location"); - worldMapLocation = new DevToolsButton("World Map Location"); - - tileLocation = new DevToolsButton("Tile Location"); - cursorPos = new DevToolsButton("Cursor Position"); - - cameraPosition = new DevToolsButton("Camera Position"); - chunkBorders = new DevToolsButton("Chunk Borders"); - - mapSquares = new DevToolsButton("Map Squares"); - lineOfSight = new DevToolsButton("Line Of Sight"); - - validMovement = new DevToolsButton("Valid Movement"); - interacting = new DevToolsButton("Interacting"); - - examine = new DevToolsButton("Examine"); - detachedCamera = new DevToolsButton("Detached Camera"); - - widgetInspector = new DevToolsButton("Widget Inspector"); - varInspector = new DevToolsButton("Var Inspector"); - - soundEffects = new DevToolsButton("Sound Effects"); - logMenuActions = new DevToolsButton("Menu Actions"); - - overlayManager.add(overlay); - overlayManager.add(locationOverlay); - overlayManager.add(sceneOverlay); - overlayManager.add(cameraOverlay); - overlayManager.add(worldMapLocationOverlay); - overlayManager.add(mapRegionOverlay); - overlayManager.add(soundEffectOverlay); - - final DevToolsPanel panel = injector.getInstance(DevToolsPanel.class); - - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "devtools_icon.png"); - - navButton = NavigationButton.builder() - .tooltip("Developer Tools") - .icon(icon) - .priority(1) - .panel(panel) - .build(); - - clientToolbar.addNavigation(navButton); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - overlayManager.remove(locationOverlay); - overlayManager.remove(sceneOverlay); - overlayManager.remove(cameraOverlay); - overlayManager.remove(worldMapLocationOverlay); - overlayManager.remove(mapRegionOverlay); - overlayManager.remove(soundEffectOverlay); - clientToolbar.removeNavigation(navButton); - } - - @Subscribe - private void onCommandExecuted(CommandExecuted commandExecuted) - { - String[] args = commandExecuted.getArguments(); - - switch (commandExecuted.getCommand()) - { - case "logger": - { - final Logger logger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); - String message; - Level currentLoggerLevel = logger.getLevel(); - - if (args.length < 1) - { - message = "Logger level is currently set to " + currentLoggerLevel; - } - else - { - Level newLoggerLevel = Level.toLevel(args[0], currentLoggerLevel); - logger.setLevel(newLoggerLevel); - message = "Logger level has been set to " + newLoggerLevel; - } - - client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", message, null); - break; - } - case "getvarp": - { - int varp = Integer.parseInt(args[0]); - int value = client.getVarpValue(client.getVarps(), varp); - client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "VarPlayer " + varp + ": " + value, null); - break; - } - case "setvarp": - { - int varp = Integer.parseInt(args[0]); - int value = Integer.parseInt(args[1]); - client.setVarpValue(client.getVarps(), varp, value); - client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Set VarPlayer " + varp + " to " + value, null); - VarbitChanged varbitChanged = new VarbitChanged(); - varbitChanged.setIndex(varp); - eventBus.post(VarbitChanged.class, varbitChanged); // fake event - break; - } - case "getvarb": - { - int varbit = Integer.parseInt(args[0]); - int value = client.getVarbitValue(client.getVarps(), varbit); - client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Varbit " + varbit + ": " + value, null); - break; - } - case "setvarb": - { - int varbit = Integer.parseInt(args[0]); - int value = Integer.parseInt(args[1]); - client.setVarbitValue(client.getVarps(), varbit, value); - client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Set varbit " + varbit + " to " + value, null); - eventBus.post(VarbitChanged.class, new VarbitChanged()); // fake event - break; - } - case "addxp": - { - Skill skill = Skill.valueOf(args[0].toUpperCase()); - int xp = Integer.parseInt(args[1]); - - int totalXp = client.getSkillExperience(skill) + xp; - int level = min(Experience.getLevelForXp(totalXp), 99); - - client.getBoostedSkillLevels()[skill.ordinal()] = level; - client.getRealSkillLevels()[skill.ordinal()] = level; - client.getSkillExperiences()[skill.ordinal()] = totalXp; - - client.queueChangedSkill(skill); - - StatChanged statChanged = new StatChanged( - skill, - totalXp, - level, - level - ); - eventBus.post(StatChanged.class, statChanged); - break; - } - case "setstat": - { - Skill skill = Skill.valueOf(args[0].toUpperCase()); - int level = Integer.parseInt(args[1]); - - level = MiscUtils.clamp(level, 1, Experience.MAX_REAL_LEVEL); - int xp = Experience.getXpForLevel(level); - - client.getBoostedSkillLevels()[skill.ordinal()] = level; - client.getRealSkillLevels()[skill.ordinal()] = level; - client.getSkillExperiences()[skill.ordinal()] = xp; - - client.queueChangedSkill(skill); - - StatChanged statChanged = new StatChanged( - skill, - xp, - level, - level - ); - eventBus.post(StatChanged.class, statChanged); - break; - } - case "anim": - { - int id = Integer.parseInt(args[0]); - Player localPlayer = client.getLocalPlayer(); - localPlayer.setAnimation(id); - localPlayer.setActionFrame(0); - break; - } - case "gfx": - { - int id = Integer.parseInt(args[0]); - Player localPlayer = client.getLocalPlayer(); - localPlayer.setSpotAnimation(id); - localPlayer.setSpotAnimationFrame(0); - break; - } - case "transform": - { - int id = Integer.parseInt(args[0]); - Player player = client.getLocalPlayer(); - player.getPlayerAppearance().setTransformedNpcId(id); - player.setIdlePoseAnimation(-1); - player.setPoseAnimation(-1); - break; - } - case "cape": - { - int id = Integer.parseInt(args[0]); - Player player = client.getLocalPlayer(); - player.getPlayerAppearance().getEquipmentIds()[KitType.CAPE.getIndex()] = id + 512; - player.getPlayerAppearance().setHash(); - break; - } - case "sound": - { - int id = Integer.parseInt(args[0]); - client.playSoundEffect(id); - break; - } - case "msg": - { - client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", String.join(" ", args), ""); - break; - } - } - } - - @Subscribe - private void onMenuEntryAdded(MenuEntryAdded entry) - { - if (!examine.isActive()) - { - return; - } - - MenuOpcode action = MenuOpcode.of(entry.getOpcode()); - - if (EXAMINE_MENU_ACTIONS.contains(action)) - { - final int identifier = entry.getIdentifier(); - String info = "ID: "; - - if (action == MenuOpcode.EXAMINE_NPC) - { - NPC npc = client.getCachedNPCs()[identifier]; - info += npc.getId(); - } - else - { - info += identifier; - - if (action == MenuOpcode.EXAMINE_OBJECT) - { - WorldPoint point = WorldPoint.fromScene(client, entry.getParam0(), entry.getParam1(), client.getPlane()); - info += " X: " + point.getX() + " Y: " + point.getY(); - } - } - - entry.setTarget(entry.getTarget() + " " + ColorUtil.prependColorTag("(" + info + ")", JagexColors.MENU_TARGET)); - entry.setModified(); - } - } - - @Subscribe - private void onSoundEffectPlayed(SoundEffectPlayed event) - { - if (!getSoundEffects().isActive() || soundEffectOverlay == null) - { - return; - } - - soundEffectOverlay.onSoundEffectPlayed(event); - } - - @Subscribe - private void onAreaSoundEffectPlayed(AreaSoundEffectPlayed event) - { - if (!getSoundEffects().isActive() || soundEffectOverlay == null) - { - return; - } - - soundEffectOverlay.onAreaSoundEffectPlayed(event); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/LocationOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/LocationOverlay.java deleted file mode 100644 index af739d6499..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/LocationOverlay.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.devtools; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import net.runelite.api.Client; -import static net.runelite.api.Constants.CHUNK_SIZE; -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.OverlayPosition; -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; -import net.runelite.client.util.ColorUtil; - -public class LocationOverlay extends Overlay -{ - private final Client client; - private final DevToolsPlugin plugin; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - LocationOverlay(Client client, DevToolsPlugin plugin) - { - this.client = client; - this.plugin = plugin; - panelComponent.setPreferredSize(new Dimension(150, 0)); - setPosition(OverlayPosition.TOP_LEFT); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.getLocation().isActive()) - { - return null; - } - - panelComponent.getChildren().clear(); - WorldPoint localWorld = client.getLocalPlayer().getWorldLocation(); - LocalPoint localPoint = client.getLocalPlayer().getLocalLocation(); - - int regionID = localWorld.getRegionID(); - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - if (client.isInInstancedRegion()) - { - tableComponent.addRow("Instance", ""); - - int[][][] instanceTemplateChunks = client.getInstanceTemplateChunks(); - int z = client.getPlane(); - int chunkData = instanceTemplateChunks[z][localPoint.getSceneX() / CHUNK_SIZE][localPoint.getSceneY() / CHUNK_SIZE]; - - int rotation = chunkData >> 1 & 0x3; - int chunkY = (chunkData >> 3 & 0x7FF) * CHUNK_SIZE; - int chunkX = (chunkData >> 14 & 0x3FF) * CHUNK_SIZE; - - tableComponent.addRow("Chunk " + localPoint.getSceneX() / CHUNK_SIZE + "," + localPoint.getSceneY() / CHUNK_SIZE, rotation + " " + chunkX + " " + chunkY); - } - - tableComponent.addRow("Base", client.getBaseX() + ", " + client.getBaseY()); - tableComponent.addRow("Local", localPoint.getX() + ", " + localPoint.getY()); - tableComponent.addRow("Scene", localPoint.getSceneX() + ", " + localPoint.getSceneY()); - tableComponent.addRow("Tile", localWorld.getX() + ", " + localWorld.getY() + ", " + client.getPlane()); - - for (int i = 0; i < client.getMapRegions().length; i++) - { - int region = client.getMapRegions()[i]; - - tableComponent.addRow((i == 0) ? "Map regions" : " ", ColorUtil.prependColorTag(String.valueOf(region), (region == regionID) ? Color.GREEN : Color.WHITE)); - } - - panelComponent.getChildren().add(tableComponent); - - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/SceneOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/SceneOverlay.java deleted file mode 100644 index 8c57b88a6b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/SceneOverlay.java +++ /dev/null @@ -1,406 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * 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.devtools; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.geom.AffineTransform; -import java.awt.geom.GeneralPath; -import java.util.List; -import java.util.stream.Stream; -import javax.inject.Inject; -import net.runelite.api.Actor; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.Perspective; -import net.runelite.api.Player; -import net.runelite.api.Point; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldArea; -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; - -public class SceneOverlay extends Overlay -{ - private static final Color MAP_SQUARE_COLOR = Color.GREEN; - private static final Color CHUNK_BORDER_COLOR = Color.BLUE; - private static final Color LOCAL_VALID_MOVEMENT_COLOR = new Color(141, 220, 26); - private static final Color VALID_MOVEMENT_COLOR = new Color(73, 122, 18); - private static final Color LINE_OF_SIGHT_COLOR = new Color(204, 42, 219); - private static final Color INTERACTING_COLOR = Color.CYAN; - - private static final int LOCAL_TILE_SIZE = Perspective.LOCAL_TILE_SIZE; - private static final int CHUNK_SIZE = 8; - private static final int MAP_SQUARE_SIZE = CHUNK_SIZE * CHUNK_SIZE; // 64 - private static final int CULL_CHUNK_BORDERS_RANGE = 16; - private static final int STROKE_WIDTH = 4; - private static final int CULL_LINE_OF_SIGHT_RANGE = 20; - private static final int INTERACTING_SHIFT = -16; - - private static final Polygon ARROW_HEAD = new Polygon( - new int[]{0, -3, 3}, - new int[]{0, -5, -5}, - 3 - ); - - - private final Client client; - private final DevToolsPlugin plugin; - - @Inject - public SceneOverlay(Client client, DevToolsPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.getChunkBorders().isActive()) - { - renderChunkBorders(graphics); - } - - if (plugin.getMapSquares().isActive()) - { - renderMapSquares(graphics); - } - - if (plugin.getLineOfSight().isActive()) - { - renderLineOfSight(graphics); - } - - if (plugin.getValidMovement().isActive()) - { - renderValidMovement(graphics); - } - - if (plugin.getInteracting().isActive()) - { - renderInteracting(graphics); - } - - return null; - } - - private void renderChunkBorders(Graphics2D graphics) - { - WorldPoint wp = client.getLocalPlayer().getWorldLocation(); - int startX = (wp.getX() - CULL_CHUNK_BORDERS_RANGE + CHUNK_SIZE - 1) / CHUNK_SIZE * CHUNK_SIZE; - int startY = (wp.getY() - CULL_CHUNK_BORDERS_RANGE + CHUNK_SIZE - 1) / CHUNK_SIZE * CHUNK_SIZE; - int endX = (wp.getX() + CULL_CHUNK_BORDERS_RANGE) / CHUNK_SIZE * CHUNK_SIZE; - int endY = (wp.getY() + CULL_CHUNK_BORDERS_RANGE) / CHUNK_SIZE * CHUNK_SIZE; - - graphics.setStroke(new BasicStroke(STROKE_WIDTH)); - graphics.setColor(CHUNK_BORDER_COLOR); - - GeneralPath path = new GeneralPath(); - for (int x = startX; x <= endX; x += CHUNK_SIZE) - { - LocalPoint lp1 = LocalPoint.fromWorld(client, x, wp.getY() - CULL_CHUNK_BORDERS_RANGE); - LocalPoint lp2 = LocalPoint.fromWorld(client, x, wp.getY() + CULL_CHUNK_BORDERS_RANGE); - - boolean first = true; - for (int y = lp1.getY(); y <= lp2.getY(); y += LOCAL_TILE_SIZE) - { - Point p = Perspective.localToCanvas(client, - new LocalPoint(lp1.getX() - LOCAL_TILE_SIZE / 2, y - LOCAL_TILE_SIZE / 2), - client.getPlane()); - if (p != null) - { - if (first) - { - path.moveTo(p.getX(), p.getY()); - first = false; - } - else - { - path.lineTo(p.getX(), p.getY()); - } - } - } - } - for (int y = startY; y <= endY; y += CHUNK_SIZE) - { - LocalPoint lp1 = LocalPoint.fromWorld(client, wp.getX() - CULL_CHUNK_BORDERS_RANGE, y); - LocalPoint lp2 = LocalPoint.fromWorld(client, wp.getX() + CULL_CHUNK_BORDERS_RANGE, y); - - boolean first = true; - for (int x = lp1.getX(); x <= lp2.getX(); x += LOCAL_TILE_SIZE) - { - Point p = Perspective.localToCanvas(client, - new LocalPoint(x - LOCAL_TILE_SIZE / 2, lp1.getY() - LOCAL_TILE_SIZE / 2), - client.getPlane()); - if (p != null) - { - if (first) - { - path.moveTo(p.getX(), p.getY()); - first = false; - } - else - { - path.lineTo(p.getX(), p.getY()); - } - } - } - } - graphics.draw(path); - } - - private void renderMapSquares(Graphics2D graphics) - { - WorldPoint wp = client.getLocalPlayer().getWorldLocation(); - int startX = (wp.getX() - CULL_CHUNK_BORDERS_RANGE + MAP_SQUARE_SIZE - 1) / MAP_SQUARE_SIZE * MAP_SQUARE_SIZE; - int startY = (wp.getY() - CULL_CHUNK_BORDERS_RANGE + MAP_SQUARE_SIZE - 1) / MAP_SQUARE_SIZE * MAP_SQUARE_SIZE; - int endX = (wp.getX() + CULL_CHUNK_BORDERS_RANGE) / MAP_SQUARE_SIZE * MAP_SQUARE_SIZE; - int endY = (wp.getY() + CULL_CHUNK_BORDERS_RANGE) / MAP_SQUARE_SIZE * MAP_SQUARE_SIZE; - - graphics.setStroke(new BasicStroke(STROKE_WIDTH)); - graphics.setColor(MAP_SQUARE_COLOR); - - GeneralPath path = new GeneralPath(); - for (int x = startX; x <= endX; x += MAP_SQUARE_SIZE) - { - LocalPoint lp1 = LocalPoint.fromWorld(client, x, wp.getY() - CULL_CHUNK_BORDERS_RANGE); - LocalPoint lp2 = LocalPoint.fromWorld(client, x, wp.getY() + CULL_CHUNK_BORDERS_RANGE); - - boolean first = true; - for (int y = lp1.getY(); y <= lp2.getY(); y += LOCAL_TILE_SIZE) - { - Point p = Perspective.localToCanvas(client, - new LocalPoint(lp1.getX() - LOCAL_TILE_SIZE / 2, y - LOCAL_TILE_SIZE / 2), - client.getPlane()); - if (p != null) - { - if (first) - { - path.moveTo(p.getX(), p.getY()); - first = false; - } - else - { - path.lineTo(p.getX(), p.getY()); - } - } - } - } - for (int y = startY; y <= endY; y += MAP_SQUARE_SIZE) - { - LocalPoint lp1 = LocalPoint.fromWorld(client, wp.getX() - CULL_CHUNK_BORDERS_RANGE, y); - LocalPoint lp2 = LocalPoint.fromWorld(client, wp.getX() + CULL_CHUNK_BORDERS_RANGE, y); - - boolean first = true; - for (int x = lp1.getX(); x <= lp2.getX(); x += LOCAL_TILE_SIZE) - { - Point p = Perspective.localToCanvas(client, - new LocalPoint(x - LOCAL_TILE_SIZE / 2, lp1.getY() - LOCAL_TILE_SIZE / 2), - client.getPlane()); - if (p != null) - { - if (first) - { - path.moveTo(p.getX(), p.getY()); - first = false; - } - else - { - path.lineTo(p.getX(), p.getY()); - } - } - } - } - graphics.draw(path); - } - - private void renderTileIfValidForMovement(Graphics2D graphics, Actor actor, int dx, int dy) - { - WorldArea area = actor.getWorldArea(); - if (area == null) - { - return; - } - - if (area.canTravelInDirection(client, dx, dy)) - { - LocalPoint lp = actor.getLocalLocation(); - if (lp == null) - { - return; - } - - lp = new LocalPoint( - lp.getX() + dx * Perspective.LOCAL_TILE_SIZE + dx * Perspective.LOCAL_TILE_SIZE * (area.getWidth() - 1) / 2, - lp.getY() + dy * Perspective.LOCAL_TILE_SIZE + dy * Perspective.LOCAL_TILE_SIZE * (area.getHeight() - 1) / 2); - - Polygon poly = Perspective.getCanvasTilePoly(client, lp); - if (poly == null) - { - return; - } - - if (actor == client.getLocalPlayer()) - { - OverlayUtil.renderPolygon(graphics, poly, LOCAL_VALID_MOVEMENT_COLOR); - } - else - { - OverlayUtil.renderPolygon(graphics, poly, VALID_MOVEMENT_COLOR); - } - } - } - - private void renderValidMovement(Graphics2D graphics) - { - Player player = client.getLocalPlayer(); - List npcs = client.getNpcs(); - for (NPC npc : npcs) - { - if (player.getInteracting() != npc && npc.getInteracting() != player) - { - continue; - } - for (int dx = -1; dx <= 1; dx++) - { - for (int dy = -1; dy <= 1; dy++) - { - if (dx == 0 && dy == 0) - { - continue; - } - renderTileIfValidForMovement(graphics, npc, dx, dy); - } - } - } - - for (int dx = -1; dx <= 1; dx++) - { - for (int dy = -1; dy <= 1; dy++) - { - if (dx == 0 && dy == 0) - { - continue; - } - renderTileIfValidForMovement(graphics, player, dx, dy); - } - } - } - - private void renderTileIfHasLineOfSight(Graphics2D graphics, WorldArea start, int targetX, int targetY) - { - WorldPoint targetLocation = new WorldPoint(targetX, targetY, start.getPlane()); - - // Running the line of sight algorithm 100 times per frame doesn't - // seem to use much CPU time, however rendering 100 tiles does - if (start.hasLineOfSightTo(client, targetLocation)) - { - LocalPoint lp = LocalPoint.fromWorld(client, targetLocation); - if (lp == null) - { - return; - } - - Polygon poly = Perspective.getCanvasTilePoly(client, lp); - if (poly == null) - { - return; - } - - OverlayUtil.renderPolygon(graphics, poly, LINE_OF_SIGHT_COLOR); - } - } - - private void renderLineOfSight(Graphics2D graphics) - { - WorldArea area = client.getLocalPlayer().getWorldArea(); - for (int x = area.getX() - CULL_LINE_OF_SIGHT_RANGE; x <= area.getX() + CULL_LINE_OF_SIGHT_RANGE; x++) - { - for (int y = area.getY() - CULL_LINE_OF_SIGHT_RANGE; y <= area.getY() + CULL_LINE_OF_SIGHT_RANGE; y++) - { - if (x == area.getX() && y == area.getY()) - { - continue; - } - renderTileIfHasLineOfSight(graphics, area, x, y); - } - } - } - - private void renderInteracting(Graphics2D graphics) - { - Stream.concat( - client.getPlayers().stream(), - client.getNpcs().stream() - ).forEach(fa -> - { - Actor ta = fa.getInteracting(); - if (ta == null) - { - return; - } - - LocalPoint fl = fa.getLocalLocation(); - Point fs = Perspective.localToCanvas(client, fl, client.getPlane(), fa.getLogicalHeight() / 2); - if (fs == null) - { - return; - } - int fsx = fs.getX(); - int fsy = fs.getY() - INTERACTING_SHIFT; - - LocalPoint tl = ta.getLocalLocation(); - Point ts = Perspective.localToCanvas(client, tl, client.getPlane(), ta.getLogicalHeight() / 2); - if (ts == null) - { - return; - } - int tsx = ts.getX(); - int tsy = ts.getY() - INTERACTING_SHIFT; - - graphics.setColor(INTERACTING_COLOR); - graphics.drawLine(fsx, fsy, tsx, tsy); - - AffineTransform t = new AffineTransform(); - t.translate(tsx, tsy); - t.rotate(tsx - fsx, tsy - fsy); - t.rotate(Math.PI / -2); - AffineTransform ot = graphics.getTransform(); - graphics.setTransform(t); - graphics.fill(ARROW_HEAD); - graphics.setTransform(ot); - - }); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/SoundEffectOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/SoundEffectOverlay.java deleted file mode 100644 index 86b878d8c1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/SoundEffectOverlay.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2018, WooxSolo - * 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.devtools; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.Player; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.events.AreaSoundEffectPlayed; -import net.runelite.api.events.SoundEffectPlayed; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; - -class SoundEffectOverlay extends Overlay -{ - private final static int MAX_LINES = 16; - private final static Color COLOR_SOUND_EFFECT = Color.WHITE; - private final static Color COLOR_AREA_SOUND_EFFECT = Color.YELLOW; - private final static Color COLOR_SILENT_SOUND_EFFECT = Color.GRAY; - - private final Client client; - private final DevToolsPlugin plugin; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - SoundEffectOverlay(Client client, DevToolsPlugin plugin) - { - this.client = client; - this.plugin = plugin; - panelComponent.setPreferredSize(new Dimension(200, 0)); - panelComponent.getChildren().add(LineComponent.builder() - .left("Sound Effects") - .leftColor(Color.CYAN) - .build()); - setPosition(OverlayPosition.TOP_LEFT); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.getSoundEffects().isActive()) - { - return null; - } - - return panelComponent.render(graphics); - } - - void onSoundEffectPlayed(SoundEffectPlayed event) - { - String text = - "Id: " + event.getSoundId() + - " - D: " + event.getDelay(); - - panelComponent.getChildren().add(LineComponent.builder() - .left(text) - .leftColor(COLOR_SOUND_EFFECT) - .build()); - - checkMaxLines(); - } - - void onAreaSoundEffectPlayed(AreaSoundEffectPlayed event) - { - Color textColor = COLOR_AREA_SOUND_EFFECT; - - // Check if the player is within range to hear the sound - Player localPlayer = client.getLocalPlayer(); - if (localPlayer != null) - { - LocalPoint lp = localPlayer.getLocalLocation(); - if (lp != null) - { - int sceneX = lp.getSceneX(); - int sceneY = lp.getSceneY(); - int distance = Math.abs(sceneX - event.getSceneX()) + Math.abs(sceneY - event.getSceneY()); - if (distance > event.getRange()) - { - textColor = COLOR_SILENT_SOUND_EFFECT; - } - } - } - - String text = - "Id: " + event.getSoundId() + - " - S: " + (event.getSource() != null ? event.getSource().getName() : "") + - " - L: " + event.getSceneX() + "," + event.getSceneY() + - " - R: " + event.getRange() + - " - D: " + event.getDelay(); - - panelComponent.getChildren().add(LineComponent.builder() - .left(text) - .leftColor(textColor) - .build()); - - checkMaxLines(); - } - - private void checkMaxLines() - { - while (panelComponent.getChildren().size() > MAX_LINES) - { - panelComponent.getChildren().remove(1); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/VarInspector.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/VarInspector.java deleted file mode 100644 index 5a5ced2878..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/VarInspector.java +++ /dev/null @@ -1,366 +0,0 @@ -/* - * 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.devtools; - -import com.google.inject.Inject; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.event.AdjustmentEvent; -import java.awt.event.AdjustmentListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import javax.swing.BorderFactory; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollBar; -import javax.swing.JScrollPane; -import javax.swing.SwingUtilities; -import javax.swing.border.CompoundBorder; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.VarClientInt; -import net.runelite.api.VarClientStr; -import net.runelite.api.VarPlayer; -import net.runelite.api.Varbits; -import net.runelite.api.events.VarClientIntChanged; -import net.runelite.api.events.VarClientStrChanged; -import net.runelite.api.events.VarbitChanged; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.ui.ClientUI; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.DynamicGridLayout; -import net.runelite.client.ui.FontManager; - -@Slf4j -class VarInspector extends JFrame -{ - @Getter(AccessLevel.PACKAGE) - private enum VarType - { - VARBIT("Varbit"), - VARP("VarPlayer"), - VARCINT("VarClientInt"), - VARCSTR("VarClientStr"); - - private final String name; - private final JCheckBox checkBox; - - VarType(String name) - { - this.name = name; - checkBox = new JCheckBox(name, true); - } - } - - private final static int MAX_LOG_ENTRIES = 10_000; - - private final Client client; - private final EventBus eventBus; - - private final JPanel tracker = new JPanel(); - - private int lastTick = 0; - - private int[] oldVarps = null; - private int[] oldVarps2 = null; - private int numVarbits = 10000; - - private Map varcs = null; - - @Inject - VarInspector(Client client, EventBus eventBus, DevToolsPlugin plugin) - { - this.eventBus = eventBus; - this.client = client; - - setTitle("RuneLite Var Inspector"); - setIconImage(ClientUI.ICON); - - setLayout(new BorderLayout()); - - setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); - addWindowListener(new WindowAdapter() - { - @Override - public void windowClosing(WindowEvent e) - { - eventBus.unregister(this); - close(); - plugin.getVarInspector().setActive(false); - } - }); - - tracker.setLayout(new DynamicGridLayout(0, 1, 0, 3)); - - final JPanel trackerWrapper = new JPanel(); - trackerWrapper.setLayout(new BorderLayout()); - trackerWrapper.add(tracker, BorderLayout.NORTH); - - final JScrollPane trackerScroller = new JScrollPane(trackerWrapper); - trackerScroller.setPreferredSize(new Dimension(400, 400)); - - final JScrollBar vertical = trackerScroller.getVerticalScrollBar(); - vertical.addAdjustmentListener(new AdjustmentListener() - { - int lastMaximum = actualMax(); - - private int actualMax() - { - return vertical.getMaximum() - vertical.getModel().getExtent(); - } - - @Override - public void adjustmentValueChanged(AdjustmentEvent e) - { - if (vertical.getValue() >= lastMaximum) - { - vertical.setValue(actualMax()); - } - lastMaximum = actualMax(); - } - }); - - add(trackerScroller, BorderLayout.CENTER); - - final JPanel trackerOpts = new JPanel(); - trackerOpts.setLayout(new FlowLayout()); - for (VarType cb : VarType.values()) - { - trackerOpts.add(cb.getCheckBox()); - } - - final JButton clearBtn = new JButton("Clear"); - clearBtn.addActionListener(e -> - { - tracker.removeAll(); - tracker.revalidate(); - }); - trackerOpts.add(clearBtn); - - add(trackerOpts, BorderLayout.SOUTH); - - pack(); - - } - - private void addVarLog(VarType type, String name, int old, int neew) - { - addVarLog(type, name, Integer.toString(old), Integer.toString(neew)); - } - - private void addVarLog(VarType type, String name, String old, String neew) - { - if (!type.getCheckBox().isSelected()) - { - return; - } - - int tick = client.getTickCount(); - SwingUtilities.invokeLater(() -> - { - if (tick != lastTick) - { - lastTick = tick; - JLabel header = new JLabel("Tick " + tick); - header.setFont(FontManager.getRunescapeSmallFont()); - header.setBorder(new CompoundBorder( - BorderFactory.createMatteBorder(0, 0, 1, 0, ColorScheme.LIGHT_GRAY_COLOR), - BorderFactory.createEmptyBorder(3, 6, 0, 0) - )); - tracker.add(header); - } - tracker.add(new JLabel(String.format("%s %s changed: %s -> %s", type.getName(), name, old, neew))); - - // Cull very old stuff - for (; tracker.getComponentCount() > MAX_LOG_ENTRIES; ) - { - tracker.remove(0); - } - - tracker.revalidate(); - }); - } - - private void onVarbitChanged(VarbitChanged ev) - { - int[] varps = client.getVarps(); - - // Check varbits - for (int i = 0; i < numVarbits; i++) - { - try - { - int old = client.getVarbitValue(oldVarps, i); - int neew = client.getVarbitValue(varps, i); - if (old != neew) - { - // Set the varbit so it doesn't show in the varp changes - // However, some varbits share common bits, so we only do it in oldVarps2 - // Example: 4101 collides with 4104-4129 - client.setVarbitValue(oldVarps2, i, neew); - - String name = String.format("%d", i); - for (Varbits varbit : Varbits.values()) - { - if (varbit.getId() == i) - { - name = String.format("%s(%d)", varbit.name(), i); - break; - } - } - addVarLog(VarType.VARBIT, name, old, neew); - } - } - catch (IndexOutOfBoundsException e) - { - // We don't know what the last varbit is, so we just hit the end, then set it for future iterations - log.debug("Hit OOB at varbit {}", i); - numVarbits = i; - break; - } - } - - // Check varps - for (int i = 0; i < varps.length; i++) - { - int old = oldVarps2[i]; - int neew = varps[i]; - if (old != neew) - { - String name = String.format("%d", i); - for (VarPlayer varp : VarPlayer.values()) - { - if (varp.getId() == i) - { - name = String.format("%s(%d)", varp.name(), i); - break; - } - } - addVarLog(VarType.VARP, name, old, neew); - } - } - - System.arraycopy(client.getVarps(), 0, oldVarps, 0, oldVarps.length); - System.arraycopy(client.getVarps(), 0, oldVarps2, 0, oldVarps2.length); - } - - private void onVarClientIntChanged(VarClientIntChanged e) - { - int idx = e.getIndex(); - int neew = (Integer) client.getVarcMap().getOrDefault(idx, 0); - int old = (Integer) varcs.getOrDefault(idx, 0); - varcs.put(idx, neew); - - if (old != neew) - { - String name = String.format("%d", idx); - for (VarClientInt varc : VarClientInt.values()) - { - if (varc.getIndex() == idx) - { - name = String.format("%s(%d)", varc.name(), idx); - break; - } - } - addVarLog(VarType.VARCINT, name, old, neew); - } - } - - private void onVarClientStrChanged(VarClientStrChanged e) - { - int idx = e.getIndex(); - String neew = (String) client.getVarcMap().getOrDefault(idx, ""); - String old = (String) varcs.getOrDefault(idx, ""); - varcs.put(idx, neew); - - if (!Objects.equals(old, neew)) - { - String name = String.format("%d", idx); - for (VarClientStr varc : VarClientStr.values()) - { - if (varc.getIndex() == idx) - { - name = String.format("%s(%d)", varc.name(), idx); - break; - } - } - if (old != null) - { - old = "\"" + old + "\""; - } - else - { - old = "null"; - } - if (neew != null) - { - neew = "\"" + neew + "\""; - } - else - { - neew = "null"; - } - addVarLog(VarType.VARCSTR, name, old, neew); - } - } - - public void open() - { - if (oldVarps == null) - { - oldVarps = new int[client.getVarps().length]; - oldVarps2 = new int[client.getVarps().length]; - } - - System.arraycopy(client.getVarps(), 0, oldVarps, 0, oldVarps.length); - System.arraycopy(client.getVarps(), 0, oldVarps2, 0, oldVarps2.length); - varcs = new HashMap<>(client.getVarcMap()); - - // eventBus.register(this); - eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged); - eventBus.subscribe(VarClientIntChanged.class, this, this::onVarClientIntChanged); - eventBus.subscribe(VarClientStrChanged.class, this, this::onVarClientStrChanged); - - setVisible(true); - toFront(); - repaint(); - } - - public void close() - { - tracker.removeAll(); - eventBus.unregister(this); - setVisible(false); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetField.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetField.java deleted file mode 100644 index 243f1a9c08..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetField.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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.devtools; - -import java.util.function.BiConsumer; -import java.util.function.Function; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.widgets.Widget; -import org.slf4j.helpers.MessageFormatter; - -@Slf4j -public class WidgetField -{ - @Getter(AccessLevel.PACKAGE) - private final String name; - - private final Function getter; - - private final BiConsumer setter; - - private final Class type; - - WidgetField(String name, Function getter) - { - this(name, getter, null, null); - } - - WidgetField(String name, Function getter, BiConsumer setter, Class type) - { - this.name = name; - this.getter = getter; - this.setter = setter; - this.type = type; - } - - Object getValue(Widget widget) - { - Object value = getter.apply(widget); - // These types are handled by the JTable automatically - if (value instanceof Boolean || value instanceof Number || value instanceof String) - { - return value; - } - return MessageFormatter.format("{}", value).getMessage(); - } - - @SuppressWarnings("unchecked") - void setValue(Widget widget, Object inValue) - { - Object value = null; - if ("null".equals(inValue)) - { - value = null; - } - if (type.isAssignableFrom(inValue.getClass())) - { - value = inValue; - } - else if (type == Boolean.class) - { - value = Boolean.valueOf((String) inValue); - } - else if (type == Integer.class) - { - value = Integer.valueOf((String) inValue); - } - else - { - log.warn("Type {} is not supported for editing", type); - } - setter.accept(widget, (T) value); - } - - boolean isSettable() - { - return setter != null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInfoTableModel.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInfoTableModel.java deleted file mode 100644 index 3e6898ebb3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInfoTableModel.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * 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.devtools; - -import com.google.common.collect.ImmutableMap; -import com.google.inject.Inject; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import javax.swing.SwingUtilities; -import javax.swing.table.AbstractTableModel; -import net.runelite.api.widgets.Widget; -import net.runelite.client.callback.ClientThread; - -class WidgetInfoTableModel extends AbstractTableModel -{ - @Inject - private ClientThread clientThread; - - private static final int COL_FIELD = 0; - private static final int COL_VALUE = 1; - - private static final List fields = populateWidgetFields(); - - private Widget widget = null; - private Map values = null; - - public void setWidget(Widget w) - { - clientThread.invoke(() -> - { - Map newValues = w == null ? null : fields.stream().collect(ImmutableMap.toImmutableMap( - Function.identity(), - i -> i.getValue(w) - )); - SwingUtilities.invokeLater(() -> - { - widget = w; - values = newValues; - fireTableStructureChanged(); - }); - }); - } - - @Override - public String getColumnName(int col) - { - switch (col) - { - case COL_FIELD: - return "Field"; - case COL_VALUE: - return "Value"; - default: - return null; - } - } - - @Override - public int getColumnCount() - { - return 2; - } - - @Override - public int getRowCount() - { - if (values == null) - { - return 0; - } - return values.size(); - } - - @Override - public Object getValueAt(int rowIndex, int columnIndex) - { - WidgetField field = fields.get(rowIndex); - switch (columnIndex) - { - case COL_FIELD: - return field.getName(); - case COL_VALUE: - return values.get(field); - default: - return null; - } - } - - @Override - public boolean isCellEditable(int rowIndex, int columnIndex) - { - if (columnIndex == COL_VALUE) - { - WidgetField field = fields.get(rowIndex); - return field.isSettable(); - } - return false; - } - - @Override - public void setValueAt(Object value, int rowIndex, int columnIndex) - { - WidgetField field = fields.get(rowIndex); - clientThread.invoke(() -> - { - field.setValue(widget, value); - setWidget(widget); - }); - } - - private static List populateWidgetFields() - { - List out = new ArrayList<>(); - - out.add(new WidgetField<>("Id", Widget::getId)); - out.add(new WidgetField<>("Type", Widget::getType, Widget::setType, Integer.class)); - out.add(new WidgetField<>("ContentType", Widget::getContentType, Widget::setContentType, Integer.class)); - out.add(new WidgetField<>("ParentId", Widget::getParentId)); - out.add(new WidgetField<>("SelfHidden", Widget::isSelfHidden, Widget::setHidden, Boolean.class)); - out.add(new WidgetField<>("Hidden", Widget::isHidden)); - out.add(new WidgetField<>("Text", Widget::getText, Widget::setText, String.class)); - out.add(new WidgetField<>("TextColor", - w -> Integer.toString(w.getTextColor(), 16), - (w, str) -> w.setTextColor(Integer.parseInt(str, 16)), - String.class - )); - out.add(new WidgetField<>("Opacity", Widget::getOpacity, Widget::setOpacity, Integer.class)); - out.add(new WidgetField<>("FontId", Widget::getFontId, Widget::setFontId, Integer.class)); - out.add(new WidgetField<>("TextShadowed", Widget::getTextShadowed, Widget::setTextShadowed, Boolean.class)); - out.add(new WidgetField<>("Name", w -> w.getName().trim(), Widget::setName, String.class)); - out.add(new WidgetField<>("ItemId", Widget::getItemId, Widget::setItemId, Integer.class)); - out.add(new WidgetField<>("ItemQuantity", Widget::getItemQuantity, Widget::setItemQuantity, Integer.class)); - out.add(new WidgetField<>("ItemQuantityMode", Widget::getItemQuantityMode, Widget::setItemQuantityMode, Integer.class)); - out.add(new WidgetField<>("ModelId", Widget::getModelId)); - out.add(new WidgetField<>("SpriteId", Widget::getSpriteId, Widget::setSpriteId, Integer.class)); - out.add(new WidgetField<>("BorderType", Widget::getBorderType, Widget::setBorderType, Integer.class)); - out.add(new WidgetField<>("IsIf3", Widget::isIf3)); - out.add(new WidgetField<>("HasListener", Widget::hasListener, Widget::setHasListener, Boolean.class)); - out.add(new WidgetField<>("Filled", Widget::isFilled, Widget::setFilled, Boolean.class)); - out.add(new WidgetField<>("OriginalX", Widget::getOriginalX, Widget::setOriginalX, Integer.class)); - out.add(new WidgetField<>("OriginalY", Widget::getOriginalY, Widget::setOriginalY, Integer.class)); - out.add(new WidgetField<>("OriginalWidth", Widget::getOriginalWidth, Widget::setOriginalWidth, Integer.class)); - out.add(new WidgetField<>("OriginalHeight", Widget::getOriginalHeight, Widget::setOriginalHeight, Integer.class)); - out.add(new WidgetField<>("XPositionMode", Widget::getXPositionMode, Widget::setXPositionMode, Integer.class)); - out.add(new WidgetField<>("YPositionMode", Widget::getYPositionMode, Widget::setYPositionMode, Integer.class)); - out.add(new WidgetField<>("WidthMode", Widget::getWidthMode, Widget::setWidthMode, Integer.class)); - out.add(new WidgetField<>("HeightMode", Widget::getHeightMode, Widget::setHeightMode, Integer.class)); - out.add(new WidgetField<>("XTextAlignment", Widget::getXTextAlignment, Widget::setXTextAlignment, Integer.class)); - out.add(new WidgetField<>("YTextAlignment", Widget::getYTextAlignment, Widget::setYTextAlignment, Integer.class)); - out.add(new WidgetField<>("RelativeX", Widget::getRelativeX, Widget::setRelativeX, Integer.class)); - out.add(new WidgetField<>("RelativeY", Widget::getRelativeY, Widget::setRelativeY, Integer.class)); - out.add(new WidgetField<>("Width", Widget::getWidth, Widget::setWidth, Integer.class)); - out.add(new WidgetField<>("Height", Widget::getHeight, Widget::setHeight, Integer.class)); - out.add(new WidgetField<>("RotationX", Widget::getRotationX, Widget::setRotationX, Integer.class)); - out.add(new WidgetField<>("RotationY", Widget::getRotationY, Widget::setRotationY, Integer.class)); - out.add(new WidgetField<>("RotationZ", Widget::getRotationZ, Widget::setRotationZ, Integer.class)); - out.add(new WidgetField<>("ModelZoom", Widget::getModelZoom, Widget::setModelZoom, Integer.class)); - out.add(new WidgetField<>("CanvasLocation", Widget::getCanvasLocation)); - out.add(new WidgetField<>("Bounds", Widget::getBounds)); - out.add(new WidgetField<>("ScrollX", Widget::getScrollX, Widget::setScrollX, Integer.class)); - out.add(new WidgetField<>("ScrollY", Widget::getScrollY, Widget::setScrollY, Integer.class)); - out.add(new WidgetField<>("ScrollWidth", Widget::getScrollWidth, Widget::setScrollWidth, Integer.class)); - out.add(new WidgetField<>("ScrollHeight", Widget::getScrollHeight, Widget::setScrollHeight, Integer.class)); - out.add(new WidgetField<>("DragDeadZone", Widget::getDragDeadZone, Widget::setDragDeadZone, Integer.class)); - out.add(new WidgetField<>("DragDeadTime", Widget::getDragDeadTime, Widget::setDragDeadTime, Integer.class)); - out.add(new WidgetField<>("NoClickThrough", Widget::getNoClickThrough, Widget::setNoClickThrough, Boolean.class)); - out.add(new WidgetField<>("NoScrollThrough", Widget::getNoScrollThrough, Widget::setNoScrollThrough, Boolean.class)); - out.add(new WidgetField<>("TargetVerb", Widget::getTargetVerb, Widget::setTargetVerb, String.class)); - - return out; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspector.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspector.java deleted file mode 100644 index 7d3c124b84..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspector.java +++ /dev/null @@ -1,578 +0,0 @@ -/* - * Copyright (c) 2018 Abex - * Copyright (c) 2017, Kronos - * Copyright (c) 2017, 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.devtools; - -import com.google.inject.Inject; -import com.google.inject.Provider; -import com.google.inject.Singleton; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.util.Collection; -import java.util.Comparator; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; -import java.util.Stack; -import java.util.stream.Stream; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSplitPane; -import javax.swing.JTable; -import javax.swing.JTree; -import javax.swing.SwingUtilities; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.TreePath; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.MenuEntry; -import net.runelite.api.MenuOpcode; -import net.runelite.api.SpriteID; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.widgets.JavaScriptCallback; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetConfig; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.api.widgets.WidgetItem; -import net.runelite.api.widgets.WidgetType; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.ui.ClientUI; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.util.ColorUtil; - -@Slf4j -@Singleton -class WidgetInspector extends JFrame -{ - private static final Map widgetIdMap = new HashMap<>(); - - static final Color SELECTED_WIDGET_COLOR = Color.CYAN; - private static final float SELECTED_WIDGET_HUE; - - static - { - float[] hsb = new float[3]; - Color.RGBtoHSB(SELECTED_WIDGET_COLOR.getRed(), SELECTED_WIDGET_COLOR.getGreen(), SELECTED_WIDGET_COLOR.getBlue(), hsb); - SELECTED_WIDGET_HUE = hsb[0]; - } - - private final Client client; - private final ClientThread clientThread; - private final DevToolsConfig config; - private final Provider overlay; - private final OverlayManager overlayManager; - - private final JTree widgetTree; - private final WidgetInfoTableModel infoTableModel; - private final JCheckBox alwaysOnTop; - private final JCheckBox hideHidden; - - private DefaultMutableTreeNode root; - - @Getter(AccessLevel.PACKAGE) - private Widget selectedWidget; - - @Getter(AccessLevel.PACKAGE) - private int selectedItem; - - private Widget picker = null; - - @Getter(AccessLevel.PACKAGE) - private boolean pickerSelected = false; - - @Inject - private WidgetInspector( - Client client, - ClientThread clientThread, - WidgetInfoTableModel infoTableModel, - DevToolsConfig config, - DevToolsPlugin plugin, - EventBus eventBus, - Provider overlay, - OverlayManager overlayManager) - { - this.client = client; - this.clientThread = clientThread; - this.infoTableModel = infoTableModel; - this.config = config; - this.overlay = overlay; - this.overlayManager = overlayManager; - - eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged); - eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked); - eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded); - - setTitle("RuneLite Widget Inspector"); - setIconImage(ClientUI.ICON); - - // Reset highlight on close - addWindowListener(new WindowAdapter() - { - @Override - public void windowClosing(WindowEvent e) - { - close(); - plugin.getWidgetInspector().setActive(false); - } - }); - - setLayout(new BorderLayout()); - - widgetTree = new JTree(new DefaultMutableTreeNode()); - widgetTree.setRootVisible(false); - widgetTree.setShowsRootHandles(true); - widgetTree.getSelectionModel().addTreeSelectionListener(e -> - { - Object selected = widgetTree.getLastSelectedPathComponent(); - if (selected instanceof WidgetTreeNode) - { - WidgetTreeNode node = (WidgetTreeNode) selected; - Widget widget = node.getWidget(); - setSelectedWidget(widget, -1, false); - } - else if (selected instanceof WidgetItemNode) - { - WidgetItemNode node = (WidgetItemNode) selected; - setSelectedWidget(node.getWidgetItem().getWidget(), node.getWidgetItem().getIndex(), false); - } - }); - - final JScrollPane treeScrollPane = new JScrollPane(widgetTree); - treeScrollPane.setPreferredSize(new Dimension(200, 400)); - - - final JTable widgetInfo = new JTable(infoTableModel); - - final JScrollPane infoScrollPane = new JScrollPane(widgetInfo); - infoScrollPane.setPreferredSize(new Dimension(400, 400)); - - - final JPanel bottomPanel = new JPanel(); - add(bottomPanel, BorderLayout.SOUTH); - - final JButton refreshWidgetsBtn = new JButton("Refresh"); - refreshWidgetsBtn.addActionListener(e -> refreshWidgets()); - bottomPanel.add(refreshWidgetsBtn); - - alwaysOnTop = new JCheckBox("Always on top"); - alwaysOnTop.addItemListener(ev -> config.inspectorAlwaysOnTop(alwaysOnTop.isSelected())); - onConfigChanged(null); - bottomPanel.add(alwaysOnTop); - - hideHidden = new JCheckBox("Hide hidden"); - hideHidden.setSelected(true); - hideHidden.addItemListener(ev -> refreshWidgets()); - bottomPanel.add(hideHidden); - - final JButton revalidateWidget = new JButton("Revalidate"); - revalidateWidget.addActionListener(ev -> clientThread.invokeLater(() -> - { - if (selectedWidget == null) - { - return; - } - - selectedWidget.revalidate(); - })); - bottomPanel.add(revalidateWidget); - - final JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treeScrollPane, infoScrollPane); - add(split, BorderLayout.CENTER); - - pack(); - } - - private void onConfigChanged(ConfigChanged ev) - { - boolean onTop = config.inspectorAlwaysOnTop(); - setAlwaysOnTop(onTop); - alwaysOnTop.setSelected(onTop); - } - - private void refreshWidgets() - { - clientThread.invokeLater(() -> - { - Widget[] rootWidgets = client.getWidgetRoots(); - root = new DefaultMutableTreeNode(); - - Widget wasSelectedWidget = selectedWidget; - int wasSelectedItem = selectedItem; - - selectedWidget = null; - selectedItem = -1; - - for (Widget widget : rootWidgets) - { - DefaultMutableTreeNode childNode = addWidget("R", widget); - if (childNode != null) - { - root.add(childNode); - } - } - - SwingUtilities.invokeLater(() -> - { - widgetTree.setModel(new DefaultTreeModel(root)); - setSelectedWidget(wasSelectedWidget, wasSelectedItem, true); - }); - }); - } - - private DefaultMutableTreeNode addWidget(String type, Widget widget) - { - if (widget == null || (hideHidden.isSelected() && widget.isHidden())) - { - return null; - } - - DefaultMutableTreeNode node = new WidgetTreeNode(type, widget); - - Widget[] childComponents = widget.getDynamicChildren(); - if (childComponents != null) - { - for (Widget component : childComponents) - { - DefaultMutableTreeNode childNode = addWidget("D", component); - if (childNode != null) - { - node.add(childNode); - } - } - } - - childComponents = widget.getStaticChildren(); - if (childComponents != null) - { - for (Widget component : childComponents) - { - DefaultMutableTreeNode childNode = addWidget("S", component); - if (childNode != null) - { - node.add(childNode); - } - } - } - - childComponents = widget.getNestedChildren(); - if (childComponents != null) - { - for (Widget component : childComponents) - { - DefaultMutableTreeNode childNode = addWidget("N", component); - if (childNode != null) - { - node.add(childNode); - } - } - } - - Collection items = widget.getWidgetItems(); - if (items != null) - { - for (WidgetItem item : items) - { - if (item == null) - { - continue; - } - - node.add(new WidgetItemNode(item)); - } - } - - return node; - } - - private void setSelectedWidget(Widget widget, int item, boolean updateTree) - { - infoTableModel.setWidget(widget); - - if (this.selectedWidget == widget && this.selectedItem == item) - { - return; - } - - this.selectedWidget = widget; - this.selectedItem = item; - - if (root == null || !updateTree) - { - return; - } - - clientThread.invoke(() -> - { - Stack treePath = new Stack<>(); - for (Widget w = widget; w != null; w = w.getParent()) - { - treePath.push(w); - } - - DefaultMutableTreeNode node = root; - deeper: - for (; !treePath.empty(); ) - { - Widget w = treePath.pop(); - for (Enumeration it = node.children(); it.hasMoreElements(); ) - { - WidgetTreeNode inner = (WidgetTreeNode) it.nextElement(); - if (inner.getWidget().getId() == w.getId() && inner.getWidget().getIndex() == w.getIndex()) - { - node = inner; - continue deeper; - } - } - } - if (selectedItem != -1) - { - for (Enumeration it = node.children(); it.hasMoreElements(); ) - { - Object wiw = it.nextElement(); - if (wiw instanceof WidgetItemNode) - { - WidgetItemNode inner = (WidgetItemNode) wiw; - if (inner.getWidgetItem().getIndex() == selectedItem) - { - node = inner; - break; - } - } - } - } - - final DefaultMutableTreeNode fnode = node; - SwingUtilities.invokeLater(() -> - { - widgetTree.getSelectionModel().clearSelection(); - widgetTree.getSelectionModel().addSelectionPath(new TreePath(fnode.getPath())); - }); - }); - } - - static WidgetInfo getWidgetInfo(int packedId) - { - if (widgetIdMap.isEmpty()) - { - //Initialize map here so it doesn't create the index - //until it's actually needed. - WidgetInfo[] widgets = WidgetInfo.values(); - for (WidgetInfo w : widgets) - { - widgetIdMap.put(w.getPackedId(), w); - } - } - - return widgetIdMap.get(packedId); - } - - public void open() - { - setVisible(true); - toFront(); - repaint(); - overlayManager.add(this.overlay.get()); - clientThread.invokeLater(this::addPickerWidget); - } - - public void close() - { - overlayManager.remove(this.overlay.get()); - clientThread.invokeLater(this::removePickerWidget); - setSelectedWidget(null, -1, false); - setVisible(false); - } - - private void removePickerWidget() - { - if (picker == null) - { - return; - } - - Widget parent = picker.getParent(); - if (parent == null) - { - return; - } - - Widget[] children = parent.getChildren(); - if (children == null || children.length <= picker.getIndex() || children[picker.getIndex()] != picker) - { - return; - } - - children[picker.getIndex()] = null; - } - - private void addPickerWidget() - { - removePickerWidget(); - - int x = 10, y = 2; - Widget parent = client.getWidget(WidgetInfo.MINIMAP_ORBS); - if (parent == null) - { - Widget[] roots = client.getWidgetRoots(); - - parent = Stream.of(roots) - .filter(w -> w.getType() == WidgetType.LAYER && w.getContentType() == 0 && !w.isSelfHidden()).max(Comparator.comparing((Widget w) -> w.getRelativeX() + w.getRelativeY()) - .reversed() - .thenComparing(Widget::getId)).get(); - x = 4; - y = 4; - } - - picker = parent.createChild(-1, WidgetType.GRAPHIC); - - log.info("Picker is {}.{} [{}]", WidgetInfo.TO_GROUP(picker.getId()), WidgetInfo.TO_CHILD(picker.getId()), picker.getIndex()); - - picker.setSpriteId(SpriteID.MOBILE_FINGER_ON_INTERFACE); - picker.setOriginalWidth(15); - picker.setOriginalHeight(17); - picker.setOriginalX(x); - picker.setOriginalY(y); - picker.revalidate(); - picker.setTargetVerb("Select"); - picker.setName("Pick"); - picker.setClickMask(WidgetConfig.USE_WIDGET | WidgetConfig.USE_ITEM); - picker.setNoClickThrough(true); - picker.setOnTargetEnterListener((JavaScriptCallback) ev -> - { - pickerSelected = true; - picker.setOpacity(30); - client.setAllWidgetsAreOpTargetable(true); - }); - picker.setOnTargetLeaveListener((JavaScriptCallback) ev -> onPickerDeselect()); - } - - private void onPickerDeselect() - { - client.setAllWidgetsAreOpTargetable(false); - picker.setOpacity(0); - pickerSelected = false; - } - - private void onMenuOptionClicked(MenuOptionClicked ev) - { - if (!pickerSelected) - { - return; - } - - onPickerDeselect(); - client.setSpellSelected(false); - ev.consume(); - - Object target = getWidgetOrWidgetItemForMenuOption(ev.getMenuOpcode().getId(), ev.getParam0(), ev.getParam1()); - if (target == null) - { - return; - } - if (target instanceof WidgetItem) - { - WidgetItem iw = (WidgetItem) target; - setSelectedWidget(iw.getWidget(), iw.getIndex(), true); - } - else - { - setSelectedWidget((Widget) target, -1, true); - } - } - - - private void onMenuEntryAdded(MenuEntryAdded event) - { - if (!pickerSelected) - { - return; - } - - MenuEntry[] menuEntries = client.getMenuEntries(); - - for (int i = 0; i < menuEntries.length; i++) - { - MenuEntry entry = menuEntries[i]; - if (entry.getOpcode() != MenuOpcode.ITEM_USE_ON_WIDGET.getId() - && entry.getOpcode() != MenuOpcode.SPELL_CAST_ON_WIDGET.getId()) - { - continue; - } - String name = WidgetInfo.TO_GROUP(entry.getParam1()) + "." + WidgetInfo.TO_CHILD(entry.getParam1()); - - if (entry.getParam0() != -1) - { - name += " [" + entry.getParam0() + "]"; - } - - Color color = colorForWidget(i, menuEntries.length); - - entry.setTarget(ColorUtil.wrapWithColorTag(name, color)); - } - - client.setMenuEntries(menuEntries); - } - - Color colorForWidget(int index, int length) - { - float h = SELECTED_WIDGET_HUE + .1f + (.8f / length) * index; - - return Color.getHSBColor(h, 1, 1); - } - - Object getWidgetOrWidgetItemForMenuOption(int type, int param0, int param1) - { - if (type == MenuOpcode.SPELL_CAST_ON_WIDGET.getId()) - { - Widget w = client.getWidget(WidgetInfo.TO_GROUP(param1), WidgetInfo.TO_CHILD(param1)); - if (param0 != -1) - { - w = w.getChild(param0); - } - - return w; - } - else if (type == MenuOpcode.ITEM_USE_ON_WIDGET.getId()) - { - Widget w = client.getWidget(WidgetInfo.TO_GROUP(param1), WidgetInfo.TO_CHILD(param1)); - return w.getWidgetItem(param0); - } - - return null; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspectorOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspectorOverlay.java deleted file mode 100644 index 0d9e6095de..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetInspectorOverlay.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2018 Abex - * Copyright (c) 2017, Kronos - * Copyright (c) 2017, 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.devtools; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FontMetrics; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.geom.Rectangle2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.MenuEntry; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetItem; -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; - -@Singleton -public class WidgetInspectorOverlay extends Overlay -{ - private final Client client; - private final WidgetInspector inspector; - - @Inject - public WidgetInspectorOverlay( - Client client, - WidgetInspector inspector - ) - { - this.client = client; - this.inspector = inspector; - - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - setPriority(OverlayPriority.HIGHEST); - } - - @Override - public Dimension render(Graphics2D g) - { - Widget w = inspector.getSelectedWidget(); - if (w != null) - { - Object wiw = w; - if (inspector.getSelectedItem() != -1) - { - wiw = w.getWidgetItem(inspector.getSelectedItem()); - } - - renderWiw(g, wiw, WidgetInspector.SELECTED_WIDGET_COLOR); - } - - if (inspector.isPickerSelected()) - { - boolean menuOpen = client.isMenuOpen(); - - MenuEntry[] entries = client.getMenuEntries(); - for (int i = menuOpen ? 0 : entries.length - 1; i < entries.length; i++) - { - MenuEntry e = entries[i]; - - Object wiw = inspector.getWidgetOrWidgetItemForMenuOption(e.getOpcode(), e.getParam0(), e.getParam1()); - if (wiw == null) - { - continue; - } - - Color color = inspector.colorForWidget(i, entries.length); - renderWiw(g, wiw, color); - } - } - - return null; - } - - private void renderWiw(Graphics2D g, Object wiw, Color color) - { - g.setColor(color); - - if (wiw instanceof WidgetItem) - { - WidgetItem wi = (WidgetItem) wiw; - Rectangle bounds = wi.getCanvasBounds(); - g.draw(bounds); - - String text = wi.getId() + ""; - FontMetrics fm = g.getFontMetrics(); - Rectangle2D textBounds = fm.getStringBounds(text, g); - - int textX = (int) (bounds.getX() + (bounds.getWidth() / 2) - (textBounds.getWidth() / 2)); - int textY = (int) (bounds.getY() + (bounds.getHeight() / 2) + (textBounds.getHeight() / 2)); - - g.setColor(Color.BLACK); - g.drawString(text, textX + 1, textY + 1); - g.setColor(Color.ORANGE); - g.drawString(text, textX, textY); - } - else - { - Widget w = (Widget) wiw; - g.draw(w.getBounds()); - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetItemNode.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetItemNode.java deleted file mode 100644 index 2c640c1de6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetItemNode.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2017, 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.devtools; - -import javax.swing.tree.DefaultMutableTreeNode; -import net.runelite.api.widgets.WidgetItem; - -class WidgetItemNode extends DefaultMutableTreeNode -{ - private final WidgetItem widgetItem; - - public WidgetItemNode(WidgetItem widgetItem) - { - super(widgetItem); - this.widgetItem = widgetItem; - } - - public WidgetItem getWidgetItem() - { - return widgetItem; - } - - @Override - public String toString() - { - return "I " + widgetItem.getIndex(); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetTreeNode.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetTreeNode.java deleted file mode 100644 index 6b7526637a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetTreeNode.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2017, 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.devtools; - -import javax.swing.tree.DefaultMutableTreeNode; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import static net.runelite.api.widgets.WidgetInfo.TO_CHILD; -import static net.runelite.api.widgets.WidgetInfo.TO_GROUP; - -class WidgetTreeNode extends DefaultMutableTreeNode -{ - private final String type; - - public WidgetTreeNode(String type, Widget widget) - { - super(widget); - this.type = type; - } - - public Widget getWidget() - { - return (Widget) getUserObject(); - } - - @Override - public String toString() - { - Widget widget = getWidget(); - - int id = widget.getId(); - String str = type + " " + TO_GROUP(id) + "." + TO_CHILD(id); - - if (widget.getIndex() != -1) - { - str += "[" + widget.getIndex() + "]"; - } - - WidgetInfo info = WidgetInspector.getWidgetInfo(id); - if (info != null) - { - str += " " + info.name(); - } - - return str; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WorldMapLocationOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WorldMapLocationOverlay.java deleted file mode 100644 index d777033616..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WorldMapLocationOverlay.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2018, Morgan Lewis - * 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.devtools; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FontMetrics; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.Point; -import net.runelite.api.RenderOverview; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -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.worldmap.WorldMapOverlay; - -public class WorldMapLocationOverlay extends Overlay -{ - private final Client client; - private final WorldMapOverlay worldMapOverlay; - private final DevToolsPlugin plugin; - - @Inject - private WorldMapLocationOverlay(Client client, WorldMapOverlay worldMapOverlay, DevToolsPlugin plugin) - { - this.client = client; - this.worldMapOverlay = worldMapOverlay; - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGH); - setLayer(OverlayLayer.ABOVE_MAP); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.getWorldMapLocation().isActive()) - { - return null; - } - - RenderOverview ro = client.getRenderOverview(); - Widget worldMapWidget = client.getWidget(WidgetInfo.WORLD_MAP_VIEW); - - if (ro == null || worldMapWidget == null) - { - return null; - } - - Rectangle worldMapRectangle = worldMapWidget.getBounds(); - - graphics.setClip(worldMapRectangle); - graphics.setColor(Color.CYAN); - - WorldPoint mapCenterPoint = new WorldPoint(ro.getWorldMapPosition().getX(), ro.getWorldMapPosition().getY(), 0); - Point middle = worldMapOverlay.mapWorldPointToGraphicsPoint(mapCenterPoint); - - if (middle == null) - { - return null; - } - - graphics.drawLine(middle.getX(), worldMapRectangle.y, middle.getX(), worldMapRectangle.y + worldMapRectangle.height); - graphics.drawLine(worldMapRectangle.x, middle.getY(), worldMapRectangle.x + worldMapRectangle.width, middle.getY()); - - String output = "Center: " + mapCenterPoint.getX() + ", " + mapCenterPoint.getY(); - graphics.setColor(Color.white); - FontMetrics fm = graphics.getFontMetrics(); - int height = fm.getHeight(); - int width = fm.stringWidth(output); - graphics.fillRect((int) worldMapRectangle.getX(), (int) worldMapRectangle.getY() + worldMapRectangle.height - height, (int) worldMapRectangle.getX() + width, (int) worldMapRectangle.getY() + worldMapRectangle.height); - - graphics.setColor(Color.BLACK); - graphics.drawString(output, (int) worldMapRectangle.getX(), (int) worldMapRectangle.getY() + worldMapRectangle.height); - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WorldMapRegionOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WorldMapRegionOverlay.java deleted file mode 100644 index a7c55edfbb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WorldMapRegionOverlay.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2018, Alex Kolpa - * 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.devtools; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FontMetrics; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.geom.Rectangle2D; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.Point; -import net.runelite.api.RenderOverview; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -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; - -class WorldMapRegionOverlay extends Overlay -{ - private static final Color WHITE_TRANSLUCENT = new Color(255, 255, 255, 127); - private static final int LABEL_PADDING = 4; - private static final int REGION_SIZE = 1 << 6; - // Bitmask to return first coordinate in region - @SuppressWarnings("PointlessBitwiseExpression") - private static final int REGION_TRUNCATE = ~((1 << 6) - 1); - private final Client client; - private final DevToolsPlugin plugin; - - @Inject - private WorldMapRegionOverlay(Client client, DevToolsPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGH); - setLayer(OverlayLayer.ABOVE_MAP); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.getWorldMapLocation().isActive()) - { - return null; - } - - drawRegionOverlay(graphics); - return null; - } - - private void drawRegionOverlay(Graphics2D graphics) - { - RenderOverview ro = client.getRenderOverview(); - Widget map = client.getWidget(WidgetInfo.WORLD_MAP_VIEW); - float pixelsPerTile = ro.getWorldMapZoom(); - - if (map == null) - { - return; - } - - Rectangle worldMapRect = map.getBounds(); - graphics.setClip(worldMapRect); - - int widthInTiles = (int) Math.ceil(worldMapRect.getWidth() / pixelsPerTile); - int heightInTiles = (int) Math.ceil(worldMapRect.getHeight() / pixelsPerTile); - - Point worldMapPosition = ro.getWorldMapPosition(); - - // Offset in tiles from anchor sides - int yTileMin = worldMapPosition.getY() - heightInTiles / 2; - int xRegionMin = (worldMapPosition.getX() - widthInTiles / 2) & REGION_TRUNCATE; - int xRegionMax = ((worldMapPosition.getX() + widthInTiles / 2) & REGION_TRUNCATE) + REGION_SIZE; - int yRegionMin = (yTileMin & REGION_TRUNCATE); - int yRegionMax = ((worldMapPosition.getY() + heightInTiles / 2) & REGION_TRUNCATE) + REGION_SIZE; - int regionPixelSize = (int) Math.ceil(REGION_SIZE * pixelsPerTile); - - for (int x = xRegionMin; x < xRegionMax; x += REGION_SIZE) - { - for (int y = yRegionMin; y < yRegionMax; y += REGION_SIZE) - { - graphics.setColor(WHITE_TRANSLUCENT); - - int yTileOffset = -(yTileMin - y); - int xTileOffset = x + widthInTiles / 2 - worldMapPosition.getX(); - - int xPos = ((int) (xTileOffset * pixelsPerTile)) + (int) worldMapRect.getX(); - int yPos = (worldMapRect.height - (int) (yTileOffset * pixelsPerTile)) + (int) worldMapRect.getY(); - // Offset y-position by a single region to correct for drawRect starting from the top - yPos -= regionPixelSize; - - graphics.drawRect(xPos, yPos, regionPixelSize, regionPixelSize); - - int regionId = ((x >> 6) << 8) | (y >> 6); - String regionText = String.valueOf(regionId); - FontMetrics fm = graphics.getFontMetrics(); - Rectangle2D textBounds = fm.getStringBounds(regionText, graphics); - int labelWidth = (int) textBounds.getWidth() + 2 * LABEL_PADDING; - int labelHeight = (int) textBounds.getHeight() + 2 * LABEL_PADDING; - graphics.fillRect(xPos, yPos, labelWidth, labelHeight); - graphics.setColor(Color.BLACK); - graphics.drawString(regionText, xPos + LABEL_PADDING, yPos + (int) textBounds.getHeight() + LABEL_PADDING); - } - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordAreaType.java b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordAreaType.java deleted file mode 100644 index b18169f88e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordAreaType.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2018, PandahRS - * 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.discord; - -enum DiscordAreaType -{ - BOSSES, - CITIES, - DUNGEONS, - MINIGAMES, - RAIDS -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordConfig.java deleted file mode 100644 index a2ebe63099..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordConfig.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.discord; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("discord") -public interface DiscordConfig extends Config -{ - @ConfigItem( - keyName = "actionTimeout", - name = "Action timeout (minutes)", - description = "Configures after how long of not updating status will be reset (in minutes)", - position = 0 - ) - default int actionTimeout() - { - return 5; - } - - @ConfigItem( - keyName = "hideElapsedTime", - name = "Hide elapsed time", - description = "Configures if the elapsed time of your activity should be hidden.", - position = 1 - ) - default boolean hideElapsedTime() - { - return false; - } - - @ConfigItem( - keyName = "alwaysShowParty", - name = "Always show party", - description = "Configures if the party counter should be always shown (this also makes party invites always work).", - position = 1 - ) - default boolean alwaysShowParty() - { - return false; - } - - @ConfigItem( - keyName = "showSkillActivity", - name = "Show activity while skilling", - description = "Configures if your activity while training skills should be shown.", - position = 3 - ) - default boolean showSkillingActivity() - { - return true; - } - - @ConfigItem( - keyName = "showBossActivity", - name = "Show activity at bosses", - description = "Configures if your activity at bosses should be shown.", - position = 4 - ) - default boolean showBossActivity() - { - return true; - } - - @ConfigItem( - keyName = "showCityActivity", - name = "Show activity at cities", - description = "Configures if your activity at cities should be shown.", - position = 5 - ) - default boolean showCityActivity() - { - return true; - } - - @ConfigItem( - keyName = "showDungeonActivity", - name = "Show activity at dungeons", - description = "Configures if your activity at dungeons should be shown.", - position = 6 - ) - default boolean showDungeonActivity() - { - return true; - } - - @ConfigItem( - keyName = "showMinigameActivity", - name = "Show activity at minigames", - description = "Configures if your activity at minigames should be shown.", - position = 7 - ) - default boolean showMinigameActivity() - { - return true; - } - - @ConfigItem( - keyName = "showRaidingActivity", - name = "Show activity at raids", - description = "Configures if your activity at raids should be shown.", - position = 8 - ) - default boolean showRaidingActivity() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordGameEventType.java b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordGameEventType.java deleted file mode 100644 index 981b83b154..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordGameEventType.java +++ /dev/null @@ -1,433 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * Copyright (c) 2018, PandahRS - * 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.discord; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import java.util.List; -import java.util.Map; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.Skill; -import net.runelite.api.Varbits; - -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -enum DiscordGameEventType -{ - - IN_GAME("In Game", -3), - IN_MENU("In Menu", -3), - TRAINING_ATTACK(Skill.ATTACK), - TRAINING_DEFENCE(Skill.DEFENCE), - TRAINING_STRENGTH(Skill.STRENGTH), - TRAINING_HITPOINTS(Skill.HITPOINTS, -1), - TRAINING_SLAYER(Skill.SLAYER, 1), - TRAINING_RANGED(Skill.RANGED), - TRAINING_MAGIC(Skill.MAGIC), - TRAINING_PRAYER(Skill.PRAYER), - TRAINING_COOKING(Skill.COOKING), - TRAINING_WOODCUTTING(Skill.WOODCUTTING), - TRAINING_FLETCHING(Skill.FLETCHING), - TRAINING_FISHING(Skill.FISHING, 1), - TRAINING_FIREMAKING(Skill.FIREMAKING), - TRAINING_CRAFTING(Skill.CRAFTING), - TRAINING_SMITHING(Skill.SMITHING), - TRAINING_MINING(Skill.MINING), - TRAINING_HERBLORE(Skill.HERBLORE), - TRAINING_AGILITY(Skill.AGILITY), - TRAINING_THIEVING(Skill.THIEVING), - TRAINING_FARMING(Skill.FARMING), - TRAINING_RUNECRAFT(Skill.RUNECRAFT), - TRAINING_HUNTER(Skill.HUNTER), - TRAINING_CONSTRUCTION(Skill.CONSTRUCTION), - - // Bosses - BOSS_ABYSSAL_SIRE("Abyssal Sire", DiscordAreaType.BOSSES, 11851, 11850, 12363, 12362), - BOSS_CERBERUS("Cerberus", DiscordAreaType.BOSSES, 4883, 5140, 5395), - BOSS_COMMANDER_ZILYANA("Commander Zilyana", DiscordAreaType.BOSSES, 11602), - BOSS_DKS("Dagannoth Kings", DiscordAreaType.BOSSES, 11588, 11589), - BOSS_GENERAL_GRAARDOR("General Graardor", DiscordAreaType.BOSSES, 11347), - BOSS_GIANT_MOLE("Giant Mole", DiscordAreaType.BOSSES, 6993, 6992), - BOSS_GROTESQUE_GUARDIANS("Grotesque Guardians", DiscordAreaType.BOSSES, 6727), - BOSS_HYDRA("Alchemical Hydra", DiscordAreaType.BOSSES, 5536), - BOSS_KQ("Kalphite Queen", DiscordAreaType.BOSSES, 13972), - BOSS_KRAKEN("Kraken", DiscordAreaType.BOSSES, 9116), - BOSS_KREEARRA("Kree'arra", DiscordAreaType.BOSSES, 11346), - BOSS_KRIL_TSUTSAROTH("K'ril Tsutsaroth", DiscordAreaType.BOSSES, 11603), - BOSS_SKOTIZO("Skotizo", DiscordAreaType.BOSSES, 6810), - BOSS_SMOKE_DEVIL("Thermonuclear smoke devil", DiscordAreaType.BOSSES, 9363, 9619), - BOSS_VORKATH("Vorkath", DiscordAreaType.BOSSES, 9023), - BOSS_WINTERTODT("Wintertodt", DiscordAreaType.BOSSES, 6462), - BOSS_ZALCANO("Zalcano", DiscordAreaType.BOSSES, 13250), - BOSS_ZULRAH("Zulrah", DiscordAreaType.BOSSES, 9007), - - // Cities - CITY_AL_KHARID("Al Kharid", DiscordAreaType.CITIES, 13105, 13106), - CITY_APE_ATOLL("Ape Atoll", DiscordAreaType.CITIES, 10795, 11051, 10974, 11050), - CITY_ARCEUUS_HOUSE("Arceuus", DiscordAreaType.CITIES, 6459, 6715, 6458, 6714), - CITY_ARDOUGNE("Ardougne", DiscordAreaType.CITIES, 10548, 10547, 10292, 10291, 10036, 10035, 9780, 9779), - CITY_BARBARIAN_VILLAGE("Barbarian Village", DiscordAreaType.CITIES, 12341), - CITY_BANDIT_CAMP("Bandit Camp", DiscordAreaType.CITIES, 12591), - CITY_BEDABIN_CAMP("Bedabin Camp", DiscordAreaType.CITIES, 12590), - CITY_BRIMHAVEN("Brimhaven", DiscordAreaType.CITIES, 11057, 11058), - CITY_BURGH_DE_ROTT("Burgh de Rott", DiscordAreaType.CITIES, 13874, 13873, 14130, 14129), - CITY_BURTHORPE("Burthorpe", DiscordAreaType.CITIES, 11319, 11575), - CITY_CANIFIS("Canifis", DiscordAreaType.CITIES, 13878), - CITY_CATHERBY("Catherby", DiscordAreaType.CITIES, 11317, 11318, 11061), - CITY_CORSAIR_CAVE("Corsair Cove", DiscordAreaType.CITIES, 10028, 10284), - CITY_DORGESH_KAAN("Dorgesh-Kaan", DiscordAreaType.CITIES, 10835, 10834), - CITY_DRAYNOR("Draynor", DiscordAreaType.CITIES, 12338), - CITY_EDGEVILLE("Edgeville", DiscordAreaType.CITIES, 12342), - CITY_ENTRANA("Entrana", DiscordAreaType.CITIES, 11060, 11316), - CITY_FALADOR("Falador", DiscordAreaType.CITIES, 11828, 11572, 11571, 11827, 12084), - CITY_GOBLIN_VILLAGE("Goblin Village", DiscordAreaType.CITIES, 11830), - CITY_GUTANOTH("Gu'Tanoth", DiscordAreaType.CITIES, 10031), - CITY_GWENITH("Gwenith", DiscordAreaType.CITIES, 8501, 8757, 9013), - CITY_HOSIDIUS_HOUSE("Hosidius", DiscordAreaType.CITIES, 6713, 6712, 6455, 6711, 6710, 6965, 6966, 7222, 7223, 6967), - CITY_JATISZO("Jatizso", DiscordAreaType.CITIES, 9531), - CITY_JIGGIG("Jiggig", DiscordAreaType.CITIES, 9775), - CITY_KARAMJA("Karamja", DiscordAreaType.CITIES, 11569, 11568, 11567, 11566, 11313, 11312, 11311), - CITY_KELDAGRIM("Keldagrim", DiscordAreaType.CITIES, 11423, 11422, 11679, 11678), - CITY_LLETYA("Lletya", DiscordAreaType.CITIES, 9265), - CITY_LOVAKENGJ_HOUSE("Lovakengj", DiscordAreaType.CITIES, 5692, 5948, 5691, 5947, 6203, 6202, 5690, 5946), - CITY_LUMBRIDGE("Lumbridge", DiscordAreaType.CITIES, 12850), - CITY_LUNAR_ISLE("Lunar Isle", DiscordAreaType.CITIES, 8253, 8252, 8509, 8508), - CITY_MEIYERDITCH("Meiyerditch", DiscordAreaType.CITIES, 14132, 14388, 14387, 14386, 14385), - CITY_MISCELLANIA("Miscellania", DiscordAreaType.CITIES, 10044, 10300), - CITY_MOS_LE_HARMLESS("Mos Le'Harmless", DiscordAreaType.CITIES, 14638), - CITY_MORTTON("Mort'ton", DiscordAreaType.CITIES, 13875), - CITY_MOR_UI_REK("Mor UI Rek", DiscordAreaType.CITIES, 9808, 9807, 10064, 10063), - CITY_MOUNT_KARUULM("Mount Karuulm", DiscordAreaType.CITIES, 5179, 4923, 5180), - CITY_NARDAH("Nardah", DiscordAreaType.CITIES, 13613), - CITY_NEITIZNOT("Neitiznot", DiscordAreaType.CITIES, 9275), - CITY_PISCATORIS("Piscatoris", DiscordAreaType.CITIES, 9273), - CITY_POLLNIVNEACH("Pollnivneach", DiscordAreaType.CITIES, 13358), - CITY_PORT_KHAZARD("Port Khazard", DiscordAreaType.CITIES, 10545), - CITY_PORT_PHASMATYS("Port Phasmatys", DiscordAreaType.CITIES, 14646), - CITY_PORT_SARIM("Port Sarim", DiscordAreaType.CITIES, 12082), - CITY_PISCARILIUS_HOUSE("Port Piscarilius", DiscordAreaType.CITIES, 6971, 7227, 6970, 7226), - CITY_PRIFDDINAS("Prifddinas", DiscordAreaType.CITIES, 12894, 12895, 13150, 13151), - CITY_RELLEKKA("Rellekka", DiscordAreaType.CITIES, 10553), - CITY_RIMMINGTON("Rimmington", DiscordAreaType.CITIES, 11826, 11570), - CITY_SEERS_VILLAGE("Seers' Village", DiscordAreaType.CITIES, 10806), - CITY_SHAYZIEN_HOUSE("Shayzien", DiscordAreaType.CITIES, 5944, 5943, 6200, 6199, 5688), - CITY_SHILO_VILLAGE("Shilo Village", DiscordAreaType.CITIES, 11310), - CITY_SOPHANEM("Sophanem", DiscordAreaType.CITIES, 13099), - CITY_TAI_BWO_WANNAI("Tai Bwo Wannai", DiscordAreaType.CITIES, 11056, 11055), - CITY_TAVERLEY("Taverley", DiscordAreaType.CITIES, 11574, 11573), - CITY_TREE_GNOME_STRONGHOLD("Tree Gnome Stronghold", DiscordAreaType.CITIES, 9782, 9781), - CITY_TREE_GNOME_VILLAGE("Tree Gnome Village", DiscordAreaType.CITIES, 10033), - CITY_TROLL_STRONGHOLD("Troll Stronghold", DiscordAreaType.CITIES, 11321), - CITY_TYRAS_CAMP("Tyras Camp", DiscordAreaType.CITIES, 8753, 8752), - CITY_UZER("Uzer", DiscordAreaType.CITIES, 13872), - CITY_VARROCK("Varrock", DiscordAreaType.CITIES, 12596, 12597, 12598, 12852, 12853, 12854, 13108, 13109, 13110), - CITY_WITCHHAVEN("Witchaven", DiscordAreaType.CITIES, 10803), - CITY_WOODCUTTING_GUILD("Woodcutting Guild", DiscordAreaType.CITIES, 6454, 6198, 6298), - CITY_YANILLE("Yanille", DiscordAreaType.CITIES, 10288, 10032), - CITY_ZANARIS("Zanaris", DiscordAreaType.CITIES, 9285, 9541, 9540, 9797), - CITY_ZULANDRA("Zul-Andra", DiscordAreaType.CITIES, 8751), - - // Dungeons - DUNGEON_ABANDONED_MINE("Abandoned Mine", DiscordAreaType.DUNGEONS, 13718, 11079, 11078, 11077, 10823, 10822, 10821), - DUNGEON_AH_ZA_RHOON("Ah Za Rhoon", DiscordAreaType.DUNGEONS, 11666), - DUNGEON_ANCIENT_CAVERN("Ancient Cavern", DiscordAreaType.DUNGEONS, 6483, 6995), - DUNGEON_APE_ATOLL("Ape Atoll Dungeon", DiscordAreaType.DUNGEONS, 11150, 10894), - DUNGEON_ARDY_SEWERS("Ardougne Sewers", DiscordAreaType.DUNGEONS, 10136), - DUNGEON_ASGARNIAN_ICE_CAVES("Asgarnian Ice Caves", DiscordAreaType.DUNGEONS, 12181), - DUNGEON_BRIMHAVEN("Brimhaven Dungeon", DiscordAreaType.DUNGEONS, 10901, 10900, 10899, 10645, 10644, 10643), - DUNGEON_BRINE_RAT_CAVERN("Brine Rat Cavern", DiscordAreaType.DUNGEONS, 10910), - DUNGEON_CATACOMBS_OF_KOUREND("Catacombs of Kourend", DiscordAreaType.DUNGEONS, 6557, 6556, 6813, 6812), - DUNGEON_CHASM_OF_FIRE("Chasm of Fire", DiscordAreaType.DUNGEONS, 5789), - DUNGEON_CLOCK_TOWER("Clock Tower Basement", DiscordAreaType.DUNGEONS, 10390), - DUNGEON_CORSAIR_COVE("Corsair Cove Dungeon", DiscordAreaType.DUNGEONS, 8076, 8332), - DUNGEON_CRABCLAW_CAVES("Crabclaw Caves", DiscordAreaType.DUNGEONS, 6553, 6809), - DUNGEON_DIGSITE("Digsite Dungeon", DiscordAreaType.DUNGEONS, 13465), - DUNGEON_DORGESHKAAN("Dorgesh-Kaan South Dungeon", DiscordAreaType.DUNGEONS, 10833), - DUNGEON_DORGESHUUN_MINES("Dorgeshuun Mines", DiscordAreaType.DUNGEONS, 12950, 13206), - DUNGEON_DRAYNOR_SEWERS("Draynor Sewers", DiscordAreaType.DUNGEONS, 12439, 12438), - DUNGEON_DWARVEN_MINES("Dwarven Mines", DiscordAreaType.DUNGEONS, 12185, 12184, 12183), - DUNGEON_EAGLES_PEAK("Eagles' Peak Dungeon", DiscordAreaType.DUNGEONS, 8013), - DUNGEON_EDGEVILLE("Edgeville Dungeon", DiscordAreaType.DUNGEONS, 12441, 12442, 12443, 12698), - DUNGEON_ELEMENTAL_WORKSHOP("Elemental Workshop", DiscordAreaType.DUNGEONS, 10906, 7760), - DUNGEON_ENAKHRAS_TEMPLE("Enakhra's Temple", DiscordAreaType.DUNGEONS, 12423), - DUNGEON_ENTRANA("Entrana Dungeon", DiscordAreaType.DUNGEONS, 11416), - DUNGEON_EVIL_CHICKENS_LAIR("Evil Chicken's Lair", DiscordAreaType.DUNGEONS, 9796), - DUNGEON_EXPERIMENT_CAVE("Experiment Cave", DiscordAreaType.DUNGEONS, 14235, 13979), - DUNGEON_FREMENNIK_SLAYER("Fremennik Slayer Dungeon", DiscordAreaType.DUNGEONS, 10908, 11164), - DUNGEON_GOBLIN_CAVE("Goblin Cave", DiscordAreaType.DUNGEONS, 10393), - DUNGEON_GRAND_TREE_TUNNELS("Grand Tree Tunnels", DiscordAreaType.DUNGEONS, 9882), - DUNGEON_HAM("H.A.M Dungeon", DiscordAreaType.DUNGEONS, 12694, 10321), - DUNGEON_IORWERTH("Iorwerth Dungeon", DiscordAreaType.DUNGEONS, 12738, 12993, 12994), - DUNGEON_JATIZSO_MINES("Jatizso Mines", DiscordAreaType.DUNGEONS, 9631), - DUNGEON_JIGGIG_BURIAL_TOMB("Jiggig Burial Tomb", DiscordAreaType.DUNGEONS, 9875, 9874), - DUNGEON_JOGRE("Jogre Dungeon", DiscordAreaType.DUNGEONS, 11412), - DUNGEON_KARAMJA_VOLCANO("Karamja Volcano", DiscordAreaType.DUNGEONS, 11413, 11414), - DUNGEON_KARUULM("Karuulm Slayer Dungeon", DiscordAreaType.DUNGEONS, 5280, 5279, 5023, 5535, 5022, 4766, 4510, 4511, 4767, 4768, 4512), - DUNGEON_KHARAZI("Khazari Dungeon", DiscordAreaType.DUNGEONS, 11153), - DUNGEON_LIGHTHOUSE("Lighthouse", DiscordAreaType.DUNGEONS, 10140), - DUNGEON_LIZARDMAN_CAVES("Lizardman Caves", DiscordAreaType.DUNGEONS, 5275), - DUNGEON_LUMBRIDGE_SWAMP_CAVES("Lumbridge Swamp Caves", DiscordAreaType.DUNGEONS, 12693, 12949), - DUNGEON_LUNAR_ISLE_MINE("Lunar Isle Mine", DiscordAreaType.DUNGEONS, 9377), - DUNGEON_MISCELLANIA("Miscellania Dungeon", DiscordAreaType.DUNGEONS, 10144, 10400), - DUNGEON_MOGRE_CAMP("Mogre Camp", DiscordAreaType.DUNGEONS, 11924), - DUNGEON_MOS_LE_HARMLESS_CAVES("Mos Le'Harmless Caves", DiscordAreaType.DUNGEONS, 14994, 14995, 15251), - DUNGEON_MOUSE_HOLE("Mouse Hole", DiscordAreaType.DUNGEONS, 9046), - DUNGEON_OBSERVATORY("Observatory Dungeon", DiscordAreaType.DUNGEONS, 9362), - DUNGEON_OGRE_ENCLAVE("Ogre Enclave", DiscordAreaType.DUNGEONS, 10387), - DUNGEON_QUIDAMORTEM_CAVE("Quidamortem Cave", DiscordAreaType.DUNGEONS, 4763), - DUNGEON_RASHILIYIAS_TOMB("Rashiliyta's Tomb", DiscordAreaType.DUNGEONS, 11668), - DUNGEON_SARADOMINSHRINE("Saradomin Shrine (Paterdomus)", DiscordAreaType.DUNGEONS, 13722), - DUNGEON_SHADE_CATACOMBS("Shade Catacombs", DiscordAreaType.DUNGEONS, 13975), - DUNGEON_SHAYZIEN_CRYPTS("Shayzien Crypts", DiscordAreaType.DUNGEONS, 6043), - DUNGEON_SMOKE("Smoke Dungeon", DiscordAreaType.DUNGEONS, 12946, 13202), - DUNGEON_SOPHANEM("Sophanem Dungeon", DiscordAreaType.DUNGEONS, 13200), - DUNGEON_STRONGHOLD_SECURITY("Stronghold of Security", DiscordAreaType.DUNGEONS, 7505, 8017, 8530, 9297), - DUNGEON_TARNS_LAIR("Tarn's Lair", DiscordAreaType.DUNGEONS, 12616, 12615), - DUNGEON_TAVERLEY("Taverley Dungeon", DiscordAreaType.DUNGEONS, 11673, 11672, 11929, 11928, 11417), - DUNGEON_TEMPLE_OF_IKOV("Temple of Ikov", DiscordAreaType.DUNGEONS, 10649, 10905, 10650), - DUNGEON_TEMPLE_OF_MARIMBO("Temple of Marimbo", DiscordAreaType.DUNGEONS, 11151), - DUNGEON_THE_WARRENS("The Warrens", DiscordAreaType.DUNGEONS, 7070, 7326), - DUNGEON_TOLNA("Dungeon of Tolna", DiscordAreaType.DUNGEONS, 13209), - DUNGEON_TOWER_OF_LIFE("Tower of Life Basement", DiscordAreaType.DUNGEONS, 12100), - DUNGEON_TRAHAEARN_MINE("Trahaearn Mine", DiscordAreaType.DUNGEONS, 13249), - DUNGEON_TUNNEL_OF_CHAOS("Tunnel of Chaos", DiscordAreaType.DUNGEONS, 12625), - DUNGEON_UNDERGROUND_PASS("Underground Pass", DiscordAreaType.DUNGEONS, 9369, 9370), - DUNGEON_VARROCKSEWERS("Varrock Sewers", DiscordAreaType.DUNGEONS, 12954, 13210), - DUNGEON_WATER_RAVINE("Water Ravine", DiscordAreaType.DUNGEONS, 13461), - DUNGEON_WATERBIRTH("Waterbirth Dungeon", DiscordAreaType.DUNGEONS, 9886, 10142, 7492, 7748), - DUNGEON_WATERFALL("Waterfall Dungeon", DiscordAreaType.DUNGEONS, 10394), - DUNGEON_WHITE_WOLF_MOUNTAIN_CAVES("White Wolf Mountain Caves", DiscordAreaType.DUNGEONS, 11418, 11419, 11675), - DUNGEON_WITCHAVEN_SHRINE("Witchhaven Shrine Dungeon", DiscordAreaType.DUNGEONS, 10903), - DUNGEON_YANILLE_AGILITY("Yanille Agility Dungeon", DiscordAreaType.DUNGEONS, 10388), - DUNGEON_MOTHERLODE_MINE("Motherlode Mine", DiscordAreaType.DUNGEONS, 14679, 14680, 14681, 14935, 14936, 14937, 15191, 15192, 15193), - - // Minigames - MG_BARBARIAN_ASSAULT("Barbarian Assault", DiscordAreaType.MINIGAMES, 10332), - MG_BARROWS("Barrows", DiscordAreaType.MINIGAMES, 14131, 14231), - MG_BLAST_FURNACE("Blast Furnace", DiscordAreaType.MINIGAMES, 7757), - MG_BRIMHAVEN_AGILITY_ARENA("Brimhaven Agility Arena", DiscordAreaType.MINIGAMES, 11157), - MG_BURTHORPE_GAMES_ROOM("Burthorpe Games Room", DiscordAreaType.MINIGAMES, 8781), - MG_CASTLE_WARS("Castle Wars", DiscordAreaType.MINIGAMES, 9520), - MG_CLAN_WARS("Clan Wars", DiscordAreaType.MINIGAMES, 13135, 13134, 13133, 13131, 13130, 13387, 13386), - MG_DUEL_ARENA("Duel Arena", DiscordAreaType.MINIGAMES, 13362), - MG_FISHING_TRAWLER("Fishing Trawler", DiscordAreaType.MINIGAMES, 7499), - MG_GAUNTLET("Gauntlet", DiscordAreaType.MINIGAMES, 12995), - MG_INFERNO("The Inferno", DiscordAreaType.MINIGAMES, 9043), - MG_LAST_MAN_STANDING("Last Man Standing", DiscordAreaType.MINIGAMES, 13660, 13659, 13658, 13916, 13915, 13914), - MG_MAGE_TRAINING_ARENA("Mage Training Arena", DiscordAreaType.MINIGAMES, 13462, 13463), - MG_NIGHTMARE_ZONE("Nightmare Zone", DiscordAreaType.MINIGAMES, 9033), - MG_PEST_CONTROL("Pest Control", DiscordAreaType.MINIGAMES, 10536), - MG_PYRAMID_PLUNDER("Pyramid Plunder", DiscordAreaType.MINIGAMES, 7749), - MG_ROGUES_DEN("Rogues' Den", DiscordAreaType.MINIGAMES, 11855, 11854, 12111, 12110), - MG_SORCERESS_GARDEN("Sorceress's Garden", DiscordAreaType.MINIGAMES, 11605), - MG_TEMPLE_TREKKING("Temple Trekking", DiscordAreaType.MINIGAMES, 8014, 8270, 8256, 8782, 9038, 9294, 9550, 9806), - MG_TITHE_FARM("Tithe Farm", DiscordAreaType.MINIGAMES, 6968), - MG_TROUBLE_BREWING("Trouble Brewing", DiscordAreaType.MINIGAMES, 15150), - MG_TZHAAR_FIGHT_CAVES("Tzhaar Fight Caves", DiscordAreaType.MINIGAMES, 9551), - MG_TZHAAR_FIGHT_PITS("Tzhaar Fight Pits", DiscordAreaType.MINIGAMES, 9552), - MG_VOLCANIC_MINE("Volcanic Mine", DiscordAreaType.MINIGAMES, 15263, 15262), - - // Raids - RAIDS_CHAMBERS_OF_XERIC("Chambers of Xeric", DiscordAreaType.RAIDS, Varbits.IN_RAID), - RAIDS_THEATRE_OF_BLOOD("Theatre of Blood", DiscordAreaType.RAIDS, Varbits.THEATRE_OF_BLOOD); - - private static final Map FROM_REGION; - private static final List FROM_VARBITS; - - static - { - ImmutableMap.Builder regionMapBuilder = new ImmutableMap.Builder<>(); - ImmutableList.Builder fromVarbitsBuilder = ImmutableList.builder(); - for (DiscordGameEventType discordGameEventType : DiscordGameEventType.values()) - { - if (discordGameEventType.getVarbits() != null) - { - fromVarbitsBuilder.add(discordGameEventType); - continue; - } - - if (discordGameEventType.getRegionIds() == null) - { - continue; - } - - for (int region : discordGameEventType.getRegionIds()) - { - regionMapBuilder.put(region, discordGameEventType); - } - } - FROM_REGION = regionMapBuilder.build(); - FROM_VARBITS = fromVarbitsBuilder.build(); - } - - private String imageKey; - private String state; - private String details; - private int priority; - private boolean shouldClear; - private boolean shouldTimeout; - - private DiscordAreaType discordAreaType; - private Varbits varbits; - private int[] regionIds; - - DiscordGameEventType(Skill skill) - { - this(skill, 0); - } - - DiscordGameEventType(Skill skill, int priority) - { - this.details = training(skill); - this.priority = priority; - this.imageKey = imageKeyOf(skill); - this.shouldTimeout = true; - } - - DiscordGameEventType(String areaName, DiscordAreaType areaType, int... regionIds) - { - this.state = exploring(areaType, areaName); - this.priority = -2; - this.discordAreaType = areaType; - this.regionIds = regionIds; - this.shouldClear = true; - } - - DiscordGameEventType(String state, int priority) - { - this.state = state; - this.priority = priority; - this.shouldClear = true; - } - - DiscordGameEventType(String areaName, DiscordAreaType areaType, Varbits varbits) - { - this.state = exploring(areaType, areaName); - this.priority = -2; - this.discordAreaType = areaType; - this.varbits = varbits; - this.shouldClear = true; - } - - private static String training(final Skill skill) - { - return training(skill.getName()); - } - - private static String training(final String what) - { - return "Training: " + what; - } - - private static String imageKeyOf(final Skill skill) - { - return imageKeyOf(skill.getName().toLowerCase()); - } - - private static String imageKeyOf(final String what) - { - return "icon_" + what; - } - - private static String exploring(DiscordAreaType areaType, String areaName) - { - return areaName; - } - - public static DiscordGameEventType fromSkill(final Skill skill) - { - switch (skill) - { - case ATTACK: - return TRAINING_ATTACK; - case DEFENCE: - return TRAINING_DEFENCE; - case STRENGTH: - return TRAINING_STRENGTH; - case RANGED: - return TRAINING_RANGED; - case PRAYER: - return TRAINING_PRAYER; - case MAGIC: - return TRAINING_MAGIC; - case COOKING: - return TRAINING_COOKING; - case WOODCUTTING: - return TRAINING_WOODCUTTING; - case FLETCHING: - return TRAINING_FLETCHING; - case FISHING: - return TRAINING_FISHING; - case FIREMAKING: - return TRAINING_FIREMAKING; - case CRAFTING: - return TRAINING_CRAFTING; - case SMITHING: - return TRAINING_SMITHING; - case MINING: - return TRAINING_MINING; - case HERBLORE: - return TRAINING_HERBLORE; - case AGILITY: - return TRAINING_AGILITY; - case THIEVING: - return TRAINING_THIEVING; - case SLAYER: - return TRAINING_SLAYER; - case FARMING: - return TRAINING_FARMING; - case RUNECRAFT: - return TRAINING_RUNECRAFT; - case HUNTER: - return TRAINING_HUNTER; - case CONSTRUCTION: - return TRAINING_CONSTRUCTION; - default: - return null; - } - } - - public static DiscordGameEventType fromRegion(final int regionId) - { - return FROM_REGION.get(regionId); - } - - public static DiscordGameEventType fromVarbit(final Client client) - { - for (DiscordGameEventType fromVarbit : FROM_VARBITS) - { - if (client.getVar(fromVarbit.getVarbits()) != 0) - { - return fromVarbit; - } - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java deleted file mode 100644 index caecbaffc1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java +++ /dev/null @@ -1,463 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * Copyright (c) 2018, PandahRS - * 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.discord; - -import com.google.common.base.Strings; -import com.google.inject.Inject; -import com.google.inject.Provides; -import com.google.inject.Singleton; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.io.InputStream; -import java.time.temporal.ChronoUnit; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; -import javax.imageio.ImageIO; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.Skill; -import net.runelite.api.WorldType; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.StatChanged; -import net.runelite.api.events.VarbitChanged; -import net.runelite.client.RuneLiteProperties; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.discord.DiscordService; -import net.runelite.client.discord.events.DiscordJoinGame; -import net.runelite.client.discord.events.DiscordJoinRequest; -import net.runelite.client.discord.events.DiscordReady; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.events.PartyChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.task.Schedule; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.LinkBrowser; -import net.runelite.client.ws.PartyMember; -import net.runelite.client.ws.PartyService; -import net.runelite.client.ws.WSClient; -import net.runelite.http.api.RuneLiteAPI; -import net.runelite.http.api.ws.messages.party.UserJoin; -import net.runelite.http.api.ws.messages.party.UserPart; -import net.runelite.http.api.ws.messages.party.UserSync; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Request; -import okhttp3.Response; -import org.jetbrains.annotations.NotNull; - -@PluginDescriptor( - name = "Discord", - description = "Show your status and activity in the Discord user panel", - tags = {"action", "activity", "external", "integration", "status"}, - type = PluginType.MISCELLANEOUS -) -@Slf4j -@Singleton -public class DiscordPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private DiscordConfig config; - - @Inject - private ClientToolbar clientToolbar; - - @Inject - private DiscordState discordState; - - @Inject - private PartyService partyService; - - @Inject - private DiscordService discordService; - - @Inject - private WSClient wsClient; - - private final Map skillExp = new HashMap<>(); - private NavigationButton discordButton; - private boolean loginFlag; - - @Getter(AccessLevel.PACKAGE) - private int actionTimeout; - @Getter(AccessLevel.PACKAGE) - private boolean hideElapsedTime; - @Getter(AccessLevel.PACKAGE) - private boolean alwaysShowParty; - private boolean showSkillingActivity; - private boolean showBossActivity; - private boolean showCityActivity; - private boolean showDungeonActivity; - private boolean showMinigameActivity; - private boolean showRaidingActivity; - - @Provides - private DiscordConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(DiscordConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "discord.png"); - - discordButton = NavigationButton.builder() - .tab(false) - .tooltip("Join Discord") - .icon(icon) - .onClick(() -> LinkBrowser.browse(RuneLiteProperties.getDiscordInvite())) - .build(); - - clientToolbar.addNavigation(discordButton); - checkForGameStateUpdate(); - checkForAreaUpdate(); - - if (discordService.getCurrentUser() != null) - { - partyService.setUsername(discordService.getCurrentUser().username + "#" + discordService.getCurrentUser().discriminator); - } - wsClient.unregisterMessage(DiscordUserInfo.class); - wsClient.registerMessage(DiscordUserInfo.class); - } - - @Override - protected void shutDown() - { - clientToolbar.removeNavigation(discordButton); - discordState.reset(); - partyService.changeParty(null); - wsClient.unregisterMessage(DiscordUserInfo.class); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - switch (event.getGameState()) - { - case LOGIN_SCREEN: - checkForGameStateUpdate(); - return; - case LOGGING_IN: - loginFlag = true; - break; - case LOGGED_IN: - if (loginFlag) - { - loginFlag = false; - checkForGameStateUpdate(); - } - - break; - } - - checkForAreaUpdate(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equalsIgnoreCase("discord")) - { - updateConfig(); - - checkForGameStateUpdate(); - checkForAreaUpdate(); - updatePresence(); - } - } - - @Subscribe - private void onStatChanged(StatChanged statChanged) - { - final Skill skill = statChanged.getSkill(); - final int exp = statChanged.getXp(); - final Integer previous = skillExp.put(skill, exp); - - if (previous == null || previous >= exp) - { - return; - } - - final DiscordGameEventType discordGameEventType = DiscordGameEventType.fromSkill(skill); - - if (discordGameEventType != null && this.showSkillingActivity) - { - discordState.triggerEvent(discordGameEventType); - } - } - - @Subscribe - private void onVarbitChanged(VarbitChanged event) - { - if (!this.showRaidingActivity) - { - return; - } - - final DiscordGameEventType discordGameEventType = DiscordGameEventType.fromVarbit(client); - - if (discordGameEventType != null) - { - discordState.triggerEvent(discordGameEventType); - } - } - - @Subscribe - private void onDiscordReady(DiscordReady event) - { - partyService.setUsername(event.getUsername() + "#" + event.getDiscriminator()); - } - - @Subscribe - private void onDiscordJoinRequest(DiscordJoinRequest request) - { - log.debug("Got discord join request {}", request); - if (partyService.isOwner() && partyService.getMembers().isEmpty()) - { - // First join, join also yourself - partyService.changeParty(partyService.getLocalPartyId()); - updatePresence(); - } - } - - @Subscribe - private void onDiscordJoinGame(DiscordJoinGame joinGame) - { - log.debug("Got discord join game {}", joinGame); - UUID partyId = UUID.fromString(joinGame.getJoinSecret()); - partyService.changeParty(partyId); - updatePresence(); - } - - @Subscribe - private void onDiscordUserInfo(final DiscordUserInfo event) - { - final PartyMember memberById = partyService.getMemberById(event.getMemberId()); - - if (memberById == null || memberById.getAvatar() != null) - { - return; - } - - String url = "https://cdn.discordapp.com/avatars/" + event.getUserId() + "/" + event.getAvatarId() + ".png"; - - if (Strings.isNullOrEmpty(event.getAvatarId())) - { - final String[] split = memberById.getName().split("#", 2); - - if (split.length == 2) - { - int disc = Integer.parseInt(split[1]); - int avatarId = disc % 5; - url = "https://cdn.discordapp.com/embed/avatars/" + avatarId + ".png"; - } - } - - log.debug("Got user avatar {}", url); - - final Request request = new Request.Builder() - .url(url) - .build(); - - RuneLiteAPI.CLIENT.newCall(request).enqueue(new Callback() - { - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) - { - - } - - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException - { - //noinspection TryFinallyCanBeTryWithResources - try - { - if (!response.isSuccessful()) - { - throw new IOException("Unexpected code " + response); - } - - final InputStream inputStream = response.body().byteStream(); - final BufferedImage image = ImageIO.read(inputStream); - memberById.setAvatar(image); - } - finally - { - response.close(); - } - } - }); - } - - @Subscribe - private void onUserJoin(final UserJoin event) - { - updatePresence(); - } - - @Subscribe - private void onUserSync(final UserSync event) - { - final PartyMember localMember = partyService.getLocalMember(); - - if (localMember != null && discordService.getCurrentUser() != null) - { - final DiscordUserInfo userInfo = new DiscordUserInfo( - discordService.getCurrentUser().userId, - discordService.getCurrentUser().avatar); - - userInfo.setMemberId(localMember.getMemberId()); - wsClient.send(userInfo); - } - } - - @Subscribe - private void onUserPart(final UserPart event) - { - updatePresence(); - } - - @Subscribe - private void onPartyChanged(final PartyChanged event) - { - updatePresence(); - } - - @Schedule( - period = 1, - unit = ChronoUnit.MINUTES - ) - public void checkForValidStatus() - { - discordState.checkForTimeout(); - } - - private void updatePresence() - { - discordState.refresh(); - } - - private void checkForGameStateUpdate() - { - // Game state update does also full reset of discord state - discordState.reset(); - discordState.triggerEvent(client.getGameState() == GameState.LOGGED_IN - ? DiscordGameEventType.IN_GAME - : DiscordGameEventType.IN_MENU); - } - - private void checkForAreaUpdate() - { - if (client.getLocalPlayer() == null) - { - return; - } - - final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, client.getLocalPlayer().getLocalLocation()); - final int playerRegionID = worldPoint == null ? 0 : worldPoint.getRegionID(); - - if (playerRegionID == 0) - { - return; - } - - final DiscordGameEventType discordGameEventType = DiscordGameEventType.fromRegion(playerRegionID); - - if (discordGameEventType == null) - { - // Unknown region, reset to default in-game - discordState.triggerEvent(DiscordGameEventType.IN_GAME); - return; - } - - if (!showArea(discordGameEventType)) - { - return; - } - - discordState.triggerEvent(discordGameEventType); - } - - private boolean showArea(final DiscordGameEventType event) - { - if (event == null) - { - return false; - } - - final EnumSet worldType = client.getWorldType(); - - // Do not show location in PVP activities - if (WorldType.isPvpWorld(worldType)) - { - return false; - } - - switch (event.getDiscordAreaType()) - { - case BOSSES: - return this.showBossActivity; - case CITIES: - return this.showCityActivity; - case DUNGEONS: - return this.showDungeonActivity; - case MINIGAMES: - return this.showMinigameActivity; - } - - return false; - } - - private void updateConfig() - { - this.actionTimeout = config.actionTimeout(); - this.hideElapsedTime = config.hideElapsedTime(); - this.alwaysShowParty = config.alwaysShowParty(); - this.showSkillingActivity = config.showSkillingActivity(); - this.showBossActivity = config.showBossActivity(); - this.showCityActivity = config.showCityActivity(); - this.showDungeonActivity = config.showDungeonActivity(); - this.showMinigameActivity = config.showMinigameActivity(); - this.showRaidingActivity = config.showRaidingActivity(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordState.java b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordState.java deleted file mode 100644 index 6133601d5c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordState.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.discord; - -import com.google.common.base.MoreObjects; -import com.google.common.collect.ComparisonChain; -import java.time.Duration; -import java.time.Instant; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.UUID; -import javax.inject.Inject; -import lombok.Data; -import net.runelite.client.RuneLiteProperties; -import net.runelite.client.discord.DiscordPresence; -import net.runelite.client.discord.DiscordService; -import net.runelite.client.ws.PartyService; -import static net.runelite.client.ws.PartyService.PARTY_MAX; - -/** - * This class contains data about currently active discord state. - */ -class DiscordState -{ - @Data - private static class EventWithTime - { - private final DiscordGameEventType type; - private final Instant start; - private Instant updated; - } - - private final UUID partyId = UUID.randomUUID(); - private final List events = new ArrayList<>(); - private final DiscordService discordService; - private final DiscordPlugin plugin; - private final PartyService party; - private DiscordPresence lastPresence; - - @Inject - private DiscordState(final DiscordService discordService, final DiscordPlugin plugin, final PartyService party) - { - this.discordService = discordService; - this.plugin = plugin; - this.party = party; - } - - /** - * Reset state. - */ - void reset() - { - discordService.clearPresence(); - events.clear(); - lastPresence = null; - } - - /** - * Force refresh discord presence - */ - void refresh() - { - if (lastPresence == null) - { - return; - } - - final DiscordPresence.DiscordPresenceBuilder presenceBuilder = DiscordPresence.builder() - .state(lastPresence.getState()) - .details(lastPresence.getDetails()) - .largeImageText(lastPresence.getLargeImageText()) - .startTimestamp(lastPresence.getStartTimestamp()) - .smallImageKey(lastPresence.getSmallImageKey()) - .partyMax(lastPresence.getPartyMax()) - .partySize(Math.max(plugin.isAlwaysShowParty() ? 1 : 0, party.getMembers().size())); - - if (party.isOwner()) - { - presenceBuilder.partyId(partyId.toString()); - presenceBuilder.joinSecret(party.getPartyId().toString()); - } - - discordService.updatePresence(presenceBuilder.build()); - } - - /** - * Trigger new discord state update. - * - * @param eventType discord event type - */ - void triggerEvent(final DiscordGameEventType eventType) - { - final Optional foundEvent = events.stream().filter(e -> e.type == eventType).findFirst(); - EventWithTime event; - - if (foundEvent.isPresent()) - { - event = foundEvent.get(); - } - else - { - // If we aren't showing the elapsed time within Discord then - // We null out the event start property - event = new EventWithTime(eventType, plugin.isHideElapsedTime() ? null : Instant.now()); - - events.add(event); - } - - event.setUpdated(Instant.now()); - - if (event.getType().isShouldClear()) - { - events.removeIf(e -> e.getType() != eventType && e.getType().isShouldClear()); - } - - events.sort((a, b) -> ComparisonChain.start() - .compare(b.getType().getPriority(), a.getType().getPriority()) - .compare(b.getUpdated(), a.getUpdated()) - .result()); - - event = events.get(0); - - String imageKey = null; - String state = null; - String details = null; - - for (EventWithTime eventWithTime : events) - { - if (imageKey == null) - { - imageKey = eventWithTime.getType().getImageKey(); - } - - if (details == null) - { - details = eventWithTime.getType().getDetails(); - } - - if (state == null) - { - state = eventWithTime.getType().getState(); - } - - if (imageKey != null && details != null && state != null) - { - break; - } - } - - // Replace snapshot with + to make tooltip shorter (so it will span only 1 line) - final String versionShortHand = RuneLiteProperties.getVersion().replace("-SNAPSHOT", "+"); - - final DiscordPresence.DiscordPresenceBuilder presenceBuilder = DiscordPresence.builder() - .state(MoreObjects.firstNonNull(state, "")) - .details(MoreObjects.firstNonNull(details, "")) - .largeImageText(RuneLiteProperties.getTitle() + " v" + versionShortHand) - .startTimestamp(event.getStart()) - .smallImageKey(imageKey) - .partyMax(PARTY_MAX) - .partySize(party.getMembers().size()); - - if (party.isOwner()) - { - presenceBuilder.partyId(partyId.toString()); - presenceBuilder.joinSecret(party.getPartyId().toString()); - } - - final DiscordPresence presence = presenceBuilder.build(); - - // This is to reduce amount of RPC calls - if (!presence.equals(lastPresence)) - { - lastPresence = presence; - discordService.updatePresence(presence); - } - } - - /** - * Check for current state timeout and act upon it. - */ - void checkForTimeout() - { - final Duration actionTimeout = Duration.ofMinutes(plugin.getActionTimeout()); - final Instant now = Instant.now(); - events.removeIf(event -> event.getType().isShouldTimeout() && now.isAfter(event.getUpdated().plus(actionTimeout))); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordUserInfo.java b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordUserInfo.java deleted file mode 100644 index fdf47d4e3e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordUserInfo.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2019, Tomas Slusny - * 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.discord; - -import lombok.EqualsAndHashCode; -import lombok.Value; -import net.runelite.http.api.ws.messages.party.PartyMemberMessage; - -@Value -@EqualsAndHashCode(callSuper = true) -public class DiscordUserInfo extends PartyMemberMessage -{ - private final String userId; - private final String avatarId; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dropparty/DropPartyConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/dropparty/DropPartyConfig.java deleted file mode 100644 index 8350b272fc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dropparty/DropPartyConfig.java +++ /dev/null @@ -1,95 +0,0 @@ -package net.runelite.client.plugins.dropparty; - -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; - -@ConfigGroup("drop") -public interface DropPartyConfig extends Config -{ - @ConfigItem( - keyName = "playerName", - name = "Dropping player", - description = "selects what players name to mark tiles", - position = 0 - ) - default String playerName() - { - return ""; - } - - @Range( - min = 1, - max = 40 - ) - @ConfigItem( - keyName = "showAmmount", - name = "Trail length", - description = "Shows the legnth of the droppers trail", - position = 1 - ) - default int showAmmount() - { - return 10; - } - - @ConfigItem( - position = 2, - keyName = "overlayColor", - name = "Overlay Color", - description = "Configures the color of the overlay" - ) - default Color overlayColor() - { - return new Color(0, 150, 200); - } - - @ConfigItem( - position = 3, - keyName = "fontStyle", - name = "Font Style", - description = "Bold/Italics/Plain" - ) - default FontStyle fontStyle() - { - return FontStyle.BOLD; - } - - @Range( - min = 10, - max = 40 - ) - @ConfigItem( - position = 4, - keyName = "textSize", - name = "Text Size", - description = "Text Size for Timers." - ) - default int textSize() - { - return 18; - } - - @Getter - @AllArgsConstructor - 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(); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dropparty/DropPartyOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/dropparty/DropPartyOverlay.java deleted file mode 100644 index 3c4ef6c201..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dropparty/DropPartyOverlay.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * All rights reserved. - * - * - * Modified by farhan1666 - * - * 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.dropparty; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -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; - -@Singleton -public class DropPartyOverlay extends Overlay -{ - private static final int FILL_START_ALPHA = 25; - private static final int OUTLINE_START_ALPHA = 255; - - private final Client client; - private final DropPartyPlugin plugin; - - @Inject - public DropPartyOverlay(final Client client, final DropPartyPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.UNDER_WIDGETS); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - int tiles = plugin.getShowAmmount(); - if (tiles == 0) - { - return null; - } - final List path = plugin.getPlayerPath(); - - final List markedTiles = new ArrayList<>(); - - for (int i = 0; i < path.size(); i++) - { - if (i > plugin.getMAXPATHSIZE() || i > (plugin.getShowAmmount() - 1)) - { - break; - } - if (path.get(i) != null) - { - final LocalPoint local = LocalPoint.fromWorld(client, path.get(i)); - Polygon tilePoly = null; - if (local != null) - { - tilePoly = Perspective.getCanvasTileAreaPoly(client, local, 1); - } - - if (tilePoly != null) - { - if (!markedTiles.contains(path.get(i))) - { - graphics.setColor(new Color(setAlphaComponent(plugin.getOverlayColor().getRGB(), OUTLINE_START_ALPHA), true)); - graphics.drawPolygon(tilePoly); - OverlayUtil.renderTextLocation(graphics, Integer.toString(i + 1), plugin.getTextSize(), - plugin.getFontStyle(), Color.WHITE, centerPoint(tilePoly.getBounds()), true, 0); - } - markedTiles.add(path.get(i)); - } - - } - } - - - return null; - } - - 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); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dropparty/DropPartyPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/dropparty/DropPartyPlugin.java deleted file mode 100644 index a53b40aa70..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dropparty/DropPartyPlugin.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * All rights reserved. - * - * - * Modified by farhan1666 - * - * 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.dropparty; - -import com.google.inject.Provides; -import java.awt.Color; -import java.util.ArrayList; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.Player; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameTick; -import net.runelite.api.util.Text; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - - -@PluginDescriptor( - name = "Drop Party", - description = "Marks where a user ran, for drop partys", - tags = {"Drop", "Party", "marker", "player"}, - type = PluginType.MISCELLANEOUS, - enabledByDefault = false -) -@Singleton -public class DropPartyPlugin extends Plugin -{ - @Inject - private DropPartyConfig config; - @Getter(AccessLevel.PACKAGE) - private List playerPath = new ArrayList<>(); - @Getter(AccessLevel.PACKAGE) - private String playerName = ""; - @Getter(AccessLevel.PACKAGE) - private int showAmmount = 0; - @Getter(AccessLevel.PACKAGE) - private int MAXPATHSIZE = 100; - private Player runningPlayer; - @Getter(AccessLevel.PACKAGE) - private Color overlayColor; - - @Inject - private OverlayManager overlayManager; - - @Inject - private DropPartyOverlay coreOverlay; - - @Inject - private Client client; - - @Getter(AccessLevel.PACKAGE) - private int fontStyle; - @Getter(AccessLevel.PACKAGE) - private int textSize; - - @Provides - DropPartyConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(DropPartyConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - overlayManager.add(coreOverlay); - reset(); - } - - @Override - protected void shutDown() - { - overlayManager.remove(coreOverlay); - reset(); - } - - @Subscribe - private void onGameTick(GameTick event) - { - shuffleList(); - if (playerName.equalsIgnoreCase("")) - { - return; - } - - runningPlayer = null; - - for (Player player : client.getPlayers()) - { - if (player.getName() == null) - { - continue; - } - if (Text.standardize(player.getName()).equalsIgnoreCase(playerName)) - { - runningPlayer = player; - break; - } - - } - - if (runningPlayer == null) - { - cordsError(); - return; - } - addCords(); - } - - private void cordsError() - { - playerPath.add(null); - - } - - private void shuffleList() - { - if (playerPath.size() > MAXPATHSIZE - 1) - { - playerPath.remove(0); - } - } - - private void addCords() - { - while (true) - { - if (playerPath.size() >= MAXPATHSIZE) - { - playerPath.add(runningPlayer.getWorldLocation()); - break; - } - playerPath.add(null); - - } - - - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("drop")) - { - return; - } - - updateConfig(); - } - - - private void reset() - { - playerPath.clear(); - - } - - - private void updateConfig() - { - this.playerName = config.playerName(); - this.showAmmount = config.showAmmount(); - this.overlayColor = config.overlayColor(); - this.fontStyle = config.fontStyle().getFont(); - this.textSize = config.textSize(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/AttackStyle.java b/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/AttackStyle.java deleted file mode 100644 index 058dbc8f53..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/AttackStyle.java +++ /dev/null @@ -1,44 +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.dynamicmaxhit; - -import java.awt.Color; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.Prayer; - -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -public enum AttackStyle -{ - MAGE("Mage", Color.CYAN, Prayer.PROTECT_FROM_MAGIC), - RANGE("Range", Color.GREEN, Prayer.PROTECT_FROM_MISSILES), - MELEE("Melee", Color.RED, Prayer.PROTECT_FROM_MELEE), - UNKNOWN("Unknown", Color.WHITE, null); - - private String name; - private Color color; - private Prayer prayer; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/AttackerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/AttackerOverlay.java deleted file mode 100644 index bc917390c7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/AttackerOverlay.java +++ /dev/null @@ -1,126 +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.dynamicmaxhit; - -import com.google.common.base.Strings; -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Graphics2D; -import java.text.DecimalFormat; -import java.util.HashMap; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Point; -import net.runelite.client.ui.FontManager; -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; - -@Singleton -@Slf4j -public class AttackerOverlay extends Overlay -{ - private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#"); - private final Font timerFont = FontManager.getRunescapeBoldFont().deriveFont(14.0f); - private final DynamicMaxHit plugin; - - @Inject - public AttackerOverlay(final DynamicMaxHit plugin) - { - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGHEST); - setLayer(OverlayLayer.ALWAYS_ON_TOP); - } - - @Override - public Dimension render(Graphics2D graphics) - { - final Map temp = new HashMap<>(plugin.getVictims()); - - if (temp.isEmpty()) - { - return null; - } - - for (Victim player : temp.values()) - { - final AttackStyle attackStyle = player.getAttackStyle(); - - if (player.getMaxHit() < 1) - { - continue; - } - - final String text = DECIMAL_FORMAT.format(player.getMaxHit()); - final String specText = DECIMAL_FORMAT.format(player.getSpecMaxHit()); - final Point textLocation; - final Point specTextLocation; - - if (player.getPlayer().getSkullIcon() == null) - { - textLocation = player.getPlayer().getCanvasTextLocation(graphics, text, player.getPlayer().getLogicalHeight() + 40); - specTextLocation = player.getPlayer().getCanvasTextLocation(graphics, specText, player.getPlayer().getLogicalHeight() + 80); - } - else - { - textLocation = player.getPlayer().getCanvasTextLocation(graphics, text, player.getPlayer().getLogicalHeight() - 40); - specTextLocation = player.getPlayer().getCanvasTextLocation(graphics, specText, player.getPlayer().getLogicalHeight() - 80); - } - - if (textLocation != null) - { - renderTextLocation(graphics, textLocation, text, attackStyle.getColor()); - } - if (specTextLocation != null && !specText.equals(text)) - { - renderTextLocation(graphics, specTextLocation, specText, Color.ORANGE); - } - } - return null; - } - - private void renderTextLocation(Graphics2D graphics, Point txtLoc, String text, Color color) - { - if (Strings.isNullOrEmpty(text)) - { - return; - } - - int x = txtLoc.getX(); - int y = txtLoc.getY(); - - graphics.setColor(Color.BLACK); - graphics.drawString(text, x + 1, y + 1); - graphics.setFont(timerFont); - graphics.setStroke(new BasicStroke(1)); - graphics.setColor(color); - graphics.drawString(text, x, y); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/DynamicMaxHit.java b/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/DynamicMaxHit.java deleted file mode 100644 index 6560fc0f92..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/DynamicMaxHit.java +++ /dev/null @@ -1,874 +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.dynamicmaxhit; - -import com.google.common.collect.ImmutableList; -import com.google.inject.Provides; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import javax.inject.Inject; -import lombok.AccessLevel; -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.GameState; -import net.runelite.api.ItemDefinition; -import net.runelite.api.ItemID; -import net.runelite.api.Player; -import net.runelite.api.events.AnimationChanged; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.PlayerDespawned; -import net.runelite.api.events.PlayerMenuOptionClicked; -import net.runelite.api.events.PlayerSpawned; -import net.runelite.api.events.SpotAnimationChanged; -import net.runelite.api.kit.KitType; -import net.runelite.api.util.Text; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -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 static net.runelite.client.plugins.dynamicmaxhit.Utils.getTrueHp; -import static net.runelite.client.plugins.dynamicmaxhit.Utils.predictOffensivePrayer; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.http.api.hiscore.HiscoreClient; -import net.runelite.http.api.hiscore.HiscoreResult; -import net.runelite.http.api.item.ItemEquipmentStats; -import net.runelite.http.api.item.ItemStats; - -@PluginDescriptor( - name = "Dynamic Max Hit", - description = "Dynamic Max Hit Calculations", - tags = {"broken", "op", "shit"}, - type = PluginType.PVP, - enabledByDefault = false -) -@Slf4j -public class DynamicMaxHit extends Plugin -{ - private static final String CALC = "Max Hit"; - private static final double SPEC_PER_TICK = 0.2; - private static final HiscoreClient HISCORE_CLIENT = new HiscoreClient(); - private static final List NORMAL_VOID = ImmutableList.of(ItemID.VOID_KNIGHT_TOP, ItemID.VOID_KNIGHT_ROBE, ItemID.VOID_KNIGHT_GLOVES); - private static final List ELITE_VOID = ImmutableList.of(ItemID.ELITE_VOID_TOP, ItemID.ELITE_VOID_ROBE, ItemID.VOID_KNIGHT_GLOVES); - private static final List DHAROK = ImmutableList.of( - ItemID.DHAROKS_GREATAXE, ItemID.DHAROKS_GREATAXE_25, ItemID.DHAROKS_GREATAXE_50, ItemID.DHAROKS_GREATAXE_75, ItemID.DHAROKS_GREATAXE_100, - ItemID.DHAROKS_HELM, ItemID.DHAROKS_HELM_25, ItemID.DHAROKS_HELM_50, ItemID.DHAROKS_HELM_75, ItemID.DHAROKS_HELM_100, - ItemID.DHAROKS_PLATEBODY, ItemID.DHAROKS_PLATEBODY_25, ItemID.DHAROKS_PLATEBODY_50, ItemID.DHAROKS_PLATEBODY_75, ItemID.DHAROKS_PLATEBODY_100, - ItemID.DHAROKS_PLATELEGS, ItemID.DHAROKS_PLATELEGS_25, ItemID.DHAROKS_PLATELEGS_50, ItemID.DHAROKS_PLATELEGS_75, ItemID.DHAROKS_PLATELEGS_100 - ); - private static final String ANTIFIRE_DRINK_MESSAGE = "You drink some of your antifire potion."; - private static final String ANTIFIRE_EXPIRED_MESSAGE = "Your antifire potion has expired."; - 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 SUPER_ANTIFIRE_DRINK_MESSAGE = "You drink some of your super antifire potion"; - private static final String SUPER_ANTIFIRE_EXPIRED_MESSAGE = "Your super antifire potion has expired."; - @Inject - private Client client; - @Inject - private EventBus eventBus; - @Inject - private ItemManager itemManager; - @Inject - private OverlayManager overlayManager; - @Inject - private AttackerOverlay attackerOverlay; - @Inject - private MenuManager menuManager; - @Inject - private DynamicMaxHitConfig config; - @Getter(AccessLevel.PACKAGE) - private Map victims = new HashMap<>(); - private boolean antiFireActive; - private final ExecutorService httpExecutor = Executors.newFixedThreadPool(100); - private final Map resultCache = new HashMap<>(); - private boolean enablePrayer; - private boolean enablePotions; - - @Provides - DynamicMaxHitConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(DynamicMaxHitConfig.class); - } - - @Override - protected void startUp() - { - addSubscriptions(); - victims.clear(); - overlayManager.add(attackerOverlay); - menuManager.addPlayerMenuItem(CALC); - if (client.getGameState() == GameState.LOGGED_IN) - { - client.getPlayers().forEach(player -> - { - if (client.getLocalPlayer() == player) - { - return; - } - final Victim victim = new Victim(player); - victims.put(victim.getName(), victim); - }); - } - } - - @Override - protected void shutDown() - { - eventBus.unregister(this); - overlayManager.remove(attackerOverlay); - menuManager.removePlayerMenuItem(CALC); - } - - private void addSubscriptions() - { - eventBus.subscribe(PlayerSpawned.class, this, this::onPlayerSpawned); - eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged); - eventBus.subscribe(PlayerDespawned.class, this, this::onPlayerDespawned); - eventBus.subscribe(GameTick.class, this, this::onGameTick); - eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged); - eventBus.subscribe(SpotAnimationChanged.class, this, this::onSpotAnimationChanged); - eventBus.subscribe(ChatMessage.class, this, this::onChatMessage); - eventBus.subscribe(PlayerMenuOptionClicked.class, this, this::onPlayerMenuOptionClicked); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("dynamicMaxHit")) - { - return; - } - - this.enablePotions = config.enablePotions(); - this.enablePrayer = config.enablePrayer(); - } - - private void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event) - { - if (event.getMenuOption().equals(CALC)) - { - final Victim victim = victims.getOrDefault(Text.standardize(event.getMenuTarget()), null); - if (victim == null) - { - return; - } - updateStats(victim); - victim.setManual(true); - } - } - - private void onChatMessage(ChatMessage event) - { - if (event.getType() != ChatMessageType.SPAM && event.getType() != ChatMessageType.GAMEMESSAGE) - { - return; - } - - final String msg = event.getMessage(); - - switch (msg) - { - case ANTIFIRE_DRINK_MESSAGE: - case EXTENDED_ANTIFIRE_DRINK_MESSAGE: - case SUPER_ANTIFIRE_DRINK_MESSAGE: - case EXTENDED_SUPER_ANTIFIRE_DRINK_MESSAGE: - antiFireActive = true; - break; - case ANTIFIRE_EXPIRED_MESSAGE: - case SUPER_ANTIFIRE_EXPIRED_MESSAGE: - antiFireActive = false; - break; - } - } - - private void onSpotAnimationChanged(SpotAnimationChanged event) - { - final Actor actor = event.getActor(); - - if (victims.isEmpty()) - { - return; - } - - if (actor.getSpotAnimation() == 111) - { - final Victim victim = victims.getOrDefault(actor.getName(), null); - - if (victim == null) - { - return; - } - - victim.setCharged(true); - } - } - - private void onAnimationChanged(AnimationChanged event) - { - final Actor actor = event.getActor(); - - if (actor.getInteracting() != client.getLocalPlayer() || !(actor instanceof Player) || actor.getAnimation() == -1) - { - return; - } - - final Victim victim = victims.get(actor.getName()); - - if (victim == null) - { - return; - } - - if (victim.getPlayer().getInteracting() != null && victim.getPlayer().getInteracting() == client.getLocalPlayer()) - { - if (victim.getSkills() == null) - { - updateStats(victim); - } - - victim.setAttacking(true); - victim.setTimer(16); - } - } - - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGGED_IN) - { - return; - } - - victims.clear(); - } - - private void onPlayerSpawned(PlayerSpawned event) - { - final Player player = event.getPlayer(); - - if (client.getLocalPlayer() == player) - { - return; - } - - final Victim victim = new Victim(player); - victims.put(victim.getName(), victim); - } - - private void onPlayerDespawned(PlayerDespawned event) - { - final Player player = event.getPlayer(); - victims.remove(Text.standardize(player.getName())); - } - - private void onGameTick(GameTick event) - { - if (victims.isEmpty() || client.getLocalPlayer() == null) - { - return; - } - - victims.values().forEach((v) -> - { - if (!v.isAttacking() && !v.isManual()) - { - return; - } - - update(v); - }); - } - - private void update(Victim player) - { - reset(player); - - if (player.getSkills() == null) - { - return; - } - - updateSpec(player); - updatePlayerGear(player); - updateTimers(player); - updateAttackStyle(player); - updateWeakness(player); - updatePredictedMagic(player); - player.setPredictedPrayer(predictOffensivePrayer(player.getPrayerLevel(), player.getAttackStyle())); - player.setPotionBoost(updatePotFormula(player)); - updateMaxHitMelee(player); - updateMaxHitMagic(player); - updateSpecMaxHit(player); - if (client.isPrayerActive(player.getAttackStyle().getPrayer())) - { - player.setMaxHit(Math.floor(player.getMaxHit() * 0.6)); - player.setSpecMaxHit(Math.floor(player.getSpecMaxHit() * 0.6)); - } - } - - private void reset(Victim player) - { - player.reset(); - } - - private void updateSpec(Victim player) - { - if (player.getSpec() < 100) - { - player.setSpec(player.getSpec() + SPEC_PER_TICK); - } - else if (player.getSpec() > 100) - { - player.setSpec(100); - } - } - - private void updateStats(Victim player) - { - if (resultCache.containsKey(player.getName())) - { - player.setSkills(resultCache.get(player.getName())); - player.setPrayerLevel(player.getSkills().getPrayer().getLevel()); - player.setHpLevel(player.getSkills().getHitpoints().getLevel()); - return; - } - - httpExecutor.submit(() -> - { - HiscoreResult result; - do - { - try - { - result = HISCORE_CLIENT.lookup(player.getName()); - } - catch (IOException ex) - { - result = null; - try - { - Thread.sleep(1000); - } - catch (InterruptedException e) - { - e.printStackTrace(); - } - } - } - while (result == null); - - resultCache.put(player.getName(), result); - player.setSkills(result); - player.setPrayerLevel(player.getSkills().getPrayer().getLevel()); - player.setHpLevel(player.getSkills().getHitpoints().getLevel()); - }); - } - - private void updateTimers(Victim player) - { - if (player.getTimer() > 0) - { - player.setTimer(player.getTimer() - 1); - } - else - { - player.setAttacking(false); - } - } - - private void updatePlayerGear(Victim player) - { - if (player.getPlayer().getPlayerAppearance() == null) - { - return; - } - - final List items = new ArrayList<>(); - - for (KitType kitType : KitType.values()) - { - if (kitType == KitType.RING || kitType == KitType.AMMUNITION) - { - continue; - } - - final int id = player.getPlayer().getPlayerAppearance().getEquipmentId(kitType); - - if (id == -1) - { - continue; - } - - if (kitType.equals(KitType.WEAPON)) - { - player.setWeapon(id); - - switch (id) - { - case ItemID.HEAVY_BALLISTA: - case ItemID.HEAVY_BALLISTA_23630: - case ItemID.LIGHT_BALLISTA: - player.setRangeStr(player.getRangeStr() + 150); - break; - case ItemID.MAPLE_LONGBOW: - case ItemID.MAPLE_SHORTBOW: - player.setRangeStr(player.getRangeStr() + 31); - break; - case ItemID.MAGIC_SHORTBOW: - case ItemID.MAGIC_SHORTBOW_20558: - case ItemID.MAGIC_SHORTBOW_I: - player.setRangeStr(player.getRangeStr() + 55); - break; - case ItemID.DARK_BOW: - case ItemID.DARK_BOW_12765: - case ItemID.DARK_BOW_12766: - case ItemID.DARK_BOW_12767: - case ItemID.DARK_BOW_12768: - case ItemID.DARK_BOW_20408: - player.setRangeStr(player.getRangeStr() + 60); - break; - case ItemID.RUNE_CROSSBOW: - case ItemID.RUNE_CROSSBOW_23601: - player.setRangeStr(player.getRangeStr() + 117); - break; - case ItemID.DRAGON_CROSSBOW: - case ItemID.ARMADYL_CROSSBOW: - case ItemID.ARMADYL_CROSSBOW_23611: - player.setRangeStr(player.getRangeStr() + 122); - break; - } - } - - if (kitType.equals(KitType.SHIELD)) - { - player.setShield(id); - } - - final ItemStats item = itemManager.getItemStats(id, false); - - if (item == null) - { - log.debug("Item is null: {}", id); - continue; - } - - ItemEquipmentStats stats = item.getEquipment(); - - if (stats == null) - { - log.debug("Stats are null: {}", item); - continue; - } - - items.add(id); - - player.setSpeed(player.getSpeed() + stats.getAspeed()); - player.setMeleeAtkCrush(player.getMeleeAtkCrush() + stats.getAcrush()); - player.setMeleeAtkStab(player.getMeleeAtkStab() + stats.getAstab()); - player.setMeleeAtkSlash(player.getMeleeAtkSlash() + stats.getAslash()); - player.setMeleeAttack(player.getMeleeAttack() + ((stats.getAcrush() + stats.getAslash() + stats.getAstab()) / 3)); - player.setMeleeDefCrush(player.getMeleeDefCrush() + stats.getDcrush()); - player.setMeleeDefStab(player.getMeleeDefStab() + stats.getDstab()); - player.setMeleeDefSlash(player.getMeleeDefSlash() + stats.getDslash()); - player.setMeleeDefence(player.getMeleeDefence() + ((stats.getDcrush() + stats.getDslash() + stats.getDstab()) / 3)); - player.setMagicAttack(player.getMagicAttack() + stats.getAmagic()); - player.setRangeAttack(player.getRangeAttack() + stats.getArange()); - player.setMagicDefence(player.getMagicDefence() + stats.getDmagic()); - player.setRangeDefence(player.getRangeDefence() + stats.getDrange()); - player.setRangeStr(player.getRangeStr() + stats.getRstr()); - player.setMeleeStr(player.getMeleeStr() + stats.getStr()); - player.setMagicStr(player.getMagicStr() + stats.getMdmg()); - } - player.setGear(items); - updateMeleeStyle(player); - } - - private void updateMeleeStyle(Victim player) - { - if (player.getMeleeAtkCrush() >= player.getMeleeAtkSlash() && player.getMeleeAtkCrush() >= player.getMeleeAtkStab()) - { - player.setMeleeStyle(Victim.MeleeStyle.CRUSH); - } - else if (player.getMeleeAtkSlash() >= player.getMeleeAtkCrush() && player.getMeleeAtkSlash() >= player.getMeleeAtkStab()) - { - player.setMeleeStyle(Victim.MeleeStyle.SLASH); - } - else if (player.getMeleeAtkStab() >= player.getMeleeAtkSlash() && player.getMeleeAtkStab() >= player.getMeleeAtkCrush()) - { - player.setMeleeStyle(Victim.MeleeStyle.STAB); - } - } - - private void updateAttackStyle(Victim player) - { - boolean staff = false; - - for (int id : player.getGear()) - { - ItemDefinition def = itemManager.getItemDefinition(id); - if (def.getName().toLowerCase().contains("staff")) - { - player.setAttackStyle(AttackStyle.MAGE); - staff = true; - break; - } - } - - if (staff) - { - return; - } - - if (player.getMagicStr() >= player.getRangeStr() && player.getMagicStr() >= player.getMeleeStr()) - { - player.setAttackStyle(AttackStyle.MAGE); - } - else if (player.getRangeStr() >= player.getMagicStr() && player.getRangeStr() >= player.getMeleeStr()) - { - player.setAttackStyle(AttackStyle.RANGE); - } - else if (player.getMeleeStr() >= player.getMagicStr() && player.getMeleeStr() >= player.getRangeStr()) - { - player.setAttackStyle(AttackStyle.MELEE); - } - } - - private void updateWeakness(Victim player) - { - if (player.getMagicDefence() <= player.getRangeDefence() && player.getMagicDefence() <= player.getMeleeDefence()) - { - player.setWeakness(AttackStyle.MAGE); - } - else if (player.getRangeDefence() <= player.getMagicDefence() && player.getRangeDefence() <= player.getMeleeDefence()) - { - player.setWeakness(AttackStyle.RANGE); - } - else if (player.getMeleeDefence() <= player.getRangeDefence() && player.getMeleeDefence() <= player.getMagicDefence()) - { - player.setWeakness(AttackStyle.MELEE); - } - } - - private void updatePredictedMagic(Victim player) - { - final int magicLevel = player.getSkills() != null ? player.getSkills().getMagic().getLevel() : 0; - - if (magicLevel >= 70 && magicLevel <= 81) - { - player.setPredictedSpell(Spells.ICE_BURST); - } - else if (magicLevel >= 82 && magicLevel <= 93) - { - player.setPredictedSpell(Spells.ICE_BLITZ); - } - else if (magicLevel >= 94) - { - player.setPredictedSpell(Spells.ICE_BARRAGE); - } - - if (player.getShield() != ItemID.TOME_OF_FIRE) - { - return; - } - - if (magicLevel >= 59 && magicLevel <= 74) - { - player.setPredictedSpell(Spells.FIRE_BLAST); - } - else if (magicLevel >= 75 && magicLevel <= 94) - { - player.setPredictedSpell(Spells.FIRE_WAVE); - } - else if (magicLevel >= 95) - { - player.setPredictedSpell(Spells.FIRE_SURGE); - } - - if (!player.isCharged()) - { - return; - } - - if (magicLevel >= 60) - { - player.setPredictedSpell(Spells.FLAMES_ZAMORAK); - } - } - - private int updatePotFormula(Victim player) - { - final Potions pot; - switch (player.getAttackStyle()) - { - case RANGE: - pot = Potions.RANGING_POTION; - return (int) Math.floor(pot.getA() + pot.getB() * player.getSkills().getSkill(pot.getSkill()).getLevel()); - case MELEE: - pot = Potions.SUPER_COMBAT; - return (int) Math.floor(pot.getA() + pot.getB() * player.getSkills().getSkill(pot.getSkill()).getLevel()); - default: - return 0; - } - } - - private void updateMaxHitMelee(Victim player) - { - if (player.getPredictedPrayer() == null) - { - return; - } - - double prayerBonus = 1; - - if (this.enablePrayer) - { - switch (player.getPredictedPrayer()) - { - case SHARP_EYE: - case BURST_OF_STRENGTH: - prayerBonus = 1.05; - break; - case HAWK_EYE: - case SUPERHUMAN_STRENGTH: - prayerBonus = 1.1; - break; - case EAGLE_EYE: - case ULTIMATE_STRENGTH: - prayerBonus = 1.15; - break; - case CHIVALRY: - prayerBonus = 1.18; - break; - case PIETY: - case RIGOUR: - prayerBonus = 1.23; - break; - } - } - - double skillPower = 0; - double estimatedStyle = 8; - - switch (player.getAttackStyle()) - { - case RANGE: - skillPower = player.getSkills() != null ? player.getSkills().getRanged().getLevel() : 0; - break; - case MELEE: - skillPower = player.getSkills() != null ? player.getSkills().getStrength().getLevel() : 0; - estimatedStyle = 11; - break; - } - - if (this.enablePotions) - { - skillPower += player.getPotionBoost(); - } - - double estimatedLevel = skillPower * prayerBonus; - estimatedLevel = Math.floor(estimatedLevel); - estimatedLevel += estimatedStyle; - - if (player.getGear().containsAll(NORMAL_VOID)) - { - estimatedLevel *= 1.10; - } - else if (player.getGear().containsAll(ELITE_VOID)) - { - estimatedLevel *= 1.10; - if (player.getAttackStyle() == AttackStyle.RANGE) - { - estimatedLevel *= 1.125; - } - } - - double maxHit = 0; - - switch (player.getAttackStyle()) - { - case MELEE: - maxHit = 0.5 + estimatedLevel * (player.getMeleeStr() + 64) / 640; - break; - case RANGE: - maxHit = 0.5 + estimatedLevel * (player.getRangeStr() + 64) / 640; - break; - } - - maxHit = Math.floor(maxHit); - - int dharokPieces = 0; - dharokPieces += player.getGear().stream().filter(DHAROK::contains).count(); - - if (dharokPieces == 4) - { - final double var1 = player.getHpLevel(); - final double var2 = getTrueHp(player.getPlayer(), player.getHpLevel()); - final double var3 = (var1 - var2) / 100; - final double var4 = (var1 / 100); - maxHit *= 1 + (var3 * var4); - } - if ((player.getGear().contains(ItemID.TZHAARKETOM) || player.getGear().contains(ItemID.TZHAARKETOM_T)) - && (player.getGear().contains(ItemID.BERSERKER_NECKLACE) || player.getGear().contains(ItemID.BERSERKER_NECKLACE_OR))) - { - maxHit *= 1.2; - } - - maxHit = Math.floor(maxHit); - - player.setMaxHit(maxHit); - } - - private void updateSpecMaxHit(Victim player) - { - double maxHit = player.getMaxHit(); - - switch (player.getWeapon()) - { - case ItemID.ARMADYL_GODSWORD: - case ItemID.ARMADYL_GODSWORD_20593: - case ItemID.ARMADYL_GODSWORD_22665: - case ItemID.ARMADYL_GODSWORD_OR: - maxHit *= 1.10; - maxHit = Math.floor(maxHit); - maxHit *= 1.25; - break; - case ItemID.BANDOS_GODSWORD: - case ItemID.BANDOS_GODSWORD_20782: - case ItemID.BANDOS_GODSWORD_21060: - case ItemID.BANDOS_GODSWORD_OR: - maxHit *= 1.10; - maxHit = Math.floor(maxHit); - maxHit *= 1.10; - break; - case ItemID.BARRELCHEST_ANCHOR: - case ItemID.BARRELCHEST_ANCHOR_10888: - case ItemID.DRAGON_HALBERD: - case ItemID.SARADOMIN_GODSWORD: - case ItemID.SARADOMIN_GODSWORD_OR: - case ItemID.ZAMORAK_GODSWORD: - case ItemID.ZAMORAK_GODSWORD_OR: - case ItemID.SARADOMIN_SWORD: - maxHit *= 1.10; - break; - case ItemID.DRAGON_CROSSBOW: - case ItemID.ARMADYL_CROSSBOW: - case ItemID.ARMADYL_CROSSBOW_23611: - case ItemID.RUNE_CLAWS: - maxHit *= 1.15; - break; - case ItemID.DRAGON_LONGSWORD: - case ItemID.DRAGON_SWORD: - case ItemID.DRAGON_SWORD_21206: - case ItemID.LIGHT_BALLISTA: - case ItemID.HEAVY_BALLISTA: - case ItemID.HEAVY_BALLISTA_23630: - case ItemID.SARADOMINS_BLESSED_SWORD: - maxHit *= 1.25; - break; - case ItemID.DARK_BOW: - case ItemID.DARK_BOW_12765: - case ItemID.DARK_BOW_12766: - case ItemID.DARK_BOW_12767: - case ItemID.DARK_BOW_12768: - case ItemID.DARK_BOW_20408: - maxHit *= 1.30; - break; - case ItemID.TOXIC_BLOWPIPE: - case ItemID.DRAGON_MACE: - maxHit *= 1.50; - case ItemID.DRAGON_KNIFE: - case ItemID.DRAGON_KNIFE_22812: - case ItemID.DRAGON_KNIFE_22814: - case ItemID.DRAGON_KNIFEP_22808: - case ItemID.DRAGON_KNIFEP_22810: - case ItemID.GRANITE_MAUL: - case ItemID.GRANITE_MAUL_12848: - case ItemID.GRANITE_MAUL_20557: - case ItemID.GRANITE_MAUL_24225: - case ItemID.GRANITE_MAUL_24227: - case ItemID.DRAGON_CLAWS: - case ItemID.DRAGON_CLAWS_20784: - case ItemID.DRAGON_DAGGER: - case ItemID.DRAGON_DAGGER_20407: - case ItemID.DRAGON_DAGGERP: - case ItemID.DRAGON_DAGGERP_5680: - case ItemID.DRAGON_DAGGERP_5698: - maxHit *= 2.0; - break; - } - - maxHit = Math.floor(maxHit); - - switch (player.getWeapon()) - { - case ItemID.RUNE_CROSSBOW: - case ItemID.RUNE_CROSSBOW_23601: - if (!antiFireActive) - { - double rangeLevel = player.getSkills() != null ? player.getSkills().getRanged().getLevel() : 0; - maxHit += rangeLevel * 0.2; - } - break; - } - - maxHit = Math.floor(maxHit); - - player.setSpecMaxHit(maxHit); - } - - private void updateMaxHitMagic(Victim player) - { - if (player.getAttackStyle() != AttackStyle.MAGE || player.getGear().isEmpty()) - { - return; - } - - double maxHit = player.getPredictedSpell().getMaxHit(); - - maxHit *= (1 + (float) player.getMagicStr() / 100); - maxHit = Math.floor(maxHit); - - if (player.getShield() == ItemID.TOME_OF_FIRE) - { - maxHit *= 1.5; - } - - maxHit = Math.floor(maxHit); - - player.setMaxHit(maxHit); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/DynamicMaxHitConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/DynamicMaxHitConfig.java deleted file mode 100644 index 60ffd97a1b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/DynamicMaxHitConfig.java +++ /dev/null @@ -1,52 +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.dynamicmaxhit; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("dynamicMaxHit") -public interface DynamicMaxHitConfig extends Config -{ - @ConfigItem( - keyName = "enablePrayer", - name = "Enable Prayer in Calculations", - description = "" - ) - default boolean enablePrayer() - { - return true; - } - - @ConfigItem( - keyName = "enablePotions", - name = "Enable Potions in Calculations", - description = "" - ) - default boolean enablePotions() - { - return true; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/Potions.java b/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/Potions.java deleted file mode 100644 index eaca31d43c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/Potions.java +++ /dev/null @@ -1,42 +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.dynamicmaxhit; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.http.api.hiscore.HiscoreSkill; - -@Getter(AccessLevel.PACKAGE) -@AllArgsConstructor -public enum Potions -{ - SUPER_COMBAT("Super Combat", 5, 0.15, HiscoreSkill.STRENGTH), - RANGING_POTION("Ranging Potion", 4, 0.10, HiscoreSkill.RANGED); - - private final String name; - private final double a; - private final double b; - private final HiscoreSkill skill; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/Spells.java b/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/Spells.java deleted file mode 100644 index 11f4717f5b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/Spells.java +++ /dev/null @@ -1,44 +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.dynamicmaxhit; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter(AccessLevel.PACKAGE) -@AllArgsConstructor -enum Spells -{ - FIRE_BLAST(16), - FIRE_WAVE(20), - FIRE_SURGE(24), - ICE_BURST(22), - ICE_BLITZ(26), - ICE_BARRAGE(30), - FLAMES_ZAMORAK(30), - UNKNOWNM(0); - - private int maxHit; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/Utils.java b/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/Utils.java deleted file mode 100644 index 6779d839e7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/Utils.java +++ /dev/null @@ -1,156 +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.dynamicmaxhit; - -import net.runelite.api.Player; -import net.runelite.api.Prayer; - -class Utils -{ - static Prayer iconToPrayer(Player player) - { - if (player.getOverheadIcon() != null) - { - switch (player.getOverheadIcon()) - { - case RANGED: - return Prayer.PROTECT_FROM_MISSILES; - case MAGIC: - return Prayer.PROTECT_FROM_MAGIC; - case MELEE: - return Prayer.PROTECT_FROM_MELEE; - case SMITE: - return Prayer.SMITE; - case REDEMPTION: - return Prayer.REDEMPTION; - case RETRIBUTION: - return Prayer.RETRIBUTION; - default: - return null; - } - } - return null; - } - - static Prayer predictOffensivePrayer(int prayerLevel, AttackStyle attackStyle) - { - switch (attackStyle) - { - case MELEE: - if (prayerLevel <= 12 && prayerLevel >= 1) - { - return Prayer.BURST_OF_STRENGTH; - } - else if (prayerLevel <= 30 && prayerLevel >= 13) - { - return Prayer.SUPERHUMAN_STRENGTH; - } - else if (prayerLevel <= 59 && prayerLevel >= 31) - { - return Prayer.ULTIMATE_STRENGTH; - } - else if (prayerLevel <= 69 && prayerLevel >= 60) - { - return Prayer.CHIVALRY; - } - else if (prayerLevel >= 70) - { - return Prayer.PIETY; - } - case RANGE: - if (prayerLevel <= 25 && prayerLevel >= 8) - { - return Prayer.SHARP_EYE; - } - else if (prayerLevel <= 43 && prayerLevel >= 26) - { - return Prayer.HAWK_EYE; - } - else if (prayerLevel <= 73 && prayerLevel >= 44) - { - return Prayer.EAGLE_EYE; - } - else if (prayerLevel >= 74) - { - return Prayer.RIGOUR; - } - case MAGE: - if (prayerLevel <= 26 && prayerLevel >= 9) - { - return Prayer.MYSTIC_WILL; - } - else if (prayerLevel <= 44 && prayerLevel >= 27) - { - return Prayer.MYSTIC_LORE; - } - else if (prayerLevel <= 76 && prayerLevel >= 45) - { - return Prayer.MYSTIC_MIGHT; - } - else if (prayerLevel >= 77) - { - return Prayer.AUGURY; - } - default: - return null; - } - } - - static int getTrueHp(Player player, int hitpoints) - { - int scale = player.getHealth(); - int ratio = player.getHealthRatio(); - - if (hitpoints == -1) - { - return -1; - } - - if (ratio > 0) - { - int minHealth = 1; - int maxHealth; - if (scale > 1) - { - if (ratio > 1) - { - minHealth = (hitpoints * (ratio - 1) + scale - 2) / (scale - 1); - } - - maxHealth = (hitpoints * ratio - 1) / (scale - 1); - - if (maxHealth > hitpoints) - { - maxHealth = hitpoints; - } - } - else - { - maxHealth = hitpoints; - } - return (minHealth + maxHealth + 1) / 2; - } - return -1; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/Victim.java b/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/Victim.java deleted file mode 100644 index fc51f5fadd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/Victim.java +++ /dev/null @@ -1,161 +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.dynamicmaxhit; - -import java.util.ArrayList; -import java.util.List; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import net.runelite.api.Player; -import net.runelite.api.Prayer; -import net.runelite.api.util.Text; -import static net.runelite.client.plugins.dynamicmaxhit.Utils.iconToPrayer; -import net.runelite.http.api.hiscore.HiscoreResult; - -@Getter(AccessLevel.PACKAGE) -@Setter(AccessLevel.PACKAGE) -@ToString(exclude = "player") -class Victim -{ - private AttackStyle attackStyle; - private AttackStyle weakness; - private MeleeStyle meleeStyle; - private HiscoreResult skills; - private List gear; - private Player player; - private Prayer overhead; - private Prayer predictedPrayer; - private Spells predictedSpell; - private String location; - private String name; - private String targetString; - private boolean manual; - private boolean attacking; - private boolean charged; - private double dps; - private double drainRate; - private double maxHit; - private double specMaxHit; - private double spec; - private int speed; - private int hpLevel; - private int magicStr; - private int magicAttack; - private int magicDefence; - private int meleeAttack; - private int meleeAtkSlash; - private int meleeAtkStab; - private int meleeAtkCrush; - private int meleeDefSlash; - private int meleeDefStab; - private int meleeDefCrush; - private int meleeDefence; - private int meleeStr; - private int prayerLevel; - private int rangeAttack; - private int rangeDefence; - private int rangeStr; - private int shield; - private int timer; - private int weapon; - private int wildyLevel; - private int potionBoost; - - Victim(Player player) - { - this.attackStyle = AttackStyle.UNKNOWN; - this.attacking = false; - this.charged = false; - this.gear = new ArrayList<>(); - this.hpLevel = -1; - this.magicAttack = 0; - this.dps = 0; - this.magicDefence = 0; - this.maxHit = 0; - this.manual = false; - this.meleeStyle = MeleeStyle.NONE; - this.meleeAttack = 0; - this.meleeAtkCrush = 0; - this.meleeAtkStab = 0; - this.meleeAtkSlash = 0; - this.meleeDefCrush = 0; - this.meleeDefStab = 0; - this.meleeDefSlash = 0; - this.meleeDefence = 0; - this.name = Text.standardize(player.getName()); - this.overhead = null; - this.player = player; - this.prayerLevel = -1; - this.predictedPrayer = null; - this.predictedSpell = Spells.UNKNOWNM; - this.rangeAttack = 0; - this.rangeDefence = 0; - this.speed = 0; - this.shield = 0; - this.skills = null; - this.specMaxHit = 0; - this.spec = 100; - this.targetString = ""; - this.timer = 0; - this.weakness = AttackStyle.UNKNOWN; - this.weapon = 0; - this.wildyLevel = 0; - this.potionBoost = 0; - } - - void reset() - { - setSpeed(0); - setMeleeAtkCrush(0); - setMeleeAtkStab(0); - setMeleeAtkSlash(0); - setMeleeAttack(0); - setMeleeDefCrush(0); - setMeleeDefStab(0); - setMeleeDefSlash(0); - setMeleeDefence(0); - setMagicAttack(0); - setRangeAttack(0); - setMagicDefence(0); - setRangeDefence(0); - setMagicStr(0); - setMeleeStr(0); - setRangeStr(0); - setDrainRate(0); - setOverhead(iconToPrayer(getPlayer())); - setAttackStyle(AttackStyle.UNKNOWN); - setMeleeStyle(MeleeStyle.NONE); - } - - @Getter(AccessLevel.PACKAGE) - enum MeleeStyle - { - CRUSH, - SLASH, - STAB, - NONE - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/Weapons.java b/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/Weapons.java deleted file mode 100644 index 6d43bf9a18..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dynamicmaxhit/Weapons.java +++ /dev/null @@ -1,123 +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.dynamicmaxhit; - -import com.google.common.collect.ImmutableSet; -import java.util.Set; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.ItemID; - -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -enum Weapons -{ - ABYSSAL_DAGGER(ImmutableSet.of(ItemID.ABYSSAL_DAGGER, ItemID.ABYSSAL_DAGGER_P, ItemID.ABYSSAL_DAGGER_P_13269, ItemID.ABYSSAL_DAGGER_P_13271), - 3300, -1, 50), - ABYSSAL_WHIP(ImmutableSet.of(ItemID.ABYSSAL_WHIP, ItemID.ABYSSAL_WHIP_4178, ItemID.ABYSSAL_WHIP_20405, ItemID.FROZEN_ABYSSAL_WHIP, - ItemID.VOLCANIC_ABYSSAL_WHIP, ItemID.ABYSSAL_TENTACLE), - 1658, 341, 50), - AGS(ImmutableSet.of(ItemID.ARMADYL_GODSWORD, ItemID.ARMADYL_GODSWORD_20593, ItemID.ARMADYL_GODSWORD_22665, ItemID.ARMADYL_GODSWORD_OR), - 7644, -1, 50), - ANCIENT_MACE(ImmutableSet.of(ItemID.ANCIENT_MACE), - 6147, -1, 100), - ARMADYL_CBOW(ImmutableSet.of(ItemID.ARMADYL_CROSSBOW, ItemID.ARMADYL_CROSSBOW_23611), - -1, -1, 50), - BARRELCHEST_ANCHOR(ImmutableSet.of(ItemID.BARRELCHEST_ANCHOR, ItemID.BARRELCHEST_ANCHOR_10888), - 5870, -1, 50), - BGS(ImmutableSet.of(ItemID.BANDOS_GODSWORD, ItemID.BANDOS_GODSWORD_20782, ItemID.BANDOS_GODSWORD_21060, ItemID.BANDOS_GODSWORD_OR), - 7642, -1, 50), - BLUDGEON(ImmutableSet.of(ItemID.ABYSSAL_BLUDGEON), - -1, -1, 50), - DARK_BOW(ImmutableSet.of(ItemID.DARK_BOW, ItemID.DARK_BOW_12765, ItemID.DARK_BOW_12766, ItemID.DARK_BOW_12767, ItemID.DARK_BOW_12768, ItemID.DARK_BOW_20408), - 426, 1100, 50), - DORG_CBOW(ImmutableSet.of(ItemID.DORGESHUUN_CROSSBOW), - 7557, -1, 50), - DRAGON_2H_SWORD(ImmutableSet.of(ItemID.DRAGON_2H_SWORD, ItemID.DRAGON_2H_SWORD_20559), - 3157, -1, 60), - DRAGON_CBOW(ImmutableSet.of(ItemID.DRAGON_CROSSBOW), - 4230, -1, 50), - DRAGON_CLAWS(ImmutableSet.of(ItemID.DRAGON_CLAWS, ItemID.DRAGON_CLAWS_20784), - 7514, -1, 50), - DRAGON_DAGGER(ImmutableSet.of(ItemID.DRAGON_DAGGER, ItemID.DRAGON_DAGGER_20407, ItemID.DRAGON_DAGGERP, ItemID.DRAGON_DAGGERP_5680, ItemID.DRAGON_DAGGERP_5698), - 1062, -1, 25), - DRAGON_HALBERD(ImmutableSet.of(ItemID.DRAGON_HALBERD), - 1203, -1, 30), - DRAGON_LONG(ImmutableSet.of(ItemID.DRAGON_LONGSWORD), - 1058, -1, 25), - DRAGON_MACE(ImmutableSet.of(ItemID.DRAGON_MACE), - -1, -1, 25), - DRAGON_SCIM(ImmutableSet.of(ItemID.DRAGON_SCIMITAR, ItemID.DRAGON_SCIMITAR_20406, ItemID.DRAGON_SCIMITAR_OR), - 1872, -1, 55), - DRAGON_SPEAR(ImmutableSet.of(ItemID.DRAGON_SPEAR, ItemID.DRAGON_SPEARP, ItemID.DRAGON_SPEARP_5716, ItemID.DRAGON_SPEARP_5730, ItemID.DRAGON_SPEARKP), - 1064, -1, 25), - DRAGON_SWORD(ImmutableSet.of(ItemID.DRAGON_SWORD, ItemID.DRAGON_SWORD_21206), - 7515, -1, 40), - DRAGON_THROWN_AXE(ImmutableSet.of(ItemID.DRAGON_THROWNAXE, ItemID.DRAGON_THROWNAXE_21207), - 8292, -1, 25), - DRAGON_THROWN_KNIVES(ImmutableSet.of(ItemID.DRAGON_KNIFE, ItemID.DRAGON_KNIFE_22812, ItemID.DRAGON_KNIFE_22814, ItemID.DRAGON_KNIFEP_22808, ItemID.DRAGON_KNIFEP_22810), - 7521, -1, 25), - GRANITE_HAMMER(ImmutableSet.of(ItemID.GRANITE_HAMMER), - 1378, -1, 60), - GRANITE_MAUL(ImmutableSet.of(ItemID.GRANITE_MAUL, ItemID.GRANITE_MAUL_12848, ItemID.GRANITE_MAUL_20557), - 1667, -1, 50), - HEAVY_BALLISTA(ImmutableSet.of(ItemID.HEAVY_BALLISTA, ItemID.HEAVY_BALLISTA_23630), - 7556, -1, 65), - LIGHT_BALLISTA(ImmutableSet.of(ItemID.LIGHT_BALLISTA), - -1, -1, 65), - MAGIC_SHORTBOW(ImmutableSet.of(ItemID.MAGIC_SHORTBOW, ItemID.MAGIC_SHORTBOW_20558), - 1074, -1, 55), - MAGIC_SHORTBOW_I(ImmutableSet.of(ItemID.MAGIC_SHORTBOW_I), - 1074, -1, 50), - MORI_THROWN_AXE(ImmutableSet.of(ItemID.MORRIGANS_THROWING_AXE), - -1, -1, 50), - MORRI_JAVELIN(ImmutableSet.of(ItemID.MORRIGANS_JAVELIN, ItemID.MORRIGANS_JAVELIN_23619), - -1, -1, 50), - RUNE_CLAWS(ImmutableSet.of(ItemID.RUNE_CLAWS), - 923, -1, 25), - SARA_BLESSED_SWORD(ImmutableSet.of(ItemID.SARADOMINS_BLESSED_SWORD), - -1, -1, 65), - SARA_SWORD(ImmutableSet.of(ItemID.SARADOMIN_SWORD), - 1132, -1, 100), - SGS(ImmutableSet.of(ItemID.SARADOMIN_GODSWORD, ItemID.SARADOMIN_GODSWORD_OR), - -1, -1, 50), - STAFF_OF_LIGHT(ImmutableSet.of(ItemID.STAFF_OF_LIGHT), - -1, -1, 100), - STATIUS_WARHAMMER(ImmutableSet.of(ItemID.STATIUSS_WARHAMMER, ItemID.STATIUSS_WARHAMMER_23620), - -1, -1, 35), - TOXIC_STAFF(ImmutableSet.of(ItemID.TOXIC_STAFF_OF_THE_DEAD, ItemID.STAFF_OF_THE_DEAD, ItemID.STAFF_OF_THE_DEAD_23613), - 1720, -1, 100), - VESTA_LONGSWORD(ImmutableSet.of(ItemID.VESTAS_LONGSWORD, ItemID.VESTAS_LONGSWORD_23615), - -1, -1, 25), - VESTA_SPEAR(ImmutableSet.of(ItemID.VESTAS_SPEAR), - -1, -1, 50), - ZGS(ImmutableSet.of(ItemID.ZAMORAK_GODSWORD, ItemID.ZAMORAK_GODSWORD_OR), - 7638, -1, 50); - - private Set ID; - private int sourceAnim; - private int targetGfx; - private double specDrain; -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/emojis/Emoji.java b/runelite-client/src/main/java/net/runelite/client/plugins/emojis/Emoji.java deleted file mode 100644 index 16e27b1519..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/emojis/Emoji.java +++ /dev/null @@ -1,121 +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.client.plugins.emojis; - -import com.google.common.collect.ImmutableMap; -import java.awt.image.BufferedImage; -import java.util.Map; -import net.runelite.client.util.ImageUtil; - -enum Emoji -{ - SLIGHT_SMILE(":)"), - JOY("=')"), - COWBOY("3:)"), - BLUSH("^_^"), - SMILE(":D"), - GRINNING("=D"), - WINK(";)"), - STUCK_OUT_TONGUE_CLOSED_EYES("X-P"), - STUCK_OUT_TONGUE(":P"), - YUM("=P~"), - HUGGING(":D"), // >:D< - TRIUMPH(":"), // :> - THINKING(":-?"), - CONFUSED(":/"), - NEUTRAL_FACE("=|"), - EXPRESSIONLESS(":|"), - UNAMUSED(":-|"), - SLIGHT_FROWN(":("), - FROWNING2("=("), - CRY(":'("), - SOB(":_("), - FLUSHED(":$"), - ZIPPER_MOUTH(":-#"), - PERSEVERE("_"), // >_< - SUNGLASSES("8-)"), - INNOCENT("O:)"), - SMILING_IMP(":)"), // >:) - RAGE(":("), // >:( - HUSHED(":-O"), - OPEN_MOUTH(":O"), - SCREAM(":-@"), - SEE_NO_EVIL("X_X"), - DANCER("\\:D/"), - OK_HAND("(Ok)"), - THUMBSUP("(Y)"), - THUMBSDOWN("(N)"), - HEARTS("3"), // <3 - BROKEN_HEART("/3"), // "), // <>< - CAT(":3"), - DOG("=3"), - CRAB("V(;,;)V"), - FORK_AND_KNIFE("--E"), - COOKING("--(o)"), - PARTY_POPPER("@@@"), - EYES("O.O"), - SWEAT(";;"), - PILE_OF_POO("~@~"), - FIRE("(/\\)"), - ALIEN("(@.@)"), - EGGPLANT("8=D"), - WAVE("(^_^)/"), - HEART_EYES("(*.*)"), - FACEPALM("M-)"), - ; - - private static final Map emojiMap; - - private final String trigger; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (final Emoji emoji : values()) - { - builder.put(emoji.trigger, emoji); - } - - emojiMap = builder.build(); - } - - Emoji(String trigger) - { - this.trigger = trigger; - } - - BufferedImage loadImage() - { - return ImageUtil.getResourceStreamFromClass(getClass(), this.name().toLowerCase() + ".png"); - } - - static Emoji getEmoji(String trigger) - { - return emojiMap.get(trigger); - } -} 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 deleted file mode 100644 index 10e3663e17..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/emojis/EmojiPlugin.java +++ /dev/null @@ -1,229 +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.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 javax.inject.Singleton; -import joptsimple.internal.Strings; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.IndexedSprite; -import net.runelite.api.MessageNode; -import net.runelite.api.Player; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.OverheadTextChanged; -import net.runelite.client.chat.ChatMessageManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.util.ImageUtil; - -@PluginDescriptor( - name = "Emojis", - description = "Replaces common emoticons such as :) with their corresponding emoji in the chat", - enabledByDefault = false, - type = PluginType.MISCELLANEOUS -) -@Slf4j -@Singleton -public class EmojiPlugin extends Plugin -{ - private static final Pattern TAG_REGEXP = Pattern.compile("<[^>]*>"); - private static final Pattern WHITESPACE_REGEXP = Pattern.compile("[\\s\\u00A0]"); - - @Inject - private Client client; - - @Inject - private ChatMessageManager chatMessageManager; - - private int modIconsStart = -1; - - @Override - protected void startUp() - { - loadEmojiIcons(); - } - - @Subscribe - void onGameStateChanged(GameStateChanged gameStateChanged) - { - if (gameStateChanged.getGameState() == GameState.LOGGED_IN) - { - loadEmojiIcons(); - } - } - - private void loadEmojiIcons() - { - final IndexedSprite[] modIcons = client.getModIcons(); - if (modIconsStart != -1 || modIcons == null) - { - return; - } - - final Emoji[] emojis = Emoji.values(); - final IndexedSprite[] newModIcons = Arrays.copyOf(modIcons, modIcons.length + emojis.length); - modIconsStart = modIcons.length; - - for (int i = 0; i < emojis.length; i++) - { - final Emoji emoji = emojis[i]; - - try - { - final BufferedImage image = emoji.loadImage(); - final IndexedSprite sprite = ImageUtil.getImageIndexedSprite(image, client); - newModIcons[modIconsStart + i] = sprite; - } - catch (Exception ex) - { - log.warn("Failed to load the sprite for emoji " + emoji, ex); - } - } - - log.debug("Adding emoji icons"); - client.setModIcons(newModIcons); - } - - @Subscribe - void onChatMessage(ChatMessage chatMessage) - { - if (client.getGameState() != GameState.LOGGED_IN || modIconsStart == -1) - { - return; - } - - switch (chatMessage.getType()) - { - case PUBLICCHAT: - case MODCHAT: - case FRIENDSCHAT: - case PRIVATECHAT: - case PRIVATECHATOUT: - case MODPRIVATECHAT: - break; - default: - return; - } - - final MessageNode messageNode = chatMessage.getMessageNode(); - final String message = messageNode.getValue(); - final String updatedMessage = updateMessage(message); - - if (updatedMessage == null) - { - return; - } - - messageNode.setRuneLiteFormatMessage(updatedMessage); - chatMessageManager.update(messageNode); - client.refreshChat(); - } - - @Subscribe - private void onOverheadTextChanged(final OverheadTextChanged event) - { - if (!(event.getActor() instanceof Player)) - { - return; - } - - final String message = event.getOverheadText(); - final String updatedMessage = updateMessage(message); - - if (updatedMessage == null) - { - return; - } - - event.getActor().setOverheadText(updatedMessage); - } - - @Nullable - String updateMessage(final String message) - { - final String[] messageWords = WHITESPACE_REGEXP.split(message); - - boolean editedMessage = false; - for (int i = 0; i < messageWords.length; i++) - { - // Remove tags except for and - final String trigger = removeTags(messageWords[i]); - final Emoji emoji = Emoji.getEmoji(trigger); - - if (emoji == null) - { - continue; - } - - final int emojiId = modIconsStart + emoji.ordinal(); - - messageWords[i] = messageWords[i].replace(trigger, ""); - editedMessage = true; - } - - // If we haven't edited the message any, don't update it. - if (!editedMessage) - { - return null; - } - - 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/main/java/net/runelite/client/plugins/entityhider/EntityHiderConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/entityhider/EntityHiderConfig.java deleted file mode 100644 index 8acf35f881..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/entityhider/EntityHiderConfig.java +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.entityhider; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigTitleSection; -import net.runelite.client.config.Title; - -@ConfigGroup("entityhider") -public interface EntityHiderConfig extends Config -{ - @ConfigTitleSection( - keyName = "playersTitle", - name = "Other players", - description = "", - position = 1 - ) - default Title playersTitle() - { - return new Title(); - } - - @ConfigItem( - position = 2, - keyName = "hidePlayers", - name = "Hide Players", - description = "Configures whether or not players are hidden", - titleSection = "playersTitle" - ) - default boolean hidePlayers() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "hidePlayers2D", - name = "Hide Players 2D", - description = "Configures whether or not players 2D elements are hidden", - titleSection = "playersTitle" - ) - default boolean hidePlayers2D() - { - return true; - } - - @ConfigItem( - position = 4, - keyName = "hideSpecificPlayers", - name = "Hide Specific Players", - description = "Hides players you never wish to see.", - titleSection = "playersTitle" - ) - default String hideSpecificPlayers() - { - return ""; - } - - @ConfigItem( - position = 5, - keyName = "hideAttackers", - name = "Hide Attackers", - description = "Configures whether or not NPCs/players attacking you are hidden", - titleSection = "playersTitle" - ) - default boolean hideAttackers() - { - return false; - } - - @ConfigTitleSection( - keyName = "localPlayerTitle", - name = "Local player", - description = "", - position = 6 - ) - default Title localPlayerTitle() - { - return new Title(); - } - - @ConfigItem( - position = 7, - keyName = "hideLocalPlayer", - name = "Hide Local Player", - description = "Configures whether or not the local player is hidden", - titleSection = "localPlayerTitle" - ) - default boolean hideLocalPlayer() - { - return false; - } - - @ConfigItem( - position = 8, - keyName = "hideLocalPlayer2D", - name = "Hide Local Player 2D", - description = "Configures whether or not the local player's 2D elements are hidden", - titleSection = "localPlayerTitle" - ) - default boolean hideLocalPlayer2D() - { - return false; - } - - @ConfigTitleSection( - keyName = "friendsTitle", - name = "Friends / clan", - description = "", - position = 9 - ) - default Title friendsTitle() - { - return new Title(); - } - - @ConfigItem( - position = 10, - keyName = "hideFriends", - name = "Hide Friends", - description = "Configures whether or not friends are hidden", - titleSection = "friendsTitle" - ) - default boolean hideFriends() - { - return false; - } - - @ConfigItem( - position = 11, - keyName = "hideClanMates", - name = "Hide Clan Mates", - description = "Configures whether or not clan mates are hidden", - titleSection = "friendsTitle" - ) - default boolean hideClanMates() - { - return false; - } - - @ConfigTitleSection( - keyName = "npcsTitle", - name = "NPCs", - description = "", - position = 12 - ) - default Title npcsTitle() - { - return new Title(); - } - - @ConfigItem( - position = 13, - keyName = "hideNPCs", - name = "Hide NPCs", - description = "Configures whether or not NPCs are hidden", - titleSection = "npcsTitle" - ) - default boolean hideNPCs() - { - return false; - } - - @ConfigItem( - position = 14, - keyName = "hideNPCs2D", - name = "Hide NPCs 2D", - description = "Configures whether or not NPCs 2D elements are hidden", - titleSection = "npcsTitle" - ) - default boolean hideNPCs2D() - { - return false; - } - - @ConfigItem( - position = 15, - keyName = "hideNPCsNames", - name = "Hide NPCs Names", - description = "Configures which NPCs to hide", - titleSection = "npcsTitle" - ) - default String hideNPCsNames() - { - return ""; - } - - @ConfigItem( - position = 16, - keyName = "hideDeadNPCs", - name = "Hide Dead NPCs", - description = "Configures whether or not NPCs that just died are hidden", - titleSection = "npcsTitle" - ) - default boolean hideDeadNPCs() - { - return false; - } - - @ConfigItem( - position = 17, - keyName = "hideNPCsOnDeath", - name = "Hide NPCs On Death", - description = "Configures which NPCs to hide when they die", - titleSection = "npcsTitle" - ) - default String hideNPCsOnDeath() - { - return ""; - } - - @ConfigItem( - position = 18, - keyName = "blacklistDeadNpcs", - name = "Hide on Death Blacklist", - description = "Configures which NPCs NOT to hide when they die", - titleSection = "npcsTitle", - hidden = true, - unhide = "hideDeadNPCs" - ) - default String blacklistDeadNpcs() - { - return ""; - } - - @ConfigItem( - position = 19, - keyName = "hidePets", - name = "Hide Pets", - description = "Configures whether or not other player pets are hidden" - ) - default boolean hidePets() - { - return false; - } - - @ConfigTitleSection( - keyName = "miscTitle", - name = "Miscellaneous", - description = "", - position = 20 - ) - default Title miscTitle() - { - return new Title(); - } - - @ConfigItem( - position = 21, - keyName = "hideProjectiles", - name = "Hide Projectiles", - description = "Configures whether or not projectiles are hidden", - titleSection = "miscTitle" - ) - default boolean hideProjectiles() - { - 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 deleted file mode 100644 index 55e53be632..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/entityhider/EntityHiderPlugin.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * Copyright (c) 2019, ThatGamerBlue - * 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.client.plugins.entityhider; - -import com.google.inject.Provides; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.util.Text; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Entity Hider", - description = "Hide players, NPCs, and/or projectiles", - tags = {"npcs", "players", "projectiles"}, - enabledByDefault = false, - type = PluginType.UTILITY -) -@Singleton -public class EntityHiderPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private EntityHiderConfig config; - - @Provides - EntityHiderConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(EntityHiderConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - Text.fromCSV(config.hideNPCsNames()).forEach(client::addHiddenNpcName); - Text.fromCSV(config.hideNPCsOnDeath()).forEach(client::addHiddenNpcDeath); - } - - @Subscribe - public void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("entityhider")) - { - updateConfig(); - - final Set blacklist = new HashSet<>(); - - for (String s : Text.COMMA_SPLITTER.split(config.blacklistDeadNpcs())) - { - try - { - blacklist.add(Integer.parseInt(s)); - } - catch (NumberFormatException ignored) - { - } - - } - - client.setBlacklistDeadNpcs(blacklist); - - if (event.getOldValue() == null || event.getNewValue() == null) - { - return; - } - - if (event.getKey().equals("hideNPCsNames")) - { - List oldList = Text.fromCSV(event.getOldValue()); - List newList = Text.fromCSV(event.getNewValue()); - - List removed = oldList.stream().filter(s -> !newList.contains(s)).collect(Collectors.toCollection(ArrayList::new)); - List added = newList.stream().filter(s -> !oldList.contains(s)).collect(Collectors.toCollection(ArrayList::new)); - - removed.forEach(client::removeHiddenNpcName); - added.forEach(client::addHiddenNpcName); - } - - if (event.getKey().equals("hideNPCsOnDeath")) - { - List oldList = Text.fromCSV(event.getOldValue()); - List newList = Text.fromCSV(event.getNewValue()); - - ArrayList removed = oldList.stream().filter(s -> !newList.contains(s)).collect(Collectors.toCollection(ArrayList::new)); - ArrayList added = newList.stream().filter(s -> !oldList.contains(s)).collect(Collectors.toCollection(ArrayList::new)); - - removed.forEach(client::removeHiddenNpcDeath); - added.forEach(client::addHiddenNpcDeath); - } - } - } - - @Subscribe - public void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGGED_IN) - { - client.setIsHidingEntities(true); - } - } - - private void updateConfig() - { - client.setIsHidingEntities(true); - client.setPlayersHidden(config.hidePlayers()); - client.setPlayersHidden2D(config.hidePlayers2D()); - client.setHideSpecificPlayers(Text.fromCSV(config.hideSpecificPlayers())); - client.setFriendsHidden(config.hideFriends()); - client.setClanMatesHidden(config.hideClanMates()); - client.setLocalPlayerHidden(config.hideLocalPlayer()); - client.setLocalPlayerHidden2D(config.hideLocalPlayer2D()); - client.setNPCsHidden(config.hideNPCs()); - client.setNPCsHidden2D(config.hideNPCs2D()); - client.setPetsHidden(config.hidePets()); - client.setAttackersHidden(config.hideAttackers()); - client.setProjectilesHidden(config.hideProjectiles()); - client.setDeadNPCsHidden(config.hideDeadNPCs()); - } - - @Override - protected void shutDown() - { - client.setIsHidingEntities(false); - client.setPlayersHidden(false); - client.setPlayersHidden2D(false); - client.setFriendsHidden(false); - client.setClanMatesHidden(false); - client.setLocalPlayerHidden(false); - client.setLocalPlayerHidden2D(false); - client.setNPCsHidden(false); - client.setNPCsHidden2D(false); - client.setPetsHidden(false); - client.setAttackersHidden(false); - client.setProjectilesHidden(false); - client.setDeadNPCsHidden(false); - Text.fromCSV(config.hideNPCsNames()).forEach(client::removeHiddenNpcName); - Text.fromCSV(config.hideNPCsOnDeath()).forEach(client::removeHiddenNpcDeath); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/equipmentinspector/EquipmentInspectorConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/equipmentinspector/EquipmentInspectorConfig.java deleted file mode 100644 index 526a49144b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/equipmentinspector/EquipmentInspectorConfig.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.equipmentinspector; - -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("equipmentinspector") -public interface EquipmentInspectorConfig extends Config -{ - @ConfigItem( - keyName = "ShowValue", - name = "Show the total value of the items", - description = "shows the total value of the items", - position = 1 - ) - default boolean showValue() - { - return true; - } - - @Range( - min = 1, - max = 4 - ) - @ConfigItem( - keyName = "protecteditems", - name = "Protected Items", - description = "Limited to 4", - position = 2 - ) - default int protectedItems() - { - return 1; - } - - @ConfigItem( - keyName = "ExactValue", - name = "Show exact value", - description = "shows the excact gp value", - position = 3 - ) - default boolean exactValue() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/equipmentinspector/EquipmentInspectorPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/equipmentinspector/EquipmentInspectorPanel.java deleted file mode 100644 index c729aaae0f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/equipmentinspector/EquipmentInspectorPanel.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.equipmentinspector; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.util.HashMap; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.swing.BorderFactory; -import javax.swing.GroupLayout; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import javax.swing.border.CompoundBorder; -import javax.swing.border.EmptyBorder; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ItemDefinition; -import net.runelite.api.kit.KitType; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.util.AsyncBufferedImage; - -@Slf4j -@Singleton -class EquipmentInspectorPanel extends PluginPanel -{ - private final static String NO_PLAYER_SELECTED = "No player selected"; - - private final GridBagConstraints c; - private final JPanel equipmentPanels; - private final JPanel header; - private final JLabel nameLabel; - - @Inject - private ItemManager itemManager; - - public EquipmentInspectorPanel() - { - GroupLayout layout = new GroupLayout(this); - setLayout(layout); - setBorder(new EmptyBorder(10, 10, 10, 10)); - setBackground(ColorScheme.DARK_GRAY_COLOR); - - equipmentPanels = new JPanel(new GridBagLayout()); - c = new GridBagConstraints(); - c.fill = GridBagConstraints.HORIZONTAL; - c.weightx = 1; - c.gridx = 0; - c.gridy = 0; - header = new JPanel(); - header.setLayout(new BorderLayout()); - header.setBorder(new CompoundBorder( - BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(58, 58, 58)), - BorderFactory.createEmptyBorder(0, 0, 10, 0))); - - nameLabel = new JLabel(NO_PLAYER_SELECTED); - nameLabel.setForeground(Color.WHITE); - header.add(nameLabel, BorderLayout.CENTER); - layout.setHorizontalGroup(layout.createParallelGroup() - .addComponent(equipmentPanels) - .addComponent(header) - ); - layout.setVerticalGroup(layout.createSequentialGroup() - .addComponent(header) - .addGap(10) - .addComponent(equipmentPanels) - ); - update(new HashMap<>(), ""); - } - - public void update(Map playerEquipment, String playerName) - { - if (playerName.isEmpty()) - { - nameLabel.setText(NO_PLAYER_SELECTED); - } - else - { - nameLabel.setText("Player: " + playerName); - } - SwingUtilities.invokeLater(() -> - { - equipmentPanels.removeAll(); - playerEquipment.forEach((kitType, itemComposition) -> - { - AsyncBufferedImage itemImage = itemManager.getImage(itemComposition.getId()); - equipmentPanels.add(new ItemPanel(itemComposition, kitType, itemImage), c); - c.gridy++; - - }); - header.revalidate(); - header.repaint(); - } - ); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/equipmentinspector/EquipmentInspectorPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/equipmentinspector/EquipmentInspectorPlugin.java deleted file mode 100644 index bdb574111a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/equipmentinspector/EquipmentInspectorPlugin.java +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.equipmentinspector; - -import com.google.inject.Provides; -import java.awt.image.BufferedImage; -import java.lang.reflect.InvocationTargetException; -import java.text.NumberFormat; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.concurrent.ScheduledExecutorService; -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.swing.SwingUtilities; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.ItemDefinition; -import net.runelite.api.events.PlayerMenuOptionClicked; -import net.runelite.api.kit.KitType; -import net.runelite.api.util.Text; -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.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.PlayerContainer; -import net.runelite.client.game.PlayerManager; -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.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.QuantityFormatter; - -@PluginDescriptor( - name = "Equipment Inspector", - type = PluginType.PVP, - enabledByDefault = false -) -@Singleton -@Slf4j -public class EquipmentInspectorPlugin extends Plugin -{ - private static final String INSPECT_EQUIPMENT = "Gear"; - - @Inject - private Client client; - @Inject - private ItemManager itemManager; - @Inject - private EquipmentInspectorConfig config; - @Inject - private ChatMessageManager chatMessageManager; - @Inject - private MenuManager menuManager; - @Inject - private ScheduledExecutorService executor; - @Inject - private ClientToolbar pluginToolbar; - @Inject - private PlayerManager playerManager; - - private NavigationButton navButton; - private EquipmentInspectorPanel equipmentInspectorPanel; - private boolean showValue; - private int protectedItems; - private boolean exactValue; - - @Provides - EquipmentInspectorConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(EquipmentInspectorConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - equipmentInspectorPanel = injector.getInstance(EquipmentInspectorPanel.class); - if (client != null) - { - menuManager.addPlayerMenuItem(INSPECT_EQUIPMENT); - } - - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(this.getClass(), "normal.png"); - - navButton = NavigationButton.builder() - .tooltip("Equipment Inspector") - .icon(icon) - .priority(5) - .panel(equipmentInspectorPanel) - .build(); - - pluginToolbar.addNavigation(navButton); - - } - - @Override - protected void shutDown() - { - menuManager.removePlayerMenuItem(INSPECT_EQUIPMENT); - pluginToolbar.removeNavigation(navButton); - } - - @Subscribe - private void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event) - { - if (!event.getMenuOption().equals(INSPECT_EQUIPMENT)) - { - return; - } - - executor.execute(() -> - { - try - { - SwingUtilities.invokeAndWait(() -> - { - if (!navButton.isSelected()) - { - navButton.getOnSelect().run(); - } - }); - } - catch (InterruptedException | InvocationTargetException e) - { - throw new RuntimeException(e); - } - - String playerName = Text.removeTags(event.getMenuTarget()).replace('\u00A0', ' '); - final PlayerContainer player = playerManager.getPlayer(playerName); - final Map playerEquipment = new HashMap<>(); - - if (player == null) - { - return; - } - - for (KitType kitType : KitType.values()) - { - if (kitType == KitType.RING || kitType == KitType.AMMUNITION || - player.getPlayer().getPlayerAppearance() == null) - { - continue; - } - - final int itemId = player.getPlayer().getPlayerAppearance().getEquipmentId(kitType); - - if (itemId != -1) - { - ItemDefinition itemComposition = client.getItemDefinition(itemId); - playerEquipment.put(kitType, itemComposition); - } - } - - if (this.showValue) - { - final LinkedHashMap gear = new LinkedHashMap<>(player.getGear()); - removeEntries(gear, this.protectedItems); - - int risk = 0; - for (int value : gear.values()) - { - risk += value; - } - - String price; - - if (!this.exactValue) - { - price = QuantityFormatter.quantityToRSDecimalStack(risk); - } - else - { - price = NumberFormat.getIntegerInstance().format(risk); - } - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.CONSOLE) - .runeLiteFormattedMessage(new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append("Risked Value: ") - .append(ChatColorType.NORMAL) - .append(price) - .build()) - .build()); - } - equipmentInspectorPanel.update(playerEquipment, playerName); - }); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equalsIgnoreCase("equipmentinspector")) - { - updateConfig(); - } - } - - private static void removeEntries(LinkedHashMap map, int quantity) - { - for (int i = 0; i < quantity; i++) - { - if (!map.entrySet().iterator().hasNext()) - { - return; - } - map.entrySet().remove(map.entrySet().iterator().next()); - } - } - - private void updateConfig() - { - this.showValue = config.showValue(); - this.protectedItems = config.protectedItems(); - this.exactValue = config.exactValue(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/equipmentinspector/ItemPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/equipmentinspector/ItemPanel.java deleted file mode 100644 index 1ba38ee751..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/equipmentinspector/ItemPanel.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.equipmentinspector; - -import javax.swing.GroupLayout; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; -import net.runelite.api.ItemDefinition; -import net.runelite.api.kit.KitType; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.util.AsyncBufferedImage; -import org.apache.commons.lang3.StringUtils; - -class ItemPanel extends JPanel -{ - ItemPanel(ItemDefinition item, KitType kitType, AsyncBufferedImage icon) - { - - setBorder(new EmptyBorder(3, 3, 3, 3)); - setBackground(ColorScheme.DARK_GRAY_COLOR); - - GroupLayout layout = new GroupLayout(this); - this.setLayout(layout); - - JLabel name = new JLabel(item.getName()); - - JLabel location = new JLabel(StringUtils.capitalize(kitType.toString().toLowerCase())); - location.setFont(FontManager.getRunescapeSmallFont()); - - JLabel imageLabel = new JLabel(); - icon.addTo(imageLabel); - - layout.setVerticalGroup(layout.createParallelGroup() - .addComponent(imageLabel) - .addGroup(layout.createSequentialGroup() - .addComponent(name) - .addComponent(location) - ) - ); - - layout.setHorizontalGroup(layout.createSequentialGroup() - .addComponent(imageLabel) - .addGap(8) - .addGroup(layout.createParallelGroup() - .addComponent(name) - .addComponent(location) - ) - ); - - // AWT's Z order is weird. This put image at the back of the stack - setComponentZOrder(imageLabel, getComponentCount() - 1); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/examine/CacheKey.java b/runelite-client/src/main/java/net/runelite/client/plugins/examine/CacheKey.java deleted file mode 100644 index 623aa869e7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/examine/CacheKey.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2017, 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.examine; - -import java.util.Objects; - -class CacheKey -{ - private final ExamineType type; - private final int id; - - CacheKey(final ExamineType type, final int id) - { - this.type = type; - this.id = id; - } - - @Override - public int hashCode() - { - int hash = 3; - hash = 23 * hash + Objects.hashCode(this.type); - hash = 23 * hash + this.id; - return hash; - } - - @Override - public boolean equals(Object obj) - { - if (this == obj) - { - return true; - } - if (obj == null) - { - return false; - } - if (getClass() != obj.getClass()) - { - return false; - } - final CacheKey other = (CacheKey) obj; - if (this.id != other.id) - { - return false; - } - return this.type == other.type; - } -} 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 deleted file mode 100644 index c54399abcc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java +++ /dev/null @@ -1,443 +0,0 @@ -/* - * Copyright (c) 2017, 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.examine; - -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; -import java.time.Instant; -import java.util.ArrayDeque; -import java.util.Deque; -import java.util.concurrent.ScheduledExecutorService; -import java.util.regex.Pattern; -import javax.inject.Inject; -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.ItemDefinition; -import net.runelite.api.ItemID; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import static net.runelite.api.widgets.WidgetInfo.SEED_VAULT_ITEM_CONTAINER; -import static net.runelite.api.widgets.WidgetInfo.TO_CHILD; -import static net.runelite.api.widgets.WidgetInfo.TO_GROUP; -import net.runelite.api.widgets.WidgetItem; -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.eventbus.Subscribe; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.util.QuantityFormatter; -import net.runelite.http.api.examine.ExamineClient; - -/** - * Submits examine info to the api - * - * @author Adam - */ -@PluginDescriptor( - name = "Examine", - description = "Send examine information to the API", - tags = {"npcs", "items", "inventory", "objects"}, - type = PluginType.UTILITY -) -@Slf4j -@Singleton -public class ExaminePlugin extends Plugin -{ - private static final Pattern X_PATTERN = Pattern.compile("^\\d+ x "); - - private final Deque pending = new ArrayDeque<>(); - private final Cache cache = CacheBuilder.newBuilder() - .maximumSize(128L) - .build(); - - @Inject - private ExamineClient examineClient; - - @Inject - private Client client; - - @Inject - private ItemManager itemManager; - - @Inject - private ChatMessageManager chatMessageManager; - - @Inject - private ScheduledExecutorService executor; - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - pending.clear(); - } - - @Subscribe - void onMenuOptionClicked(MenuOptionClicked event) - { - if (!event.getOption().equals("Examine")) - { - return; - } - - ExamineType type; - int id, quantity = -1; - switch (event.getMenuOpcode()) - { - case EXAMINE_ITEM: - { - type = ExamineType.ITEM; - id = event.getIdentifier(); - - int widgetId = event.getParam1(); - int widgetGroup = TO_GROUP(widgetId); - int widgetChild = TO_CHILD(widgetId); - Widget widget = client.getWidget(widgetGroup, widgetChild); - WidgetItem widgetItem = widget.getWidgetItem(event.getParam0()); - quantity = widgetItem != null && widgetItem.getId() >= 0 ? widgetItem.getQuantity() : 1; - break; - } - case EXAMINE_ITEM_GROUND: - type = ExamineType.ITEM; - id = event.getIdentifier(); - break; - case CC_OP_LOW_PRIORITY: - { - type = ExamineType.ITEM_BANK_EQ; - int[] qi = findItemFromWidget(event.getParam1(), event.getParam0()); - if (qi == null) - { - log.debug("Examine for item with unknown widget: {}", event); - return; - } - quantity = qi[0]; - id = qi[1]; - break; - } - case EXAMINE_OBJECT: - type = ExamineType.OBJECT; - id = event.getIdentifier(); - break; - case EXAMINE_NPC: - type = ExamineType.NPC; - id = event.getIdentifier(); - break; - default: - return; - } - - PendingExamine pendingExamine = new PendingExamine(); - pendingExamine.setType(type); - pendingExamine.setId(id); - pendingExamine.setQuantity(quantity); - pendingExamine.setCreated(Instant.now()); - pending.push(pendingExamine); - } - - @Subscribe - void onChatMessage(ChatMessage event) - { - ExamineType type; - switch (event.getType()) - { - case ITEM_EXAMINE: - type = ExamineType.ITEM; - break; - case OBJECT_EXAMINE: - type = ExamineType.OBJECT; - break; - case NPC_EXAMINE: - type = ExamineType.NPC; - break; - case GAMEMESSAGE: - type = ExamineType.ITEM_BANK_EQ; - break; - default: - return; - } - - if (pending.isEmpty()) - { - log.debug("Got examine without a pending examine?"); - return; - } - - PendingExamine pendingExamine = pending.pop(); - - if (pendingExamine.getType() != type) - { - log.debug("Type mismatch for pending examine: {} != {}", pendingExamine.getType(), type); - pending.clear(); // eh - return; - } - - log.debug("Got examine for {} {}: {}", pendingExamine.getType(), pendingExamine.getId(), event.getMessage()); - - // If it is an item, show the price of it - final ItemDefinition itemDefinition; - if (pendingExamine.getType() == ExamineType.ITEM || pendingExamine.getType() == ExamineType.ITEM_BANK_EQ) - { - final int itemId = pendingExamine.getId(); - final int itemQuantity = pendingExamine.getQuantity(); - - if (itemId == ItemID.COINS_995) - { - return; - } - - itemDefinition = itemManager.getItemDefinition(itemId); - - if (itemDefinition != null) - { - final int id = itemManager.canonicalize(itemDefinition.getId()); - executor.submit(() -> getItemPrice(id, itemDefinition, itemQuantity)); - } - } - else - { - itemDefinition = null; - } - - // Don't submit examine info for tradeable items, which we already have from the RS item api - if (itemDefinition != null && itemDefinition.isTradeable()) - { - return; - } - - // Large quantities of items show eg. 100000 x Coins - if (type == ExamineType.ITEM && X_PATTERN.matcher(event.getMessage()).lookingAt()) - { - return; - } - - CacheKey key = new CacheKey(type, pendingExamine.getId()); - Boolean cached = cache.getIfPresent(key); - if (cached != null) - { - return; - } - - cache.put(key, Boolean.TRUE); - submitExamine(pendingExamine, event.getMessage()); - } - - private int[] findItemFromWidget(int widgetId, int actionParam) - { - int widgetGroup = TO_GROUP(widgetId); - int widgetChild = TO_CHILD(widgetId); - Widget widget = client.getWidget(widgetGroup, widgetChild); - - if (widget == null) - { - return null; - } - - if (WidgetInfo.EQUIPMENT.getGroupId() == widgetGroup) - { - Widget widgetItem = widget.getChild(1); - if (widgetItem != null) - { - return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()}; - } - } - else if (WidgetInfo.SMITHING_INVENTORY_ITEMS_CONTAINER.getGroupId() == widgetGroup) - { - Widget widgetItem = widget.getChild(2); - if (widgetItem != null) - { - return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()}; - } - } - else if (WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER.getGroupId() == widgetGroup - || WidgetInfo.RUNE_POUCH_ITEM_CONTAINER.getGroupId() == widgetGroup) - { - Widget widgetItem = widget.getChild(actionParam); - if (widgetItem != null) - { - return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()}; - } - } - else if (WidgetInfo.BANK_ITEM_CONTAINER.getGroupId() == widgetGroup - || WidgetInfo.CLUE_SCROLL_REWARD_ITEM_CONTAINER.getGroupId() == widgetGroup - || WidgetInfo.LOOTING_BAG_CONTAINER.getGroupId() == widgetGroup - || WidgetID.SEED_VAULT_INVENTORY_GROUP_ID == widgetGroup - || WidgetID.SEED_BOX_GROUP_ID == widgetGroup - || WidgetID.PLAYER_TRADE_SCREEN_GROUP_ID == widgetGroup - || WidgetID.PLAYER_TRADE_INVENTORY_GROUP_ID == widgetGroup) - { - Widget[] children = widget.getDynamicChildren(); - if (actionParam < children.length) - { - Widget widgetItem = children[actionParam]; - return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()}; - } - } - else if (WidgetInfo.SHOP_ITEMS_CONTAINER.getGroupId() == widgetGroup) - { - Widget[] children = widget.getDynamicChildren(); - if (actionParam < children.length) - { - Widget widgetItem = children[actionParam]; - return new int[]{1, widgetItem.getItemId()}; - } - } - else if (WidgetID.SEED_VAULT_GROUP_ID == widgetGroup) - { - Widget[] children = client.getWidget(SEED_VAULT_ITEM_CONTAINER).getDynamicChildren(); - if (actionParam < children.length) - { - Widget widgetItem = children[actionParam]; - return new int[]{widgetItem.getItemQuantity(), widgetItem.getItemId()}; - } - } - - return null; - } - - private void getItemPrice(int id, ItemDefinition itemComposition, int quantity) - { - // quantity is at least 1 - quantity = Math.max(1, quantity); - int itemCompositionPrice = itemComposition.getPrice(); - final long gePrice = itemManager.getItemPrice(id); - final long alchPrice = itemCompositionPrice <= 0 ? 0 : Math.round(itemCompositionPrice * Constants.HIGH_ALCHEMY_MULTIPLIER); - - if (gePrice > 0 || alchPrice > 0) - { - final ChatMessageBuilder message = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Price of ") - .append(ChatColorType.HIGHLIGHT); - - if (quantity > 1) - { - message - .append(QuantityFormatter.formatNumber(quantity)) - .append(" x "); - } - - message - .append(itemComposition.getName()) - .append(ChatColorType.NORMAL) - .append(":"); - - if (gePrice > 0) - { - int finalQuantity = quantity; - message - .append(ChatColorType.NORMAL) - .append(" GE ") - .append(ChatColorType.HIGHLIGHT) - .append(QuantityFormatter.formatNumber(gePrice * finalQuantity)); - - if (finalQuantity > 1) - { - message - .append(ChatColorType.NORMAL) - .append(" (") - .append(ChatColorType.HIGHLIGHT) - .append(QuantityFormatter.formatNumber(gePrice)) - .append(ChatColorType.NORMAL) - .append("ea)"); - } - - message - .append(ChatColorType.NORMAL) - .append(" HA value ") - .append(ChatColorType.HIGHLIGHT) - .append(QuantityFormatter.formatNumber(alchPrice * finalQuantity)); - - if (finalQuantity > 1) - { - message - .append(ChatColorType.NORMAL) - .append(" (") - .append(ChatColorType.HIGHLIGHT) - .append(QuantityFormatter.formatNumber(alchPrice)) - .append(ChatColorType.NORMAL) - .append("ea)"); - } - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.ITEM_EXAMINE) - .runeLiteFormattedMessage(message.build()) - .build()); - } - else - { - message - .append(ChatColorType.NORMAL) - .append(" HA value ") - .append(ChatColorType.HIGHLIGHT) - .append(QuantityFormatter.formatNumber(alchPrice * quantity)); - - if (quantity > 1) - { - message - .append(ChatColorType.NORMAL) - .append(" (") - .append(ChatColorType.HIGHLIGHT) - .append(QuantityFormatter.formatNumber(alchPrice)) - .append(ChatColorType.NORMAL) - .append("ea)"); - } - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.ITEM_EXAMINE) - .runeLiteFormattedMessage(message.build()) - .build()); - } - } - } - - private void submitExamine(PendingExamine examine, String text) - { - int id = examine.getId(); - - switch (examine.getType()) - { - case ITEM: - examineClient.submitItem(id, text); - break; - case OBJECT: - examineClient.submitObject(id, text); - break; - case NPC: - examineClient.submitNpc(id, text); - break; - } - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExamineType.java b/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExamineType.java deleted file mode 100644 index 947c17fee8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExamineType.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2017, 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.examine; - -public enum ExamineType -{ - ITEM, - ITEM_BANK_EQ, - NPC, - OBJECT -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/examine/PendingExamine.java b/runelite-client/src/main/java/net/runelite/client/plugins/examine/PendingExamine.java deleted file mode 100644 index 96b7389e06..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/examine/PendingExamine.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2017, 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.examine; - -import java.time.Instant; -import lombok.Data; - -@Data -class PendingExamine -{ - private ExamineType type; - private int id; - private int quantity; - private Instant created; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/DefaultColors.java b/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/DefaultColors.java deleted file mode 100644 index 5ac836435f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/DefaultColors.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2018, Cameron - * 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.experiencedrop; - -import java.awt.Color; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@AllArgsConstructor -enum DefaultColors -{ - WHITE(new Color(0xFF, 0xFF, 0xFF)), - LILAC(new Color(0xC8, 0xC8, 0xFF)), - CYAN(new Color(0x00, 0xFF, 0xFF)), - JADE(new Color(0xC8, 0xFF, 0xC8)), - LIME(new Color(0x64, 0xFF, 0x64)), - YELLOW(new Color(0xFF, 0xFF, 0x40)), - ORANGE(new Color(0xFF, 0x98, 0x1F)), - PINK(new Color(0xFF, 0xC8, 0xC8)); - - @Getter(AccessLevel.PACKAGE) - private final Color color; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/PrayerType.java b/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/PrayerType.java deleted file mode 100644 index 2f1bf310bb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/PrayerType.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2018, 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.experiencedrop; - -enum PrayerType -{ - MELEE, - RANGE, - MAGIC -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropConfig.java deleted file mode 100644 index 62d5e4937b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropConfig.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2018, Cameron - * 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.experiencedrop; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("xpdrop") -public interface XpDropConfig extends Config -{ - enum DamageMode - { - NONE, - ABOVE_OPPONENT, - IN_XP_DROP - } - - @ConfigItem( - keyName = "hideSkillIcons", - name = "Hide skill icons", - description = "Configure if XP drops will show their respective skill icons", - position = 0 - ) - default boolean hideSkillIcons() - { - return false; - } - - @ConfigItem( - keyName = "meleePrayerColor", - name = "Melee Prayer Color", - description = "XP drop color when a melee prayer is active", - position = 1 - ) - default Color getMeleePrayerColor() - { - return new Color(0x15, 0x80, 0xAD); - } - - @ConfigItem( - keyName = "rangePrayerColor", - name = "Range Prayer Color", - description = "XP drop color when a range prayer is active", - position = 2 - ) - default Color getRangePrayerColor() - { - return new Color(0x15, 0x80, 0xAD); - } - - @ConfigItem( - keyName = "magePrayerColor", - name = "Mage Prayer Color", - description = "XP drop color when a mage prayer is active", - position = 3 - ) - default Color getMagePrayerColor() - { - return new Color(0x15, 0x80, 0xAD); - } - - @ConfigItem( - keyName = "fakeXpDropDelay", - name = "Fake Xp Drop delay", - description = "Configures how many ticks should pass between fake XP drops, 0 to disable", - position = 4 - ) - default int fakeXpDropDelay() - { - return 0; - } - - @ConfigItem( - keyName = "showdamagedrops", - name = "Show Damage on XP Drop", - description = "Show what you hit next to the XP drop", - position = 5 - ) - default DamageMode showdamagedrops() - { - return DamageMode.NONE; - } - - @ConfigItem( - keyName = "damageColor", - name = "Damage Color", - description = "The color you want the text to be for damage", - position = 6 - ) - default Color getDamageColor() - { - return Color.RED; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropOverlay.java deleted file mode 100644 index ee6ee0f26e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropOverlay.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2017, honeyhoney - * 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.experiencedrop; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Actor; -import net.runelite.api.Point; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; -import net.runelite.client.ui.overlay.OverlayUtil; - -@Singleton -class XpDropOverlay extends Overlay -{ - private final XpDropPlugin plugin; - - @Inject - private XpDropOverlay(final XpDropPlugin plugin) - { - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.MED); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.getTickShow() > 0) - { - final Actor opponent = plugin.getLastOpponent(); - if (opponent != null) - { - int offset = opponent.getLogicalHeight() + 50; - String damageStr = String.valueOf(plugin.getDamage()); - Point textLocation = opponent.getCanvasTextLocation(graphics, damageStr, offset); - - if (textLocation != null && plugin.getDamage() != 0) - { - OverlayUtil.renderTextLocation(graphics, textLocation, damageStr, plugin.getDamageColor()); - } - } - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropPlugin.java deleted file mode 100644 index 5c552c7385..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropPlugin.java +++ /dev/null @@ -1,449 +0,0 @@ -/* - * Copyright (c) 2019, Owain van Brakel - * Copyright (c) 2019, TheStonedTurtle - * Copyright (c) 2018, Cameron , SoyChai - * 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.experiencedrop; - -import com.google.inject.Provides; -import java.awt.Color; -import java.util.Arrays; -import java.util.stream.IntStream; -import javax.inject.Inject; -import javax.inject.Singleton; -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 static net.runelite.api.ScriptID.XPDROP_DISABLED; -import net.runelite.api.Skill; -import net.runelite.api.SpriteID; -import net.runelite.api.Varbits; -import net.runelite.api.WorldType; -import net.runelite.api.events.FakeXpDrop; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.api.events.WidgetHiddenChanged; -import net.runelite.api.widgets.Widget; -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.events.ConfigChanged; -import net.runelite.client.game.NPCManager; -import net.runelite.client.game.XpDropEvent; -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.ColorUtil; - -@PluginDescriptor( - name = "XP Drop", - description = "Enable customization of the way XP drops are displayed", - tags = {"experience", "levels", "tick"}, - type = PluginType.UTILITY -) -@Singleton -public class XpDropPlugin extends Plugin -{ - private static final int XPDROP_PADDING = 2; // space between xp drop icons - private static final double HITPOINT_RATIO = 1.33; // Base rate of hp xp per point damage - private static final double DMM_MULTIPLIER_RATIO = 10; - - @Inject - private Client client; - - @Inject - private XpDropConfig config; - - @Inject - private NPCManager npcManager; - - @Inject - private OverlayManager overlayManager; - - @Inject - private XpDropOverlay overlay; - - @Getter(AccessLevel.PACKAGE) - private int damage = 0; - - @Getter(AccessLevel.PACKAGE) - private int tickShow = 0; - - @Getter(AccessLevel.PACKAGE) - private Actor lastOpponent; - - private int tickCounter = 0; - private int previousExpGained; - private boolean hasDropped = false; - private boolean correctPrayer; - private Skill lastSkill = null; - private PrayerType currentTickPrayer; - private XpDropConfig.DamageMode damageMode; - private boolean hideSkillIcons; - private Color getMeleePrayerColor; - private Color getRangePrayerColor; - private Color getMagePrayerColor; - private int fakeXpDropDelay; - private XpDropConfig.DamageMode showdamagedrops; - - @Getter(AccessLevel.PACKAGE) - private Color damageColor; - - @Provides - XpDropConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(XpDropConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - damageMode = config.showdamagedrops(); - - if (damageMode == XpDropConfig.DamageMode.ABOVE_OPPONENT) - { - overlayManager.add(overlay); - } - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - } - - @Subscribe - private void onXpDropEvent(XpDropEvent event) - { - previousExpGained = event.getExp(); - lastSkill = event.getSkill(); - hasDropped = true; - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("xpdrop")) - { - return; - } - - updateConfig(); - - if (damageMode != XpDropConfig.DamageMode.ABOVE_OPPONENT) - { - damageMode = this.showdamagedrops; - - if (damageMode == XpDropConfig.DamageMode.ABOVE_OPPONENT) - { - overlayManager.add(overlay); - } - } - else - { - damageMode = this.showdamagedrops; - - if (damageMode != XpDropConfig.DamageMode.ABOVE_OPPONENT) - { - overlayManager.remove(overlay); - } - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - tickShow = 0; - damage = 0; - } - - @Subscribe - private void onWidgetHiddenChanged(WidgetHiddenChanged event) - { - Widget widget = event.getWidget(); - - int group = WidgetInfo.TO_GROUP(widget.getId()); - - if (group != WidgetID.EXPERIENCE_DROP_GROUP_ID) - { - return; - } - - if (widget.isHidden()) - { - return; - } - - if (this.hideSkillIcons) - { - if (widget.getSpriteId() > 0) - { - widget.setHidden(true); - return; - } - else if (!widget.getText().isEmpty()) - { - // Align text accordingly to take up hidden skill icon space - int width = 0; - for (Widget w : widget.getParent().getDynamicChildren()) - { - if (w.getSpriteId() != -1) - { - if (width > 0) - { - // Add in space between sprites - width += XPDROP_PADDING; - } - width += w.getWidth(); // width of sprite - } - } - - final int xpDropPosition = client.getVar(Varbits.EXPERIENCE_TRACKER_POSITION); - switch (xpDropPosition) - { - case 2: // left - int cur = widget.getRelativeX(); - cur -= width; - widget.setRelativeX(cur); - break; - case 0: // right - break; - case 1: // center - cur = widget.getRelativeX(); - cur -= width / 2; - widget.setRelativeX(cur); - break; - } - } - } - - PrayerType prayer = currentTickPrayer; - if (prayer == null) - { - resetTextColor(widget); - return; - } - - String text = widget.getText(); - final IntStream spriteIDs = - Arrays.stream(widget.getParent().getDynamicChildren()).mapToInt(Widget::getSpriteId); - - if (text != null) - { - int color = widget.getTextColor(); - - switch (prayer) - { - case MELEE: - if (spriteIDs.anyMatch( - id -> - id == SpriteID.SKILL_ATTACK - || id == SpriteID.SKILL_STRENGTH - || id == SpriteID.SKILL_DEFENCE - || correctPrayer)) - { - color = this.getMeleePrayerColor.getRGB(); - correctPrayer = true; - } - break; - case RANGE: - if (spriteIDs.anyMatch(id -> id == SpriteID.SKILL_RANGED || correctPrayer)) - { - color = this.getRangePrayerColor.getRGB(); - correctPrayer = true; - } - break; - case MAGIC: - if (spriteIDs.anyMatch(id -> id == SpriteID.SKILL_MAGIC || correctPrayer)) - { - color = this.getMagePrayerColor.getRGB(); - correctPrayer = true; - } - break; - } - - widget.setTextColor(color); - } - } - - private void resetTextColor(Widget widget) - { - int defaultColorIdx = client.getVar(Varbits.EXPERIENCE_DROP_COLOR); - int defaultColor = DefaultColors.values()[defaultColorIdx].getColor().getRGB(); - widget.setTextColor(defaultColor); - } - - private PrayerType getActivePrayerType() - { - for (XpPrayer prayer : XpPrayer.values()) - { - if (client.isPrayerActive(prayer.getPrayer())) - { - return prayer.getType(); - } - } - return null; - } - - @Subscribe - private void onGameTick(GameTick tick) - { - lastOpponent = client.getLocalPlayer().getInteracting(); - - if (tickShow > 0) - { - tickShow--; - } - - currentTickPrayer = getActivePrayerType(); - correctPrayer = false; - - final int fakeTickDelay = this.fakeXpDropDelay; - - if (fakeTickDelay == 0 || lastSkill == null) - { - return; - } - - // If an xp drop was created this tick, reset the counter - if (hasDropped) - { - hasDropped = false; - tickCounter = 0; - return; - } - - if (++tickCounter % fakeTickDelay != 0) - { - return; - } - - client.runScript(XPDROP_DISABLED, lastSkill.ordinal(), previousExpGained); - } - - @Subscribe - private void onFakeXpDrop(FakeXpDrop fakeXpDrop) - { - if (fakeXpDrop.getSkill() == Skill.HITPOINTS) - { - calculateDamageDealt(fakeXpDrop.getXp()); - } - } - - @Subscribe - private void onScriptCallbackEvent(ScriptCallbackEvent e) - { - if (this.showdamagedrops == XpDropConfig.DamageMode.NONE) - { - return; - } - - final String eventName = e.getEventName(); - - if (eventName.equals("newXpDrop")) - { - damage = 0; - } - else if (eventName.equals("hpXpGained")) - { - final int[] intStack = client.getIntStack(); - final int intStackSize = client.getIntStackSize(); - - final int exp = intStack[intStackSize - 1]; - calculateDamageDealt(exp); - } - else if (eventName.equals("xpDropAddDamage") - && damageMode == XpDropConfig.DamageMode.IN_XP_DROP - && damage > 0) - { - final String[] stringStack = client.getStringStack(); - final int stringStackSize = client.getStringStackSize(); - - String builder = - stringStack[stringStackSize - 1] - + ColorUtil.colorTag(this.damageColor) - + " (" - + damage - + ")"; - stringStack[stringStackSize - 1] = builder; - } - } - - private void calculateDamageDealt(int diff) - { - double damageDealt = diff / HITPOINT_RATIO; - - // DeadMan mode has an XP modifier of 10x - 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) && !(a instanceof Player)) - { - // If we are interacting with nothing we may have clicked away at the perfect time fall back - // to last tick - if (!(lastOpponent instanceof NPC) && !(lastOpponent instanceof Player)) - { - damage = (int) Math.rint(damageDealt); - tickShow = 3; - return; - } - - a = lastOpponent; - } - - if (a instanceof Player) - { - damage = (int) Math.rint(damageDealt); - tickShow = 3; - return; - } - - NPC target = (NPC) a; - damage = (int) Math.rint(damageDealt / npcManager.getXpModifier(target.getId())); - tickShow = 3; - } - - private void updateConfig() - { - this.hideSkillIcons = config.hideSkillIcons(); - this.getMeleePrayerColor = config.getMeleePrayerColor(); - this.getRangePrayerColor = config.getRangePrayerColor(); - this.getMagePrayerColor = config.getMagePrayerColor(); - this.fakeXpDropDelay = config.fakeXpDropDelay(); - this.showdamagedrops = config.showdamagedrops(); - this.damageColor = config.getDamageColor(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpPrayer.java b/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpPrayer.java deleted file mode 100644 index a3651267d9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpPrayer.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2018, 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.experiencedrop; - -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Prayer; -import static net.runelite.api.Prayer.*; -import static net.runelite.client.plugins.experiencedrop.PrayerType.MAGIC; -import static net.runelite.client.plugins.experiencedrop.PrayerType.MELEE; -import static net.runelite.client.plugins.experiencedrop.PrayerType.RANGE; - -enum XpPrayer -{ - XP_BURST_OF_STRENGTH(BURST_OF_STRENGTH, MELEE), - XP_CLARITY_OF_THOUGHT(CLARITY_OF_THOUGHT, MELEE), - XP_SHARP_EYE(SHARP_EYE, RANGE), - XP_MYSTIC_WILL(MYSTIC_WILL, MAGIC), - XP_SUPERHUMAN_STRENGTH(SUPERHUMAN_STRENGTH, MELEE), - XP_IMPROVED_REFLEXES(IMPROVED_REFLEXES, MELEE), - XP_HAWK_EYE(HAWK_EYE, RANGE), - XP_MYSTIC_LORE(MYSTIC_LORE, MAGIC), - XP_ULTIMATE_STRENGTH(ULTIMATE_STRENGTH, MELEE), - XP_INCREDIBLE_REFLEXES(INCREDIBLE_REFLEXES, MELEE), - XP_EAGLE_EYE(EAGLE_EYE, RANGE), - XP_MYSTIC_MIGHT(MYSTIC_MIGHT, MAGIC), - XP_CHIVALRY(CHIVALRY, MELEE), - XP_PIETY(PIETY, MELEE), - XP_RIGOUR(RIGOUR, RANGE), - XP_AUGURY(AUGURY, MAGIC); - - @Getter(AccessLevel.PACKAGE) - private final Prayer prayer; - @Getter(AccessLevel.PACKAGE) - private final PrayerType type; - - XpPrayer(Prayer prayer, PrayerType type) - { - this.prayer = prayer; - this.type = type; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fairyring/FairyRingConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/fairyring/FairyRingConfig.java deleted file mode 100644 index 131e36e6c1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fairyring/FairyRingConfig.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.fairyring; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("fairyrings") -public interface FairyRingConfig extends Config -{ - @ConfigItem( - keyName = "autoOpen", - name = "Open search automatically", - description = "Open the search widget every time you enter a fairy ring" - ) - default boolean autoOpen() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fairyring/FairyRingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/fairyring/FairyRingPlugin.java deleted file mode 100644 index d08810b03d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fairyring/FairyRingPlugin.java +++ /dev/null @@ -1,388 +0,0 @@ -/* - * Copyright (c) 2018 Abex - * Copyright (c) 2017, Tyler - * Copyright (c) 2018, Yoav Ram - * Copyright (c) 2018, Infinitay - * 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.fairyring; - -import com.google.common.base.Strings; -import com.google.inject.Provides; -import java.util.Collection; -import java.util.Map; -import java.util.TreeMap; -import javax.annotation.Nullable; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.ScriptEvent; -import net.runelite.api.ScriptID; -import net.runelite.api.SoundEffectID; -import net.runelite.api.SpriteID; -import net.runelite.api.Varbits; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.JavaScriptCallback; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.api.widgets.WidgetType; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.chatbox.ChatboxPanelManager; -import net.runelite.client.game.chatbox.ChatboxTextInput; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@Slf4j -@PluginDescriptor( - name = "Fairy Rings", - description = "Show the location of the fairy ring teleport", - tags = {"teleportation"}, - type = PluginType.UTILITY -) -@Singleton -public class FairyRingPlugin extends Plugin -{ - private static final String[] leftDial = new String[]{"A", "D", "C", "B"}; - private static final String[] middleDial = new String[]{"I", "L", "K", "J"}; - private static final String[] rightDial = new String[]{"P", "S", "R", "Q"}; - - private static final int ENTRY_PADDING = 3; - - private static final String MENU_OPEN = "Open"; - private static final String MENU_CLOSE = "Close"; - - @Inject - private Client client; - - @Inject - private FairyRingConfig config; - - @Inject - private ChatboxPanelManager chatboxPanelManager; - - @Inject - private ClientThread clientThread; - - private ChatboxTextInput searchInput = null; - private Widget searchBtn; - private Collection codes = null; - - private boolean autoOpen; - - @Data - private static class CodeWidgets - { - // The fairy hideout has both of these null, because its not the same as the rest of them - @Nullable - private Widget favorite; - - @Nullable - private Widget code; - - private Widget description; - } - - @Override - protected void startUp() - { - this.autoOpen = config.autoOpen(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("fairyrings")) - { - return; - } - - this.autoOpen = config.autoOpen(); - } - - @Provides - FairyRingConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(FairyRingConfig.class); - } - - @Subscribe - private void onVarbitChanged(VarbitChanged event) - { - setWidgetTextToDestination(); - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded widgetLoaded) - { - if (widgetLoaded.getGroupId() == WidgetID.FAIRY_RING_PANEL_GROUP_ID) - { - setWidgetTextToDestination(); - - Widget header = client.getWidget(WidgetInfo.FAIRY_RING_HEADER); - if (header != null) - { - searchBtn = header.createChild(-1, WidgetType.GRAPHIC); - searchBtn.setSpriteId(SpriteID.GE_SEARCH); - searchBtn.setOriginalWidth(17); - searchBtn.setOriginalHeight(17); - searchBtn.setOriginalX(11); - searchBtn.setOriginalY(11); - searchBtn.setHasListener(true); - searchBtn.setAction(1, MENU_OPEN); - searchBtn.setOnOpListener((JavaScriptCallback) this::menuOpen); - searchBtn.setName("Search"); - searchBtn.revalidate(); - - codes = null; - - if (this.autoOpen) - { - openSearch(); - } - } - } - } - - private void menuOpen(ScriptEvent e) - { - openSearch(); - client.playSoundEffect(SoundEffectID.UI_BOOP); - } - - private void menuClose(ScriptEvent e) - { - updateFilter(""); - chatboxPanelManager.close(); - client.playSoundEffect(SoundEffectID.UI_BOOP); - } - - private void setWidgetTextToDestination() - { - Widget fairyRingTeleportButton = client.getWidget(WidgetInfo.FAIRY_RING_TELEPORT_BUTTON); - if (fairyRingTeleportButton != null && !fairyRingTeleportButton.isHidden()) - { - String destination; - try - { - FairyRings fairyRingDestination = getFairyRingDestination(client.getVar(Varbits.FAIRY_RING_DIAL_ADCB), - client.getVar(Varbits.FAIRY_RIGH_DIAL_ILJK), client.getVar(Varbits.FAIRY_RING_DIAL_PSRQ)); - destination = fairyRingDestination.getDestination(); - } - catch (IllegalArgumentException ex) - { - destination = "Invalid location"; - } - - fairyRingTeleportButton.setText(destination); - } - } - - private FairyRings getFairyRingDestination(int varbitValueDialLeft, int varbitValueDialMiddle, int varbitValueDialRight) - { - return FairyRings.valueOf(leftDial[varbitValueDialLeft] + middleDial[varbitValueDialMiddle] + rightDial[varbitValueDialRight]); - } - - private void openSearch() - { - updateFilter(""); - searchBtn.setAction(1, MENU_CLOSE); - searchBtn.setOnOpListener((JavaScriptCallback) this::menuClose); - searchInput = chatboxPanelManager.openTextInput("Filter fairy rings") - .onChanged(s -> clientThread.invokeLater(() -> updateFilter(s))) - .onClose(() -> - { - clientThread.invokeLater(() -> updateFilter("")); - searchBtn.setOnOpListener((JavaScriptCallback) this::menuOpen); - searchBtn.setAction(1, MENU_OPEN); - }) - .build(); - } - - @Subscribe - private void onGameTick(GameTick t) - { - // This has to happen because the only widget that gets hidden is the tli one - Widget fairyRingTeleportButton = client.getWidget(WidgetInfo.FAIRY_RING_TELEPORT_BUTTON); - boolean fairyRingWidgetOpen = fairyRingTeleportButton != null && !fairyRingTeleportButton.isHidden(); - boolean chatboxOpen = searchInput != null && chatboxPanelManager.getCurrentInput() == searchInput; - - if (!fairyRingWidgetOpen && chatboxOpen) - { - chatboxPanelManager.close(); - } - } - - private void updateFilter(String filter) - { - filter = filter.toLowerCase(); - final Widget list = client.getWidget(WidgetInfo.FAIRY_RING_LIST); - final Widget favorites = client.getWidget(WidgetInfo.FAIRY_RING_FAVORITES); - - if (list == null) - { - return; - } - - if (codes != null && - // Check to make sure the list hasn't been rebuild since we were last her - // Do this by making sure the list's dynamic children are the same as when we last saw them - codes.stream().noneMatch(w -> - { - Widget codeWidget = w.getCode(); - if (codeWidget == null) - { - return false; - } - return list.getChild(codeWidget.getIndex()) == codeWidget; - })) - { - codes = null; - } - - if (codes == null) - { - // Find all of the widgets that we care about, grouping by their Y value - Map codeMap = new TreeMap<>(); - - for (Widget w : list.getStaticChildren()) - { - if (w.isSelfHidden()) - { - continue; - } - - if (w.getSpriteId() != -1) - { - codeMap.computeIfAbsent(w.getRelativeY(), k -> new CodeWidgets()).setFavorite(w); - } - else if (!Strings.isNullOrEmpty(w.getText())) - { - codeMap.computeIfAbsent(w.getRelativeY(), k -> new CodeWidgets()).setDescription(w); - } - } - - for (Widget w : list.getDynamicChildren()) - { - if (w.isSelfHidden()) - { - continue; - } - - CodeWidgets c = codeMap.computeIfAbsent(w.getRelativeY(), k -> new CodeWidgets()); - c.setCode(w); - } - - codes = codeMap.values(); - } - - // Relayout the panel - int y = 0; - - if (favorites != null) - { - boolean hide = !filter.isEmpty(); - favorites.setHidden(hide); - if (!hide) - { - y += favorites.getOriginalHeight() + ENTRY_PADDING; - } - } - - for (CodeWidgets c : codes) - { - String code = Text.removeTags(c.getDescription().getName()).replaceAll(" ", ""); - String tags = null; - - if (!code.isEmpty()) - { - try - { - FairyRings ring = FairyRings.valueOf(code); - tags = ring.getTags(); - } - catch (IllegalArgumentException e) - { - log.warn("Unable to find ring with code '{}'", code, e); - } - } - - boolean hidden = !(filter.isEmpty() - || Text.removeTags(c.getDescription().getText()).toLowerCase().contains(filter) - || code.toLowerCase().contains(filter) - || tags != null && tags.contains(filter)); - - if (c.getCode() != null) - { - c.getCode().setHidden(hidden); - c.getCode().setOriginalY(y); - } - - if (c.getFavorite() != null) - { - c.getFavorite().setHidden(hidden); - c.getFavorite().setOriginalY(y); - } - - c.getDescription().setHidden(hidden); - c.getDescription().setOriginalY(y); - - if (!hidden) - { - y += c.getDescription().getHeight() + ENTRY_PADDING; - } - } - - y -= ENTRY_PADDING; - - if (y < 0) - { - y = 0; - } - - int newHeight = 0; - if (list.getScrollHeight() > 0) - { - newHeight = (list.getScrollY() * y) / list.getScrollHeight(); - } - - list.setScrollHeight(y); - list.revalidateScroll(); - client.runScript( - ScriptID.UPDATE_SCROLLBAR, - WidgetInfo.FAIRY_RING_LIST_SCROLLBAR.getId(), - WidgetInfo.FAIRY_RING_LIST.getId(), - newHeight - ); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fairyring/FairyRings.java b/runelite-client/src/main/java/net/runelite/client/plugins/fairyring/FairyRings.java deleted file mode 100644 index 9cc44b44b5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fairyring/FairyRings.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2018, Yoav Ram - * Copyright (c) 2018, Infinitay - * 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.fairyring; - -import lombok.AccessLevel; -import lombok.Getter; - -public enum FairyRings -{ - // A - AIQ("Mudskipper Point"), - AIR("(Island) South-east of Ardougne"), - AJQ("Cave south of Dorgesh-Kaan"), - AJR("Slayer cave"), - AJS("Penguins near Miscellania"), - AKQ("Piscatoris Hunter area"), - AKS("Feldip Hunter area"), - ALP("(Island) Lighthouse"), - ALQ("Haunted Woods east of Canifis"), - ALR("Abyssal Area"), - ALS("McGrubor's Wood"), - - // B - BIP("(Island) South-west of Mort Myre"), - BIQ("Kalphite Hive"), - BIS("Ardougne Zoo - Unicorns"), - BJR("Realm of the Fisher King"), - BJS("(Island) Near Zul-Andra", "zulrah"), - BKP("South of Castle Wars"), - BKQ("Enchanted Valley"), - BKR("Mort Myre Swamp, south of Canifis"), - BKS("Zanaris"), - BLP("TzHaar area"), - BLR("Legends' Guild"), - - // C - CIP("(Island) Miscellania"), - CIQ("North-west of Yanille"), - CIS("North of the Arceuus Library"), - CIR("North-east of the Farming Guild", "mount karuulm konar"), - CJR("Sinclair Mansion (east)"), - CKP("Cosmic entity's plane"), - CKR("South of Tai Bwo Wannai Village"), - CKS("Canifis"), - CLP("(Island) South of Draynor Village"), - CLR("(Island) Ape Atoll"), - CLS("(Island) Hazelmere's home"), - - // D - DIP("(Sire Boss) Abyssal Nexus"), - DIR("Gorak's Plane"), - DIQ("Player-owned house", "poh home"), - DIS("Wizards' Tower"), - DJP("Tower of Life"), - DJR("Chasm of Fire"), - DKP("South of Musa Point"), - DKR("Edgeville, Grand Exchange"), - DKS("Polar Hunter area"), - DLQ("North of Nardah"), - DLR("(Island) Poison Waste south of Isafdar"), - DLS("Myreque hideout under The Hollows"); - - @Getter(AccessLevel.PACKAGE) - private final String destination; - - @Getter(AccessLevel.PACKAGE) - private final String tags; - - FairyRings(String destination) - { - this(destination, ""); - } - - FairyRings(String destination, String tags) - { - this.destination = destination; - this.tags = tags.toLowerCase() + " " + destination.toLowerCase(); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedConfig.java deleted file mode 100644 index 74ed8cf97c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedConfig.java +++ /dev/null @@ -1,42 +0,0 @@ -package net.runelite.client.plugins.feed; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("feed") -public interface FeedConfig extends Config -{ - @ConfigItem( - keyName = "includeBlogPosts", - name = "Include Blog Posts", - description = "Configures whether blog posts are displayed", - position = 0 - ) - default boolean includeBlogPosts() - { - return true; - } - - @ConfigItem( - keyName = "includeTweets", - name = "Include Tweets", - description = "Configures whether tweets are displayed", - position = 1 - ) - default boolean includeTweets() - { - return true; - } - - @ConfigItem( - keyName = "includeOsrsNews", - name = "Include OSRS News", - description = "Configures whether OSRS news are displayed", - position = 2 - ) - default boolean includeOsrsNews() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedPanel.java deleted file mode 100644 index 0fb4bfb418..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedPanel.java +++ /dev/null @@ -1,345 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * Copyright (c) 2018, Psikoi - * 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.feed; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.GridLayout; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.font.FontRenderContext; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.time.Duration; -import java.time.Instant; -import java.util.Comparator; -import java.util.function.Supplier; -import javax.imageio.ImageIO; -import javax.inject.Singleton; -import javax.swing.Box; -import javax.swing.BoxLayout; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import javax.swing.UIManager; -import javax.swing.border.EmptyBorder; -import lombok.extern.slf4j.Slf4j; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.LinkBrowser; -import net.runelite.http.api.RuneLiteAPI; -import net.runelite.http.api.feed.FeedItem; -import net.runelite.http.api.feed.FeedItemType; -import net.runelite.http.api.feed.FeedResult; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; - -@Slf4j -@Singleton -class FeedPanel extends PluginPanel -{ - private static final ImageIcon RUNELITE_ICON; - private static final ImageIcon OSRS_ICON; - - private static final Color TWEET_BACKGROUND = new Color(15, 15, 15); - private static final Color OSRS_NEWS_BACKGROUND = new Color(36, 30, 19); - private static final Color BLOG_POST_BACKGROUND = new Color(11, 30, 41); - - private static final int MAX_CONTENT_LINES = 3; - private static final int CONTENT_WIDTH = 148; - private static final int TIME_WIDTH = 20; - - private static final Comparator FEED_ITEM_COMPARATOR = (o1, o2) -> - { - if (o1.getType() != o2.getType()) - { - if (o1.getType() == FeedItemType.BLOG_POST) - { - return -1; - } - else if (o2.getType() == FeedItemType.BLOG_POST) - { - return 1; - } - } - - return -Long.compare(o1.getTimestamp(), o2.getTimestamp()); - }; - - static - { - RUNELITE_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(FeedPanel.class, "runelite.png")); - OSRS_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(FeedPanel.class, "osrs.png")); - } - - private final FeedConfig config; - private final Supplier feedSupplier; - - FeedPanel(FeedConfig config, Supplier feedSupplier) - { - super(true); - this.config = config; - this.feedSupplier = feedSupplier; - - setBorder(new EmptyBorder(10, 10, 10, 10)); - setBackground(ColorScheme.DARK_GRAY_COLOR); - setLayout(new GridLayout(0, 1, 0, 4)); - } - - void rebuildFeed() - { - FeedResult feed = feedSupplier.get(); - - if (feed == null) - { - return; - } - - SwingUtilities.invokeLater(() -> - { - removeAll(); - - feed.getItems() - .stream() - .filter(f -> f.getType() != FeedItemType.BLOG_POST || config.includeBlogPosts()) - .filter(f -> f.getType() != FeedItemType.TWEET || config.includeTweets()) - .filter(f -> f.getType() != FeedItemType.OSRS_NEWS || config.includeOsrsNews()) - .sorted(FEED_ITEM_COMPARATOR) - .forEach(this::addItemToPanel); - }); - } - - private void addItemToPanel(FeedItem item) - { - JPanel avatarAndRight = new JPanel(new BorderLayout()); - avatarAndRight.setPreferredSize(new Dimension(0, 56)); - - JLabel avatar = new JLabel(); - // width = 48+4 to compensate for the border - avatar.setPreferredSize(new Dimension(52, 48)); - avatar.setBorder(new EmptyBorder(0, 4, 0, 0)); - - switch (item.getType()) - { - case TWEET: - try - { - Request request = new Request.Builder() - .url(item.getAvatar()) - .build(); - - RuneLiteAPI.CLIENT.newCall(request).enqueue(new Callback() - { - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) - { - log.warn(null, e); - } - - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException - { - try (ResponseBody responseBody = response.body()) - { - if (!response.isSuccessful()) - { - log.warn("Failed to download image " + item.getAvatar()); - return; - } - - BufferedImage icon; - synchronized (ImageIO.class) - { - icon = ImageIO.read(responseBody.byteStream()); - } - avatar.setIcon(new ImageIcon(icon)); - } - } - }); - } - catch (IllegalArgumentException | NullPointerException e) - { - log.warn(null, e); - } - avatarAndRight.setBackground(TWEET_BACKGROUND); - break; - case OSRS_NEWS: - if (OSRS_ICON != null) - { - avatar.setIcon(OSRS_ICON); - } - avatarAndRight.setBackground(OSRS_NEWS_BACKGROUND); - break; - default: - if (RUNELITE_ICON != null) - { - avatar.setIcon(RUNELITE_ICON); - } - avatarAndRight.setBackground(BLOG_POST_BACKGROUND); - break; - } - - JPanel upAndContent = new JPanel(); - upAndContent.setLayout(new BoxLayout(upAndContent, BoxLayout.Y_AXIS)); - upAndContent.setBorder(new EmptyBorder(4, 8, 4, 4)); - upAndContent.setBackground(null); - - JPanel titleAndTime = new JPanel(); - titleAndTime.setLayout(new BorderLayout()); - titleAndTime.setBackground(null); - - Color darkerForeground = UIManager.getColor("Label.foreground").darker(); - - JLabel titleLabel = new JLabel(item.getTitle()); - titleLabel.setFont(FontManager.getRunescapeSmallFont()); - titleLabel.setBackground(null); - titleLabel.setForeground(darkerForeground); - titleLabel.setPreferredSize(new Dimension(CONTENT_WIDTH - TIME_WIDTH, 0)); - - Duration duration = Duration.between(Instant.ofEpochMilli(item.getTimestamp()), Instant.now()); - JLabel timeLabel = new JLabel(durationToString(duration)); - timeLabel.setFont(FontManager.getRunescapeSmallFont()); - timeLabel.setForeground(darkerForeground); - - titleAndTime.add(titleLabel, BorderLayout.WEST); - titleAndTime.add(timeLabel, BorderLayout.EAST); - - JPanel content = new JPanel(new BorderLayout()); - content.setBackground(null); - - JLabel contentLabel = new JLabel(lineBreakText(item.getContent(), FontManager.getRunescapeSmallFont())); - contentLabel.setBorder(new EmptyBorder(2, 0, 0, 0)); - contentLabel.setFont(FontManager.getRunescapeSmallFont()); - contentLabel.setForeground(darkerForeground); - - content.add(contentLabel, BorderLayout.CENTER); - - upAndContent.add(titleAndTime); - upAndContent.add(content); - upAndContent.add(new Box.Filler(new Dimension(0, 0), - new Dimension(0, Short.MAX_VALUE), - new Dimension(0, Short.MAX_VALUE))); - - avatarAndRight.add(avatar, BorderLayout.WEST); - avatarAndRight.add(upAndContent, BorderLayout.CENTER); - - Color backgroundColor = avatarAndRight.getBackground(); - Color hoverColor = backgroundColor.brighter().brighter(); - Color pressedColor = hoverColor.brighter(); - - avatarAndRight.addMouseListener(new MouseAdapter() - { - @Override - public void mouseEntered(MouseEvent e) - { - avatarAndRight.setBackground(hoverColor); - avatarAndRight.setCursor(new Cursor(Cursor.HAND_CURSOR)); - } - - @Override - public void mouseExited(MouseEvent e) - { - avatarAndRight.setBackground(backgroundColor); - avatarAndRight.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); - } - - @Override - public void mousePressed(MouseEvent e) - { - avatarAndRight.setBackground(pressedColor); - } - - @Override - public void mouseReleased(MouseEvent e) - { - avatarAndRight.setBackground(hoverColor); - LinkBrowser.browse(item.getUrl()); - } - }); - - add(avatarAndRight); - } - - private String durationToString(Duration duration) - { - if (duration.getSeconds() >= 60 * 60 * 24) - { - return (int) (duration.getSeconds() / (60 * 60 * 24)) + "d"; - } - else if (duration.getSeconds() >= 60 * 60) - { - return (int) (duration.getSeconds() / (60 * 60)) + "h"; - } - return (int) (duration.getSeconds() / 60) + "m"; - } - - private String lineBreakText(String text, Font font) - { - StringBuilder newText = new StringBuilder(""); - - FontRenderContext fontRenderContext = new FontRenderContext(font.getTransform(), - true, true); - - int lines = 0; - int pos = 0; - String[] words = text.split(" "); - String line = ""; - - while (lines < MAX_CONTENT_LINES && pos < words.length) - { - String newLine = pos > 0 ? line + " " + words[pos] : words[pos]; - double width = font.getStringBounds(newLine, fontRenderContext).getWidth(); - - if (width >= CONTENT_WIDTH) - { - newText.append(line); - newText.append("
"); - line = ""; - lines++; - } - else - { - line = newLine; - pos++; - } - } - - newText.append(line); - newText.append(""); - - return newText.toString(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedPlugin.java deleted file mode 100644 index a8d9b0c1ad..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/feed/FeedPlugin.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.feed; - -import com.google.common.base.Suppliers; -import com.google.inject.Provides; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.time.temporal.ChronoUnit; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import java.util.function.Supplier; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.task.Schedule; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.util.ImageUtil; -import net.runelite.http.api.feed.FeedClient; -import net.runelite.http.api.feed.FeedResult; - -@PluginDescriptor( - name = "News Feed", - description = "Show the latest RuneLite blog posts, OSRS news, and JMod Twitter posts", - tags = {"external", "integration", "panel", "twitter"}, - loadWhenOutdated = true, - type = PluginType.MISCELLANEOUS -) -@Slf4j -@Singleton -public class FeedPlugin extends Plugin -{ - @Inject - private ClientToolbar clientToolbar; - - @Inject - private FeedConfig config; - - @Inject - private ScheduledExecutorService executorService; - - @Inject - private FeedClient feedClient; - - private FeedPanel feedPanel; - private NavigationButton navButton; - - private final Supplier feedSupplier = Suppliers.memoizeWithExpiration(() -> - { - try - { - return feedClient.lookupFeed(); - } - catch (IOException e) - { - log.warn(null, e); - } - return null; - }, 10, TimeUnit.MINUTES); - - @Override - protected void startUp() - { - feedPanel = new FeedPanel(config, feedSupplier); - - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "icon.png"); - - navButton = NavigationButton.builder() - .tooltip("News Feed") - .icon(icon) - .priority(8) - .panel(feedPanel) - .build(); - - clientToolbar.addNavigation(navButton); - executorService.submit(this::updateFeed); - } - - @Override - protected void shutDown() - { - clientToolbar.removeNavigation(navButton); - } - - private void updateFeed() - { - feedPanel.rebuildFeed(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("feed")) - { - executorService.submit(this::updateFeed); - } - } - - @Schedule( - period = 10, - unit = ChronoUnit.MINUTES, - asynchronous = true - ) - public void updateFeedTask() - { - updateFeed(); - } - - @Provides - FeedConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(FeedConfig.class); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveConfig.java deleted file mode 100644 index 72cc3be70c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveConfig.java +++ /dev/null @@ -1,143 +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.fightcave; - -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.ConfigTitleSection; -import net.runelite.client.config.Range; -import net.runelite.client.config.Title; - -@ConfigGroup("fightcave") -public interface FightCaveConfig extends Config -{ - @ConfigTitleSection( - keyName = "mainConfig", - position = 0, - name = "Main Config", - description = "" - ) - default Title mainConfig() - { - return new Title(); - } - - @ConfigItem( - position = 1, - keyName = "waveDisplay", - name = "Wave display", - description = "Shows monsters that will spawn on the selected wave(s).", - titleSection = "mainConfig" - ) - default WaveDisplayMode waveDisplay() - { - return WaveDisplayMode.BOTH; - } - - @ConfigItem( - position = 2, - keyName = "tickTimersWidget", - name = "Tick Timers in Prayer", - description = "Adds an overlay to the Prayer Interface with the ticks until next attack for that prayer.", - titleSection = "mainConfig" - ) - default boolean tickTimersWidget() - { - return true; - } - - @ConfigTitleSection( - keyName = "text", - position = 3, - name = "Text", - description = "" - ) - default Title text() - { - return new Title(); - } - - @ConfigItem( - position = 4, - keyName = "fontStyle", - name = "Font Style", - description = "Plain | Bold | Italics", - titleSection = "text" - ) - default FontStyle fontStyle() - { - return FontStyle.BOLD; - } - - @Range( - min = 14, - max = 40 - ) - @ConfigItem( - position = 5, - keyName = "textSize", - name = "Text Size", - description = "Text Size for Timers.", - titleSection = "text" - ) - default int textSize() - { - return 32; - } - - @ConfigItem( - position = 6, - keyName = "shadows", - name = "Shadows", - description = "Adds Shadows to text.", - titleSection = "text" - ) - default boolean shadows() - { - return false; - } - - @Getter - @AllArgsConstructor - 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(); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveContainer.java b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveContainer.java deleted file mode 100644 index 7b32f5c087..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveContainer.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2019, Ganom - * Copyright (c) 2019, Lucas - * 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.fightcave; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import java.awt.Color; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; -import net.runelite.api.Actor; -import net.runelite.api.AnimationID; -import net.runelite.api.NPC; -import net.runelite.api.NPCDefinition; -import net.runelite.api.NpcID; -import net.runelite.api.Prayer; - -@Getter(AccessLevel.PACKAGE) -class FightCaveContainer -{ - private NPC npc; - private String npcName; - private int npcIndex; - private int npcSize; - private int attackSpeed; - private int priority; - private ImmutableSet animations; - @Setter(AccessLevel.PACKAGE) - private int ticksUntilAttack; - @Setter(AccessLevel.PACKAGE) - private Actor npcInteracting; - @Setter(AccessLevel.PACKAGE) - private AttackStyle attackStyle; - - FightCaveContainer(NPC npc, int attackSpeed) - { - this.npc = npc; - this.npcName = npc.getName(); - this.npcIndex = npc.getIndex(); - this.npcInteracting = npc.getInteracting(); - this.attackStyle = AttackStyle.UNKNOWN; - this.attackSpeed = attackSpeed; - this.ticksUntilAttack = -1; - final NPCDefinition composition = npc.getTransformedDefinition(); - - BossMonsters monster = BossMonsters.of(npc.getId()); - - if (monster == null) - { - throw new IllegalStateException(); - } - - this.animations = monster.animations; - this.attackStyle = monster.attackStyle; - this.priority = monster.priority; - - if (composition != null) - { - this.npcSize = composition.getSize(); - } - } - - @RequiredArgsConstructor - enum BossMonsters - { - TOK_XIL1(NpcID.TOKXIL_3121, AttackStyle.RANGE, ImmutableSet.of(AnimationID.TOK_XIL_RANGE_ATTACK, AnimationID.TOK_XIL_MELEE_ATTACK), 1), - TOK_XIL2(NpcID.TOKXIL_3122, AttackStyle.RANGE, ImmutableSet.of(AnimationID.TOK_XIL_RANGE_ATTACK, AnimationID.TOK_XIL_MELEE_ATTACK), 1), - KETZEK1(NpcID.KETZEK, AttackStyle.MAGE, ImmutableSet.of(AnimationID.KET_ZEK_MAGE_ATTACK, AnimationID.KET_ZEK_MELEE_ATTACK), 0), - KETZEK2(NpcID.KETZEK_3126, AttackStyle.MAGE, ImmutableSet.of(AnimationID.KET_ZEK_MAGE_ATTACK, AnimationID.KET_ZEK_MELEE_ATTACK), 0), - YTMEJKOT1(NpcID.YTMEJKOT, AttackStyle.MELEE, ImmutableSet.of(AnimationID.MEJ_KOT_HEAL_ATTACK, AnimationID.MEJ_KOT_MELEE_ATTACK), 2), - YTMEJKOT2(NpcID.YTMEJKOT_3124, AttackStyle.MELEE, ImmutableSet.of(AnimationID.MEJ_KOT_HEAL_ATTACK, AnimationID.MEJ_KOT_MELEE_ATTACK), 2), - TZTOKJAD1(NpcID.TZTOKJAD, AttackStyle.UNKNOWN, ImmutableSet.of(AnimationID.TZTOK_JAD_MAGIC_ATTACK, AnimationID.TZTOK_JAD_RANGE_ATTACK, AnimationID.TZTOK_JAD_MELEE_ATTACK), 0), - TZTOKJAD2(NpcID.TZTOKJAD_6506, AttackStyle.UNKNOWN, ImmutableSet.of(AnimationID.TZTOK_JAD_MAGIC_ATTACK, AnimationID.TZTOK_JAD_RANGE_ATTACK, AnimationID.TZTOK_JAD_MELEE_ATTACK), 0); - - private static final ImmutableMap idMap; - - static - { - ImmutableMap.Builder builder = ImmutableMap.builder(); - - for (BossMonsters monster : values()) - { - builder.put(monster.npcID, monster); - } - - idMap = builder.build(); - } - - private final int npcID; - private final AttackStyle attackStyle; - private final ImmutableSet animations; - private final int priority; - - static BossMonsters of(int npcID) - { - return idMap.get(npcID); - } - } - - @Getter(AccessLevel.PACKAGE) - @AllArgsConstructor - enum AttackStyle - { - MAGE("Mage", Color.CYAN, Prayer.PROTECT_FROM_MAGIC), - RANGE("Range", Color.GREEN, Prayer.PROTECT_FROM_MISSILES), - MELEE("Melee", Color.RED, Prayer.PROTECT_FROM_MELEE), - UNKNOWN("Unknown", Color.WHITE, null); - - private String name; - private Color color; - private Prayer prayer; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveOverlay.java deleted file mode 100644 index 8cf64da3f4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCaveOverlay.java +++ /dev/null @@ -1,201 +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.fightcave; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Point; -import net.runelite.api.Prayer; -import net.runelite.api.SpriteID; -import net.runelite.client.game.SpriteManager; -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; -import net.runelite.client.util.ImageUtil; - -@Singleton -public class FightCaveOverlay extends Overlay -{ - private final FightCavePlugin plugin; - private final Client client; - private final SpriteManager spriteManager; - - @Inject - FightCaveOverlay(final Client client, final FightCavePlugin plugin, final SpriteManager spriteManager) - { - this.client = client; - this.plugin = plugin; - this.spriteManager = spriteManager; - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGHEST); - setLayer(OverlayLayer.ALWAYS_ON_TOP); - } - - @Override - public Dimension render(Graphics2D graphics) - { - for (FightCaveContainer npc : plugin.getFightCaveContainer()) - { - if (npc.getNpc() == null) - { - continue; - } - - final int ticksLeft = npc.getTicksUntilAttack(); - final FightCaveContainer.AttackStyle attackStyle = npc.getAttackStyle(); - - if (ticksLeft <= 0) - { - continue; - } - - final String ticksLeftStr = String.valueOf(ticksLeft); - final int font = plugin.getFontStyle().getFont(); - final boolean shadows = plugin.isShadows(); - Color color = (ticksLeft <= 1 ? Color.WHITE : attackStyle.getColor()); - final Point canvasPoint = npc.getNpc().getCanvasTextLocation(graphics, Integer.toString(ticksLeft), 0); - - if (npc.getNpcName().equals("TzTok-Jad")) - { - color = (ticksLeft <= 1 || ticksLeft == 8 ? attackStyle.getColor() : Color.WHITE); - - BufferedImage pray = getPrayerImage(npc.getAttackStyle()); - - if (pray == null) - { - continue; - } - - renderImageLocation(graphics, npc.getNpc().getCanvasImageLocation(ImageUtil.resizeImage(pray, 36, 36), 0), pray, 12, 30); - } - - OverlayUtil.renderTextLocation(graphics, ticksLeftStr, plugin.getTextSize(), font, color, canvasPoint, shadows, 0); - } - - if (plugin.isTickTimersWidget()) - { - - if (!plugin.getMageTicks().isEmpty()) - { - widgetHandler(graphics, - Prayer.PROTECT_FROM_MAGIC, - plugin.getMageTicks().get(0) == 1 ? Color.WHITE : Color.CYAN, - Integer.toString(plugin.getMageTicks().get(0)), - plugin.isShadows() - ); - } - if (!plugin.getRangedTicks().isEmpty()) - { - widgetHandler(graphics, - Prayer.PROTECT_FROM_MISSILES, - plugin.getRangedTicks().get(0) == 1 ? Color.WHITE : Color.GREEN, - Integer.toString(plugin.getRangedTicks().get(0)), - plugin.isShadows() - ); - } - if (!plugin.getMeleeTicks().isEmpty()) - { - widgetHandler(graphics, - Prayer.PROTECT_FROM_MELEE, - plugin.getMeleeTicks().get(0) == 1 ? Color.WHITE : Color.RED, - Integer.toString(plugin.getMeleeTicks().get(0)), - plugin.isShadows() - ); - } - } - return null; - } - - private void widgetHandler(Graphics2D graphics, Prayer prayer, Color color, String ticks, boolean shadows) - { - if (prayer != null) - { - Rectangle bounds = OverlayUtil.renderPrayerOverlay(graphics, client, prayer, color); - - if (bounds != null) - { - renderTextLocation(graphics, ticks, 16, plugin.getFontStyle().getFont(), color, centerPoint(bounds), shadows); - } - } - } - - private BufferedImage getPrayerImage(FightCaveContainer.AttackStyle attackStyle) - { - switch (attackStyle) - { - case MAGE: - return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MAGIC, 0); - case MELEE: - return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MELEE, 0); - case RANGE: - return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MISSILES, 0); - } - return null; - } - - private void renderImageLocation(Graphics2D graphics, Point imgLoc, BufferedImage image, int xOffset, int yOffset) - { - int x = imgLoc.getX() + xOffset; - int y = imgLoc.getY() - yOffset; - - graphics.drawImage(image, x, y, null); - } - - private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint, boolean shadows) - { - graphics.setFont(new Font("Arial", fontStyle, fontSize)); - if (canvasPoint != null) - { - final Point canvasCenterPoint = new Point( - canvasPoint.getX() - 3, - canvasPoint.getY() + 6); - final Point canvasCenterPoint_shadow = new Point( - canvasPoint.getX() - 2, - canvasPoint.getY() + 7); - if (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); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCavePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCavePlugin.java deleted file mode 100644 index 55560b55b7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/FightCavePlugin.java +++ /dev/null @@ -1,388 +0,0 @@ -/* - * Copyright (c) 2018, Jordan Atwood - * 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.fightcave; - -import com.google.inject.Provides; -import java.util.ArrayList; -import java.util.Collections; -import java.util.EnumMap; -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 javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.AnimationID; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -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.ConfigChanged; -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 org.apache.commons.lang3.ArrayUtils; - -@PluginDescriptor( - name = "Fight Cave", - description = "Displays current and upcoming wave monsters in the Fight Caves", - tags = {"bosses", "combat", "minigame", "overlay", "pve", "pvm", "jad", "fire", "cape", "wave"}, - type = PluginType.PVM, - enabledByDefault = false -) -@Singleton -@Slf4j -public class FightCavePlugin extends Plugin -{ - static final int MAX_WAVE = 63; - @Getter(AccessLevel.PACKAGE) - static final List> WAVES = new ArrayList<>(); - private static final Pattern WAVE_PATTERN = Pattern.compile(".*Wave: (\\d+).*"); - private static final int FIGHT_CAVE_REGION = 9551; - private static final int MAX_MONSTERS_OF_TYPE_PER_WAVE = 2; - - static - { - final WaveMonster[] waveMonsters = WaveMonster.values(); - - // Add wave 1, future waves are derived from its contents - final EnumMap waveOne = new EnumMap<>(WaveMonster.class); - waveOne.put(waveMonsters[0], 1); - WAVES.add(waveOne); - - for (int wave = 1; wave < MAX_WAVE; wave++) - { - 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 WaveMonster addedMonster = waveMonsters[addedMonsterOrdinal]; - final int addedMonsterQuantity = prevWave.getOrDefault(addedMonster, 0); - - prevWave.put(addedMonster, addedMonsterQuantity + 1); - - WAVES.add(prevWave); - } - } - - @Inject - private Client client; - - @Inject - private NPCManager npcManager; - - @Inject - private OverlayManager overlayManager; - - @Inject - private WaveOverlay waveOverlay; - - @Inject - private FightCaveOverlay fightCaveOverlay; - - @Inject - private FightCaveConfig config; - - @Getter(AccessLevel.PACKAGE) - private Set fightCaveContainer = new HashSet<>(); - @Getter(AccessLevel.PACKAGE) - private int currentWave = -1; - @Getter(AccessLevel.PACKAGE) - private boolean validRegion; - @Getter(AccessLevel.PACKAGE) - private List mageTicks = new ArrayList<>(); - @Getter(AccessLevel.PACKAGE) - private List rangedTicks = new ArrayList<>(); - @Getter(AccessLevel.PACKAGE) - private List meleeTicks = new ArrayList<>(); - - static String formatMonsterQuantity(final WaveMonster monster, final int quantity) - { - return String.format("%dx %s", quantity, monster); - } - - - @Getter(AccessLevel.PACKAGE) - private WaveDisplayMode waveDisplay; - @Getter(AccessLevel.PACKAGE) - private boolean tickTimersWidget; - @Getter(AccessLevel.PACKAGE) - private FightCaveConfig.FontStyle fontStyle; - @Getter(AccessLevel.PACKAGE) - private int textSize; - @Getter(AccessLevel.PACKAGE) - private boolean shadows; - - @Provides - FightCaveConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(FightCaveConfig.class); - } - - @Override - public void startUp() - { - updateConfig(); - - if (client.getGameState() == GameState.LOGGED_IN && regionCheck()) - { - validRegion = true; - overlayManager.add(waveOverlay); - overlayManager.add(fightCaveOverlay); - } - } - - @Override - public void shutDown() - { - overlayManager.remove(waveOverlay); - overlayManager.remove(fightCaveOverlay); - currentWave = -1; - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("fightcave")) - { - return; - } - - updateConfig(); - } - - @Subscribe - private void onChatMessage(ChatMessage event) - { - if (!validRegion) - { - return; - } - - final Matcher waveMatcher = WAVE_PATTERN.matcher(event.getMessage()); - - if (event.getType() != ChatMessageType.GAMEMESSAGE || !waveMatcher.matches()) - { - return; - } - - currentWave = Integer.parseInt(waveMatcher.group(1)); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() != GameState.LOGGED_IN) - { - return; - } - - if (regionCheck()) - { - validRegion = true; - overlayManager.add(waveOverlay); - overlayManager.add(fightCaveOverlay); - } - else - { - validRegion = false; - overlayManager.remove(fightCaveOverlay); - overlayManager.remove(fightCaveOverlay); - } - - fightCaveContainer.clear(); - } - - @Subscribe - private void onNpcSpawned(NpcSpawned event) - { - if (!validRegion) - { - return; - } - - NPC npc = event.getNpc(); - - switch (npc.getId()) - { - case NpcID.TOKXIL_3121: - case NpcID.TOKXIL_3122: - case NpcID.YTMEJKOT: - case NpcID.YTMEJKOT_3124: - case NpcID.KETZEK: - case NpcID.KETZEK_3126: - case NpcID.TZTOKJAD: - case NpcID.TZTOKJAD_6506: - fightCaveContainer.add(new FightCaveContainer(npc, npcManager.getAttackSpeed(npc.getId()))); - break; - } - } - - @Subscribe - private void onNpcDespawned(NpcDespawned event) - { - if (!validRegion) - { - return; - } - - NPC npc = event.getNpc(); - - switch (npc.getId()) - { - case NpcID.TOKXIL_3121: - case NpcID.TOKXIL_3122: - case NpcID.YTMEJKOT: - case NpcID.YTMEJKOT_3124: - case NpcID.KETZEK: - case NpcID.KETZEK_3126: - case NpcID.TZTOKJAD: - case NpcID.TZTOKJAD_6506: - fightCaveContainer.removeIf(c -> c.getNpc() == npc); - break; - } - } - - @Subscribe - private void onGameTick(GameTick Event) - { - if (!validRegion) - { - return; - } - - mageTicks.clear(); - rangedTicks.clear(); - meleeTicks.clear(); - - for (FightCaveContainer npc : fightCaveContainer) - { - if (npc.getTicksUntilAttack() >= 0) - { - npc.setTicksUntilAttack(npc.getTicksUntilAttack() - 1); - } - - for (int anims : npc.getAnimations()) - { - if (anims == npc.getNpc().getAnimation()) - { - if (npc.getTicksUntilAttack() < 1) - { - npc.setTicksUntilAttack(npc.getAttackSpeed()); - } - - switch (anims) - { - case AnimationID.TZTOK_JAD_RANGE_ATTACK: - npc.setAttackStyle(FightCaveContainer.AttackStyle.RANGE); - break; - case AnimationID.TZTOK_JAD_MAGIC_ATTACK: - npc.setAttackStyle(FightCaveContainer.AttackStyle.MAGE); - break; - case AnimationID.TZTOK_JAD_MELEE_ATTACK: - npc.setAttackStyle(FightCaveContainer.AttackStyle.MELEE); - break; - } - } - } - - if (npc.getNpcName().equals("TzTok-Jad")) - { - continue; - } - - switch (npc.getAttackStyle()) - { - case RANGE: - if (npc.getTicksUntilAttack() > 0) - { - rangedTicks.add(npc.getTicksUntilAttack()); - } - break; - case MELEE: - if (npc.getTicksUntilAttack() > 0) - { - meleeTicks.add(npc.getTicksUntilAttack()); - } - break; - case MAGE: - if (npc.getTicksUntilAttack() > 0) - { - mageTicks.add(npc.getTicksUntilAttack()); - } - break; - } - } - - Collections.sort(mageTicks); - Collections.sort(rangedTicks); - Collections.sort(meleeTicks); - } - - private boolean regionCheck() - { - return ArrayUtils.contains(client.getMapRegions(), FIGHT_CAVE_REGION); - } - - private void updateConfig() - { - this.waveDisplay = config.waveDisplay(); - this.tickTimersWidget = config.tickTimersWidget(); - this.fontStyle = config.fontStyle(); - this.textSize = config.textSize(); - this.shadows = config.shadows(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/WaveDisplayMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/WaveDisplayMode.java deleted file mode 100644 index f67049d241..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/WaveDisplayMode.java +++ /dev/null @@ -1,43 +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.fightcave; - -import lombok.RequiredArgsConstructor; - -@RequiredArgsConstructor -public enum WaveDisplayMode -{ - CURRENT("Current wave"), - NEXT("Next wave"), - BOTH("Both"); - - private final String name; - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/WaveMonster.java b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/WaveMonster.java deleted file mode 100644 index 399cd1947b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/WaveMonster.java +++ /dev/null @@ -1,47 +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.fightcave; - -import lombok.AllArgsConstructor; - -@AllArgsConstructor -enum WaveMonster -{ - TZ_KIH("Drainer", 22), - TZ_KEK("Blob", 45), - TOK_XIL("Range", 90), - YT_MEJKOT("Melee", 180), - KET_ZEK("Mage", 360), - TZKOK_JAD("Jad", 702); - - 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/fightcave/WaveOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/WaveOverlay.java deleted file mode 100644 index d38920a976..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/WaveOverlay.java +++ /dev/null @@ -1,133 +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.fightcave; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; -import net.runelite.client.ui.overlay.components.table.TableAlignment; -import net.runelite.client.ui.overlay.components.table.TableComponent; - -@Singleton -class WaveOverlay extends Overlay -{ - private static final Color HEADER_COLOR = ColorScheme.BRAND_BLUE; - - private final FightCaveConfig config; - private final FightCavePlugin plugin; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - private WaveOverlay(final FightCaveConfig config, final FightCavePlugin plugin) - { - this.config = config; - this.plugin = plugin; - setPosition(OverlayPosition.TOP_RIGHT); - } - - 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 WaveMonster monster = monsterEntry.getKey(); - final int quantity = monsterEntry.getValue(); - final String line = FightCavePlugin.formatMonsterQuantity(monster, quantity); - - outputLines.add(line); - } - - return outputLines; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isValidRegion() || plugin.getCurrentWave() < 0) - { - return null; - } - - panelComponent.getChildren().clear(); - - final int currentWave = plugin.getCurrentWave(); - final int waveIndex = currentWave - 1; - - if (config.waveDisplay() == WaveDisplayMode.CURRENT - || config.waveDisplay() == WaveDisplayMode.BOTH) - { - final Map waveContents = FightCavePlugin.getWAVES().get(waveIndex); - - addWaveInfo("Wave " + plugin.getCurrentWave(), waveContents); - } - - if ((config.waveDisplay() == WaveDisplayMode.NEXT - || config.waveDisplay() == WaveDisplayMode.BOTH) - && currentWave != FightCavePlugin.MAX_WAVE) - { - final Map waveContents = FightCavePlugin.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(); - tableComponent.setColumnAlignments(TableAlignment.CENTER); - - for (String line : buildWaveLines(waveContents)) - { - tableComponent.addRow(line); - } - - if (!tableComponent.isEmpty()) - { - panelComponent.getChildren().add(tableComponent); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingConfig.java deleted file mode 100644 index 5ccee0e752..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingConfig.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.fishing; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("fishing") -public interface FishingConfig extends Config -{ - @ConfigItem( - position = 0, - keyName = "onlyCurrent", - name = "Display only currently fished fish", - description = "Configures whether only current fished fish's fishing spots are displayed" - ) - default boolean onlyCurrentSpot() - { - return false; - } - - @ConfigItem( - position = 1, - keyName = "showTiles", - name = "Display spot tiles", - description = "Configures whether tiles for fishing spots are highlighted" - ) - default boolean showSpotTiles() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "showIcons", - name = "Display spot icons", - description = "Configures whether icons for fishing spots are displayed" - ) - default boolean showSpotIcons() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "showNames", - name = "Display spot names", - description = "Configures whether names for fishing spots are displayed" - ) - default boolean showSpotNames() - { - return false; - } - - @ConfigItem( - keyName = "overlayColor", - name = "Overlay Color", - description = "Color of overlays", - position = 4 - ) - default Color getOverlayColor() - { - return Color.CYAN; - } - - @ConfigItem( - keyName = "minnowsOverlayColor", - name = "Minnows Overlay Color", - description = "Color of overlays for Minnows", - position = 5 - ) - default Color getMinnowsOverlayColor() - { - return Color.RED; - } - - @ConfigItem( - keyName = "aerialOverlayColor", - name = "Aerial Overlay Color", - description = "Color of overlays when 1-tick aerial fishing", - position = 6 - ) - default Color getAerialOverlayColor() - { - return Color.GREEN; - } - - @ConfigItem( - position = 7, - keyName = "statTimeout", - name = "Reset stats (minutes)", - description = "The time until fishing session data is reset in minutes." - ) - default int statTimeout() - { - return 5; - } - - @ConfigItem( - position = 8, - keyName = "showFishingStats", - name = "Show Fishing session stats", - description = "Display the fishing session stats." - ) - default boolean showFishingStats() - { - return true; - } - - @ConfigItem( - position = 9, - keyName = "showMinnowOverlay", - name = "Show Minnow Movement overlay", - description = "Display the minnow progress pie overlay." - ) - default boolean showMinnowOverlay() - { - return true; - } - - @ConfigItem( - position = 10, - keyName = "trawlerNotification", - name = "Trawler activity notification", - description = "Send a notification when fishing trawler activity drops below 15%." - ) - default boolean trawlerNotification() - { - return true; - } - - @ConfigItem( - position = 11, - keyName = "trawlerTimer", - name = "Trawler timer in MM:SS", - description = "Trawler Timer will display a more accurate timer in MM:SS format." - ) - default boolean trawlerTimer() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingOverlay.java deleted file mode 100644 index 6b81a2622c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingOverlay.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.fishing; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.GraphicID; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.Skill; -import net.runelite.client.plugins.xptracker.XpTrackerService; -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.TableAlignment; -import net.runelite.client.ui.overlay.components.table.TableComponent; - -@Singleton -class FishingOverlay extends Overlay -{ - private static final String FISHING_SPOT = "Fishing spot"; - static final String FISHING_RESET = "Reset"; - - private final Client client; - private final FishingPlugin plugin; - private final XpTrackerService xpTrackerService; - - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - public FishingOverlay(final Client client, final FishingPlugin plugin, final XpTrackerService xpTrackerService) - { - super(plugin); - setPosition(OverlayPosition.TOP_LEFT); - this.client = client; - this.plugin = plugin; - this.xpTrackerService = xpTrackerService; - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Fishing overlay")); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY, FISHING_RESET, "Fishing overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isShowFishingStats() || plugin.getSession().getLastFishCaught() == null) - { - return null; - } - - panelComponent.getChildren().clear(); - if (client.getLocalPlayer().getInteracting() != null - && client.getLocalPlayer().getInteracting().getName().contains(FISHING_SPOT) - && client.getLocalPlayer().getInteracting().getSpotAnimation() != GraphicID.FLYING_FISH) - { - panelComponent.getChildren().add(TitleComponent.builder() - .text("Fishing") - .color(Color.GREEN) - .build()); - } - else - { - panelComponent.getChildren().add(TitleComponent.builder() - .text("NOT fishing") - .color(Color.RED) - .build()); - } - - int actions = xpTrackerService.getActions(Skill.FISHING); - if (actions > 0) - { - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - tableComponent.addRow("Caught fish:", Integer.toString(actions)); - - if (actions > 2) - { - tableComponent.addRow("Fish/hr:", Integer.toString(xpTrackerService.getActionsHr(Skill.FISHING))); - } - - panelComponent.getChildren().add(tableComponent); - } - - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java deleted file mode 100644 index 278d054b9d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingPlugin.java +++ /dev/null @@ -1,499 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * Copyright (c) 2018, Levi - * 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.fishing; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Provides; -import java.awt.Color; -import java.time.Duration; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -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.GameState; -import net.runelite.api.InventoryID; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemID; -import net.runelite.api.MenuOpcode; -import net.runelite.api.NPC; -import net.runelite.api.Varbits; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.InteractingChanged; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.Notifier; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.events.OverlayMenuClicked; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDependency; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.xptracker.XpTrackerPlugin; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.ui.overlay.OverlayMenuEntry; -import net.runelite.client.util.ItemUtil; - -@PluginDescriptor( - name = "Fishing", - description = "Show fishing stats and mark fishing spots", - tags = {"overlay", "skilling"}, - type = PluginType.SKILLING -) -@PluginDependency(XpTrackerPlugin.class) -@Singleton -@Slf4j -public class FishingPlugin extends Plugin -{ - private static final int TRAWLER_SHIP_REGION_NORMAL = 7499; - private static final int TRAWLER_SHIP_REGION_SINKING = 8011; - private static final int TRAWLER_TIME_LIMIT_IN_SECONDS = 614; - private static final int TRAWLER_ACTIVITY_THRESHOLD = Math.round(0.15f * 255); - - private Instant trawlerStartTime; - - private static final ImmutableSet FISHING_TOOLS = ImmutableSet.of( - ItemID.DRAGON_HARPOON, ItemID.INFERNAL_HARPOON, ItemID.INFERNAL_HARPOON_UNCHARGED, ItemID.HARPOON, - ItemID.BARBTAIL_HARPOON, ItemID.BIG_FISHING_NET, ItemID.SMALL_FISHING_NET, ItemID.SMALL_FISHING_NET_6209, - ItemID.FISHING_ROD, ItemID.FLY_FISHING_ROD, ItemID.BARBARIAN_ROD, ItemID.OILY_FISHING_ROD, - ItemID.LOBSTER_POT, ItemID.KARAMBWAN_VESSEL, ItemID.KARAMBWAN_VESSEL_3159, - ItemID.CORMORANTS_GLOVE, ItemID.CORMORANTS_GLOVE_22817, - ItemID.PEARL_FISHING_ROD, ItemID.PEARL_FLY_FISHING_ROD, ItemID.PEARL_BARBARIAN_ROD - ); - - @Getter(AccessLevel.PACKAGE) - private final FishingSession session = new FishingSession(); - - @Getter(AccessLevel.PACKAGE) - private final Map minnowSpots = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private final List fishingSpots = new ArrayList<>(); - - @Getter(AccessLevel.PACKAGE) - private FishingSpot currentSpot; - - @Inject - private Client client; - - @Inject - private Notifier notifier; - - @Inject - private OverlayManager overlayManager; - - @Inject - private FishingConfig config; - - @Inject - private FishingOverlay overlay; - - @Inject - private FishingSpotOverlay spotOverlay; - - @Inject - private FishingSpotMinimapOverlay fishingSpotMinimapOverlay; - - private boolean trawlerNotificationSent; - - @Provides - FishingConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(FishingConfig.class); - } - - @Getter(AccessLevel.PACKAGE) - private boolean onlyCurrentSpot; - @Getter(AccessLevel.PACKAGE) - private boolean showSpotTiles; - @Getter(AccessLevel.PACKAGE) - private boolean showSpotIcons; - @Getter(AccessLevel.PACKAGE) - private boolean showSpotNames; - private int statTimeout; - @Getter(AccessLevel.PACKAGE) - private boolean showFishingStats; - @Getter(AccessLevel.PACKAGE) - private boolean showMinnowOverlay; - private boolean trawlerNotification; - private boolean trawlerTimer; - @Getter(AccessLevel.PACKAGE) - private Color overlayColor; - @Getter(AccessLevel.PACKAGE) - private Color minnowsOverlayColor; - @Getter(AccessLevel.PACKAGE) - private Color aerialOverlayColor; - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - overlayManager.add(spotOverlay); - overlayManager.add(fishingSpotMinimapOverlay); - } - - @Override - protected void shutDown() - { - spotOverlay.setHidden(true); - fishingSpotMinimapOverlay.setHidden(true); - overlayManager.remove(overlay); - overlayManager.remove(spotOverlay); - overlayManager.remove(fishingSpotMinimapOverlay); - fishingSpots.clear(); - minnowSpots.clear(); - trawlerNotificationSent = false; - currentSpot = null; - trawlerStartTime = null; - } - - @Subscribe - private void onOverlayMenuClicked(OverlayMenuClicked overlayMenuClicked) - { - OverlayMenuEntry overlayMenuEntry = overlayMenuClicked.getEntry(); - if (overlayMenuEntry.getMenuOpcode() == MenuOpcode.RUNELITE_OVERLAY - && overlayMenuClicked.getEntry().getOption().equals(FishingOverlay.FISHING_RESET) - && overlayMenuClicked.getOverlay() == overlay) - { - session.setLastFishCaught(null); - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("fishing")) - { - return; - } - - updateConfig(); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged gameStateChanged) - { - GameState gameState = gameStateChanged.getGameState(); - if (gameState == GameState.CONNECTION_LOST || gameState == GameState.LOGIN_SCREEN || gameState == GameState.HOPPING) - { - fishingSpots.clear(); - minnowSpots.clear(); - } - } - - @Subscribe - private void onItemContainerChanged(ItemContainerChanged event) - { - if (event.getItemContainer() != client.getItemContainer(InventoryID.INVENTORY) - && event.getItemContainer() != client.getItemContainer(InventoryID.EQUIPMENT)) - { - return; - } - - final boolean showOverlays = session.getLastFishCaught() != null - || canPlayerFish(client.getItemContainer(InventoryID.INVENTORY)) - || canPlayerFish(client.getItemContainer(InventoryID.EQUIPMENT)); - - if (!showOverlays) - { - currentSpot = null; - } - - spotOverlay.setHidden(!showOverlays); - fishingSpotMinimapOverlay.setHidden(!showOverlays); - } - - @Subscribe - private void onChatMessage(ChatMessage event) - { - if (event.getType() != ChatMessageType.SPAM) - { - return; - } - - if (event.getMessage().contains("You catch a") || event.getMessage().contains("You catch some") || - event.getMessage().equals("Your cormorant returns with its catch.")) - { - session.setLastFishCaught(Instant.now()); - spotOverlay.setHidden(false); - fishingSpotMinimapOverlay.setHidden(false); - } - } - - @Subscribe - private void onInteractingChanged(InteractingChanged event) - { - if (event.getSource() != client.getLocalPlayer()) - { - return; - } - - final Actor target = event.getTarget(); - - if (!(target instanceof NPC)) - { - return; - } - - final NPC npc = (NPC) target; - FishingSpot spot = FishingSpot.findSpot(npc.getId()); - - if (spot == null) - { - return; - } - - currentSpot = spot; - } - - private boolean canPlayerFish(final ItemContainer itemContainer) - { - if (itemContainer == null) - { - return false; - } - - return ItemUtil.containsAnyItemId(itemContainer.getItems(), FISHING_TOOLS); - } - - @Subscribe - private void onGameTick(GameTick event) - { - // Reset fishing session - if (session.getLastFishCaught() != null) - { - final Duration statTimeout = Duration.ofMinutes(this.statTimeout); - final Duration sinceCaught = Duration.between(session.getLastFishCaught(), Instant.now()); - - if (sinceCaught.compareTo(statTimeout) >= 0) - { - currentSpot = null; - session.setLastFishCaught(null); - } - } - - inverseSortSpotDistanceFromPlayer(); - - for (NPC npc : fishingSpots) - { - if (FishingSpot.findSpot(npc.getId()) == FishingSpot.MINNOW && this.showMinnowOverlay) - { - final int id = npc.getIndex(); - final MinnowSpot minnowSpot = minnowSpots.get(id); - - // create the minnow spot if it doesn't already exist - // or if it was moved, reset it - if (minnowSpot == null - || !minnowSpot.getLoc().equals(npc.getWorldLocation())) - { - minnowSpots.put(id, new MinnowSpot(npc.getWorldLocation(), Instant.now())); - } - } - } - - if (this.trawlerTimer) - { - updateTrawlerTimer(); - } - } - - @Subscribe - private void onNpcSpawned(NpcSpawned event) - { - final NPC npc = event.getNpc(); - - if (FishingSpot.findSpot(npc.getId()) == null) - { - return; - } - - fishingSpots.add(npc); - inverseSortSpotDistanceFromPlayer(); - } - - @Subscribe - private void onNpcDespawned(NpcDespawned npcDespawned) - { - final NPC npc = npcDespawned.getNpc(); - - fishingSpots.remove(npc); - - MinnowSpot minnowSpot = minnowSpots.remove(npc.getIndex()); - if (minnowSpot != null) - { - log.debug("Minnow spot {} despawned", npc); - } - } - - @Subscribe - private void onVarbitChanged(VarbitChanged event) - { - if (!this.trawlerNotification || client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - int regionID = client.getLocalPlayer().getWorldLocation().getRegionID(); - - if ((regionID == TRAWLER_SHIP_REGION_NORMAL || regionID == TRAWLER_SHIP_REGION_SINKING) - && client.getVar(Varbits.FISHING_TRAWLER_ACTIVITY) <= TRAWLER_ACTIVITY_THRESHOLD) - { - if (!trawlerNotificationSent) - { - notifier.notify("[" + client.getLocalPlayer().getName() + "] has low Fishing Trawler activity!"); - trawlerNotificationSent = true; - } - } - else - { - trawlerNotificationSent = false; - } - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded event) - { - if (event.getGroupId() == WidgetID.FISHING_TRAWLER_GROUP_ID) - { - trawlerStartTime = Instant.now(); - } - } - - /** - * Changes the Fishing Trawler timer widget from minutes to minutes and seconds - */ - private void updateTrawlerTimer() - { - if (trawlerStartTime == null) - { - return; - } - - int regionID = client.getLocalPlayer().getWorldLocation().getRegionID(); - if (regionID != TRAWLER_SHIP_REGION_NORMAL && regionID != TRAWLER_SHIP_REGION_SINKING) - { - log.debug("Trawler session ended"); - trawlerStartTime = null; - return; - } - - Widget trawlerTimerWidget = client.getWidget(WidgetInfo.FISHING_TRAWLER_TIMER); - if (trawlerTimerWidget == null) - { - return; - } - - long timeLeft = TRAWLER_TIME_LIMIT_IN_SECONDS - Duration.between(trawlerStartTime, Instant.now()).getSeconds(); - if (timeLeft < 0) - { - timeLeft = 0; - } - - int minutes = (int) timeLeft / 60; - int seconds = (int) timeLeft % 60; - - final StringBuilder trawlerText = new StringBuilder(); - trawlerText.append("Time Left: "); - - if (minutes > 0) - { - trawlerText.append(minutes); - } - else - { - trawlerText.append("00"); - } - - trawlerText.append(':'); - - if (seconds < 10) - { - trawlerText.append("0"); - } - - trawlerText.append(seconds); - - trawlerTimerWidget.setText(trawlerText.toString()); - } - - private void inverseSortSpotDistanceFromPlayer() - { - if (fishingSpots.isEmpty()) - { - return; - } - - final LocalPoint cameraPoint = new LocalPoint(client.getCameraX(), client.getCameraY()); - fishingSpots.sort( - Comparator.comparing( - // Negate to have the furthest first - (NPC npc) -> -npc.getLocalLocation().distanceTo(cameraPoint)) - // Order by position - .thenComparing(NPC::getLocalLocation, Comparator.comparing(LocalPoint::getX) - .thenComparing(LocalPoint::getY)) - // And then by id - .thenComparing(NPC::getId) - ); - } - - private void updateConfig() - { - this.onlyCurrentSpot = config.onlyCurrentSpot(); - this.showSpotTiles = config.showSpotTiles(); - this.showSpotIcons = config.showSpotIcons(); - this.showSpotNames = config.showSpotNames(); - this.statTimeout = config.statTimeout(); - this.showFishingStats = config.showFishingStats(); - this.showMinnowOverlay = config.showMinnowOverlay(); - this.trawlerNotification = config.trawlerNotification(); - this.trawlerTimer = config.trawlerTimer(); - this.overlayColor = config.getOverlayColor(); - this.minnowsOverlayColor = config.getMinnowsOverlayColor(); - this.aerialOverlayColor = config.getAerialOverlayColor(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSession.java b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSession.java deleted file mode 100644 index f5daf21ce6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSession.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2017, 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.fishing; - -import java.time.Instant; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; - -class FishingSession -{ - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private Instant lastFishCaught; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpot.java b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpot.java deleted file mode 100644 index c9fd8d1cd4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpot.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.fishing; - -import com.google.common.collect.ImmutableMap; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ItemID; -import static net.runelite.api.NpcID.*; - -@Getter(AccessLevel.PACKAGE) -enum FishingSpot -{ - SHRIMP("Shrimp, Anchovies", ItemID.RAW_SHRIMPS, - FISHING_SPOT_1514, FISHING_SPOT_1518, FISHING_SPOT_1521, - FISHING_SPOT_1523, FISHING_SPOT_1524, FISHING_SPOT_1525, - FISHING_SPOT_1528, FISHING_SPOT_1530, FISHING_SPOT_1544, - FISHING_SPOT_3913, FISHING_SPOT_7155, FISHING_SPOT_7459, - FISHING_SPOT_7462, FISHING_SPOT_7467, FISHING_SPOT_7469, - FISHING_SPOT_7947 - ), - LOBSTER("Lobster, Swordfish, Tuna", ItemID.RAW_LOBSTER, - FISHING_SPOT_1510, FISHING_SPOT_1519, FISHING_SPOT_1522, - FISHING_SPOT_3914, FISHING_SPOT_5820, FISHING_SPOT_7199, - FISHING_SPOT_7460, FISHING_SPOT_7465, FISHING_SPOT_7470, - FISHING_SPOT_7946 - ), - SHARK("Shark, Bass", ItemID.RAW_SHARK, - FISHING_SPOT_1511, FISHING_SPOT_1520, FISHING_SPOT_3915, - FISHING_SPOT_4476, FISHING_SPOT_4477, FISHING_SPOT_5233, - FISHING_SPOT_5234, FISHING_SPOT_5821, FISHING_SPOT_7200, - FISHING_SPOT_7461, FISHING_SPOT_7466, FISHING_SPOT_8525, - FISHING_SPOT_8526, FISHING_SPOT_8527 - ), - MONKFISH("Monkfish", ItemID.RAW_MONKFISH, - FISHING_SPOT_4316 - ), - SALMON("Salmon, Trout", ItemID.RAW_SALMON, - ROD_FISHING_SPOT, ROD_FISHING_SPOT_1508, ROD_FISHING_SPOT_1509, - ROD_FISHING_SPOT_1513, ROD_FISHING_SPOT_1515, ROD_FISHING_SPOT_1516, - ROD_FISHING_SPOT_1526, ROD_FISHING_SPOT_1527, ROD_FISHING_SPOT_7463, - ROD_FISHING_SPOT_7464, ROD_FISHING_SPOT_7468, ROD_FISHING_SPOT_8524 - ), - LAVA_EEL("Lava eel", ItemID.LAVA_EEL, - FISHING_SPOT_4928, FISHING_SPOT_6784 - ), - BARB_FISH("Sturgeon, Salmon, Trout", ItemID.LEAPING_STURGEON, - FISHING_SPOT_1542, FISHING_SPOT_7323 - ), - ANGLERFISH("Anglerfish", ItemID.RAW_ANGLERFISH, - ROD_FISHING_SPOT_6825 - ), - MINNOW("Minnow", ItemID.MINNOW, - FISHING_SPOT_7730, FISHING_SPOT_7731, FISHING_SPOT_7732, FISHING_SPOT_7733 - ), - INFERNAL_EEL("Infernal Eel", ItemID.INFERNAL_EEL, - ROD_FISHING_SPOT_7676 - ), - KARAMBWAN("Karambwan", ItemID.RAW_KARAMBWAN, - FISHING_SPOT_4712, FISHING_SPOT_4713 - ), - KARAMBWANJI("Karambwanji, Shrimp", ItemID.KARAMBWANJI, - FISHING_SPOT_4710 - ), - SACRED_EEL("Sacred eel", ItemID.SACRED_EEL, - FISHING_SPOT_6488 - ), - CAVE_EEL("Cave eel", ItemID.RAW_CAVE_EEL, - FISHING_SPOT_1497, FISHING_SPOT_1498 - ), - SLIMY_EEL("Slimy eel", ItemID.RAW_SLIMY_EEL, - FISHING_SPOT_2653, FISHING_SPOT_2654, FISHING_SPOT_2655 - ), - DARK_CRAB("Dark Crab", ItemID.RAW_DARK_CRAB, - FISHING_SPOT_1536 - ), - COMMON_TENCH("Common tench, Bluegill, Greater siren, Mottled eel", ItemID.COMMON_TENCH, - FISHING_SPOT_8523); - - private static final Map SPOTS; - - private final String name; - private final int fishSpriteId; - private final int[] ids; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (FishingSpot spot : values()) - { - for (int spotId : spot.getIds()) - { - builder.put(spotId, spot); - } - } - - SPOTS = builder.build(); - } - - FishingSpot(String spot, int fishSpriteId, int... ids) - { - this.name = spot; - this.fishSpriteId = fishSpriteId; - this.ids = ids; - } - - static FishingSpot findSpot(int id) - { - return SPOTS.get(id); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpotMinimapOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpotMinimapOverlay.java deleted file mode 100644 index d102e75551..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpotMinimapOverlay.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2018, 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.fishing; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Setter; -import net.runelite.api.GraphicID; -import net.runelite.api.NPC; -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; - -@Singleton -class FishingSpotMinimapOverlay extends Overlay -{ - private final FishingPlugin plugin; - - @Setter(AccessLevel.PACKAGE) - private boolean hidden; - - @Inject - public FishingSpotMinimapOverlay(final FishingPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (hidden) - { - return null; - } - - for (NPC npc : plugin.getFishingSpots()) - { - FishingSpot spot = FishingSpot.findSpot(npc.getId()); - - if (spot == null) - { - continue; - } - - if (plugin.isOnlyCurrentSpot() && plugin.getCurrentSpot() != null && plugin.getCurrentSpot() != spot) - { - continue; - } - - Color color = npc.getSpotAnimation() == GraphicID.FLYING_FISH - ? plugin.getMinnowsOverlayColor() - : plugin.getOverlayColor(); - - net.runelite.api.Point minimapLocation = npc.getMinimapLocation(); - if (minimapLocation != null) - { - OverlayUtil.renderMinimapLocation(graphics, minimapLocation, color.darker()); - } - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpotOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpotOverlay.java deleted file mode 100644 index 6aae4252fd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/FishingSpotOverlay.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.fishing; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.image.BufferedImage; -import java.time.Duration; -import java.time.Instant; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Setter; -import net.runelite.api.Client; -import net.runelite.api.GraphicID; -import net.runelite.api.NPC; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.ui.overlay.components.ProgressPieComponent; -import net.runelite.client.util.ImageUtil; - -@Singleton -class FishingSpotOverlay extends Overlay -{ - private static final Duration MINNOW_MOVE = Duration.ofSeconds(15); - private static final Duration MINNOW_WARN = Duration.ofSeconds(3); - private static final int ONE_TICK_AERIAL_FISHING = 3; - - private final FishingPlugin plugin; - private final Client client; - private final ItemManager itemManager; - - @Setter(AccessLevel.PACKAGE) - private boolean hidden; - - @Inject - private FishingSpotOverlay(final FishingPlugin plugin, final Client client, final ItemManager itemManager) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.plugin = plugin; - this.client = client; - this.itemManager = itemManager; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (hidden) - { - return null; - } - - FishingSpot previousSpot = null; - WorldPoint previousLocation = null; - for (NPC npc : plugin.getFishingSpots()) - { - FishingSpot spot = FishingSpot.findSpot(npc.getId()); - - if (spot == null) - { - continue; - } - - if (plugin.isOnlyCurrentSpot() && plugin.getCurrentSpot() != null && plugin.getCurrentSpot() != spot) - { - continue; - } - - // This relies on the sort order to keep identical npcs on the same tile adjacent to each other - if (previousSpot == spot && previousLocation.equals(npc.getWorldLocation())) - { - continue; - } - - Color color; - if (npc.getSpotAnimation() == GraphicID.FLYING_FISH) - { - color = plugin.getMinnowsOverlayColor(); - } - else if (spot == FishingSpot.COMMON_TENCH && npc.getWorldLocation().distanceTo2D(client.getLocalPlayer().getWorldLocation()) <= ONE_TICK_AERIAL_FISHING) - { - color = plugin.getAerialOverlayColor(); - } - else - { - color = plugin.getOverlayColor(); - } - - if (spot == FishingSpot.MINNOW && plugin.isShowMinnowOverlay()) - { - MinnowSpot minnowSpot = plugin.getMinnowSpots().get(npc.getIndex()); - if (minnowSpot != null) - { - long millisLeft = MINNOW_MOVE.toMillis() - Duration.between(minnowSpot.getTime(), Instant.now()).toMillis(); - if (millisLeft < MINNOW_WARN.toMillis()) - { - color = Color.ORANGE; - } - - LocalPoint localPoint = npc.getLocalLocation(); - Point location = Perspective.localToCanvas(client, localPoint, client.getPlane()); - - if (location != null) - { - ProgressPieComponent pie = new ProgressPieComponent(); - pie.setFill(color); - pie.setBorderColor(color); - pie.setPosition(location); - pie.setProgress((float) millisLeft / MINNOW_MOVE.toMillis()); - pie.render(graphics); - } - } - } - - if (plugin.isShowSpotTiles()) - { - Polygon poly = npc.getCanvasTilePoly(); - - if (poly != null) - { - OverlayUtil.renderPolygon(graphics, poly, color.darker()); - } - } - - if (plugin.isShowSpotIcons()) - { - BufferedImage fishImage = itemManager.getImage(spot.getFishSpriteId()); - - if (spot == FishingSpot.COMMON_TENCH - && npc.getWorldLocation().distanceTo2D(client.getLocalPlayer().getWorldLocation()) <= ONE_TICK_AERIAL_FISHING) - { - fishImage = ImageUtil.outlineImage(itemManager.getImage(spot.getFishSpriteId()), color); - } - - if (fishImage != null) - { - Point imageLocation = npc.getCanvasImageLocation(fishImage, npc.getLogicalHeight()); - if (imageLocation != null) - { - OverlayUtil.renderImageLocation(graphics, imageLocation, fishImage); - } - } - } - - if (plugin.isShowSpotNames()) - { - String text = spot.getName(); - Point textLocation = npc.getCanvasTextLocation(graphics, text, npc.getLogicalHeight() + 40); - - if (textLocation != null) - { - OverlayUtil.renderTextLocation(graphics, textLocation, text, color.darker()); - } - } - - previousSpot = spot; - previousLocation = npc.getWorldLocation(); - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/MinnowSpot.java b/runelite-client/src/main/java/net/runelite/client/plugins/fishing/MinnowSpot.java deleted file mode 100644 index b17270dfee..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fishing/MinnowSpot.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2018, 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.fishing; - -import java.time.Instant; -import lombok.AllArgsConstructor; -import lombok.Value; -import net.runelite.api.coords.WorldPoint; - -@AllArgsConstructor -@Value -class MinnowSpot -{ - private final WorldPoint loc; - private final Instant time; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fps/FpsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/fps/FpsConfig.java deleted file mode 100644 index feba6256cb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fps/FpsConfig.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2017, Levi - * 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.fps; - -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(FpsPlugin.CONFIG_GROUP_KEY) -public interface FpsConfig extends Config -{ - @ConfigItem( - keyName = "limitFps", - name = "Limit Global FPS", - description = "Global FPS limit in effect regardless of
" + - "whether window is in focus or not", - position = 1 - ) - default boolean limitFps() - { - return false; - } - - @Range( - min = 1, - max = 50 - ) - @ConfigItem( - keyName = "maxFps", - name = "Global FPS target", - description = "Desired max global frames per second", - position = 2 - ) - default int maxFps() - { - return 50; - } - - @ConfigItem( - keyName = "limitFpsUnfocused", - name = "Limit FPS unfocused", - description = "FPS limit while window is out of focus", - position = 3 - ) - default boolean limitFpsUnfocused() - { - return false; - } - - @Range( - min = 1, - max = 50 - ) - @ConfigItem( - keyName = "maxFpsUnfocused", - name = "Unfocused FPS target", - description = "Desired max frames per second for unfocused", - position = 4 - ) - default int maxFpsUnfocused() - { - return 50; - } - - @ConfigItem( - keyName = "drawFps", - name = "Draw FPS indicator", - description = "Show a number in the corner for the current FPS", - position = 5 - ) - default boolean drawFps() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fps/FpsDrawListener.java b/runelite-client/src/main/java/net/runelite/client/plugins/fps/FpsDrawListener.java deleted file mode 100644 index 8871780b1e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fps/FpsDrawListener.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2017, Levi - * 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.fps; - -import javax.inject.Inject; -import net.runelite.api.events.FocusChanged; - -/** - * FPS Draw Listener runs after the canvas has been painted with the buffered image (unused in this plugin) - * It specifically is designed only to pause when RS decides to paint the canvas, after the canvas has been painted. - * The RS client operates at 50 cycles happen per second in the RS Client with higher priority than draws per second. - * For high powered computers, drawing is limited by client cycles, so 50 is the max FPS observed. - * After running a game cycle and a draw operation, the RS client burns the rest of the time with a nano timer. - * For low powered computers, the RS client is often throttled by the hardware or OS and draws at 25-30 fps. - * The nano timer is not used in this scenario. - * Instead to catch up the RS client runs several cycles before drawing, thus maintaining 50 cycles / second. - *

- * Enforcing FPS in the draw code does not impact the client engine's ability to run including its audio, - * even when forced to 1 FPS with this plugin. - */ -public class FpsDrawListener implements Runnable -{ - private static final int SAMPLE_SIZE = 4; - - private final FpsConfig config; - private final FpsPlugin plugin; - - private long targetDelay = 0; - - // Often changing values - private boolean isFocused = true; - - // Working set - private long lastMillis = 0; - private final long[] lastDelays = new long[SAMPLE_SIZE]; - private int lastDelayIndex = 0; - private long sleepDelay = 0; - - @Inject - private FpsDrawListener(final FpsConfig config, final FpsPlugin plugin) - { - this.config = config; - this.plugin = plugin; - reloadConfig(); - } - - void reloadConfig() - { - lastMillis = System.currentTimeMillis(); - - int fps = config.limitFpsUnfocused() && !isFocused - ? config.maxFpsUnfocused() - : config.maxFps(); - - targetDelay = 1000 / Math.max(1, fps); - - sleepDelay = targetDelay; - - for (int i = 0; i < SAMPLE_SIZE; i++) - { - lastDelays[i] = targetDelay; - } - } - - void onFocusChanged(FocusChanged event) - { - this.isFocused = event.isFocused(); - reloadConfig(); // load new delay - } - - private boolean isEnforced() - { - return config.limitFps() - || (config.limitFpsUnfocused() && !isFocused); - } - - @Override - public void run() - { - if (!isEnforced()) - { - return; - } - - // We can't trust client.getFPS to get frame-perfect FPS knowledge - // If we do try to use client.getFPS, we will end up oscillating - // So we rely on currentTimeMillis which is occasionally cached by the JVM unlike nanotime - // Its caching will not cause oscillation as it is granular enough for our uses here - final long before = lastMillis; - final long now = System.currentTimeMillis(); - - lastMillis = now; - lastDelayIndex = (lastDelayIndex + 1) % SAMPLE_SIZE; - lastDelays[lastDelayIndex] = now - before; - - // We take a sampling approach because sometimes the game client seems to repaint - // after only running 1 game cycle, and then runs repaint again after running 30 cycles - long averageDelay = 0; - for (int i = 0; i < SAMPLE_SIZE; i++) - { - averageDelay += lastDelays[i]; - } - averageDelay /= lastDelays.length; - - // Sleep delay is a moving target due to the nature of how and when the engine - // decides to run cycles. - // This will also keep us safe from time spent in plugins conditionally - // as some plugins and overlays are only appropriate in some game areas - if (averageDelay > targetDelay) - { - sleepDelay--; - } - else if (averageDelay < targetDelay) - { - sleepDelay++; - } - - if (sleepDelay > 0) - { - try - { - Thread.sleep(sleepDelay); - } - catch (InterruptedException e) - { - // Can happen on shutdown - } - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fps/FpsLimitMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/fps/FpsLimitMode.java deleted file mode 100644 index 5e1369a24d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fps/FpsLimitMode.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2017, Levi - * 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.fps; - -public enum FpsLimitMode -{ - NEVER, - UNFOCUSED, - ALWAYS -} - diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fps/FpsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/fps/FpsOverlay.java deleted file mode 100644 index e7e3f669a0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fps/FpsOverlay.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2017, Levi - * 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.fps; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Point; -import net.runelite.api.events.FocusChanged; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -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; - -/** - * The built in FPS overlay has a few problems that this one does not have, most of all: it is distracting. - * 1. The built in one also shows memory, which constantly fluctuates and garbage collects. - * It is useful for devs profiling memory. - * 2. The built in one shifts around constantly because it is not monospace. - * This locks "FPS:" into one position (the far top right corner of the canvas), - * along with a locked position for the FPS value. - */ -@Singleton -public class FpsOverlay extends Overlay -{ - private static final int Y_OFFSET = 1; - private static final int X_OFFSET = 1; - private static final String FPS_STRING = " FPS"; - - // Local dependencies - private final Client client; - private final FpsConfig config; - - // Often changing values - private boolean isFocused = true; - - @Inject - private FpsOverlay(final FpsConfig config, final Client client) - { - this.client = client; - this.config = config; - setLayer(OverlayLayer.ABOVE_WIDGETS); - setPriority(OverlayPriority.HIGH); - setPosition(OverlayPosition.DYNAMIC); - } - - void onFocusChanged(FocusChanged event) - { - isFocused = event.isFocused(); - } - - private boolean isEnforced() - { - return config.limitFps() - || (config.limitFpsUnfocused() && !isFocused); - } - - private Color getFpsValueColor() - { - return isEnforced() ? Color.red : Color.yellow; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!config.drawFps()) - { - return null; - } - - // On resizable bottom line mode the logout button is at the top right, so offset the overlay - // to account for it - Widget logoutButton = client.getWidget(WidgetInfo.RESIZABLE_MINIMAP_LOGOUT_BUTTON); - int xOffset = X_OFFSET; - if (logoutButton != null && !logoutButton.isHidden()) - { - xOffset += logoutButton.getWidth(); - } - - final String text = client.getFPS() + FPS_STRING; - final int textWidth = graphics.getFontMetrics().stringWidth(text); - final int textHeight = graphics.getFontMetrics().getAscent() - graphics.getFontMetrics().getDescent(); - - final int width = (int) client.getRealDimensions().getWidth(); - final Point point = new Point(width - textWidth - xOffset, textHeight + Y_OFFSET); - OverlayUtil.renderTextLocation(graphics, point, text, getFpsValueColor()); - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fps/FpsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/fps/FpsPlugin.java deleted file mode 100644 index 88d732d1cf..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fps/FpsPlugin.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2017, Levi - * 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.fps; - -import com.google.inject.Inject; -import com.google.inject.Provides; -import com.google.inject.Singleton; -import net.runelite.api.events.FocusChanged; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.ui.DrawManager; -import net.runelite.client.ui.overlay.OverlayManager; - -/** - * FPS Control has two primary areas, this plugin class just keeps those areas up to date and handles setup / teardown. - * - *

Overlay paints the current FPS, the color depends on whether or not FPS is being enforced. - * The overlay is lightweight and is merely and indicator. - * - *

Draw Listener, sleeps a calculated amount after each canvas paint operation. - * This is the heart of the plugin, the amount of sleep taken is regularly adjusted to account varying - * game and system load, it usually finds the sweet spot in about two seconds. - */ -@PluginDescriptor( - name = "Performance", - description = "Show current FPS or set an FPS limit", - tags = {"frames", "framerate", "limit", "overlay"}, - enabledByDefault = false, - type = PluginType.MISCELLANEOUS -) -@Singleton -public class FpsPlugin extends Plugin -{ - static final String CONFIG_GROUP_KEY = "fpscontrol"; - - @Inject - private OverlayManager overlayManager; - - @Inject - private FpsOverlay overlay; - - @Inject - private FpsDrawListener drawListener; - - @Inject - private DrawManager drawManager; - - @Provides - FpsConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(FpsConfig.class); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals(CONFIG_GROUP_KEY)) - { - drawListener.reloadConfig(); - } - } - - @Subscribe - private void onFocusChanged(FocusChanged event) - { - drawListener.onFocusChanged(event); - overlay.onFocusChanged(event); - } - - @Override - protected void startUp() - { - overlayManager.add(overlay); - drawManager.registerEveryFrameListener(drawListener); - drawListener.reloadConfig(); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - drawManager.unregisterEveryFrameListener(drawListener); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FontStyle.java b/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FontStyle.java deleted file mode 100644 index c9921af410..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FontStyle.java +++ /dev/null @@ -1,47 +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.freezetimers; - -import java.awt.Font; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter(AccessLevel.PACKAGE) -@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/freezetimers/FreezeTimersConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersConfig.java deleted file mode 100644 index 7e9142df45..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersConfig.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2019, ganom - * Copyright (c) 2019, pklite - * 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.freezetimers; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigTitleSection; -import net.runelite.client.config.Range; -import net.runelite.client.config.Title; - -@ConfigGroup("freezetimers") -public interface FreezeTimersConfig extends Config -{ - @ConfigTitleSection( - keyName = "timersTitle", - name = "Timers", - description = "", - position = 1 - ) - default Title timersTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "showOverlay", - name = "Show Players", - description = "Configure if the player overlay should be shown", - position = 2, - titleSection = "timersTitle" - ) - default boolean showPlayers() - { - return true; - } - - @ConfigItem( - keyName = "showNpcs", - name = "Show NPCs", - description = "Configure if the npc overlay should be shown", - position = 3, - titleSection = "timersTitle" - ) - default boolean showNpcs() - { - return false; - } - - @ConfigItem( - keyName = "FreezeTimers", - name = "Show Freeze Timers", - description = "Toggle overlay for Freeze timers", - position = 4, - titleSection = "timersTitle" - ) - default boolean FreezeTimers() - { - return true; - } - - @ConfigItem( - keyName = "TB", - name = "Show TB Timers", - description = "Toggle overlay for TB timers", - position = 5, - titleSection = "timersTitle" - ) - default boolean TB() - { - return true; - } - - @ConfigItem( - keyName = "Veng", - name = "Show Veng Timers", - description = "Toggle overlay for Veng timers", - position = 6, - titleSection = "timersTitle" - ) - default boolean Veng() - { - return true; - } - - @ConfigTitleSection( - keyName = "overlayTitle", - name = "Overlay", - description = "", - position = 7 - ) - default Title overlayTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "xoffset", - name = "X Offset", - description = "Increasing this will push further away from model. Does not apply to text timers.", - position = 8, - titleSection = "overlayTitle" - ) - default int offset() - { - return 20; - } - - @ConfigItem( - keyName = "noImage", - name = "Text Timers", - description = "Remove Images from Timers", - position = 9, - titleSection = "overlayTitle" - ) - default boolean noImage() - { - return false; - } - - @ConfigItem( - keyName = "fontStyle", - name = "Font Style", - description = "Bold/Italics/Plain", - position = 10, - titleSection = "overlayTitle" - ) - default FontStyle fontStyle() - { - return FontStyle.BOLD; - } - - @Range( - min = 9, - max = 14 - ) - @ConfigItem( - keyName = "textSize", - name = "Text Size", - description = "Text Size for Timers.", - position = 11, - titleSection = "overlayTitle" - ) - default int textSize() - { - return 11; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersOverlay.java deleted file mode 100644 index 7daa3b7089..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersOverlay.java +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright (c) 2019, ganom - * Copyright (c) 2019, kyle - * Copyright (c) 2019, pklite - * 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.freezetimers; - -import java.awt.Color; -import static java.awt.Color.WHITE; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Actor; -import net.runelite.api.Client; -import net.runelite.api.Point; -import net.runelite.client.ui.FontManager; -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; -import net.runelite.client.util.ImageUtil; - -@Singleton -public class FreezeTimersOverlay extends Overlay -{ - private final FreezeTimersPlugin plugin; - private final Client client; - private final Font timerFont = FontManager.getRunescapeBoldFont().deriveFont(14.0f); - private final BufferedImage FREEZE_IMAGE = ImageUtil.getResourceStreamFromClass(getClass(), "freeze.png"); - private final BufferedImage FREEZE_IMMUNE_IMAGE = ImageUtil.getResourceStreamFromClass(getClass(), "freezeimmune.png"); - private final BufferedImage TB_IMAGE = ImageUtil.getResourceStreamFromClass(getClass(), "teleblock.png"); - private final BufferedImage TB_IMMUNE_IMAGE = ImageUtil.getResourceStreamFromClass(getClass(), "teleblockimmune.png"); - private final BufferedImage VENG_IMAGE = ImageUtil.getResourceStreamFromClass(getClass(), "veng.png"); - private final Timers timers; - - - @Inject - public FreezeTimersOverlay(final FreezeTimersPlugin plugin, final Client client, final Timers timers) - { - this.plugin = plugin; - this.client = client; - this.timers = timers; - setPriority(OverlayPriority.HIGHEST); - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.UNDER_WIDGETS); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.isShowPlayers()) - { - client.getPlayers().forEach((p) -> renderOverlayFor(graphics, p)); - } - if (plugin.isShowNpcs()) - { - client.getNpcs().forEach((npc) -> renderOverlayFor(graphics, npc)); - } - return null; - } - - private void renderOverlayFor(Graphics2D g, Actor actor) - { - if (timers.areAllTimersZero(actor)) - { - return; - } - - int overlaysDrawn = 0; - - if (drawFreezeOverlay(g, actor, overlaysDrawn) && plugin.isFreezeTimers()) - { - overlaysDrawn++; - } - if (drawTBOverlay(g, actor, overlaysDrawn) && plugin.isTB()) - { - overlaysDrawn++; - } - if (drawVengOverlay(g, actor, overlaysDrawn) && plugin.isVeng()) - { - overlaysDrawn++; - } - } - - private boolean drawFreezeOverlay(Graphics2D g, Actor actor, int overlaysDrawn) - { - final long currentTick = System.currentTimeMillis(); - if (timers.getTimerReApply(actor, TimerType.FREEZE) <= currentTick) - { - return false; - } - - long finishedAt; - BufferedImage image; - if (timers.getTimerEnd(actor, TimerType.FREEZE) > currentTick) - { - finishedAt = timers.getTimerEnd(actor, TimerType.FREEZE); - image = FREEZE_IMAGE; - } - else - { - finishedAt = timers.getTimerReApply(actor, TimerType.FREEZE); - image = FREEZE_IMMUNE_IMAGE; - } - - final String text = processTickCounter(finishedAt); - final Point poi = actor.getCanvasTextLocation(g, text, 0); - - if (poi == null) - { - return false; - } - - final Point fixedPoint = new Point(poi.getX(), poi.getY()); - - if (plugin.isNoImage()) - { - if (image == FREEZE_IMAGE) - { - OverlayUtil.renderTextLocation(g, text, plugin.getTextSize(), plugin.getFontStyle().getFont(), Color.WHITE, fixedPoint, false, 0); - } - else - { - OverlayUtil.renderTextLocation(g, text, plugin.getTextSize(), plugin.getFontStyle().getFont(), Color.YELLOW, fixedPoint, false, 0); - } - } - else - { - renderActorText(g, actor, text, overlaysDrawn, image); - } - return true; - } - - private boolean drawTBOverlay(Graphics2D g, Actor actor, int overlaysDrawn) - { - final long currentTick = System.currentTimeMillis(); - if (!plugin.isTB()) - { - return false; - } - if (timers.getTimerReApply(actor, TimerType.TELEBLOCK) <= currentTick) - { - return false; - } - - long finishedAt; - BufferedImage image; - if (timers.getTimerEnd(actor, TimerType.TELEBLOCK) > currentTick) - { - finishedAt = timers.getTimerEnd(actor, TimerType.TELEBLOCK); - image = TB_IMAGE; - } - else - { - finishedAt = timers.getTimerReApply(actor, TimerType.TELEBLOCK); - image = TB_IMMUNE_IMAGE; - } - - final String text = processTickCounter(finishedAt); - final Point poi = actor.getCanvasTextLocation(g, text, 0); - - if (poi == null) - { - return false; - } - - final Point fixedPoint = new Point(poi.getX() + 20, poi.getY()); - - if (plugin.isNoImage()) - { - if (timers.getTimerReApply(actor, TimerType.FREEZE) <= currentTick) - { - OverlayUtil.renderTextLocation(g, text, plugin.getTextSize(), plugin.getFontStyle().getFont(), Color.CYAN, poi, false, 0); - } - else - { - OverlayUtil.renderTextLocation(g, " | " + text, plugin.getTextSize(), plugin.getFontStyle().getFont(), Color.CYAN, fixedPoint, false, 0); - } - - if (timers.getTimerReApply(actor, TimerType.VENG) >= currentTick) - { - OverlayUtil.renderTextLocation(g, " | " + text, plugin.getTextSize(), plugin.getFontStyle().getFont(), Color.CYAN, fixedPoint, false, 0); - } - } - else - { - renderActorText(g, actor, text, overlaysDrawn, image); - } - return true; - } - - private boolean drawVengOverlay(Graphics2D g, Actor actor, int overlaysDrawn) - { - final long currentTick = System.currentTimeMillis(); - if (!plugin.isVeng()) - { - return false; - } - if (timers.getTimerEnd(actor, TimerType.VENG) <= currentTick) - { - return false; - } - final long finishedAt = timers.getTimerEnd(actor, TimerType.VENG); - - final String text = processTickCounter(finishedAt); - final Point poi = actor.getCanvasTextLocation(g, text, 0); - - if (poi == null) - { - return false; - } - - final Point fixedPoint = new Point(poi.getX() - 20, poi.getY()); - if (plugin.isNoImage()) - { - if (timers.getTimerEnd(actor, TimerType.FREEZE) <= currentTick) - { - OverlayUtil.renderTextLocation(g, text, plugin.getTextSize(), plugin.getFontStyle().getFont(), Color.RED, poi, false, 0); - } - if (timers.getTimerEnd(actor, TimerType.FREEZE) >= currentTick) - { - OverlayUtil.renderTextLocation(g, text + " | ", plugin.getTextSize(), plugin.getFontStyle().getFont(), Color.RED, fixedPoint, false, 0); - } - if (timers.getTimerEnd(actor, TimerType.TELEBLOCK) >= currentTick) - { - OverlayUtil.renderTextLocation(g, text + " | ", plugin.getTextSize(), plugin.getFontStyle().getFont(), Color.RED, fixedPoint, false, 0); - } - } - else - { - renderActorText(g, actor, text, overlaysDrawn, VENG_IMAGE); - } - return true; - } - - private void renderActorText(Graphics2D g, Actor actor, String text, int overlaysDrawn, BufferedImage image) - { - final int yOffset = (overlaysDrawn * 18); - g.setFont(timerFont); - g.setColor(WHITE); - final int xOffset = plugin.getOffset(); - renderActorTextAndImage(g, actor, text, Color.WHITE, image, yOffset, - xOffset); - } - - private void renderImageLocation(Graphics2D graphics, Point imgLoc, BufferedImage image) - { - final int x = imgLoc.getX(); - final int y = imgLoc.getY(); - - graphics.drawImage(image, x, y, null); - } - - private void renderActorTextAndImage(Graphics2D graphics, Actor actor, String text, Color color, BufferedImage image, int yOffset, int xOffset) - { - Point textLocation = new Point(actor.getCanvasImageLocation(image, 0).getX() + xOffset, actor.getCanvasImageLocation(image, 0).getY() + yOffset); - renderImageLocation(graphics, textLocation, image); - xOffset = image.getWidth() + 1; - yOffset = (image.getHeight() - (int) graphics.getFontMetrics().getStringBounds(text, graphics).getHeight()); - textLocation = new Point(textLocation.getX() + xOffset, textLocation.getY() + image.getHeight() - yOffset); - OverlayUtil.renderTextLocation(graphics, textLocation, text, color); - } - - private String processTickCounter(long finishedAt) - { - final long currentTick = System.currentTimeMillis(); - final long tickDifference = finishedAt - currentTick; - long seconds = tickDifference / 1000; - seconds++; - final int minutes = (int) (seconds / 60); - seconds = seconds % 60; - String text = seconds > 9 ? seconds + "" : "0" + seconds; - if (minutes > 0) - { - text = minutes + ":" + text; - } - return text + ""; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersPlugin.java deleted file mode 100644 index 93a0566faa..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersPlugin.java +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright (c) 2019, ganom - * Copyright (c) 2019, pklite - * 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.freezetimers; - -import com.google.inject.Provides; -import java.util.EnumSet; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -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.NPC; -import net.runelite.api.Player; -import net.runelite.api.WorldType; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.PlayerDeath; -import net.runelite.api.events.SpotAnimationChanged; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.multiindicators.MapLocations; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.util.PvPUtil; -import org.apache.commons.lang3.ArrayUtils; - -@PluginDescriptor( - name = "Freeze Timers", - description = "Shows a freeze timer overlay on players", - tags = {"freeze", "timers", "barrage", "teleblock", "pklite"}, - type = PluginType.PVP, - enabledByDefault = false -) -@Singleton -public class FreezeTimersPlugin extends Plugin -{ - private static final int VORKATH_REGION = 9023; - - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private Timers timers; - - @Inject - private PrayerTracker prayerTracker; - - @Inject - private FreezeTimersOverlay overlay; - - @Inject - private FreezeTimersConfig config; - - @Getter(AccessLevel.PACKAGE) - private boolean showPlayers; - @Getter(AccessLevel.PACKAGE) - private boolean showNpcs; - @Getter(AccessLevel.PACKAGE) - private boolean FreezeTimers; - @Getter(AccessLevel.PACKAGE) - private boolean TB; - @Getter(AccessLevel.PACKAGE) - private boolean Veng; - @Getter(AccessLevel.PACKAGE) - private int offset; - @Getter(AccessLevel.PACKAGE) - private boolean noImage; - @Getter(AccessLevel.PACKAGE) - private FontStyle fontStyle; - @Getter(AccessLevel.PACKAGE) - private int textSize; - - public void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - } - - public void shutDown() - { - overlayManager.remove(overlay); - } - - @Provides - public FreezeTimersConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(FreezeTimersConfig.class); - } - - @Subscribe - public void onSpotAnimationChanged(SpotAnimationChanged graphicChanged) - { - final int oldGraphic = prayerTracker.getSpotanimLastTick(graphicChanged.getActor()); - final int newGraphic = graphicChanged.getActor().getSpotAnimation(); - - if (oldGraphic == newGraphic) - { - return; - } - - final PlayerSpellEffect effect = PlayerSpellEffect.getFromSpotAnim(newGraphic); - - if (effect == PlayerSpellEffect.NONE) - { - return; - } - - final long currentTime = System.currentTimeMillis(); - - if (timers.getTimerReApply(graphicChanged.getActor(), effect.getType()) > currentTime) - { - return; - } - - long length = effect.getTimerLengthTicks(); - - if (effect.isHalvable() && prayerTracker.getPrayerIconLastTick(graphicChanged.getActor()) == 2) - { - length /= 2; - } - - timers.setTimerEnd(graphicChanged.getActor(), effect.getType(), - currentTime + length); - } - - @Subscribe - public void onGameTick(GameTick tickEvent) - { - prayerTracker.gameTick(); - - for (Actor actor : client.getPlayers()) - { - if (prayerTracker.getSpotanimLastTick(actor) != actor.getSpotAnimation()) - { - SpotAnimationChanged callback = new SpotAnimationChanged(); - callback.setActor(actor); - client.getCallbacks().post(SpotAnimationChanged.class, callback); - } - } - - List teleblocked = timers.getAllActorsOnTimer(TimerType.TELEBLOCK); - - if (!teleblocked.isEmpty()) - { - final EnumSet worldTypes = client.getWorldType(); - - for (Actor actor : teleblocked) - { - final WorldPoint actorLoc = actor.getWorldLocation(); - - if (!WorldType.isAllPvpWorld(worldTypes) && (actorLoc.getY() < 3525 || PvPUtil.getWildernessLevelFrom(actorLoc) <= 0)) - { - timers.setTimerReApply(actor, TimerType.TELEBLOCK, System.currentTimeMillis()); - } - else if (WorldType.isPvpWorld(worldTypes) && - MapLocations.getPvpSafeZones(actorLoc.getPlane()).contains(actorLoc.getX(), actorLoc.getY())) - { - timers.setTimerReApply(actor, TimerType.TELEBLOCK, System.currentTimeMillis()); - } - else if (WorldType.isDeadmanWorld(worldTypes) && - MapLocations.getDeadmanSafeZones(actorLoc.getPlane()).contains(actorLoc.getX(), actorLoc.getY())) - { - timers.setTimerReApply(actor, TimerType.TELEBLOCK, System.currentTimeMillis()); - } - } - } - } - - @Subscribe - private void onPlayerDeath(PlayerDeath event) - { - final Player localPlayer = client.getLocalPlayer(); - final long currentTime = System.currentTimeMillis(); - - for (TimerType type : TimerType.values()) - { - if (timers.getTimerReApply(localPlayer, type) <= currentTime) - { - continue; - } - - timers.setTimerReApply(localPlayer, type, currentTime); - } - } - - @Subscribe - public void onNpcDespawned(NpcDespawned event) - { - if (!isAtVorkath()) - { - return; - } - - final NPC npc = event.getNpc(); - - if (npc.getName() == null) - { - return; - } - - if (npc.getName().equals("Zombified Spawn")) - { - timers.setTimerReApply(client.getLocalPlayer(), TimerType.FREEZE, - System.currentTimeMillis()); - } - } - - @Subscribe - public void onChatMessage(ChatMessage event) - { - if (event.getType() != ChatMessageType.GAMEMESSAGE - || !event.getMessage().contains("Your Tele Block has been removed")) - { - return; - } - - timers.setTimerReApply(client.getLocalPlayer(), TimerType.TELEBLOCK, System.currentTimeMillis()); - } - - private boolean isAtVorkath() - { - return ArrayUtils.contains(client.getMapRegions(), VORKATH_REGION); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("freezetimers")) - { - updateConfig(); - } - } - - private void updateConfig() - { - this.showPlayers = config.showPlayers(); - this.showNpcs = config.showNpcs(); - this.FreezeTimers = config.FreezeTimers(); - this.TB = config.TB(); - this.Veng = config.Veng(); - this.offset = config.offset(); - this.noImage = config.noImage(); - this.fontStyle = config.fontStyle(); - this.textSize = config.textSize(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/PlayerSpellEffect.java b/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/PlayerSpellEffect.java deleted file mode 100644 index 7c7123fc1f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/PlayerSpellEffect.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2019, ganom - * Copyright (c) 2019, pklite - * 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.freezetimers; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@AllArgsConstructor -public enum PlayerSpellEffect -{ - BIND("Bind", 181, 4800, false, 0, TimerType.FREEZE), - SNARE("Snare", 180, 9600, false, 1, TimerType.FREEZE), - ENTANGLE("Entangle", 179, 14400, false, 2, TimerType.FREEZE), - RUSH("Ice Rush", 361, 4800, false, 3, TimerType.FREEZE), - BURST("Ice Burst", 363, 9600, false, 4, TimerType.FREEZE), - BLITZ("Ice Blitz", 367, 14400, false, 5, TimerType.FREEZE), - BARRAGE("Ice Barrage", 369, 19200, false, 6, TimerType.FREEZE), - TELEBLOCK("Teleblock", 345, 300000, true, 7, TimerType.TELEBLOCK), - VENG("Vengeance", 726, 30000, false, 8, TimerType.VENG), - VENG_OTHER("Vengeance Other", 725, 30000, false, 9, TimerType.VENG), - NONE("Nothing", -69, 420, true, 9999, TimerType.THIS_SHIT_BROKE); - - @Getter(AccessLevel.PACKAGE) - private final String name; - @Getter(AccessLevel.PACKAGE) - private final int spotAnimId; - @Getter(AccessLevel.PACKAGE) - private final int timerLengthTicks; - @Getter(AccessLevel.PACKAGE) - private boolean halvable; - @Getter(AccessLevel.PACKAGE) - private final int spriteIdx; - @Getter(AccessLevel.PACKAGE) - private final TimerType type; - - static PlayerSpellEffect getFromSpotAnim(int spotAnim) - { - for (PlayerSpellEffect effect : values()) - { - if (effect.getSpotAnimId() == spotAnim) - { - return effect; - } - } - return NONE; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/PrayerTracker.java b/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/PrayerTracker.java deleted file mode 100644 index 38f236567c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/PrayerTracker.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2019, pklite - * 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.freezetimers; - -import java.util.HashMap; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Actor; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.Player; - -@Slf4j -@Singleton -class PrayerTracker -{ - - @Inject - private Client client; - - private final Map> lastTick = new HashMap<>(); - private final Map> newTick = new HashMap<>(); - - public void gameTick() - { - lastTick.clear(); - lastTick.putAll(newTick); - newTick.clear(); - for (Player p : client.getPlayers()) - { - processActor(p); - } - for (NPC npc : client.getNpcs()) - { - processActor(npc); - } - } - - private void processActor(Actor actor) - { - if (!newTick.containsKey(actor)) - { - newTick.put(actor, new HashMap<>()); - } - if (actor instanceof Player) - { - newTick.get(actor).put("PrayerIcon", ((Player) actor).getOverheadIcon() == null ? -1 : ((Player) actor).getOverheadIcon().ordinal()); - } - newTick.get(actor).put("SpotAnim", actor.getSpotAnimation()); - } - - int getPrayerIconLastTick(Actor p) - { - return lastTick.getOrDefault(p, new HashMap<>()).getOrDefault("PrayerIcon", -1337); - } - - int getSpotanimLastTick(Actor p) - { - return lastTick.getOrDefault(p, new HashMap<>()).getOrDefault("SpotAnim", -1337); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/TimerType.java b/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/TimerType.java deleted file mode 100644 index 82aee9aecb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/TimerType.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2019, pklite - * 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.freezetimers; - -import lombok.AccessLevel; -import lombok.Getter; - -public enum TimerType -{ - FREEZE(3000), - VENG(0), - TELEBLOCK(45000), - THIS_SHIT_BROKE(-1); - - @Getter(AccessLevel.PACKAGE) - private final int immunityTime; - - TimerType(int immunityTime) - { - this.immunityTime = immunityTime; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/Timers.java b/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/Timers.java deleted file mode 100644 index 7e025e6ad4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/Timers.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2019, pklite - * 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.freezetimers; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Actor; - -@Slf4j -@Singleton -class Timers -{ - private final Map> timerMap = new HashMap<>(); - - void setTimerEnd(Actor actor, TimerType type, long n) - { - if (!timerMap.containsKey(actor)) - { - timerMap.put(actor, new HashMap<>()); - } - - timerMap.get(actor).put(type, n + type.getImmunityTime()); - } - - void setTimerReApply(Actor actor, TimerType type, long n) - { - if (!timerMap.containsKey(actor)) - { - timerMap.put(actor, new HashMap<>()); - } - - timerMap.get(actor).put(type, n); - } - - long getTimerEnd(Actor actor, TimerType type) - { - if (!timerMap.containsKey(actor)) - { - return 0; - } - - return timerMap.get(actor).getOrDefault(type, (long) type.getImmunityTime()) - type.getImmunityTime(); - } - - long getTimerReApply(Actor actor, TimerType type) - { - if (!timerMap.containsKey(actor)) - { - return 0; - } - - return timerMap.get(actor).getOrDefault(type, (long) 0); - } - - List getAllActorsOnTimer(TimerType type) - { - final List actors = new ArrayList<>(); - final Iterator it = timerMap.keySet().iterator(); - - while (it.hasNext()) - { - final Actor actor = it.next(); - - for (TimerType timerType : TimerType.values()) - { - if (getTimerReApply(actor, timerType) > System.currentTimeMillis()) - { - break; - } - it.remove(); - break; - } - - final long end = getTimerReApply(actor, type); - - if (end > System.currentTimeMillis()) - { - actors.add(actor); - } - } - - return actors; - } - - boolean areAllTimersZero(Actor actor) - { - for (TimerType type : TimerType.values()) - { - if (getTimerReApply(actor, type) > System.currentTimeMillis()) - { - return false; - } - } - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/friendlist/FriendListPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/friendlist/FriendListPlugin.java deleted file mode 100644 index cc7b766a53..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/friendlist/FriendListPlugin.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2018, Connor - * Copyright (c) 2018, 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.friendlist; - -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.VarPlayer; -import net.runelite.api.events.GameTick; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Friend List", - description = "Add extra information to the friend and ignore lists", - type = PluginType.MISCELLANEOUS -) -@Singleton -public class FriendListPlugin extends Plugin -{ - private static final int MAX_FRIENDS_P2P = 400; - private static final int MAX_FRIENDS_F2P = 200; - - private static final int MAX_IGNORES_P2P = 400; - private static final int MAX_IGNORES_F2P = 100; - - @Inject - private Client client; - - @Override - protected void shutDown() - { - final int world = client.getWorld(); - setFriendsListTitle("Friends List - World " + world); - setIgnoreListTitle("Ignore List - World " + world); - } - - @Subscribe - private void onGameTick(GameTick tick) - { - final int world = client.getWorld(); - final boolean isMember = client.getVar(VarPlayer.MEMBERSHIP_DAYS) > 0; - - final int friendCount = client.getFriendsCount(); - if (friendCount >= 0) - { - final int limit = isMember ? MAX_FRIENDS_P2P : MAX_FRIENDS_F2P; - - final String title = "Friends - W" + - world + - " (" + - friendCount + - "/" + - limit + - ")"; - - setFriendsListTitle(title); - } - - final int ignoreCount = client.getIgnoreCount(); - if (ignoreCount >= 0) - { - final int limit = isMember ? MAX_IGNORES_P2P : MAX_IGNORES_F2P; - - final String title = "Ignores - W" + - world + - " (" + - ignoreCount + - "/" + - limit + - ")"; - - setIgnoreListTitle(title); - } - } - - private void setFriendsListTitle(final String title) - { - Widget friendListTitleWidget = client.getWidget(WidgetInfo.FRIEND_CHAT_TITLE); - if (friendListTitleWidget != null) - { - friendListTitleWidget.setText(title); - } - } - - private void setIgnoreListTitle(final String title) - { - Widget ignoreTitleWidget = client.getWidget(WidgetInfo.IGNORE_TITLE); - if (ignoreTitleWidget != null) - { - ignoreTitleWidget.setText(title); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/friendnotes/FriendNoteOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/friendnotes/FriendNoteOverlay.java deleted file mode 100644 index acac979de6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/friendnotes/FriendNoteOverlay.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2018, Rheon - * Copyright (c) 2018, 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 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.client.plugins.friendnotes; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.tooltip.Tooltip; -import net.runelite.client.ui.overlay.tooltip.TooltipManager; - -@Singleton -class FriendNoteOverlay extends Overlay -{ - private final Client client; - private final FriendNotesPlugin plugin; - private final TooltipManager tooltipManager; - - @Inject - private FriendNoteOverlay(final Client client, final FriendNotesPlugin plugin, final TooltipManager tooltipManager) - { - this.client = client; - this.plugin = plugin; - this.tooltipManager = tooltipManager; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (client.isMenuOpen()) - { - return null; - } - - // Add a friend note tooltip to a hovered friend list entry - final HoveredFriend hovered = plugin.getHoveredFriend(); - - if (hovered != null) // Will always have a friend note if non-null - { - final String content = hovered.getNote(); - tooltipManager.add(new Tooltip(content)); - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/friendnotes/FriendNotesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/friendnotes/FriendNotesPlugin.java deleted file mode 100644 index 7f0e2f2489..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/friendnotes/FriendNotesPlugin.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (c) 2018, Rheon - * Copyright (c) 2018, 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 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.client.plugins.friendnotes; - -import com.google.common.base.Strings; -import java.awt.Color; -import javax.annotation.Nullable; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.Friend; -import net.runelite.api.MenuOpcode; -import net.runelite.api.Nameable; -import net.runelite.api.events.FriendRemoved; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.NameableNameChanged; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.game.chatbox.ChatboxPanelManager; -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.ColorUtil; - -@Slf4j -@PluginDescriptor( - name = "Friend Notes", - description = "Store notes about your friends", - type = PluginType.MISCELLANEOUS -) -@Singleton -public class FriendNotesPlugin extends Plugin -{ - private static final String CONFIG_GROUP = "friendNotes"; - private static final int CHARACTER_LIMIT = 128; - private static final String KEY_PREFIX = "note_"; - private static final String ADD_NOTE = "Add Note"; - private static final String EDIT_NOTE = "Edit Note"; - private static final String NOTE_PROMPT_FORMAT = "%s's Notes
" + - ColorUtil.prependColorTag("(Limit %s Characters)", new Color(0, 0, 170)); - - @Inject - private Client client; - - @Inject - private ConfigManager configManager; - - @Inject - private OverlayManager overlayManager; - - @Inject - private FriendNoteOverlay overlay; - - @Inject - private ChatboxPanelManager chatboxPanelManager; - - @Getter(AccessLevel.PACKAGE) - private HoveredFriend hoveredFriend = null; - - @Override - protected void startUp() - { - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - } - - /** - * Set a friend note, or unset by passing a null/empty note. - */ - private void setFriendNote(String displayName, String note) - { - if (Strings.isNullOrEmpty(note)) - { - configManager.unsetConfiguration(CONFIG_GROUP, KEY_PREFIX + displayName); - } - else - { - configManager.setConfiguration(CONFIG_GROUP, KEY_PREFIX + displayName, note); - } - } - - /** - * Get the friend note of a display name, or null if no friend note exists for it. - */ - @Nullable - private String getFriendNote(String displayName) - { - return configManager.getConfiguration(CONFIG_GROUP, KEY_PREFIX + displayName); - } - - /** - * Migrate a friend note to a new display name, and remove the previous one. - * If current name already has a note, or previous name had none, do nothing. - */ - private void migrateFriendNote(String currentDisplayName, String prevDisplayName) - { - final String currentNote = getFriendNote(currentDisplayName); - if (currentNote == null) - { - final String prevNote = getFriendNote(prevDisplayName); - if (prevNote != null) - { - log.debug("Update friend's username: '{}' -> '{}'", prevDisplayName, currentDisplayName); - setFriendNote(prevDisplayName, null); - setFriendNote(currentDisplayName, prevNote); - } - } - } - - /** - * Set the currently hovered display name, if a friend note exists for it. - */ - private void setHoveredFriend(String displayName) - { - hoveredFriend = null; - - if (!Strings.isNullOrEmpty(displayName)) - { - final String note = getFriendNote(displayName); - if (note != null) - { - hoveredFriend = new HoveredFriend(displayName, note); - } - } - } - - @Subscribe - private void onMenuEntryAdded(MenuEntryAdded event) - { - final int groupId = WidgetInfo.TO_GROUP(event.getParam1()); - - // Look for "Message" on friends list - if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() && event.getOption().equals("Message")) - { - // Friends have color tags - setHoveredFriend(Text.toJagexName(Text.removeTags(event.getTarget()))); - - // Build "Add Note" or "Edit Note" menu entry - // Add menu entry - client.insertMenuItem( - hoveredFriend == null || hoveredFriend.getNote() == null ? ADD_NOTE : EDIT_NOTE, - event.getTarget(), - MenuOpcode.RUNELITE.getId(), - 0, - event.getParam0(), - event.getParam1(), - false - ); - } - else if (hoveredFriend != null) - { - hoveredFriend = null; - } - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked event) - { - if (WidgetInfo.TO_GROUP(event.getParam1()) == WidgetInfo.FRIENDS_LIST.getGroupId()) - { - if (Strings.isNullOrEmpty(event.getTarget())) - { - return; - } - - // Handle clicks on "Add Note" or "Edit Note" - if (event.getOption().equals(ADD_NOTE) || event.getOption().equals(EDIT_NOTE)) - { - event.consume(); - - //Friends have color tags - final String sanitizedTarget = Text.toJagexName(Text.removeTags(event.getTarget())); - final String note = getFriendNote(sanitizedTarget); - - // Open the new chatbox input dialog - chatboxPanelManager.openTextInput(String.format(NOTE_PROMPT_FORMAT, sanitizedTarget, CHARACTER_LIMIT)) - .value(Strings.nullToEmpty(note)) - .onDone((content) -> - { - if (content == null) - { - return; - } - - content = Text.removeTags(content).trim(); - log.debug("Set note for '{}': '{}'", sanitizedTarget, content); - setFriendNote(sanitizedTarget, content); - }).build(); - } - } - - } - - @Subscribe - private void onNameableNameChanged(NameableNameChanged event) - { - final Nameable nameable = event.getNameable(); - - if (nameable instanceof Friend) - { - // Migrate a friend's note to their new display name - final Friend friend = (Friend) nameable; - String name = friend.getName(); - String prevName = friend.getPrevName(); - - if (prevName != null) - { - migrateFriendNote( - Text.toJagexName(name), - Text.toJagexName(prevName) - ); - } - } - } - - @Subscribe - private void onFriendRemoved(FriendRemoved event) - { - // Delete a friend's note if they are removed - final String displayName = Text.toJagexName(event.getName()); - log.debug("Remove friend: '{}'", displayName); - setFriendNote(displayName, null); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/friendnotes/HoveredFriend.java b/runelite-client/src/main/java/net/runelite/client/plugins/friendnotes/HoveredFriend.java deleted file mode 100644 index 9a049ec58e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/friendnotes/HoveredFriend.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2018, Rheon - * 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.client.plugins.friendnotes; - -import lombok.Value; - -@Value -class HoveredFriend -{ - private String friendName; - private String note; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/friendtagging/FriendTaggingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/friendtagging/FriendTaggingPlugin.java deleted file mode 100644 index 886312fbb4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/friendtagging/FriendTaggingPlugin.java +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright (c) 2019. PKLite - All Rights Reserved - * Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited. - * Proprietary and confidential. Refer to PKLite License file for more information on - * full terms of this copyright and to determine what constitutes authorized use. - * Written by PKLite(ST0NEWALL, others) , 2019 - * - */ - -package net.runelite.client.plugins.friendtagging; - -import com.google.common.base.Strings; -import java.awt.Toolkit; -import java.awt.datatransfer.StringSelection; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Objects; -import java.util.concurrent.ConcurrentHashMap; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.NonNull; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.Friend; -import net.runelite.api.Ignore; -import net.runelite.api.MenuOpcode; -import net.runelite.api.Nameable; -import net.runelite.api.events.FriendRemoved; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.NameableNameChanged; -import net.runelite.api.events.WidgetMenuOptionClicked; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.game.chatbox.ChatboxPanelManager; -import net.runelite.client.game.chatbox.ChatboxTextInput; -import net.runelite.client.menus.MenuManager; -import net.runelite.client.menus.WidgetMenuOption; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import org.apache.commons.lang3.ArrayUtils; - -@Slf4j -@PluginDescriptor( - name = "Friend Tagging", - description = "Tag people on your friends list.", - tags = {"PVP", "friend", "finder", "pk", "pklite"}, - type = PluginType.UTILITY, - enabledByDefault = false -) -@Singleton -public class FriendTaggingPlugin extends Plugin -{ - public static final ConcurrentHashMap taggedFriends = new ConcurrentHashMap<>(); - - private static final String CONFIG_GROUP = "friendtagging"; - private static final int CHARACTER_LIMIT = 30; - private static final String KEY_PREFIX = "tag_"; - private static final String ADD_TAG = "Add Tag"; - private static final String DELETE_TAG = "Delete Tag"; - private final WidgetMenuOption friendsTabMenuOption = new WidgetMenuOption("Copy to", "clipboard", - WidgetInfo.FIXED_VIEWPORT_FRIENDS_TAB); - private final WidgetMenuOption ignoreTabMenuOption = new WidgetMenuOption("Copy to", "clipboard", - WidgetInfo.FIXED_VIEWPORT_IGNORES_TAB); - private final WidgetMenuOption friendTabResizableOption = new WidgetMenuOption("Copy to", "clipboard", - WidgetInfo.FIXED_VIEWPORT_FRIENDS_TAB); - private final WidgetMenuOption ignoreTabResizableOption = new WidgetMenuOption("Copy to", "clipboard", - WidgetInfo.FIXED_VIEWPORT_IGNORES_TAB); - - @Inject - private Client client; - - @Inject - private ConfigManager configManager; - - @Inject - private MenuManager menuManager; - - @Inject - private ChatboxPanelManager chatboxPanelManager; - - @Override - protected void startUp() - { - - menuManager.addManagedCustomMenu(friendsTabMenuOption); - menuManager.addManagedCustomMenu(ignoreTabMenuOption); - menuManager.addManagedCustomMenu(friendTabResizableOption); - menuManager.addManagedCustomMenu(ignoreTabResizableOption); - loadFriendTags(); - } - - @Override - protected void shutDown() - { - menuManager.removeManagedCustomMenu(friendsTabMenuOption); - menuManager.removeManagedCustomMenu(ignoreTabMenuOption); - menuManager.removeManagedCustomMenu(friendTabResizableOption); - menuManager.removeManagedCustomMenu(ignoreTabResizableOption); - } - - @Subscribe - private void onMenuEntryAdded(MenuEntryAdded event) - { - final int groupId = WidgetInfo.TO_GROUP(event.getParam1()); - - if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() && event.getOption().equals("Message")) - { - // Friends have color tags - String friendName = Text.removeTags(event.getTarget()); - - // Build "Add Note" or "Edit Note" menu entry - client.insertMenuItem( - friendName == null || getTag(friendName) == null ? ADD_TAG : DELETE_TAG, - event.getTarget(), - MenuOpcode.RUNELITE.getId(), - 0, - event.getParam0(), - event.getParam1(), - false - ); - // Add menu entry - // jk it is already added - } - } - - @Subscribe - private void onFriendRemoved(FriendRemoved event) - { - final String displayName = event.getName().trim().toLowerCase(); - deleteTag(displayName); - } - - @Subscribe - private void onNameableNameChanged(NameableNameChanged event) - { - final Nameable nameable = event.getNameable(); - - if (nameable instanceof Friend) - { - // Migrate a friend's note to their new display name - final Friend friend = (Friend) nameable; - if (friend.getName() != null && friend.getPrevName() != null) - { - migrateFriendTag(friend.getName(), friend.getPrevName()); - } - } - } - - @Subscribe - private void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event) - { - if (event.getWidget().getId() == WidgetInfo.FIXED_VIEWPORT_FRIENDS_TAB.getId() && - Text.standardize(event.getMenuTarget()).equals(Text.standardize("clipboard"))) - { - friendIgnoreToClipboard(); - } - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked event) - { - if (WidgetInfo.TO_GROUP(event.getParam1()) == WidgetInfo.FRIENDS_LIST.getGroupId()) - { - if (Strings.isNullOrEmpty(event.getTarget())) - { - return; - } - - final String sanitizedTarget = Text.removeTags(event.getTarget()); - - if (event.getOption().equals(ADD_TAG)) - { - event.consume(); - final ChatboxTextInput build = chatboxPanelManager.openTextInput("Enter the tag").value("") - .onDone((content) -> - { - if (content == null) - { - return; - } - content = Text.removeTags(content).trim(); - setTag(sanitizedTarget, content); - }).build(); - } - if (event.getOption().equals(DELETE_TAG)) - { - event.consume(); - client.getLogger().info(sanitizedTarget); - taggedFriends.forEach((k, v) -> client.getLogger().info(k + ": ", v)); - deleteTag(sanitizedTarget); - } - } - - } - - /** - * Gets a tag from the currently loaded tags - * - * @param name the username of the player - * @return the text of the tag - */ - @NonNull - private String getTag(String name) - { - name = name.trim().toLowerCase(); - String keyName = KEY_PREFIX + name; - return taggedFriends.get(keyName); - } - - /** - * Sets a tag for a friend - * - * @param name the username of the player to tag - * @param tag the text of the tag - */ - private void setTag(String name, String tag) - { - client.getLogger().info("SETTING " + name + ": " + tag); - name = name.trim().toLowerCase(); - String keyName = KEY_PREFIX + name; - if (tag.length() <= CHARACTER_LIMIT) - { - taggedFriends.put(keyName, tag); - configManager.setConfiguration(CONFIG_GROUP, keyName, tag); - } - } - - /** - * Deletes a friends tag - * - * @param name the username of the friend to delete the tag for - */ - private void deleteTag(String name) - { - name = name.trim().toLowerCase(); - String keyName = KEY_PREFIX + name; - configManager.unsetConfiguration(CONFIG_GROUP, keyName); - taggedFriends.remove(keyName); - } - - /** - * Loads all of the friend tags for use with player indicators - */ - private void loadFriendTags() - { - String prefix = CONFIG_GROUP + "." + KEY_PREFIX; - for (String key : configManager.getConfigurationKeys(prefix)) - { - key = key.replace(CONFIG_GROUP + ".", ""); - String result = configManager.getConfiguration(CONFIG_GROUP, key); - if (Objects.nonNull(result) && !result.equals("")) - { - taggedFriends.put(key, configManager.getConfiguration(CONFIG_GROUP, key)); - } - } - } - - /** - * Migrate a friend note to a new display name, and remove the previous one. - * If current name already has a note, or previous name had none, do nothing. - */ - private void migrateFriendTag(String currentDisplayName, String prevDisplayName) - { - final String currentTag = getTag(currentDisplayName); - if (currentTag == null) - { - final String prevTag = getTag(prevDisplayName); - if (prevTag != null) - { - setTag(prevDisplayName, ""); - setTag(currentDisplayName, prevTag); - } - } - } - - /** - * This method combines the list of usernames on local players friend/ignore list into a comma delimited string - * and then copies it to the clipboard. - */ - private void friendIgnoreToClipboard() - { - StringBuilder friendsList = new StringBuilder(); - Friend[] friends = client.getFriends(); - Ignore[] ignores = client.getIgnores(); - String[] friendsIgnores = ArrayUtils.addAll(Arrays.stream(friends).map(Friend::getName).toArray(String[]::new), - Arrays.stream(ignores).map(Ignore::getName).toArray(String[]::new)); - HashSet names = new HashSet<>(Arrays.asList(friendsIgnores)); - names.forEach(n -> friendsList.append(n.toLowerCase()).append(",")); - StringSelection namesSelection = new StringSelection(friendsList.toString()); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(namesSelection, namesSelection); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletConfig.java deleted file mode 100644 index 134b32ae1d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletConfig.java +++ /dev/null @@ -1,336 +0,0 @@ -/* - * Copyright (c) 2019, kThisIsCvpv - * Copyright (c) 2019, ganom - * Copyright (c) 2019, kyle - * 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.gauntlet; - -import java.awt.Color; -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.ConfigTitleSection; -import net.runelite.client.config.Range; -import net.runelite.client.config.Title; - -@ConfigGroup("Gauntlet") - -public interface GauntletConfig extends Config -{ - @Getter - @AllArgsConstructor - enum CounterDisplay - { - ONBOSS("On Boss"), - INFOBOX("Info Box"), - BOTH("Both"), - NONE("None"); - - private String name; - - @Override - public String toString() - { - return getName(); - } - } - - @ConfigTitleSection( - keyName = "resources", - position = 0, - name = "Resources", - description = "" - ) - default Title resources() - { - return new Title(); - } - - @ConfigItem( - position = 1, - keyName = "highlightResources", - name = "Highlight Resources (Outline)", - description = "Highlights all the resources in each room with an outline.", - titleSection = "resources" - ) - default boolean highlightResources() - { - return false; - } - - @ConfigItem( - position = 2, - keyName = "highlightResourcesColor", - name = "Highlight Color", - description = "Highlights all the resources in each room with this color.", - titleSection = "resources", - hidden = true, - unhide = "highlightResources" - ) - default Color highlightResourcesColor() - { - return Color.YELLOW; - } - - @ConfigItem( - position = 3, - keyName = "highlightResourcesIcons", - name = "Highlight Resources (Icon)", - description = "Highlights all the icons in each room with an icon.", - titleSection = "resources", - hidden = true, - unhide = "highlightResources" - ) - default boolean highlightResourcesIcons() - { - return false; - } - - @Range( - min = 1, - max = 50 - ) - @ConfigItem( - position = 4, - keyName = "resourceIconSize", - name = "Resource Icon Size", - description = " change the size of resource icons.", - hidden = true, - unhide = "highlightResources", - titleSection = "resources" - ) - default int resourceIconSize() - { - return 20; - } - - @ConfigTitleSection( - keyName = "boss", - position = 5, - name = "Boss", - description = "" - ) - default Title boss() - { - return new Title(); - } - - @ConfigItem( - position = 6, - keyName = "countAttacks", - name = "Count Attacks Display", - description = "Count the attacks until the Hunllef switches their attack style and prayer.", - titleSection = "boss" - ) - default CounterDisplay countAttacks() - { - return CounterDisplay.NONE; - } - - @ConfigItem( - position = 7, - keyName = "highlightWidget", - name = "Highlight Prayer (Prayer Tab)", - description = "Highlights the correct prayer to use in your prayer book.", - titleSection = "boss" - ) - default boolean highlightWidget() - { - return false; - } - - @ConfigItem( - position = 8, - keyName = "highlightPrayerInfobox", - name = "Highlight Prayer (InfoBox)", - description = "Highlights the correct prayer to use in an Infobox.", - titleSection = "boss" - ) - default boolean highlightPrayerInfobox() - { - return false; - } - - @ConfigItem( - position = 9, - keyName = "flashOnWrongAttack", - name = "Flash screen on Wrong Attack", - description = "This will flash your screen if you attack with the wrong stlye.", - titleSection = "boss" - ) - default boolean flashOnWrongAttack() - { - return false; - } - - @ConfigItem( - position = 10, - keyName = "uniquePrayerAudio", - name = "Prayer Audio Warning", - description = "Plays a unique sound whenever the boss is about to shut down your prayer.", - titleSection = "boss" - ) - default boolean uniquePrayerAudio() - { - return false; - } - - @ConfigItem( - position = 11, - keyName = "uniquePrayerVisual", - name = "Prayer Attack (Icon)", - description = "Prayer attacks will have a unique overlay visual.", - titleSection = "boss" - ) - default boolean uniquePrayerVisual() - { - return false; - } - - @ConfigItem( - position = 12, - keyName = "uniqueAttackVisual", - name = "Magic & Range Attack (Icon)", - description = "Magic and Range attacks will have a unique overlay visual.", - titleSection = "boss" - ) - default boolean uniqueAttackVisual() - { - return false; - } - - @ConfigItem( - position = 13, - keyName = "attackVisualOutline", - name = "Hunllefs' attacks (Outline)", - description = "Outline the Hunllefs' attacks.", - titleSection = "boss" - ) - default boolean attackVisualOutline() - { - return false; - } - - @ConfigItem( - position = 14, - keyName = "overlayBoss", - name = "Outline Hunllef (Color)", - description = "Overlay Hunllef while you are on the wrong prayer with an color denoting it's current attack style.", - titleSection = "boss" - ) - default boolean overlayBoss() - { - return false; - } - - - @ConfigItem( - position = 15, - keyName = "overlayBossPrayer", - name = "Hunllef Overlay (Icons)", - description = "Overlay the Hunllef with an icon denoting it's current attack style.", - titleSection = "boss" - ) - default boolean overlayBossPrayer() - { - return false; - } - - @ConfigItem( - position = 16, - keyName = "overlayTornadoes", - name = "Show Tornado Decay", - description = "Display the amount of ticks left until the tornadoes decay.", - titleSection = "boss" - ) - default boolean overlayTornadoes() - { - return false; - } - - @Range( - min = 1, - max = 50 - ) - @ConfigItem( - position = 17, - keyName = "projectileIconSize", - name = "Hunllef Projectile Icon Size", - description = " change the size of Projectile icons.", - titleSection = "boss" - ) - default int projectileIconSize() - { - return 20; - } - - @ConfigTitleSection( - keyName = "timer", - position = 18, - name = "Timer", - description = "" - ) - default Title timer() - { - return new Title(); - } - - @ConfigItem( - position = 19, - keyName = "displayTimerWidget", - name = "Show Gauntlet timer overlay", - description = "Display a timer widget that tracks your gauntlet progress.", - titleSection = "timer" - ) - default boolean displayTimerWidget() - { - return false; - } - - @ConfigItem( - position = 20, - keyName = "displayTimerChat", - name = "Show Gauntlet timer chat message", - description = "Display a chat message that tracks your gauntlet progress.", - titleSection = "timer" - ) - default boolean displayTimerChat() - { - return false; - } - - @ConfigItem( - position = 21, - keyName = "displayResources", - name = "Show raw resources gathered", - description = "Displays how much of each resource you have gathered.", - titleSection = "resources" - ) - default boolean displayGatheredResources() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletCounter.java deleted file mode 100644 index 7e1f257277..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletCounter.java +++ /dev/null @@ -1,86 +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.gauntlet; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import static net.runelite.client.plugins.gauntlet.GauntletConfig.CounterDisplay.NONE; -import static net.runelite.client.plugins.gauntlet.GauntletConfig.CounterDisplay.ONBOSS; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; -import net.runelite.client.ui.overlay.components.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; - -@Singleton -public class GauntletCounter extends Overlay -{ - private final GauntletPlugin plugin; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - GauntletCounter(final GauntletPlugin plugin) - { - this.plugin = plugin; - setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT); - setPriority(OverlayPriority.HIGH); - } - - @Override - public Dimension render(Graphics2D graphics) - { - panelComponent.getChildren().clear(); - final Hunllef hunllef = plugin.getHunllef(); - - if (!plugin.fightingBoss() || - hunllef == null || - plugin.getCountAttacks() == NONE || - plugin.getCountAttacks() == ONBOSS) - { - return null; - } - - panelComponent.getChildren().add(TitleComponent.builder() - .text("Hunllef") - .color(Color.pink) - .build()); - - - Color color = hunllef.getPlayerAttacks() == 1 ? Color.RED : Color.WHITE; - final String pHits = ColorUtil.prependColorTag(Integer.toString(hunllef.getPlayerAttacks()), color); - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - tableComponent.addRow("Hunllef Hits: ", Integer.toString(hunllef.getBossAttacks())); - tableComponent.addRow("Player Hits Left: ", pHits); - panelComponent.getChildren().add(tableComponent); - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletInfoBoxOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletInfoBoxOverlay.java deleted file mode 100644 index 492c0b5283..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletInfoBoxOverlay.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2019, ganom - * Copyright (c) 2019, kyle - * 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.gauntlet; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.Prayer; -import net.runelite.api.SpriteID; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; -import net.runelite.client.ui.overlay.components.ComponentConstants; -import net.runelite.client.ui.overlay.components.InfoBoxComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; - -public class GauntletInfoBoxOverlay extends Overlay -{ - private static final Color NOT_ACTIVATED_BACKGROUND_COLOR = new Color(150, 0, 0, 150); - private final Client client; - private final GauntletPlugin plugin; - private final PanelComponent panelComponent = new PanelComponent(); - private final SpriteManager spriteManager; - - @Inject - GauntletInfoBoxOverlay(final Client client, final GauntletPlugin plugin, final SpriteManager spriteManager) - { - this.client = client; - this.plugin = plugin; - this.spriteManager = spriteManager; - setPosition(OverlayPosition.BOTTOM_RIGHT); - setPriority(OverlayPriority.HIGH); - } - - @Override - public Dimension render(Graphics2D graphics) - { - panelComponent.getChildren().clear(); - - if (!plugin.isHighlightPrayerInfobox() || !plugin.fightingBoss() || plugin.getHunllef() == null) - { - return null; - } - - final Hunllef hunllef = plugin.getHunllef(); - final Hunllef.BossAttackPhase phase = hunllef.getCurrentPhase(); - Prayer prayer = phase.getPrayer(); - - if (plugin.getHunllef() == null || !plugin.startedGauntlet()) - { - return null; - } - if (prayer == null) - { - return null; - } - - InfoBoxComponent prayComponent = new InfoBoxComponent(); - BufferedImage prayImg = scaleImg(getPrayerImage(prayer)); - prayComponent.setImage(prayImg); - prayComponent.setColor(Color.WHITE); - prayComponent.setBackgroundColor(client.isPrayerActive(prayer) - ? ComponentConstants.STANDARD_BACKGROUND_COLOR - : NOT_ACTIVATED_BACKGROUND_COLOR); - prayComponent.setPreferredSize(new Dimension(40, 40)); - panelComponent.getChildren().add(prayComponent); - panelComponent.setPreferredSize(new Dimension(40, 40)); - panelComponent.setBorder(new Rectangle(0, 0, 0, 0)); - return panelComponent.render(graphics); - } - - private BufferedImage getPrayerImage(Prayer prayer) - { - switch (prayer) - { - case PROTECT_FROM_MAGIC: - return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MAGIC, 0); - case PROTECT_FROM_MELEE: - return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MELEE, 0); - case PROTECT_FROM_MISSILES: - return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MISSILES, 0); - } - return null; - } - - private static BufferedImage scaleImg(final BufferedImage img) - { - if (img == null) - { - return null; - } - final double width = img.getWidth(null); - final double height = img.getHeight(null); - final double size = 36; // Limit size to 2 as that is minimum size not causing breakage - final double scalex = size / width; - final double scaley = size / height; - final double scale = Math.min(scalex, scaley); - final int newWidth = (int) (width * scale); - final int newHeight = (int) (height * scale); - final BufferedImage scaledImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_ARGB); - final Graphics g = scaledImage.createGraphics(); - g.drawImage(img, 0, 0, newWidth, newHeight, null); - g.dispose(); - return scaledImage; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletOverlay.java deleted file mode 100644 index 1f70af8837..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletOverlay.java +++ /dev/null @@ -1,424 +0,0 @@ -/* - * Copyright (c) 2019, kThisIsCvpv - * Copyright (c) 2019, ganom - * Copyright (c) 2019, kyle - * 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.gauntlet; - -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.awt.Shape; -import java.awt.image.BufferedImage; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.Model; -import net.runelite.api.NPC; -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.model.Jarvis; -import net.runelite.api.model.Vertex; -import net.runelite.client.graphics.ModelOutlineRenderer; -import static net.runelite.client.plugins.gauntlet.GauntletConfig.CounterDisplay.BOTH; -import static net.runelite.client.plugins.gauntlet.GauntletConfig.CounterDisplay.ONBOSS; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; -import net.runelite.client.ui.overlay.OverlayUtil; -import static net.runelite.client.util.ImageUtil.resizeImage; - -public class GauntletOverlay extends Overlay -{ - @Inject - private OverlayManager overlayManager; - - @Inject - private GauntletCounter GauntletCounter; - - private static final Color FLASH_COLOR = new Color(255, 0, 0, 70); - private static final int MAX_DISTANCE = 2400; - private final Client client; - private final GauntletPlugin plugin; - private final ModelOutlineRenderer outlineRenderer; - private int timeout; - - @Inject - private GauntletOverlay(Client client, GauntletPlugin plugin, ModelOutlineRenderer outlineRenderer) - { - this.client = client; - this.plugin = plugin; - this.outlineRenderer = outlineRenderer; - - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGH); - setLayer(OverlayLayer.ALWAYS_ON_TOP); - } - - @Override - public Dimension render(Graphics2D graphics) - { - // Save resources. There's nothing to render if the user is not in a raid. - - if (!plugin.startedGauntlet()) - { - return null; - } - - if (plugin.fightingBoss()) - { - // This section handles the visuals when the player is in the boss room. - // This section handles the projectile overlays. - Set projectiles = plugin.getProjectiles(); - projectiles.forEach(projectile -> - { - BufferedImage icon = resizeImage(projectile.getImage(), plugin.getProjectileIconSize(), plugin.getProjectileIconSize()); - Color color = projectile.getColor(); - - Polygon polygon = boundProjectile(projectile.getProjectile()); - if (polygon == null) - { - int x = (int) projectile.getProjectile().getX(); - int y = (int) projectile.getProjectile().getY(); - - LocalPoint point = new LocalPoint(x, y); - Point loc = Perspective.getCanvasImageLocation(client, point, icon, -(int) projectile.getProjectile().getZ()); - - if (loc == null) - { - return; - } - - if (plugin.isUniqueAttackVisual()) - { - graphics.drawImage(icon, loc.getX(), loc.getY(), null); - } - } - else - { - if (plugin.isAttackVisualOutline()) - { - graphics.setColor(color); - graphics.draw(polygon); - graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 50)); - graphics.fill(polygon); - } - if (plugin.isUniqueAttackVisual()) - { - Rectangle bounds = polygon.getBounds(); - int x = (int) bounds.getCenterX() - (icon.getWidth() / 2); - int y = (int) bounds.getCenterY() - (icon.getHeight() / 2); - graphics.drawImage(icon, x, y, null); - } - } - }); - projectiles.removeIf(proj -> proj.getProjectile().getRemainingCycles() <= 0); - - plugin.getTornadoes().forEach(tornado -> - { - if (plugin.isOverlayTornadoes()) - { - if (tornado.getTimeLeft() <= 0) - { - return; - } - - final String textOverlay = Integer.toString(tornado.getTimeLeft()); - final Point textLoc = Perspective.getCanvasTextLocation(client, graphics, tornado.getNpc().getLocalLocation(), textOverlay, 0); - final LocalPoint lp = LocalPoint.fromWorld(client, tornado.getNpc().getWorldLocation()); - - if (lp == null) - { - return; - } - - final Polygon tilePoly = Perspective.getCanvasTilePoly(client, lp); - OverlayUtil.renderPolygon(graphics, tilePoly, Color.YELLOW); - - if (textLoc == null) - { - return; - } - - Font oldFont = graphics.getFont(); - graphics.setFont(new Font("Arial", Font.BOLD, 20)); - Point pointShadow = new Point(textLoc.getX() + 1, textLoc.getY() + 1); - OverlayUtil.renderTextLocation(graphics, pointShadow, textOverlay, Color.BLACK); - OverlayUtil.renderTextLocation(graphics, textLoc, textOverlay, Color.YELLOW); - graphics.setFont(oldFont); - } - }); - - if (plugin.getHunllef() != null) - { - final Hunllef hunllef = plugin.getHunllef(); - final Hunllef.BossAttackPhase phase = hunllef.getCurrentPhase(); - final NPC boss = hunllef.getNpc(); - final LocalPoint point = boss.getLocalLocation(); - - if (plugin.isFlash() && plugin.isFlashOnWrongAttack()) - { - final Color flash = graphics.getColor(); - graphics.setColor(FLASH_COLOR); - graphics.fill(new Rectangle(client.getCanvas().getSize())); - graphics.setColor(flash); - timeout++; - if (timeout >= 15) - { - timeout = 0; - plugin.setFlash(false); - } - } - - if (plugin.isOverlayBoss()) - { - Shape polygon = boss.getConvexHull(); - - if (polygon == null) - { - return null; - } - - if (phase.getPrayer() != null && !client.isPrayerActive(phase.getPrayer())) - { - Color color = phase.getColor(); - outlineRenderer.drawOutline(boss, 12, color, new Color(0, 0, 0, 0)); - } - } - - if (plugin.isOverlayBossPrayer()) - { - BufferedImage attackIcon = null; - - switch (phase) - { - case MAGIC: - attackIcon = resizeImage(hunllef.getMage(), plugin.getProjectileIconSize(), plugin.getProjectileIconSize()); - break; - case RANGE: - attackIcon = resizeImage(hunllef.getRange(), plugin.getProjectileIconSize(), plugin.getProjectileIconSize()); - break; - default: - break; - } - - if (attackIcon == null) - { - return null; - } - - Point imageLoc = Perspective.getCanvasImageLocation(client, point, attackIcon, boss.getLogicalHeight() / 2); - - if (imageLoc == null) - { - return null; - } - - graphics.drawImage(attackIcon, imageLoc.getX(), imageLoc.getY(), null); - } - - if (plugin.isHighlightWidget()) - { - if (phase.getPrayer() == null) - { - return null; - } - - final Rectangle bounds = OverlayUtil.renderPrayerOverlay(graphics, client, phase.getPrayer(), phase.getColor()); - - if (bounds != null) - { - final Color color = hunllef.getTicksUntilAttack() == 1 ? Color.WHITE : phase.getColor(); - renderTextLocation(graphics, Integer.toString(hunllef.getTicksUntilAttack()), 16, Font.BOLD, color, centerPoint(bounds), false); - } - } - - if (plugin.getCountAttacks() == ONBOSS || plugin.getCountAttacks() == BOTH) - { - String textOverlay; - - textOverlay = Integer.toString(hunllef.getBossAttacks()); - - if (textOverlay.length() > 0) - { - textOverlay += " | "; - } - - textOverlay += Integer.toString(hunllef.getPlayerAttacks()); - - if (textOverlay.length() > 0) - { - Point textLoc = Perspective.getCanvasTextLocation(client, graphics, point, textOverlay, boss.getLogicalHeight() / 2); - - if (textLoc == null) - { - return null; - } - - textLoc = new Point(textLoc.getX(), textLoc.getY() + 35); - - Font oldFont = graphics.getFont(); - - graphics.setFont(new Font("Arial", Font.BOLD, 20)); - Point pointShadow = new Point(textLoc.getX() + 1, textLoc.getY() + 1); - - OverlayUtil.renderTextLocation(graphics, pointShadow, textOverlay, Color.BLACK); - OverlayUtil.renderTextLocation(graphics, textLoc, textOverlay, phase.getColor()); - - graphics.setFont(oldFont); - } - } - } - if (plugin.getHunllef() == null) - { - overlayManager.remove(GauntletCounter); - } - } - else - { - // This section overlays all resources. - final LocalPoint playerLocation = client.getLocalPlayer().getLocalLocation(); - - final Set resources = plugin.getResources(); - resources.forEach(object -> - { - if (object.getGameObject().getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE) - { - - // Don't use Convex Hull click box. As the room start to fill up, your FPS will dip. - Shape polygon = object.getGameObject().getConvexHull(); - - if (polygon == null) - { - return; - } - // This section will highlight the resource with color. - if (plugin.isHighlightResources()) - { - outlineRenderer.drawOutline(object.getGameObject(), 2, plugin.getHighlightResourcesColor()); - } - - // This section will overlay the resource with an icon. - if (plugin.isHighlightResourcesIcons()) - { - BufferedImage icon = resizeImage(object.getImage(), plugin.getResourceIconSize(), plugin.getResourceIconSize()); - Rectangle bounds = polygon.getBounds(); - int startX = (int) bounds.getCenterX() - (icon.getWidth() / 2); - int startY = (int) bounds.getCenterY() - (icon.getHeight() / 2); - graphics.drawImage(icon, startX, startY, null); - } - } - }); - } - return null; - } - - private Polygon boundProjectile(Projectile proj) - { - if (proj == null || proj.getModel() == null) - { - return null; - } - - Model model = proj.getModel(); - LocalPoint point = new LocalPoint((int) proj.getX(), (int) proj.getY()); - int tileHeight = Perspective.getTileHeight(client, point, client.getPlane()); - - double angle = Math.atan(proj.getVelocityY() / proj.getVelocityX()); - angle = Math.toDegrees(angle) + (proj.getVelocityX() < 0 ? 180 : 0); - angle = angle < 0 ? angle + 360 : angle; - angle = 360 - angle - 90; - - double ori = angle * (512d / 90d); - ori = ori < 0 ? ori + 2048 : ori; - - int orientation = (int) Math.round(ori); - - List vertices = model.getVertices(); - for (int i = 0; i < vertices.size(); ++i) - { - vertices.set(i, vertices.get(i).rotate(orientation)); - } - - List list = new ArrayList<>(); - - for (Vertex vertex : vertices) - { - final Point localToCanvas = Perspective.localToCanvas(client, point.getX() - vertex.getX(), point.getY() - vertex.getZ(), tileHeight + vertex.getY() + (int) proj.getZ()); - if (localToCanvas != null) - { - list.add(localToCanvas); - } - } - - final List convexHull = Jarvis.convexHull(list); - if (convexHull == null) - { - return null; - } - - final Polygon polygon = new Polygon(); - for (final Point hullPoint : convexHull) - { - polygon.addPoint(hullPoint.getX(), hullPoint.getY()); - } - - return polygon; - } - - private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint, boolean shadows) - { - graphics.setFont(new Font("Arial", fontStyle, fontSize)); - if (canvasPoint != null) - { - final Point canvasCenterPoint = new Point( - canvasPoint.getX() - 3, - canvasPoint.getY() + 6); - final Point canvasCenterPoint_shadow = new Point( - canvasPoint.getX() - 2, - canvasPoint.getY() + 7); - if (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); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletPlugin.java deleted file mode 100644 index f4f336634c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletPlugin.java +++ /dev/null @@ -1,663 +0,0 @@ -/* - * Copyright (c) 2019, kThisIsCvpv - * Copyright (c) 2019, ganom - * Copyright (c) 2019, kyle - * 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.gauntlet; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Provides; -import java.awt.Color; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import javax.annotation.Nullable; -import javax.inject.Inject; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.Actor; -import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.GameState; -import net.runelite.api.HeadIcon; -import net.runelite.api.ItemID; -import net.runelite.api.NPC; -import net.runelite.api.NPCDefinition; -import net.runelite.api.NpcID; -import net.runelite.api.ObjectID; -import net.runelite.api.Player; -import net.runelite.api.Projectile; -import net.runelite.api.ProjectileID; -import net.runelite.api.SoundEffectID; -import net.runelite.api.Varbits; -import net.runelite.api.events.AnimationChanged; -import net.runelite.api.events.GameObjectDespawned; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.events.ProjectileSpawned; -import net.runelite.api.events.StatChanged; -import net.runelite.api.events.VarbitChanged; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.events.NpcLootReceived; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.SkillIconManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import static net.runelite.client.plugins.gauntlet.Hunllef.BossAttack.LIGHTNING; -import static net.runelite.client.plugins.gauntlet.Hunllef.BossAttack.MAGIC; -import static net.runelite.client.plugins.gauntlet.Hunllef.BossAttack.PRAYER; -import static net.runelite.client.plugins.gauntlet.Hunllef.BossAttack.RANGE; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.ui.overlay.infobox.Counter; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; - -@PluginDescriptor( - name = "Gauntlet", - description = "All-in-one plugin for the Gauntlet.", - tags = {"Gauntlet"}, - enabledByDefault = false, - type = PluginType.PVM -) -@Getter(AccessLevel.PACKAGE) -public class GauntletPlugin extends Plugin -{ - private static final int BOW_ATTACK = 426; - private static final int STAFF_ATTACK = 1167; - private static final int LIGHTNING_ANIMATION = 8418; - private static final Set TORNADO_NPC_IDS = ImmutableSet.of(9025, 9039); - private static final Set MELEE_ANIMATIONS = ImmutableSet.of(395, 401, 400, 401, 386, 390, 422, 423, 401, 428, 440); - private static final Set PLAYER_ANIMATIONS = ImmutableSet.of(395, 401, 400, 401, 386, 390, 422, 423, 401, 428, 440, 426, 1167); - private static final Set HUNLLEF_MAGE_PROJECTILES = ImmutableSet.of(ProjectileID.HUNLLEF_MAGE_ATTACK, ProjectileID.HUNLLEF_CORRUPTED_MAGE_ATTACK); - private static final Set HUNLLEF_RANGE_PROJECTILES = ImmutableSet.of(ProjectileID.HUNLLEF_RANGE_ATTACK, ProjectileID.HUNLLEF_CORRUPTED_RANGE_ATTACK); - private static final Set HUNLLEF_PRAYER_PROJECTILES = ImmutableSet.of(ProjectileID.HUNLLEF_PRAYER_ATTACK, ProjectileID.HUNLLEF_CORRUPTED_PRAYER_ATTACK); - private static final Set HUNLLEF_PROJECTILES = ImmutableSet.of(ProjectileID.HUNLLEF_PRAYER_ATTACK, ProjectileID.HUNLLEF_CORRUPTED_PRAYER_ATTACK, - ProjectileID.HUNLLEF_RANGE_ATTACK, ProjectileID.HUNLLEF_CORRUPTED_RANGE_ATTACK, ProjectileID.HUNLLEF_MAGE_ATTACK, ProjectileID.HUNLLEF_CORRUPTED_MAGE_ATTACK - ); - private static final Set HUNLLEF_NPC_IDS = ImmutableSet.of(NpcID.CRYSTALLINE_HUNLLEF, NpcID.CRYSTALLINE_HUNLLEF_9022, NpcID.CRYSTALLINE_HUNLLEF_9023, - NpcID.CRYSTALLINE_HUNLLEF_9024, NpcID.CORRUPTED_HUNLLEF, NpcID.CORRUPTED_HUNLLEF_9036, NpcID.CORRUPTED_HUNLLEF_9037, NpcID.CORRUPTED_HUNLLEF_9038 - ); - private static final Set RESOURCES = ImmutableSet.of(ObjectID.CRYSTAL_DEPOSIT, ObjectID.CORRUPT_DEPOSIT, ObjectID.PHREN_ROOTS, - ObjectID.PHREN_ROOTS_36066, ObjectID.FISHING_SPOT_36068, ObjectID.FISHING_SPOT_35971, ObjectID.GRYM_ROOT, ObjectID.GRYM_ROOT_36070, - ObjectID.LINUM_TIRINUM, ObjectID.LINUM_TIRINUM_36072 - ); - private static final int GATHERING_HERB = 0; - private static final int GATHERING_CLOTH = 1; - - @Inject - @Getter(AccessLevel.NONE) - private Client client; - - @Inject - @Getter(AccessLevel.NONE) - private ClientThread clientThread; - - @Inject - @Getter(AccessLevel.NONE) - private OverlayManager overlayManager; - - @Inject - @Getter(AccessLevel.NONE) - private GauntletOverlay overlay; - - @Inject - @Getter(AccessLevel.NONE) - private GauntletInfoBoxOverlay infoboxoverlay; - - @Inject - @Getter(AccessLevel.NONE) - private GauntletConfig config; - - @Inject - @Getter(AccessLevel.NONE) - private EventBus eventBus; - - @Inject - @Getter(AccessLevel.NONE) - private GauntletTimer timer; - - @Inject - @Getter(AccessLevel.NONE) - private SkillIconManager skillIconManager; - - @Inject - @Getter(AccessLevel.NONE) - private GauntletCounter GauntletCounter; - - @Setter(AccessLevel.PACKAGE) - @Nullable - private Hunllef hunllef; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private ItemManager itemManager; - - private boolean attackVisualOutline; - private boolean completeStartup = false; - private boolean displayTimerChat; - private boolean displayTimerWidget; - @Setter(AccessLevel.PACKAGE) - private boolean flash; - private boolean flashOnWrongAttack; - private boolean highlightPrayerInfobox; - private boolean highlightResources; - private boolean highlightResourcesIcons; - private boolean highlightWidget; - private boolean overlayBoss; - private boolean overlayBossPrayer; - private boolean overlayTornadoes; - private boolean timerVisible = true; - private boolean uniqueAttackVisual; - private boolean uniquePrayerAudio; - private boolean uniquePrayerVisual; - private Color highlightResourcesColor; - private final Map items = new HashMap<>(); - private final Set projectiles = new HashSet<>(); - private final Set resources = new HashSet<>(); - - private GauntletConfig.CounterDisplay countAttacks; - private int resourceIconSize; - private Set tornadoes = new HashSet<>(); - private int projectileIconSize; - private boolean displayResources; - private Counter oreCounter; - private Counter woodCounter; - private Counter clothCounter; - private Counter fishCounter; - private Counter herbCounter; - private int oresGathered; - private int woodGathered; - private int clothGathered; - private int fishGathered; - private int herbGathered; - private int currentFarmingAction = -1; - private boolean countersVisible = false; - private int miningXp = 0; - private int farmingXp = 0; - private int woodcuttingXp = 0; - private int fishingXp = 0; - private boolean inGauntlet = false; - - @Provides - GauntletConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(GauntletConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - initializeCounters(); - overlayManager.add(overlay); - overlayManager.add(infoboxoverlay); - overlayManager.add(GauntletCounter); - timerVisible = this.displayTimerWidget; - timer.resetStates(); - if (timerVisible) - { - overlayManager.add(timer); - } - if (client.getGameState() != GameState.STARTING && client.getGameState() != GameState.UNKNOWN) - { - completeStartup = false; - clientThread.invoke(() -> - { - timer.initStates(); - completeStartup = true; - }); - } - else - { - completeStartup = true; - } - } - - private void addCounters() - { - if (!countersVisible) - { - infoBoxManager.addInfoBox(oreCounter); - infoBoxManager.addInfoBox(woodCounter); - infoBoxManager.addInfoBox(clothCounter); - infoBoxManager.addInfoBox(fishCounter); - infoBoxManager.addInfoBox(herbCounter); - countersVisible = true; - } - } - - private void initializeCounters() - { - resetGatheringCounters(); - oreCounter = new Counter(itemManager.getImage(ItemID.CORRUPTED_ORE), this, 0); - woodCounter = new Counter(itemManager.getImage(ItemID.PHREN_BARK_23878), this, 0); - clothCounter = new Counter(itemManager.getImage(ItemID.LINUM_TIRINUM_23876), this, 0); - fishCounter = new Counter(itemManager.getImage(ItemID.RAW_PADDLEFISH), this, 0); - herbCounter = new Counter(itemManager.getImage(ItemID.GRYM_LEAF_23875), this, 0); - } - - private void resetGatheringCounters() - { - oresGathered = 0; - fishGathered = 0; - woodGathered = 0; - clothGathered = 0; - herbGathered = 0; - if (oreCounter != null) updateCounters(); - } - - private void updateCounters() - { - oreCounter.setCount(oresGathered); - - woodCounter.setCount(woodGathered); - clothCounter.setCount(clothGathered); - fishCounter.setCount(fishGathered); - herbCounter.setCount(herbGathered); - } - - @Override - protected void shutDown() - { - timer.resetStates(); - if (timerVisible) - { - overlayManager.remove(timer); - timerVisible = false; - } - overlayManager.remove(overlay); - overlayManager.remove(infoboxoverlay); - overlayManager.remove(GauntletCounter); - removeCounters(); - resetGatheringCounters(); - resources.clear(); - projectiles.clear(); - tornadoes.clear(); - setHunllef(null); - } - - private void removeCounters() - { - infoBoxManager.removeInfoBox(oreCounter); - infoBoxManager.removeInfoBox(woodCounter); - infoBoxManager.removeInfoBox(clothCounter); - infoBoxManager.removeInfoBox(fishCounter); - infoBoxManager.removeInfoBox(herbCounter); - countersVisible = false; - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked menuOptionClicked) - { - if (menuOptionClicked.getTarget().toUpperCase().contains("LINUM")) - { - currentFarmingAction = GATHERING_CLOTH; - } - if (menuOptionClicked.getTarget().toUpperCase().contains("GRYM")) - { - currentFarmingAction = GATHERING_HERB; - } - } - - @Subscribe - private void onNpcLootReceived(NpcLootReceived npcLootReceived) - { - fishGathered += (int) npcLootReceived.getItems().stream().filter(item -> item.getId() == ItemID.RAW_PADDLEFISH).count(); - herbGathered += (int) npcLootReceived.getItems().stream().filter(item -> item.getId() == ItemID.GRYM_LEAF || item.getId() == ItemID.GRYM_LEAF_23875).count(); - updateCounters(); - } - - - @Subscribe - private void onStatsChanged(StatChanged event) - { - switch (event.getSkill()) - { - case MINING: - if (miningXp != event.getXp()) - { - oresGathered++; - miningXp = event.getXp(); - } - break; - case FISHING: - if (fishingXp != event.getXp()) - { - fishGathered++; - fishingXp = event.getXp(); - } - break; - case WOODCUTTING: - if (woodcuttingXp != event.getXp()) - { - woodGathered++; - woodcuttingXp = event.getXp(); - } - break; - case FARMING: - if (farmingXp != event.getXp()) - { - if (currentFarmingAction == GATHERING_HERB) - { - herbGathered++; - farmingXp = event.getXp(); - } - else if (currentFarmingAction == GATHERING_CLOTH) - { - clothGathered++; - farmingXp = event.getXp(); - } - } - break; - } - updateCounters(); - } - - @Subscribe - private void onAnimationChanged(AnimationChanged event) - { - if (hunllef == null) - { - return; - } - - final Actor actor = event.getActor(); - - // This section handles the player counter. - if (actor instanceof Player && fightingBoss()) - { - final Player player = (Player) actor; - final int anim = player.getAnimation(); - - if (player.getName() == null || client.getLocalPlayer() == null || !player.getName().equals(client.getLocalPlayer().getName()) || anim == -1 || !PLAYER_ANIMATIONS.contains(anim)) - { - return; - } - - NPCDefinition comp = hunllef.getNpc().getDefinition(); - - if (comp == null || comp.getOverheadIcon() == null) - { - return; - } - - final HeadIcon prayer = comp.getOverheadIcon(); - - switch (prayer) - { - case MELEE: - if (MELEE_ANIMATIONS.contains(anim)) - { - setFlash(true); - return; - } - hunllef.updatePlayerAttack(); - break; - case RANGED: - if (BOW_ATTACK == anim) - { - setFlash(true); - return; - } - hunllef.updatePlayerAttack(); - break; - case MAGIC: - if (STAFF_ATTACK == anim) - { - setFlash(true); - return; - } - hunllef.updatePlayerAttack(); - break; - } - } - - // This section handles the boss attack counter if they perform a lightning attack. - if (actor instanceof NPC) - { - final NPC npc = (NPC) actor; - - if (npc.getAnimation() == LIGHTNING_ANIMATION) - { - hunllef.updateAttack(LIGHTNING); - } - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("Gauntlet")) - { - return; - } - - updateConfig(); - - if (event.getKey().equals("displayTimerWidget")) - { - if (this.displayTimerWidget && !timerVisible) - { - overlayManager.add(timer); - timerVisible = true; - } - else if (!this.displayTimerWidget && timerVisible) - { - overlayManager.remove(timer); - timerVisible = false; - } - } - - if (event.getKey().equals("displayResources")) - { - if (this.displayResources && this.startedGauntlet()) - { - addCounters(); - } - else - { - removeCounters(); - } - } - } - - @Subscribe - private void onGameObjectDespawned(GameObjectDespawned event) - { - final GameObject obj = event.getGameObject(); - if (RESOURCES.contains(obj.getId())) - { - resources.removeIf(object -> object.getGameObject() == obj); - } - } - - @Subscribe - private void onGameObjectSpawned(GameObjectSpawned event) - { - final GameObject obj = event.getGameObject(); - if (RESOURCES.contains(obj.getId())) - { - resources.add(new Resources(obj, event.getTile(), skillIconManager)); - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOADING) - { - resources.clear(); - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - // This handles the timer based on player health. - if (this.completeStartup) - { - timer.checkStates(false); - } - if (!tornadoes.isEmpty()) - { - tornadoes.forEach(Tornado::updateTimeLeft); - } - if (hunllef != null) - { - if (hunllef.getTicksUntilAttack() > 0) - { - hunllef.setTicksUntilAttack(hunllef.getTicksUntilAttack() - 1); - } - } - } - - @Subscribe - private void onNpcDespawned(NpcDespawned event) - { - final NPC npc = event.getNpc(); - if (HUNLLEF_NPC_IDS.contains(npc.getId())) - { - setHunllef(null); - resetGatheringCounters(); - } - else if (TORNADO_NPC_IDS.contains(npc.getId())) - { - tornadoes.removeIf(tornado -> tornado.getNpc() == npc); - } - } - - @Subscribe - private void onNpcSpawned(NpcSpawned event) - { - final NPC npc = event.getNpc(); - if (HUNLLEF_NPC_IDS.contains(npc.getId())) - { - setHunllef(new Hunllef(npc, skillIconManager)); - } - else if (TORNADO_NPC_IDS.contains(npc.getId())) - { - tornadoes.add(new Tornado(npc)); - } - } - - @Subscribe - private void onProjectileSpawned(ProjectileSpawned event) - { - if (hunllef == null) - { - return; - } - - final Projectile proj = event.getProjectile(); - - if (HUNLLEF_PROJECTILES.contains(proj.getId())) - { - projectiles.add(new Missiles(proj, skillIconManager)); - if (HUNLLEF_MAGE_PROJECTILES.contains(proj.getId())) - { - hunllef.updateAttack(MAGIC); - } - else if (HUNLLEF_PRAYER_PROJECTILES.contains(proj.getId())) - { - hunllef.updateAttack(PRAYER); - if (this.uniquePrayerAudio) - { - client.playSoundEffect(SoundEffectID.MAGIC_SPLASH_BOING); - } - } - else if (HUNLLEF_RANGE_PROJECTILES.contains(proj.getId())) - { - hunllef.updateAttack(RANGE); - } - } - } - - @Subscribe - private void onVarbitChanged(VarbitChanged event) - { - if (client.getVar(Varbits.GAUNTLET_ENTERED) == 1 && !inGauntlet) - { - resetGatheringCounters(); - inGauntlet = true; - } - if (this.completeStartup) - { - timer.checkStates(true); - } - if (startedGauntlet() && displayResources) - { - addCounters(); - } - else - { - removeCounters(); - inGauntlet = false; - } - } - - boolean fightingBoss() - { - return client.getVar(Varbits.GAUNTLET_FINAL_ROOM_ENTERED) == 1; - } - - boolean startedGauntlet() - { - return client.getVar(Varbits.GAUNTLET_ENTERED) == 1; - } - - private void updateConfig() - { - this.highlightResources = config.highlightResources(); - this.highlightResourcesColor = config.highlightResourcesColor(); - this.highlightResourcesIcons = config.highlightResourcesIcons(); - this.flashOnWrongAttack = config.flashOnWrongAttack(); - this.highlightWidget = config.highlightWidget(); - this.resourceIconSize = config.resourceIconSize(); - this.projectileIconSize = config.projectileIconSize(); - this.countAttacks = config.countAttacks(); - this.uniquePrayerAudio = config.uniquePrayerAudio(); - this.uniquePrayerVisual = config.uniquePrayerVisual(); - this.uniqueAttackVisual = config.uniqueAttackVisual(); - this.overlayBoss = config.overlayBoss(); - this.overlayBossPrayer = config.overlayBossPrayer(); - this.overlayTornadoes = config.overlayTornadoes(); - this.displayTimerWidget = config.displayTimerWidget(); - this.displayTimerChat = config.displayTimerChat(); - this.attackVisualOutline = config.attackVisualOutline(); - this.highlightPrayerInfobox = config.highlightPrayerInfobox(); - this.displayResources = config.displayGatheredResources(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletTimer.java b/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletTimer.java deleted file mode 100644 index 815c131db3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletTimer.java +++ /dev/null @@ -1,313 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.gauntlet; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.Player; -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 static net.runelite.client.plugins.gauntlet.GauntletTimer.RaidState.IN_BOSS; -import static net.runelite.client.plugins.gauntlet.GauntletTimer.RaidState.IN_RAID; -import static net.runelite.client.plugins.gauntlet.GauntletTimer.RaidState.UNKNOWN; -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; -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; - -class GauntletTimer extends Overlay -{ - private final Client client; - private final GauntletPlugin plugin; - private final PanelComponent panelComponent = new PanelComponent(); - @Inject - private ChatMessageManager chatMessageManager; - private long timeRaidStart = -1L; - private long timeBossEnter = -1L; - private RaidState currentState = UNKNOWN; - - @Inject - public GauntletTimer(Client client, GauntletPlugin plugin) - { - super(plugin); - - setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT); - setPriority(OverlayPriority.HIGH); - - this.client = client; - this.plugin = plugin; - - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Gauntlet Timer Overlay")); - } - - /** - * Resets the timer. - */ - void resetStates() - { - timeRaidStart = -1L; - timeBossEnter = -1L; - - currentState = UNKNOWN; - } - - /** - * This is called when the player resets the plugin mid-raid. We do not want to confuse the timer. - *

- * TODO: Originally, this function will disable the timer if the plugin is started mid raid. - * Unfortunately, VARBITS can't be checked unless you're on the client thread. - * I've no idea how to access RL's task handler. - * Good luck to you. If you restart plugin mid raid, oh well. Your timer's going to be inaccurate. - */ - void initStates() - { - timeRaidStart = -1L; - timeBossEnter = -1L; - - if (plugin.startedGauntlet()) - { - currentState = IN_RAID; - if (plugin.fightingBoss()) - { - currentState = IN_BOSS; - } - } - else - { - currentState = UNKNOWN; - } - } - - /** - * Converts the different between two epoch times into minutes:seconds format. - * - * @param epochA long - * @param epochB long - * @return String - */ - private String calculateElapsedTime(long epochA, long epochB) - { - long max = Math.max(epochA, epochB); - long min = Math.min(epochA, epochB); - - long elapsedEpoch = max - min; - long seconds = elapsedEpoch / 1000L; - - long minutes = seconds / 60L; - seconds = seconds % 60; - - if (seconds == 0) - { - return minutes + ":00"; - } - - if (seconds < 10) - { - return minutes + ":0" + seconds; - } - - return minutes + ":" + seconds; - } - - /** - * Called when varbit changes. See if the the raid state has changed. - */ - void checkStates(boolean checkVarps) - { - final Player p = client.getLocalPlayer(); - - if (p == null || !plugin.isCompleteStartup()) - { - return; - } - - if (checkVarps) - { - switch (currentState) - { - case UNKNOWN: - if (plugin.startedGauntlet() && p.getHealthRatio() != 0) - { - // Player has started a new raid. - if (!plugin.fightingBoss()) - { - currentState = IN_RAID; - timeRaidStart = System.currentTimeMillis(); - return; - } - currentState = IN_RAID; - timeRaidStart = timeBossEnter = System.currentTimeMillis(); - } - break; - case IN_RAID: - if (!plugin.startedGauntlet()) - { - printPrepTime(); - resetStates(); - return; - } - if (plugin.fightingBoss()) - { - // Player has begun the boss fight. - printPrepTime(); - currentState = IN_BOSS; - timeBossEnter = System.currentTimeMillis(); - } - break; - case IN_BOSS: - if (!plugin.fightingBoss() || !plugin.startedGauntlet()) - { - // Player has killed the boss. - resetStates(); - } - break; - } - } - else - { - if (currentState == IN_BOSS && p.getHealthRatio() == 0) - { - printBossTime(); - resetStates(); - } - } - } - - private void printPrepTime() - { - if (!plugin.isDisplayTimerChat() || timeRaidStart == -1L) - { - return; - } - - String elapsedTime = calculateElapsedTime(System.currentTimeMillis(), timeRaidStart); - - final ChatMessageBuilder prepmessage = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Preparation time: ") - .append(ChatColorType.HIGHLIGHT) - .append(elapsedTime); - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.CONSOLE) - .runeLiteFormattedMessage(prepmessage.build()) - .build()); - } - - private void printBossTime() - { - if (!plugin.isDisplayTimerChat() || timeRaidStart == -1L || timeBossEnter == -1L) - { - return; - } - - String elapsedBossTime = calculateElapsedTime(System.currentTimeMillis(), timeBossEnter); - String elapsedPrepTime = calculateElapsedTime(timeRaidStart, timeBossEnter); - String elapsedTotalTime = calculateElapsedTime(System.currentTimeMillis(), timeRaidStart); - - final ChatMessageBuilder challengedurationmessage = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Challenge duration: ") - .append(ChatColorType.HIGHLIGHT) - .append(elapsedTotalTime); - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.CONSOLE) - .runeLiteFormattedMessage(challengedurationmessage.build()) - .build()); - - final ChatMessageBuilder prepdeathmessage = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Preparation time: ") - .append(ChatColorType.HIGHLIGHT) - .append(elapsedPrepTime) - .append(ChatColorType.NORMAL) - .append(" player/boss death time: ") - .append(ChatColorType.HIGHLIGHT) - .append(elapsedBossTime); - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.CONSOLE) - .runeLiteFormattedMessage(prepdeathmessage.build()) - .build()); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (currentState == UNKNOWN) - { - return null; - } - - panelComponent.getChildren().clear(); - panelComponent.getChildren().add(TitleComponent.builder().text("Gauntlet Timer").color(Color.WHITE).build()); - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - if (timeRaidStart == -1L) - { // User restarted the plugin mid raid. Timer is inaccurate. - tableComponent.addRow("Inactive", "0:00"); - } - else - { - String elapsedPrepTime, elapsedBossTime, elapsedTotalTime; - elapsedTotalTime = calculateElapsedTime(System.currentTimeMillis(), timeRaidStart); - - if (currentState == IN_RAID) - { - elapsedPrepTime = calculateElapsedTime(timeRaidStart, System.currentTimeMillis()); - elapsedBossTime = "0:00"; - } - else - { - elapsedPrepTime = calculateElapsedTime(timeRaidStart, timeBossEnter); - elapsedBossTime = calculateElapsedTime(System.currentTimeMillis(), timeBossEnter); - } - tableComponent.addRow("Preparation", elapsedPrepTime); - tableComponent.addRow("Boss Fight", elapsedBossTime); - tableComponent.addRow("Total Time", elapsedTotalTime); - panelComponent.getChildren().add(tableComponent); - } - return panelComponent.render(graphics); - } - - public enum RaidState - { - UNKNOWN, IN_RAID, IN_BOSS - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/Hunllef.java b/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/Hunllef.java deleted file mode 100644 index 215c061923..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/Hunllef.java +++ /dev/null @@ -1,149 +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.gauntlet; - -import java.awt.Color; -import java.awt.image.BufferedImage; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.NPC; -import net.runelite.api.Prayer; -import net.runelite.api.Skill; -import net.runelite.client.game.SkillIconManager; - -@Getter(AccessLevel.PACKAGE) -@Setter(AccessLevel.PACKAGE) -public class Hunllef -{ - private NPC npc; - private int bossAttacks; - private int playerAttacks; - private int ticksUntilAttack; - private BufferedImage mage; - private BufferedImage range; - private BossAttackPhase currentPhase; - - Hunllef(NPC npc, SkillIconManager skillIconManager) - { - this.npc = npc; - this.bossAttacks = 0; - this.playerAttacks = 6; - this.ticksUntilAttack = 0; - this.mage = skillIconManager.getSkillImage(Skill.MAGIC); - this.range = skillIconManager.getSkillImage(Skill.RANGED); - this.currentPhase = BossAttackPhase.UNKNOWN; - } - - void updatePlayerAttack() - { - playerAttacks--; - if (playerAttacks <= 0) - { - playerAttacks = 6; - } - } - - void updateAttack(BossAttack style) - { - ticksUntilAttack = 6; - if (style == BossAttack.PRAYER) - { - style = BossAttack.MAGIC; - } - - if (style == BossAttack.LIGHTNING) - { - bossAttacks--; - } - else if (style == BossAttack.RANGE) - { - if (currentPhase != BossAttackPhase.RANGE) - { - currentPhase = BossAttackPhase.RANGE; - bossAttacks = 3; - } - else - { - bossAttacks--; - } - } - else if (style == BossAttack.MAGIC) - { - if (currentPhase != BossAttackPhase.MAGIC) - { - currentPhase = BossAttackPhase.MAGIC; - bossAttacks = 3; - } - else - { - bossAttacks--; - } - } - - if (bossAttacks <= 0) - { - BossAttackPhase nextPhase; - - switch (currentPhase) - { - case MAGIC: - bossAttacks = 4; - nextPhase = BossAttackPhase.RANGE; - break; - case RANGE: - bossAttacks = 4; - nextPhase = BossAttackPhase.MAGIC; - break; - default: - bossAttacks = 0; - nextPhase = BossAttackPhase.UNKNOWN; - break; - } - currentPhase = nextPhase; - } - } - - @AllArgsConstructor - @Getter(AccessLevel.PACKAGE) - enum BossAttackPhase - { - MAGIC(Color.CYAN, Prayer.PROTECT_FROM_MAGIC), - RANGE(Color.GREEN, Prayer.PROTECT_FROM_MISSILES), - UNKNOWN(Color.WHITE, null); - - private Color color; - private Prayer prayer; - } - - enum BossAttack - { - MAGIC, - RANGE, - PRAYER, - LIGHTNING - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/Missiles.java b/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/Missiles.java deleted file mode 100644 index 445d50a77a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/Missiles.java +++ /dev/null @@ -1,87 +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.gauntlet; - -import java.awt.Color; -import java.awt.image.BufferedImage; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Projectile; -import net.runelite.api.ProjectileID; -import net.runelite.api.Skill; -import net.runelite.client.game.SkillIconManager; - -@Getter(AccessLevel.PACKAGE) -class Missiles -{ - private Projectile projectile; - private int id; - private BufferedImage image; - private Color color; - - Missiles(Projectile projectile, SkillIconManager skillIconManager) - { - this.projectile = projectile; - this.id = projectile.getId(); - this.image = assignedImage(skillIconManager, id); - this.color = assignedColor(id); - } - - private Color assignedColor(int id) - { - switch (id) - { - case ProjectileID.HUNLLEF_MAGE_ATTACK: - case ProjectileID.HUNLLEF_CORRUPTED_MAGE_ATTACK: - return Color.CYAN; - case ProjectileID.HUNLLEF_RANGE_ATTACK: - case ProjectileID.HUNLLEF_CORRUPTED_RANGE_ATTACK: - return Color.GREEN; - case ProjectileID.HUNLLEF_PRAYER_ATTACK: - case ProjectileID.HUNLLEF_CORRUPTED_PRAYER_ATTACK: - return Color.MAGENTA; - default: - return null; - } - } - - private BufferedImage assignedImage(SkillIconManager SkillIconManager, int id) - { - switch (id) - { - case ProjectileID.HUNLLEF_MAGE_ATTACK: - case ProjectileID.HUNLLEF_CORRUPTED_MAGE_ATTACK: - return SkillIconManager.getSkillImage(Skill.MAGIC); - case ProjectileID.HUNLLEF_RANGE_ATTACK: - case ProjectileID.HUNLLEF_CORRUPTED_RANGE_ATTACK: - return SkillIconManager.getSkillImage(Skill.RANGED); - case ProjectileID.HUNLLEF_PRAYER_ATTACK: - case ProjectileID.HUNLLEF_CORRUPTED_PRAYER_ATTACK: - return SkillIconManager.getSkillImage(Skill.PRAYER); - default: - return null; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/Resources.java b/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/Resources.java deleted file mode 100644 index 517a393ca8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/Resources.java +++ /dev/null @@ -1,72 +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.gauntlet; - -import java.awt.image.BufferedImage; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.GameObject; -import net.runelite.api.ObjectID; -import net.runelite.api.Skill; -import net.runelite.api.Tile; -import net.runelite.client.game.SkillIconManager; - -@Getter(AccessLevel.PACKAGE) -class Resources -{ - private GameObject gameObject; - private Tile tile; - private BufferedImage image; - - Resources(GameObject object, Tile tile, SkillIconManager skillIconManager) - { - this.gameObject = object; - this.tile = tile; - this.image = assignedImage(skillIconManager, object.getId()); - } - - private BufferedImage assignedImage(SkillIconManager SkillIconManager, int id) - { - switch (id) - { - case ObjectID.CRYSTAL_DEPOSIT: - case ObjectID.CORRUPT_DEPOSIT: - return SkillIconManager.getSkillImage(Skill.MINING); - case ObjectID.PHREN_ROOTS: - case ObjectID.PHREN_ROOTS_36066: - return SkillIconManager.getSkillImage(Skill.WOODCUTTING); - case ObjectID.FISHING_SPOT_36068: - case ObjectID.FISHING_SPOT_35971: - return SkillIconManager.getSkillImage(Skill.FISHING); - case ObjectID.GRYM_ROOT: - case ObjectID.GRYM_ROOT_36070: - return SkillIconManager.getSkillImage(Skill.HERBLORE); - case ObjectID.LINUM_TIRINUM: - case ObjectID.LINUM_TIRINUM_36072: - return SkillIconManager.getSkillImage(Skill.FARMING); - default: - return null; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/Tornado.java b/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/Tornado.java deleted file mode 100644 index a9d2dee2b2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/Tornado.java +++ /dev/null @@ -1,50 +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.gauntlet; - -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.NPC; - -@Getter(AccessLevel.PACKAGE) -class Tornado -{ - private NPC npc; - private int timeLeft; - - Tornado(NPC npc) - { - this.npc = npc; - this.timeLeft = 20; - } - - void updateTimeLeft() - { - if (timeLeft > 0) - { - timeLeft--; - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GLUtil.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GLUtil.java deleted file mode 100644 index 7c51d67e62..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GLUtil.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) 2018, 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.gpu; - -import com.jogamp.opengl.GL4; -import java.io.InputStream; -import java.util.Scanner; -import lombok.extern.slf4j.Slf4j; - -@Slf4j -class GLUtil -{ - private static final int ERR_LEN = 1024; - - private static final int[] buf = new int[1]; - private static final float[] fbuf = new float[1]; - - static int glGetInteger(GL4 gl) - { - gl.glGetIntegerv(com.jogamp.opengl.GL.GL_MAX_SAMPLES, buf, 0); - return buf[0]; - } - - static float glGetFloat(GL4 gl) - { - gl.glGetFloatv(com.jogamp.opengl.GL.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, fbuf, 0); - return fbuf[0]; - } - - private static int glGetShader(GL4 gl, int shader) - { - gl.glGetShaderiv(shader, com.jogamp.opengl.GL2ES2.GL_COMPILE_STATUS, buf, 0); - assert buf[0] > -1; - return buf[0]; - } - - private static int glGetProgram(GL4 gl, int program, int pname) - { - gl.glGetProgramiv(program, pname, buf, 0); - assert buf[0] > -1; - return buf[0]; - } - - private static String glGetShaderInfoLog(GL4 gl, int shader) - { - byte[] err = new byte[ERR_LEN]; - gl.glGetShaderInfoLog(shader, ERR_LEN, buf, 0, err, 0); - return new String(err); - } - - static String glGetProgramInfoLog(GL4 gl, int program) - { - byte[] err = new byte[ERR_LEN]; - gl.glGetProgramInfoLog(program, ERR_LEN, buf, 0, err, 0); - return new String(err); - } - - static int glGenVertexArrays(GL4 gl) - { - gl.glGenVertexArrays(1, buf, 0); - return buf[0]; - } - - static void glDeleteVertexArrays(GL4 gl, int vertexArray) - { - buf[0] = vertexArray; - gl.glDeleteVertexArrays(1, buf, 0); - } - - static int glGenBuffers(GL4 gl) - { - gl.glGenBuffers(1, buf, 0); - return buf[0]; - } - - static void glDeleteBuffer(GL4 gl, int buffer) - { - buf[0] = buffer; - gl.glDeleteBuffers(1, buf, 0); - } - - static int glGenTexture(GL4 gl) - { - gl.glGenTextures(1, buf, 0); - return buf[0]; - } - - static void glDeleteTexture(GL4 gl, int texture) - { - buf[0] = texture; - gl.glDeleteTextures(1, buf, 0); - } - - static int glGenFrameBuffer(GL4 gl) - { - gl.glGenFramebuffers(1, buf, 0); - return buf[0]; - } - - static void glDeleteFrameBuffer(GL4 gl, int frameBuffer) - { - buf[0] = frameBuffer; - gl.glDeleteFramebuffers(1, buf, 0); - } - - static int glGenRenderbuffer(GL4 gl) - { - gl.glGenRenderbuffers(1, buf, 0); - return buf[0]; - } - - static void glDeleteRenderbuffers(GL4 gl, int renderBuffer) - { - buf[0] = renderBuffer; - gl.glDeleteRenderbuffers(1, buf, 0); - } - - static void loadShaders(GL4 gl, int glProgram, int glVertexShader, int glGeometryShader, int glFragmentShader, - String vertexShaderStr, String geomShaderStr, String fragShaderStr) throws ShaderException - { - compileAndAttach(gl, glProgram, glVertexShader, vertexShaderStr); - - if (glGeometryShader != -1) - { - compileAndAttach(gl, glProgram, glGeometryShader, geomShaderStr); - } - - compileAndAttach(gl, glProgram, glFragmentShader, fragShaderStr); - - gl.glLinkProgram(glProgram); - - if (glGetProgram(gl, glProgram, gl.GL_LINK_STATUS) == gl.GL_FALSE) - { - String err = glGetProgramInfoLog(gl, glProgram); - throw new ShaderException(err); - } - - gl.glValidateProgram(glProgram); - - if (glGetProgram(gl, glProgram, gl.GL_VALIDATE_STATUS) == gl.GL_FALSE) - { - String err = glGetProgramInfoLog(gl, glProgram); - throw new ShaderException(err); - } - } - - static void loadComputeShader(GL4 gl, int glProgram, int glComputeShader, String str) throws ShaderException - { - compileAndAttach(gl, glProgram, glComputeShader, str); - - gl.glLinkProgram(glProgram); - - if (glGetProgram(gl, glProgram, gl.GL_LINK_STATUS) == gl.GL_FALSE) - { - String err = glGetProgramInfoLog(gl, glProgram); - throw new ShaderException(err); - } - - gl.glValidateProgram(glProgram); - - if (glGetProgram(gl, glProgram, gl.GL_VALIDATE_STATUS) == gl.GL_FALSE) - { - String err = glGetProgramInfoLog(gl, glProgram); - throw new ShaderException(err); - } - } - - private static void compileAndAttach(GL4 gl, int program, int shader, String source) throws ShaderException - { - gl.glShaderSource(shader, 1, new String[]{source}, null); - gl.glCompileShader(shader); - - if (glGetShader(gl, shader) == gl.GL_TRUE) - { - gl.glAttachShader(program, shader); - } - else - { - String err = glGetShaderInfoLog(gl, shader); - log.info(String.valueOf(program)); - throw new ShaderException(err); - } - } - - static String inputStreamToString(InputStream in) - { - Scanner scanner = new Scanner(in).useDelimiter("\\A"); - return scanner.next(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuFloatBuffer.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuFloatBuffer.java deleted file mode 100644 index a5901d65b2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuFloatBuffer.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2018, 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.gpu; - -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.FloatBuffer; - -class GpuFloatBuffer -{ - private FloatBuffer buffer = allocateDirect(65536); - - void put(float texture, float u, float v) - { - buffer.put(texture).put(u).put(v).put((float) 0.0); - } - - void flip() - { - buffer.flip(); - } - - void clear() - { - buffer.clear(); - } - - void ensureCapacity(int size) - { - while (buffer.remaining() < size) - { - FloatBuffer newB = allocateDirect(buffer.capacity() * 2); - buffer.flip(); - newB.put(buffer); - buffer = newB; - } - } - - FloatBuffer getBuffer() - { - return buffer; - } - - static FloatBuffer allocateDirect(int size) - { - return ByteBuffer.allocateDirect(size * Float.BYTES) - .order(ByteOrder.nativeOrder()) - .asFloatBuffer(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuIntBuffer.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuIntBuffer.java deleted file mode 100644 index bc85a230b0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuIntBuffer.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2018, 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.gpu; - -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.IntBuffer; - -class GpuIntBuffer -{ - private IntBuffer buffer = allocateDirect(65536); - - void put(int x, int y, int z, int c) - { - buffer.put(x).put(y).put(z).put(c); - } - - void flip() - { - buffer.flip(); - } - - void clear() - { - buffer.clear(); - } - - void ensureCapacity(int size) - { - while (buffer.remaining() < size) - { - IntBuffer newB = allocateDirect(buffer.capacity() * 2); - buffer.flip(); - newB.put(buffer); - buffer = newB; - } - } - - IntBuffer getBuffer() - { - return buffer; - } - - static IntBuffer allocateDirect(int size) - { - return ByteBuffer.allocateDirect(size * Integer.BYTES) - .order(ByteOrder.nativeOrder()) - .asIntBuffer(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java deleted file mode 100644 index 6babb89392..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java +++ /dev/null @@ -1,1591 +0,0 @@ -/* - * Copyright (c) 2018, 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.gpu; - -import com.google.inject.Provides; -import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration; -import com.jogamp.nativewindow.awt.JAWTWindow; -import com.jogamp.opengl.GL; -import com.jogamp.opengl.GL4; -import com.jogamp.opengl.GLCapabilities; -import com.jogamp.opengl.GLContext; -import com.jogamp.opengl.GLDrawable; -import com.jogamp.opengl.GLDrawableFactory; -import com.jogamp.opengl.GLException; -import com.jogamp.opengl.GLProfile; -import java.awt.Canvas; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.geom.AffineTransform; -import java.awt.image.BufferedImage; -import java.awt.image.DataBufferInt; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.FloatBuffer; -import java.nio.IntBuffer; -import java.util.function.Function; -import javax.inject.Inject; -import javax.inject.Singleton; -import jogamp.nativewindow.SurfaceScaleUtils; -import jogamp.nativewindow.jawt.x11.X11JAWTWindow; -import jogamp.newt.awt.NewtFactoryAWT; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.BufferProvider; -import net.runelite.api.Client; -import net.runelite.api.Constants; -import net.runelite.api.Entity; -import net.runelite.api.GameState; -import net.runelite.api.Model; -import net.runelite.api.NodeCache; -import net.runelite.api.Perspective; -import net.runelite.api.Scene; -import net.runelite.api.Texture; -import net.runelite.api.TextureProvider; -import net.runelite.api.TileModel; -import net.runelite.api.TilePaint; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.hooks.DrawCallbacks; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginInstantiationException; -import net.runelite.client.plugins.PluginManager; -import net.runelite.client.plugins.PluginType; -import static net.runelite.client.plugins.gpu.GLUtil.*; -import net.runelite.client.plugins.gpu.config.AnisotropicFilteringMode; -import net.runelite.client.plugins.gpu.config.AntiAliasingMode; -import net.runelite.client.plugins.gpu.config.UIScalingMode; -import net.runelite.client.plugins.gpu.template.Template; -import net.runelite.client.ui.DrawManager; -import net.runelite.client.util.OSType; - -@PluginDescriptor( - name = "GPU", - description = "Utilizes the GPU", - enabledByDefault = false, - tags = {"fog", "draw distance"}, - type = PluginType.MISCELLANEOUS -) -@Slf4j -@Singleton -public class GpuPlugin extends Plugin implements DrawCallbacks -{ - // This is the maximum number of triangles the compute shaders support - private static final int MAX_TRIANGLE = 4096; - static final int SMALL_TRIANGLE_COUNT = 512; - private static final int FLAG_SCENE_BUFFER = Integer.MIN_VALUE; - static final int MAX_DISTANCE = 90; - static final int MAX_FOG_DEPTH = 100; - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private GpuPluginConfig config; - - @Inject - private TextureManager textureManager; - - @Inject - private SceneUploader sceneUploader; - - @Inject - private DrawManager drawManager; - - @Inject - private PluginManager pluginManager; - - private Canvas canvas; - private JAWTWindow jawtWindow; - private GL4 gl; - private GLContext glContext; - private GLDrawable glDrawable; - - private int glProgram; - private int glVertexShader; - private int glGeomShader; - private int glFragmentShader; - - private int glComputeProgram; - private int glComputeShader; - - private int glSmallComputeProgram; - private int glSmallComputeShader; - - private int glUnorderedComputeProgram; - private int glUnorderedComputeShader; - - private int vaoHandle; - - private int interfaceTexture; - - private int glUiProgram; - private int glUiVertexShader; - private int glUiFragmentShader; - - private int vaoUiHandle; - private int vboUiHandle; - - private int fboSceneHandle; - private int texSceneHandle; - private int rboSceneHandle; - - // scene vertex buffer id - private int bufferId; - // scene uv buffer id - private int uvBufferId; - - private int textureArrayId; - - private int uniformBufferId; - private final IntBuffer uniformBuffer = GpuIntBuffer.allocateDirect(5 + 3 + 2048 * 4); - private final float[] textureOffsets = new float[128]; - - private GpuIntBuffer vertexBuffer; - private GpuFloatBuffer uvBuffer; - - private GpuIntBuffer modelBufferUnordered; - private GpuIntBuffer modelBufferSmall; - private GpuIntBuffer modelBuffer; - - private int unorderedModels; - - /** - * number of models in small buffer - */ - private int smallModels; - - /** - * number of models in large buffer - */ - private int largeModels; - - /** - * offset in the target buffer for model - */ - private int targetBufferOffset; - - /** - * offset into the temporary scene vertex buffer - */ - private int tempOffset; - - /** - * offset into the temporary scene uv buffer - */ - private int tempUvOffset; - - private int lastViewportWidth; - private int lastViewportHeight; - private int lastCanvasWidth; - private int lastCanvasHeight; - private int lastStretchedCanvasWidth; - private int lastStretchedCanvasHeight; - private AntiAliasingMode lastAntiAliasingMode; - private AnisotropicFilteringMode lastAnisotropicFilteringMode; - - private int centerX; - private int centerY; - private int yaw; - private int pitch; - - // Uniforms - private int uniUseFog; - private int uniFogColor; - private int uniFogDepth; - private int uniFogCornerRadius; - private int uniFogDensity; - private int uniDrawDistance; - private int uniProjectionMatrix; - private int uniBrightness; - private int uniTex; - private int uniTexSamplingMode; - private int uniTexSourceDimensions; - private int uniTexTargetDimensions; - private int uniTextures; - private int uniTextureOffsets; - private int uniBlockSmall; - private int uniBlockLarge; - private int uniBlockMain; - private int uniSmoothBanding; - private int uniAmbientLighting; - - private int drawDistance; - private boolean smoothBanding; - private boolean ambientLighting; - private AntiAliasingMode antiAliasingMode; - private AnisotropicFilteringMode anisotropicFilteringMode; - private int fogDepth; - private int fogCircularity; - private int fogDensity; - private UIScalingMode uiScalingMode; - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("gpu")) - { - updateConfig(); - } - } - - private void updateConfig() - { - this.drawDistance = config.drawDistance(); - this.smoothBanding = config.smoothBanding(); - this.antiAliasingMode = config.antiAliasingMode(); - this.anisotropicFilteringMode = config.anisotropicFilteringMode(); - this.fogDepth = config.fogDepth(); - this.fogCircularity = config.fogCircularity(); - this.fogDensity = config.fogDensity(); - this.uiScalingMode = config.uiScalingMode(); - this.ambientLighting = config.ambientLighting(); - } - - @Override - protected void startUp() - { - updateConfig(); - - clientThread.invoke(() -> - { - try - { - bufferId = uvBufferId = uniformBufferId = -1; - unorderedModels = smallModels = largeModels = 0; - - canvas = client.getCanvas(); - - if (!canvas.isDisplayable()) - { - return false; - } - - canvas.setIgnoreRepaint(true); - - vertexBuffer = new GpuIntBuffer(); - uvBuffer = new GpuFloatBuffer(); - - modelBufferUnordered = new GpuIntBuffer(); - modelBufferSmall = new GpuIntBuffer(); - modelBuffer = new GpuIntBuffer(); - - GLProfile.initSingleton(); - - GLProfile glProfile = GLProfile.get(GLProfile.GL4); - - GLCapabilities glCaps = new GLCapabilities(glProfile); - AWTGraphicsConfiguration config = AWTGraphicsConfiguration.create(canvas.getGraphicsConfiguration(), glCaps, glCaps); - - jawtWindow = NewtFactoryAWT.getNativeWindow(canvas, config); - canvas.setFocusable(true); - - GLDrawableFactory glDrawableFactory = GLDrawableFactory.getFactory(glProfile); - - glDrawable = glDrawableFactory.createGLDrawable(jawtWindow); - glDrawable.setRealized(true); - - glContext = glDrawable.createContext(null); - - int res = glContext.makeCurrent(); - if (res == GLContext.CONTEXT_NOT_CURRENT) - { - throw new GLException("Unable to make context current"); - } - - // Surface needs to be unlocked on X11 window otherwise input is blocked - if (jawtWindow instanceof X11JAWTWindow && jawtWindow.getLock().isLocked()) - { - jawtWindow.unlockSurface(); - } - - this.gl = glContext.getGL().getGL4(); - gl.setSwapInterval(0); - - initVao(); - initProgram(); - initInterfaceTexture(); - initUniformBuffer(); - - client.setDrawCallbacks(this); - client.setGpu(true); - - // force rebuild of main buffer provider to enable alpha channel - client.resizeCanvas(); - - lastViewportWidth = lastViewportHeight = lastCanvasWidth = lastCanvasHeight = -1; - lastStretchedCanvasWidth = lastStretchedCanvasHeight = -1; - lastAntiAliasingMode = null; - - textureArrayId = -1; - - // increase size of model cache for dynamic objects since we are extending scene size - NodeCache cachedModels2 = client.getCachedModels2(); - cachedModels2.setCapacity(256); - cachedModels2.setRemainingCapacity(256); - cachedModels2.reset(); - - if (client.getGameState() == GameState.LOGGED_IN) - { - uploadScene(); - } - } - catch (Throwable e) - { - log.error("Error starting GPU plugin", e); - - try - { - pluginManager.setPluginEnabled(this, false); - pluginManager.stopPlugin(this); - } - catch (PluginInstantiationException ex) - { - log.error("error stopping plugin", ex); - } - - shutDown(); - } - return true; - }); - } - - @Override - protected void shutDown() - { - clientThread.invoke(() -> - { - client.setGpu(false); - client.setDrawCallbacks(null); - - if (gl != null) - { - if (textureArrayId != -1) - { - textureManager.freeTextureArray(gl, textureArrayId); - textureArrayId = -1; - } - - if (bufferId != -1) - { - GLUtil.glDeleteBuffer(gl, bufferId); - bufferId = -1; - } - - if (uvBufferId != -1) - { - GLUtil.glDeleteBuffer(gl, uvBufferId); - uvBufferId = -1; - } - - if (uniformBufferId != -1) - { - GLUtil.glDeleteBuffer(gl, uniformBufferId); - uniformBufferId = -1; - } - - shutdownInterfaceTexture(); - shutdownProgram(); - shutdownVao(); - shutdownSceneFbo(); - } - - if (jawtWindow != null) - { - if (!jawtWindow.getLock().isLocked()) - { - jawtWindow.lockSurface(); - } - - if (glContext != null) - { - glContext.destroy(); - } - - NewtFactoryAWT.destroyNativeWindow(jawtWindow); - } - - jawtWindow = null; - gl = null; - glDrawable = null; - glContext = null; - - vertexBuffer = null; - uvBuffer = null; - - modelBufferSmall = null; - modelBuffer = null; - modelBufferUnordered = null; - - // force main buffer provider rebuild to turn off alpha channel - client.resizeCanvas(); - }); - } - - @Provides - GpuPluginConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(GpuPluginConfig.class); - } - - private void initProgram() throws ShaderException - { - glProgram = gl.glCreateProgram(); - glVertexShader = gl.glCreateShader(gl.GL_VERTEX_SHADER); - glGeomShader = gl.glCreateShader(gl.GL_GEOMETRY_SHADER); - glFragmentShader = gl.glCreateShader(gl.GL_FRAGMENT_SHADER); - - final String glVersionHeader; - - if (OSType.getOSType() == OSType.Linux) - { - glVersionHeader = - "#version 420\n" + - "#extension GL_ARB_compute_shader : require\n" + - "#extension GL_ARB_shader_storage_buffer_object : require\n"; - } - else - { - glVersionHeader = "#version 430\n"; - } - - Function resourceLoader = (s) -> - { - if (s.endsWith(".glsl")) - { - return inputStreamToString(getClass().getResourceAsStream(s)); - } - - if (s.equals("version_header")) - { - return glVersionHeader; - } - - return ""; - }; - - Template template = new Template(resourceLoader); - String source = template.process(resourceLoader.apply("geom.glsl")); - - template = new Template(resourceLoader); - String vertSource = template.process(resourceLoader.apply("vert.glsl")); - - template = new Template(resourceLoader); - String fragSource = template.process(resourceLoader.apply("frag.glsl")); - - GLUtil.loadShaders(gl, glProgram, glVertexShader, glGeomShader, glFragmentShader, - vertSource, - source, - fragSource); - - glComputeProgram = gl.glCreateProgram(); - glComputeShader = gl.glCreateShader(gl.GL_COMPUTE_SHADER); - template = new Template(resourceLoader); - source = template.process(resourceLoader.apply("comp.glsl")); - GLUtil.loadComputeShader(gl, glComputeProgram, glComputeShader, source); - - glSmallComputeProgram = gl.glCreateProgram(); - glSmallComputeShader = gl.glCreateShader(gl.GL_COMPUTE_SHADER); - template = new Template(resourceLoader); - source = template.process(resourceLoader.apply("comp_small.glsl")); - GLUtil.loadComputeShader(gl, glSmallComputeProgram, glSmallComputeShader, source); - - glUnorderedComputeProgram = gl.glCreateProgram(); - glUnorderedComputeShader = gl.glCreateShader(gl.GL_COMPUTE_SHADER); - template = new Template(resourceLoader); - source = template.process(resourceLoader.apply("comp_unordered.glsl")); - GLUtil.loadComputeShader(gl, glUnorderedComputeProgram, glUnorderedComputeShader, source); - - glUiProgram = gl.glCreateProgram(); - glUiVertexShader = gl.glCreateShader(gl.GL_VERTEX_SHADER); - glUiFragmentShader = gl.glCreateShader(gl.GL_FRAGMENT_SHADER); - template = new Template(resourceLoader); - vertSource = template.process(resourceLoader.apply("vertui.glsl")); - template = new Template(resourceLoader); - fragSource = template.process(resourceLoader.apply("fragui.glsl")); - GLUtil.loadShaders(gl, glUiProgram, glUiVertexShader, -1, glUiFragmentShader, - vertSource, - null, - fragSource); - - initUniforms(); - } - - private void initUniforms() - { - uniProjectionMatrix = gl.glGetUniformLocation(glProgram, "projectionMatrix"); - uniBrightness = gl.glGetUniformLocation(glProgram, "brightness"); - uniSmoothBanding = gl.glGetUniformLocation(glProgram, "smoothBanding"); - uniUseFog = gl.glGetUniformLocation(glProgram, "useFog"); - uniFogColor = gl.glGetUniformLocation(glProgram, "fogColor"); - uniFogDepth = gl.glGetUniformLocation(glProgram, "fogDepth"); - uniFogCornerRadius = gl.glGetUniformLocation(glProgram, "fogCornerRadius"); - uniFogDensity = gl.glGetUniformLocation(glProgram, "fogDensity"); - uniDrawDistance = gl.glGetUniformLocation(glProgram, "drawDistance"); - uniAmbientLighting = gl.glGetUniformLocation(glProgram, "ambientLighting"); - - uniTex = gl.glGetUniformLocation(glUiProgram, "tex"); - uniTexSamplingMode = gl.glGetUniformLocation(glUiProgram, "samplingMode"); - uniTexTargetDimensions = gl.glGetUniformLocation(glUiProgram, "targetDimensions"); - uniTexSourceDimensions = gl.glGetUniformLocation(glUiProgram, "sourceDimensions"); - uniTextures = gl.glGetUniformLocation(glProgram, "textures"); - uniTextureOffsets = gl.glGetUniformLocation(glProgram, "textureOffsets"); - - uniBlockSmall = gl.glGetUniformBlockIndex(glSmallComputeProgram, "uniforms"); - uniBlockLarge = gl.glGetUniformBlockIndex(glComputeProgram, "uniforms"); - uniBlockMain = gl.glGetUniformBlockIndex(glProgram, "uniforms"); - } - - private void shutdownProgram() - { - gl.glDeleteShader(glVertexShader); - glVertexShader = -1; - - gl.glDeleteShader(glGeomShader); - glGeomShader = -1; - - gl.glDeleteShader(glFragmentShader); - glFragmentShader = -1; - - gl.glDeleteProgram(glProgram); - glProgram = -1; - - gl.glDeleteShader(glComputeShader); - glComputeShader = -1; - - gl.glDeleteProgram(glComputeProgram); - glComputeProgram = -1; - - gl.glDeleteShader(glSmallComputeShader); - glSmallComputeShader = -1; - - gl.glDeleteProgram(glSmallComputeProgram); - glSmallComputeProgram = -1; - - gl.glDeleteShader(glUnorderedComputeShader); - glUnorderedComputeShader = -1; - - gl.glDeleteProgram(glUnorderedComputeProgram); - glUnorderedComputeProgram = -1; - - gl.glDeleteShader(glUiVertexShader); - glUiVertexShader = -1; - - gl.glDeleteShader(glUiFragmentShader); - glUiFragmentShader = -1; - - gl.glDeleteProgram(glUiProgram); - glUiProgram = -1; - } - - private void initVao() - { - // Create VAO - vaoHandle = glGenVertexArrays(gl); - - // Create UI VAO - vaoUiHandle = glGenVertexArrays(gl); - // Create UI buffer - vboUiHandle = glGenBuffers(gl); - gl.glBindVertexArray(vaoUiHandle); - - FloatBuffer vboUiBuf = GpuFloatBuffer.allocateDirect(5 * 4); - vboUiBuf.put(new float[]{ - // positions // texture coords - 1f, 1f, 0.0f, 1.0f, 0f, // top right - 1f, -1f, 0.0f, 1.0f, 1f, // bottom right - -1f, -1f, 0.0f, 0.0f, 1f, // bottom left - -1f, 1f, 0.0f, 0.0f, 0f // top left - }); - vboUiBuf.rewind(); - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, vboUiHandle); - gl.glBufferData(gl.GL_ARRAY_BUFFER, vboUiBuf.capacity() * Float.BYTES, vboUiBuf, gl.GL_STATIC_DRAW); - - // position attribute - gl.glVertexAttribPointer(0, 3, gl.GL_FLOAT, false, 5 * Float.BYTES, 0); - gl.glEnableVertexAttribArray(0); - - // texture coord attribute - gl.glVertexAttribPointer(1, 2, gl.GL_FLOAT, false, 5 * Float.BYTES, 3 * Float.BYTES); - gl.glEnableVertexAttribArray(1); - - // unbind VBO - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, 0); - } - - private void shutdownVao() - { - glDeleteVertexArrays(gl, vaoHandle); - vaoHandle = -1; - - glDeleteBuffer(gl, vboUiHandle); - vboUiHandle = -1; - - glDeleteVertexArrays(gl, vaoUiHandle); - vaoUiHandle = -1; - } - - private void initInterfaceTexture() - { - interfaceTexture = glGenTexture(gl); - gl.glBindTexture(gl.GL_TEXTURE_2D, interfaceTexture); - gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_WRAP_S, gl.GL_REPEAT); - gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_WRAP_T, gl.GL_REPEAT); - gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MIN_FILTER, gl.GL_LINEAR); - gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MAG_FILTER, gl.GL_LINEAR); - gl.glBindTexture(gl.GL_TEXTURE_2D, 0); - } - - private void shutdownInterfaceTexture() - { - glDeleteTexture(gl, interfaceTexture); - interfaceTexture = -1; - } - - private void initUniformBuffer() - { - uniformBufferId = glGenBuffers(gl); - gl.glBindBuffer(gl.GL_UNIFORM_BUFFER, uniformBufferId); - uniformBuffer.clear(); - uniformBuffer.put(new int[8]); - final int[] pad = new int[2]; - for (int i = 0; i < 2048; i++) - { - uniformBuffer.put(Perspective.SINE[i]); - uniformBuffer.put(Perspective.COSINE[i]); - uniformBuffer.put(pad); - } - uniformBuffer.flip(); - - gl.glBufferData(gl.GL_UNIFORM_BUFFER, uniformBuffer.limit() * Integer.BYTES, uniformBuffer, gl.GL_DYNAMIC_DRAW); - gl.glBindBuffer(gl.GL_UNIFORM_BUFFER, 0); - } - - private void initSceneFbo(int width, int height, int aaSamples) - { - // Create and bind the FBO - fboSceneHandle = glGenFrameBuffer(gl); - gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, fboSceneHandle); - - // Create color render buffer - rboSceneHandle = glGenRenderbuffer(gl); - gl.glBindRenderbuffer(gl.GL_RENDERBUFFER, rboSceneHandle); - gl.glRenderbufferStorageMultisample(gl.GL_RENDERBUFFER, aaSamples, gl.GL_RGBA, width, height); - gl.glFramebufferRenderbuffer(gl.GL_FRAMEBUFFER, gl.GL_COLOR_ATTACHMENT0, gl.GL_RENDERBUFFER, rboSceneHandle); - - // Create texture - texSceneHandle = glGenTexture(gl); - gl.glBindTexture(gl.GL_TEXTURE_2D_MULTISAMPLE, texSceneHandle); - gl.glTexImage2DMultisample(gl.GL_TEXTURE_2D_MULTISAMPLE, aaSamples, gl.GL_RGBA, width, height, true); - - // Bind texture - gl.glFramebufferTexture2D(gl.GL_FRAMEBUFFER, gl.GL_COLOR_ATTACHMENT0, gl.GL_TEXTURE_2D_MULTISAMPLE, texSceneHandle, 0); - - // Reset - gl.glBindTexture(gl.GL_TEXTURE_2D_MULTISAMPLE, 0); - gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, 0); - gl.glBindRenderbuffer(gl.GL_RENDERBUFFER, 0); - } - - private void shutdownSceneFbo() - { - if (texSceneHandle != -1) - { - glDeleteTexture(gl, texSceneHandle); - texSceneHandle = -1; - } - - if (fboSceneHandle != -1) - { - glDeleteFrameBuffer(gl, fboSceneHandle); - fboSceneHandle = -1; - } - - if (rboSceneHandle != -1) - { - glDeleteRenderbuffers(gl, rboSceneHandle); - rboSceneHandle = -1; - } - } - - private void createProjectionMatrix(float left, float right, float bottom, float top, float near, float far) - { - // create a standard orthographic projection - float tx = -((right + left) / (right - left)); - float ty = -((top + bottom) / (top - bottom)); - float tz = -((far + near) / (far - near)); - - gl.glUseProgram(glProgram); - - float[] matrix = new float[]{ - 2 / (right - left), 0, 0, 0, - 0, 2 / (top - bottom), 0, 0, - 0, 0, -2 / (far - near), 0, - tx, ty, tz, 1 - }; - gl.glUniformMatrix4fv(uniProjectionMatrix, 1, false, matrix, 0); - - gl.glUseProgram(0); - } - - @Override - public void drawScene(int cameraX, int cameraY, int cameraZ, int cameraPitch, int cameraYaw, int plane) - { - centerX = client.getCenterX(); - centerY = client.getCenterY(); - yaw = client.getCameraYaw(); - pitch = client.getCameraPitch(); - - final Scene scene = client.getScene(); - final int drawDistance = Math.max(0, Math.min(MAX_DISTANCE, this.drawDistance)); - scene.setDrawDistance(drawDistance); - } - - public void drawScenePaint(int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z, - TilePaint paint, int tileZ, int tileX, int tileY, - int zoom, int centerX, int centerY) - { - if (paint.getBufferLen() > 0) - { - x = tileX * Perspective.LOCAL_TILE_SIZE; - y = 0; - z = tileY * Perspective.LOCAL_TILE_SIZE; - - GpuIntBuffer b = modelBufferUnordered; - ++unorderedModels; - - b.ensureCapacity(8); - IntBuffer buffer = b.getBuffer(); - buffer.put(paint.getBufferOffset()); - buffer.put(paint.getUvBufferOffset()); - buffer.put(2); - buffer.put(targetBufferOffset); - buffer.put(FLAG_SCENE_BUFFER); - buffer.put(x).put(y).put(z); - - targetBufferOffset += 2 * 3; - } - } - - public void drawSceneModel(int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z, - TileModel model, int tileZ, int tileX, int tileY, - int zoom, int centerX, int centerY) - { - if (model.getBufferLen() > 0) - { - x = tileX * Perspective.LOCAL_TILE_SIZE; - y = 0; - z = tileY * Perspective.LOCAL_TILE_SIZE; - - GpuIntBuffer b = modelBufferUnordered; - ++unorderedModels; - - b.ensureCapacity(8); - IntBuffer buffer = b.getBuffer(); - buffer.put(model.getBufferOffset()); - buffer.put(model.getUvBufferOffset()); - buffer.put(model.getBufferLen() / 3); - buffer.put(targetBufferOffset); - buffer.put(FLAG_SCENE_BUFFER); - buffer.put(x).put(y).put(z); - - targetBufferOffset += model.getBufferLen(); - } - } - - @Override - public void draw() - { - if (jawtWindow.getAWTComponent() != client.getCanvas()) - { - // We inject code in the game engine mixin to prevent the client from doing canvas replacement, - // so this should not ever be hit - log.warn("Canvas invalidated!"); - try - { - shutDown(); - startUp(); - } - catch (Exception ignored) - { - } - return; - } - - if (client.getGameState() == GameState.LOADING || client.getGameState() == GameState.HOPPING) - { - // While the client is loading it doesn't draw - return; - } - - final int canvasHeight = client.getCanvasHeight(); - final int canvasWidth = client.getCanvasWidth(); - - final int viewportHeight = client.getViewportHeight(); - final int viewportWidth = client.getViewportWidth(); - - // If the viewport has changed, update the projection matrix - if (viewportWidth > 0 && viewportHeight > 0 && (viewportWidth != lastViewportWidth || viewportHeight != lastViewportHeight)) - { - createProjectionMatrix(0, viewportWidth, viewportHeight, 0, 0, Constants.SCENE_SIZE * Perspective.LOCAL_TILE_SIZE); - lastViewportWidth = viewportWidth; - lastViewportHeight = viewportHeight; - } - - // Setup anti-aliasing - final AntiAliasingMode antiAliasingMode = this.antiAliasingMode; - final boolean aaEnabled = antiAliasingMode != AntiAliasingMode.DISABLED; - - if (aaEnabled) - { - gl.glEnable(gl.GL_MULTISAMPLE); - - final Dimension stretchedDimensions = client.getStretchedDimensions(); - - final int stretchedCanvasWidth = client.isStretchedEnabled() ? stretchedDimensions.width : canvasWidth; - final int stretchedCanvasHeight = client.isStretchedEnabled() ? stretchedDimensions.height : canvasHeight; - - // Re-create fbo - if (lastStretchedCanvasWidth != stretchedCanvasWidth - || lastStretchedCanvasHeight != stretchedCanvasHeight - || (lastAntiAliasingMode != null - && !lastAntiAliasingMode.equals(antiAliasingMode))) - { - shutdownSceneFbo(); - - final int maxSamples = glGetInteger(gl); - final int samples = Math.min(antiAliasingMode.getSamples(), maxSamples); - - initSceneFbo(stretchedCanvasWidth, stretchedCanvasHeight, samples); - - lastStretchedCanvasWidth = stretchedCanvasWidth; - lastStretchedCanvasHeight = stretchedCanvasHeight; - } - - gl.glBindFramebuffer(gl.GL_DRAW_FRAMEBUFFER, fboSceneHandle); - } - else - { - gl.glDisable(gl.GL_MULTISAMPLE); - shutdownSceneFbo(); - } - - lastAntiAliasingMode = antiAliasingMode; - - // Clear scene - int sky = client.getSkyboxColor(); - gl.glClearColor((sky >> 16 & 0xFF) / 255f, (sky >> 8 & 0xFF) / 255f, (sky & 0xFF) / 255f, 1f); - gl.glClear(gl.GL_COLOR_BUFFER_BIT); - - // Upload buffers - vertexBuffer.flip(); - uvBuffer.flip(); - modelBuffer.flip(); - modelBufferSmall.flip(); - modelBufferUnordered.flip(); - - int bufferId = glGenBuffers(gl); // temporary scene vertex buffer - int uvBufferId = glGenBuffers(gl); // temporary scene uv buffer - int modelBufferId = glGenBuffers(gl); // scene model buffer, large - int modelBufferSmallId = glGenBuffers(gl); // scene model buffer, small - int modelBufferUnorderedId = glGenBuffers(gl); - - IntBuffer vertexBuffer = this.vertexBuffer.getBuffer(); - FloatBuffer uvBuffer = this.uvBuffer.getBuffer(); - IntBuffer modelBuffer = this.modelBuffer.getBuffer(); - IntBuffer modelBufferSmall = this.modelBufferSmall.getBuffer(); - IntBuffer modelBufferUnordered = this.modelBufferUnordered.getBuffer(); - - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, bufferId); - gl.glBufferData(gl.GL_ARRAY_BUFFER, vertexBuffer.limit() * Integer.BYTES, vertexBuffer, gl.GL_STREAM_DRAW); - - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, uvBufferId); - gl.glBufferData(gl.GL_ARRAY_BUFFER, uvBuffer.limit() * Float.BYTES, uvBuffer, gl.GL_STREAM_DRAW); - - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, modelBufferId); - gl.glBufferData(gl.GL_ARRAY_BUFFER, modelBuffer.limit() * Integer.BYTES, modelBuffer, gl.GL_STREAM_DRAW); - - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, modelBufferSmallId); - gl.glBufferData(gl.GL_ARRAY_BUFFER, modelBufferSmall.limit() * Integer.BYTES, modelBufferSmall, gl.GL_STREAM_DRAW); - - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, modelBufferUnorderedId); - gl.glBufferData(gl.GL_ARRAY_BUFFER, modelBufferUnordered.limit() * Integer.BYTES, modelBufferUnordered, gl.GL_STREAM_DRAW); - - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, 0); - - // allocate target vertex buffer for compute shaders - int outBufferId = glGenBuffers(gl); - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, outBufferId); - - gl.glBufferData(gl.GL_ARRAY_BUFFER, - targetBufferOffset * 16, // each vertex is an ivec4, which is 16 bytes - null, - gl.GL_STREAM_DRAW); - - // allocate target uv buffer for compute shaders - int outUvBufferId = glGenBuffers(gl); - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, outUvBufferId); - gl.glBufferData(gl.GL_ARRAY_BUFFER, - targetBufferOffset * 16, - null, - gl.GL_STREAM_DRAW); - - // UBO - gl.glBindBuffer(gl.GL_UNIFORM_BUFFER, uniformBufferId); - uniformBuffer.clear(); - uniformBuffer - .put(yaw) - .put(pitch) - .put(centerX) - .put(centerY) - .put(client.getScale()) - .put(client.getCameraX2()) - .put(client.getCameraY2()) - .put(client.getCameraZ2()); - uniformBuffer.flip(); - - gl.glBufferSubData(gl.GL_UNIFORM_BUFFER, 0, uniformBuffer.limit() * Integer.BYTES, uniformBuffer); - gl.glBindBuffer(gl.GL_UNIFORM_BUFFER, 0); - - // Draw 3d scene - final TextureProvider textureProvider = client.getTextureProvider(); - if (textureProvider != null && this.bufferId != -1) - { - gl.glUniformBlockBinding(glSmallComputeProgram, uniBlockSmall, 0); - gl.glUniformBlockBinding(glComputeProgram, uniBlockLarge, 0); - - gl.glBindBufferBase(gl.GL_UNIFORM_BUFFER, 0, uniformBufferId); - - /* - * Compute is split into two separate programs 'small' and 'large' to - * save on GPU resources. Small will sort <= 512 faces, large will do <= 4096. - */ - - // unordered - gl.glUseProgram(glUnorderedComputeProgram); - - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 0, modelBufferUnorderedId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 1, this.bufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 2, bufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 3, outBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 4, outUvBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 5, this.uvBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 6, uvBufferId); - - gl.glDispatchCompute(unorderedModels, 1, 1); - - // small - gl.glUseProgram(glSmallComputeProgram); - - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 0, modelBufferSmallId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 1, this.bufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 2, bufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 3, outBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 4, outUvBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 5, this.uvBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 6, uvBufferId); - - gl.glDispatchCompute(smallModels, 1, 1); - - // large - gl.glUseProgram(glComputeProgram); - - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 0, modelBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 1, this.bufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 2, bufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 3, outBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 4, outUvBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 5, this.uvBufferId); - gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 6, uvBufferId); - - gl.glDispatchCompute(largeModels, 1, 1); - - gl.glMemoryBarrier(gl.GL_SHADER_STORAGE_BARRIER_BIT); - - if (textureArrayId == -1) - { - // lazy init textures as they may not be loaded at plugin start. - // this will return -1 and retry if not all textures are loaded yet, too. - textureArrayId = textureManager.initTextureArray(textureProvider, gl); - } - - final Texture[] textures = textureProvider.getTextures(); - int renderHeightOff = client.getViewportYOffset(); - int renderWidthOff = client.getViewportXOffset(); - int renderCanvasHeight = canvasHeight; - int renderViewportHeight = viewportHeight; - int renderViewportWidth = viewportWidth; - - // Setup anisotropic filtering - final AnisotropicFilteringMode anisotropicFilteringMode = this.anisotropicFilteringMode; - final boolean afEnabled = anisotropicFilteringMode != AnisotropicFilteringMode.DISABLED; - - if (lastAnisotropicFilteringMode != null && !lastAnisotropicFilteringMode.equals(anisotropicFilteringMode)) - { - if (afEnabled) - { - switch (anisotropicFilteringMode) - { - case BILINEAR: - gl.glTexParameteri(gl.GL_TEXTURE_2D_ARRAY, gl.GL_TEXTURE_MIN_FILTER, gl.GL_LINEAR_MIPMAP_NEAREST); - break; - case TRILINEAR: - gl.glTexParameteri(gl.GL_TEXTURE_2D_ARRAY, gl.GL_TEXTURE_MIN_FILTER, gl.GL_LINEAR_MIPMAP_LINEAR); - break; - default: - final float maxSamples = glGetFloat(gl); - final float samples = Math.min(anisotropicFilteringMode.getSamples(), maxSamples); - gl.glTexParameteri(gl.GL_TEXTURE_2D_ARRAY, gl.GL_TEXTURE_MIN_FILTER, gl.GL_LINEAR_MIPMAP_LINEAR); - gl.glTexParameterf(gl.GL_TEXTURE_2D_ARRAY, gl.GL_TEXTURE_MAX_ANISOTROPY_EXT, samples); - break; - } - - gl.glGenerateMipmap(gl.GL_TEXTURE_2D_ARRAY); - } - else - { - gl.glTexParameteri(gl.GL_TEXTURE_2D_ARRAY, gl.GL_TEXTURE_MIN_FILTER, gl.GL_NEAREST); - } - } - - lastAnisotropicFilteringMode = anisotropicFilteringMode; - - if (client.isStretchedEnabled()) - { - Dimension dim = client.getStretchedDimensions(); - renderCanvasHeight = dim.height; - - double scaleFactorY = dim.getHeight() / canvasHeight; - double scaleFactorX = dim.getWidth() / canvasWidth; - - // Pad the viewport a little because having ints for our viewport dimensions can introduce off-by-one errors. - final int padding = 1; - - // Ceil the sizes because even if the size is 599.1 we want to treat it as size 600 (i.e. render to the x=599 pixel). - renderViewportHeight = (int) Math.ceil(scaleFactorY * (renderViewportHeight)) + padding * 2; - renderViewportWidth = (int) Math.ceil(scaleFactorX * (renderViewportWidth)) + padding * 2; - - // Floor the offsets because even if the offset is 4.9, we want to render to the x=4 pixel anyway. - renderHeightOff = (int) Math.floor(scaleFactorY * (renderHeightOff)) - padding; - renderWidthOff = (int) Math.floor(scaleFactorX * (renderWidthOff)) - padding; - } - - glDpiAwareViewport(renderWidthOff, renderCanvasHeight - renderViewportHeight - renderHeightOff, renderViewportWidth, renderViewportHeight); - - gl.glUseProgram(glProgram); - - final int drawDistance = Math.max(0, Math.min(MAX_DISTANCE, this.drawDistance)); - final int fogDepth = this.fogDepth; - float effectiveDrawDistance = Perspective.LOCAL_TILE_SIZE * Math.min(Constants.SCENE_SIZE / 2, drawDistance); - gl.glUniform1i(uniUseFog, fogDepth > 0 ? 1 : 0); - gl.glUniform4f(uniFogColor, (sky >> 16 & 0xFF) / 255f, (sky >> 8 & 0xFF) / 255f, (sky & 0xFF) / 255f, 1f); - gl.glUniform1f(uniFogDepth, this.fogDepth * 0.01f * effectiveDrawDistance); - gl.glUniform1f(uniFogCornerRadius, this.fogCircularity * 0.01f * effectiveDrawDistance); - gl.glUniform1f(uniFogDensity, this.fogDensity * 0.1f); - gl.glUniform1i(uniDrawDistance, drawDistance * Perspective.LOCAL_TILE_SIZE); - - // Brightness happens to also be stored in the texture provider, so we use that - gl.glUniform1f(uniBrightness, (float) textureProvider.getBrightness()); - - gl.glUniform1f(uniSmoothBanding, this.smoothBanding ? 0f : 1f); - gl.glUniform1f(uniAmbientLighting, !this.ambientLighting ? 0f : 1f); - - for (int id = 0; id < textures.length; ++id) - { - Texture texture = textures[id]; - if (texture == null) - { - continue; - } - - textureProvider.load(id); // trips the texture load flag which lets textures animate - - textureOffsets[id * 2] = texture.getU(); - textureOffsets[id * 2 + 1] = texture.getV(); - } - - // Bind uniforms - gl.glUniformBlockBinding(glProgram, uniBlockMain, 0); - gl.glUniform1i(uniTextures, 1); // texture sampler array is bound to texture1 - gl.glUniform2fv(uniTextureOffsets, 128, textureOffsets, 0); - - // We just allow the GL to do face culling. Note this requires the priority renderer - // to have logic to disregard culled faces in the priority depth testing. - gl.glEnable(gl.GL_CULL_FACE); - - // Enable blending for alpha - gl.glEnable(gl.GL_BLEND); - gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA); - - // Draw output of compute shaders - gl.glBindVertexArray(vaoHandle); - - gl.glEnableVertexAttribArray(0); - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, outBufferId); - gl.glVertexAttribIPointer(0, 4, gl.GL_INT, 0, 0); - - gl.glEnableVertexAttribArray(1); - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, outUvBufferId); - gl.glVertexAttribPointer(1, 4, gl.GL_FLOAT, false, 0, 0); - - gl.glDrawArrays(gl.GL_TRIANGLES, 0, targetBufferOffset); - - gl.glDisable(gl.GL_BLEND); - gl.glDisable(gl.GL_CULL_FACE); - - gl.glUseProgram(0); - } - - if (aaEnabled) - { - gl.glBindFramebuffer(gl.GL_READ_FRAMEBUFFER, fboSceneHandle); - gl.glBindFramebuffer(gl.GL_DRAW_FRAMEBUFFER, 0); - gl.glBlitFramebuffer(0, 0, lastStretchedCanvasWidth, lastStretchedCanvasHeight, - 0, 0, lastStretchedCanvasWidth, lastStretchedCanvasHeight, - gl.GL_COLOR_BUFFER_BIT, gl.GL_NEAREST); - - // Reset - gl.glBindFramebuffer(gl.GL_READ_FRAMEBUFFER, 0); - } - - vertexBuffer.clear(); - uvBuffer.clear(); - modelBuffer.clear(); - modelBufferSmall.clear(); - modelBufferUnordered.clear(); - - targetBufferOffset = 0; - smallModels = largeModels = unorderedModels = 0; - tempOffset = 0; - tempUvOffset = 0; - - glDeleteBuffer(gl, bufferId); - glDeleteBuffer(gl, uvBufferId); - glDeleteBuffer(gl, modelBufferId); - glDeleteBuffer(gl, modelBufferSmallId); - glDeleteBuffer(gl, modelBufferUnorderedId); - glDeleteBuffer(gl, outBufferId); - glDeleteBuffer(gl, outUvBufferId); - - // Texture on UI - drawUi(canvasHeight, canvasWidth); - - try - { - glDrawable.swapBuffers(); - } - catch (GLException ignored) - { - // Ignore - } - - drawManager.processDrawComplete(this::screenshot); - } - - private void drawUi(final int canvasHeight, final int canvasWidth) - { - final BufferProvider bufferProvider = client.getBufferProvider(); - final int[] pixels = bufferProvider.getPixels(); - final int width = bufferProvider.getWidth(); - final int height = bufferProvider.getHeight(); - - gl.glEnable(gl.GL_BLEND); - - vertexBuffer.clear(); // reuse vertex buffer for interface - vertexBuffer.ensureCapacity(pixels.length); - - IntBuffer interfaceBuffer = vertexBuffer.getBuffer(); - interfaceBuffer.put(pixels); - vertexBuffer.flip(); - - gl.glBlendFunc(gl.GL_ONE, gl.GL_ONE_MINUS_SRC_ALPHA); - gl.glBindTexture(gl.GL_TEXTURE_2D, interfaceTexture); - - if (canvasWidth != lastCanvasWidth || canvasHeight != lastCanvasHeight) - { - gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_RGBA, width, height, 0, gl.GL_BGRA, gl.GL_UNSIGNED_INT_8_8_8_8_REV, interfaceBuffer); - lastCanvasWidth = canvasWidth; - lastCanvasHeight = canvasHeight; - } - else - { - gl.glTexSubImage2D(gl.GL_TEXTURE_2D, 0, 0, 0, width, height, gl.GL_BGRA, gl.GL_UNSIGNED_INT_8_8_8_8_REV, interfaceBuffer); - } - - // Use the texture bound in the first pass - gl.glUseProgram(glUiProgram); - gl.glUniform1i(uniTex, 0); - gl.glUniform1i(uniTexSamplingMode, this.uiScalingMode.getMode()); - gl.glUniform2i(uniTexSourceDimensions, canvasWidth, canvasHeight); - - if (client.isStretchedEnabled()) - { - Dimension dim = client.getStretchedDimensions(); - glDpiAwareViewport(0, 0, dim.width, dim.height); - gl.glUniform2i(uniTexTargetDimensions, dim.width, dim.height); - } - else - { - glDpiAwareViewport(0, 0, canvasWidth, canvasHeight); - gl.glUniform2i(uniTexTargetDimensions, canvasWidth, canvasHeight); - } - - - // Set the sampling function used when stretching the UI. - // This is probably better done with sampler objects instead of texture parameters, but this is easier and likely more portable. - // See https://www.khronos.org/opengl/wiki/Sampler_Object for details. - if (client.isStretchedEnabled()) - { - final int function = this.uiScalingMode == UIScalingMode.LINEAR ? gl.GL_LINEAR : gl.GL_NEAREST; - gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MIN_FILTER, function); - gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MAG_FILTER, function); - } - - // Texture on UI - gl.glBindVertexArray(vaoUiHandle); - gl.glDrawArrays(gl.GL_TRIANGLE_FAN, 0, 4); - - // Reset - gl.glBindTexture(gl.GL_TEXTURE_2D, 0); - gl.glBindVertexArray(0); - gl.glUseProgram(0); - gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA); - gl.glDisable(gl.GL_BLEND); - - vertexBuffer.clear(); - } - - /** - * Convert the front framebuffer to an Image - * - * @return - */ - private Image screenshot() - { - int width = client.getCanvasWidth(); - int height = client.getCanvasHeight(); - - if (client.isStretchedEnabled()) - { - Dimension dim = client.getStretchedDimensions(); - width = dim.width; - height = dim.height; - } - - ByteBuffer buffer = ByteBuffer.allocateDirect(width * height * 4) - .order(ByteOrder.nativeOrder()); - - gl.glReadBuffer(gl.GL_FRONT); - gl.glReadPixels(0, 0, width, height, GL.GL_RGBA, gl.GL_UNSIGNED_BYTE, buffer); - - BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); - int[] pixels = ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); - - for (int y = 0; y < height; ++y) - { - for (int x = 0; x < width; ++x) - { - int r = buffer.get() & 0xff; - int g = buffer.get() & 0xff; - int b = buffer.get() & 0xff; - buffer.get(); // alpha - - pixels[(height - y - 1) * width + x] = (r << 16) | (g << 8) | b; - } - } - - return image; - } - - @Override - public void animate(Texture texture, int diff) - { - textureManager.animate(texture, diff); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged gameStateChanged) - { - if (gameStateChanged.getGameState() != GameState.LOGGED_IN) - { - return; - } - - uploadScene(); - } - - private void uploadScene() - { - vertexBuffer.clear(); - uvBuffer.clear(); - - sceneUploader.upload(client.getScene(), vertexBuffer, uvBuffer); - - vertexBuffer.flip(); - uvBuffer.flip(); - - IntBuffer vertexBuffer = this.vertexBuffer.getBuffer(); - FloatBuffer uvBuffer = this.uvBuffer.getBuffer(); - - if (bufferId != -1) - { - GLUtil.glDeleteBuffer(gl, bufferId); - bufferId = -1; - } - - if (uvBufferId != -1) - { - GLUtil.glDeleteBuffer(gl, uvBufferId); - uvBufferId = -1; - } - - bufferId = glGenBuffers(gl); - uvBufferId = glGenBuffers(gl); - - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, bufferId); - gl.glBufferData(gl.GL_ARRAY_BUFFER, vertexBuffer.limit() * Integer.BYTES, vertexBuffer, gl.GL_STATIC_COPY); - - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, uvBufferId); - gl.glBufferData(gl.GL_ARRAY_BUFFER, uvBuffer.limit() * Float.BYTES, uvBuffer, gl.GL_STATIC_COPY); - - gl.glBindBuffer(gl.GL_ARRAY_BUFFER, 0); - - vertexBuffer.clear(); - uvBuffer.clear(); - } - - /** - * Check is a model is visible and should be drawn. - */ - private boolean isNotVisible(Model model, int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int _x, int _y, int _z, long hash) - { - final int XYZMag = model.getXYZMag(); - final int zoom = client.get3dZoom(); - final int modelHeight = model.getModelHeight(); - - int Rasterizer3D_clipMidX2 = client.getRasterizer3D_clipMidX2(); - int Rasterizer3D_clipNegativeMidX = client.getRasterizer3D_clipNegativeMidX(); - int Rasterizer3D_clipNegativeMidY = client.getRasterizer3D_clipNegativeMidY(); - int Rasterizer3D_clipMidY2 = client.getRasterizer3D_clipMidY2(); - - int var11 = yawCos * _z - yawSin * _x >> 16; - int var12 = pitchSin * _y + pitchCos * var11 >> 16; - int var13 = pitchCos * XYZMag >> 16; - int var14 = var12 + var13; - if (var14 > 50) - { - int var15 = _z * yawSin + yawCos * _x >> 16; - int var16 = (var15 - XYZMag) * zoom; - if (var16 / var14 < Rasterizer3D_clipMidX2) - { - int var17 = (var15 + XYZMag) * zoom; - if (var17 / var14 > Rasterizer3D_clipNegativeMidX) - { - int var18 = pitchCos * _y - var11 * pitchSin >> 16; - int var19 = pitchSin * XYZMag >> 16; - int var20 = (var18 + var19) * zoom; - if (var20 / var14 > Rasterizer3D_clipNegativeMidY) - { - int var21 = (pitchCos * modelHeight >> 16) + var19; - int var22 = (var18 - var21) * zoom; - return var22 / var14 >= Rasterizer3D_clipMidY2; - } - } - } - } - return true; - } - - /** - * Draw a entity in the scene - * - * @param entity - * @param orientation - * @param pitchSin - * @param pitchCos - * @param yawSin - * @param yawCos - * @param x - * @param y - * @param z - * @param hash - */ - @Override - public void draw(Entity entity, int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z, long hash) - { - // Model may be in the scene buffer - if (entity instanceof Model && ((Model) entity).getSceneId() == sceneUploader.sceneId) - { - Model model = (Model) entity; - - model.calculateBoundsCylinder(); - model.calculateExtreme(orientation); - - if (isNotVisible(model, orientation, pitchSin, pitchCos, yawSin, yawCos, x, y, z, hash)) - { - return; - } - - client.checkClickbox(model, orientation, pitchSin, pitchCos, yawSin, yawCos, x, y, z, hash); - - int tc = Math.min(MAX_TRIANGLE, model.getTrianglesCount()); - int uvOffset = model.getUvBufferOffset(); - boolean hasUv = model.getFaceTextures() != null; - - // Speed hack: the scene uploader splits up large models with no priorities - // based on face height, and then we sort each smaller set of faces - if (tc > SMALL_TRIANGLE_COUNT && model.getFaceRenderPriorities() == null) - { - int left = tc; - int off = 0; - while (left > 0) - { - tc = Math.min(SMALL_TRIANGLE_COUNT, left); - - GpuIntBuffer b = bufferForTriangles(tc); - b.ensureCapacity(8); - IntBuffer buffer = b.getBuffer(); - buffer.put(model.getBufferOffset() + off); - buffer.put(hasUv ? uvOffset + off : -1); - buffer.put(tc); - buffer.put(targetBufferOffset); - buffer.put(FLAG_SCENE_BUFFER | (model.getRadius() << 12) | orientation); - buffer.put(x + client.getCameraX2()).put(y + client.getCameraY2()).put(z + client.getCameraZ2()); - - targetBufferOffset += tc * 3; - - off += tc * 3; - left -= tc; - } - return; - } - - GpuIntBuffer b = bufferForTriangles(tc); - - b.ensureCapacity(8); - IntBuffer buffer = b.getBuffer(); - buffer.put(model.getBufferOffset()); - buffer.put(uvOffset); - buffer.put(tc); - buffer.put(targetBufferOffset); - buffer.put(FLAG_SCENE_BUFFER | (model.getRadius() << 12) | orientation); - buffer.put(x + client.getCameraX2()).put(y + client.getCameraY2()).put(z + client.getCameraZ2()); - - targetBufferOffset += tc * 3; - } - else - { - // Temporary model (animated or otherwise not a static Model on the scene) - Model model = entity instanceof Model ? (Model) entity : entity.getModel(); - if (model != null) - { - // Apply height to entity from the model - model.setModelHeight(model.getModelHeight()); - - model.calculateBoundsCylinder(); - model.calculateExtreme(orientation); - - if (isNotVisible(model, orientation, pitchSin, pitchCos, yawSin, yawCos, x, y, z, hash)) - { - return; - } - - client.checkClickbox(model, orientation, pitchSin, pitchCos, yawSin, yawCos, x, y, z, hash); - - boolean hasUv = model.getFaceTextures() != null; - - int faces = Math.min(MAX_TRIANGLE, model.getTrianglesCount()); - vertexBuffer.ensureCapacity(12 * faces); - uvBuffer.ensureCapacity(12 * faces); - int len = 0; - for (int i = 0; i < faces; ++i) - { - len += sceneUploader.pushFace(model, i, vertexBuffer, uvBuffer); - } - - GpuIntBuffer b = bufferForTriangles(faces); - - b.ensureCapacity(8); - IntBuffer buffer = b.getBuffer(); - buffer.put(tempOffset); - buffer.put(hasUv ? tempUvOffset : -1); - buffer.put(len / 3); - buffer.put(targetBufferOffset); - buffer.put((model.getRadius() << 12) | orientation); - buffer.put(x + client.getCameraX2()).put(y + client.getCameraY2()).put(z + client.getCameraZ2()); - - tempOffset += len; - if (hasUv) - { - tempUvOffset += len; - } - - targetBufferOffset += len; - } - } - } - - /** - * returns the correct buffer based on triangle count and updates model count - * - * @param triangles - * @return - */ - private GpuIntBuffer bufferForTriangles(int triangles) - { - if (triangles <= SMALL_TRIANGLE_COUNT) - { - ++smallModels; - return modelBufferSmall; - } - else - { - ++largeModels; - return modelBuffer; - } - } - - private int getScaledValue(final double scale, final int value) - { - return SurfaceScaleUtils.scale(value, (float) scale); - } - - private void glDpiAwareViewport(final int x, final int y, final int width, final int height) - { - final AffineTransform t = ((Graphics2D) canvas.getGraphics()).getTransform(); - gl.glViewport( - getScaledValue(t.getScaleX(), x), - getScaledValue(t.getScaleY(), y), - getScaledValue(t.getScaleX(), width), - getScaledValue(t.getScaleY(), height)); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPluginConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPluginConfig.java deleted file mode 100644 index 1fcab87225..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPluginConfig.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (c) 2018, 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.gpu; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigTitleSection; -import net.runelite.client.config.Range; -import net.runelite.client.config.Title; -import static net.runelite.client.plugins.gpu.GpuPlugin.MAX_DISTANCE; -import static net.runelite.client.plugins.gpu.GpuPlugin.MAX_FOG_DEPTH; -import net.runelite.client.plugins.gpu.config.AnisotropicFilteringMode; -import net.runelite.client.plugins.gpu.config.AntiAliasingMode; -import net.runelite.client.plugins.gpu.config.UIScalingMode; - -@ConfigGroup("gpu") -public interface GpuPluginConfig extends Config -{ - @ConfigTitleSection( - keyName = "drawingTitle", - name = "Drawing", - description = "", - position = 1 - ) - default Title drawingTitle() - { - return new Title(); - } - - @Range( - min = 20, - max = MAX_DISTANCE - ) - @ConfigItem( - keyName = "drawDistance", - name = "Draw Distance", - description = "Draw distance", - position = 2, - titleSection = "drawingTitle" - ) - default int drawDistance() - { - return 25; - } - - @ConfigItem( - keyName = "smoothBanding", - name = "Remove Color Banding", - description = "Smooths out the color banding that is present in the CPU renderer", - position = 3, - titleSection = "drawingTitle" - ) - default boolean smoothBanding() - { - return false; - } - - @ConfigTitleSection( - keyName = "scalingTitle", - name = "Scaling", - description = "", - position = 4 - ) - default Title scalingTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "uiScalingMode", - name = "UI scaling mode", - description = "Sampling function to use for the UI in stretched mode", - titleSection = "scalingTitle", - position = 5 - ) - default UIScalingMode uiScalingMode() - { - return UIScalingMode.CATMULL_ROM; - } - - @ConfigTitleSection( - keyName = "ppTitle", - name = "Post processing", - description = "", - position = 6 - ) - default Title ppTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "antiAliasingMode", - name = "Anti Aliasing", - description = "Configures the anti-aliasing mode", - position = 7, - titleSection = "ppTitle" - ) - default AntiAliasingMode antiAliasingMode() - { - return AntiAliasingMode.DISABLED; - } - - @ConfigItem( - keyName = "anisotropicFilteringMode", - name = "Anisotropic Filtering", - description = "Configures the anisotropic filtering mode", - position = 8, - titleSection = "ppTitle" - ) - default AnisotropicFilteringMode anisotropicFilteringMode() - { - return AnisotropicFilteringMode.DISABLED; - } - - @ConfigTitleSection( - keyName = "fogTitle", - name = "Fog", - description = "", - position = 9 - ) - default Title fogTitle() - { - return new Title(); - } - - @Range( - max = MAX_FOG_DEPTH - ) - @ConfigItem( - keyName = "fogDepth", - name = "Depth", - description = "Distance from the scene edge the fog starts", - position = 10, - titleSection = "fogTitle" - ) - default int fogDepth() - { - return 30; - } - - @Range( - max = MAX_FOG_DEPTH - ) - @ConfigItem( - keyName = "fogCircularity", - name = "Roundness", - description = "Fog circularity in %", - position = 11, - titleSection = "fogTitle" - ) - default int fogCircularity() - { - return 30; - } - - @Range( - max = MAX_FOG_DEPTH - ) - @ConfigItem( - keyName = "fogDensity", - name = "Density", - description = "Relative fog thickness", - position = 12, - titleSection = "fogTitle" - ) - default int fogDensity() - { - return 10; - } - - @ConfigTitleSection( - keyName = "effectsTitle", - name = "Effects", - description = "", - position = 13 - ) - default Title effectsTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "ambientLighting", - name = "Ambient Lighting", - description = "Produces global lighting based on current fog color", - position = 14, - titleSection = "effectsTitle" - ) - default boolean ambientLighting() - { - return false; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/SceneUploader.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/SceneUploader.java deleted file mode 100644 index 4a7e8bd628..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/SceneUploader.java +++ /dev/null @@ -1,569 +0,0 @@ -/* - * Copyright (c) 2018, 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.gpu; - -import java.util.Arrays; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Constants; -import net.runelite.api.DecorativeObject; -import net.runelite.api.Entity; -import net.runelite.api.GameObject; -import net.runelite.api.GroundObject; -import net.runelite.api.Model; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.Scene; -import net.runelite.api.Tile; -import net.runelite.api.TileModel; -import net.runelite.api.TilePaint; -import net.runelite.api.WallObject; -import static net.runelite.client.plugins.gpu.GpuPlugin.SMALL_TRIANGLE_COUNT; - -@Singleton -class SceneUploader -{ - @Inject - private Client client; - - int sceneId = (int) (System.currentTimeMillis() / 1000L); - private int offset; - private int uvoffset; - - void upload(Scene scene, GpuIntBuffer vertexbuffer, GpuFloatBuffer uvBuffer) - { - ++sceneId; - offset = 0; - uvoffset = 0; - vertexbuffer.clear(); - uvBuffer.clear(); - - for (int z = 0; z < Constants.MAX_Z; ++z) - { - for (int x = 0; x < Constants.SCENE_SIZE; ++x) - { - for (int y = 0; y < Constants.SCENE_SIZE; ++y) - { - Tile tile = scene.getTiles()[z][x][y]; - if (tile != null) - { - reset(tile); - } - } - } - } - - for (int z = 0; z < Constants.MAX_Z; ++z) - { - for (int x = 0; x < Constants.SCENE_SIZE; ++x) - { - for (int y = 0; y < Constants.SCENE_SIZE; ++y) - { - Tile tile = scene.getTiles()[z][x][y]; - if (tile != null) - { - upload(tile, vertexbuffer, uvBuffer); - } - } - } - } - } - - private static void reset(Tile tile) - { - Tile bridge = tile.getBridge(); - if (bridge != null) - { - reset(bridge); - } - - TilePaint tilePaint = tile.getTilePaint(); - if (tilePaint != null) - { - tilePaint.setBufferOffset(-1); - } - - TileModel sceneTileModel = tile.getTileModel(); - if (sceneTileModel != null) - { - sceneTileModel.setBufferOffset(-1); - } - - WallObject wallObject = tile.getWallObject(); - if (wallObject != null) - { - if (wallObject.getEntity1() instanceof Model) - { - ((Model) wallObject.getEntity1()).setBufferOffset(-1); - } - if (wallObject.getEntity2() instanceof Model) - { - ((Model) wallObject.getEntity2()).setBufferOffset(-1); - } - } - - GroundObject groundObject = tile.getGroundObject(); - if (groundObject != null && groundObject.getEntity() instanceof Model) - { - ((Model) groundObject.getEntity()).setBufferOffset(-1); - } - - DecorativeObject decorativeObject = tile.getDecorativeObject(); - if (decorativeObject != null && decorativeObject.getEntity1() instanceof Model) - { - ((Model) decorativeObject.getEntity1()).setBufferOffset(-1); - } - - GameObject[] gameObjects = tile.getGameObjects(); - for (GameObject gameObject : gameObjects) - { - if (gameObject == null) - { - continue; - } - if (gameObject.getEntity() instanceof Model) - { - ((Model) gameObject.getEntity()).setBufferOffset(-1); - } - } - } - - private void upload(Tile tile, GpuIntBuffer vertexBuffer, GpuFloatBuffer uvBuffer) - { - Tile bridge = tile.getBridge(); - if (bridge != null) - { - upload(bridge, vertexBuffer, uvBuffer); - } - - TilePaint tilePaint = tile.getTilePaint(); - if (tilePaint != null) - { - tilePaint.setBufferOffset(offset); - if (tilePaint.getTexture() != -1) - { - tilePaint.setUvBufferOffset(uvoffset); - } - else - { - tilePaint.setUvBufferOffset(-1); - } - Point tilePoint = tile.getSceneLocation(); - int len = upload(tilePaint, tile.getRenderLevel(), tilePoint.getX(), tilePoint.getY(), vertexBuffer, uvBuffer); - tilePaint.setBufferLen(len); - offset += len; - if (tilePaint.getTexture() != -1) - { - uvoffset += len; - } - } - - TileModel sceneTileModel = tile.getTileModel(); - if (sceneTileModel != null) - { - sceneTileModel.setBufferOffset(offset); - if (sceneTileModel.getTriangleTextureId() != null) - { - sceneTileModel.setUvBufferOffset(uvoffset); - } - else - { - sceneTileModel.setUvBufferOffset(-1); - } - Point tilePoint = tile.getSceneLocation(); - int len = upload(sceneTileModel, tilePoint.getX(), tilePoint.getY(), vertexBuffer, uvBuffer); - sceneTileModel.setBufferLen(len); - offset += len; - if (sceneTileModel.getTriangleTextureId() != null) - { - uvoffset += len; - } - } - - WallObject wallObject = tile.getWallObject(); - if (wallObject != null) - { - Entity entity1 = wallObject.getEntity1(); - if (entity1 instanceof Model) - { - uploadModel((Model) entity1, vertexBuffer, uvBuffer); - } - - Entity entity2 = wallObject.getEntity2(); - if (entity2 instanceof Model) - { - uploadModel((Model) entity2, vertexBuffer, uvBuffer); - } - } - - GroundObject groundObject = tile.getGroundObject(); - if (groundObject != null) - { - Entity entity = groundObject.getEntity(); - if (entity instanceof Model) - { - uploadModel((Model) entity, vertexBuffer, uvBuffer); - } - } - - DecorativeObject decorativeObject = tile.getDecorativeObject(); - if (decorativeObject != null) - { - Entity entity = decorativeObject.getEntity1(); - if (entity instanceof Model) - { - uploadModel((Model) entity, vertexBuffer, uvBuffer); - } - - Entity entity2 = decorativeObject.getEntity2(); - if (entity2 instanceof Model) - { - uploadModel((Model) entity2, vertexBuffer, uvBuffer); - } - } - - GameObject[] gameObjects = tile.getGameObjects(); - for (GameObject gameObject : gameObjects) - { - if (gameObject == null) - { - continue; - } - - Entity entity = gameObject.getEntity(); - if (entity instanceof Model) - { - uploadModel((Model) gameObject.getEntity(), vertexBuffer, uvBuffer); - } - } - } - - private int upload(TilePaint tile, int tileZ, int tileX, int tileY, GpuIntBuffer vertexBuffer, GpuFloatBuffer uvBuffer) - { - final int[][][] tileHeights = client.getTileHeights(); - - final int localX = 0; - final int localY = 0; - - int swHeight = tileHeights[tileZ][tileX][tileY]; - int seHeight = tileHeights[tileZ][tileX + 1][tileY]; - int neHeight = tileHeights[tileZ][tileX + 1][tileY + 1]; - int nwHeight = tileHeights[tileZ][tileX][tileY + 1]; - - final int neColor = tile.getNeColor(); - final int nwColor = tile.getNwColor(); - final int seColor = tile.getSeColor(); - final int swColor = tile.getSwColor(); - - if (neColor == 12345678) - { - return 0; - } - - vertexBuffer.ensureCapacity(24); - uvBuffer.ensureCapacity(24); - - // 1,0 - int vertexCx = localX + Perspective.LOCAL_TILE_SIZE; - - // 1,1 - int vertexAx = localX + Perspective.LOCAL_TILE_SIZE; - int vertexAy = localY + Perspective.LOCAL_TILE_SIZE; - - // 0,1 - int vertexBy = localY + Perspective.LOCAL_TILE_SIZE; - - vertexBuffer.put(vertexAx, neHeight, vertexAy, neColor); - vertexBuffer.put(localX, nwHeight, vertexBy, nwColor); - vertexBuffer.put(vertexCx, seHeight, localY, seColor); - - vertexBuffer.put(localX, swHeight, localY, swColor); - vertexBuffer.put(vertexCx, seHeight, localY, seColor); - vertexBuffer.put(localX, nwHeight, vertexBy, nwColor); - - if (tile.getTexture() != -1) - { - float tex = tile.getTexture() + 1f; - uvBuffer.put(tex, 1.0f, 1.0f); - uvBuffer.put(tex, 0.0f, 1.0f); - uvBuffer.put(tex, 1.0f, 0.0f); - - uvBuffer.put(tex, 0.0f, 0.0f); - uvBuffer.put(tex, 1.0f, 0.0f); - uvBuffer.put(tex, 0.0f, 1.0f); - } - - return 6; - } - - private static int upload(TileModel sceneTileModel, int tileX, int tileY, GpuIntBuffer vertexBuffer, GpuFloatBuffer uvBuffer) - { - final int[] faceX = sceneTileModel.getFaceX(); - final int[] faceY = sceneTileModel.getFaceY(); - final int[] faceZ = sceneTileModel.getFaceZ(); - - final int[] vertexX = sceneTileModel.getVertexX(); - final int[] vertexY = sceneTileModel.getVertexY(); - final int[] vertexZ = sceneTileModel.getVertexZ(); - - final int[] triangleColorA = sceneTileModel.getTriangleColorA(); - final int[] triangleColorB = sceneTileModel.getTriangleColorB(); - final int[] triangleColorC = sceneTileModel.getTriangleColorC(); - - final int[] triangleTextures = sceneTileModel.getTriangleTextureId(); - - final int faceCount = faceX.length; - - vertexBuffer.ensureCapacity(faceCount * 12); - uvBuffer.ensureCapacity(faceCount * 12); - - int baseX = Perspective.LOCAL_TILE_SIZE * tileX; - int baseY = Perspective.LOCAL_TILE_SIZE * tileY; - - int cnt = 0; - for (int i = 0; i < faceCount; ++i) - { - final int triangleA = faceX[i]; - final int triangleB = faceY[i]; - final int triangleC = faceZ[i]; - - final int colorA = triangleColorA[i]; - final int colorB = triangleColorB[i]; - final int colorC = triangleColorC[i]; - - if (colorA == 12345678) - { - continue; - } - - cnt += 3; - - int vertexXA = vertexX[triangleA] - baseX; - int vertexZA = vertexZ[triangleA] - baseY; - - int vertexXB = vertexX[triangleB] - baseX; - int vertexZB = vertexZ[triangleB] - baseY; - - int vertexXC = vertexX[triangleC] - baseX; - int vertexZC = vertexZ[triangleC] - baseY; - - vertexBuffer.put(vertexXA, vertexY[triangleA], vertexZA, colorA); - vertexBuffer.put(vertexXB, vertexY[triangleB], vertexZB, colorB); - vertexBuffer.put(vertexXC, vertexY[triangleC], vertexZC, colorC); - - if (triangleTextures != null) - { - if (triangleTextures[i] != -1) - { - float tex = triangleTextures[i] + 1f; - uvBuffer.put(tex, vertexXA / 128f, vertexZA / 128f); - uvBuffer.put(tex, vertexXB / 128f, vertexZB / 128f); - uvBuffer.put(tex, vertexXC / 128f, vertexZC / 128f); - } - else - { - uvBuffer.put(0, 0, 0); - uvBuffer.put(0, 0, 0); - uvBuffer.put(0, 0, 0); - } - } - } - - return cnt; - } - - private static int faceHeight(Model model, int face) - { - final int[] vertexY = model.getVerticesY(); - - final int[] trianglesX = model.getTrianglesX(); - final int[] trianglesY = model.getTrianglesY(); - final int[] trianglesZ = model.getTrianglesZ(); - - int triangleA = trianglesX[face]; - int triangleB = trianglesY[face]; - int triangleC = trianglesZ[face]; - - return (vertexY[triangleA] + vertexY[triangleB] + vertexY[triangleC]) / 3; - } - - private void uploadModel(Model model, GpuIntBuffer vertexBuffer, GpuFloatBuffer uvBuffer) - { - if (model.getBufferOffset() > 0) - { - return; - } - - model.setBufferOffset(offset); - if (model.getFaceTextures() != null) - { - model.setUvBufferOffset(uvoffset); - } - else - { - model.setUvBufferOffset(-1); - } - model.setSceneId(sceneId); - - vertexBuffer.ensureCapacity(model.getTrianglesCount() * 12); - uvBuffer.ensureCapacity(model.getTrianglesCount() * 12); - - final int triangleCount = model.getTrianglesCount(); - int len = 0; - if (triangleCount > SMALL_TRIANGLE_COUNT && model.getFaceRenderPriorities() == null) - { - Integer[] faces = new Integer[triangleCount]; - for (int i = 0; i < triangleCount; ++i) - { - faces[i] = i; - } - - Arrays.sort(faces, (i1, i2) -> - { - int z1 = faceHeight(model, i1); - int z2 = faceHeight(model, i2); - return Integer.compare(z2, z1); - }); - - for (int i = 0; i < triangleCount; ++i) - { - len += pushFace(model, faces[i], vertexBuffer, uvBuffer); - } - } - else - { - for (int i = 0; i < triangleCount; ++i) - { - len += pushFace(model, i, vertexBuffer, uvBuffer); - } - } - - offset += len; - if (model.getFaceTextures() != null) - { - uvoffset += len; - } - } - - int pushFace(Model model, int face, GpuIntBuffer vertexBuffer, GpuFloatBuffer uvBuffer) - { - final int[] vertexX = model.getVerticesX(); - final int[] vertexY = model.getVerticesY(); - final int[] vertexZ = model.getVerticesZ(); - - final int[] trianglesX = model.getTrianglesX(); - final int[] trianglesY = model.getTrianglesY(); - final int[] trianglesZ = model.getTrianglesZ(); - - final int[] color1s = model.getFaceColors1(); - final int[] color2s = model.getFaceColors2(); - final int[] color3s = model.getFaceColors3(); - - final byte[] transparencies = model.getTriangleTransparencies(); - final short[] faceTextures = model.getFaceTextures(); - final byte[] facePriorities = model.getFaceRenderPriorities(); - - int triangleA = trianglesX[face]; - int triangleB = trianglesY[face]; - int triangleC = trianglesZ[face]; - - int color1 = color1s[face]; - int color2 = color2s[face]; - int color3 = color3s[face]; - - int alpha = 0; - if (transparencies != null && (faceTextures == null || faceTextures[face] == -1)) - { - alpha = (transparencies[face] & 0xFF) << 24; - } - int priority = 0; - if (facePriorities != null) - { - priority = (facePriorities[face] & 0xff) << 16; - } - - if (color3 == -1) - { - color2 = color3 = color1; - } - else if (color3 == -2) - { - vertexBuffer.put(0, 0, 0, 0); - vertexBuffer.put(0, 0, 0, 0); - vertexBuffer.put(0, 0, 0, 0); - - if (faceTextures != null) - { - uvBuffer.put(0, 0, 0); - uvBuffer.put(0, 0, 0); - uvBuffer.put(0, 0, 0); - } - return 3; - } - - int a, b, c; - - a = vertexX[triangleA]; - b = vertexY[triangleA]; - c = vertexZ[triangleA]; - - vertexBuffer.put(a, b, c, alpha | priority | color1); - - a = vertexX[triangleB]; - b = vertexY[triangleB]; - c = vertexZ[triangleB]; - - vertexBuffer.put(a, b, c, alpha | priority | color2); - - a = vertexX[triangleC]; - b = vertexY[triangleC]; - c = vertexZ[triangleC]; - - vertexBuffer.put(a, b, c, alpha | priority | color3); - - float[][] u = model.getFaceTextureUCoordinates(); - float[][] v = model.getFaceTextureVCoordinates(); - float[] uf, vf; - if (faceTextures != null) - { - if (u != null && v != null && (uf = u[face]) != null && (vf = v[face]) != null) - { - float texture = faceTextures[face] + 1f; - uvBuffer.put(texture, uf[0], vf[0]); - uvBuffer.put(texture, uf[1], vf[1]); - uvBuffer.put(texture, uf[2], vf[2]); - } - else - { - uvBuffer.put(0f, 0f, 0f); - uvBuffer.put(0f, 0f, 0f); - uvBuffer.put(0f, 0f, 0f); - } - } - - return 3; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/ShaderException.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/ShaderException.java deleted file mode 100644 index 78a36eaa34..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/ShaderException.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2018, 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.gpu; - -class ShaderException extends Exception -{ - ShaderException(String message) - { - super(message); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/TextureManager.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/TextureManager.java deleted file mode 100644 index 8a2b01d31b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/TextureManager.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2018, 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.gpu; - -import com.jogamp.opengl.GL4; -import java.nio.ByteBuffer; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Texture; -import net.runelite.api.TextureProvider; - -@Singleton -@Slf4j -class TextureManager -{ - private static final float PERC_64 = 1f / 64f; - private static final float PERC_128 = 1f / 128f; - - private static final int TEXTURE_SIZE = 128; - - int initTextureArray(TextureProvider textureProvider, GL4 gl) - { - if (!allTexturesLoaded(textureProvider)) - { - return -1; - } - - Texture[] textures = textureProvider.getTextures(); - - int textureArrayId = GLUtil.glGenTexture(gl); - gl.glBindTexture(gl.GL_TEXTURE_2D_ARRAY, textureArrayId); - gl.glTexStorage3D(gl.GL_TEXTURE_2D_ARRAY, 1, gl.GL_RGBA8, TEXTURE_SIZE, TEXTURE_SIZE, textures.length); - - gl.glTexParameteri(gl.GL_TEXTURE_2D_ARRAY, gl.GL_TEXTURE_MIN_FILTER, gl.GL_NEAREST); - gl.glTexParameteri(gl.GL_TEXTURE_2D_ARRAY, gl.GL_TEXTURE_MAG_FILTER, gl.GL_NEAREST); - - gl.glTexParameteri(gl.GL_TEXTURE_2D_ARRAY, gl.GL_TEXTURE_WRAP_S, gl.GL_CLAMP_TO_EDGE); - - // Set brightness to 1.0d to upload unmodified textures to GPU - double save = textureProvider.getBrightness(); - textureProvider.setBrightness(1.0d); - - updateTextures(textureProvider, gl, textureArrayId); - - textureProvider.setBrightness(save); - - gl.glActiveTexture(gl.GL_TEXTURE1); - gl.glBindTexture(gl.GL_TEXTURE_2D_ARRAY, textureArrayId); - gl.glActiveTexture(gl.GL_TEXTURE0); - - return textureArrayId; - } - - void freeTextureArray(GL4 gl, int textureArrayId) - { - GLUtil.glDeleteTexture(gl, textureArrayId); - } - - /** - * Check if all textures have been loaded and cached yet. - * - * @param textureProvider - * @return - */ - private static boolean allTexturesLoaded(TextureProvider textureProvider) - { - Texture[] textures = textureProvider.getTextures(); - if (textures == null || textures.length == 0) - { - return false; - } - - for (int textureId = 0; textureId < textures.length; textureId++) - { - Texture texture = textures[textureId]; - if (texture != null) - { - int[] pixels = textureProvider.load(textureId); - if (pixels == null) - { - return false; - } - } - } - - return true; - } - - private static void updateTextures(TextureProvider textureProvider, GL4 gl, int textureArrayId) - { - Texture[] textures = textureProvider.getTextures(); - - gl.glBindTexture(gl.GL_TEXTURE_2D_ARRAY, textureArrayId); - - int cnt = 0; - for (int textureId = 0; textureId < textures.length; textureId++) - { - Texture texture = textures[textureId]; - if (texture != null) - { - int[] srcPixels = textureProvider.load(textureId); - if (srcPixels == null) - { - log.warn("No pixels for texture {}!", textureId); - continue; // this can't happen - } - - ++cnt; - - if (srcPixels.length != TEXTURE_SIZE * TEXTURE_SIZE) - { - // The texture storage is 128x128 bytes, and will only work correctly with the - // 128x128 textures from high detail mode - log.warn("Texture size for {} is {}!", textureId, srcPixels.length); - continue; - } - - byte[] pixels = convertPixels(srcPixels, TEXTURE_SIZE, TEXTURE_SIZE, TEXTURE_SIZE, TEXTURE_SIZE); - ByteBuffer pixelBuffer = ByteBuffer.wrap(pixels); - gl.glTexSubImage3D(gl.GL_TEXTURE_2D_ARRAY, 0, 0, 0, textureId, TEXTURE_SIZE, TEXTURE_SIZE, - 1, gl.GL_RGBA, gl.GL_UNSIGNED_BYTE, pixelBuffer); - } - } - - log.debug("Uploaded textures {}", cnt); - } - - private static byte[] convertPixels(int[] srcPixels, int width, int height, int textureWidth, int textureHeight) - { - byte[] pixels = new byte[textureWidth * textureHeight * 4]; - - int pixelIdx = 0; - int srcPixelIdx = 0; - - int offset = (textureWidth - width) * 4; - - for (int y = 0; y < height; y++) - { - for (int x = 0; x < width; x++) - { - int rgb = srcPixels[srcPixelIdx++]; - if (rgb != 0) - { - pixels[pixelIdx++] = (byte) (rgb >> 16); - pixels[pixelIdx++] = (byte) (rgb >> 8); - pixels[pixelIdx++] = (byte) rgb; - pixels[pixelIdx++] = (byte) -1; - } - else - { - pixelIdx += 4; - } - } - pixelIdx += offset; - } - return pixels; - } - - /** - * Animate the given texture - * - * @param texture - * @param diff Number of elapsed client ticks since last animation - */ - void animate(Texture texture, int diff) - { - final int[] pixels = texture.getPixels(); - if (pixels == null) - { - return; - } - - final int animationSpeed = texture.getAnimationSpeed(); - final float uvdiff = pixels.length == 4096 ? PERC_64 : PERC_128; - - float u = texture.getU(); - float v = texture.getV(); - - int offset = animationSpeed * diff; - float d = (float) offset * uvdiff; - - switch (texture.getAnimationDirection()) - { - case 1: - v -= d; - if (v < 0f) - { - v += 1f; - } - break; - case 3: - v += d; - if (v > 1f) - { - v -= 1f; - } - break; - case 2: - u -= d; - if (u < 0f) - { - u += 1f; - } - break; - case 4: - u += d; - if (u > 1f) - { - u -= 1f; - } - break; - default: - return; - } - - texture.setU(u); - texture.setV(v); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/config/AnisotropicFilteringMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/config/AnisotropicFilteringMode.java deleted file mode 100644 index 6c10002a85..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/config/AnisotropicFilteringMode.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2018, pacf531 - * 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.gpu.config; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter(AccessLevel.PUBLIC) -@RequiredArgsConstructor -public enum AnisotropicFilteringMode -{ - DISABLED("Disabled", 0f), - BILINEAR("Bilinear", 0.5f), - TRILINEAR("Trilinear", 1f), - AF_2("x2", 2f), - AF_4("x4", 4f), - AF_8("x8", 8f), - AF_16("x16", 16f); - - private final String name; - private final float samples; - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/config/AntiAliasingMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/config/AntiAliasingMode.java deleted file mode 100644 index 131c639da4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/config/AntiAliasingMode.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.gpu.config; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter(AccessLevel.PUBLIC) -@RequiredArgsConstructor -public enum AntiAliasingMode -{ - DISABLED("Disabled", 0), - MSAA_2("MSAA x2", 2), - MSAA_4("MSAA x4", 4), - MSAA_8("MSAA x8", 8), - MSAA_16("MSAA x16", 16); - - private final String name; - private final int samples; - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/config/UIScalingMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/config/UIScalingMode.java deleted file mode 100644 index eb571a32c8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/config/UIScalingMode.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2019 logarrhytmic - * 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.gpu.config; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor -public enum UIScalingMode -{ - NEAREST("Nearest Neighbor", 0), - LINEAR("Bilinear", 0), - MITCHELL("Bicubic (Mitchell)", 1), - CATMULL_ROM("Bicubic (Catmull-Rom)", 2), - XBR("xBR (best at 2x & above)", 3); - - private final String name; - private final int mode; - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/template/Template.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/template/Template.java deleted file mode 100644 index 1f2ea73549..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/template/Template.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2018, 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.gpu.template; - -import java.util.function.Function; - -public class Template -{ - private final Function resourceLoader; - - public Template(Function resourceLoader) - { - this.resourceLoader = resourceLoader; - } - - public String process(String str) - { - StringBuilder sb = new StringBuilder(); - for (String line : str.split("\r?\n")) - { - if (line.startsWith("#include ")) - { - String resource = line.substring(9); - String resourceStr = resourceLoader.apply(resource); - sb.append(process(resourceStr)); - } - else - { - sb.append(line).append('\n'); - } - } - return sb.toString(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeConfig.java deleted file mode 100644 index b2ca3c22de..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeConfig.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.grandexchange; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("grandexchange") -public interface GrandExchangeConfig extends Config -{ - @ConfigItem( - position = 1, - keyName = "quickLookup", - name = "Hotkey lookup (Alt + Left click)", - description = "Configures whether to enable the hotkey lookup for ge searches" - ) - default boolean quickLookup() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "enableNotifications", - name = "Enable Notifications", - description = "Configures whether to enable notifications when an offer updates" - ) - default boolean enableNotifications() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "enableOsbPrices", - name = "Enable OSB actively traded prices", - description = "Shows the OSBuddy actively traded price at the GE" - ) - default boolean enableOsbPrices() - { - return false; - } - - @ConfigItem( - position = 4, - keyName = "enableGeLimits", - name = "Enable GE Limits on GE", - description = "Shows the GE Limits on the GE" - ) - default boolean enableGELimits() - { - return true; - } - - @ConfigItem( - position = 5, - keyName = "showTotal", - name = "Show grand exchange total", - description = "Show grand exchange total" - ) - default boolean showTotal() - { - return true; - } - - @ConfigItem( - position = 6, - keyName = "showExact", - name = "Show exact total value", - description = "Show exact total value" - ) - default boolean showExact() - { - return false; - } - - @ConfigItem( - position = 7, - keyName = "enableAfford", - name = "Enable Afford quantity on GE", - description = "Shows the quantity you can buy on the GE" - ) - default boolean enableAfford() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeInputListener.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeInputListener.java deleted file mode 100644 index a7fbc8824b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeInputListener.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2018, Jeremy Plsek - * 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.grandexchange; - -import java.awt.event.KeyEvent; -import java.awt.event.MouseEvent; -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.swing.SwingUtilities; -import net.runelite.api.Client; -import net.runelite.api.MenuEntry; -import net.runelite.api.util.Text; -import net.runelite.client.input.KeyListener; -import net.runelite.client.input.MouseAdapter; -import static net.runelite.client.plugins.grandexchange.GrandExchangePlugin.SEARCH_GRAND_EXCHANGE; - -@Singleton -public class GrandExchangeInputListener extends MouseAdapter implements KeyListener -{ - private final Client client; - private final GrandExchangePlugin plugin; - - @Inject - private GrandExchangeInputListener(final Client client, final GrandExchangePlugin plugin) - { - this.client = client; - this.plugin = plugin; - } - - @Override - public MouseEvent mouseClicked(MouseEvent e) - { - // Check if left click + alt - if (e.getButton() == MouseEvent.BUTTON1 && e.isAltDown()) - { - final MenuEntry[] menuEntries = client.getMenuEntries(); - for (final MenuEntry menuEntry : menuEntries) - { - if (menuEntry.getOption().equals(SEARCH_GRAND_EXCHANGE)) - { - search(Text.removeTags(menuEntry.getTarget())); - e.consume(); - break; - } - } - } - - return super.mouseClicked(e); - } - - private void search(final String itemName) - { - SwingUtilities.invokeLater(() -> - { - plugin.getPanel().showSearch(); - - if (!plugin.getButton().isSelected()) - { - plugin.getButton().getOnSelect().run(); - } - - plugin.getPanel().getSearchPanel().priceLookup(itemName); - }); - } - - @Override - public void keyTyped(KeyEvent e) - { - - } - - @Override - public void keyPressed(KeyEvent e) - { - if (e.isAltDown()) - { - plugin.setHotKeyPressed(true); - } - } - - @Override - public void keyReleased(KeyEvent e) - { - if (!e.isAltDown()) - { - plugin.setHotKeyPressed(false); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeItemPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeItemPanel.java deleted file mode 100644 index 0653ec2a6d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeItemPanel.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * Copyright (c) 2018, Psikoi - * 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.grandexchange; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.ArrayList; -import java.util.List; -import javax.inject.Singleton; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.border.CompoundBorder; -import javax.swing.border.EmptyBorder; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.util.AsyncBufferedImage; -import net.runelite.client.util.LinkBrowser; -import net.runelite.client.util.QuantityFormatter; - -/** - * This panel displays an individual item result in the - * Grand Exchange search plugin. - */ -@Singleton -class GrandExchangeItemPanel extends JPanel -{ - private static final Dimension ICON_SIZE = new Dimension(32, 32); - - GrandExchangeItemPanel(AsyncBufferedImage icon, String name, int itemID, int gePrice, int haPrice, int geItemLimit) - { - BorderLayout layout = new BorderLayout(); - layout.setHgap(5); - setLayout(layout); - setToolTipText(name); - setBackground(ColorScheme.DARKER_GRAY_COLOR); - - Color background = getBackground(); - List panels = new ArrayList<>(); - panels.add(this); - - MouseAdapter itemPanelMouseListener = new MouseAdapter() - { - @Override - public void mouseReleased(MouseEvent e) - { - geLink(name, itemID); - } - - @Override - public void mouseEntered(MouseEvent e) - { - for (JPanel panel : panels) - { - matchComponentBackground(panel, ColorScheme.DARK_GRAY_HOVER_COLOR); - } - setCursor(new Cursor(Cursor.HAND_CURSOR)); - } - - @Override - public void mouseExited(MouseEvent e) - { - for (JPanel panel : panels) - { - matchComponentBackground(panel, background); - } - setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); - } - }; - - addMouseListener(itemPanelMouseListener); - - setBorder(new EmptyBorder(5, 5, 5, 0)); - - // Icon - JLabel itemIcon = new JLabel(); - itemIcon.setPreferredSize(ICON_SIZE); - if (icon != null) - { - icon.addTo(itemIcon); - } - add(itemIcon, BorderLayout.LINE_START); - - // Item details panel - JPanel rightPanel = new JPanel(new GridLayout(4, 1)); - panels.add(rightPanel); - rightPanel.setBackground(background); - - // Item name - JLabel itemName = new JLabel(); - itemName.setForeground(Color.WHITE); - itemName.setMaximumSize(new Dimension(0, 0)); // to limit the label's size for - itemName.setPreferredSize(new Dimension(0, 0)); // items with longer names - itemName.setText(name); - rightPanel.add(itemName); - - // Ge price - JLabel gePriceLabel = new JLabel(); - if (gePrice > 0) - { - gePriceLabel.setText("GE Price: " + QuantityFormatter.formatNumber(gePrice) + " gp"); - } - else - { - gePriceLabel.setText("N/A"); - } - gePriceLabel.setForeground(ColorScheme.GRAND_EXCHANGE_PRICE); - rightPanel.add(gePriceLabel); - - // Alch price - JLabel haPriceLabel = new JLabel(); - haPriceLabel.setText("Alch Price: " + QuantityFormatter.formatNumber(haPrice) + " gp"); - haPriceLabel.setForeground(ColorScheme.GRAND_EXCHANGE_ALCH); - rightPanel.add(haPriceLabel); - - // GE Limit - JLabel geLimitLabel = new JLabel(); - String limitLabelText = geItemLimit == 0 ? "" : "Buy Limit " + QuantityFormatter.formatNumber(geItemLimit); - geLimitLabel.setText(limitLabelText); - geLimitLabel.setForeground(ColorScheme.GRAND_EXCHANGE_LIMIT); - geLimitLabel.setBorder(new CompoundBorder(geLimitLabel.getBorder(), new EmptyBorder(0, 0, 0, 7))); - rightPanel.add(geLimitLabel); - - add(rightPanel, BorderLayout.CENTER); - } - - static void geLink(String name, int itemID) - { - final String url = "http://services.runescape.com/m=itemdb_oldschool/" - + name.replaceAll(" ", "_") - + "/viewitem?obj=" - + itemID; - - LinkBrowser.browse(url); - } - - private void matchComponentBackground(JPanel panel, Color color) - { - panel.setBackground(color); - for (Component c : panel.getComponents()) - { - c.setBackground(color); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeItems.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeItems.java deleted file mode 100644 index 0bc10499e7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeItems.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.grandexchange; - -import lombok.Value; -import net.runelite.client.util.AsyncBufferedImage; - -@Value -class GrandExchangeItems -{ - private final AsyncBufferedImage icon; - private final String name; - private final int itemId; - private final int gePrice; - private final int haPrice; - private final int geItemLimit; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeOfferSlot.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeOfferSlot.java deleted file mode 100644 index 348b7a2b87..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeOfferSlot.java +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright (c) 2018, SomeoneWithAnInternetConnection - * Copyright (c) 2018, Psikoi - * 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.grandexchange; - -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.image.BufferedImage; -import javax.annotation.Nullable; -import javax.inject.Singleton; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.border.EmptyBorder; -import net.runelite.api.GrandExchangeOffer; -import net.runelite.api.GrandExchangeOfferState; -import static net.runelite.api.GrandExchangeOfferState.CANCELLED_BUY; -import static net.runelite.api.GrandExchangeOfferState.CANCELLED_SELL; -import static net.runelite.api.GrandExchangeOfferState.EMPTY; -import net.runelite.api.ItemDefinition; -import static net.runelite.client.plugins.grandexchange.GrandExchangeItemPanel.geLink; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.components.ThinProgressBar; -import net.runelite.client.util.ColorUtil; -import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.QuantityFormatter; - -@Singleton -class GrandExchangeOfferSlot extends JPanel -{ - private static final String FACE_CARD = "FACE_CARD"; - private static final String DETAILS_CARD = "DETAILS_CARD"; - - private static final ImageIcon RIGHT_ARROW_ICON; - private static final ImageIcon LEFT_ARROW_ICON; - - private final JPanel container = new JPanel(); - private final CardLayout cardLayout = new CardLayout(); - - private final JLabel itemIcon = new JLabel(); - private final JLabel itemName = new JLabel(); - private final JLabel offerInfo = new JLabel(); - - private final JLabel itemPrice = new JLabel(); - private final JLabel offerSpent = new JLabel(); - - private final ThinProgressBar progressBar = new ThinProgressBar(); - - private final JMenuItem geLink = new JMenuItem("Open in Grand Exchange"); - - private boolean showingFace = true; - - static - { - final BufferedImage rightArrow = ImageUtil.alphaOffset(ImageUtil.getResourceStreamFromClass(GrandExchangeOfferSlot.class, "/util/arrow_right.png"), 0.25f); - RIGHT_ARROW_ICON = new ImageIcon(rightArrow); - LEFT_ARROW_ICON = new ImageIcon(ImageUtil.flipImage(rightArrow, true, false)); - } - - /** - * This (sub)panel is used for each GE slot displayed - * in the sidebar - */ - GrandExchangeOfferSlot() - { - setLayout(new BorderLayout()); - setBackground(ColorScheme.DARK_GRAY_COLOR); - setBorder(new EmptyBorder(7, 0, 0, 0)); - - final MouseListener ml = new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - super.mousePressed(mouseEvent); - switchPanel(); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - super.mouseEntered(mouseEvent); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - super.mouseExited(mouseEvent); - } - }; - - container.setLayout(cardLayout); - container.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - JPanel faceCard = new JPanel(); - faceCard.setBackground(ColorScheme.DARKER_GRAY_COLOR); - faceCard.setLayout(new BorderLayout()); - - itemIcon.setVerticalAlignment(JLabel.CENTER); - itemIcon.setHorizontalAlignment(JLabel.CENTER); - itemIcon.setPreferredSize(new Dimension(45, 45)); - - itemName.setForeground(Color.WHITE); - itemName.setVerticalAlignment(JLabel.BOTTOM); - itemName.setFont(FontManager.getRunescapeSmallFont()); - - offerInfo.setForeground(ColorScheme.LIGHT_GRAY_COLOR); - offerInfo.setVerticalAlignment(JLabel.TOP); - offerInfo.setFont(FontManager.getRunescapeSmallFont()); - - JLabel switchFaceViewIcon = new JLabel(); - switchFaceViewIcon.setIcon(RIGHT_ARROW_ICON); - switchFaceViewIcon.setVerticalAlignment(JLabel.CENTER); - switchFaceViewIcon.setHorizontalAlignment(JLabel.CENTER); - switchFaceViewIcon.setPreferredSize(new Dimension(30, 45)); - switchFaceViewIcon.addMouseListener(ml); - - JPopupMenu menu = new JPopupMenu(); - menu.add(geLink); - - JPanel offerFaceDetails = new JPanel(); - offerFaceDetails.setBackground(ColorScheme.DARKER_GRAY_COLOR); - offerFaceDetails.setLayout(new GridLayout(2, 1, 0, 2)); - offerFaceDetails.setComponentPopupMenu(menu); - - offerFaceDetails.add(itemName); - offerFaceDetails.add(offerInfo); - - faceCard.add(offerFaceDetails, BorderLayout.CENTER); - faceCard.add(itemIcon, BorderLayout.WEST); - faceCard.add(switchFaceViewIcon, BorderLayout.EAST); - - JPanel detailsCard = new JPanel(); - detailsCard.setBackground(ColorScheme.DARKER_GRAY_COLOR); - detailsCard.setLayout(new BorderLayout()); - detailsCard.setBorder(new EmptyBorder(0, 15, 0, 0)); - detailsCard.setComponentPopupMenu(menu); - - itemPrice.setForeground(Color.WHITE); - itemPrice.setVerticalAlignment(JLabel.BOTTOM); - itemPrice.setFont(FontManager.getRunescapeSmallFont()); - - offerSpent.setForeground(Color.WHITE); - offerSpent.setVerticalAlignment(JLabel.TOP); - offerSpent.setFont(FontManager.getRunescapeSmallFont()); - - JLabel switchDetailsViewIcon = new JLabel(); - switchDetailsViewIcon.setIcon(LEFT_ARROW_ICON); - switchDetailsViewIcon.setVerticalAlignment(JLabel.CENTER); - switchDetailsViewIcon.setHorizontalAlignment(JLabel.CENTER); - switchDetailsViewIcon.setPreferredSize(new Dimension(30, 45)); - switchDetailsViewIcon.addMouseListener(ml); - - JPanel offerDetails = new JPanel(); - offerDetails.setBackground(ColorScheme.DARKER_GRAY_COLOR); - offerDetails.setLayout(new GridLayout(2, 1)); - - offerDetails.add(itemPrice); - offerDetails.add(offerSpent); - - detailsCard.add(offerDetails, BorderLayout.CENTER); - detailsCard.add(switchDetailsViewIcon, BorderLayout.EAST); - - container.add(faceCard, FACE_CARD); - container.add(detailsCard, DETAILS_CARD); - - cardLayout.show(container, FACE_CARD); - - add(container, BorderLayout.CENTER); - add(progressBar, BorderLayout.SOUTH); - } - - void updateOffer(ItemDefinition offerItem, BufferedImage itemImage, @Nullable GrandExchangeOffer newOffer) - { - if (newOffer == null || newOffer.getState() == EMPTY) - { - return; - } - else - { - cardLayout.show(container, FACE_CARD); - - itemName.setText(offerItem.getName()); - itemIcon.setIcon(new ImageIcon(itemImage)); - - for (ActionListener al : geLink.getActionListeners()) - { - geLink.removeActionListener(al); - } - geLink.addActionListener(actionEvent -> geLink(offerItem.getName(), offerItem.getId())); - - boolean buying = newOffer.getState() == GrandExchangeOfferState.BOUGHT - || newOffer.getState() == GrandExchangeOfferState.BUYING - || newOffer.getState() == GrandExchangeOfferState.CANCELLED_BUY; - - String offerState = (buying ? "Bought " : "Sold ") - + QuantityFormatter.quantityToRSDecimalStack(newOffer.getQuantitySold()) + " / " - + QuantityFormatter.quantityToRSDecimalStack(newOffer.getTotalQuantity()); - - offerInfo.setText(offerState); - - itemPrice.setText(htmlLabel("Price each: ", QuantityFormatter.formatNumber(newOffer.getPrice()))); - - String action = buying ? "Spent: " : "Received: "; - - offerSpent.setText(htmlLabel(action, QuantityFormatter.formatNumber(newOffer.getSpent()) + " / " - + QuantityFormatter.formatNumber(newOffer.getPrice() * newOffer.getTotalQuantity()))); - - progressBar.setForeground(getProgressColor(newOffer)); - progressBar.setMaximumValue(newOffer.getTotalQuantity()); - progressBar.setValue(newOffer.getQuantitySold()); - - /* Couldn't set the tooltip for the container panel as the children override it, so I'm setting - * the tooltips on the children instead. */ - for (Component c : container.getComponents()) - { - if (c instanceof JPanel) - { - JPanel panel = (JPanel) c; - panel.setToolTipText(htmlTooltip(((int) progressBar.getPercentage()) + "%")); - } - } - } - - revalidate(); - repaint(); - } - - private String htmlTooltip(String value) - { - return "Progress: " + value + ""; - } - - private String htmlLabel(String key, String value) - { - return "" + key + "" + value + ""; - } - - private void switchPanel() - { - this.showingFace = !this.showingFace; - cardLayout.show(container, showingFace ? FACE_CARD : DETAILS_CARD); - } - - private Color getProgressColor(GrandExchangeOffer offer) - { - if (offer.getState() == CANCELLED_BUY || offer.getState() == CANCELLED_SELL) - { - return ColorScheme.PROGRESS_ERROR_COLOR; - } - - if (offer.getQuantitySold() == offer.getTotalQuantity()) - { - return ColorScheme.PROGRESS_COMPLETE_COLOR; - } - - return ColorScheme.PROGRESS_INPROGRESS_COLOR; - } -} - diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeOffersPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeOffersPanel.java deleted file mode 100644 index e73987f0fb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeOffersPanel.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2018, SomeoneWithAnInternetConnection - * Copyright (c) 2018, Psikoi - * 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.grandexchange; - -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.image.BufferedImage; -import java.util.Arrays; -import javax.inject.Singleton; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; -import net.runelite.api.GrandExchangeOffer; -import net.runelite.api.GrandExchangeOfferState; -import net.runelite.api.ItemDefinition; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.components.PluginErrorPanel; - -@Singleton -class GrandExchangeOffersPanel extends JPanel -{ - private static final String ERROR_PANEL = "ERROR_PANEL"; - private static final String OFFERS_PANEL = "OFFERS_PANEL"; - - private static final int MAX_OFFERS = 8; - - private final GridBagConstraints constraints = new GridBagConstraints(); - private final CardLayout cardLayout = new CardLayout(); - - /* The offers container, this will hold all the individual ge offers panels */ - private final JPanel offerPanel = new JPanel(); - - /* The center panel, this holds either the error panel or the offers container */ - private final JPanel container = new JPanel(cardLayout); - - private final GrandExchangeOfferSlot[] offerSlotPanels = new GrandExchangeOfferSlot[MAX_OFFERS]; - - GrandExchangeOffersPanel() - { - setLayout(new BorderLayout()); - setBackground(ColorScheme.DARK_GRAY_COLOR); - - constraints.fill = GridBagConstraints.HORIZONTAL; - constraints.weightx = 1; - constraints.gridx = 0; - constraints.gridy = 0; - - /* This panel wraps the offers panel and limits its height */ - JPanel offersWrapper = new JPanel(new BorderLayout()); - offersWrapper.setBackground(ColorScheme.DARK_GRAY_COLOR); - offersWrapper.add(offerPanel, BorderLayout.NORTH); - - offerPanel.setLayout(new GridBagLayout()); - offerPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); - offerPanel.setBackground(ColorScheme.DARK_GRAY_COLOR); - - /* This panel wraps the error panel and limits its height */ - JPanel errorWrapper = new JPanel(new BorderLayout()); - errorWrapper.setBackground(ColorScheme.DARK_GRAY_COLOR); - /* The error panel, this displays an error message */ - PluginErrorPanel errorPanel = new PluginErrorPanel(); - errorWrapper.add(errorPanel, BorderLayout.NORTH); - - errorPanel.setBorder(new EmptyBorder(50, 20, 20, 20)); - errorPanel.setContent("No offers detected", "No grand exchange offers were found on your account."); - - container.add(offersWrapper, OFFERS_PANEL); - container.add(errorWrapper, ERROR_PANEL); - - add(container, BorderLayout.CENTER); - - resetOffers(); - } - - void resetOffers() - { - offerPanel.removeAll(); - Arrays.fill(offerSlotPanels, null); - updateEmptyOffersPanel(); - } - - void updateOffer(ItemDefinition item, BufferedImage itemImage, GrandExchangeOffer newOffer, int slot) - { - /* If slot was previously filled, and is now empty, remove it from the list */ - if (newOffer == null || newOffer.getState() == GrandExchangeOfferState.EMPTY) - { - if (offerSlotPanels[slot] != null) - { - offerPanel.remove(offerSlotPanels[slot]); - offerSlotPanels[slot] = null; - revalidate(); - repaint(); - } - - removeTopMargin(); - updateEmptyOffersPanel(); - return; - } - - /* If slot was empty, and is now filled, add it to the list */ - if (offerSlotPanels[slot] == null) - { - GrandExchangeOfferSlot newSlot = new GrandExchangeOfferSlot(); - offerSlotPanels[slot] = newSlot; - offerPanel.add(newSlot, constraints); - constraints.gridy++; - } - - offerSlotPanels[slot].updateOffer(item, itemImage, newOffer); - - removeTopMargin(); - - revalidate(); - repaint(); - - updateEmptyOffersPanel(); - } - - /** - * Reset the border for the first offer slot. - */ - private void removeTopMargin() - { - - if (offerPanel.getComponentCount() <= 0) - { - return; - } - - JPanel firstItem = (JPanel) offerPanel.getComponent(0); - firstItem.setBorder(null); - } - - /** - * This method calculates the amount of empty ge offer slots, if all slots are empty, - * it shows the error panel. - */ - private void updateEmptyOffersPanel() - { - int nullCount = 0; - for (GrandExchangeOfferSlot slot : offerSlotPanels) - { - if (slot == null) - { - nullCount++; - } - } - - if (nullCount == MAX_OFFERS) - { - offerPanel.removeAll(); - cardLayout.show(container, ERROR_PANEL); - } - else - { - cardLayout.show(container, OFFERS_PANEL); - } - - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePanel.java deleted file mode 100644 index fcfef5322d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePanel.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2018, SomeoneWithAnInternetConnection - * Copyright (c) 2018, Psikoi - * 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.grandexchange; - -import java.awt.BorderLayout; -import java.util.Map; -import java.util.concurrent.ScheduledExecutorService; -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.ui.components.materialtabs.MaterialTab; -import net.runelite.client.ui.components.materialtabs.MaterialTabGroup; - -@Singleton -class GrandExchangePanel extends PluginPanel -{ - - // this panel will hold either the ge search panel or the ge offers panel - private final JPanel display = new JPanel(); - - private final MaterialTabGroup tabGroup = new MaterialTabGroup(display); - private final MaterialTab searchTab; - - @Getter(AccessLevel.PACKAGE) - private GrandExchangeSearchPanel searchPanel; - @Getter(AccessLevel.PACKAGE) - private GrandExchangeOffersPanel offersPanel; - - @Inject - private GrandExchangePanel(ClientThread clientThread, ItemManager itemManager, ScheduledExecutorService executor, GrandExchangeConfig config) - { - super(false); - - setLayout(new BorderLayout()); - setBackground(ColorScheme.DARK_GRAY_COLOR); - - // Search Panel - searchPanel = new GrandExchangeSearchPanel(clientThread, itemManager, executor); - - //Offers Panel - offersPanel = new GrandExchangeOffersPanel(); - - MaterialTab offersTab = new MaterialTab("Offers", tabGroup, offersPanel); - searchTab = new MaterialTab("Search", tabGroup, searchPanel); - - tabGroup.setBorder(new EmptyBorder(5, 0, 0, 0)); - tabGroup.addTab(offersTab); - tabGroup.addTab(searchTab); - tabGroup.select(offersTab); // selects the default selected tab - - add(tabGroup, BorderLayout.NORTH); - add(display, BorderLayout.CENTER); - } - - void showSearch() - { - if (searchPanel.isShowing()) - { - return; - } - - tabGroup.select(searchTab); - revalidate(); - } - - void setGELimits(Map itemGELimits) - { - searchPanel.setItemGELimits(itemGELimits); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java deleted file mode 100644 index 4c958d6179..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java +++ /dev/null @@ -1,622 +0,0 @@ -/* - * Copyright (c) 2019, Adam - * Copyright (c) 2017, Robbie - * Copyright (c) 2018, SomeoneWithAnInternetConnection - * 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.grandexchange; - -import com.google.common.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.inject.Provides; -import io.reactivex.schedulers.Schedulers; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.Map; -import java.util.concurrent.ScheduledExecutorService; -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.swing.SwingUtilities; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.GrandExchangeOffer; -import net.runelite.api.GrandExchangeOfferState; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemDefinition; -import static net.runelite.api.ItemID.COINS_995; -import net.runelite.api.MenuOpcode; -import net.runelite.api.Varbits; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.FocusChanged; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GrandExchangeOfferChanged; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.Notifier; -import net.runelite.client.account.AccountSession; -import net.runelite.client.account.SessionManager; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.events.SessionClose; -import net.runelite.client.events.SessionOpen; -import net.runelite.client.game.ItemManager; -import net.runelite.client.input.KeyManager; -import net.runelite.client.input.MouseManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.QuantityFormatter; -import net.runelite.http.api.RuneLiteAPI; -import net.runelite.http.api.ge.GrandExchangeClient; -import net.runelite.http.api.ge.GrandExchangeTrade; -import net.runelite.http.api.osbuddy.OSBGrandExchangeClient; -import net.runelite.http.api.osbuddy.OSBGrandExchangeResult; - -@PluginDescriptor( - name = "Grand Exchange", - description = "Provide additional and/or easier access to Grand Exchange information", - tags = {"external", "integration", "notifications", "panel", "prices", "trade"}, - type = PluginType.UTILITY -) -@Slf4j -@Singleton -public class GrandExchangePlugin extends Plugin -{ - static final String SEARCH_GRAND_EXCHANGE = "Search Grand Exchange"; - private static final int OFFER_TYPE_BUY = 0; - private static final int OFFER_CONTAINER_ITEM = 21; - private static final int OFFER_QUANTITY_HEADING = 28; - private static final String OFFER_QUANTITY_DEFAULT_HEADING = "Quantity:"; - private static final int OFFER_DEFAULT_ITEM_ID = 6512; - private static final OSBGrandExchangeClient CLIENT = new OSBGrandExchangeClient(); - private static final String OSB_GE_TEXT = "
OSBuddy Actively traded price: "; - private static final String BUY_LIMIT_GE_TEXT = "
Buy limit: "; - private static final TypeToken> BUY_LIMIT_TOKEN = new TypeToken>() - { - }; - @Getter(AccessLevel.PACKAGE) - private NavigationButton button; - - @Getter(AccessLevel.PACKAGE) - private GrandExchangePanel panel; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private boolean hotKeyPressed; - - @Inject - private GrandExchangeInputListener inputListener; - - @Inject - private ItemManager itemManager; - - @Inject - private MouseManager mouseManager; - - @Inject - private KeyManager keyManager; - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private ClientToolbar clientToolbar; - - @Inject - private GrandExchangeConfig config; - - @Inject - private Notifier notifier; - - @Inject - private ScheduledExecutorService executorService; - - @Inject - private SessionManager sessionManager; - - @Inject - private ConfigManager configManager; - - private Widget grandExchangeText; - private Widget grandExchangeItem; - private Widget grandExchangeOfferQuantityHeading; - private Map itemGELimits; - - private int osbItem; - private OSBGrandExchangeResult osbGrandExchangeResult; - private GrandExchangeClient grandExchangeClient; - - private boolean quickLookup; - private boolean enableNotifications; - private boolean enableOsbPrices; - private boolean enableGELimits; - private boolean enableAfford; - - private static Map loadGELimits() throws IOException - { - try (final JsonReader geLimitData = new JsonReader(new InputStreamReader(GrandExchangePlugin.class.getResourceAsStream("ge_limits.json")))) - { - final Map itemGELimits = RuneLiteAPI.GSON.fromJson(geLimitData, BUY_LIMIT_TOKEN.getType()); - log.debug("Loaded {} limits", itemGELimits.size()); - return itemGELimits; - } - } - - private SavedOffer getOffer(int slot) - { - String offer = configManager.getConfiguration("geoffer." + client.getUsername().toLowerCase(), Integer.toString(slot)); - if (offer == null) - { - return null; - } - return RuneLiteAPI.GSON.fromJson(offer, SavedOffer.class); - } - - private void setOffer(int slot, SavedOffer offer) - { - configManager.setConfiguration("geoffer." + client.getUsername().toLowerCase(), Integer.toString(slot), RuneLiteAPI.GSON.toJson(offer)); - } - - private void deleteOffer(int slot) - { - configManager.unsetConfiguration("geoffer." + client.getUsername().toLowerCase(), Integer.toString(slot)); - } - - @Provides - GrandExchangeConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(GrandExchangeConfig.class); - } - - @Override - protected void startUp() throws Exception - { - updateConfig(); - - itemGELimits = loadGELimits(); - panel = injector.getInstance(GrandExchangePanel.class); - panel.setGELimits(itemGELimits); - - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "ge_icon.png"); - - button = NavigationButton.builder() - .tooltip("Grand Exchange") - .icon(icon) - .priority(3) - .panel(panel) - .build(); - - clientToolbar.addNavigation(button); - - if (this.quickLookup) - { - mouseManager.registerMouseListener(inputListener); - keyManager.registerKeyListener(inputListener); - } - - AccountSession accountSession = sessionManager.getAccountSession(); - if (accountSession != null) - { - grandExchangeClient = new GrandExchangeClient(accountSession.getUuid()); - } - - osbItem = -1; - osbGrandExchangeResult = null; - } - - @Override - protected void shutDown() - { - clientToolbar.removeNavigation(button); - mouseManager.unregisterMouseListener(inputListener); - keyManager.unregisterKeyListener(inputListener); - grandExchangeText = null; - grandExchangeItem = null; - grandExchangeOfferQuantityHeading = null; - itemGELimits = null; - grandExchangeClient = null; - } - - @Subscribe - private void onSessionOpen(SessionOpen sessionOpen) - { - AccountSession accountSession = sessionManager.getAccountSession(); - if (accountSession.getUuid() != null) - { - grandExchangeClient = new GrandExchangeClient(accountSession.getUuid()); - } - else - { - grandExchangeClient = null; - } - } - - private void updateConfig() - { - this.quickLookup = config.quickLookup(); - this.enableNotifications = config.enableNotifications(); - this.enableOsbPrices = config.enableOsbPrices(); - this.enableGELimits = config.enableGELimits(); - this.enableAfford = config.enableAfford(); - } - - @Subscribe - private void onSessionClose(SessionClose sessionClose) - { - grandExchangeClient = null; - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("grandexchange")) - { - updateConfig(); - if (event.getKey().equals("quickLookup")) - { - if (this.quickLookup) - { - mouseManager.registerMouseListener(inputListener); - keyManager.registerKeyListener(inputListener); - } - else - { - mouseManager.unregisterMouseListener(inputListener); - keyManager.unregisterKeyListener(inputListener); - } - } - } - } - - @Subscribe - private void onGrandExchangeOfferChanged(GrandExchangeOfferChanged offerEvent) - { - final int slot = offerEvent.getSlot(); - final GrandExchangeOffer offer = offerEvent.getOffer(); - - ItemDefinition offerItem = itemManager.getItemDefinition(offer.getItemId()); - boolean shouldStack = offerItem.isStackable() || offer.getTotalQuantity() > 1; - BufferedImage itemImage = itemManager.getImage(offer.getItemId(), offer.getTotalQuantity(), shouldStack); - SwingUtilities.invokeLater(() -> panel.getOffersPanel().updateOffer(offerItem, itemImage, offer, slot)); - - submitTrades(slot, offer); - - updateConfig(slot, offer); - } - - private void submitTrades(int slot, GrandExchangeOffer offer) - { - if (grandExchangeClient == null) - { - return; - } - - // Only interested in offers which are fully bought/sold - if (offer.getState() != GrandExchangeOfferState.BOUGHT && offer.getState() != GrandExchangeOfferState.SOLD) - { - return; - } - - SavedOffer savedOffer = getOffer(slot); - if (!shouldUpdate(savedOffer, offer)) - { - return; - } - - // getPrice() is the price of the offer, not necessarily what the item bought at - int priceEach = offer.getSpent() / offer.getTotalQuantity(); - - GrandExchangeTrade grandExchangeTrade = new GrandExchangeTrade(); - grandExchangeTrade.setBuy(offer.getState() == GrandExchangeOfferState.BOUGHT); - grandExchangeTrade.setItemId(offer.getItemId()); - grandExchangeTrade.setQuantity(offer.getTotalQuantity()); - grandExchangeTrade.setPrice(priceEach); - - log.debug("Submitting trade: {}", grandExchangeTrade); - grandExchangeClient.submit(grandExchangeTrade); - } - - private void updateConfig(int slot, GrandExchangeOffer offer) - { - if (offer.getState() == GrandExchangeOfferState.EMPTY) - { - deleteOffer(slot); - } - else - { - SavedOffer savedOffer = new SavedOffer(); - savedOffer.setItemId(offer.getItemId()); - savedOffer.setQuantitySold(offer.getQuantitySold()); - savedOffer.setTotalQuantity(offer.getTotalQuantity()); - savedOffer.setPrice(offer.getPrice()); - savedOffer.setSpent(offer.getSpent()); - savedOffer.setState(offer.getState()); - setOffer(slot, savedOffer); - } - } - - private boolean shouldUpdate(SavedOffer savedOffer, GrandExchangeOffer grandExchangeOffer) - { - if (savedOffer == null) - { - return false; - } - - // Only update offer if state has changed - return savedOffer.getState() != grandExchangeOffer.getState(); - } - - @Subscribe - private void onChatMessage(ChatMessage event) - { - if (!this.enableNotifications || event.getType() != ChatMessageType.GAMEMESSAGE) - { - return; - } - - String message = Text.removeTags(event.getMessage()); - - if (message.startsWith("Grand Exchange:")) - { - this.notifier.notify(message); - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged gameStateChanged) - { - if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN) - { - panel.getOffersPanel().resetOffers(); - } - } - - @Subscribe - private void onMenuEntryAdded(MenuEntryAdded menuEntry) - { - // At the moment, if the user disables quick lookup, the input listener gets disabled. Thus, isHotKeyPressed() - // should always return false when quick lookup is disabled. - // Replace the default option with "Search ..." when holding alt - if (client.getGameState() != GameState.LOGGED_IN || !hotKeyPressed) - { - return; - } - - final int widgetId = menuEntry.getParam1(); - final int groupId = WidgetInfo.TO_GROUP(widgetId); - - switch (groupId) - { - case WidgetID.BANK_GROUP_ID: - // Don't show for view tabs and such - if (WidgetInfo.TO_CHILD(widgetId) != WidgetInfo.BANK_ITEM_CONTAINER.getChildId()) - { - break; - } - case WidgetID.INVENTORY_GROUP_ID: - case WidgetID.BANK_INVENTORY_GROUP_ID: - case WidgetID.GRAND_EXCHANGE_INVENTORY_GROUP_ID: - case WidgetID.SHOP_INVENTORY_GROUP_ID: - menuEntry.setOption(SEARCH_GRAND_EXCHANGE); - menuEntry.setOpcode(MenuOpcode.RUNELITE.getId()); - menuEntry.setModified(); - } - } - - @Subscribe - private void onFocusChanged(FocusChanged focusChanged) - { - if (!focusChanged.isFocused()) - { - setHotKeyPressed(false); - } - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded event) - { - switch (event.getGroupId()) - { - case WidgetID.GRAND_EXCHANGE_GROUP_ID: - Widget grandExchangeOffer = client.getWidget(WidgetInfo.GRAND_EXCHANGE_OFFER_CONTAINER); - grandExchangeText = client.getWidget(WidgetInfo.GRAND_EXCHANGE_OFFER_TEXT); - grandExchangeItem = grandExchangeOffer.getDynamicChildren()[OFFER_CONTAINER_ITEM]; - grandExchangeOfferQuantityHeading = grandExchangeOffer.getDynamicChildren()[OFFER_QUANTITY_HEADING]; - break; - case WidgetID.INVENTORY_GROUP_ID: - grandExchangeText = null; - grandExchangeItem = null; - grandExchangeOfferQuantityHeading = null; - break; - } - } - - @Subscribe - private void onScriptCallbackEvent(ScriptCallbackEvent event) - { - if (event.getEventName().equals("geBuilt")) - { - rebuildGeText(); - } - - if (!event.getEventName().equals("setGETitle") || !config.showTotal()) - { - return; - } - - long total = 0; - GrandExchangeOffer[] offers = client.getGrandExchangeOffers(); - for (GrandExchangeOffer offer : offers) - { - if (offer != null) - { - total += offer.getPrice() * offer.getTotalQuantity(); - } - } - - if (total == 0L) - { - return; - } - - StringBuilder titleBuilder = new StringBuilder(" ("); - - if (config.showExact()) - { - titleBuilder.append(QuantityFormatter.formatNumber(total)); - } - else - { - titleBuilder.append(QuantityFormatter.quantityToStackSize(total)); - } - - titleBuilder.append(')'); - - String[] stringStack = client.getStringStack(); - int stringStackSize = client.getStringStackSize(); - - stringStack[stringStackSize - 1] += titleBuilder.toString(); - } - - private void rebuildGeText() - { - if (grandExchangeText == null || grandExchangeItem == null || grandExchangeItem.isHidden()) - { - return; - } - - final Widget geText = grandExchangeText; - final Widget geQuantityHeading = grandExchangeOfferQuantityHeading; - final int offerType = client.getVar(Varbits.GE_OFFER_CREATION_TYPE); - final int itemId = grandExchangeItem.getItemId(); - - if (itemId == OFFER_DEFAULT_ITEM_ID || itemId == -1) - { - return; - } - - - if (this.enableAfford && offerType == OFFER_TYPE_BUY) - { - final ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); - int coins = 0; - if (inventory != null) - { - for (final Item item : inventory.getItems()) - { - if (item.getId() == COINS_995) - { - coins = item.getQuantity(); - break; - } - } - } - - final int currentItemPrice = client.getVar(Varbits.GRAND_EXCHANGE_PRICE_PER_ITEM); - final int canAfford = currentItemPrice != 0 ? coins / currentItemPrice : 0; - final String quantityHeadingText = OFFER_QUANTITY_DEFAULT_HEADING + " (" + canAfford + ")"; - geQuantityHeading.setText(quantityHeadingText); - } - else - { - geQuantityHeading.setText(OFFER_QUANTITY_DEFAULT_HEADING); - } - - - String[] lines = geText.getText().split("
"); - String text = lines[0]; // remove any limit or OSB ge values - - if (this.enableGELimits && itemGELimits != null) - { - final Integer itemLimit = itemGELimits.get(itemId); - - // If we have item buy limit, append it - if (itemLimit != null) - { - text += BUY_LIMIT_GE_TEXT + QuantityFormatter.formatNumber(itemLimit); - } - } - - geText.setText(text); - - if (!this.enableOsbPrices) - { - return; - } - - // If we already have the result, use it - if (osbGrandExchangeResult != null && osbGrandExchangeResult.getItem_id() == itemId && osbGrandExchangeResult.getOverall_average() > 0) - { - geText.setText(text + OSB_GE_TEXT + QuantityFormatter.formatNumber(osbGrandExchangeResult.getOverall_average())); - } - - if (osbItem == itemId) - { - // avoid starting duplicate lookups - return; - } - - osbItem = itemId; - - log.debug("Looking up OSB item price {}", itemId); - - final String start = text; - executorService.submit(() -> - { - CLIENT.lookupItem(itemId) - .subscribeOn(Schedulers.io()) - .observeOn(Schedulers.single()) - .subscribe( - (osbresult) -> - { - osbGrandExchangeResult = osbresult; - // Update the text on the widget too - geText.setText(start + OSB_GE_TEXT + QuantityFormatter.formatNumber(osbresult.getOverall_average())); - }, - (e) -> log.debug("Error getting price of item {}", itemId, e) - ); - }); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeSearchPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeSearchPanel.java deleted file mode 100644 index 57200d58c9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeSearchPanel.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * Copyright (c) 2018, Psikoi - * 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.grandexchange; - -import com.google.common.base.Strings; -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ScheduledExecutorService; -import javax.inject.Singleton; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.SwingUtilities; -import javax.swing.border.EmptyBorder; -import lombok.AccessLevel; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ItemDefinition; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.components.IconTextField; -import net.runelite.client.ui.components.PluginErrorPanel; -import net.runelite.client.util.AsyncBufferedImage; -import net.runelite.http.api.item.ItemPrice; - -/** - * This panel holds the search section of the Grand Exchange Plugin. - * It should display a search bar and either item results or a error panel. - */ -@Slf4j -@Singleton -class GrandExchangeSearchPanel extends JPanel -{ - private static final String ERROR_PANEL = "ERROR_PANEL"; - private static final String RESULTS_PANEL = "RESULTS_PANEL"; - private static final int MAX_SEARCH_ITEMS = 100; - - private final GridBagConstraints constraints = new GridBagConstraints(); - private final CardLayout cardLayout = new CardLayout(); - - private final ClientThread clientThread; - private final ItemManager itemManager; - private final ScheduledExecutorService executor; - - private final IconTextField searchBar = new IconTextField(); - - /* The results container, this will hold all the individual ge item panels */ - private final JPanel searchItemsPanel = new JPanel(); - - /* The center panel, this holds either the error panel or the results container */ - private final JPanel centerPanel = new JPanel(cardLayout); - - /* The error panel, this displays an error message */ - private final PluginErrorPanel errorPanel = new PluginErrorPanel(); - - private final List itemsList = new ArrayList<>(); - - @Setter(AccessLevel.PACKAGE) - private Map itemGELimits = Collections.emptyMap(); - - GrandExchangeSearchPanel(final ClientThread clientThread, final ItemManager itemManager, final ScheduledExecutorService executor) - { - this.clientThread = clientThread; - this.itemManager = itemManager; - this.executor = executor; - - setLayout(new BorderLayout()); - setBackground(ColorScheme.DARK_GRAY_COLOR); - - /* The main container, this holds the search bar and the center panel */ - JPanel container = new JPanel(); - container.setLayout(new BorderLayout(5, 5)); - container.setBorder(new EmptyBorder(10, 10, 10, 10)); - container.setBackground(ColorScheme.DARK_GRAY_COLOR); - - searchBar.setIcon(IconTextField.Icon.SEARCH); - searchBar.setPreferredSize(new Dimension(100, 30)); - searchBar.setBackground(ColorScheme.DARKER_GRAY_COLOR); - searchBar.setHoverBackgroundColor(ColorScheme.DARK_GRAY_HOVER_COLOR); - searchBar.addActionListener(e -> executor.execute(() -> priceLookup(false))); - searchBar.addClearListener(e -> updateSearch()); - - searchItemsPanel.setLayout(new GridBagLayout()); - searchItemsPanel.setBackground(ColorScheme.DARK_GRAY_COLOR); - - constraints.fill = GridBagConstraints.HORIZONTAL; - constraints.weightx = 1; - constraints.gridx = 0; - constraints.gridy = 0; - - /* This panel wraps the results panel and guarantees the scrolling behaviour */ - JPanel wrapper = new JPanel(new BorderLayout()); - wrapper.setBackground(ColorScheme.DARK_GRAY_COLOR); - wrapper.add(searchItemsPanel, BorderLayout.NORTH); - - /* The results wrapper, this scrolling panel wraps the results container */ - JScrollPane resultsWrapper = new JScrollPane(wrapper); - resultsWrapper.setBackground(ColorScheme.DARK_GRAY_COLOR); - resultsWrapper.getVerticalScrollBar().setPreferredSize(new Dimension(12, 0)); - resultsWrapper.getVerticalScrollBar().setBorder(new EmptyBorder(0, 5, 0, 0)); - resultsWrapper.setVisible(false); - - /* This panel wraps the error panel and limits its height */ - JPanel errorWrapper = new JPanel(new BorderLayout()); - errorWrapper.setBackground(ColorScheme.DARK_GRAY_COLOR); - errorWrapper.add(errorPanel, BorderLayout.NORTH); - - errorPanel.setContent("Grand Exchange Search", - "Here you can search for an item by its name to find price information."); - - centerPanel.add(resultsWrapper, RESULTS_PANEL); - centerPanel.add(errorWrapper, ERROR_PANEL); - - cardLayout.show(centerPanel, ERROR_PANEL); - - container.add(searchBar, BorderLayout.NORTH); - container.add(centerPanel, BorderLayout.CENTER); - - add(container, BorderLayout.CENTER); - } - - void priceLookup(String item) - { - searchBar.setText(item); - executor.execute(() -> priceLookup(true)); - } - - private boolean updateSearch() - { - String lookup = searchBar.getText(); - - if (Strings.isNullOrEmpty(lookup)) - { - searchItemsPanel.removeAll(); - SwingUtilities.invokeLater(searchItemsPanel::updateUI); - return false; - } - - // Input is not empty, add searching label - searchItemsPanel.removeAll(); - searchBar.setBackground(ColorScheme.DARKER_GRAY_COLOR); - searchBar.setEditable(false); - searchBar.setIcon(IconTextField.Icon.LOADING); - return true; - } - - private void priceLookup(boolean exactMatch) - { - if (!updateSearch()) - { - return; - } - - List result = itemManager.search(searchBar.getText()); - if (result.isEmpty()) - { - searchBar.setIcon(IconTextField.Icon.ERROR); - errorPanel.setContent("No results found.", "No items were found with that name, please try again."); - cardLayout.show(centerPanel, ERROR_PANEL); - searchBar.setEditable(true); - return; - } - - // move to client thread to lookup item composition - clientThread.invokeLater(() -> processResult(result, searchBar.getText(), exactMatch)); - } - - private void processResult(List result, String lookup, boolean exactMatch) - { - itemsList.clear(); - - cardLayout.show(centerPanel, RESULTS_PANEL); - - int count = 0; - - for (ItemPrice item : result) - { - if (count++ > MAX_SEARCH_ITEMS) - { - // Cap search - break; - } - - int itemId = item.getId(); - - ItemDefinition itemComp = itemManager.getItemDefinition(itemId); - if (itemComp == null) - { - continue; - } - - int itemPrice = item.getPrice(); - int itemLimit = itemGELimits.getOrDefault(itemId, 0); - AsyncBufferedImage itemImage = itemManager.getImage(itemId); - - itemsList.add(new GrandExchangeItems(itemImage, item.getName(), itemId, itemPrice, itemManager.getAlchValue(itemId), itemLimit)); - - // If using hotkey to lookup item, stop after finding match. - if (exactMatch && item.getName().equalsIgnoreCase(lookup)) - { - break; - } - } - - SwingUtilities.invokeLater(() -> - { - int index = 0; - for (GrandExchangeItems item : itemsList) - { - - GrandExchangeItemPanel panel = new GrandExchangeItemPanel(item.getIcon(), item.getName(), - item.getItemId(), item.getGePrice(), item.getHaPrice(), item.getGeItemLimit()); - - /* - Add the first item directly, wrap the rest with margin. This margin hack is because - gridbaglayout does not support inter-element margins. - */ - if (index++ > 0) - { - JPanel marginWrapper = new JPanel(new BorderLayout()); - marginWrapper.setBackground(ColorScheme.DARK_GRAY_COLOR); - marginWrapper.setBorder(new EmptyBorder(5, 0, 0, 0)); - marginWrapper.add(panel, BorderLayout.NORTH); - searchItemsPanel.add(marginWrapper, constraints); - } - else - { - searchItemsPanel.add(panel, constraints); - } - - constraints.gridy++; - } - - // if exactMatch was set, then it came from the applet, so don't lose focus - if (!exactMatch) - { - searchItemsPanel.requestFocusInWindow(); - } - searchBar.setEditable(true); - - // Remove searching label after search is complete - if (!itemsList.isEmpty()) - { - searchBar.setIcon(IconTextField.Icon.SEARCH); - } - }); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/SavedOffer.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/SavedOffer.java deleted file mode 100644 index 58a4055fed..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/SavedOffer.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.grandexchange; - -import lombok.Data; -import net.runelite.api.GrandExchangeOfferState; - -@Data -class SavedOffer -{ - private int itemId; - private int quantitySold; - private int totalQuantity; - private int price; - private int spent; - private GrandExchangeOfferState state; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/DuskAttack.java b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/DuskAttack.java deleted file mode 100644 index fa193796f3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/DuskAttack.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.grotesqueguardians; - -import net.runelite.api.Prayer; - -public enum DuskAttack -{ - MELEE(7800, Prayer.PROTECT_FROM_MELEE), - RANGE(7801, Prayer.PROTECT_FROM_MISSILES); - - private final int animation; - private final Prayer prayer; - - DuskAttack(final int animation, final Prayer prayer) - { - this.animation = animation; - this.prayer = prayer; - } - - public int getAnimation() - { - return animation; - } - - public Prayer getPrayer() - { - return prayer; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansOverlay.java deleted file mode 100644 index 0a83e9c904..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansOverlay.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2018, Damen - * 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.grotesqueguardians; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.util.Objects; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.GraphicsObject; -import net.runelite.api.Perspective; -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; -import net.runelite.client.ui.overlay.components.TextComponent; - -@Singleton -class GrotesqueGuardiansOverlay extends Overlay -{ - private static final int GROTESQUE_GUARDIANS_REGION_ID = 6727; - private final Client client; - private final GrotesqueGuardiansPlugin plugin; - private static final int GROTESQUE_GUARDIANS_LIGHTNING_START = 1416; - private static final int GROTESQUE_GUARDIANS_LIGHTNING_END = 1431; - private static final int GROTESQUE_GUARDIANS_FALLING_ROCKS = 1436; - private static final int GROTESQUE_GUARDIANS_STONE_ORB = 160; - - @Inject - private GrotesqueGuardiansOverlay(final Client client, final GrotesqueGuardiansPlugin plugin) - { - this.client = client; - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - setPriority(OverlayPriority.LOW); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!client.isInInstancedRegion() || client.getMapRegions()[0] != GROTESQUE_GUARDIANS_REGION_ID) - { - return null; - } - - // TODO: Awaiting GraphicsObjectDespawn event to be tracked to make this more efficient. - for (GraphicsObject graphicsObject : client.getGraphicsObjects()) - { - Color color; - - if (graphicsObject.getId() >= GROTESQUE_GUARDIANS_LIGHTNING_START && graphicsObject.getId() <= GROTESQUE_GUARDIANS_LIGHTNING_END) - { - color = Color.ORANGE; - } - else if (graphicsObject.getId() == GROTESQUE_GUARDIANS_STONE_ORB) - { - color = Color.GRAY; - } - else if (graphicsObject.getId() == GROTESQUE_GUARDIANS_FALLING_ROCKS) - { - color = Color.YELLOW; - } - else - { - continue; - } - - LocalPoint lp = graphicsObject.getLocation(); - Polygon poly = Perspective.getCanvasTilePoly(client, lp); - - if (poly != null) - { - OverlayUtil.renderPolygon(graphics, poly, color); - } - if (plugin.isInGargs() && plugin.isNeedingToRun() && plugin.getDusk() != null && plugin.getDusk().getLocalLocation() != null) - { - TextComponent textComponent = new TextComponent(); - LocalPoint duskPoint; - - duskPoint = new LocalPoint(plugin.getDusk().getLocalLocation().getX() + 128 * (Objects.requireNonNull(plugin.getDusk().getTransformedDefinition()).getSize() - 1) / 2, plugin.getDusk().getLocalLocation().getY() + 128 * (plugin.getDusk().getTransformedDefinition().getSize() - 1) / 2); - net.runelite.api.Point duskLoc = Perspective.getCanvasTextLocation(client, graphics, duskPoint, "RUN AWAY", 500); - if (duskLoc != null) - { - textComponent.setText("RUN AWAY"); - textComponent.setPosition(new java.awt.Point(duskLoc.getX(), duskLoc.getY())); - textComponent.setColor(Color.red); - textComponent.render(graphics); - } - } - } - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPlugin.java deleted file mode 100644 index 273233eabf..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPlugin.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2018, Damen - * 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.grotesqueguardians; - -import java.util.ArrayList; -import javax.annotation.Nullable; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import static net.runelite.api.NpcID.DUSK_7888; -import net.runelite.api.events.GameTick; -import net.runelite.client.eventbus.Subscribe; -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; - - -@PluginDescriptor( - name = "Grotesque Guardians", - description = "Show various helpful utitiles during the Grotesque Gaurdians (Gargoyles) fight", - tags = {"bosses", "combat", "gargs", "overlay", "grotesque", "pve", "pvm"}, - type = PluginType.PVM, - enabledByDefault = false -) -@Singleton -public class GrotesqueGuardiansPlugin extends Plugin -{ - private static final int GARGOYLES_REGION = 6727; - - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private GrotesqueGuardiansPrayerOverlay prayerOverlay; - - @Nullable - private DuskAttack prayAgainst; - - @Nullable - private NPC dusk; - - private boolean inGargs; - private boolean needingToRun; - - public GrotesqueGuardiansPlugin() - { - inGargs = false; - needingToRun = false; - } - - @Inject - private GrotesqueGuardiansOverlay overlay; - - @Override - protected void startUp() - { - - overlayManager.add(overlay); - overlayManager.add(prayerOverlay); - dusk = null; - prayAgainst = null; - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - overlayManager.remove(prayerOverlay); - dusk = null; - prayAgainst = null; - } - - @Subscribe - private void onGameTick(final GameTick event) - { - final ArrayList regions = new ArrayList<>(); - for (final int intValue : client.getMapRegions()) - { - regions.add(intValue); - } - if (regions.contains(GARGOYLES_REGION)) - { - dusk = null; - inGargs = true; - for (final NPC npc : client.getNpcs()) - { - if (npc.getName() != null && npc.getName().contains("Dusk") && !npc.isDead()) - { - dusk = npc; - } - } - if (inGargs && dusk != null) - { - if (dusk.getId() == DUSK_7888) - { - if (dusk.getAnimation() == DuskAttack.MELEE.getAnimation()) - { - prayAgainst = DuskAttack.MELEE; - } - else if (dusk.getAnimation() == DuskAttack.RANGE.getAnimation()) - { - prayAgainst = DuskAttack.RANGE; - } - } - else - { - prayAgainst = null; - } - needingToRun = dusk.getAnimation() == 7802; - } - } - else - { - inGargs = false; - prayAgainst = null; - dusk = null; - } - } - - @Nullable - DuskAttack getPrayAgainst() - { - return prayAgainst; - } - - @Nullable - NPC getDusk() - { - return dusk; - } - - boolean isInGargs() - { - return inGargs; - } - - boolean isNeedingToRun() - { - return needingToRun; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPrayerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPrayerOverlay.java deleted file mode 100644 index 507553913d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPrayerOverlay.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.grotesqueguardians; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.util.Objects; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.Perspective; -import net.runelite.api.coords.LocalPoint; -import net.runelite.client.game.SpriteManager; -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.ComponentConstants; -import net.runelite.client.ui.overlay.components.ImageComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; - -@Singleton -public class GrotesqueGuardiansPrayerOverlay extends Overlay -{ - private static final Color NOT_ACTIVATED_BACKGROUND_COLOR = new Color(150, 0, 0, 150); - private final Client client; - private final GrotesqueGuardiansPlugin plugin; - private final SpriteManager spriteManager; - private final PanelComponent imagePanelComponent = new PanelComponent(); - - @Inject - private GrotesqueGuardiansPrayerOverlay(final Client client, final GrotesqueGuardiansPlugin plugin, final SpriteManager spriteManager) - { - setLayer(OverlayLayer.ABOVE_SCENE); - setPriority(OverlayPriority.HIGH); - setPosition(OverlayPosition.DYNAMIC); - this.client = client; - this.plugin = plugin; - this.spriteManager = spriteManager; - } - - public Dimension render(Graphics2D graphics) - { - imagePanelComponent.getChildren().clear(); - if ((plugin.isInGargs()) && (plugin.getPrayAgainst() != null) && (plugin.getDusk() != null)) - { - DuskAttack attack = plugin.getPrayAgainst(); - BufferedImage prayerImage; - prayerImage = getPrayerImage(attack); - imagePanelComponent.setBackgroundColor(client - .isPrayerActive(attack.getPrayer()) ? ComponentConstants.STANDARD_BACKGROUND_COLOR : NOT_ACTIVATED_BACKGROUND_COLOR); - - NPC dusk = plugin.getDusk(); - imagePanelComponent.getChildren().add(new ImageComponent(prayerImage)); - - - LocalPoint duskPoint = new LocalPoint(dusk.getLocalLocation().getX() + 128 * (Objects.requireNonNull(dusk.getTransformedDefinition()).getSize() - 1) / 2, dusk.getLocalLocation().getY() + 128 * (dusk.getTransformedDefinition().getSize() - 1) / 2); - net.runelite.api.Point duskLoc = Perspective.getCanvasImageLocation(client, duskPoint, prayerImage, 400); - if (duskLoc != null) - { - imagePanelComponent.setPreferredLocation(new java.awt.Point(duskLoc.getX(), duskLoc.getY())); - } - return imagePanelComponent.render(graphics); - } - return null; - } - - private BufferedImage getPrayerImage(DuskAttack attack) - { - int prayerSpriteID = attack == DuskAttack.MELEE ? 129 : 128; - - return spriteManager.getSprite(prayerSpriteID, 0); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItem.java deleted file mode 100644 index 174e74bedc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItem.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.grounditems; - -import java.time.Instant; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import lombok.Builder; -import lombok.Data; -import lombok.Value; -import net.runelite.api.coords.WorldPoint; - -@Data -@Builder -public class GroundItem -{ - private int id; - private int itemId; - private String name; - private int quantity; - private WorldPoint location; - private int height; - private int haPrice; - private int gePrice; - private int offset; - private boolean tradeable; - private boolean isMine; - private int ticks; - private int durationMillis; - private boolean isAlwaysPrivate; - private boolean isOwnedByPlayer; - private Instant droppedInstant; - - @Nonnull - private LootType lootType; - - @Nullable - private Instant spawnTime; - - int getHaPrice() - { - return haPrice * quantity; - } - - int getGePrice() - { - return gePrice * quantity; - } - - boolean isMine() - { - return lootType != LootType.UNKNOWN; - } - - @Value - static class GroundItemKey - { - private int itemId; - private WorldPoint location; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemInputListener.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemInputListener.java deleted file mode 100644 index 8a53d9c2dc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemInputListener.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.grounditems; - -import java.awt.Point; -import java.awt.event.KeyEvent; -import java.awt.event.MouseEvent; -import java.time.Duration; -import java.time.Instant; -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.swing.SwingUtilities; -import net.runelite.client.input.KeyListener; -import net.runelite.client.input.MouseAdapter; - -@Singleton -class GroundItemInputListener extends MouseAdapter implements KeyListener -{ - private static final int HOTKEY = KeyEvent.VK_ALT; - - private Instant lastPress; - - @Inject - private GroundItemsPlugin plugin; - - @Override - public void keyTyped(KeyEvent e) - { - - } - - @Override - public void keyPressed(KeyEvent e) - { - if (e.getKeyCode() == HOTKEY) - { - if (plugin.isHideAll()) - { - plugin.setHideAll(false); - plugin.setHotKeyPressed(true); - lastPress = null; - } - else if (lastPress != null && !plugin.isHotKeyPressed() && plugin.getDoubleTapDelay() > 0 && Duration.between(lastPress, Instant.now()).compareTo(Duration.ofMillis(plugin.getDoubleTapDelay())) < 0) - { - plugin.setHideAll(true); - lastPress = null; - } - else - { - plugin.setHotKeyPressed(true); - lastPress = Instant.now(); - } - } - } - - @Override - public void keyReleased(KeyEvent e) - { - if (e.getKeyCode() == HOTKEY) - { - plugin.setHotKeyPressed(false); - plugin.setTextBoxBounds(null); - plugin.setHiddenBoxBounds(null); - plugin.setHighlightBoxBounds(null); - } - } - - @Override - public MouseEvent mousePressed(MouseEvent e) - { - final Point mousePos = e.getPoint(); - - if (plugin.isHotKeyPressed()) - { - if (SwingUtilities.isLeftMouseButton(e)) - { - // Process both click boxes for hidden and highlighted items - if (plugin.getHiddenBoxBounds() != null && plugin.getHiddenBoxBounds().getKey().contains(mousePos)) - { - plugin.updateList(plugin.getHiddenBoxBounds().getValue().getName(), true); - e.consume(); - return e; - } - - if (plugin.getHighlightBoxBounds() != null && plugin.getHighlightBoxBounds().getKey().contains(mousePos)) - { - plugin.updateList(plugin.getHighlightBoxBounds().getValue().getName(), false); - e.consume(); - return e; - } - - // There is one name click box for left click and one for right click - if (plugin.getTextBoxBounds() != null && plugin.getTextBoxBounds().getKey().contains(mousePos)) - { - plugin.updateList(plugin.getTextBoxBounds().getValue().getName(), false); - e.consume(); - return e; - } - } - else if (SwingUtilities.isRightMouseButton(e) && plugin.getTextBoxBounds() != null && plugin.getTextBoxBounds().getKey().contains(mousePos)) - { - plugin.updateList(plugin.getTextBoxBounds().getValue().getName(), true); - e.consume(); - return e; - } - } - - return e; - } -} - diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java deleted file mode 100644 index afd1586d15..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java +++ /dev/null @@ -1,705 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * 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.grounditems; - -import java.awt.Color; -import net.runelite.client.config.Alpha; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigTitleSection; -import net.runelite.client.config.Title; -import net.runelite.client.plugins.grounditems.config.ItemHighlightMode; -import net.runelite.client.plugins.grounditems.config.MenuHighlightMode; -import net.runelite.client.plugins.grounditems.config.PriceDisplayMode; -import net.runelite.client.plugins.grounditems.config.TimerDisplayMode; -import net.runelite.client.plugins.grounditems.config.ValueCalculationMode; - -@ConfigGroup("grounditems") -public interface GroundItemsConfig extends Config -{ - @ConfigTitleSection( - keyName = "colorsTitle", - name = "Colors", - description = "", - position = 1 - ) - default Title colorsTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "defaultColor", - name = "Default items", - description = "Configures the color for default, non-highlighted items", - position = 2, - titleSection = "colorsTitle" - ) - @Alpha - default Color defaultColor() - { - return Color.WHITE; - } - - @ConfigItem( - keyName = "highlightedColor", - name = "Highlighted items", - description = "Configures the color for highlighted items", - position = 3, - titleSection = "colorsTitle" - ) - @Alpha - default Color highlightedColor() - { - return Color.decode("#C46AFF"); - } - - @ConfigItem( - keyName = "hiddenColor", - name = "Hidden items", - description = "Configures the color for hidden items in right-click menu and when holding ALT", - position = 4, - titleSection = "colorsTitle" - ) - @Alpha - default Color hiddenColor() - { - return Color.GRAY; - } - - @ConfigTitleSection( - keyName = "highlightedTitle", - name = "Highlighted", - description = "", - position = 5 - ) - default Title highlightedTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "highlightedItems", - name = "Highlighted Items", - description = "Configures specifically highlighted ground items. Format: (item), (item)", - position = 6, - titleSection = "highlightedTitle" - ) - default String getHighlightItems() - { - return ""; - } - - @ConfigItem( - keyName = "highlightedItems", - name = "", - description = "" - ) - void setHighlightedItem(String key); - - @ConfigItem( - keyName = "showHighlightedOnly", - name = "Show Highlighted items only", - description = "Configures whether or not to draw items only on your highlighted list", - position = 7, - titleSection = "highlightedTitle" - ) - default boolean showHighlightedOnly() - { - return false; - } - - @ConfigItem( - keyName = "highlightValueCalculation", - name = "Highlighted Value Calculation", - description = "Configures which coin value is used to determine highlight color", - position = 8, - titleSection = "highlightedTitle" - ) - default ValueCalculationMode valueCalculationMode() - { - return ValueCalculationMode.HIGHEST; - } - - @ConfigItem( - keyName = "highlightOverValue2", - name = "Highlight > Value", - description = "Configures highlighted ground items over either GE or HA value", - position = 9, - titleSection = "highlightedTitle" - ) - default int getHighlightOverValue() - { - return 0; - } - - @ConfigItem( - keyName = "notifyHighlightedDrops", - name = "Notify for Highlighted drops", - description = "Configures whether or not to notify for drops on your highlighted list", - position = 10, - titleSection = "highlightTitle" - ) - default boolean notifyHighlightedDrops() - { - return false; - } - - @ConfigTitleSection( - keyName = "hiddenTitle", - name = "Hidden", - description = "", - position = 11 - ) - default Title hiddenTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "dontHideUntradeables", - name = "Do not hide untradeables", - description = "Configures whether or not untradeable items ignore hiding under settings", - position = 12, - titleSection = "hiddenTitle" - ) - default boolean dontHideUntradeables() - { - return true; - } - - @ConfigItem( - keyName = "hiddenItems", - name = "Hidden Items", - description = "Configures hidden ground items. Format: (item), (item)", - position = 13, - titleSection = "hiddenTitle" - ) - default String getHiddenItems() - { - return "Vial, Ashes, Coins, Bones, Bucket, Jug, Seaweed"; - } - - @ConfigItem( - keyName = "hiddenItems", - name = "", - description = "", - titleSection = "hiddenTitle" - ) - void setHiddenItems(String key); - - @ConfigItem( - keyName = "recolorMenuHiddenItems", - name = "Recolor Menu Hidden Items", - description = "Configures whether or not hidden items in right click menu will be recolored", - position = 14, - titleSection = "hiddenTitle" - ) - default boolean recolorMenuHiddenItems() - { - return false; - } - - @ConfigItem( - keyName = "hideUnderValue", - name = "Hide < Value", - description = "Configures hidden ground items under both GE and HA value", - position = 15, - titleSection = "hiddenTitle" - ) - default int getHideUnderValue() - { - return 0; - } - - @ConfigItem( - keyName = "removeIgnored", - name = "Hide Hidden", - description = "Remove take option for items that are on the hidden items list.", - position = 16, - titleSection = "hiddenTitle" - ) - default boolean removeIgnored() - { - return false; - } - - @ConfigItem( - keyName = "rightClickHidden", - name = "Right click hidden items", - description = "Places hidden items below the 'Walk here' option, making it so that you need to right click to pick them up", - position = 17, - titleSection = "hiddenTitle" - ) - default boolean rightClickHidden() - { - return false; - } - - @ConfigTitleSection( - keyName = "highlightTitle", - name = "Highlight", - description = "", - position = 18 - ) - default Title highlightTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "highlightTiles", - name = "Highlight Tiles", - description = "Configures whether or not to highlight tiles containing ground items", - position = 19, - titleSection = "highlightTitle" - ) - default boolean highlightTiles() - { - return false; - } - - @ConfigItem( - keyName = "itemHighlightMode", - name = "Item Highlight Mode", - description = "Configures how ground items will be highlighted", - position = 20, - titleSection = "highlightTitle" - ) - default ItemHighlightMode itemHighlightMode() - { - return ItemHighlightMode.BOTH; - } - - @ConfigItem( - keyName = "menuHighlightMode", - name = "Menu Highlight Mode", - description = "Configures what to highlight in right-click menu", - position = 21, - titleSection = "highlightTitle" - ) - default MenuHighlightMode menuHighlightMode() - { - return MenuHighlightMode.NAME; - } - - @ConfigTitleSection( - keyName = "lowValueTitle", - name = "Low value", - description = "", - position = 22 - ) - default Title lowValueTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "lowValueColor", - name = "Low value color", - description = "Configures the color for low value items", - position = 23, - titleSection = "lowValueTitle" - ) - @Alpha - default Color lowValueColor() - { - return Color.decode("#66B2FF"); - } - - @ConfigItem( - keyName = "lowValuePrice", - name = "Low value price", - description = "Configures the start price for low value items", - position = 24, - titleSection = "lowValueTitle" - ) - default int lowValuePrice() - { - return 20000; - } - - @ConfigItem( - keyName = "notifyLowValueDrops", - name = "Notify for low value drops", - description = "Configures whether or not to notify for drops of low value", - position = 25, - titleSection = "lowValueTitle" - ) - default boolean notifyLowValueDrops() - { - return false; - } - - @ConfigTitleSection( - keyName = "mediumValueTitle", - name = "Medium value", - description = "", - position = 26 - ) - default Title mediumValueTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "mediumValueColor", - name = "Medium value color", - description = "Configures the color for medium value items", - position = 27, - titleSection = "mediumValueTitle" - ) - @Alpha - default Color mediumValueColor() - { - return Color.decode("#99FF99"); - } - - @ConfigItem( - keyName = "mediumValuePrice", - name = "Medium value price", - description = "Configures the start price for medium value items", - position = 28, - titleSection = "mediumValueTitle" - ) - default int mediumValuePrice() - { - return 100000; - } - - @ConfigItem( - keyName = "notifyMediumValueDrops", - name = "Notify for medium value drops", - description = "Configures whether or not to notify for drops of medium value", - position = 29, - titleSection = "mediumValueTitle" - ) - default boolean notifyMediumValueDrops() - { - return false; - } - - @ConfigTitleSection( - keyName = "highValueTitle", - name = "High value", - description = "", - position = 30 - ) - default Title highValueTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "highValueColor", - name = "High value color", - description = "Configures the color for high value items", - position = 31, - titleSection = "highValueTitle" - ) - @Alpha - default Color highValueColor() - { - return Color.decode("#FF9600"); - } - - @ConfigItem( - keyName = "highValuePrice", - name = "High value price", - description = "Configures the start price for high value items", - position = 32, - titleSection = "highValueTitle" - ) - default int highValuePrice() - { - return 1000000; - } - - @ConfigItem( - keyName = "notifyHighValueDrops", - name = "Notify for high value drops", - description = "Configures whether or not to notify for drops of high value", - position = 33, - titleSection = "highValueTitle" - ) - default boolean notifyHighValueDrops() - { - return false; - } - - @ConfigTitleSection( - keyName = "insaneValueTitle", - name = "Insane value", - description = "", - position = 34 - ) - default Title insaneValueTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "insaneValueColor", - name = "Insane value items color", - description = "Configures the color for insane value items", - position = 35, - titleSection = "insaneValueTitle" - ) - @Alpha - default Color insaneValueColor() - { - return Color.decode("#FF66B2"); - } - - @ConfigItem( - keyName = "insaneValuePrice", - name = "Insane value price", - description = "Configures the start price for insane value items", - position = 36, - titleSection = "insaneValueTitle" - ) - default int insaneValuePrice() - { - return 10000000; - } - - @ConfigItem( - keyName = "notifyInsaneValueDrops", - name = "Notify for insane value drops", - description = "Configures whether or not to notify for drops of insane value", - position = 37, - titleSection = "insaneValueTitle" - ) - default boolean notifyInsaneValueDrops() - { - return false; - } - - @ConfigTitleSection( - keyName = "priceTitle", - name = "Price", - description = "", - position = 38 - ) - default Title priceTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "priceDisplayMode", - name = "Price Display Mode", - description = "Configures what price types are shown alongside of ground item name", - position = 39, - titleSection = "priceTitle" - ) - default PriceDisplayMode priceDisplayMode() - { - return PriceDisplayMode.BOTH; - } - - @ConfigItem( - keyName = "sortByGEPrice", - name = "Sort by GE price", - description = "Sorts ground items by GE price, instead of alch value", - position = 40, - titleSection = "priceTitle" - ) - default boolean sortByGEPrice() - { - return false; - } - - @ConfigTitleSection( - keyName = "miscTitle", - name = "Miscellaneous", - description = "", - position = 41 - ) - default Title miscTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "showMenuItemQuantities", - name = "Show Menu Item Quantities", - description = "Configures whether or not to show the item quantities in the menu", - position = 42, - titleSection = "miscTitle" - ) - default boolean showMenuItemQuantities() - { - return true; - } - - @ConfigItem( - keyName = "collapseEntries", - name = "Collapse ground item menu entries", - description = "Collapses ground item menu entries together and appends count", - position = 43, - titleSection = "miscTitle" - ) - default boolean collapseEntries() - { - return false; - } - - @ConfigItem( - keyName = "onlyShowLoot", - name = "Only show loot", - description = "Only shows drops from NPCs and players", - position = 44, - titleSection = "miscTitle" - ) - default boolean onlyShowLoot() - { - return false; - } - - @ConfigItem( - keyName = "showGroundItemDuration", - name = "Show time remaining", - description = "Turn on a countdown timer to show how long an item will remain on the ground", - position = 45, - titleSection = "miscTitle" - ) - default TimerDisplayMode showGroundItemDuration() - { - return TimerDisplayMode.HOTKEY_PRESSED; - } - - @ConfigItem( - keyName = "doubleTapDelay", - name = "Delay for double-tap ALT to hide", - description = "Decrease this number if you accidentally hide ground items often. (0 = Disabled)", - position = 46, - titleSection = "miscTitle" - ) - default int doubleTapDelay() - { - return 250; - } - - @ConfigItem( - keyName = "toggleOutline", - name = "Text Outline", - description = "Use an outline around text instead of a text shadow", - position = 47, - titleSection = "miscTitle" - ) - default boolean toggleOutline() - { - return false; - } - - @Alpha - @ConfigItem( - keyName = "bordercolor", - name = "Border color", - description = "Change the border color", - position = 48, - titleSection = "miscTitle" - ) - default Color bordercolor() - { - return new Color(0, 0, 0, 150); - } - - @ConfigItem( - keyName = "showTimer", - name = "Show ground item tick countdown timer", - description = "Shows how many ticks left until disappearing.", - position = 49, - titleSection = "miscTitle" - ) - default boolean showTimer() - { - return false; - } - - @ConfigTitleSection( - keyName = "xpTitle", - name = "XP", - description = "Highlights various items that give xp", - position = 50 - ) - default Title xpTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "highlightHerblore", - name = "Highlight Herblore xp", - description = "Highlight Herblore xp related items.", - position = 51, - titleSection = "xpTitle" - ) - default boolean highlightHerblore() - { - return false; - } - - @ConfigItem( - keyName = "herbloreColor", - name = "Herblore Color", - description = "Color of Herblore xp items.", - position = 52, - titleSection = "xpTitle" - ) - @Alpha - default Color herbloreColor() - { - return Color.GREEN.darker(); - } - - @ConfigItem( - keyName = "highlightPrayer", - name = "Highlight Prayer xp", - description = "Highlight Prayer xp related items.", - position = 53, - titleSection = "xpTitle" - ) - default boolean highlightPrayer() - { - return false; - } - - @ConfigItem( - keyName = "prayerColor", - name = "Prayer Color", - description = "Color of Prayer xp items.", - position = 54, - titleSection = "xpTitle" - ) - @Alpha - default Color prayerColor() - { - return Color.YELLOW; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java deleted file mode 100644 index 0d301b5614..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java +++ /dev/null @@ -1,523 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * Copyright (c) 2018, 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.grounditems; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FontMetrics; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.Rectangle; -import java.time.Duration; -import java.time.Instant; -import java.util.AbstractMap.SimpleEntry; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import net.runelite.api.Player; -import net.runelite.api.Point; -import net.runelite.api.Tile; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import static net.runelite.client.plugins.grounditems.config.ItemHighlightMode.MENU; -import net.runelite.client.plugins.grounditems.config.PriceDisplayMode; -import net.runelite.client.plugins.grounditems.config.TimerDisplayMode; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.ui.overlay.components.BackgroundComponent; -import net.runelite.client.ui.overlay.components.ProgressPieComponent; -import net.runelite.client.ui.overlay.components.TextComponent; -import net.runelite.client.util.QuantityFormatter; - -@Singleton -public class GroundItemsOverlay extends Overlay -{ - private static final int MAX_DISTANCE = 2500; - // We must offset the text on the z-axis such that - // it doesn't obscure the ground items below it. - private static final int OFFSET_Z = 20; - // The game won't send anything higher than this value to the plugin - - // so we replace any item quantity higher with "Lots" instead. - private static final int MAX_QUANTITY = 65535; - // The 15 pixel gap between each drawn ground item. - private static final int STRING_GAP = 15; - // Size of the hidden/highlight boxes - private static final int RECTANGLE_SIZE = 8; - - private static final int TIMER_OVERLAY_DIAMETER = 10; - private static final int PUBLIC_ITEM_DURATION_MILLIS = 60000; - private static final float WARNING_THRESHOLD = 0.25f; - private static final Color PUBLIC_TIMER_COLOR = Color.YELLOW; - private static final Color PRIVATE_TIMER_COLOR = Color.GREEN; - private static final Color PUBLIC_WARNING_TIMER_COLOR = Color.RED; - - private final Client client; - private final GroundItemsPlugin plugin; - private final StringBuilder itemStringBuilder = new StringBuilder(); - private final BackgroundComponent backgroundComponent = new BackgroundComponent(); - private final TextComponent textComponent = new TextComponent(); - private final ProgressPieComponent progressPieComponent = new ProgressPieComponent(); - private final Map offsetMap = new HashMap<>(); - - @Inject - private GroundItemsOverlay(final Client client, final GroundItemsPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - final boolean dontShowOverlay = (plugin.getItemHighlightMode() == MENU || plugin.isHideAll()) && !plugin.isHotKeyPressed(); - - if (dontShowOverlay && !plugin.isHighlightTiles()) - { - return null; - } - - final FontMetrics fm = graphics.getFontMetrics(); - final Player player = client.getLocalPlayer(); - - if (player == null || client.getViewportWidget() == null) - { - return null; - } - - offsetMap.clear(); - final LocalPoint localLocation = player.getLocalLocation(); - final Point mousePos = client.getMouseCanvasPosition(); - Collection groundItemList = GroundItemsPlugin.getCollectedGroundItems().values(); - GroundItem topGroundItem = null; - - if (plugin.isHotKeyPressed()) - { - // Make copy of ground items because we are going to modify them here, and the array list supports our - // desired behaviour here - groundItemList = new ArrayList<>(groundItemList); - final java.awt.Point awtMousePos = new java.awt.Point(mousePos.getX(), mousePos.getY()); - GroundItem groundItem = null; - - for (GroundItem item : groundItemList) - { - item.setOffset(offsetMap.compute(item.getLocation(), (k, v) -> v != null ? v + 1 : 0)); - - if (groundItem != null) - { - continue; - } - - if (plugin.getTextBoxBounds() != null - && item.equals(plugin.getTextBoxBounds().getValue()) - && plugin.getTextBoxBounds().getKey().contains(awtMousePos)) - { - groundItem = item; - continue; - } - - if (plugin.getHiddenBoxBounds() != null - && item.equals(plugin.getHiddenBoxBounds().getValue()) - && plugin.getHiddenBoxBounds().getKey().contains(awtMousePos)) - { - groundItem = item; - continue; - } - - if (plugin.getHighlightBoxBounds() != null - && item.equals(plugin.getHighlightBoxBounds().getValue()) - && plugin.getHighlightBoxBounds().getKey().contains(awtMousePos)) - { - groundItem = item; - } - } - - if (groundItem != null) - { - groundItemList.remove(groundItem); - groundItemList.add(groundItem); - topGroundItem = groundItem; - } - } - - plugin.setTextBoxBounds(null); - plugin.setHiddenBoxBounds(null); - plugin.setHighlightBoxBounds(null); - - final boolean onlyShowLoot = plugin.isOnlyShowLoot(); - - List groundItemListAsList = new ArrayList<>(groundItemList); // make a copy so we can non-destructively modify the list - - Comparator compareByHaPrice = Comparator.comparingInt(GroundItem::getHaPrice); - Comparator compareByGePrice = Comparator.comparingInt(GroundItem::getGePrice); - groundItemListAsList.sort(plugin.isSortByGEPrice() ? compareByGePrice : compareByHaPrice); - - for (GroundItem item : groundItemListAsList) - { - final LocalPoint groundPoint = LocalPoint.fromWorld(client, item.getLocation()); - - if (groundPoint == null || localLocation.distanceTo(groundPoint) > MAX_DISTANCE - || (onlyShowLoot && !item.isMine())) - { - continue; - } - - Color highlighted = plugin.getHighlighted(item.getName(), item.getGePrice(), item.getHaPrice()); - - //Process skill items - if (!plugin.hiddenItems.getUnchecked(item.getName())) - { - if (plugin.highlightHerblore) - { - if (GroundItemsPlugin.herbloreItems.contains(item.getId())) - { - highlighted = plugin.getHerbloreColor(); - } - } - if (plugin.highlightPrayer) - { - if (GroundItemsPlugin.prayerItems.contains(item.getId())) - { - highlighted = plugin.getPrayerColor(); - } - } - } - - // Value overrides skill - if (plugin.getHighlighted(item.getName(), item.getGePrice(), item.getHaPrice()) != null) - { - if (plugin.getHighlighted(item.getName(), item.getGePrice(), item.getHaPrice()).getRGB() != highlighted.getRGB()) - { - highlighted = plugin.getHighlighted(item.getName(), item.getGePrice(), item.getHaPrice()); - } - } - - final Color hidden = plugin.getHidden(item.getName(), item.getGePrice(), item.getHaPrice(), item.isTradeable()); - - if (highlighted == null && !plugin.isHotKeyPressed()) - { - // Do not display hidden items - if (hidden != null) - { - continue; - } - - // Do not display non-highlighted items - if (plugin.isShowHighlightedOnly()) - { - continue; - } - } - - final Color color = plugin.getItemColor(highlighted, hidden); - - if (plugin.isHighlightTiles()) - { - final Polygon poly = Perspective.getCanvasTilePoly(client, groundPoint); - - if (poly != null) - { - OverlayUtil.renderPolygon(graphics, poly, color); - } - } - - if (dontShowOverlay) - { - continue; - } - - itemStringBuilder.append(item.getName()); - - if (item.getQuantity() > 1) - { - if (item.getQuantity() >= MAX_QUANTITY) - { - itemStringBuilder.append(" (Lots!)"); - } - else - { - itemStringBuilder.append(" (") - .append(QuantityFormatter.quantityToStackSize(item.getQuantity())) - .append(")"); - } - } - - if (plugin.getPriceDisplayMode() == PriceDisplayMode.BOTH) - { - if (item.getGePrice() > 0) - { - itemStringBuilder.append(" (EX: ") - .append(QuantityFormatter.quantityToStackSize(item.getGePrice())) - .append(" gp)"); - } - - if (item.getHaPrice() > 0) - { - itemStringBuilder.append(" (HA: ") - .append(QuantityFormatter.quantityToStackSize(item.getHaPrice())) - .append(" gp)"); - } - } - else if (plugin.getPriceDisplayMode() != PriceDisplayMode.OFF) - { - final int price = plugin.getPriceDisplayMode() == PriceDisplayMode.GE - ? item.getGePrice() - : item.getHaPrice(); - - if (price > 0) - { - itemStringBuilder - .append(" (") - .append(QuantityFormatter.quantityToStackSize(price)) - .append(" gp)"); - } - } - - if (item.getTicks() > 0 && plugin.isShowTimer()) - { - itemStringBuilder - .append(" - ") - .append(item.getTicks()); - } - - final String itemString = itemStringBuilder.toString(); - itemStringBuilder.setLength(0); - - if (item.getHeight() == -1) - { - final Tile[][][] sceneTiles = client.getScene().getTiles(); - final Tile itemTile = sceneTiles[client.getPlane()][groundPoint.getSceneX()][groundPoint.getSceneY()]; - item.setHeight(itemTile.getItemLayer().getHeight()); - } - - final Point textPoint = Perspective.getCanvasTextLocation(client, - graphics, - groundPoint, - itemString, - item.getHeight() + OFFSET_Z); - - if (textPoint == null) - { - continue; - } - - final int offset = plugin.isHotKeyPressed() - ? item.getOffset() - : offsetMap.compute(item.getLocation(), (k, v) -> v != null ? v + 1 : 0); - - final int textX = textPoint.getX(); - final int textY = textPoint.getY() - (STRING_GAP * offset); - - if (plugin.isHotKeyPressed()) - { - final int stringWidth = fm.stringWidth(itemString); - final int stringHeight = fm.getHeight(); - - // Item bounds - int x = textX - 2; - int y = textY - stringHeight - 2; - int width = stringWidth + 4; - int height = stringHeight + 4; - final Rectangle itemBounds = new Rectangle(x, y, width, height); - - // Hidden box - x += width + 2; - y = textY - (RECTANGLE_SIZE + stringHeight) / 2; - width = height = RECTANGLE_SIZE; - final Rectangle itemHiddenBox = new Rectangle(x, y, width, height); - - // Highlight box - x += width + 2; - final Rectangle itemHighlightBox = new Rectangle(x, y, width, height); - - boolean mouseInBox = itemBounds.contains(mousePos.getX(), mousePos.getY()); - boolean mouseInHiddenBox = itemHiddenBox.contains(mousePos.getX(), mousePos.getY()); - boolean mouseInHighlightBox = itemHighlightBox.contains(mousePos.getX(), mousePos.getY()); - - if (mouseInBox) - { - plugin.setTextBoxBounds(new SimpleEntry<>(itemBounds, item)); - } - else if (mouseInHiddenBox) - { - plugin.setHiddenBoxBounds(new SimpleEntry<>(itemHiddenBox, item)); - - } - else if (mouseInHighlightBox) - { - plugin.setHighlightBoxBounds(new SimpleEntry<>(itemHighlightBox, item)); - } - - boolean topItem = false; - if (topGroundItem != null) - { - topItem = topGroundItem.equals(item); - } - - // Draw background if hovering - if (topItem && (mouseInBox || mouseInHiddenBox || mouseInHighlightBox)) - { - backgroundComponent.setRectangle(itemBounds); - backgroundComponent.render(graphics); - } - - // Draw hidden box - drawRectangle(graphics, itemHiddenBox, topItem && mouseInHiddenBox ? Color.RED : color, hidden != null, true); - - // Draw highlight box - drawRectangle(graphics, itemHighlightBox, topItem && mouseInHighlightBox ? Color.GREEN : color, highlighted != null, false); - } - - if (plugin.getShowGroundItemDuration() == TimerDisplayMode.ALWAYS - || (plugin.getShowGroundItemDuration() == TimerDisplayMode.HOTKEY_PRESSED && plugin.isHotKeyPressed())) - { - drawTimerOverlay(graphics, new java.awt.Point(textX, textY), item); - } - - if (plugin.isToggleOutline()) - { - final Color bordercolor = plugin.getBordercolor(); - graphics.setColor(bordercolor); - graphics.drawString(itemString, textX + 1, textY + 1); - graphics.drawString(itemString, textX - 1, textY - 1); - graphics.drawString(itemString, textX - 1, textY + 1); - graphics.drawString(itemString, textX + 1, textY - 1); - } - - textComponent.setText(itemString); - textComponent.setColor(color); - textComponent.setPosition(new java.awt.Point(textX, textY)); - textComponent.render(graphics); - } - return null; - } - - private void drawRectangle(Graphics2D graphics, Rectangle rect, Color color, boolean inList, boolean hiddenBox) - { - graphics.setColor(Color.BLACK); - graphics.drawRect(rect.x + 1, rect.y + 1, rect.width, rect.height); - - graphics.setColor(color); - graphics.draw(rect); - - if (inList) - { - graphics.fill(rect); - } - - graphics.setColor(Color.WHITE); - // Minus symbol - graphics.drawLine - ( - rect.x + 2, - rect.y + (rect.height / 2), - rect.x + rect.width - 2, - rect.y + (rect.height / 2) - ); - - if (!hiddenBox) - { - // Plus symbol - graphics.drawLine - ( - rect.x + (rect.width / 2), - rect.y + 2, - rect.x + (rect.width / 2), - rect.y + rect.height - 2 - ); - } - - } - - private void drawTimerOverlay(Graphics2D graphics, java.awt.Point location, GroundItem item) - { - progressPieComponent.setDiameter(TIMER_OVERLAY_DIAMETER); - - int x = (int) location.getX() - TIMER_OVERLAY_DIAMETER; - int y = (int) location.getY() - TIMER_OVERLAY_DIAMETER / 2; - - progressPieComponent.setPosition(new Point(x, y)); - - double millisOnGround = Duration.between(item.getDroppedInstant(), Instant.now()).toMillis(); - boolean isPubliclyVisible = !item.isAlwaysPrivate() && millisOnGround > item.getDurationMillis(); - double timeLeftRelative; - Color fillColor; - - if (isPubliclyVisible || !item.isOwnedByPlayer()) - { - if (item.isOwnedByPlayer()) - { - timeLeftRelative = getTimeLeftRelative(millisOnGround - PUBLIC_ITEM_DURATION_MILLIS, PUBLIC_ITEM_DURATION_MILLIS); - - } - else - { - timeLeftRelative = getTimeLeftRelative(millisOnGround, PUBLIC_ITEM_DURATION_MILLIS); - } - - if (timeLeftRelative < WARNING_THRESHOLD) - { - fillColor = PUBLIC_WARNING_TIMER_COLOR; - } - else - { - fillColor = PUBLIC_TIMER_COLOR; - } - } - else - { - timeLeftRelative = getTimeLeftRelative(millisOnGround, item.getDurationMillis()); - fillColor = PRIVATE_TIMER_COLOR; - - } - - // don't draw timer for any permanently spawned items or broken edge cases - if (timeLeftRelative > 1 || timeLeftRelative < 0) - { - return; - } - - progressPieComponent.setFill(fillColor); - progressPieComponent.setBorderColor(fillColor); - progressPieComponent.setProgress(timeLeftRelative); - progressPieComponent.render(graphics); - } - - private double getTimeLeftRelative(double millisOnGround, int duration) - { - return (duration - millisOnGround) / duration; - } -} 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 deleted file mode 100644 index c5a42be4fd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java +++ /dev/null @@ -1,1279 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * Copyright (c) 2018, 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.grounditems; - -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.LoadingCache; -import com.google.common.collect.EvictingQueue; -import com.google.common.collect.ImmutableSet; -import com.google.inject.Provides; -import java.awt.Color; -import java.awt.Rectangle; -import static java.lang.Boolean.TRUE; -import static java.lang.Math.floor; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Queue; -import java.util.Set; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.ItemDefinition; -import net.runelite.api.ItemID; -import static net.runelite.api.ItemID.*; -import net.runelite.api.MenuEntry; -import net.runelite.api.MenuOpcode; -import net.runelite.api.Node; -import net.runelite.api.Player; -import net.runelite.api.Scene; -import net.runelite.api.Tile; -import net.runelite.api.TileItem; -import net.runelite.api.TileItemPile; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.ClientTick; -import net.runelite.api.events.FocusChanged; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.ItemDespawned; -import net.runelite.api.events.ItemQuantityChanged; -import net.runelite.api.events.ItemSpawned; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.util.Text; -import net.runelite.client.Notifier; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.events.NpcLootReceived; -import net.runelite.client.events.PlayerLootReceived; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.ItemStack; -import net.runelite.client.input.KeyManager; -import net.runelite.client.input.MouseManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.grounditems.config.ItemHighlightMode; -import static net.runelite.client.plugins.grounditems.config.ItemHighlightMode.OVERLAY; -import net.runelite.client.plugins.grounditems.config.MenuHighlightMode; -import static net.runelite.client.plugins.grounditems.config.MenuHighlightMode.BOTH; -import static net.runelite.client.plugins.grounditems.config.MenuHighlightMode.NAME; -import static net.runelite.client.plugins.grounditems.config.MenuHighlightMode.OPTION; -import net.runelite.client.plugins.grounditems.config.PriceDisplayMode; -import net.runelite.client.plugins.grounditems.config.TimerDisplayMode; -import net.runelite.client.plugins.grounditems.config.ValueCalculationMode; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.util.ColorUtil; -import net.runelite.client.util.QuantityFormatter; - -@PluginDescriptor( - name = "Ground Items", - description = "Highlight ground items and/or show price information", - tags = {"grand", "exchange", "high", "alchemy", "prices", "highlight", "overlay"}, - type = PluginType.UTILITY -) -@Singleton -public class GroundItemsPlugin extends Plugin -{ - @Getter(AccessLevel.PUBLIC) - public static final Map collectedGroundItems = new LinkedHashMap<>(); - // ItemID for coins - private static final int COINS = ItemID.COINS_995; - // items stay on the ground for 30 mins in an instance - private static final int INSTANCE_DURATION_MILLIS = 45 * 60 * 1000; - private static final int INSTANCE_DURATION_TICKS = (int) floor(30 * 60 / 0.6); - //untradeables stay on the ground for 150 seconds (http://oldschoolrunescape.wikia.com/wiki/Item#Dropping_and_Destroying) - private static final int UNTRADEABLE_DURATION_MILLIS = 150 * 1000; - private static final int UNTRADEABLE_DURATION_TICKS = (int) floor(150 / 0.6); - //items stay on the ground for 1 hour after death - private static final int DEATH_DURATION_MILLIS = 60 * 60 * 1000; - private static final int DEATH_DURATION_TICKS = (int) floor(60 * 60 / 0.6); - private static final int NORMAL_DURATION_MILLIS = 60 * 1000; - private static final int NORMAL_DURATION_TICKS = (int) floor(60 / 0.6); - // Ground item menu options - private static final int FIRST_OPTION = MenuOpcode.GROUND_ITEM_FIRST_OPTION.getId(); - private static final int SECOND_OPTION = MenuOpcode.GROUND_ITEM_SECOND_OPTION.getId(); - private static final int THIRD_OPTION = MenuOpcode.GROUND_ITEM_THIRD_OPTION.getId(); // this is Take - private static final int FOURTH_OPTION = MenuOpcode.GROUND_ITEM_FOURTH_OPTION.getId(); - private static final int FIFTH_OPTION = MenuOpcode.GROUND_ITEM_FIFTH_OPTION.getId(); - private static final int EXAMINE_ITEM = MenuOpcode.EXAMINE_ITEM_GROUND.getId(); - private static final int WALK = MenuOpcode.WALK.getId(); - private static final int CAST_ON_ITEM = MenuOpcode.SPELL_CAST_ON_GROUND_ITEM.getId(); - private static final String TELEGRAB_TEXT = ColorUtil.wrapWithColorTag("Telekinetic Grab", Color.GREEN) + ColorUtil.prependColorTag(" -> ", Color.WHITE); - private final Map priceChecks = new LinkedHashMap<>(); - private final Queue droppedItemQueue = EvictingQueue.create(16); // recently dropped items - boolean highlightHerblore; - boolean highlightPrayer; - LoadingCache hiddenItems; - static final ImmutableSet herbloreItems = ImmutableSet.of - ( - //Grimy Herbs - GRIMY_GUAM_LEAF, - GRIMY_GUAM_LEAF + 1, - GRIMY_MARRENTILL, - GRIMY_MARRENTILL + 1, - GRIMY_TARROMIN, - GRIMY_TARROMIN + 1, - GRIMY_HARRALANDER, - GRIMY_HARRALANDER + 1, - GRIMY_RANARR_WEED, - GRIMY_RANARR_WEED + 1, - GRIMY_TOADFLAX, - GRIMY_TOADFLAX + 1, - GRIMY_IRIT_LEAF, - GRIMY_IRIT_LEAF + 1, - GRIMY_AVANTOE, - GRIMY_AVANTOE + 1, - GRIMY_KWUARM, - GRIMY_KWUARM + 1, - GRIMY_SNAPDRAGON, - GRIMY_SNAPDRAGON + 1, - GRIMY_CADANTINE, - GRIMY_CADANTINE + 1, - GRIMY_LANTADYME, - GRIMY_LANTADYME + 1, - GRIMY_DWARF_WEED, - GRIMY_DWARF_WEED + 1, - GRIMY_TORSTOL, - GRIMY_TORSTOL + 1, - - //Clean Herbs - GUAM_LEAF, - GUAM_LEAF + 1, - MARRENTILL, - MARRENTILL + 1, - TARROMIN, - TARROMIN + 1, - HARRALANDER, - HARRALANDER + 1, - RANARR_WEED, - RANARR_WEED + 1, - TOADFLAX, - TOADFLAX + 1, - IRIT_LEAF, - IRIT_LEAF + 1, - AVANTOE, - AVANTOE + 1, - KWUARM, - KWUARM + 1, - SNAPDRAGON, - SNAPDRAGON + 1, - CADANTINE, - CADANTINE + 1, - LANTADYME, - LANTADYME + 1, - DWARF_WEED, - DWARF_WEED + 1, - TORSTOL, - TORSTOL + 1, - - //Secondary ingredients - EYE_OF_NEWT, - EYE_OF_NEWT + 1, - UNICORN_HORN, - UNICORN_HORN + 1, - UNICORN_HORN_DUST, - UNICORN_HORN_DUST + 1, - LIMPWURT_ROOT, - LIMPWURT_ROOT + 1, - RED_SPIDERS_EGGS, - RED_SPIDERS_EGGS + 1, - CHOCOLATE_BAR, - CHOCOLATE_BAR + 1, - CHOCOLATE_DUST, - CHOCOLATE_DUST + 1, - TOADS_LEGS, - TOADS_LEGS + 1, - GOAT_HORN_DUST, - GOAT_HORN_DUST + 1, - DESERT_GOAT_HORN, - DESERT_GOAT_HORN + 1, - SNAPE_GRASS, - SNAPE_GRASS + 1, - MORT_MYRE_FUNGUS, - MORT_MYRE_FUNGUS + 1, - WHITE_BERRIES, - WHITE_BERRIES + 1, - BLUE_DRAGON_SCALE, - BLUE_DRAGON_SCALE + 1, - DRAGON_SCALE_DUST, - DRAGON_SCALE_DUST + 1, - WINE_OF_ZAMORAK, - WINE_OF_ZAMORAK + 1, - POTATO_CACTUS, - POTATO_CACTUS + 1, - BIRD_NEST, - BIRD_NEST + 1, - BIRD_NEST_5071, - BIRD_NEST_5072, - BIRD_NEST_5073, - BIRD_NEST_5074, - BIRD_NEST_5075, - BIRD_NEST_7413, - BIRD_NEST_13653, - BIRD_NEST_22798, - BIRD_NEST_22800, - LAVA_SCALE, - LAVA_SCALE + 1, - LAVA_SCALE_SHARD, - LAVA_SCALE_SHARD + 1, - TORSTOL, - TORSTOL + 1, - SUPERIOR_DRAGON_BONES, - SUPERIOR_DRAGON_BONES + 1, - CRUSHED_SUPERIOR_DRAGON_BONES, - CRUSHED_SUPERIOR_DRAGON_BONES + 1, - AMYLASE_CRYSTAL, - GARLIC, - GARLIC + 1, - - //Jungle Potion herbs - GRIMY_ARDRIGAL, - GRIMY_ROGUES_PURSE, - GRIMY_SITO_FOIL, - GRIMY_SNAKE_WEED, - GRIMY_VOLENCIA_MOSS, - - //Herb seeds - GUAM_SEED, - MARRENTILL_SEED, - TARROMIN_SEED, - HARRALANDER_SEED, - GOUT_TUBER, - RANARR_SEED, - TOADFLAX_SEED, - IRIT_SEED, - AVANTOE_SEED, - KWUARM_SEED, - SNAPDRAGON_SEED, - CADANTINE_SEED, - LANTADYME_SEED, - DWARF_WEED_SEED, - TORSTOL_SEED, - - //Secondary seeds - LIMPWURT_SEED, - SNAPE_GRASS_SEED, - POTATO_CACTUS_SEED, - JANGERBERRY_SEED, - POISON_IVY_SEED, - BELLADONNA_SEED - ); - static final ImmutableSet prayerItems = ImmutableSet.of - ( - //Bones - BONES, - BONES + 1, - WOLF_BONES, - WOLF_BONES + 1, - BURNT_BONES, - BURNT_BONES + 1, - MONKEY_BONES, - MONKEY_BONES + 1, - BAT_BONES, - BAT_BONES + 1, - BIG_BONES, - BIG_BONES + 1, - JOGRE_BONES, - JOGRE_BONES + 1, - ZOGRE_BONES, - ZOGRE_BONES + 1, - SHAIKAHAN_BONES, - SHAIKAHAN_BONES + 1, - BABYDRAGON_BONES, - BABYDRAGON_BONES + 1, - WYRM_BONES, - WYRM_BONES + 1, - WYVERN_BONES, - WYVERN_BONES + 1, - DRAGON_BONES, - DRAGON_BONES + 1, - DRAKE_BONES, - DRAKE_BONES + 1, - FAYRG_BONES, - FAYRG_BONES + 1, - LAVA_DRAGON_BONES, - LAVA_DRAGON_BONES + 1, - RAURG_BONES, - RAURG_BONES + 1, - HYDRA_BONES, - HYDRA_BONES + 1, - DAGANNOTH_BONES, - DAGANNOTH_BONES + 1, - OURG_BONES, - OURG_BONES + 1, - SUPERIOR_DRAGON_BONES, - SUPERIOR_DRAGON_BONES + 1, - - //Ensouled heads - ENSOULED_ABYSSAL_HEAD_13508, - ENSOULED_ABYSSAL_HEAD_13508 + 1, - ENSOULED_AVIANSIE_HEAD_13505, - ENSOULED_AVIANSIE_HEAD_13505 + 1, - ENSOULED_BEAR_HEAD_13463, - ENSOULED_BEAR_HEAD_13463 + 1, - ENSOULED_BLOODVELD_HEAD_13496, - ENSOULED_BLOODVELD_HEAD_13496 + 1, - ENSOULED_CHAOS_DRUID_HEAD_13472, - ENSOULED_CHAOS_DRUID_HEAD_13472 + 1, - ENSOULED_DAGANNOTH_HEAD_13493, - ENSOULED_DAGANNOTH_HEAD_13493 + 1, - ENSOULED_DEMON_HEAD_13502, - ENSOULED_DEMON_HEAD_13502 + 1, - ENSOULED_DOG_HEAD_13469, - ENSOULED_DOG_HEAD_13469 + 1, - ENSOULED_DRAGON_HEAD_13511, - ENSOULED_DRAGON_HEAD_13511 + 1, - ENSOULED_ELF_HEAD_13481, - ENSOULED_ELF_HEAD_13481 + 1, - ENSOULED_GIANT_HEAD_13475, - ENSOULED_GIANT_HEAD_13475 + 1, - ENSOULED_GOBLIN_HEAD_13448, - ENSOULED_GOBLIN_HEAD_13448 + 1, - ENSOULED_HORROR_HEAD_13487, - ENSOULED_HORROR_HEAD_13487 + 1, - ENSOULED_IMP_HEAD_13454, - ENSOULED_IMP_HEAD_13454 + 1, - ENSOULED_KALPHITE_HEAD_13490, - ENSOULED_KALPHITE_HEAD_13490 + 1, - ENSOULED_MINOTAUR_HEAD_13457, - ENSOULED_MINOTAUR_HEAD_13457 + 1, - ENSOULED_MONKEY_HEAD_13451, - ENSOULED_MONKEY_HEAD_13451 + 1, - ENSOULED_OGRE_HEAD_13478, - ENSOULED_OGRE_HEAD_13478 + 1, - ENSOULED_SCORPION_HEAD_13460, - ENSOULED_SCORPION_HEAD_13460 + 1, - ENSOULED_TROLL_HEAD_13484, - ENSOULED_TROLL_HEAD_13484 + 1, - ENSOULED_TZHAAR_HEAD_13499, - ENSOULED_TZHAAR_HEAD_13499 + 1, - ENSOULED_UNICORN_HEAD_13466, - ENSOULED_UNICORN_HEAD_13466 + 1 - ); - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private Map.Entry textBoxBounds; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private Map.Entry hiddenBoxBounds; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private Map.Entry highlightBoxBounds; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private boolean hotKeyPressed; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private boolean hideAll; - - private List hiddenItemList = new CopyOnWriteArrayList<>(); - private List highlightedItemsList = new CopyOnWriteArrayList<>(); - - @Inject - private GroundItemInputListener inputListener; - - @Inject - private MouseManager mouseManager; - - @Inject - private KeyManager keyManager; - - @Inject - private Client client; - - @Inject - private ItemManager itemManager; - - @Inject - private OverlayManager overlayManager; - - @Inject - private GroundItemsConfig config; - - @Inject - private GroundItemsOverlay overlay; - - @Inject - private Notifier notifier; - - private LoadingCache highlightedItems; - private Color defaultColor; - private Color highlightedColor; - private Color hiddenColor; - private String getHighlightItems; - @Getter(AccessLevel.PACKAGE) - private boolean showHighlightedOnly; - private ValueCalculationMode valueCalculationMode; - private int getHighlightOverValue; - private boolean notifyHighlightedDrops; - private boolean dontHideUntradeables; - private String getHiddenItems; - private boolean recolorMenuHiddenItems; - private int getHideUnderValue; - private boolean removeIgnored; - private boolean rightClickHidden; - @Getter(AccessLevel.PACKAGE) - private boolean highlightTiles; - @Getter(AccessLevel.PACKAGE) - private ItemHighlightMode itemHighlightMode; - private MenuHighlightMode menuHighlightMode; - private Color lowValueColor; - private int lowValuePrice; - private boolean notifyLowValueDrops; - private Color mediumValueColor; - private int mediumValuePrice; - private boolean notifyMediumValueDrops; - private Color highValueColor; - private int highValuePrice; - private boolean notifyHighValueDrops; - private Color insaneValueColor; - private int insaneValuePrice; - private boolean notifyInsaneValueDrops; - @Getter(AccessLevel.PACKAGE) - private PriceDisplayMode priceDisplayMode; - @Getter(AccessLevel.PACKAGE) - private boolean sortByGEPrice; - private boolean showMenuItemQuantities; - private boolean collapseEntries; - @Getter(AccessLevel.PACKAGE) - private boolean onlyShowLoot; - @Getter(AccessLevel.PACKAGE) - private TimerDisplayMode showGroundItemDuration; - @Getter(AccessLevel.PACKAGE) - private int doubleTapDelay; - @Getter(AccessLevel.PACKAGE) - private boolean toggleOutline; - @Getter(AccessLevel.PACKAGE) - private boolean showTimer; - @Getter(AccessLevel.PACKAGE) - private Color bordercolor; - private Color herbloreColor; - private Color prayerColor; - - @Provides - GroundItemsConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(GroundItemsConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - reset(); - mouseManager.registerMouseListener(inputListener); - keyManager.registerKeyListener(inputListener); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - mouseManager.unregisterMouseListener(inputListener); - keyManager.unregisterKeyListener(inputListener); - highlightedItems.invalidateAll(); - highlightedItems = null; - hiddenItems.invalidateAll(); - hiddenItems = null; - hiddenItemList = null; - highlightedItemsList = null; - collectedGroundItems.clear(); - } - - @Subscribe - private void onGameTick(GameTick event) - { - for (GroundItem item : collectedGroundItems.values()) - { - if (item.getTicks() == -1) - { - continue; - } - item.setTicks(item.getTicks() - 1); - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("grounditems")) - { - updateConfig(); - reset(); - } - } - - @Subscribe - private void onGameStateChanged(final GameStateChanged event) - { - if (event.getGameState() == GameState.LOADING) - { - collectedGroundItems.clear(); - } - } - - @Subscribe - private void onItemSpawned(ItemSpawned itemSpawned) - { - TileItem item = itemSpawned.getItem(); - Tile tile = itemSpawned.getTile(); - - GroundItem groundItem = buildGroundItem(tile, item); - - GroundItem.GroundItemKey groundItemKey = new GroundItem.GroundItemKey(item.getId(), tile.getWorldLocation()); - GroundItem existing = collectedGroundItems.putIfAbsent(groundItemKey, groundItem); - if (existing != null) - { - existing.setQuantity(existing.getQuantity() + groundItem.getQuantity()); - // The spawn time remains set at the oldest spawn - } - - boolean shouldNotify = !this.onlyShowLoot && this.highlightedColor.equals(getHighlighted( - groundItem.getName(), - groundItem.getGePrice(), - groundItem.getHaPrice())); - - if (this.notifyHighlightedDrops && shouldNotify) - { - notifyHighlightedItem(groundItem); - } - } - - @Subscribe - private void onItemDespawned(ItemDespawned itemDespawned) - { - TileItem item = itemDespawned.getItem(); - Tile tile = itemDespawned.getTile(); - - GroundItem.GroundItemKey groundItemKey = new GroundItem.GroundItemKey(item.getId(), tile.getWorldLocation()); - GroundItem groundItem = collectedGroundItems.get(groundItemKey); - if (groundItem == null) - { - return; - } - - if (groundItem.getQuantity() <= item.getQuantity()) - { - collectedGroundItems.remove(groundItemKey); - } - else - { - groundItem.setQuantity(groundItem.getQuantity() - item.getQuantity()); - // When picking up an item when multiple stacks appear on the ground, - // it is not known which item is picked up, so we invalidate the spawn - // time - groundItem.setSpawnTime(null); - } - } - - @Subscribe - private void onItemQuantityChanged(ItemQuantityChanged itemQuantityChanged) - { - TileItem item = itemQuantityChanged.getItem(); - Tile tile = itemQuantityChanged.getTile(); - int oldQuantity = itemQuantityChanged.getOldQuantity(); - int newQuantity = itemQuantityChanged.getNewQuantity(); - - int diff = newQuantity - oldQuantity; - GroundItem.GroundItemKey groundItemKey = new GroundItem.GroundItemKey(item.getId(), tile.getWorldLocation()); - GroundItem groundItem = collectedGroundItems.get(groundItemKey); - if (groundItem != null) - { - groundItem.setQuantity(groundItem.getQuantity() + diff); - } - } - - @Subscribe - private void onNpcLootReceived(NpcLootReceived npcLootReceived) - { - npcLootReceived.getItems().forEach(item -> - { - GroundItem.GroundItemKey groundItemKey = new GroundItem.GroundItemKey(item.getId(), npcLootReceived.getNpc().getWorldLocation()); - if (collectedGroundItems.containsKey(groundItemKey)) - { - collectedGroundItems.get(groundItemKey).setOwnedByPlayer(true); - } - } - ); - - Collection items = npcLootReceived.getItems(); - lootReceived(items, LootType.PVM); - lootNotifier(items); - } - - @Subscribe - private void onPlayerLootReceived(PlayerLootReceived playerLootReceived) - { - Collection items = playerLootReceived.getItems(); - lootReceived(items, LootType.PVP); - lootNotifier(items); - } - - private void lootNotifier(Collection items) - { - ItemDefinition composition; - for (ItemStack is : items) - { - composition = itemManager.getItemDefinition(is.getId()); - Color itemColor = getHighlighted(composition.getName(), itemManager.getItemPrice(is.getId()) * is.getQuantity(), itemManager.getAlchValue(is.getId()) * is.getQuantity()); - if (itemColor != null) - { - if (this.notifyHighlightedDrops && itemColor.equals(this.highlightedColor)) - { - sendLootNotification(composition.getName(), "highlighted"); - } - else if (this.notifyLowValueDrops && itemColor.equals(this.lowValueColor)) - { - sendLootNotification(composition.getName(), "low value"); - } - else if (this.notifyMediumValueDrops && itemColor.equals(this.mediumValueColor)) - { - sendLootNotification(composition.getName(), "medium value"); - } - else if (this.notifyHighValueDrops && itemColor.equals(this.highValueColor)) - { - sendLootNotification(composition.getName(), "high value"); - } - else if (this.notifyInsaneValueDrops && itemColor.equals(this.insaneValueColor)) - { - sendLootNotification(composition.getName(), "insane value"); - } - } - } - } - - private void sendLootNotification(String itemName, String message) - { - String notification = "[" + client.getLocalPlayer().getName() + "] " + - "Received a " + message + " item: " + itemName; - notifier.notify(notification); - } - - @Subscribe - private void onClientTick(ClientTick event) - { - final MenuEntry[] menuEntries = client.getMenuEntries(); - final List newEntries = new ArrayList<>(menuEntries.length); - - outer: - for (int i = menuEntries.length - 1; i >= 0; i--) - { - MenuEntry menuEntry = menuEntries[i]; - - if (this.collapseEntries) - { - int menuType = menuEntry.getOpcode(); - if (menuType == FIRST_OPTION || menuType == SECOND_OPTION || menuType == THIRD_OPTION - || menuType == FOURTH_OPTION || menuType == FIFTH_OPTION || menuType == EXAMINE_ITEM) - { - for (MenuEntryWithCount entryWCount : newEntries) - { - if (entryWCount.getEntry().equals(menuEntry)) - { - entryWCount.increment(); - continue outer; - } - } - } - } - - newEntries.add(new MenuEntryWithCount(menuEntry)); - } - - Collections.reverse(newEntries); - - newEntries.sort((a, b) -> - { - final int aMenuType = a.getEntry().getOpcode(); - if (aMenuType == FIRST_OPTION || aMenuType == SECOND_OPTION || aMenuType == THIRD_OPTION - || aMenuType == FOURTH_OPTION || aMenuType == FIFTH_OPTION || aMenuType == EXAMINE_ITEM - || aMenuType == WALK) - { // only check for item related menu types, so we don't sort other stuff - final int bMenuType = b.getEntry().getOpcode(); - if (bMenuType == FIRST_OPTION || bMenuType == SECOND_OPTION || bMenuType == THIRD_OPTION - || bMenuType == FOURTH_OPTION || bMenuType == FIFTH_OPTION || bMenuType == EXAMINE_ITEM - || bMenuType == WALK) - { - final MenuEntry aEntry = a.getEntry(); - final int aId = aEntry.getIdentifier(); - final int aQuantity = getCollapsedItemQuantity(aId, aEntry.getTarget()); - final boolean aHidden = isItemIdHidden(aId, aQuantity); - - final MenuEntry bEntry = b.getEntry(); - final int bId = bEntry.getIdentifier(); - final int bQuantity = getCollapsedItemQuantity(bId, bEntry.getTarget()); - final boolean bHidden = isItemIdHidden(bId, bQuantity); - - // only put items below walk if the config is set for it - if (this.rightClickHidden) - { - if (aHidden && bMenuType == WALK) - { - return -1; - } - if (bHidden && aMenuType == WALK) - { - return 1; - } - } - - // sort hidden items below non-hidden items - if (aHidden && !bHidden && bMenuType != WALK) - { - return -1; - } - if (bHidden && !aHidden && aMenuType != WALK) - { - return 1; - } - - - // RS sorts by alch price by private, so no need to sort if config not set - if (this.sortByGEPrice) - { - return (getGePriceFromItemId(aId) * aQuantity) - (getGePriceFromItemId(bId) * bQuantity); - } - } - } - - return 0; - }); - - client.setMenuEntries(newEntries.stream().map(e -> - { - final MenuEntry entry = e.getEntry(); - - if (this.collapseEntries) - { - final int count = e.getCount(); - if (count > 1) - { - entry.setTarget(entry.getTarget() + " x " + count); - } - } - - return entry; - }).toArray(MenuEntry[]::new)); - } - - private void lootReceived(Collection items, LootType lootType) - { - for (ItemStack itemStack : items) - { - WorldPoint location = WorldPoint.fromLocal(client, itemStack.getLocation()); - GroundItem.GroundItemKey groundItemKey = new GroundItem.GroundItemKey(itemStack.getId(), location); - GroundItem groundItem = collectedGroundItems.get(groundItemKey); - if (groundItem != null) - { - groundItem.setMine(true); - groundItem.setTicks(200); - groundItem.setLootType(lootType); - - boolean shouldNotify = this.onlyShowLoot && this.highlightedColor.equals(getHighlighted( - groundItem.getName(), - groundItem.getGePrice(), - groundItem.getHaPrice())); - - if (this.notifyHighlightedDrops && shouldNotify) - { - notifyHighlightedItem(groundItem); - } - } - } - } - - private GroundItem buildGroundItem(final Tile tile, final TileItem item) - { - // Collect the data for the item - final int itemId = item.getId(); - final ItemDefinition itemComposition = itemManager.getItemDefinition(itemId); - final int realItemId = itemComposition.getNote() != -1 ? itemComposition.getLinkedNoteId() : itemId; - final int alchPrice = itemManager.getAlchValue(realItemId); - int durationMillis; - int durationTicks; - - WorldPoint playerLocation = client.getLocalPlayer().getWorldLocation(); - - if (client.isInInstancedRegion()) - { - durationMillis = INSTANCE_DURATION_MILLIS; - durationTicks = INSTANCE_DURATION_TICKS; - } - else if (!itemComposition.isTradeable() && realItemId != COINS) - { - durationMillis = UNTRADEABLE_DURATION_MILLIS; - durationTicks = UNTRADEABLE_DURATION_TICKS; - } - else - { - durationMillis = NORMAL_DURATION_MILLIS; - durationTicks = tile.getWorldLocation().equals(playerLocation) ? NORMAL_DURATION_TICKS * 2 : NORMAL_DURATION_TICKS; - } - final boolean dropped = tile.getWorldLocation().equals(client.getLocalPlayer().getWorldLocation()) && droppedItemQueue.remove(itemId); - - final GroundItem groundItem = GroundItem.builder() - .id(itemId) - .location(tile.getWorldLocation()) - .itemId(realItemId) - .quantity(item.getQuantity()) - .name(itemComposition.getName()) - .haPrice(alchPrice) - .height(-1) - .tradeable(itemComposition.isTradeable()) - .droppedInstant(Instant.now()) - .durationMillis(durationMillis) - .isAlwaysPrivate(client.isInInstancedRegion() || (!itemComposition.isTradeable() && realItemId != COINS)) - .isOwnedByPlayer(tile.getWorldLocation().equals(playerLocation)) - .ticks(durationTicks) - .lootType(dropped ? LootType.DROPPED : LootType.UNKNOWN) - .spawnTime(Instant.now()) - .build(); - - - // Update item price in case it is coins - if (realItemId == COINS) - { - groundItem.setHaPrice(1); - groundItem.setGePrice(1); - } - else - { - groundItem.setGePrice(itemManager.getItemPrice(realItemId)); - } - - return groundItem; - } - - private void reset() - { - // gets the hidden items from the text box in the config - hiddenItemList = Text.fromCSV(this.getHiddenItems); - - // gets the highlighted items from the text box in the config - highlightedItemsList = Text.fromCSV(this.getHighlightItems); - - highlightedItems = CacheBuilder.newBuilder() - .maximumSize(512L) - .expireAfterAccess(10, TimeUnit.MINUTES) - .build(new WildcardMatchLoader(highlightedItemsList)); - - hiddenItems = CacheBuilder.newBuilder() - .maximumSize(512L) - .expireAfterAccess(10, TimeUnit.MINUTES) - .build(new WildcardMatchLoader(hiddenItemList)); - - // Cache colors - priceChecks.clear(); - - if (this.insaneValuePrice > 0) - { - priceChecks.put(this.insaneValuePrice, this.insaneValueColor); - } - - if (this.highValuePrice > 0) - { - priceChecks.put(this.highValuePrice, this.highValueColor); - } - - if (this.mediumValuePrice > 0) - { - priceChecks.put(this.mediumValuePrice, this.mediumValueColor); - } - - if (this.lowValuePrice > 0) - { - priceChecks.put(this.lowValuePrice, this.lowValueColor); - } - - if (this.getHighlightOverValue > 0) - { - priceChecks.put(this.getHighlightOverValue, this.highlightedColor); - } - } - - @Subscribe - private void onMenuEntryAdded(MenuEntryAdded lastEntry) - { - if (this.itemHighlightMode != OVERLAY) - { - final boolean telegrabEntry = lastEntry.getOption().equals("Cast") && lastEntry.getTarget().startsWith(TELEGRAB_TEXT) && lastEntry.getOpcode() == CAST_ON_ITEM; - if (!(lastEntry.getOption().equals("Take") && lastEntry.getOpcode() == THIRD_OPTION) && !telegrabEntry) - { - return; - } - - int itemId = lastEntry.getIdentifier(); - Scene scene = client.getScene(); - Tile tile = scene.getTiles()[client.getPlane()][lastEntry.getParam0()][lastEntry.getParam1()]; - TileItemPile tileItemPile = tile.getItemLayer(); - - if (tileItemPile == null) - { - return; - } - - int quantity = 1; - Node current = tileItemPile.getBottom(); - - while (current instanceof TileItem) - { - TileItem item = (TileItem) current; - if (item.getId() == itemId) - { - quantity = item.getQuantity(); - } - current = current.getNext(); - } - - - final ItemDefinition itemComposition = itemManager.getItemDefinition(itemId); - 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 = itemManager.getAlchValue(realItemId); - final int gePrice = quantity * price; - final Color hidden = getHidden(itemComposition.getName(), gePrice, haPrice, itemComposition.isTradeable()); - final Color highlighted = getHighlighted(itemComposition.getName(), gePrice, haPrice); - final Color color = getItemColor(highlighted, hidden); - final boolean canBeRecolored = highlighted != null || (hidden != null && this.recolorMenuHiddenItems); - - if (color != null && canBeRecolored && !color.equals(this.defaultColor)) - { - final MenuHighlightMode mode = this.menuHighlightMode; - - if (mode == BOTH || mode == OPTION) - { - final String optionText = telegrabEntry ? "Cast" : "Take"; - lastEntry.setOption(ColorUtil.prependColorTag(optionText, color)); - lastEntry.setModified(); - } - - if (mode == BOTH || mode == NAME) - { - String target = lastEntry.getTarget(); - - if (telegrabEntry) - { - target = target.substring(TELEGRAB_TEXT.length()); - } - - target = ColorUtil.prependColorTag(target.substring(target.indexOf('>') + 1), color); - - if (telegrabEntry) - { - target = TELEGRAB_TEXT + target; - } - - lastEntry.setTarget(target); - lastEntry.setModified(); - } - } - - if (this.showMenuItemQuantities && itemComposition.isStackable() && quantity > 1) - { - lastEntry.setTarget(lastEntry.getTarget() + " (" + quantity + ")"); - lastEntry.setModified(); - } - - if (this.removeIgnored && lastEntry.getOption().equals("Take") && hiddenItemList.contains(Text.removeTags(lastEntry.getTarget()))) - { - client.setMenuOptionCount(client.getMenuOptionCount() - 1); - } - } - } - - void updateList(String item, boolean hiddenList) - { - final Set hiddenItemSet = new HashSet<>(hiddenItemList); - final Set highlightedItemSet = new HashSet<>(highlightedItemsList); - - if (hiddenList) - { - highlightedItemSet.removeIf(item::equalsIgnoreCase); - } - else - { - hiddenItemSet.removeIf(item::equalsIgnoreCase); - } - - final Set items = hiddenList ? hiddenItemSet : highlightedItemSet; - - if (!items.removeIf(item::equalsIgnoreCase)) - { - items.add(item); - } - - config.setHiddenItems(Text.toCSV(hiddenItemSet)); - this.getHiddenItems = Text.toCSV(hiddenItemSet); - config.setHighlightedItem(Text.toCSV(highlightedItemSet)); - this.getHighlightItems = Text.toCSV(highlightedItemSet); - } - - Color getHerbloreColor() - { - return herbloreColor; - } - - Color getPrayerColor() - { - return prayerColor; - } - - Color getDefaultColor() - { - return config.defaultColor(); - } - - Color getHighlighted(String item, int gePrice, int haPrice) - { - if (TRUE.equals(highlightedItems.getUnchecked(item))) - { - return this.highlightedColor; - } - - // Explicit hide takes priority over implicit highlight - if (TRUE.equals(hiddenItems.getUnchecked(item))) - { - return null; - } - - ValueCalculationMode mode = this.valueCalculationMode; - for (Map.Entry entry : priceChecks.entrySet()) - { - switch (mode) - { - case GE: - if (gePrice > entry.getKey()) - { - return entry.getValue(); - } - break; - case HA: - if (haPrice > entry.getKey()) - { - return entry.getValue(); - } - break; - default: // case HIGHEST - if (gePrice > entry.getKey() || haPrice > entry.getKey()) - { - return entry.getValue(); - } - break; - } - } - - return null; - } - - Color getHidden(String item, int gePrice, int haPrice, boolean isTradeable) - { - final boolean isExplicitHidden = TRUE.equals(hiddenItems.getUnchecked(item)); - final boolean isExplicitHighlight = TRUE.equals(highlightedItems.getUnchecked(item)); - final boolean canBeHidden = gePrice > 0 || isTradeable || !this.dontHideUntradeables; - final boolean underGe = gePrice < this.getHideUnderValue; - final boolean underHa = haPrice < this.getHideUnderValue; - - // Explicit highlight takes priority over implicit hide - return isExplicitHidden || (!isExplicitHighlight && canBeHidden && underGe && underHa) - ? this.hiddenColor - : null; - } - - private int getGePriceFromItemId(int itemId) - { - final ItemDefinition itemComposition = itemManager.getItemDefinition(itemId); - final int realItemId = itemComposition.getNote() != -1 ? itemComposition.getLinkedNoteId() : itemId; - - return itemManager.getItemPrice(realItemId); - } - - private boolean isItemIdHidden(int itemId, int quantity) - { - final ItemDefinition itemComposition = itemManager.getItemDefinition(itemId); - final int realItemId = itemComposition.getNote() != -1 ? itemComposition.getLinkedNoteId() : itemId; - final int alchPrice = itemManager.getAlchValue(realItemId) * quantity; - final int gePrice = itemManager.getItemPrice(realItemId) * quantity; - - return getHidden(itemComposition.getName(), gePrice, alchPrice, itemComposition.isTradeable()) != null; - } - - private int getCollapsedItemQuantity(int itemId, String item) - { - final ItemDefinition itemComposition = itemManager.getItemDefinition(itemId); - final boolean itemNameIncludesQuantity = Pattern.compile("\\(\\d+\\)").matcher(itemComposition.getName()).find(); - - Matcher matcher = Pattern.compile("\\((\\d+)\\)").matcher(item); - int matches = 0; - String lastMatch = "1"; - while (matcher.find()) - { - // so that "Prayer Potion (4)" returns 1 instead of 4 and "Coins (25)" returns 25 instead of 1 - if (!itemNameIncludesQuantity || matches >= 1) - { - lastMatch = matcher.group(1); - } - - matches++; - } - - return Integer.parseInt(lastMatch); - } - - Color getItemColor(Color highlighted, Color hidden) - { - if (highlighted != null) - { - return highlighted; - } - - if (hidden != null) - { - return hidden; - } - - return this.defaultColor; - } - - @Subscribe - private void onFocusChanged(FocusChanged focusChanged) - { - if (!focusChanged.isFocused()) - { - setHotKeyPressed(false); - } - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked menuOptionClicked) - { - if (menuOptionClicked.getMenuOpcode() == MenuOpcode.ITEM_DROP) - { - int itemId = menuOptionClicked.getIdentifier(); - // Keep a queue of recently dropped items to better detect - // item spawns that are drops - droppedItemQueue.add(itemId); - } - } - - private void notifyHighlightedItem(GroundItem item) - { - final Player local = client.getLocalPlayer(); - final StringBuilder notificationStringBuilder = new StringBuilder() - .append("[") - .append(local.getName()) - .append("] received a highlighted drop: ") - .append(item.getName()); - - if (item.getQuantity() > 1) - { - notificationStringBuilder.append(" x ").append(item.getQuantity()); - - - if (item.getQuantity() > (int) Character.MAX_VALUE) - { - notificationStringBuilder.append(" (Lots!)"); - } - else - { - notificationStringBuilder.append(" (") - .append(QuantityFormatter.quantityToStackSize(item.getQuantity())) - .append(")"); - } - } - - notificationStringBuilder.append("!"); - notifier.notify(notificationStringBuilder.toString()); - } - - private void updateConfig() - { - this.defaultColor = config.defaultColor(); - this.highlightedColor = config.highlightedColor(); - this.hiddenColor = config.hiddenColor(); - this.getHighlightItems = config.getHighlightItems(); - this.showHighlightedOnly = config.showHighlightedOnly(); - this.valueCalculationMode = config.valueCalculationMode(); - this.getHighlightOverValue = config.getHighlightOverValue(); - this.notifyHighlightedDrops = config.notifyHighlightedDrops(); - this.dontHideUntradeables = config.dontHideUntradeables(); - this.getHiddenItems = config.getHiddenItems(); - this.recolorMenuHiddenItems = config.recolorMenuHiddenItems(); - this.getHideUnderValue = config.getHideUnderValue(); - this.removeIgnored = config.removeIgnored(); - this.rightClickHidden = config.rightClickHidden(); - this.highlightTiles = config.highlightTiles(); - this.itemHighlightMode = config.itemHighlightMode(); - this.menuHighlightMode = config.menuHighlightMode(); - this.lowValueColor = config.lowValueColor(); - this.lowValuePrice = config.lowValuePrice(); - this.notifyLowValueDrops = config.notifyLowValueDrops(); - this.mediumValueColor = config.mediumValueColor(); - this.mediumValuePrice = config.mediumValuePrice(); - this.notifyMediumValueDrops = config.notifyMediumValueDrops(); - this.highValueColor = config.highValueColor(); - this.highValuePrice = config.highValuePrice(); - this.notifyHighValueDrops = config.notifyHighValueDrops(); - this.insaneValueColor = config.insaneValueColor(); - this.insaneValuePrice = config.insaneValuePrice(); - this.notifyInsaneValueDrops = config.notifyInsaneValueDrops(); - this.priceDisplayMode = config.priceDisplayMode(); - this.sortByGEPrice = config.sortByGEPrice(); - this.showMenuItemQuantities = config.showMenuItemQuantities(); - this.collapseEntries = config.collapseEntries(); - this.onlyShowLoot = config.onlyShowLoot(); - this.showGroundItemDuration = config.showGroundItemDuration(); - this.doubleTapDelay = config.doubleTapDelay(); - this.toggleOutline = config.toggleOutline(); - this.showTimer = config.showTimer(); - this.bordercolor = config.bordercolor(); - this.herbloreColor = config.herbloreColor(); - this.prayerColor = config.prayerColor(); - this.highlightHerblore = config.highlightHerblore(); - this.highlightPrayer = config.highlightPrayer(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/LootType.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/LootType.java deleted file mode 100644 index aa2d5a3f3f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/LootType.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.grounditems; - -enum LootType -{ - UNKNOWN, - DROPPED, - PVP, - PVM -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/MenuEntryWithCount.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/MenuEntryWithCount.java deleted file mode 100644 index 172bbc94ee..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/MenuEntryWithCount.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.grounditems; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.api.MenuEntry; - -@RequiredArgsConstructor -class MenuEntryWithCount -{ - @Getter(AccessLevel.PACKAGE) - private final MenuEntry entry; - - @Getter(AccessLevel.PACKAGE) - private int count = 1; - - void increment() - { - count++; - } -} - diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/WildcardMatchLoader.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/WildcardMatchLoader.java deleted file mode 100644 index 0aeea2e1dd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/WildcardMatchLoader.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.grounditems; - -import com.google.common.base.Strings; -import com.google.common.cache.CacheLoader; -import java.util.List; -import javax.annotation.Nonnull; -import net.runelite.client.util.WildcardMatcher; - -class WildcardMatchLoader extends CacheLoader -{ - private final List nameFilters; - - WildcardMatchLoader(final List nameFilters) - { - this.nameFilters = nameFilters; - } - - @Override - public Boolean load(@Nonnull final String key) - { - if (Strings.isNullOrEmpty(key)) - { - return false; - } - - final String filteredName = key.trim(); - - for (final String filter : nameFilters) - { - if (WildcardMatcher.matches(filter, filteredName)) - { - return true; - } - } - - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/config/ItemHighlightMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/config/ItemHighlightMode.java deleted file mode 100644 index 3cccecd936..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/config/ItemHighlightMode.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.grounditems.config; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter(AccessLevel.PUBLIC) -@RequiredArgsConstructor -public enum ItemHighlightMode -{ - OVERLAY("Overlay"), - MENU("Right-click"), - BOTH("Both"); - - private final String name; - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/config/MenuHighlightMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/config/MenuHighlightMode.java deleted file mode 100644 index 8d62f86c8e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/config/MenuHighlightMode.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.grounditems.config; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter(AccessLevel.PUBLIC) -@RequiredArgsConstructor -public enum MenuHighlightMode -{ - OPTION("Menu option"), - NAME("Menu item"), - BOTH("Both"); - - private final String name; - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/config/PriceDisplayMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/config/PriceDisplayMode.java deleted file mode 100644 index b93c556b8c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/config/PriceDisplayMode.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.grounditems.config; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter(AccessLevel.PUBLIC) -@RequiredArgsConstructor -public enum PriceDisplayMode -{ - HA, - GE, - BOTH, - OFF -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/config/TimerDisplayMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/config/TimerDisplayMode.java deleted file mode 100644 index 33b8fa0afe..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/config/TimerDisplayMode.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2018 Matthew Smith - * 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.grounditems.config; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter(AccessLevel.PUBLIC) -@RequiredArgsConstructor -public enum TimerDisplayMode -{ - ALWAYS("Always"), - HOTKEY_PRESSED("Hotkey"), - NEVER("Never"); - - private final String name; - - @Override - public String toString() - { - return name; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/config/ValueCalculationMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/config/ValueCalculationMode.java deleted file mode 100644 index 948f0b73d6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/config/ValueCalculationMode.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2019, Abel Briggs - * 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.grounditems.config; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter(AccessLevel.PUBLIC) -@RequiredArgsConstructor -public enum ValueCalculationMode -{ - HA, // calc highlight by HA value - GE, // calc by GE - HIGHEST -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java deleted file mode 100644 index 99867b2e77..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright (c) 2018, TheLonelyDev - * Copyright (c) 2018, 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.groundmarkers; - -import java.awt.Color; -import lombok.RequiredArgsConstructor; -import net.runelite.client.config.Alpha; -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("groundMarker") -public interface GroundMarkerConfig extends Config -{ - @RequiredArgsConstructor - enum amount - { - ONE("1"), - TWO("2"), - THREE("3"), - FOUR("4"), - FIVE("5"), - SIX("6"), - SEVEN("7"), - EIGHT("8"), - NINE("9"), - TEN("10"), - ELEVEN("11"), - TWELVE("12"); - - private final String name; - - @Override - public String toString() - { - return name; - } - - public int toInt() - { - return Integer.parseInt(name); - } - } - - @ConfigItem( - position = 0, - keyName = "amount", - name = "Amount of groups", - description = "The amount of inventory groups" - ) - default amount getAmount() - { - return amount.FOUR; - } - - @Alpha - @ConfigItem( - position = 1, - keyName = "markerColor", - name = "Default tile Color", - description = "Configures the default color of marked tiles", - hidden = true, - unhide = "amount", - unhideValue = "1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12" - ) - default Color markerColor() - { - return Color.YELLOW; - } - - @Alpha - @ConfigItem( - position = 3, - keyName = "markerColor2", - name = "Group 2 tile color", - description = "Configures the color of the 2nd group of marked tiles", - hidden = true, - unhide = "amount", - unhideValue = "2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12" - ) - default Color markerColor2() - { - return Color.RED; - } - - @Alpha - @ConfigItem( - position = 4, - keyName = "markerColor3", - name = "Group 3 tile color", - description = "Configures the color of the 3rd group of marked tiles", - hidden = true, - unhide = "amount", - unhideValue = "3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12" - ) - default Color markerColor3() - { - return Color.BLUE; - } - - @Alpha - @ConfigItem( - position = 5, - keyName = "markerColor4", - name = "Group 4 tile color", - description = "Configures the color of the 4th group of marked tiles", - hidden = true, - unhide = "amount", - unhideValue = "4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12" - ) - default Color markerColor4() - { - return Color.GREEN; - } - - @Alpha - @ConfigItem( - position = 6, - keyName = "markerColor5", - name = "Group 5 tile color", - description = "Configures the color of the 5th group of marked tiles", - hidden = true, - unhide = "amount", - unhideValue = "5 || 6 || 7 || 8 || 9 || 10 || 11 || 12" - ) - default Color markerColor5() - { - return Color.BLACK; - } - - @Alpha - @ConfigItem( - position = 7, - keyName = "markerColor6", - name = "Group 6 tile color", - description = "Configures the color of the 6th group of marked tiles", - hidden = true, - unhide = "amount", - unhideValue = "6 || 7 || 8 || 9 || 10 || 11 || 12" - ) - default Color markerColor6() - { - return Color.GRAY; - } - - @Alpha - @ConfigItem( - position = 8, - keyName = "markerColor7", - name = "Group 7 tile color", - description = "Configures the color of the 7th group of marked tiles", - hidden = true, - unhide = "amount", - unhideValue = "7 || 8 || 9 || 10 || 11 || 12" - ) - default Color markerColor7() - { - return Color.WHITE; - } - - @Alpha - @ConfigItem( - position = 9, - keyName = "markerColor8", - name = "Group 8 tile color", - description = "Configures the color of the 8th group of marked tiles", - hidden = true, - unhide = "amount", - unhideValue = "8 || 9 || 10 || 11 || 12" - ) - default Color markerColor8() - { - return Color.MAGENTA; - } - - @Alpha - @ConfigItem( - position = 10, - keyName = "markerColor9", - name = "Group 9 tile color", - description = "Configures the color of the 9th group of marked tiles", - hidden = true, - unhide = "amount", - unhideValue = "9 || 10 || 11 || 12" - ) - default Color markerColor9() - { - return Color.CYAN; - } - - @Alpha - @ConfigItem( - position = 11, - keyName = "markerColor10", - name = "Group 10 tile color", - description = "Configures the color of the 10th group of marked tiles", - hidden = true, - unhide = "amount", - unhideValue = "10 || 11 || 12" - ) - default Color markerColor10() - { - return Color.ORANGE; - } - - @Alpha - @ConfigItem( - position = 12, - keyName = "markerColor11", - name = "Group 11 tile color", - description = "Configures the color of the 11th group of marked tiles", - hidden = true, - unhide = "amount", - unhideValue = "11 || 12" - ) - default Color markerColor11() - { - return Color.PINK; - } - - @Alpha - @ConfigItem( - position = 13, - keyName = "markerColor12", - name = "Group 12 tile color", - description = "Configures the color of the 12th group of marked tiles", - hidden = true, - unhide = "amount", - unhideValue = "12" - ) - default Color markerColor12() - { - return Color.LIGHT_GRAY; - } - - @ConfigItem( - position = 14, - keyName = "showMinimap", - name = "Show on minimap", - description = "Shows marked tiles on the minimap" - ) - default boolean showMinimap() - { - return false; - } - - @Range( - min = 1, - max = 100 - ) - @ConfigItem( - position = 15, - keyName = "minimapOpacity", - name = "Minimap opacity", - description = "The opacity of the minimap markers" - ) - default int minimapOverlayOpacity() - { - return 100; - } - - @ConfigItem( - position = 16, - keyName = "thinMarkers", - name = "Thin markers", - description = "Render marked tile borders as 1 pixel wide instead of 2" - ) - default boolean thinMarkers() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerInputListener.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerInputListener.java deleted file mode 100644 index 6a92bb0e99..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerInputListener.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, TheLonelyDev - * Copyright (c) 2018, 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.groundmarkers; - -import java.awt.event.KeyEvent; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.client.input.KeyListener; - -@Singleton -public class GroundMarkerInputListener implements KeyListener -{ - private static final int HOTKEY = KeyEvent.VK_SHIFT; - - private final GroundMarkerPlugin plugin; - - @Inject - private GroundMarkerInputListener(final GroundMarkerPlugin plugin) - { - this.plugin = plugin; - } - - @Override - public void keyTyped(KeyEvent e) - { - - } - - @Override - public void keyPressed(KeyEvent e) - { - if (e.getKeyCode() == HOTKEY) - { - plugin.setHotKeyPressed(true); - } - } - - @Override - public void keyReleased(KeyEvent e) - { - if (e.getKeyCode() == HOTKEY) - { - plugin.setHotKeyPressed(false); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerMinimapOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerMinimapOverlay.java deleted file mode 100644 index 794bed0859..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerMinimapOverlay.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2019, Benjamin - * 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.groundmarkers; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import static java.lang.Math.floor; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -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.OverlayPriority; -import net.runelite.client.ui.overlay.OverlayUtil; - -@Singleton -class GroundMarkerMinimapOverlay extends Overlay -{ - private static final int TILE_WIDTH = 4; - private static final int TILE_HEIGHT = 4; - - private final Client client; - private final GroundMarkerPlugin plugin; - - @Inject - private GroundMarkerMinimapOverlay(final Client client, final GroundMarkerPlugin plugin) - { - this.client = client; - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.LOW); - setLayer(OverlayLayer.ABOVE_WIDGETS); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isShowMinimap()) - { - return null; - } - - final List points = plugin.getPoints(); - for (final GroundMarkerWorldPoint point : points) - { - WorldPoint worldPoint = point.getWorldPoint(); - if (worldPoint.getPlane() != client.getPlane()) - { - continue; - } - - Color color = plugin.getMarkerColor(); - switch (point.getGroundMarkerPoint().getGroup()) - { - case 2: - color = plugin.getMarkerColor2(); - break; - case 3: - color = plugin.getMarkerColor3(); - break; - case 4: - color = plugin.getMarkerColor4(); - break; - case 5: - color = plugin.getMarkerColor5(); - break; - case 6: - color = plugin.getMarkerColor6(); - break; - case 7: - color = plugin.getMarkerColor7(); - break; - case 8: - color = plugin.getMarkerColor8(); - break; - case 9: - color = plugin.getMarkerColor9(); - break; - case 10: - color = plugin.getMarkerColor10(); - break; - case 11: - color = plugin.getMarkerColor11(); - break; - case 12: - color = plugin.getMarkerColor12(); - } - - int opacity = (int) floor(plugin.getMinimapOverlayOpacity() * 2.55); - Color tileColor = new Color(color.getRed(), color.getGreen(), color.getBlue(), opacity); - - drawOnMinimap(graphics, worldPoint, tileColor); - } - - return null; - } - - private void drawOnMinimap(Graphics2D graphics, WorldPoint point, Color color) - { - - LocalPoint lp = LocalPoint.fromWorld(client, point); - if (lp == null) - { - return; - } - - Point posOnMinimap = Perspective.localToMinimap(client, lp); - if (posOnMinimap == null) - { - return; - } - - OverlayUtil.renderMinimapRect(client, graphics, posOnMinimap, TILE_WIDTH, TILE_HEIGHT, color); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java deleted file mode 100644 index 4af11b450c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2018, TheLonelyDev - * Copyright (c) 2018, 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.groundmarkers; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -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.OverlayPriority; -import net.runelite.client.ui.overlay.OverlayUtil; - -@Singleton -public class GroundMarkerOverlay extends Overlay -{ - private final Client client; - private final GroundMarkerPlugin plugin; - - @Inject - private GroundMarkerOverlay(final Client client, final GroundMarkerPlugin plugin) - { - this.client = client; - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.LOW); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D graphics) - { - List points = plugin.getPoints(); - for (GroundMarkerWorldPoint groundMarkerWorldPoint : points) - { - drawTile(graphics, groundMarkerWorldPoint); - } - - return null; - } - - private void drawTile(Graphics2D graphics, GroundMarkerWorldPoint groundMarkerWorldPoint) - { - WorldPoint point = groundMarkerWorldPoint.getWorldPoint(); - if (point.getPlane() != client.getPlane()) - { - return; - } - - LocalPoint lp = LocalPoint.fromWorld(client, point); - if (lp == null) - { - return; - } - - Polygon poly = Perspective.getCanvasTilePoly(client, lp); - if (poly == null) - { - return; - } - - Color color = plugin.getMarkerColor(); - switch (groundMarkerWorldPoint.getGroundMarkerPoint().getGroup()) - { - case 2: - color = plugin.getMarkerColor2(); - break; - case 3: - color = plugin.getMarkerColor3(); - break; - case 4: - color = plugin.getMarkerColor4(); - break; - case 5: - color = plugin.getMarkerColor5(); - break; - case 6: - color = plugin.getMarkerColor6(); - break; - case 7: - color = plugin.getMarkerColor7(); - break; - case 8: - color = plugin.getMarkerColor8(); - break; - case 9: - color = plugin.getMarkerColor9(); - break; - case 10: - color = plugin.getMarkerColor10(); - break; - case 11: - color = plugin.getMarkerColor11(); - break; - case 12: - color = plugin.getMarkerColor12(); - } - if (plugin.isThinMarkers()) - { - OverlayUtil.renderPolygonThin(graphics, poly, color); - } - else - { - OverlayUtil.renderPolygon(graphics, poly, color); - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java deleted file mode 100644 index d249d0090f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java +++ /dev/null @@ -1,518 +0,0 @@ -/* - * Copyright (c) 2018, TheLonelyDev - * Copyright (c) 2018, 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.groundmarkers; - -import com.google.common.base.Strings; -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; -import com.google.inject.Provides; -import java.awt.Color; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Optional; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import static net.runelite.api.Constants.CHUNK_SIZE; -import net.runelite.api.GameState; -import net.runelite.api.MenuEntry; -import net.runelite.api.MenuOpcode; -import net.runelite.api.Tile; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.FocusChanged; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.util.Text; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.input.KeyManager; -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.ColorUtil; - -@Slf4j -@PluginDescriptor( - name = "Ground Markers", - description = "Enable marking of tiles using the Shift key", - tags = {"overlay", "tiles"}, - type = PluginType.UTILITY -) -@Singleton -public class GroundMarkerPlugin extends Plugin -{ - private static final String CONFIG_GROUP = "groundMarker"; - private static final String MARK = "Mark tile"; - private static final Pattern GROUP_MATCHER = Pattern.compile(".*ark tile \\(Group (\\d{1,2})\\)"); - private static final String UNMARK = "Unmark tile"; - private static final String WALK_HERE = "Walk here"; - private static final String REGION_PREFIX = "region_"; - - private static final Gson GSON = new Gson(); - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private boolean hotKeyPressed; - - @Getter(AccessLevel.PACKAGE) - private final List points = new ArrayList<>(); - - @Inject - private Client client; - - @Inject - private GroundMarkerInputListener inputListener; - - @Inject - private ConfigManager configManager; - - @Inject - private GroundMarkerConfig config; - - @Inject - private OverlayManager overlayManager; - - @Inject - private GroundMarkerOverlay overlay; - - @Inject - private GroundMarkerMinimapOverlay minimapOverlay; - - @Inject - private KeyManager keyManager; - - private void savePoints(int regionId, Collection points) - { - if (points == null || points.isEmpty()) - { - configManager.unsetConfiguration(CONFIG_GROUP, REGION_PREFIX + regionId); - return; - } - - String json = GSON.toJson(points); - configManager.setConfiguration(CONFIG_GROUP, REGION_PREFIX + regionId, json); - } - - private Collection getPoints(int regionId) - { - String json = configManager.getConfiguration(CONFIG_GROUP, REGION_PREFIX + regionId); - if (Strings.isNullOrEmpty(json)) - { - return Collections.emptyList(); - } - return GSON.fromJson(json, new GroundMarkerListTypeToken().getType()); - } - - private static class GroundMarkerListTypeToken extends TypeToken> - { - } - - private GroundMarkerConfig.amount amount; - @Getter(AccessLevel.PACKAGE) - private Color markerColor; - @Getter(AccessLevel.PACKAGE) - private Color markerColor2; - @Getter(AccessLevel.PACKAGE) - private Color markerColor3; - @Getter(AccessLevel.PACKAGE) - private Color markerColor4; - @Getter(AccessLevel.PACKAGE) - private Color markerColor5; - @Getter(AccessLevel.PACKAGE) - private Color markerColor6; - @Getter(AccessLevel.PACKAGE) - private Color markerColor7; - @Getter(AccessLevel.PACKAGE) - private Color markerColor8; - @Getter(AccessLevel.PACKAGE) - private Color markerColor9; - @Getter(AccessLevel.PACKAGE) - private Color markerColor10; - @Getter(AccessLevel.PACKAGE) - private Color markerColor11; - @Getter(AccessLevel.PACKAGE) - private Color markerColor12; - @Getter(AccessLevel.PACKAGE) - private boolean showMinimap; - @Getter(AccessLevel.PACKAGE) - private int minimapOverlayOpacity; - @Getter(AccessLevel.PACKAGE) - private boolean thinMarkers; - - @Provides - GroundMarkerConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(GroundMarkerConfig.class); - } - - private void loadPoints() - { - points.clear(); - - int[] regions = client.getMapRegions(); - - if (regions == null) - { - return; - } - - for (int regionId : regions) - { - // load points for region - log.debug("Loading points for region {}", regionId); - Collection regionPoints = getPoints(regionId); - Collection worldPoints = translateToWorld(regionPoints); - points.addAll(worldPoints); - } - } - - /** - * Translate a collection of ground marker points to world points, accounting for instances - * - * @param points - * @return - */ - @SuppressWarnings("unchecked") - private Collection translateToWorld(Collection points) - { - if (points.isEmpty()) - { - return Collections.EMPTY_LIST; - } - - List worldPoints = new ArrayList<>(); - for (GroundMarkerPoint point : points) - { - int regionId = point.getRegionId(); - int regionX = point.getRegionX(); - int regionY = point.getRegionY(); - int z = point.getZ(); - - WorldPoint worldPoint = WorldPoint.fromRegion(regionId, regionX, regionY, z); - - if (!client.isInInstancedRegion()) - { - worldPoints.add(new GroundMarkerWorldPoint(point, worldPoint)); - continue; - } - - // find instance chunks using the template point. there might be more than one. - int[][][] instanceTemplateChunks = client.getInstanceTemplateChunks(); - for (int x = 0; x < instanceTemplateChunks[z].length; ++x) - { - for (int y = 0; y < instanceTemplateChunks[z][x].length; ++y) - { - int chunkData = instanceTemplateChunks[z][x][y]; - int rotation = chunkData >> 1 & 0x3; - int templateChunkY = (chunkData >> 3 & 0x7FF) * CHUNK_SIZE; - int templateChunkX = (chunkData >> 14 & 0x3FF) * CHUNK_SIZE; - if (worldPoint.getX() >= templateChunkX && worldPoint.getX() < templateChunkX + CHUNK_SIZE - && worldPoint.getY() >= templateChunkY && worldPoint.getY() < templateChunkY + CHUNK_SIZE) - { - WorldPoint p = new WorldPoint(client.getBaseX() + x * CHUNK_SIZE + (worldPoint.getX() & (CHUNK_SIZE - 1)), - client.getBaseY() + y * CHUNK_SIZE + (worldPoint.getY() & (CHUNK_SIZE - 1)), - worldPoint.getPlane()); - p = rotate(p, rotation); - worldPoints.add(new GroundMarkerWorldPoint(point, p)); - } - } - } - } - return worldPoints; - } - - /** - * Rotate the chunk containing the given point to rotation 0 - * - * @param point point - * @param rotation rotation - * @return world point - */ - private static WorldPoint rotateInverse(WorldPoint point, int rotation) - { - return rotate(point, 4 - rotation); - } - - /** - * Rotate the coordinates in the chunk according to chunk rotation - * - * @param point point - * @param rotation rotation - * @return world point - */ - private static WorldPoint rotate(WorldPoint point, int rotation) - { - int chunkX = point.getX() & -CHUNK_SIZE; - int chunkY = point.getY() & -CHUNK_SIZE; - int x = point.getX() & (CHUNK_SIZE - 1); - int y = point.getY() & (CHUNK_SIZE - 1); - switch (rotation) - { - case 1: - return new WorldPoint(chunkX + y, chunkY + (CHUNK_SIZE - 1 - x), point.getPlane()); - case 2: - return new WorldPoint(chunkX + (CHUNK_SIZE - 1 - x), chunkY + (CHUNK_SIZE - 1 - y), point.getPlane()); - case 3: - return new WorldPoint(chunkX + (CHUNK_SIZE - 1 - y), chunkY + x, point.getPlane()); - } - return point; - } - - @Subscribe - private void onGameStateChanged(GameStateChanged gameStateChanged) - { - if (gameStateChanged.getGameState() != GameState.LOGGED_IN) - { - return; - } - - // map region has just been updated - loadPoints(); - } - - @Subscribe - private void onFocusChanged(FocusChanged focusChanged) - { - if (!focusChanged.isFocused()) - { - hotKeyPressed = false; - } - } - - @Subscribe - private void onMenuEntryAdded(MenuEntryAdded event) - { - if (hotKeyPressed && event.getOption().equals(WALK_HERE)) - { - final Tile selectedSceneTile = client.getSelectedSceneTile(); - - if (selectedSceneTile == null) - { - return; - } - - MenuEntry[] menuEntries = client.getMenuEntries(); - - int lastIndex = menuEntries.length; - menuEntries = Arrays.copyOf(menuEntries, lastIndex + this.amount.toInt()); - - final Tile tile = client.getSelectedSceneTile(); - if (tile == null) - { - return; - } - final WorldPoint loc = WorldPoint.fromLocalInstance(client, tile.getLocalLocation()); - if (loc == null) - { - return; - } - final int regionId = loc.getRegionID(); - - for (int i = this.amount.toInt(); i > 0; i--) - { - MenuEntry menuEntry = menuEntries[lastIndex] = new MenuEntry(); - - final GroundMarkerPoint point = new GroundMarkerPoint(regionId, loc.getRegionX(), loc.getRegionY(), client.getPlane(), i); - final Optional stream = getPoints(regionId).stream().filter(x -> x.equals(point)).findAny(); - final String option = (stream.isPresent() && stream.get().getGroup() == i) ? UNMARK : MARK; - menuEntry.setOption(ColorUtil.prependColorTag(Text.removeTags(option + (i == 1 ? "" : " (Group " + i + ")")), getColor(i))); - menuEntry.setTarget(event.getTarget()); - menuEntry.setOpcode(MenuOpcode.RUNELITE.getId()); - - lastIndex++; - } - - client.setMenuEntries(menuEntries); - } - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked event) - { - if (!event.getOption().contains(MARK) && !event.getOption().contains(UNMARK)) - { - return; - } - - int group = 1; - Matcher m = GROUP_MATCHER.matcher(event.getOption()); - if (m.matches()) - { - group = Integer.parseInt(m.group(1)); - } - - Tile target = client.getSelectedSceneTile(); - - if (target == null) - { - return; - } - markTile(target.getLocalLocation(), group); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - overlayManager.add(minimapOverlay); - keyManager.registerKeyListener(inputListener); - loadPoints(); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - overlayManager.remove(minimapOverlay); - keyManager.unregisterKeyListener(inputListener); - points.clear(); - } - - private void markTile(LocalPoint localPoint, int group) - { - if (localPoint == null) - { - return; - } - - WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, localPoint); - - if (worldPoint == null) - { - return; - } - - int regionId = worldPoint.getRegionID(); - GroundMarkerPoint point = new GroundMarkerPoint(regionId, worldPoint.getRegionX(), worldPoint.getRegionY(), client.getPlane(), group); - log.debug("Updating point: {} - {}", point, worldPoint); - - List points = new ArrayList<>(getPoints(regionId)); - if (points.contains(point)) - { - GroundMarkerPoint old = points.get(points.indexOf(point)); - points.remove(point); - - if (old.getGroup() != group) - { - points.add(point); - } - } - else - { - points.add(point); - } - - savePoints(regionId, points); - - loadPoints(); - } - - private Color getColor(int group) - { - Color color = this.markerColor; - switch (group) - { - case 2: - color = this.markerColor2; - break; - case 3: - color = this.markerColor3; - break; - case 4: - color = this.markerColor4; - break; - case 5: - color = this.markerColor5; - break; - case 6: - color = this.markerColor6; - break; - case 7: - color = this.markerColor7; - break; - case 8: - color = this.markerColor8; - break; - case 9: - color = this.markerColor9; - break; - case 10: - color = this.markerColor10; - break; - case 11: - color = this.markerColor11; - break; - case 12: - color = this.markerColor12; - } - - return color; - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("groundMarker")) - { - updateConfig(); - } - } - - private void updateConfig() - { - this.amount = config.getAmount(); - this.markerColor = config.markerColor(); - this.markerColor2 = config.markerColor2(); - this.markerColor3 = config.markerColor3(); - this.markerColor4 = config.markerColor4(); - this.markerColor5 = config.markerColor5(); - this.markerColor6 = config.markerColor6(); - this.markerColor7 = config.markerColor7(); - this.markerColor8 = config.markerColor8(); - this.markerColor9 = config.markerColor9(); - this.markerColor10 = config.markerColor10(); - this.markerColor11 = config.markerColor11(); - this.markerColor12 = config.markerColor12(); - this.showMinimap = config.showMinimap(); - this.minimapOverlayOpacity = config.minimapOverlayOpacity(); - this.thinMarkers = config.thinMarkers(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java deleted file mode 100644 index 99b1b489b1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPoint.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2018, TheLonelyDev - * Copyright (c) 2018, 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.groundmarkers; - -import lombok.EqualsAndHashCode; -import lombok.Value; - -@Value -@EqualsAndHashCode(exclude = {"group"}) -class GroundMarkerPoint -{ - private int regionId; - private int regionX; - private int regionY; - private int z; - private int group; -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerWorldPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerWorldPoint.java deleted file mode 100644 index 57234eeca0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerWorldPoint.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.groundmarkers; - -import lombok.Value; -import net.runelite.api.coords.WorldPoint; - -@Value -class GroundMarkerWorldPoint -{ - private GroundMarkerPoint groundMarkerPoint; - private WorldPoint worldPoint; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarConfig.java deleted file mode 100644 index 0a149032c4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarConfig.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2017, Tyler - * Copyright (c) 2019, Gamer1120 - * 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.herbiboars; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("herbiboar") -public interface HerbiboarConfig extends Config -{ - @ConfigItem( - position = 0, - keyName = "showStart", - name = "Show Start Objects", - description = "Show highlights for starting rocks and logs" - ) - default boolean isStartShown() - { - return true; - } - - @ConfigItem( - position = 1, - keyName = "showOutline", - name = "Show Outlines", - description = "Show outlines on trail objects and tunnels instead of tiles" - ) - default boolean showOutlines() - { - return false; - } - - @ConfigItem( - position = 2, - keyName = "highlightStyle", - name = "Outline Style", - description = "Outline setting", - hidden = true, - unhide = "showOutline" - ) - default RenderStyle outlineStyle() - { - return RenderStyle.THIN_OUTLINE; - } - - @ConfigItem( - position = 3, - keyName = "colorStart", - name = "Start Color", - description = "Color for rocks that start the trails" - ) - default Color getStartColor() - { - return Color.CYAN; - } - - @ConfigItem( - position = 4, - keyName = "showTunnel", - name = "Show End Tunnels", - description = "Show highlights for tunnels with herbiboars" - ) - default boolean isTunnelShown() - { - return true; - } - - @ConfigItem( - position = 5, - keyName = "colorTunnel", - name = "Tunnel Color", - description = "Color for tunnels with herbiboars" - ) - default Color getTunnelColor() - { - return Color.GREEN; - } - - @ConfigItem( - position = 6, - keyName = "showObject", - name = "Show Trail Objects", - description = "Show highlights for mushrooms, mud, seaweed, etc" - ) - default boolean isObjectShown() - { - return true; - } - - @ConfigItem( - position = 7, - keyName = "colorGameObject", - name = "Trail Object Color", - description = "Color for mushrooms, mud, seaweed, etc" - ) - default Color getObjectColor() - { - return Color.CYAN; - } - - @ConfigItem( - position = 8, - keyName = "showTrail", - name = "Show Trail", - description = "Show highlights for trail prints" - ) - default boolean isTrailShown() - { - return true; - } - - @ConfigItem( - position = 9, - keyName = "showOnlyCurrentTrail", - name = "Show Current Trail Only", - description = "Only show the trail that you currently have to follow to get to the next object you have to inspect. Requires that the \"Show Trail\" option is enabled" - ) - default boolean isOnlyCurrentTrailShown() - { - return false; - } - - @ConfigItem( - position = 10, - keyName = "colorTrail", - name = "Trail Color", - description = "Color for mushrooms, mud, seaweed, etc" - ) - default Color getTrailColor() - { - return Color.WHITE; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarMinimapOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarMinimapOverlay.java deleted file mode 100644 index ea27aeaa7c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarMinimapOverlay.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel - * Copyright (c) 2019, Gamer1120 - * 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.herbiboars; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.Set; -import net.runelite.api.Point; -import net.runelite.api.TileObject; -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; - -@Singleton -public class HerbiboarMinimapOverlay extends Overlay -{ - private final HerbiboarPlugin plugin; - - @Inject - public HerbiboarMinimapOverlay(final HerbiboarPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.isTrailShown() && plugin.isInHerbiboarArea()) - { - HerbiboarTrail currentTrail = plugin.getCurrentTrail(); - int finishId = plugin.getFinishId(); - Set shownTrailIds; - if (plugin.isOnlyCurrentTrailShown()) - { - shownTrailIds = plugin.getCurrentTrailIds(); - } - else - { - shownTrailIds = plugin.getShownTrails(); - } - - for (TileObject tileObject : plugin.getTrails().values()) - { - int id = tileObject.getId(); - Point minimapLocation = tileObject.getMinimapLocation(); - - if (minimapLocation == null) - { - continue; - } - - if (shownTrailIds.contains(id) && (finishId > 0 || (currentTrail != null && currentTrail.getTrailId() != id && currentTrail.getTrailId() + 1 != id))) - { - OverlayUtil.renderMinimapLocation(graphics, minimapLocation, plugin.getGetTrailColor()); - } - } - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarOverlay.java deleted file mode 100644 index 6eac5222c4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarOverlay.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (c) 2017, Tyler - * Copyright (c) 2019, Gamer1120 - * 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.herbiboars; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.Set; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.TileObject; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.graphics.ModelOutlineRenderer; -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; - -@Singleton -class HerbiboarOverlay extends Overlay -{ - private static final Color TRANSPARENT = new Color(0, 0, 0, 0); - - private final Client client; - - private final HerbiboarPlugin plugin; - private final ModelOutlineRenderer modelOutlineRenderer; - - @Inject - public HerbiboarOverlay(final HerbiboarPlugin plugin, ModelOutlineRenderer modelOutlineRenderer, Client client) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.plugin = plugin; - this.modelOutlineRenderer = modelOutlineRenderer; - this.client = client; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isInHerbiboarArea()) - { - return null; - } - - HerbiboarTrail currentTrail = plugin.getCurrentTrail(); - - int finishId = plugin.getFinishId(); - - // Draw start objects - if (plugin.isStartShown() && currentTrail == null && finishId == 0 && !plugin.isHerbiboarRendered()) - { - plugin.getStarts().values().forEach((obj) -> - OverlayUtil.renderTileOverlay(graphics, obj, "", plugin.getGetStartColor())); - } - - // Draw trails - Set shownTrailIds; - if (plugin.isTrailShown()) - { - if (plugin.isOnlyCurrentTrailShown()) - { - shownTrailIds = plugin.getCurrentTrailIds(); - } - else - { - shownTrailIds = plugin.getShownTrails(); - } - plugin.getTrails().values().forEach((x) -> - { - int id = x.getId(); - if (shownTrailIds.contains(id) && (finishId > 0 || (currentTrail != null && currentTrail.getTrailId() != id && currentTrail.getTrailId() + 1 != id))) - { - OverlayUtil.renderTileOverlay(graphics, x, "", plugin.getGetTrailColor()); - } - }); - } - - // Draw trail objects (mushrooms, mud, etc) - if (plugin.isObjectShown() && currentTrail != null) - { - int currentPath = plugin.getCurrentPath(); - WorldPoint[] trailLocs = currentTrail.getObjectLocs(currentPath); - for (WorldPoint trailLoc : trailLocs) - { - if (trailLoc == null) - { - continue; - } - - TileObject object = plugin.getTrailObjects().get(trailLoc); - - if (object != null) - { - if (plugin.isShowOutlines()) - { - renderOutline(object, new Color(255, 0, 255, 20)); - } - else - { - OverlayUtil.renderTileOverlay(graphics, object, "", plugin.getGetObjectColor()); - } - } - } - } - - // Draw finish tunnels - if (plugin.isTunnelShown() && finishId > 0) - { - WorldPoint finishLoc = plugin.getEndLocations().get(finishId - 1); - TileObject object = plugin.getTunnels().get(finishLoc); - if (object != null) - { - if (plugin.isShowOutlines()) - { - Color col = plugin.getGetObjectColor(); - renderOutline(object, new Color(col.getRed(), col.getGreen(), col.getBlue(), 20)); - } - else - { - OverlayUtil.renderTileOverlay(graphics, object, "", plugin.getGetTunnelColor()); - } - } - } - - // Draw herbiboar - if (plugin.isHerbiboarRendered()) - { - for (NPC npc : client.getNpcs()) - { - if (npc.getId() == NpcID.HERBIBOAR || npc.getId() == NpcID.HERBIBOAR_7786) - { - modelOutlineRenderer.drawOutline(npc, 2, plugin.getGetObjectColor()); - } - } - } - return null; - } - - private void renderOutline(TileObject object, Color color) - { - switch (plugin.getOutlineStyle()) - { - case THIN_OUTLINE: - modelOutlineRenderer.drawOutline(object, 1, color); - break; - - case OUTLINE: - modelOutlineRenderer.drawOutline(object, 2, color); - break; - - case THIN_GLOW: - modelOutlineRenderer.drawOutline(object, 4, color, TRANSPARENT); - break; - - case GLOW: - modelOutlineRenderer.drawOutline(object, 8, color, TRANSPARENT); - break; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarPlugin.java deleted file mode 100644 index 933432fde4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarPlugin.java +++ /dev/null @@ -1,493 +0,0 @@ -/* - * Copyright (c) 2017, Tyler - * 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.herbiboars; - -import com.google.inject.Provides; -import java.awt.Color; -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 javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import static net.runelite.api.ObjectID.DRIFTWOOD_30523; -import static net.runelite.api.ObjectID.MUSHROOM_30520; -import static net.runelite.api.ObjectID.ROCK_30519; -import static net.runelite.api.ObjectID.ROCK_30521; -import static net.runelite.api.ObjectID.ROCK_30522; -import net.runelite.api.Tile; -import net.runelite.api.TileObject; -import net.runelite.api.Varbits; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.AnimationChanged; -import net.runelite.api.events.GameObjectChanged; -import net.runelite.api.events.GameObjectDespawned; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GroundObjectChanged; -import net.runelite.api.events.GroundObjectDespawned; -import net.runelite.api.events.GroundObjectSpawned; -import net.runelite.api.events.VarbitChanged; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "Herbiboar", - description = "Highlight starting rocks, trails, and the objects to search at the end of each trail", - tags = {"herblore", "hunter", "skilling", "overlay"}, - type = PluginType.SKILLING -) -@Singleton -public class HerbiboarPlugin extends Plugin -{ - private static final List END_LOCATIONS = Arrays.asList( - new WorldPoint(3693, 3798, 0), - new WorldPoint(3702, 3808, 0), - new WorldPoint(3703, 3826, 0), - new WorldPoint(3710, 3881, 0), - new WorldPoint(3700, 3877, 0), - new WorldPoint(3715, 3840, 0), - new WorldPoint(3751, 3849, 0), - new WorldPoint(3685, 3869, 0), - new WorldPoint(3681, 3863, 0) - ); - - private static final List START_OBJECT_IDS = Arrays.asList( - ROCK_30519, - MUSHROOM_30520, - ROCK_30521, - ROCK_30522, - DRIFTWOOD_30523 - ); - - private static final int[] HERBIBOAR_REGIONS = { - 14652, - 14651, - 14908, - 14907 - }; - - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private HerbiboarOverlay overlay; - - @Inject - private HerbiboarMinimapOverlay minimapOverlay; - - @Inject - private HerbiboarConfig config; - - @Getter(AccessLevel.PACKAGE) - private boolean inHerbiboarArea; - - @Getter(AccessLevel.PACKAGE) - private Map trails = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private Map tunnels = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private Map starts = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private Map trailObjects = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private Set shownTrails = new HashSet<>(); - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private HerbiboarTrail currentTrail; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private int currentPath; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private int finishId; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private Set previousShownTrailIds; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private Integer previousTrailId = null; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private boolean herbiboarRendered = false; - - @Getter(AccessLevel.PACKAGE) - private boolean isStartShown; - @Getter(AccessLevel.PACKAGE) - private Color getStartColor; - @Getter(AccessLevel.PACKAGE) - private boolean isTunnelShown; - @Getter(AccessLevel.PACKAGE) - private Color getTunnelColor; - @Getter(AccessLevel.PACKAGE) - private boolean isObjectShown; - @Getter(AccessLevel.PACKAGE) - private Color getObjectColor; - @Getter(AccessLevel.PACKAGE) - private boolean isTrailShown; - @Getter(AccessLevel.PACKAGE) - private Color getTrailColor; - @Getter(AccessLevel.PACKAGE) - private boolean isOnlyCurrentTrailShown; - @Getter(AccessLevel.PACKAGE) - private boolean showOutlines; - @Getter(AccessLevel.PACKAGE) - private RenderStyle outlineStyle; - - @Provides - HerbiboarConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(HerbiboarConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - overlayManager.add(minimapOverlay); - inHerbiboarArea = checkArea(); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - overlayManager.remove(minimapOverlay); - } - - private void updateTrailData() - { - currentTrail = null; - currentPath = -1; - - // Get trail data - for (HerbiboarTrail trail : HerbiboarTrail.values()) - { - int trailId = trail.getTrailId(); - int value = client.getVar(trail.getVarbit()); - - if (value > 0) - { - shownTrails.add(trailId); - shownTrails.add(trailId + 1); - } - if (value == 1 || value == 2) - { - currentTrail = trail; - currentPath = value; - } - } - - // Get finish data - finishId = client.getVar(Varbits.HB_FINISH); - if (finishId > 0 && currentTrail != null) - { - shownTrails.add(currentTrail.getTrailId()); - shownTrails.add(currentTrail.getTrailId() + 1); - currentTrail = null; - currentPath = -1; - } - - int started = client.getVar(Varbits.HB_STARTED); - if (currentPath == -1 && finishId == 0 && started == 0) - { - resetTrailData(); - } - - } - - public Set getCurrentTrailIds() - { - Set shownTrailIds; - if (currentTrail == null) - { - if (finishId <= 0) - { - previousTrailId = null; - shownTrailIds = new HashSet<>(); - } - else - { - shownTrailIds = new HashSet<>(); - shownTrailIds.add(previousTrailId); - shownTrailIds.add(previousTrailId + 1); - } - } - else if (previousTrailId == null) - { - previousTrailId = currentTrail.getTrailId(); - shownTrailIds = getShownTrails(); - } - else if (currentTrail.getTrailId() == previousTrailId) - { - shownTrailIds = previousShownTrailIds; - } - else - { - shownTrailIds = new HashSet<>(); - shownTrailIds.add(previousTrailId); - shownTrailIds.add(previousTrailId + 1); - previousTrailId = currentTrail.getTrailId(); - } - previousShownTrailIds = shownTrailIds; - return shownTrailIds; - } - - private void resetTrailData() - { - currentPath = 0; - currentTrail = null; - finishId = 0; - shownTrails.clear(); - } - - private void clearCache() - { - starts.clear(); - trailObjects.clear(); - trails.clear(); - tunnels.clear(); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - switch (event.getGameState()) - { - case HOPPING: - case LOGGING_IN: - resetTrailData(); - break; - case LOADING: - clearCache(); - inHerbiboarArea = checkArea(); - break; - default: - break; - } - } - - @Subscribe - private void onVarbitChanged(VarbitChanged event) - { - if (isInHerbiboarArea()) - { - updateTrailData(); - } - } - - @Subscribe - private void onGameObjectSpawned(GameObjectSpawned event) - { - onGameObject(event.getTile(), null, event.getGameObject()); - } - - @Subscribe - public void onAnimationChanged(AnimationChanged event) - { - if (!(event.getActor() instanceof NPC)) - { - return; - } - - NPC npc = (NPC) event.getActor(); - // Herbiboar spawns - if (npc.getId() == NpcID.HERBIBOAR_7786 && npc.getAnimation() == 7687) - { - herbiboarRendered = true; - } - // Herbiboar is stunned - else if (npc.getId() == NpcID.HERBIBOAR && npc.getAnimation() == 7689) - { - herbiboarRendered = true; - } - // Herbiboar is harvested - else if (npc.getId() == NpcID.HERBIBOAR_7786 && npc.getAnimation() == 7690) - { - herbiboarRendered = false; - } - } - - @Subscribe - private void onGameObjectChanged(GameObjectChanged event) - { - onGameObject(event.getTile(), event.getPrevious(), event.getGameObject()); - } - - @Subscribe - private void onGameObjectDespawned(GameObjectDespawned event) - { - onGameObject(event.getTile(), event.getGameObject(), null); - } - - @Subscribe - private void onGroundObjectSpawned(GroundObjectSpawned event) - { - onGroundObject(null, event.getGroundObject()); - } - - @Subscribe - private void onGroundObjectChanged(GroundObjectChanged event) - { - onGroundObject(event.getPrevious(), event.getGroundObject()); - } - - @Subscribe - private void onGroundObjectDespawned(GroundObjectDespawned event) - { - onGroundObject(event.getGroundObject(), null); - } - - // Store relevant GameObjects (starts, objects used to trigger next trails, and some tunnels) - private void onGameObject(Tile tile, TileObject oldObject, TileObject newObject) - { - if (oldObject != null) - { - WorldPoint oldLocation = oldObject.getWorldLocation(); - trailObjects.remove(oldLocation); - tunnels.remove(oldLocation); - starts.remove(oldLocation); - } - - if (newObject == null) - { - return; - } - - // Starts - if (START_OBJECT_IDS.contains(newObject.getId())) - { - starts.put(newObject.getWorldLocation(), newObject); - return; - } - - // GameObject to trigger next trail (mushrooms, mud, seaweed, etc) - if (HerbiboarTrail.getAllObjectLocs().contains(newObject.getWorldLocation())) - { - trailObjects.put(newObject.getWorldLocation(), newObject); - return; - } - - // Herbiboar tunnel - if (END_LOCATIONS.contains(newObject.getWorldLocation())) - { - tunnels.put(newObject.getWorldLocation(), newObject); - } - } - - // Store relevant GroundObjects (tracks on trails, and some tunnels) - private void onGroundObject(TileObject oldObject, TileObject newObject) - { - if (oldObject != null) - { - WorldPoint oldLocation = oldObject.getWorldLocation(); - trails.remove(oldLocation); - tunnels.remove(oldLocation); - } - - if (newObject == null) - { - return; - } - - //Trails - if (HerbiboarTrail.getTrailIds().contains(newObject.getId())) - { - trails.put(newObject.getWorldLocation(), newObject); - return; - } - - //Herbiboar tunnel - if (END_LOCATIONS.contains(newObject.getWorldLocation())) - { - tunnels.put(newObject.getWorldLocation(), newObject); - } - } - - private boolean checkArea() - { - return client.getMapRegions() != null && Arrays.stream(client.getMapRegions()) - .filter(x -> Arrays.stream(HERBIBOAR_REGIONS).anyMatch(y -> y == x)) - .toArray().length > 0; - } - - List getEndLocations() - { - return END_LOCATIONS; - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("herbiboar")) - { - updateConfig(); - } - } - - private void updateConfig() - { - this.isStartShown = config.isStartShown(); - this.getStartColor = config.getStartColor(); - this.isTunnelShown = config.isTunnelShown(); - this.getTunnelColor = config.getTunnelColor(); - this.isObjectShown = config.isObjectShown(); - this.getObjectColor = config.getObjectColor(); - this.isTrailShown = config.isTrailShown(); - this.getTrailColor = config.getTrailColor(); - this.isOnlyCurrentTrailShown = config.isOnlyCurrentTrailShown(); - this.showOutlines = config.showOutlines(); - this.outlineStyle = config.outlineStyle(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarTrail.java b/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarTrail.java deleted file mode 100644 index f7d70558b4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/HerbiboarTrail.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2017, Tyler - * 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.herbiboars; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.Varbits; -import net.runelite.api.coords.WorldPoint; - -//Location of GameObjects which show TRAIL_xxxxx when used -@AllArgsConstructor -public enum HerbiboarTrail -{ - TRAIL_31303(31303, Varbits.HB_TRAIL_31303, null, new WorldPoint(3697, 3875, 0), null, new WorldPoint(3699, 3875, 0)), - TRAIL_31306(31306, Varbits.HB_TRAIL_31306, null, new WorldPoint(3672, 3890, 0), null, new WorldPoint(3670, 3889, 0)), - TRAIL_31309(31309, Varbits.HB_TRAIL_31309, null, new WorldPoint(3681, 3859, 0), null, new WorldPoint(3681, 3860, 0)), - TRAIL_31312(31312, Varbits.HB_TRAIL_31312, new WorldPoint(3699, 3875, 0), new WorldPoint(3710, 3877, 0), new WorldPoint(3697, 3875, 0), new WorldPoint(3708, 3876, 0)), - TRAIL_31315(31315, Varbits.HB_TRAIL_31315, new WorldPoint(3699, 3875, 0), new WorldPoint(3728, 3893, 0), new WorldPoint(3697, 3875, 0), null), - TRAIL_31318(31318, Varbits.HB_TRAIL_31318, new WorldPoint(3670, 3889, 0), new WorldPoint(3728, 3893, 0), new WorldPoint(3672, 3890, 0), null), - TRAIL_31321(31321, Varbits.HB_TRAIL_31321, new WorldPoint(3670, 3889, 0), new WorldPoint(3667, 3862, 0), new WorldPoint(3672, 3890, 0), new WorldPoint(3668, 3865, 0)), - TRAIL_31324(31324, Varbits.HB_TRAIL_31324, new WorldPoint(3681, 3860, 0), new WorldPoint(3680, 3836, 0), new WorldPoint(3681, 3859, 0), new WorldPoint(3680, 3838, 0)), - TRAIL_31327(31327, Varbits.HB_TRAIL_31327, new WorldPoint(3681, 3860, 0), new WorldPoint(3698, 3847, 0), new WorldPoint(3681, 3859, 0), new WorldPoint(3694, 3847, 0)), - TRAIL_31330(31330, Varbits.HB_TRAIL_31330, new WorldPoint(3708, 3876, 0), new WorldPoint(3713, 3850, 0), new WorldPoint(3710, 3877, 0), new WorldPoint(3715, 3851, 0)), - TRAIL_31333(31333, Varbits.HB_TRAIL_31333, new WorldPoint(3708, 3876, 0), new WorldPoint(3694, 3847, 0), new WorldPoint(3710, 3877, 0), new WorldPoint(3698, 3847, 0)), - TRAIL_31336(31336, Varbits.HB_TRAIL_31336, new WorldPoint(3728, 3893, 0), null, null, null), - TRAIL_31339(31339, Varbits.HB_TRAIL_31339, new WorldPoint(3728, 3893, 0), new WorldPoint(3710, 3877, 0), null, new WorldPoint(3708, 3876, 0)), - TRAIL_31342(31342, Varbits.HB_TRAIL_31342, new WorldPoint(3668, 3865, 0), new WorldPoint(3681, 3860, 0), new WorldPoint(3667, 3862, 0), new WorldPoint(3681, 3859, 0)), - TRAIL_31345(31345, Varbits.HB_TRAIL_31345, new WorldPoint(3668, 3865, 0), new WorldPoint(3680, 3836, 0), new WorldPoint(3667, 3862, 0), new WorldPoint(3680, 3838, 0)), - TRAIL_31348(31348, Varbits.HB_TRAIL_31348, new WorldPoint(3680, 3838, 0), new WorldPoint(3706, 3811, 0), new WorldPoint(3680, 3836, 0), null), - TRAIL_31351(31351, Varbits.HB_TRAIL_31351, new WorldPoint(3680, 3838, 0), null, new WorldPoint(3680, 3836, 0), null), - TRAIL_31354(31354, Varbits.HB_TRAIL_31354, new WorldPoint(3694, 3847, 0), null, new WorldPoint(3698, 3847, 0), null), - TRAIL_31357(31357, Varbits.HB_TRAIL_31357, new WorldPoint(3715, 3851, 0), new WorldPoint(3713, 3840, 0), new WorldPoint(3713, 3850, 0), null), - TRAIL_31360(31360, Varbits.HB_TRAIL_31360, new WorldPoint(3715, 3851, 0), null, new WorldPoint(3713, 3850, 0), null), - TRAIL_31363(31363, Varbits.HB_TRAIL_31363, new WorldPoint(3713, 3850, 0), null, new WorldPoint(3715, 3851, 0), null), - TRAIL_31366(31366, Varbits.HB_TRAIL_31366, null, null, null, null), - TRAIL_31369(31369, Varbits.HB_TRAIL_31369, new WorldPoint(3706, 3811, 0), null, null, null), - TRAIL_31372(31372, Varbits.HB_TRAIL_31372, new WorldPoint(3713, 3840, 0), null, null, null); - - @Getter(AccessLevel.PACKAGE) - private final int trailId; - @Getter(AccessLevel.PACKAGE) - private final Varbits varbit; - private final WorldPoint objectLoc1; - private final WorldPoint objectLoc2; - private final WorldPoint objectLoc3; - private final WorldPoint objectLoc4; - - @Getter(AccessLevel.PACKAGE) - private static Set trailIds = new HashSet<>(); - @Getter(AccessLevel.PACKAGE) - private static Set allObjectLocs = new HashSet<>(); - - static - { - for (HerbiboarTrail trail : values()) - { - trailIds.add(trail.trailId); - trailIds.add(trail.trailId + 1); - - allObjectLocs.addAll(Arrays.asList(trail.getObjectLocs(1))); - allObjectLocs.addAll(Arrays.asList(trail.getObjectLocs(2))); - } - } - - public WorldPoint[] getObjectLocs(int varbitValue) - { - switch (varbitValue) - { - case 1: - return new WorldPoint[]{objectLoc1, objectLoc3}; - case 2: - return new WorldPoint[]{objectLoc2, objectLoc4}; - case 0: - default: - return new WorldPoint[]{}; - } - } - - @Override - public String toString() - { - return String.format("trailId=%s obj1=%s obj2=%s obj3=%s obj4=%s", trailId, objectLoc1, objectLoc2, objectLoc3, objectLoc4); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/RenderStyle.java b/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/RenderStyle.java deleted file mode 100644 index bbfba92700..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/herbiboars/RenderStyle.java +++ /dev/null @@ -1,22 +0,0 @@ -package net.runelite.client.plugins.herbiboars; - -public enum RenderStyle -{ - THIN_OUTLINE("Thin outline"), - OUTLINE("Outline"), - THIN_GLOW("Thin glow"), - GLOW("Glow"); - - private final String name; - - RenderStyle(final String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/HidePrayersConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/HidePrayersConfig.java deleted file mode 100644 index 1e2ccbb828..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/HidePrayersConfig.java +++ /dev/null @@ -1,760 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2019, Kyle - * Copyright (c) 2018, Raiever - * 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.hideprayers; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigSection; -import net.runelite.client.plugins.hideprayers.util.Armadyl; -import net.runelite.client.plugins.hideprayers.util.Bandos; -import net.runelite.client.plugins.hideprayers.util.Barrows; -import net.runelite.client.plugins.hideprayers.util.Cerberus; -import net.runelite.client.plugins.hideprayers.util.PVPPrayers; -import net.runelite.client.plugins.hideprayers.util.Saradomin; -import net.runelite.client.plugins.hideprayers.util.Vorkath; -import net.runelite.client.plugins.hideprayers.util.Zamorak; -import net.runelite.client.plugins.hideprayers.util.Zulrah; - -@ConfigGroup("hideprayers") -public interface HidePrayersConfig extends Config -{ - @ConfigSection( - name = "Individual Prayers", - description = "", - position = 0, - keyName = "individualPrayersSection" - ) - default boolean individualPrayersSection() - { - return false; - } - - @ConfigSection( - name = "PvM Prayers", - description = "", - position = 1, - keyName = "pvmSection" - ) - default boolean pvmSection() - { - return false; - } - - @ConfigSection( - name = "PvP Prayers", - description = "", - position = 2, - keyName = "pvpSection" - ) - default boolean pvpSection() - { - return false; - } - - @ConfigItem( - position = 0, - keyName = "showindividualprayers", - name = "Hide Individual Prayers", - description = "Hide/Show Prayers.", - section = "individualPrayersSection", - disabledBy = "getpvpprayers || HideRapidHealRestore || getzulrahprayers || getzamorakprayers || getvorkathprayers || getsaradominprayers || getcerberusprayers || getbandosprayers || getbarrowsprayers || getarmadylprayers" - ) - default boolean showindividualprayers() - { - return false; - } - - @ConfigItem( - position = 1, - keyName = "ShowTHICK_SKIN", - name = "Show Thick Skin", - description = "Hide/Show Thick Skin", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowTHICK_SKIN() - { - return false; - } - - @ConfigItem( - position = 2, - keyName = "ShowBURST_OF_STRENGTH", - name = "Show Burst of Strength", - description = "Hide/Show Burst of Strength", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowBURST_OF_STRENGTH() - { - return false; - } - - @ConfigItem( - position = 3, - keyName = "ShowCLARITY_OF_THOUGHT", - name = "Show Clarity of Thought", - description = "Hide/Show Clarity of Thought", - section = "individualPrayersSection", - hidden = true, - unhide = "Showindividualprayers" - ) - default boolean ShowCLARITY_OF_THOUGHT() - { - return false; - } - - @ConfigItem( - position = 4, - keyName = "ShowSHARP_EYE", - name = "Show Sharp Eye", - description = "Hide/Show Sharp Eye", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowSHARP_EYE() - { - return false; - } - - @ConfigItem( - position = 5, - keyName = "ShowMYSTIC_WILL", - name = "Show Mystic Will", - description = "Hide/Show Mystic Will", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowMYSTIC_WILL() - { - return false; - } - - @ConfigItem( - position = 6, - keyName = "ShowROCK_SKIN", - name = "Show Rock Skin", - description = "Hide/Show Rock Skin", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowROCK_SKIN() - { - return false; - } - - @ConfigItem( - position = 7, - keyName = "ShowSUPERHUMAN_STRENGTH", - name = "Show Super Human Strength", - description = "Hide/Show Super Human Strength", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowSUPERHUMAN_STRENGTH() - { - return false; - } - - @ConfigItem( - position = 8, - keyName = "ShowIMPROVED_REFLEXES", - name = "Show Improved_Reflexes", - description = "Hide/Show Improved_Reflexes", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowIMPROVED_REFLEXES() - { - return false; - } - - @ConfigItem( - position = 9, - keyName = "ShowRapidRestore", - name = "Show Rapid Restore", - description = "Hide/Show Rapid Restore", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowRapidRestore() - { - return false; - } - - @ConfigItem( - position = 10, - keyName = "ShowRapidHeal", - name = "Show Rapid Heal", - description = "Hide/Show Rapid Heal", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowRapidHeal() - { - return false; - } - - @ConfigItem( - position = 11, - keyName = "ShowProtectItem", - name = "Show Protect Item", - description = "Hide/Show Protect Item", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowProtectItem() - { - return false; - } - - @ConfigItem( - position = 12, - keyName = "ShowHAWK_EYE", - name = "Show Hawk Eye", - description = "Hide/Show Hawk Eye", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowHAWK_EYE() - { - return false; - } - - @ConfigItem( - position = 13, - keyName = "ShowMYSTIC_LORE", - name = "Show Mystic Lore", - description = "Hide/Show Mystic Lore", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowMYSTIC_LORE() - { - return false; - } - - - @ConfigItem( - position = 14, - keyName = "ShowSteelSkin", - name = "Show Steel Skin", - description = "Hide/Show Steel skin", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowSteelSkin() - { - return false; - } - - @ConfigItem( - position = 15, - keyName = "ShowUltimateStrength", - name = "Show Ultimate Strength", - description = "Hide/Show Ultimate strength", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowUltimateStrength() - { - return false; - } - - @ConfigItem( - position = 16, - keyName = "ShowIncredibleReflex", - name = "Show Incredible Reflex", - description = "Hide/Show Incredible Reflex", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowIncredibleReflex() - { - return false; - } - - @ConfigItem( - position = 17, - keyName = "ShowPTFMagic", - name = "Show Protect From Magic", - description = "Hide/Show Protect From Magic", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowPTFMagic() - { - return false; - } - - @ConfigItem( - position = 18, - keyName = "ShowPTFRange", - name = "Show Protect From Range", - description = "Hide/Show Protect from Range", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowPTFRange() - { - return false; - } - - @ConfigItem( - position = 19, - keyName = "ShowPTFMelee", - name = "Show Protect From Melee", - description = "Hide/Show Protect From Melee", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowPTFMelee() - { - return false; - } - - @ConfigItem( - position = 20, - keyName = "ShowEagle", - name = "Show Eagle Eye", - description = "Hide/Show Eagle Eye", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowEagle() - { - return false; - } - - @ConfigItem( - position = 19, - keyName = "ShowMystic", - name = "Show Mystic Might", - description = "Hide/Show Mystic Might", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowMystic() - { - return false; - } - - @ConfigItem( - position = 21, - keyName = "ShowRETRIBUTION", - name = "Show Retribution", - description = "Hide/Show Retribution", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowRETRIBUTION() - { - return false; - } - - @ConfigItem( - position = 22, - keyName = "ShowRedemption", - name = "Show Redemption", - description = "Hide/Show Redemption", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowRedemption() - { - return false; - } - - @ConfigItem( - position = 23, - keyName = "ShowSmite", - name = "Show Smite", - description = "Hide/Show Smite", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowSmite() - { - return false; - } - - @ConfigItem( - position = 24, - keyName = "ShowPreserve", - name = "Show Preserve", - description = "Hide/Show Preserve", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowPreserve() - { - return false; - } - - @ConfigItem( - position = 25, - keyName = "ShowChivalry", - name = "Show Chivalry", - description = "Hide/Show Chivalry", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowChivalry() - { - return false; - } - - @ConfigItem( - position = 26, - keyName = "ShowPiety", - name = "Show Piety", - description = "Hide/Show Piety", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowPiety() - { - return false; - } - - @ConfigItem( - position = 27, - keyName = "ShowRigour", - name = "Show Rigour", - description = "Hide/Show Rigour", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowRigour() - { - return false; - } - - @ConfigItem( - position = 28, - keyName = "ShowAugury", - name = "Show Augury", - description = "Hide/Show Augury", - section = "individualPrayersSection", - hidden = true, - unhide = "showindividualprayers" - ) - default boolean ShowAugury() - { - return false; - } - -// ----------------------------------------------------------- // - - @ConfigItem( - position = 0, - keyName = "getarmadylprayers", - name = "enable Armadyl Prayers", - description = "Shows prayers for Armadyl", - section = "pvmSection", - disabledBy = "showindividualprayers || getpvpprayers || HideRapidHealRestore || getzulrahprayers || getzamorakprayers || getvorkathprayers || getsaradominprayers || getcerberusprayers || getbandosprayers || getbarrowsprayers" - ) - default boolean getarmadylprayers() - { - return false; - } - - @ConfigItem( - position = 1, - keyName = "armadyl", - name = "Armadyl", - description = "Shows prayers for Armadyl", - section = "pvmSection", - hidden = true, - unhide = "getarmadylprayers" - ) - default Armadyl armadyl() - { - return Armadyl.DISABLED; - } - - @ConfigItem( - position = 2, - keyName = "getbarrowsprayers", - name = "enable Barrows Prayers", - description = "Shows prayers for Barrows", - section = "pvmSection", - disabledBy = "showindividualprayers || getpvpprayers || HideRapidHealRestore || getzulrahprayers || getzamorakprayers || getvorkathprayers || getsaradominprayers || getcerberusprayers || getbandosprayers || getarmadylprayers" - ) - default boolean getbarrowsprayers() - { - return false; - } - - @ConfigItem( - position = 3, - keyName = "barrows", - name = "Barrows", - description = "Shows prayers for Barrows", - section = "pvmSection", - hidden = true, - unhide = "getbarrowsprayers" - ) - default Barrows barrows() - { - return Barrows.DISABLED; - } - - @ConfigItem( - position = 4, - keyName = "getbandosprayers", - name = "enable Bandos Prayers", - description = "Shows prayers for Bandos", - section = "pvmSection", - disabledBy = "showindividualprayers || getpvpprayers || HideRapidHealRestore || getzulrahprayers || getzamorakprayers || getvorkathprayers || getsaradominprayers || getcerberusprayers || getbarrowsprayers || getarmadylprayers" - ) - default boolean getbandosprayers() - { - return false; - } - - @ConfigItem( - position = 5, - keyName = "bandos", - name = "Bandos", - description = "Shows prayers for Bandos", - section = "pvmSection", - hidden = true, - unhide = "getbandosprayers" - ) - default Bandos bandos() - { - return Bandos.DISABLED; - } - - @ConfigItem( - position = 6, - keyName = "getcerberusprayers", - name = "enable Cerberus Prayers", - description = "Shows prayers for Cerberus", - section = "pvmSection", - disabledBy = "showindividualprayers || getpvpprayers || HideRapidHealRestore || getzulrahprayers || getzamorakprayers || getvorkathprayers || getsaradominprayers || getbandosprayers || getbarrowsprayers || getarmadylprayers" - ) - default boolean getcerberusprayers() - { - return false; - } - - @ConfigItem( - position = 7, - keyName = "cerberus", - name = "Cerberus", - description = "Shows prayers for Cerberus", - section = "pvmSection", - hidden = true, - unhide = "getcerberusprayers" - ) - default Cerberus cerberus() - { - return Cerberus.DISABLED; - } - - @ConfigItem( - position = 8, - keyName = "getsaradominprayers", - name = "enable Saradomin Prayers", - description = "Shows prayers for Saradomin", - section = "pvmSection", - disabledBy = "showindividualprayers || getpvpprayers || HideRapidHealRestore || getzulrahprayers || getzamorakprayers || getvorkathprayers || getcerberusprayers || getbandosprayers || getbarrowsprayers || getarmadylprayers" - ) - default boolean getsaradominprayers() - { - return false; - } - - @ConfigItem( - position = 9, - keyName = "saradomin", - name = "Saradomin", - description = "Shows prayers for Saradomin", - section = "pvmSection", - hidden = true, - unhide = "getsaradominprayers" - ) - default Saradomin saradomin() - { - return Saradomin.DISABLED; - } - - @ConfigItem( - position = 10, - keyName = "getvorkathprayers", - name = "enable Vorkath Prayers", - description = "Shows prayers for Vorkath", - section = "pvmSection", - disabledBy = "showindividualprayers || getpvpprayers || HideRapidHealRestore || getzulrahprayers || getzamorakprayers || getsaradominprayers || getcerberusprayers || getbandosprayers || getbarrowsprayers || getarmadylprayers" - ) - default boolean getvorkathprayers() - { - return false; - } - - @ConfigItem( - position = 11, - keyName = "vorkath", - name = "Vorkath", - description = "Shows prayers for Vorkath", - section = "pvmSection", - hidden = true, - unhide = "getvorkathprayers" - ) - default Vorkath vorkath() - { - return Vorkath.DISABLED; - } - - @ConfigItem( - position = 12, - keyName = "getzamorakprayers", - name = "enable Zamorak Prayers", - description = "Shows prayers for Zamorak", - section = "pvmSection", - disabledBy = "showindividualprayers || getpvpprayers || HideRapidHealRestore || getzulrahprayers || getvorkathprayers || getsaradominprayers || getcerberusprayers || getbandosprayers || getbarrowsprayers || getarmadylprayers" - ) - default boolean getzamorakprayers() - { - return false; - } - - @ConfigItem( - position = 13, - keyName = "zamorak", - name = "Zamorak", - description = "Shows prayers for Zamorak", - section = "pvmSection", - hidden = true, - unhide = "getzamorakprayers" - ) - default Zamorak zamorak() - { - return Zamorak.DISABLED; - } - - @ConfigItem( - position = 14, - keyName = "getzulrahprayers", - name = "enable Zulrah Prayers", - description = "Shows prayers for Zulrah", - section = "pvmSection", - disabledBy = "showindividualprayers || getpvpprayers || HideRapidHealRestore || getzamorakprayers || getvorkathprayers || getsaradominprayers || getcerberusprayers || getbandosprayers || getbarrowsprayers || getarmadylprayers" - ) - default boolean getzulrahprayers() - { - return false; - } - - @ConfigItem( - position = 15, - keyName = "zulrah", - name = "Zulrah", - description = "Shows prayers for Zulrah", - section = "pvmSection", - hidden = true, - unhide = "getzulrahprayers" - ) - default Zulrah zulrah() - { - return Zulrah.DISABLED; - } - -// ----------------------------------------------------------- // - - @ConfigItem( - position = 0, - keyName = "getpvpprayers", - name = "enable PVP Prayers", - description = "Shows prayers based on prayer build", - section = "pvpSection", - disabledBy = "showindividualprayers || getzulrahprayers || getzamorakprayers || getvorkathprayers || getsaradominprayers || getcerberusprayers || getbandosprayers || getbarrowsprayers || getarmadylprayers" - ) - default boolean getpvpprayers() - { - return false; - } - - @ConfigItem( - position = 1, - keyName = "pvpprayers", - name = "PVP Prayers", - description = "Shows prayers based on prayer build", - section = "pvpSection", - hidden = true, - unhide = "getpvpprayers" - ) - default PVPPrayers pvpprayers() - { - return PVPPrayers.DISABLED; - } - - @ConfigItem( - position = 2, - keyName = "HideRapidHealRestore", - name = "Hide Rapid Heal and Rapid Restore", - description = "Hides the Rapid Heal and Rapid Restore prayers", - section = "pvpSection", - hidden = true, - unhide = "getpvpprayers" - ) - default boolean HideRapidHealRestore() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/HidePrayersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/HidePrayersPlugin.java deleted file mode 100644 index dcc474db34..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/HidePrayersPlugin.java +++ /dev/null @@ -1,770 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2019, Kyle - * Copyright (c) 2018, Raiever - * 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.hideprayers; - -import com.google.common.collect.ImmutableList; -import com.google.inject.Provides; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.HashTable; -import net.runelite.api.Skill; -import net.runelite.api.WidgetNode; -import net.runelite.api.WorldType; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.widgets.Widget; -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.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.hideprayers.util.Armadyl; -import net.runelite.client.plugins.hideprayers.util.Bandos; -import net.runelite.client.plugins.hideprayers.util.Barrows; -import net.runelite.client.plugins.hideprayers.util.Cerberus; -import net.runelite.client.plugins.hideprayers.util.PVPPrayers; -import net.runelite.client.plugins.hideprayers.util.PrayerTabStates; -import net.runelite.client.plugins.hideprayers.util.Saradomin; -import net.runelite.client.plugins.hideprayers.util.Vorkath; -import net.runelite.client.plugins.hideprayers.util.Zamorak; -import net.runelite.client.plugins.hideprayers.util.Zulrah; - -@PluginDescriptor( - name = "Show/Hide Prayers", - description = "Hides specific Prayers.", - type = PluginType.UTILITY, - enabledByDefault = false -) -@Singleton -public class HidePrayersPlugin extends Plugin -{ - private static final List PRAYER_WIDGET_INFO_LIST = ImmutableList.of( - WidgetInfo.PRAYER_THICK_SKIN, //0 - WidgetInfo.PRAYER_BURST_OF_STRENGTH, //1 - WidgetInfo.PRAYER_CLARITY_OF_THOUGHT, //2 - WidgetInfo.PRAYER_SHARP_EYE, //3 - WidgetInfo.PRAYER_MYSTIC_WILL, //4 - WidgetInfo.PRAYER_ROCK_SKIN, //5 - WidgetInfo.PRAYER_SUPERHUMAN_STRENGTH, //6 - WidgetInfo.PRAYER_IMPROVED_REFLEXES, //7 - WidgetInfo.PRAYER_RAPID_RESTORE, //8 - WidgetInfo.PRAYER_RAPID_HEAL, //9 - WidgetInfo.PRAYER_PROTECT_ITEM, //10 - WidgetInfo.PRAYER_HAWK_EYE, //11 - WidgetInfo.PRAYER_MYSTIC_LORE, //12 - WidgetInfo.PRAYER_STEEL_SKIN, //13 - WidgetInfo.PRAYER_ULTIMATE_STRENGTH, //14 - WidgetInfo.PRAYER_INCREDIBLE_REFLEXES, //15 - WidgetInfo.PRAYER_PROTECT_FROM_MAGIC, //16 - WidgetInfo.PRAYER_PROTECT_FROM_MISSILES, //17 - WidgetInfo.PRAYER_PROTECT_FROM_MELEE, //18 - WidgetInfo.PRAYER_EAGLE_EYE, //19 - WidgetInfo.PRAYER_MYSTIC_MIGHT, //20 - WidgetInfo.PRAYER_RETRIBUTION, //21 - WidgetInfo.PRAYER_REDEMPTION, //22 - WidgetInfo.PRAYER_SMITE, //23 - WidgetInfo.PRAYER_PRESERVE, //24 - WidgetInfo.PRAYER_CHIVALRY, //25 - WidgetInfo.PRAYER_PIETY, //26 - WidgetInfo.PRAYER_RIGOUR, //27 - WidgetInfo.PRAYER_AUGURY //28 - ); - - @Inject - private Client client; - - @Inject - private HidePrayersConfig config; - - private boolean showindividualprayers; - private boolean ShowTHICK_SKIN; - private boolean ShowBURST_OF_STRENGTH; - private boolean ShowCLARITY_OF_THOUGHT; - private boolean ShowSHARP_EYE; - private boolean ShowMYSTIC_WILL; - private boolean ShowROCK_SKIN; - private boolean ShowSUPERHUMAN_STRENGTH; - private boolean ShowIMPROVED_REFLEXES; - private boolean ShowRapidRestore; - private boolean ShowRapidHeal; - private boolean ShowProtectItem; - private boolean ShowHAWK_EYE; - private boolean ShowMYSTIC_LORE; - private boolean ShowSteelSkin; - private boolean ShowUltimateStrength; - private boolean ShowIncredibleReflex; - private boolean ShowPTFMagic; - private boolean ShowPTFRange; - private boolean ShowPTFMelee; - private boolean ShowEagle; - private boolean ShowMystic; - private boolean ShowRETRIBUTION; - private boolean ShowRedemption; - private boolean ShowSmite; - private boolean ShowPreserve; - private boolean ShowChivalry; - private boolean ShowPiety; - private boolean ShowRigour; - private boolean ShowAugury; - private boolean getarmadylprayers; - private Armadyl armadyl; - private boolean getbarrowsprayers; - private Barrows barrows; - private boolean getbandosprayers; - private Bandos bandos; - private boolean getcerberusprayers; - private Cerberus cerberus; - private boolean getsaradominprayers; - private Saradomin saradomin; - private boolean getvorkathprayers; - private Vorkath vorkath; - private boolean getzamorakprayers; - private Zamorak zamorak; - private boolean getzulrahprayers; - private Zulrah zulrah; - private boolean getpvpprayers; - private PVPPrayers pvpprayers; - private boolean HideRapidHealRestore; - - @Provides - HidePrayersConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(HidePrayersConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - hidePrayers(); - } - - @Override - protected void shutDown() - { - restorePrayers(); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGGED_IN) - { - reallyHidePrayers(); - hidePrayers(); - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("hideprayers")) - { - updateConfig(); - hidePrayers(); - } - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded event) - { - if (event.getGroupId() == WidgetID.PRAYER_GROUP_ID || event.getGroupId() == WidgetID.QUICK_PRAYERS_GROUP_ID) - { - hidePrayers(); - } - } - - private PrayerTabStates getPrayerTabState() - { - HashTable componentTable = client.getComponentTable(); - for (WidgetNode widgetNode : componentTable.getNodes()) - { - if (widgetNode.getId() == WidgetID.PRAYER_GROUP_ID) - { - return PrayerTabStates.PRAYERS; - } - else if (widgetNode.getId() == WidgetID.QUICK_PRAYERS_GROUP_ID) - { - return PrayerTabStates.QUICK_PRAYERS; - } - } - return PrayerTabStates.NONE; - } - - private void restorePrayers() - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - PrayerTabStates prayerTabState = getPrayerTabState(); - - if (prayerTabState == PrayerTabStates.PRAYERS) - { - List prayerWidgets = PRAYER_WIDGET_INFO_LIST.stream().map(client::getWidget) - .filter(Objects::nonNull).collect(Collectors.toList()); - - if (prayerWidgets.size() != PRAYER_WIDGET_INFO_LIST.size()) - { - return; - } - - for (Widget w : prayerWidgets) - { - w.setHidden(false); - } - } - } - - private void reallyHidePrayers() - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - PrayerTabStates prayerTabState = getPrayerTabState(); - - if (prayerTabState == PrayerTabStates.PRAYERS) - { - List prayerWidgets = PRAYER_WIDGET_INFO_LIST.stream().map(client::getWidget) - .filter(Objects::nonNull).collect(Collectors.toList()); - - if (prayerWidgets.size() != PRAYER_WIDGET_INFO_LIST.size()) - { - return; - } - - for (Widget w : prayerWidgets) - { - w.setHidden(true); - } - } - } - - private void hidePrayers() - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - PrayerTabStates prayerTabState = getPrayerTabState(); - - if (prayerTabState == PrayerTabStates.PRAYERS) - { - List prayerWidgets = PRAYER_WIDGET_INFO_LIST.stream().map(client::getWidget) - .filter(Objects::nonNull).collect(Collectors.toList()); - - if (prayerWidgets.size() != PRAYER_WIDGET_INFO_LIST.size()) - { - return; - } - - if (!this.showindividualprayers - && !this.getarmadylprayers - && !this.getbarrowsprayers - && !this.getbandosprayers - && !this.getcerberusprayers - && !this.getsaradominprayers - && !this.getvorkathprayers - && !this.getzamorakprayers - && !this.getzulrahprayers - && !this.getpvpprayers) - { - restorePrayers(); - return; - } - - reallyHidePrayers(); - - if (this.showindividualprayers) - { - prayerWidgets.get(0).setHidden(!this.ShowTHICK_SKIN); // Thick Skin - prayerWidgets.get(1).setHidden(!this.ShowBURST_OF_STRENGTH); // Burst of Strength - prayerWidgets.get(2).setHidden(!this.ShowCLARITY_OF_THOUGHT); // Clarity of Thought - prayerWidgets.get(3).setHidden(!this.ShowSHARP_EYE); // Sharp Eye - prayerWidgets.get(4).setHidden(!this.ShowMYSTIC_WILL); // Mystic Will - prayerWidgets.get(5).setHidden(!this.ShowROCK_SKIN); // Rock Skin - prayerWidgets.get(6).setHidden(!this.ShowSUPERHUMAN_STRENGTH); // Super Human Strength - prayerWidgets.get(7).setHidden(!this.ShowIMPROVED_REFLEXES); // Improved_Reflexes - prayerWidgets.get(8).setHidden(!this.ShowRapidRestore); // Rapid Restore - prayerWidgets.get(9).setHidden(!this.ShowRapidHeal); // Rapid Heal - prayerWidgets.get(10).setHidden(!this.ShowProtectItem); // Protect Item - prayerWidgets.get(11).setHidden(!this.ShowHAWK_EYE); // Hawk Eye - prayerWidgets.get(12).setHidden(!this.ShowMYSTIC_LORE); // Mystic Lore - prayerWidgets.get(13).setHidden(!this.ShowSteelSkin); // Steel Skin - prayerWidgets.get(14).setHidden(!this.ShowUltimateStrength); // Ultimate Strength - prayerWidgets.get(15).setHidden(!this.ShowIncredibleReflex); // Incredible Reflexes - prayerWidgets.get(16).setHidden(!this.ShowPTFMagic); // Protect from Magic - prayerWidgets.get(17).setHidden(!this.ShowPTFRange); // Protect from Range - prayerWidgets.get(18).setHidden(!this.ShowPTFMelee); // Protect from Melee - prayerWidgets.get(19).setHidden(!this.ShowEagle); // eagle eye - prayerWidgets.get(20).setHidden(!this.ShowMystic); // Mystic Might - prayerWidgets.get(21).setHidden(!this.ShowRETRIBUTION); // Retribution - prayerWidgets.get(22).setHidden(!this.ShowRedemption); // Redemption - prayerWidgets.get(23).setHidden(!this.ShowSmite); // Smite - prayerWidgets.get(24).setHidden(!this.ShowPreserve); // Preserve - prayerWidgets.get(25).setHidden(!this.ShowChivalry); // Chivalry - prayerWidgets.get(26).setHidden(!this.ShowPiety); // Piety - prayerWidgets.get(27).setHidden(!this.ShowRigour); // Rigour - prayerWidgets.get(28).setHidden(!this.ShowAugury); // Augury - } - - else if (this.getarmadylprayers) - { - switch (this.armadyl) - { - case DISABLED: - break; - case ARMADYL_CHEAP: - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(19).setHidden(false); // eagle eye - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(24).setHidden(false); // Preserve - break; - case ARMADYL_EXPENSIVE: - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(24).setHidden(false); // Preserve - prayerWidgets.get(27).setHidden(false); // Rigour - break; - } - } - - else if (this.getbandosprayers) - { - switch (this.bandos) - { - case DISABLED: - break; - case BANDOS_CHEAP: - prayerWidgets.get(13).setHidden(false); // Steel Skin - prayerWidgets.get(14).setHidden(false); // Ultimate Strength - prayerWidgets.get(15).setHidden(false); // Incredible Reflex - prayerWidgets.get(18).setHidden(false); // Protect from Melee - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(24).setHidden(false); // Preserve - break; - case BANDOS_EXPENSIVE: - prayerWidgets.get(18).setHidden(false); // Protect from Melee - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(24).setHidden(false); // Preserve - prayerWidgets.get(26).setHidden(false); // Piety - break; - } - } - - else if (this.getbarrowsprayers) - { - switch (this.barrows) - { - case DISABLED: - break; - case BARROWS_CHEAP: - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(18).setHidden(false); // Protect from Melee - prayerWidgets.get(19).setHidden(false); // eagle eye - prayerWidgets.get(20).setHidden(false); // mystic might - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(24).setHidden(false); // Preserve - break; - case BARROWS_EXPENSIVE: - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(18).setHidden(false); // Protect from Melee - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(24).setHidden(false); // Preserve - prayerWidgets.get(27).setHidden(false); // Rigour - prayerWidgets.get(28).setHidden(false); // Augury - break; - } - } - - else if (this.getcerberusprayers) - { - switch (this.cerberus) - { - case DISABLED: - break; - case CERBERUS_CHEAP: - prayerWidgets.get(13).setHidden(false); // Steel Skin - prayerWidgets.get(14).setHidden(false); // Ultimate Strength - prayerWidgets.get(15).setHidden(false); // Incredible Reflex - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(18).setHidden(false); // Protect from Melee - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(24).setHidden(false); // Preserve - break; - case CERBERUS_EXPENSIVE: - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(18).setHidden(false); // Protect from Melee - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(24).setHidden(false); // Preserve - prayerWidgets.get(26).setHidden(false); // Piety - break; - case CERBERUS_CHEAP_RANGE: - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(18).setHidden(false); // Protect from Melee - prayerWidgets.get(19).setHidden(false); // eagle eye - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(24).setHidden(false); // Preserve - break; - case CERBERUS_EXPENSIVE_RANGE: - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(18).setHidden(false); // Protect from Melee - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(24).setHidden(false); // Preserve - prayerWidgets.get(27).setHidden(false); // Rigour - break; - } - } - - else if (this.getsaradominprayers) - { - switch (this.saradomin) - { - case DISABLED: - break; - case SARDOMIN_CHEAP: - prayerWidgets.get(13).setHidden(false); // Steel Skin - prayerWidgets.get(14).setHidden(false); // Ultimate Strength - prayerWidgets.get(15).setHidden(false); // Incredible Reflex - prayerWidgets.get(16).setHidden(false); // Protect from magic - prayerWidgets.get(19).setHidden(false); // eagle eye - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(24).setHidden(false); // Preserve - break; - case SARADOMIN_EXPENSIVE: - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(24).setHidden(false); // Preserve - prayerWidgets.get(26).setHidden(false); // Piety - prayerWidgets.get(27).setHidden(false); // Rigour - break; - } - } - else if (this.getvorkathprayers) - { - switch (this.vorkath) - { - case DISABLED: - break; - case VORKATH_CHEAP: - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(19).setHidden(false); // eagle eye - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(24).setHidden(false); // Preserve - break; - case VORKATH_EXPENSIVE: - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(24).setHidden(false); // Preserve - prayerWidgets.get(27).setHidden(false); // Rigour - break; - } - } - - else if (this.getzamorakprayers) - { - switch (this.zamorak) - { - case DISABLED: - break; - case ZAMORAK_CHEAP: - prayerWidgets.get(13).setHidden(false); // Steel Skin - prayerWidgets.get(14).setHidden(false); // Ultimate Strength - prayerWidgets.get(15).setHidden(false); // Incredible Reflex - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(18).setHidden(false); // Protect from Melee - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(24).setHidden(false); // Preserve - break; - case ZAMORAK_EXPENSIVE: - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(18).setHidden(false); // Protect from Melee - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(24).setHidden(false); // Preserve - prayerWidgets.get(26).setHidden(false); // Piety - break; - } - } - - else if (this.getzulrahprayers) - { - switch (this.zulrah) - { - case DISABLED: - break; - case ZULRAH_CHEAP: - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(19).setHidden(false); // eagle eye - prayerWidgets.get(20).setHidden(false); // mystic might - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(24).setHidden(false); // Preserve - break; - case ZULRAH_EXPENSIVE: - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(24).setHidden(false); // Preserve - prayerWidgets.get(27).setHidden(false); // Rigour - prayerWidgets.get(28).setHidden(false); // Augury - break; - } - } - - else if (this.getpvpprayers) - { - if (this.HideRapidHealRestore) - { - prayerWidgets.get(8).setHidden(true); // Rapid Restore - prayerWidgets.get(9).setHidden(true); // Rapid Heal - } - else - { - prayerWidgets.get(8).setHidden(false); // Rapid Restore - prayerWidgets.get(9).setHidden(false); // Rapid Heal - } - - if (WorldType.isAllHighRiskWorld(client.getWorldType()) || client.getRealSkillLevel(Skill.PRAYER) <= 24) - { - prayerWidgets.get(10).setHidden(true); // Protect Item - } - else - { - prayerWidgets.get(10).setHidden(false); // Protect Item - } - - switch (this.pvpprayers) - { - case DISABLED: - reallyHidePrayers(); - break; - case PRAY1: - prayerWidgets.get(0).setHidden(false); // Thick Skin - break; - case PRAY13: - prayerWidgets.get(0).setHidden(false); // Thick Skin - prayerWidgets.get(3).setHidden(false); // Sharp Eye - prayerWidgets.get(4).setHidden(false); // Mystic Will - prayerWidgets.get(5).setHidden(false); // Rock Skin - prayerWidgets.get(6).setHidden(false); // Super Human Strength - break; - case PRAY16: - case PRAY25: - prayerWidgets.get(3).setHidden(false); // Sharp Eye - prayerWidgets.get(4).setHidden(false); // Mystic Will - prayerWidgets.get(5).setHidden(false); // Rock Skin - prayerWidgets.get(6).setHidden(false); // Super Human Strength - prayerWidgets.get(7).setHidden(false); // Improved Reflexed - break; - case PRAY31: - prayerWidgets.get(7).setHidden(false); // Improved Reflexed - prayerWidgets.get(11).setHidden(false); // Hawk Eye - prayerWidgets.get(12).setHidden(false); // Mystic Lore - prayerWidgets.get(13).setHidden(false); // Steel Skin - prayerWidgets.get(14).setHidden(false); // Ultimate Strength - break; - case PRAY43: - prayerWidgets.get(11).setHidden(false); // Hawk Eye - prayerWidgets.get(12).setHidden(false); // Mystic Lore - prayerWidgets.get(13).setHidden(false); // Steel Skin - prayerWidgets.get(14).setHidden(false); // Ultimate Strength - prayerWidgets.get(15).setHidden(false); // Incredible Reflexes - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(18).setHidden(false); // Protect from Melee - break; - case PRAY44: - prayerWidgets.get(12).setHidden(false); // Mystic Lore - prayerWidgets.get(13).setHidden(false); // Steel Skin - prayerWidgets.get(14).setHidden(false); // Ultimate Strength - prayerWidgets.get(15).setHidden(false); // Incredible Reflexes - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(18).setHidden(false); // Protect from Melee - prayerWidgets.get(19).setHidden(false); // Eagle Eye - break; - case PRAY45: - prayerWidgets.get(13).setHidden(false); // Steel Skin - prayerWidgets.get(14).setHidden(false); // Ultimate Strength - prayerWidgets.get(15).setHidden(false); // Incredible Reflexes - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(18).setHidden(false); // Protect from Melee - prayerWidgets.get(19).setHidden(false); // Eagle Eye - prayerWidgets.get(20).setHidden(false); // Mystic Might - break; - case PRAY52: - prayerWidgets.get(13).setHidden(false); // Steel Skin - prayerWidgets.get(14).setHidden(false); // Ultimate Strength - prayerWidgets.get(15).setHidden(false); // Incredible Reflexes - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(18).setHidden(false); // Protect from Melee - prayerWidgets.get(19).setHidden(false); // Eagle Eye - prayerWidgets.get(20).setHidden(false); // Mystic Might - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(23).setHidden(false); // Smite - break; - case PRAY55: - prayerWidgets.get(13).setHidden(false); // Steel Skin - prayerWidgets.get(14).setHidden(false); // Ultimate Strength - prayerWidgets.get(15).setHidden(false); // Incredible Reflexes - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(18).setHidden(false); // Protect from Melee - prayerWidgets.get(19).setHidden(false); // Eagle Eye - prayerWidgets.get(20).setHidden(false); // Mystic Might - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(23).setHidden(false); // Smite - prayerWidgets.get(24).setHidden(false); // Preserve - break; - case PRAY60: - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(18).setHidden(false); // Protect from Melee - prayerWidgets.get(19).setHidden(false); // Eagle Eye - prayerWidgets.get(20).setHidden(false); // Mystic Might - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(23).setHidden(false); // Smite - prayerWidgets.get(24).setHidden(false); // Preserve - prayerWidgets.get(25).setHidden(false); // Chivalry - break; - case PRAY70: - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(18).setHidden(false); // Protect from Melee - prayerWidgets.get(19).setHidden(false); // Eagle Eye - prayerWidgets.get(20).setHidden(false); // Mystic Might - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(23).setHidden(false); // Smite - prayerWidgets.get(24).setHidden(false); // Preserve - prayerWidgets.get(26).setHidden(false); // Piety - break; - case PRAY74: - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(18).setHidden(false); // Protect from Melee - prayerWidgets.get(20).setHidden(false); // Mystic Might - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(23).setHidden(false); // Smite - prayerWidgets.get(24).setHidden(false); // Preserve - prayerWidgets.get(26).setHidden(false); // Piety - prayerWidgets.get(27).setHidden(false); // Rigour - break; - case PRAY77: - prayerWidgets.get(16).setHidden(false); // Protect from Magic - prayerWidgets.get(17).setHidden(false); // Protect from Range - prayerWidgets.get(18).setHidden(false); // Protect from Melee - prayerWidgets.get(22).setHidden(false); // Redemption - prayerWidgets.get(23).setHidden(false); // Smite - prayerWidgets.get(24).setHidden(false); // Preserve - prayerWidgets.get(26).setHidden(false); // Piety - prayerWidgets.get(27).setHidden(false); // Rigour - prayerWidgets.get(28).setHidden(false); // Augury - break; - } - } - } - } - - private void updateConfig() - { - this.showindividualprayers = config.showindividualprayers(); - this.ShowTHICK_SKIN = config.ShowTHICK_SKIN(); - this.ShowBURST_OF_STRENGTH = config.ShowBURST_OF_STRENGTH(); - this.ShowCLARITY_OF_THOUGHT = config.ShowCLARITY_OF_THOUGHT(); - this.ShowSHARP_EYE = config.ShowSHARP_EYE(); - this.ShowMYSTIC_WILL = config.ShowMYSTIC_WILL(); - this.ShowROCK_SKIN = config.ShowROCK_SKIN(); - this.ShowSUPERHUMAN_STRENGTH = config.ShowSUPERHUMAN_STRENGTH(); - this.ShowIMPROVED_REFLEXES = config.ShowIMPROVED_REFLEXES(); - this.ShowRapidRestore = config.ShowRapidRestore(); - this.ShowRapidHeal = config.ShowRapidHeal(); - this.ShowProtectItem = config.ShowProtectItem(); - this.ShowHAWK_EYE = config.ShowHAWK_EYE(); - this.ShowMYSTIC_LORE = config.ShowMYSTIC_LORE(); - this.ShowSteelSkin = config.ShowSteelSkin(); - this.ShowUltimateStrength = config.ShowUltimateStrength(); - this.ShowIncredibleReflex = config.ShowIncredibleReflex(); - this.ShowPTFMagic = config.ShowPTFMagic(); - this.ShowPTFRange = config.ShowPTFRange(); - this.ShowPTFMelee = config.ShowPTFMelee(); - this.ShowEagle = config.ShowEagle(); - this.ShowMystic = config.ShowMystic(); - this.ShowRETRIBUTION = config.ShowRETRIBUTION(); - this.ShowRedemption = config.ShowRedemption(); - this.ShowSmite = config.ShowSmite(); - this.ShowPreserve = config.ShowPreserve(); - this.ShowChivalry = config.ShowChivalry(); - this.ShowPiety = config.ShowPiety(); - this.ShowRigour = config.ShowRigour(); - this.ShowAugury = config.ShowAugury(); - this.getarmadylprayers = config.getarmadylprayers(); - this.armadyl = config.armadyl(); - this.getbarrowsprayers = config.getbarrowsprayers(); - this.barrows = config.barrows(); - this.getbandosprayers = config.getbandosprayers(); - this.bandos = config.bandos(); - this.getcerberusprayers = config.getcerberusprayers(); - this.cerberus = config.cerberus(); - this.getsaradominprayers = config.getsaradominprayers(); - this.saradomin = config.saradomin(); - this.getvorkathprayers = config.getvorkathprayers(); - this.vorkath = config.vorkath(); - this.getzamorakprayers = config.getzamorakprayers(); - this.zamorak = config.zamorak(); - this.getzulrahprayers = config.getzulrahprayers(); - this.zulrah = config.zulrah(); - this.getpvpprayers = config.getpvpprayers(); - this.pvpprayers = config.pvpprayers(); - this.HideRapidHealRestore = config.HideRapidHealRestore(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Armadyl.java b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Armadyl.java deleted file mode 100644 index 80802f5a22..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Armadyl.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * 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 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.client.plugins.hideprayers.util; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter(AccessLevel.PACKAGE) -@AllArgsConstructor -public enum Armadyl -{ - DISABLED("Disabled"), - ARMADYL_CHEAP("Eagle eye"), - ARMADYL_EXPENSIVE("Rigour"); - - private String name; - - @Override - public String toString() - { - return getName(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Bandos.java b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Bandos.java deleted file mode 100644 index c3f0c39294..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Bandos.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * 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 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.client.plugins.hideprayers.util; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter(AccessLevel.PACKAGE) -@AllArgsConstructor -public enum Bandos -{ - DISABLED("Disabled"), - BANDOS_CHEAP("Low LVL Melee"), - BANDOS_EXPENSIVE("Piety"); - - private String name; - - @Override - public String toString() - { - return getName(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Barrows.java b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Barrows.java deleted file mode 100644 index 414024f356..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Barrows.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * 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 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.client.plugins.hideprayers.util; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter(AccessLevel.PACKAGE) -@AllArgsConstructor -public enum Barrows -{ - DISABLED("Disabled"), - BARROWS_CHEAP("Eagle/Mystic"), - BARROWS_EXPENSIVE("Augury/Rigour"); - - private String name; - - @Override - public String toString() - { - return getName(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Cerberus.java b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Cerberus.java deleted file mode 100644 index 3894a71b12..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Cerberus.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * 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 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.client.plugins.hideprayers.util; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter(AccessLevel.PACKAGE) -@AllArgsConstructor -public enum Cerberus -{ - DISABLED("Disabled"), - CERBERUS_CHEAP("Low LVL Melee"), - CERBERUS_EXPENSIVE("Melee Piety"), - CERBERUS_CHEAP_RANGE("Range Eagle Eye"), - CERBERUS_EXPENSIVE_RANGE("Range Rigour"); - - private String name; - - @Override - public String toString() - { - return getName(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/PVPPrayers.java b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/PVPPrayers.java deleted file mode 100644 index 8571c7611c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/PVPPrayers.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * 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 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.client.plugins.hideprayers.util; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter(AccessLevel.PACKAGE) -@AllArgsConstructor -public enum PVPPrayers -{ - DISABLED("Disabled"), - PRAY1("1 prayer build"), - PRAY13("13 prayer build"), - PRAY16("16 prayer build"), - PRAY25("25 prayer build"), - PRAY31("31 prayer build"), - PRAY43("43 prayer build"), - PRAY44("44 prayer build"), - PRAY45("45 prayer build"), - PRAY52("52 prayer build"), - PRAY55("55 prayer build"), - PRAY60("60 prayer build"), - PRAY70("70 prayer build"), - PRAY74("74 prayer build"), - PRAY77("77 prayer build"); - - private String name; - - @Override - public String toString() - { - return getName(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/PrayerTabStates.java b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/PrayerTabStates.java deleted file mode 100644 index d79bcaf7c0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/PrayerTabStates.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2019, Kyle - * Copyright (c) 2018, Raiever - * 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.hideprayers.util; - -public enum PrayerTabStates -{ - NONE, - PRAYERS, - QUICK_PRAYERS -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Saradomin.java b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Saradomin.java deleted file mode 100644 index 8b108f50f0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Saradomin.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * 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 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.client.plugins.hideprayers.util; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter(AccessLevel.PACKAGE) -@AllArgsConstructor -public enum Saradomin -{ - DISABLED("Disabled"), - SARDOMIN_CHEAP("Melee/Eagle"), - SARADOMIN_EXPENSIVE("Piety/Rigour"); - - private String name; - - @Override - public String toString() - { - return getName(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Vorkath.java b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Vorkath.java deleted file mode 100644 index 499566d9ee..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Vorkath.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * 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 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.client.plugins.hideprayers.util; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter(AccessLevel.PACKAGE) -@AllArgsConstructor -public enum Vorkath -{ - DISABLED("Disabled"), - VORKATH_CHEAP("Eagle Eye"), - VORKATH_EXPENSIVE("Rigour"); - - private String name; - - @Override - public String toString() - { - return getName(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Zamorak.java b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Zamorak.java deleted file mode 100644 index fd77e1f848..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Zamorak.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * 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 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.client.plugins.hideprayers.util; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter(AccessLevel.PACKAGE) -@AllArgsConstructor -public enum Zamorak -{ - DISABLED("Disabled"), - ZAMORAK_CHEAP("Low LVL Melee"), - ZAMORAK_EXPENSIVE("Piety"); - - private String name; - - @Override - public String toString() - { - return getName(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Zulrah.java b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Zulrah.java deleted file mode 100644 index 2590016edd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/util/Zulrah.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * 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 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.client.plugins.hideprayers.util; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter(AccessLevel.PACKAGE) -@AllArgsConstructor -public enum Zulrah -{ - DISABLED("Disabled"), - ZULRAH_CHEAP("Eagle/Mystic"), - ZULRAH_EXPENSIVE("Augury/Rigour"); - - private String name; - - @Override - public String toString() - { - return getName(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hideunder/HideUnder.java b/runelite-client/src/main/java/net/runelite/client/plugins/hideunder/HideUnder.java deleted file mode 100644 index 93fb4427a9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hideunder/HideUnder.java +++ /dev/null @@ -1,108 +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.hideunder; - -import javax.inject.Inject; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.Varbits; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.game.PlayerContainer; -import net.runelite.client.game.PlayerManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Hide Under", - description = "Hide local player when under targeted players", - tags = {"hide", "local", "player", "under"}, - type = PluginType.PVP, - enabledByDefault = false -) -@Slf4j -public class HideUnder extends Plugin -{ - @Inject - private Client client; - @Inject - private PlayerManager playerManager; - - - @Override - protected void startUp() - { - } - - @Override - protected void shutDown() - { - - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGGED_IN) - { - client.setIsHidingEntities(true); - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - if (client.getLocalPlayer() == null) - { - return; - } - - client.setLocalPlayerHidden(false); - - final WorldPoint localPlayerWp = WorldPoint.fromLocalInstance(client, client.getLocalPlayer().getLocalLocation()); - final WorldPoint lp = client.getLocalPlayer().getWorldLocation(); - - for (PlayerContainer player : playerManager.getAllAttackers()) - { - if (client.getVar(Varbits.LMS_IN_GAME) == 1) - { - final WorldPoint playerWp = WorldPoint.fromLocalInstance(client, player.getPlayer().getLocalLocation()); - if (localPlayerWp != null && localPlayerWp.distanceTo(playerWp) == 0) - { - client.setLocalPlayerHidden(true); - } - continue; - } - - if (lp != null && player.getPlayer().getWorldLocation().distanceTo(lp) == 0) - { - client.setLocalPlayerHidden(true); - } - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyConfig.java deleted file mode 100644 index 4b90360112..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyConfig.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2019 Ahmad Issa - * Copyright (c) 2019 Owain - * Copyright (c) 2019 Kyle - * 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.highalchemy; - -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.Range; - -@ConfigGroup("highalchemy") -public interface HighAlchemyConfig extends Config -{ - int lowerLimit = Integer.MIN_VALUE; - - @ConfigItem( - keyName = "showBank", - name = "Highlight Bank Items", - description = "Show highlight on bank items.", - position = 0 - ) - default boolean showBank() - { - return false; - } - - @ConfigItem( - keyName = "showInventory", - name = "Highlight Inventory Items", - description = "Show highlight on inventory items.", - position = 1 - ) - default boolean showInventory() - { - return false; - } - - @ConfigItem( - keyName = "getHighlightColor", - name = "Highlight Color", - description = "Choose the color of the highlight.", - position = 2 - ) - default Color getHighlightColor() - { - return Color.WHITE; - } - - @Range( - min = lowerLimit - ) - @ConfigItem( - keyName = "minProfit", - name = "Profit Target", - description = "Minimal desired profit from casting High Alchemy", - position = 3 - ) - default int minProfit() - { - return 1; - } - - @ConfigItem( - keyName = "usingFireRunes", - name = "Using Fire Runes", - description = "Change the equation to include the price of fire runes.", - position = 4 - ) - default boolean usingFireRunes() - { - return false; - } - -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyOverlay.java deleted file mode 100644 index 92e24a96fd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyOverlay.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2019 Ahmad Issa - * Copyright (c) 2019 Owain - * Copyright (c) 2019 Kyle - * Copyright (c) 2019, Lucas - * 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.highalchemy; - -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.ItemDefinition; -import net.runelite.api.ItemID; -import net.runelite.api.widgets.Widget; -import static net.runelite.api.widgets.WidgetInfo.TO_GROUP; -import net.runelite.api.widgets.WidgetItem; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.overlay.WidgetItemOverlay; - -@Singleton -public class HighAlchemyOverlay extends WidgetItemOverlay -{ - private final ItemManager itemManager; - private final HighAlchemyPlugin plugin; - private final int alchPrice; - private final int alchPriceNoStaff; - - @Inject - public HighAlchemyOverlay(final ItemManager itemManager, final HighAlchemyPlugin plugin) - { - this.itemManager = itemManager; - this.plugin = plugin; - - int natPrice = itemManager.getItemPrice(ItemID.NATURE_RUNE, true); - this.alchPrice = natPrice; - this.alchPriceNoStaff = natPrice + 5 * itemManager.getItemPrice(ItemID.FIRE_RUNE, true); - - showOnBank(); - showOnInventory(); - } - - @Override - public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget) - { - Widget widget = itemWidget.getWidget(); - int interfaceGroup = TO_GROUP(widget.getId()); - - if (!plugin.getInterfaceGroups().contains(interfaceGroup)) - { - return; - } - - final int id = getNotedId(itemId); - final int gePrice = getGEPrice(id); - final int haPrice = getHAPrice(id); - final int materialCost = plugin.isUsingFireRunes() ? alchPriceNoStaff : alchPrice; - final int desiredProfit = plugin.getMinProfit(); - final int haProfit = getHAProfit(haPrice, gePrice, materialCost); - - if (gePrice > 0 && haPrice > 0 && haProfit >= desiredProfit) - { - final Color color = plugin.getGetHighlightColor(); - - if (color != null) - { - Rectangle bounds = itemWidget.getCanvasBounds(); - final BufferedImage outline = itemManager.getItemOutline(itemId, itemWidget.getQuantity(), color); - graphics.drawImage(outline, (int) bounds.getX() + 1, (int) bounds.getY() + 1, null); - } - } - } - - private int getGEPrice(int id) - { - return itemManager.getItemPrice(id); - } - - private int getHAPrice(int id) - { - if (id == ItemID.COINS_995) - { - return 0; - } - - return itemManager.getAlchValue(id); - } - - private int getHAProfit(int haPrice, int gePrice, int alchCost) - { - return haPrice - gePrice - alchCost; - } - - // Checks if item is noted, if not returns id - private int getNotedId(int id) - { - int noteID = id; - ItemDefinition itemComposition = itemManager.getItemDefinition(noteID); - if (itemComposition.getNote() != -1) - { - noteID = itemComposition.getLinkedNoteId(); - } - return noteID; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyPlugin.java deleted file mode 100644 index 81aa12827c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyPlugin.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2019 Ahmad Issa - * Copyright (c) 2019 Owain - * Copyright (c) 2019 Kyle - * 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.highalchemy; - -import com.google.inject.Provides; -import java.awt.Color; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import static net.runelite.api.widgets.WidgetID.BANK_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.BANK_INVENTORY_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.DEPOSIT_BOX_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.EQUIPMENT_INVENTORY_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.GRAND_EXCHANGE_INVENTORY_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.GUIDE_PRICES_INVENTORY_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.INVENTORY_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.SHOP_INVENTORY_GROUP_ID; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "High Alchemy", - description = "Highlights items that yield a profit from casting the High Alchemy spell.", - tags = {"bank", "inventory", "overlay", "high", "alchemy", "grand", "exchange", "tooltips"}, - type = PluginType.UTILITY, - enabledByDefault = false -) -@Singleton -public class HighAlchemyPlugin extends Plugin -{ - private static final String CONFIG_GROUP = "highalchemy"; - - @Getter(AccessLevel.PACKAGE) - private final Set interfaceGroups = new HashSet<>(); - - @Inject - private HighAlchemyConfig config; - - @Inject - private OverlayManager overlayManager; - - @Inject - private HighAlchemyOverlay overlay; - - @Provides - HighAlchemyConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(HighAlchemyConfig.class); - } - - private boolean showBank; - private boolean showInventory; - @Getter(AccessLevel.PACKAGE) - private Color getHighlightColor; - @Getter(AccessLevel.PACKAGE) - private int minProfit; - @Getter(AccessLevel.PACKAGE) - private boolean usingFireRunes; - - @Override - protected void startUp() - { - updateConfig(); - buildGroupList(); - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals(CONFIG_GROUP)) - { - updateConfig(); - buildGroupList(); - } - } - - private void buildGroupList() - { - interfaceGroups.clear(); - - if (this.showBank) - { - interfaceGroups.add(BANK_GROUP_ID); - } - - if (this.showInventory) - { - Arrays.stream( - new int[]{ - DEPOSIT_BOX_GROUP_ID, - BANK_INVENTORY_GROUP_ID, - SHOP_INVENTORY_GROUP_ID, - GRAND_EXCHANGE_INVENTORY_GROUP_ID, - GUIDE_PRICES_INVENTORY_GROUP_ID, - EQUIPMENT_INVENTORY_GROUP_ID, - INVENTORY_GROUP_ID - } - ).forEach(interfaceGroups::add); - } - } - - private void updateConfig() - { - this.showBank = config.showBank(); - this.showInventory = config.showInventory(); - this.getHighlightColor = config.getHighlightColor(); - this.minProfit = config.minProfit(); - this.usingFireRunes = config.usingFireRunes(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscoreConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscoreConfig.java deleted file mode 100644 index 848ded03e7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscoreConfig.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2018, 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.hiscore; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("hiscore") -public interface HiscoreConfig extends Config -{ - @ConfigItem( - position = 1, - keyName = "playerOption", - name = "Player option", - description = "Add Lookup option to players" - ) - default boolean playerOption() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "menuOption", - name = "Menu option", - description = "Show Lookup option in menus" - ) - default boolean menuOption() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "virtualLevels", - name = "Display virtual levels", - description = "Display levels over 99 in the hiscore panel" - ) - default boolean virtualLevels() - { - return true; - } - - @ConfigItem( - position = 4, - keyName = "autocomplete", - name = "Autocomplete", - description = "Predict names when typing a name to lookup" - ) - default boolean autocomplete() - { - return true; - } - - @ConfigItem( - position = 5, - keyName = "bountylookup", - name = "Bounty lookup", - description = "Automatically lookup the stats of your bounty hunter target" - ) - default boolean bountyLookup() - { - return false; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java deleted file mode 100644 index 681ca2490f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java +++ /dev/null @@ -1,718 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * Copyright (c) 2018, Psikoi - * Copyright (c) 2019, Bram91 - * 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.hiscore; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Strings; -import com.google.common.collect.ImmutableList; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.GridLayout; -import java.awt.Insets; -import java.awt.event.KeyListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ScheduledExecutorService; -import javax.annotation.Nullable; -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.Experience; -import net.runelite.api.Player; -import net.runelite.api.WorldType; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.ui.components.IconTextField; -import net.runelite.client.ui.components.materialtabs.MaterialTab; -import net.runelite.client.ui.components.materialtabs.MaterialTabGroup; -import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.QuantityFormatter; -import net.runelite.http.api.hiscore.HiscoreClient; -import net.runelite.http.api.hiscore.HiscoreEndpoint; -import net.runelite.http.api.hiscore.HiscoreResult; -import net.runelite.http.api.hiscore.HiscoreSkill; -import static net.runelite.http.api.hiscore.HiscoreSkill.*; -import net.runelite.http.api.hiscore.HiscoreSkillType; -import net.runelite.http.api.hiscore.Skill; -import org.apache.commons.lang3.StringUtils; - -@Slf4j -@Singleton -public class HiscorePanel extends PluginPanel -{ - /* The maximum allowed username length in RuneScape accounts */ - private static final int MAX_USERNAME_LENGTH = 12; - - /** - * Real skills, ordered in the way they should be displayed in the panel. - */ - private static final List SKILLS = ImmutableList.of( - ATTACK, HITPOINTS, MINING, - STRENGTH, AGILITY, SMITHING, - DEFENCE, HERBLORE, FISHING, - RANGED, THIEVING, COOKING, - PRAYER, CRAFTING, FIREMAKING, - MAGIC, FLETCHING, WOODCUTTING, - RUNECRAFT, SLAYER, FARMING, - CONSTRUCTION, HUNTER - ); - - /** - * Bosses, ordered in the way they should be displayed in the panel. - */ - private static final List BOSSES = ImmutableList.of( - ABYSSAL_SIRE, ALCHEMICAL_HYDRA, BARROWS_CHESTS, - BRYOPHYTA, CALLISTO, CERBERUS, - CHAMBERS_OF_XERIC, CHAMBERS_OF_XERIC_CHALLENGE_MODE, CHAOS_ELEMENTAL, - CHAOS_FANATIC, COMMANDER_ZILYANA, CORPOREAL_BEAST, - DAGANNOTH_PRIME, DAGANNOTH_REX, DAGANNOTH_SUPREME, - CRAZY_ARCHAEOLOGIST, DERANGED_ARCHAEOLOGIST, GENERAL_GRAARDOR, - GIANT_MOLE, GROTESQUE_GUARDIANS, HESPORI, - KALPHITE_QUEEN, KING_BLACK_DRAGON, KRAKEN, - KREEARRA, KRIL_TSUTSAROTH, MIMIC, - OBOR, SARACHNIS, SCORPIA, - SKOTIZO, THE_GAUNTLET, THE_CORRUPTED_GAUNTLET, - THEATRE_OF_BLOOD, THERMONUCLEAR_SMOKE_DEVIL, TZKAL_ZUK, - TZTOK_JAD, VENENATIS, VETION, - VORKATH, WINTERTODT, ZALCANO, - ZULRAH - ); - - @Inject - ScheduledExecutorService executor; - - @Inject - @Nullable - private Client client; - - private final HiscorePlugin plugin; - - private final IconTextField searchBar; - - // Not an enummap because we need null keys for combat - private final Map skillLabels = new HashMap<>(); - - /* Container of all the selectable endpoints (ironman, deadman, etc) */ - private final MaterialTabGroup tabGroup; - - private final HiscoreClient hiscoreClient = new HiscoreClient(); - - /* The currently selected endpoint */ - private HiscoreEndpoint selectedEndPoint; - - /* Used to prevent users from switching endpoint tabs while the results are loading */ - private boolean loading = false; - - @Inject - public HiscorePanel(HiscorePlugin plugin) - { - super(); - this.plugin = plugin; - - // The layout seems to be ignoring the top margin and only gives it - // a 2-3 pixel margin, so I set the value to 18 to compensate - // TODO: Figure out why this layout is ignoring most of the top margin - setBorder(new EmptyBorder(18, 10, 0, 10)); - setBackground(ColorScheme.DARK_GRAY_COLOR); - setLayout(new GridBagLayout()); - - // Expand sub items to fit width of panel, align to top of panel - GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.HORIZONTAL; - c.gridx = 0; - c.gridy = 0; - c.weightx = 1; - c.weighty = 0; - c.insets = new Insets(0, 0, 10, 0); - - searchBar = new IconTextField(); - searchBar.setIcon(IconTextField.Icon.SEARCH); - searchBar.setPreferredSize(new Dimension(PluginPanel.PANEL_WIDTH - 20, 30)); - searchBar.setBackground(ColorScheme.DARKER_GRAY_COLOR); - searchBar.setHoverBackgroundColor(ColorScheme.DARK_GRAY_HOVER_COLOR); - searchBar.setMinimumSize(new Dimension(0, 30)); - searchBar.addActionListener(e -> executor.execute(this::lookup)); - searchBar.addMouseListener(new MouseAdapter() - { - @Override - public void mouseClicked(MouseEvent e) - { - if (e.getClickCount() != 2) - { - return; - } - if (client == null) - { - return; - } - - Player localPlayer = client.getLocalPlayer(); - - if (localPlayer != null) - { - executor.execute(() -> lookup(localPlayer.getName())); - } - } - }); - - add(searchBar, c); - c.gridy++; - - tabGroup = new MaterialTabGroup(); - tabGroup.setLayout(new GridLayout(1, 5, 7, 7)); - - for (HiscoreEndpoint endpoint : HiscoreEndpoint.values()) - { - final BufferedImage iconImage = ImageUtil.getResourceStreamFromClass(getClass(), endpoint.name().toLowerCase() + ".png"); - - MaterialTab tab = new MaterialTab(new ImageIcon(iconImage), tabGroup, null); - tab.setToolTipText(endpoint.getName() + " Hiscores"); - tab.setOnSelectEvent(() -> - { - if (loading) - { - return false; - } - - selectedEndPoint = endpoint; - return true; - }); - - // Adding the lookup method to a mouseListener instead of the above onSelectedEvent - // Because sometimes you might want to switch the tab, without calling for lookup - // Ex: selecting the normal hiscores as default - tab.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - if (loading) - { - return; - } - - executor.execute(HiscorePanel.this::lookup); - } - }); - - tabGroup.addTab(tab); - } - - // Default selected tab is normal hiscores - resetEndpoints(); - - add(tabGroup, c); - c.gridy++; - - // Panel that holds skill icons - JPanel statsPanel = new JPanel(); - statsPanel.setLayout(new GridLayout(8, 3)); - statsPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - statsPanel.setBorder(new EmptyBorder(5, 0, 5, 0)); - - // For each skill on the ingame skill panel, create a Label and add it to the UI - for (HiscoreSkill skill : SKILLS) - { - JPanel panel = makeHiscorePanel(skill); - statsPanel.add(panel); - } - - add(statsPanel, c); - c.gridy++; - - JPanel totalPanel = new JPanel(); - totalPanel.setLayout(new GridLayout(1, 2)); - totalPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - totalPanel.add(makeHiscorePanel(null)); //combat has no hiscore skill, referred to as null - totalPanel.add(makeHiscorePanel(OVERALL)); - - add(totalPanel, c); - c.gridy++; - - JPanel minigamePanel = new JPanel(); - // These aren't all on one row because when there's a label with four or more digits it causes the details - // panel to change its size for some reason... - minigamePanel.setLayout(new GridLayout(2, 3)); - minigamePanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - minigamePanel.add(makeHiscorePanel(CLUE_SCROLL_ALL)); - minigamePanel.add(makeHiscorePanel(LEAGUE_POINTS)); - minigamePanel.add(makeHiscorePanel(LAST_MAN_STANDING)); - minigamePanel.add(makeHiscorePanel(BOUNTY_HUNTER_ROGUE)); - minigamePanel.add(makeHiscorePanel(BOUNTY_HUNTER_HUNTER)); - - add(minigamePanel, c); - c.gridy++; - - JPanel bossPanel = new JPanel(); - bossPanel.setLayout(new GridLayout(0, 3)); - bossPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - // For each boss on the hi-scores, create a Label and add it to the UI - for (HiscoreSkill skill : BOSSES) - { - JPanel panel = makeHiscorePanel(skill); - bossPanel.add(panel); - } - - add(bossPanel, c); - c.gridy++; - } - - @Override - public void onActivate() - { - super.onActivate(); - searchBar.requestFocusInWindow(); - } - - /* Builds a JPanel displaying an icon and level/number associated with it */ - private JPanel makeHiscorePanel(HiscoreSkill skill) - { - HiscoreSkillType skillType = skill == null ? HiscoreSkillType.SKILL : skill.getType(); - - JLabel label = new JLabel(); - label.setFont(FontManager.getRunescapeSmallFont()); - label.setText(pad("--", skillType)); - - String directory; - if (skill == null || skill == OVERALL) - { - directory = "/skill_icons/"; - } - else if (skill.getType() == HiscoreSkillType.BOSS) - { - directory = "bosses/"; - } - else - { - directory = "/skill_icons_small/"; - } - - String skillName = (skill == null ? "combat" : skill.name().toLowerCase()); - String skillIcon = directory + skillName + ".png"; - log.debug("Loading skill icon from {}", skillIcon); - - label.setIcon(new ImageIcon(ImageUtil.getResourceStreamFromClass(getClass(), skillIcon))); - - boolean totalLabel = skill == HiscoreSkill.OVERALL || skill == null; //overall or combat - label.setIconTextGap(totalLabel ? 10 : 4); - - JPanel skillPanel = new JPanel(); - skillPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - skillPanel.setBorder(new EmptyBorder(2, 0, 2, 0)); - skillLabels.put(skill, label); - skillPanel.add(label); - - return skillPanel; - } - - public void lookup(String username) - { - searchBar.setText(username); - resetEndpoints(); - lookup(); - } - - private void lookup() - { - String lookup = searchBar.getText(); - - lookup = sanitize(lookup); - - if (Strings.isNullOrEmpty(lookup)) - { - return; - } - - /* RuneScape usernames can't be longer than 12 characters long */ - if (lookup.length() > MAX_USERNAME_LENGTH) - { - searchBar.setIcon(IconTextField.Icon.ERROR); - loading = false; - return; - } - - searchBar.setEditable(false); - searchBar.setIcon(IconTextField.Icon.LOADING_DARKER); - loading = true; - - for (Map.Entry entry : skillLabels.entrySet()) - { - HiscoreSkill skill = entry.getKey(); - JLabel label = entry.getValue(); - HiscoreSkillType skillType = skill == null ? HiscoreSkillType.SKILL : skill.getType(); - - label.setText(pad("--", skillType)); - label.setToolTipText(null); - } - - // if for some reason no endpoint was selected, default to normal - if (selectedEndPoint == null) - { - selectedEndPoint = HiscoreEndpoint.NORMAL; - } - - HiscoreResult result; - try - { - log.debug("Hiscore endpoint " + selectedEndPoint.name() + " selected"); - result = hiscoreClient.lookup(lookup, selectedEndPoint); - } - catch (IOException ex) - { - log.warn("Error fetching Hiscore data " + ex.getMessage()); - searchBar.setIcon(IconTextField.Icon.ERROR); - searchBar.setEditable(true); - loading = false; - return; - } - - if (result == null) - { - searchBar.setIcon(IconTextField.Icon.ERROR); - searchBar.setEditable(true); - loading = false; - return; - } - - //successful player search - searchBar.setIcon(IconTextField.Icon.SEARCH); - searchBar.setEditable(true); - loading = false; - - for (Map.Entry entry : skillLabels.entrySet()) - { - HiscoreSkill skill = entry.getKey(); - JLabel label = entry.getValue(); - Skill s; - - if (skill == null) - { - if (result.getPlayer() != null) - { - int combatLevel = Experience.getCombatLevel( - result.getAttack().getLevel(), - result.getStrength().getLevel(), - result.getDefence().getLevel(), - result.getHitpoints().getLevel(), - result.getMagic().getLevel(), - result.getRanged().getLevel(), - result.getPrayer().getLevel() - ); - label.setText(Integer.toString(combatLevel)); - } - } - else if ((s = result.getSkill(skill)) != null) - { - final long exp = s.getExperience(); - final boolean isSkill = skill.getType() == HiscoreSkillType.SKILL; - int level = -1; - if (plugin.isVirtualLevels() && isSkill && exp > -1L) - { - level = Experience.getLevelForXp((int) exp); - } - else if (!isSkill || exp != -1L) - { - // for skills, level is only valid if exp is not -1 - // otherwise level is always valid - level = s.getLevel(); - } - - if (level != -1) - { - label.setText(pad(formatLevel(level), skill.getType())); - } - } - - label.setToolTipText(detailsHtml(result, skill)); - } - } - - void addInputKeyListener(KeyListener l) - { - this.searchBar.addKeyListener(l); - } - - void removeInputKeyListener(KeyListener l) - { - this.searchBar.removeKeyListener(l); - } - - /* - Builds a html string to display on tooltip (when hovering a skill). - */ - private String detailsHtml(HiscoreResult result, HiscoreSkill skill) - { - String openingTags = ""; - String closingTags = ""; - - String content = ""; - - if (skill == null) - { - double combatLevel = Experience.getCombatLevelPrecise( - result.getAttack().getLevel(), - result.getStrength().getLevel(), - result.getDefence().getLevel(), - result.getHitpoints().getLevel(), - result.getMagic().getLevel(), - result.getRanged().getLevel(), - result.getPrayer().getLevel() - ); - - double combatExperience = result.getAttack().getExperience() - + result.getStrength().getExperience() + result.getDefence().getExperience() - + result.getHitpoints().getExperience() + result.getMagic().getExperience() - + result.getRanged().getExperience() + result.getPrayer().getExperience(); - - content += "

Skill: Combat

"; - content += "

Exact Combat Level: " + QuantityFormatter.formatNumber(combatLevel) + "

"; - content += "

Experience: " + QuantityFormatter.formatNumber(combatExperience) + "

"; - } - else - { - switch (skill) - { - case CLUE_SCROLL_ALL: - { - String allRank = (result.getClueScrollAll().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollAll().getRank()); - String beginnerRank = (result.getClueScrollBeginner().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollBeginner().getRank()); - String easyRank = (result.getClueScrollEasy().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollEasy().getRank()); - String mediumRank = (result.getClueScrollMedium().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollMedium().getRank()); - String hardRank = (result.getClueScrollHard().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollHard().getRank()); - String eliteRank = (result.getClueScrollElite().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollElite().getRank()); - String masterRank = (result.getClueScrollMaster().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollMaster().getRank()); - String all = (result.getClueScrollAll().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollAll().getLevel())); - String beginner = (result.getClueScrollBeginner().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollBeginner().getLevel())); - String easy = (result.getClueScrollEasy().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollEasy().getLevel())); - String medium = (result.getClueScrollMedium().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollMedium().getLevel())); - String hard = (result.getClueScrollHard().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollHard().getLevel())); - String elite = (result.getClueScrollElite().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollElite().getLevel())); - String master = (result.getClueScrollMaster().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollMaster().getLevel())); - content += "

All: " + all + " Rank: " + allRank + "

"; - content += "

Beginner: " + beginner + " Rank: " + beginnerRank + "

"; - content += "

Easy: " + easy + " Rank: " + easyRank + "

"; - content += "

Medium: " + medium + " Rank: " + mediumRank + "

"; - content += "

Hard: " + hard + " Rank: " + hardRank + "

"; - content += "

Elite: " + elite + " Rank: " + eliteRank + "

"; - content += "

Master: " + master + " Rank: " + masterRank + "

"; - break; - } - case BOUNTY_HUNTER_ROGUE: - { - Skill bountyHunterRogue = result.getBountyHunterRogue(); - String rank = (bountyHunterRogue.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(bountyHunterRogue.getRank()); - content += "

Rank: " + rank + "

"; - if (bountyHunterRogue.getLevel() > -1) - { - content += "

Score: " + QuantityFormatter.formatNumber(bountyHunterRogue.getLevel()) + "

"; - } - break; - } - case BOUNTY_HUNTER_HUNTER: - { - Skill bountyHunterHunter = result.getBountyHunterHunter(); - String rank = (bountyHunterHunter.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(bountyHunterHunter.getRank()); - content += "

Rank: " + rank + "

"; - if (bountyHunterHunter.getLevel() > -1) - { - content += "

Score: " + QuantityFormatter.formatNumber(bountyHunterHunter.getLevel()) + "

"; - } - break; - } - case LAST_MAN_STANDING: - { - Skill lastManStanding = result.getLastManStanding(); - String rank = (lastManStanding.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(lastManStanding.getRank()); - content += "

Rank: " + rank + "

"; - if (lastManStanding.getLevel() > -1) - { - content += "

Score: " + QuantityFormatter.formatNumber(lastManStanding.getLevel()) + "

"; - } - break; - } - case LEAGUE_POINTS: - { - Skill leaguePoints = result.getLeaguePoints(); - String rank = (leaguePoints.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(leaguePoints.getRank()); - content += "

Rank: " + rank + "

"; - if (leaguePoints.getLevel() > -1) - { - content += "

Points: " + QuantityFormatter.formatNumber(leaguePoints.getLevel()) + "

"; - } - break; - } - case OVERALL: - { - Skill requestedSkill = result.getSkill(skill); - String rank = (requestedSkill.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(requestedSkill.getRank()); - String exp = (requestedSkill.getExperience() == -1L) ? "Unranked" : QuantityFormatter.formatNumber(requestedSkill.getExperience()); - content += "

Skill: " + skill.getName() + "

"; - content += "

Rank: " + rank + "

"; - content += "

Experience: " + exp + "

"; - break; - } - default: - { - if (skill.getType() == HiscoreSkillType.BOSS) - { - Skill requestedSkill = result.getSkill(skill); - String rank = "Unranked"; - String lvl = "0"; - if (requestedSkill != null) - { - rank = (requestedSkill.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(requestedSkill.getRank()); - lvl = (requestedSkill.getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(requestedSkill.getLevel())); - } - content += "

Boss: " + skill.getName() + "

"; - content += "

Rank: " + rank + "

"; - content += "

KC: " + lvl + "

"; - } - else - { - Skill requestedSkill = result.getSkill(skill); - final long experience = requestedSkill.getExperience(); - - String rank = (requestedSkill.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(requestedSkill.getRank()); - String exp = (experience == -1L) ? "Unranked" : QuantityFormatter.formatNumber(experience); - String remainingXp; - if (experience == -1L) - { - remainingXp = "Unranked"; - } - else - { - int currentLevel = Experience.getLevelForXp((int) experience); - remainingXp = (currentLevel + 1 <= Experience.MAX_VIRT_LEVEL) ? QuantityFormatter.formatNumber(Experience.getXpForLevel(currentLevel + 1) - experience) : "0"; - } - - content += "

Skill: " + skill.getName() + "

"; - content += "

Rank: " + rank + "

"; - content += "

Experience: " + exp + "

"; - content += "

Remaining XP: " + remainingXp + "

"; - } - break; - } - } - } - - // Add a html progress bar to the hover information - if (skill != null && skill.getType() == HiscoreSkillType.SKILL) - { - long experience = 0; - if (skill != null) - { - experience = result.getSkill(skill).getExperience(); - } - if (experience >= 0) - { - int currentXp = (int) experience; - int currentLevel = Experience.getLevelForXp(currentXp); - int xpForCurrentLevel = Experience.getXpForLevel(currentLevel); - int xpForNextLevel = currentLevel + 1 <= Experience.MAX_VIRT_LEVEL ? Experience.getXpForLevel(currentLevel + 1) : -1; - - double xpGained = currentXp - xpForCurrentLevel; - double xpGoal = xpForNextLevel != -1 ? xpForNextLevel - xpForCurrentLevel : 100; - int progress = (int) ((xpGained / xpGoal) * 100f); - - // had to wrap the bar with an empty div, if i added the margin directly to the bar, it would mess up - content += "
" - + "
" - + "
" - + "
" - + "
" - + "
"; - } - } - - return openingTags + content + closingTags; - } - - private static String sanitize(String lookup) - { - return lookup.replace('\u00A0', ' '); - } - - private void resetEndpoints() - { - // Select the correct tab based on the world type. - tabGroup.select(tabGroup.getTab(selectWorldEndpoint().ordinal())); - } - - private HiscoreEndpoint selectWorldEndpoint() - { - if (client != null) - { - EnumSet wTypes = client.getWorldType(); - - if (wTypes.contains(WorldType.DEADMAN)) - { - return HiscoreEndpoint.DEADMAN; - } - else if (wTypes.contains(WorldType.LEAGUE)) - { - return HiscoreEndpoint.LEAGUE; - } - } - return HiscoreEndpoint.NORMAL; - } - - @VisibleForTesting - static String formatLevel(int level) - { - if (level < 10000) - { - return Integer.toString(level); - } - else - { - return (level / 1000) + "k"; - } - } - - private static String pad(String str, HiscoreSkillType type) - { - // Left pad label text to keep labels aligned - int pad = type == HiscoreSkillType.BOSS ? 4 : 2; - return StringUtils.leftPad(str, pad); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePlugin.java deleted file mode 100644 index a329333e0e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePlugin.java +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Copyright (c) 2017, 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.hiscore; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ObjectArrays; -import com.google.inject.Provides; -import java.awt.image.BufferedImage; -import java.lang.reflect.InvocationTargetException; -import java.util.concurrent.ScheduledExecutorService; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.annotation.Nullable; -import javax.inject.Inject; -import javax.inject.Provider; -import javax.inject.Singleton; -import javax.swing.SwingUtilities; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.MenuEntry; -import net.runelite.api.MenuOpcode; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.PlayerMenuOptionClicked; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.util.ImageUtil; -import org.apache.commons.lang3.ArrayUtils; - -@PluginDescriptor( - name = "HiScore", - description = "Enable the HiScore panel and an optional Lookup option on players", - tags = {"panel", "players"}, - loadWhenOutdated = true, - type = PluginType.MISCELLANEOUS -) -@Singleton -public class HiscorePlugin extends Plugin -{ - private static final String LOOKUP = "Lookup"; - private static final String KICK_OPTION = "Kick"; - private static final ImmutableList AFTER_OPTIONS = ImmutableList.of("Message", "Add ignore", "Remove friend", "Delete", KICK_OPTION); - private static final Pattern BOUNTY_PATTERN = Pattern.compile("You've been assigned a target: (.*)"); - - // config - private boolean playerOption; - private boolean menuOption; - @Getter(AccessLevel.PACKAGE) - private boolean virtualLevels; - private boolean autocomplete; - private boolean bountyLookup; - - @Inject - @Nullable - private Client client; - - @Inject - private Provider menuManager; - - @Inject - private ClientToolbar clientToolbar; - - @Inject - private ScheduledExecutorService executor; - - @Inject - private HiscoreConfig config; - - private NavigationButton navButton; - private HiscorePanel hiscorePanel; - - @Inject - private NameAutocompleter autocompleter; - - @Provides - HiscoreConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(HiscoreConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - hiscorePanel = injector.getInstance(HiscorePanel.class); - - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "normal.png"); - - navButton = NavigationButton.builder() - .tooltip("Hiscore") - .icon(icon) - .priority(5) - .panel(hiscorePanel) - .build(); - - clientToolbar.addNavigation(navButton); - - if (this.playerOption && client != null) - { - menuManager.get().addPlayerMenuItem(LOOKUP); - } - if (this.autocomplete) - { - hiscorePanel.addInputKeyListener(autocompleter); - } - } - - @Override - protected void shutDown() - { - hiscorePanel.removeInputKeyListener(autocompleter); - clientToolbar.removeNavigation(navButton); - - if (client != null) - { - menuManager.get().removePlayerMenuItem(LOOKUP); - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - - if (!event.getGroup().equals("hiscore")) - { - return; - } - updateConfig(); - if (client != null) - { - menuManager.get().removePlayerMenuItem(LOOKUP); - - if (this.playerOption) - { - menuManager.get().addPlayerMenuItem(LOOKUP); - } - } - - if (event.getKey().equals("autocomplete")) - { - if (this.autocomplete) - { - hiscorePanel.addInputKeyListener(autocompleter); - } - else - { - hiscorePanel.removeInputKeyListener(autocompleter); - } - } - } - - - @Subscribe - private void onMenuEntryAdded(MenuEntryAdded event) - { - if (!this.menuOption) - { - return; - } - - int groupId = WidgetInfo.TO_GROUP(event.getParam1()); - String option = event.getOption(); - - if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() || groupId == WidgetInfo.CLAN_CHAT.getGroupId() || - groupId == WidgetInfo.CHATBOX.getGroupId() && !KICK_OPTION.equals(option) || //prevent from adding for Kick option (interferes with the raiding party one) - groupId == WidgetInfo.RAIDING_PARTY.getGroupId() || groupId == WidgetInfo.PRIVATE_CHAT_MESSAGE.getGroupId() || - groupId == WidgetInfo.IGNORE_LIST.getGroupId()) - { - if (!AFTER_OPTIONS.contains(option) || (option.equals("Delete") && groupId != WidgetInfo.IGNORE_LIST.getGroupId())) - { - return; - } - - final MenuEntry lookup = new MenuEntry(); - lookup.setOption(LOOKUP); - lookup.setTarget(event.getTarget()); - lookup.setOpcode(MenuOpcode.RUNELITE.getId()); - lookup.setParam0(event.getParam0()); - lookup.setParam1(event.getParam1()); - lookup.setIdentifier(event.getIdentifier()); - - if (client != null) - { - insertMenuEntry(lookup, client.getMenuEntries()); - } - } - } - - @Subscribe - private void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event) - { - if (event.getMenuOption().equals(LOOKUP)) - { - lookupPlayer(Text.removeTags(event.getMenuTarget())); - } - } - - @Subscribe - private void onChatMessage(ChatMessage event) - { - if (!this.bountyLookup || !event.getType().equals(ChatMessageType.GAMEMESSAGE)) - { - return; - } - - String message = event.getMessage(); - Matcher m = BOUNTY_PATTERN.matcher(message); - if (m.matches()) - { - lookupPlayer(m.group(1)); - } - } - - private void updateConfig() - { - this.playerOption = config.playerOption(); - this.menuOption = config.menuOption(); - this.virtualLevels = config.virtualLevels(); - this.autocomplete = config.autocomplete(); - this.bountyLookup = config.bountyLookup(); - } - - private void insertMenuEntry(MenuEntry newEntry, MenuEntry[] entries) - { - MenuEntry[] newMenu = ObjectArrays.concat(entries, newEntry); - int menuEntryCount = newMenu.length; - ArrayUtils.swap(newMenu, menuEntryCount - 1, menuEntryCount - 2); - if (client != null) - { - client.setMenuEntries(newMenu); - } - } - - private void lookupPlayer(String playerName) - { - executor.execute(() -> - { - try - { - SwingUtilities.invokeAndWait(() -> - { - if (!navButton.isSelected()) - { - navButton.getOnSelect().run(); - } - }); - } - catch (InterruptedException | InvocationTargetException e) - { - throw new RuntimeException(e); - } - - hiscorePanel.lookup(playerName); - }); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/NameAutocompleter.java b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/NameAutocompleter.java deleted file mode 100644 index bf23f9190f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/NameAutocompleter.java +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Copyright (c) 2018, John Pettenger - * 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.hiscore; - -import com.google.inject.Inject; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.util.Arrays; -import java.util.Objects; -import java.util.Optional; -import java.util.regex.Pattern; -import javax.annotation.Nullable; -import javax.swing.SwingUtilities; -import javax.swing.text.BadLocationException; -import javax.swing.text.Document; -import javax.swing.text.JTextComponent; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ClanMember; -import net.runelite.api.Client; -import net.runelite.api.Friend; -import net.runelite.api.Player; - -@Slf4j -class NameAutocompleter implements KeyListener -{ - /** - * Non-breaking space character. - */ - private static final String NBSP = Character.toString((char) 160); - - /** - * Character class for characters that cannot be in an RSN. - */ - private static final Pattern INVALID_CHARS = Pattern.compile("[^a-zA-Z0-9_ -]"); - - private final Client client; - - /** - * The name currently being autocompleted. - */ - private String autocompleteName; - - /** - * Pattern for the name currently being autocompleted. - */ - private Pattern autocompleteNamePattern; - - @Inject - private NameAutocompleter(@Nullable final Client client) - { - this.client = client; - } - - @Override - public void keyPressed(KeyEvent e) - { - - } - - @Override - public void keyReleased(KeyEvent e) - { - - } - - @Override - public void keyTyped(KeyEvent e) - { - final JTextComponent input = (JTextComponent) e.getSource(); - final String inputText = input.getText(); - - // Only autocomplete if the selection end is at the end of the text. - if (input.getSelectionEnd() != inputText.length()) - { - return; - } - - // Character to be inserted at the selection start. - final String charToInsert = Character.toString(e.getKeyChar()); - - // Don't attempt to autocomplete if the name is invalid. - // This condition is also true when the user presses a key like backspace. - if (INVALID_CHARS.matcher(charToInsert).find() - || INVALID_CHARS.matcher(inputText).find()) - { - return; - } - - // Check if we are already autocompleting. - if (autocompleteName != null && autocompleteNamePattern.matcher(inputText).matches()) - { - if (isExpectedNext(input, charToInsert)) - { - try - { - // Insert the character and move the selection. - final int insertIndex = input.getSelectionStart(); - Document doc = input.getDocument(); - doc.remove(insertIndex, 1); - doc.insertString(insertIndex, charToInsert, null); - input.select(insertIndex + 1, input.getSelectionEnd()); - } - catch (BadLocationException ex) - { - log.warn("Could not insert character.", ex); - } - - // Prevent default behavior. - e.consume(); - } - else // Character to insert does not match current autocompletion. Look for another name. - { - newAutocomplete(e); - } - } - else // Search for a name to autocomplete - { - newAutocomplete(e); - } - } - - private void newAutocomplete(KeyEvent e) - { - final JTextComponent input = (JTextComponent) e.getSource(); - final String inputText = input.getText(); - final String nameStart = inputText.substring(0, input.getSelectionStart()) + e.getKeyChar(); - - if (findAutocompleteName(nameStart)) - { - // Assert this.autocompleteName != null - final String name = this.autocompleteName; - SwingUtilities.invokeLater(() -> - { - try - { - input.getDocument().insertString( - nameStart.length(), - name.substring(nameStart.length()), - null); - input.select(nameStart.length(), name.length()); - } - catch (BadLocationException ex) - { - log.warn("Could not autocomplete name.", ex); - } - }); - } - } - - private boolean findAutocompleteName(String nameStart) - { - final Pattern pattern; - Optional autocompleteName; - - // Pattern to match names that start with nameStart. - // Allows spaces to be represented as common whitespaces, underscores, - // hyphens, or non-breaking spaces. - // Matching non-breaking spaces is necessary because the API - // returns non-breaking spaces when a name has whitespace. - pattern = Pattern.compile( - "(?i)^" + nameStart.replaceAll("[ _-]", "[ _" + NBSP + "-]") + ".+?"); - - if (client == null) - { - return false; - } - - autocompleteName = Optional.empty(); - - // TODO: Search lookup history - - Friend[] friends = client.getFriends(); - if (friends != null) - { - autocompleteName = Arrays.stream(friends) - .filter(Objects::nonNull) - .map(Friend::getName) - .filter(n -> pattern.matcher(n).matches()) - .findFirst(); - } - - // Search clan if a friend wasn't found - if (!autocompleteName.isPresent()) - { - final ClanMember[] clannies = client.getClanMembers(); - if (clannies != null) - { - autocompleteName = Arrays.stream(clannies) - .filter(Objects::nonNull) - .map(ClanMember::getUsername) - .filter(n -> pattern.matcher(n).matches()) - .findFirst(); - } - } - - // Search cached players if a clannie wasn't found. - if (!autocompleteName.isPresent()) - { - final Player[] cachedPlayers = client.getCachedPlayers(); - autocompleteName = Arrays.stream(cachedPlayers) - .filter(Objects::nonNull) - .map(Player::getName) - .filter(n -> pattern.matcher(n).matches()) - .findFirst(); - } - - if (autocompleteName.isPresent()) - { - this.autocompleteName = autocompleteName.get().replace(NBSP, " "); - this.autocompleteNamePattern = Pattern.compile( - "(?i)^" + this.autocompleteName.replaceAll("[ _-]", "[ _-]") + "$"); - } - else - { - this.autocompleteName = null; - this.autocompleteNamePattern = null; - } - - return autocompleteName.isPresent(); - } - - private boolean isExpectedNext(JTextComponent input, String nextChar) - { - String expected; - if (input.getSelectionStart() < input.getSelectionEnd()) - { - try - { - expected = input.getText(input.getSelectionStart(), 1); - } - catch (BadLocationException ex) - { - log.warn("Could not get first character from input selection.", ex); - return false; - } - } - else - { - expected = ""; - } - return nextChar.equalsIgnoreCase(expected); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hunter/HunterConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/hunter/HunterConfig.java deleted file mode 100644 index 87df9baadd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hunter/HunterConfig.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2017, Robin Weymans - * 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.hunter; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("hunterplugin") -public interface HunterConfig extends Config -{ - @ConfigItem( - position = 1, - keyName = "hexColorOpenTrap", - name = "Open trap", - description = "Color of open trap timer" - ) - default Color getOpenTrapColor() - { - return Color.YELLOW; - } - - @ConfigItem( - position = 2, - keyName = "hexColorFullTrap", - name = "Full trap", - description = "Color of full trap timer" - ) - default Color getFullTrapColor() - { - return Color.GREEN; - } - - @ConfigItem( - position = 3, - keyName = "hexColorEmptyTrap", - name = "Empty trap", - description = "Color of empty trap timer" - ) - default Color getEmptyTrapColor() - { - return Color.RED; - } - - @ConfigItem( - position = 4, - keyName = "hexColorTransTrap", - name = "Transitioning trap", - description = "Color of transitioning trap timer" - ) - default Color getTransTrapColor() - { - return Color.ORANGE; - } - - @ConfigItem( - position = 5, - keyName = "maniacalMonkeyNotify", - name = "Maniacal monkey notification", - description = "Send notification when maniacal monkey is caught or you fail to catch." - ) - default boolean maniacalMonkeyNotify() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hunter/HunterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/hunter/HunterPlugin.java deleted file mode 100644 index 7fd25e2b7d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hunter/HunterPlugin.java +++ /dev/null @@ -1,416 +0,0 @@ -/* - * Copyright (c) 2017, Robin Weymans - * 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.hunter; - -import com.google.inject.Provides; -import java.awt.Color; -import java.time.Instant; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.ObjectID; -import net.runelite.api.Player; -import net.runelite.api.Tile; -import net.runelite.api.coords.Direction; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GameTick; -import net.runelite.client.Notifier; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@Slf4j -@PluginDescriptor( - name = "Hunter", - description = "Show the state of your traps", - tags = {"overlay", "skilling", "timers"}, - type = PluginType.SKILLING -) -@Singleton -public class HunterPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private TrapOverlay overlay; - - @Inject - private Notifier notifier; - - @Inject - private HunterConfig config; - - @Getter(AccessLevel.PACKAGE) - private final Map traps = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private Instant lastActionTime = Instant.ofEpochMilli(0); - - private WorldPoint lastTickLocalPlayerLocation; - - @Getter(AccessLevel.PACKAGE) - private Color getOpenTrapColor; - @Getter(AccessLevel.PACKAGE) - private Color getFullTrapColor; - @Getter(AccessLevel.PACKAGE) - private Color getEmptyTrapColor; - @Getter(AccessLevel.PACKAGE) - private Color getTransTrapColor; - private boolean maniacalMonkeyNotify; - - @Provides - HunterConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(HunterConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - overlay.updateConfig(); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - lastActionTime = Instant.ofEpochMilli(0); - traps.clear(); - } - - @Subscribe - private void onGameObjectSpawned(GameObjectSpawned event) - { - final GameObject gameObject = event.getGameObject(); - final WorldPoint trapLocation = gameObject.getWorldLocation(); - final HunterTrap myTrap = traps.get(trapLocation); - final Player localPlayer = client.getLocalPlayer(); - - switch (gameObject.getId()) - { - /* - * ------------------------------------------------------------------------------ - * Placing traps - * ------------------------------------------------------------------------------ - */ - case ObjectID.DEADFALL: // Deadfall trap placed - case ObjectID.MONKEY_TRAP: // Maniacal monkey trap placed - // If player is right next to "object" trap assume that player placed the trap - if (localPlayer.getWorldLocation().distanceTo(trapLocation) <= 2) - { - log.debug("Trap placed by \"{}\" on {}", localPlayer.getName(), trapLocation); - traps.put(trapLocation, new HunterTrap(gameObject)); - lastActionTime = Instant.now(); - } - break; - - case ObjectID.MAGIC_BOX: // Imp box placed - case ObjectID.BOX_TRAP_9380: // Box trap placed - case ObjectID.BIRD_SNARE_9345: // Bird snare placed - // If the player is on that tile, assume he is the one that placed the trap - // Note that a player can move and set up a trap in the same tick, and this - // event runs after the player movement has been updated, so we need to - // compare to the trap location to the last location of the player. - if (lastTickLocalPlayerLocation != null - && trapLocation.distanceTo(lastTickLocalPlayerLocation) == 0) - { - log.debug("Trap placed by \"{}\" on {}", localPlayer.getName(), localPlayer.getWorldLocation()); - traps.put(trapLocation, new HunterTrap(gameObject)); - lastActionTime = Instant.now(); - } - break; - - case ObjectID.NET_TRAP_9343: // Net trap placed at green sallys - case ObjectID.NET_TRAP: // Net trap placed at orange sallys - case ObjectID.NET_TRAP_8992: // Net trap placed at red sallys - case ObjectID.NET_TRAP_9002: // Net trap placed at black sallys - if (lastTickLocalPlayerLocation != null - && trapLocation.distanceTo(lastTickLocalPlayerLocation) == 0) - { - // Net traps facing to the north and east must have their tile translated. - // As otherwise, the wrong tile is stored. - Direction trapOrientation = gameObject.getOrientation().getNearestDirection(); - WorldPoint translatedTrapLocation = trapLocation; - - switch (trapOrientation) - { - case NORTH: - translatedTrapLocation = trapLocation.dy(1); - break; - case EAST: - translatedTrapLocation = trapLocation.dx(1); - break; - } - - log.debug("Trap placed by \"{}\" on {}", localPlayer.getName(), translatedTrapLocation); - traps.put(translatedTrapLocation, new HunterTrap(gameObject)); - lastActionTime = Instant.now(); - } - break; - - /* - * ------------------------------------------------------------------------------ - * Catching stuff - * ------------------------------------------------------------------------------ - */ - case ObjectID.MAGIC_BOX_19226: // Imp caught - case ObjectID.SHAKING_BOX: // Black chinchompa caught - case ObjectID.SHAKING_BOX_9382: // Grey chinchompa caught - case ObjectID.SHAKING_BOX_9383: // Red chinchompa caught - case ObjectID.SHAKING_BOX_9384: // Ferret caught - case ObjectID.BOULDER_20648: // Prickly kebbit caught - case ObjectID.BOULDER_20649: // Sabre-tooth kebbit caught - case ObjectID.BOULDER_20650: // Barb-tailed kebbit caught - case ObjectID.BOULDER_20651: // Wild kebbit caught - case ObjectID.BIRD_SNARE_9373: // Crimson swift caught - case ObjectID.BIRD_SNARE_9375: // Cerulean twitch caught - case ObjectID.BIRD_SNARE_9377: // Golden warbler caught - case ObjectID.BIRD_SNARE_9379: // Copper longtail caught - case ObjectID.BIRD_SNARE_9348: // Tropical wagtail caught - case ObjectID.NET_TRAP_9004: // Green sally caught - case ObjectID.NET_TRAP_8986: // Red sally caught - case ObjectID.NET_TRAP_8734: // Orange sally caught - case ObjectID.NET_TRAP_8996: // Black sally caught - case ObjectID.LARGE_BOULDER_28830: // Maniacal monkey tail obtained - case ObjectID.LARGE_BOULDER_28831: // Maniacal monkey tail obtained - if (myTrap != null) - { - myTrap.setState(HunterTrap.State.FULL); - myTrap.resetTimer(); - lastActionTime = Instant.now(); - - if (this.maniacalMonkeyNotify && myTrap.getObjectId() == ObjectID.MONKEY_TRAP) - { - notifier.notify("You've caught part of a monkey's tail."); - } - } - - break; - /* - * ------------------------------------------------------------------------------ - * Failed catch - * ------------------------------------------------------------------------------ - */ - case ObjectID.MAGIC_BOX_FAILED: //Empty imp box - case ObjectID.BOX_TRAP_9385: //Empty box trap - case ObjectID.BIRD_SNARE: //Empty box trap - if (myTrap != null) - { - myTrap.setState(HunterTrap.State.EMPTY); - myTrap.resetTimer(); - lastActionTime = Instant.now(); - } - - break; - /* - * ------------------------------------------------------------------------------ - * Transitions - * ------------------------------------------------------------------------------ - */ - // Imp entering box - case ObjectID.MAGIC_BOX_19225: - - // Black chin shaking box - case ObjectID.BOX_TRAP: - case ObjectID.BOX_TRAP_2026: - case ObjectID.BOX_TRAP_2028: - case ObjectID.BOX_TRAP_2029: - - // Red chin shaking box - case ObjectID.BOX_TRAP_9381: - case ObjectID.BOX_TRAP_9390: - case ObjectID.BOX_TRAP_9391: - case ObjectID.BOX_TRAP_9392: - case ObjectID.BOX_TRAP_9393: - - // Grey chin shaking box - case ObjectID.BOX_TRAP_9386: - case ObjectID.BOX_TRAP_9387: - case ObjectID.BOX_TRAP_9388: - - // Ferret shaking box - case ObjectID.BOX_TRAP_9394: - case ObjectID.BOX_TRAP_9396: - case ObjectID.BOX_TRAP_9397: - - // Bird traps - case ObjectID.BIRD_SNARE_9346: - case ObjectID.BIRD_SNARE_9347: - case ObjectID.BIRD_SNARE_9349: - case ObjectID.BIRD_SNARE_9374: - case ObjectID.BIRD_SNARE_9376: - case ObjectID.BIRD_SNARE_9378: - - // Deadfall trap - case ObjectID.DEADFALL_19218: - case ObjectID.DEADFALL_19851: - case ObjectID.DEADFALL_20128: - case ObjectID.DEADFALL_20129: - case ObjectID.DEADFALL_20130: - case ObjectID.DEADFALL_20131: - - // Net trap - case ObjectID.NET_TRAP_9003: - case ObjectID.NET_TRAP_9005: - case ObjectID.NET_TRAP_8972: - case ObjectID.NET_TRAP_8974: - case ObjectID.NET_TRAP_8985: - case ObjectID.NET_TRAP_8987: - case ObjectID.NET_TRAP_8993: - case ObjectID.NET_TRAP_8997: - - // Maniacal monkey boulder trap - case ObjectID.MONKEY_TRAP_28828: - case ObjectID.MONKEY_TRAP_28829: - if (myTrap != null) - { - myTrap.setState(HunterTrap.State.TRANSITION); - } - break; - } - } - - /** - * Iterates over all the traps that were placed by the local player and - * checks if the trap is still there. If the trap is gone, it removes - * the trap from the local players trap collection. - */ - @Subscribe - private void onGameTick(GameTick event) - { - // Check if all traps are still there, and remove the ones that are not. - Iterator> it = traps.entrySet().iterator(); - Tile[][][] tiles = client.getScene().getTiles(); - - Instant expire = Instant.now().minus(HunterTrap.TRAP_TIME.multipliedBy(2)); - - while (it.hasNext()) - { - Map.Entry entry = it.next(); - HunterTrap trap = entry.getValue(); - WorldPoint world = entry.getKey(); - LocalPoint local = LocalPoint.fromWorld(client, world); - - // Not within the client's viewport - if (local == null) - { - // Cull very old traps - if (trap.getPlacedOn().isBefore(expire)) - { - log.debug("Trap removed from personal trap collection due to timeout, {} left", traps.size()); - it.remove(); - continue; - } - continue; - } - - Tile tile = tiles[world.getPlane()][local.getSceneX()][local.getSceneY()]; - GameObject[] objects = tile.getGameObjects(); - - boolean containsBoulder = false; - boolean containsAnything = false; - boolean containsYoungTree = false; - for (GameObject object : objects) - { - if (object != null) - { - containsAnything = true; - if (object.getId() == ObjectID.BOULDER_19215 || object.getId() == ObjectID.LARGE_BOULDER) - { - containsBoulder = true; - break; - } - - // Check for young trees (used while catching salamanders) in the tile. - // Otherwise, hunter timers will never disappear after a trap is dismantled - if (object.getId() == ObjectID.YOUNG_TREE_8732 || object.getId() == ObjectID.YOUNG_TREE_8990 || - object.getId() == ObjectID.YOUNG_TREE_9000 || object.getId() == ObjectID.YOUNG_TREE_9341) - { - containsYoungTree = true; - } - } - } - - if (!containsAnything || containsYoungTree) - { - it.remove(); - log.debug("Trap removed from personal trap collection, {} left", traps.size()); - } - else if (containsBoulder) // For traps like deadfalls. This is different because when the trap is gone, there is still a GameObject (boulder) - { - it.remove(); - log.debug("Special trap removed from personal trap collection, {} left", traps.size()); - - // Case we have notifications enabled and the action was not manual, throw notification - if (config.maniacalMonkeyNotify() && trap.getObjectId() == ObjectID.MONKEY_TRAP && - !trap.getState().equals(HunterTrap.State.FULL) && !trap.getState().equals(HunterTrap.State.OPEN)) - { - notifier.notify("The monkey escaped."); - } - } - } - - lastTickLocalPlayerLocation = client.getLocalPlayer().getWorldLocation(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("hunterplugin")) - { - updateConfig(); - overlay.updateConfig(); - } - } - - private void updateConfig() - { - this.getOpenTrapColor = config.getOpenTrapColor(); - this.getFullTrapColor = config.getFullTrapColor(); - this.getEmptyTrapColor = config.getEmptyTrapColor(); - this.getTransTrapColor = config.getTransTrapColor(); - this.maniacalMonkeyNotify = config.maniacalMonkeyNotify(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hunter/HunterTrap.java b/runelite-client/src/main/java/net/runelite/client/plugins/hunter/HunterTrap.java deleted file mode 100644 index 3312a5a4f7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hunter/HunterTrap.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2017, Robin Weymans - * 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.hunter; - -import java.time.Duration; -import java.time.Instant; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.GameObject; -import net.runelite.api.coords.WorldPoint; - -/** - * Wrapper class for a GameObject that represents a hunter trap. - */ -class HunterTrap -{ - /** - * A hunter trap stays up 1 minute before collapsing. - */ - static final Duration TRAP_TIME = Duration.ofMinutes(1); - - /** - * The time in milliseconds when the trap was placed. - */ - @Getter(AccessLevel.PACKAGE) - private Instant placedOn; - - /** - * The state of the trap. - */ - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private State state; - - /** - * The ID of the game object this is representing - */ - @Getter(AccessLevel.PACKAGE) - private int objectId; - - @Getter(AccessLevel.PACKAGE) - private WorldPoint worldLocation; - - /** - * The states a trap can be in. - */ - enum State - { - /** - * A laid out trap. - */ - OPEN, - /** - * A trap that is empty. - */ - EMPTY, - /** - * A trap that caught something. - */ - FULL, - /** - * A trap that is closing. - */ - TRANSITION - } - - /** - * Constructor for a HunterTrap object - * - * @param gameObject The gameobject thats corresponds with this trap. - */ - HunterTrap(final GameObject gameObject) - { - this.state = State.OPEN; - this.placedOn = Instant.now(); - this.objectId = gameObject.getId(); - this.worldLocation = gameObject.getWorldLocation(); - } - - /** - * Calculates how much time is left before the trap is collapsing. - * - * @return Value between 0 and 1. 0 means the trap was laid moments ago. - * 1 is a trap that's about to collapse. - */ - double getTrapTimeRelative() - { - Duration duration = Duration.between(placedOn, Instant.now()); - return duration.compareTo(TRAP_TIME) < 0 ? (double) duration.toMillis() / TRAP_TIME.toMillis() : 1; - } - - /** - * Resets the time value when the trap was placed. - */ - void resetTimer() - { - placedOn = Instant.now(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hunter/TrapOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/hunter/TrapOverlay.java deleted file mode 100644 index cb774336d4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hunter/TrapOverlay.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2017, Robin Weymans - * 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.hunter; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -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.components.ProgressPieComponent; - -/** - * Represents the overlay that shows timers on traps that are placed by the - * player. - */ -@Singleton -public class TrapOverlay extends Overlay -{ - /** - * The timer is low when only 25% is left. - */ - private static final double TIMER_LOW = 0.25; // When the timer is under a quarter left, if turns red. - - private final Client client; - private final HunterPlugin plugin; - - private Color colorOpen, colorOpenBorder; - private Color colorEmpty, colorEmptyBorder; - private Color colorFull, colorFullBorder; - private Color colorTrans, colorTransBorder; - - @Inject - TrapOverlay(final Client client, final HunterPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.plugin = plugin; - this.client = client; - } - - @Override - public Dimension render(Graphics2D graphics) - { - drawTraps(graphics); - return null; - } - - /** - * Updates the timer colors. - */ - public void updateConfig() - { - colorEmptyBorder = plugin.getGetEmptyTrapColor(); - colorEmpty = new Color(colorEmptyBorder.getRed(), colorEmptyBorder.getGreen(), colorEmptyBorder.getBlue(), 100); - colorFullBorder = plugin.getGetFullTrapColor(); - colorFull = new Color(colorFullBorder.getRed(), colorFullBorder.getGreen(), colorFullBorder.getBlue(), 100); - colorOpenBorder = plugin.getGetOpenTrapColor(); - colorOpen = new Color(colorOpenBorder.getRed(), colorOpenBorder.getGreen(), colorOpenBorder.getBlue(), 100); - colorTransBorder = plugin.getGetTransTrapColor(); - colorTrans = new Color(colorTransBorder.getRed(), colorTransBorder.getGreen(), colorTransBorder.getBlue(), 100); - } - - /** - * Iterates over all the traps that were placed by the local player, and - * draws a circle or a timer on the trap, depending on the trap state. - * - * @param graphics - */ - private void drawTraps(Graphics2D graphics) - { - for (Map.Entry entry : plugin.getTraps().entrySet()) - { - HunterTrap trap = entry.getValue(); - - switch (trap.getState()) - { - case OPEN: - drawTimerOnTrap(graphics, trap, colorOpen, colorOpenBorder, colorEmpty, colorOpenBorder); - break; - case EMPTY: - drawTimerOnTrap(graphics, trap, colorEmpty, colorEmptyBorder, colorEmpty, colorEmptyBorder); - break; - case FULL: - drawTimerOnTrap(graphics, trap, colorFull, colorFullBorder, colorFull, colorFullBorder); - break; - case TRANSITION: - drawCircleOnTrap(graphics, trap, colorTrans, colorTransBorder); - break; - } - } - } - - /** - * Draws a timer on a given trap. - * - * @param graphics - * @param trap The trap on which the timer needs to be drawn - * @param fill The fill color of the timer - * @param border The border color of the timer - * @param fillTimeLow The fill color of the timer when it is low - * @param borderTimeLow The border color of the timer when it is low - */ - private void drawTimerOnTrap(Graphics2D graphics, HunterTrap trap, Color fill, Color border, Color fillTimeLow, Color borderTimeLow) - { - if (trap.getWorldLocation().getPlane() != client.getPlane()) - { - return; - } - LocalPoint localLoc = LocalPoint.fromWorld(client, trap.getWorldLocation()); - if (localLoc == null) - { - return; - } - net.runelite.api.Point loc = Perspective.localToCanvas(client, localLoc, client.getPlane()); - - if (loc == null) - { - return; - } - - double timeLeft = 1 - trap.getTrapTimeRelative(); - - ProgressPieComponent pie = new ProgressPieComponent(); - pie.setFill(timeLeft > TIMER_LOW ? fill : fillTimeLow); - pie.setBorderColor(timeLeft > TIMER_LOW ? border : borderTimeLow); - pie.setPosition(loc); - pie.setProgress(timeLeft); - pie.render(graphics); - } - - /** - * Draws a timer on a given trap. - * - * @param graphics - * @param trap The trap on which the timer needs to be drawn - * @param fill The fill color of the timer - * @param border The border color of the timer - */ - private void drawCircleOnTrap(Graphics2D graphics, HunterTrap trap, Color fill, Color border) - { - if (trap.getWorldLocation().getPlane() != client.getPlane()) - { - return; - } - LocalPoint localLoc = LocalPoint.fromWorld(client, trap.getWorldLocation()); - if (localLoc == null) - { - return; - } - net.runelite.api.Point loc = Perspective.localToCanvas(client, localLoc, client.getPlane()); - - ProgressPieComponent pie = new ProgressPieComponent(); - pie.setFill(fill); - pie.setBorderColor(border); - pie.setPosition(loc); - pie.setProgress(1); - pie.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hydra/Hydra.java b/runelite-client/src/main/java/net/runelite/client/plugins/hydra/Hydra.java deleted file mode 100644 index e1540682a9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hydra/Hydra.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2020, Dutta64 - * 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.hydra; - -import java.awt.Graphics2D; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.NPC; -import net.runelite.api.Point; - -public class Hydra -{ - static final int MAX_ATTACK_COUNT = 3; - - private final NPC npc; - - @Getter(AccessLevel.PACKAGE) - private int attackCount; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private HydraAnimation hydraAnimation; - - public Hydra(final NPC npc) - { - this.npc = npc; - this.attackCount = MAX_ATTACK_COUNT; - this.hydraAnimation = null; - } - - void updateAttackCount() - { - attackCount = attackCount == 1 ? MAX_ATTACK_COUNT : --attackCount; - } - - void resetAttackCount() - { - attackCount = MAX_ATTACK_COUNT; - } - - Point getCanvasTextLocation(final Graphics2D graphics, final String text, final int zOffset) - { - return npc.getCanvasTextLocation(graphics, text, zOffset); - } - - int getLogicalHeight() - { - return npc.getLogicalHeight(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraAnimation.java b/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraAnimation.java deleted file mode 100644 index 05f4bc6f3a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraAnimation.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2020, Dutta64 - * 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.hydra; - -import java.awt.Color; -import java.util.Objects; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@RequiredArgsConstructor -public enum HydraAnimation -{ - RANGE(8261, "RANGE", new Color(0, 255, 0)), - MAGIC(8262, "MAGIC", new Color(52, 152, 219)), - POISON(8263, "POISON", new Color(255, 0, 0)); // Not used currently - - @Getter(AccessLevel.PACKAGE) - private final int id; - - @Getter(AccessLevel.PACKAGE) - private final String text; - - @Getter(AccessLevel.PACKAGE) - private final Color color; - - public static HydraAnimation fromId(final int id) - { - for (final HydraAnimation hydraAnimation : HydraAnimation.values()) - { - if (Objects.equals(hydraAnimation.id, id)) - { - return hydraAnimation; - } - } - - throw new IllegalArgumentException(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraAttackCounterOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraAttackCounterOverlay.java deleted file mode 100644 index da429d5976..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraAttackCounterOverlay.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2020, Dutta64 - * 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.hydra; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.HashMap; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Setter; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.Point; -import net.runelite.client.ui.FontManager; -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; - -@Singleton -public class HydraAttackCounterOverlay extends Overlay -{ - private final HydraPlugin hydraPlugin; - - private final Client client; - - @Setter(AccessLevel.PACKAGE) - private Map hydras; - - @Setter(AccessLevel.PACKAGE) - private boolean isBoldAttackCounterOverlay; - - @Inject - private HydraAttackCounterOverlay(final HydraPlugin hydraPlugin, final Client client) - { - this.hydraPlugin = hydraPlugin; - this.client = client; - this.hydras = new HashMap<>(); - this.isBoldAttackCounterOverlay = false; - setLayer(OverlayLayer.ABOVE_SCENE); - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.MED); - } - - @Override - public Dimension render(final Graphics2D graphics) - { - if (!hydraPlugin.isPlayerAtHydraRegion()) - { - return null; - } - - for (final NPC npc : client.getNpcs()) - { - final Hydra hydra = hydras.get(npc.getIndex()); - - if (hydra == null) - { - continue; - } - - if (isBoldAttackCounterOverlay) - { - graphics.setFont(FontManager.getRunescapeBoldFont()); - } - else - { - graphics.setFont(FontManager.getRunescapeFont()); - } - - renderAnimationAttackType(graphics, hydra); - renderAttackCount(graphics, hydra); - } - - return null; - } - - private void renderAnimationAttackType(final Graphics2D graphics, final Hydra hydra) - { - final HydraAnimation hydraAnimation = hydra.getHydraAnimation(); - - if (hydraAnimation == null) - { - return; - } - - final int heightOffset = 100; - - final Point textLocation = hydra.getCanvasTextLocation(graphics, "TEMP!", - hydra.getLogicalHeight() + heightOffset); - - if (textLocation == null) - { - return; - } - - final boolean attackCountIsMax = hydra.getAttackCount() == Hydra.MAX_ATTACK_COUNT; - - switch (hydraAnimation) - { - case RANGE: - if (attackCountIsMax) - { - OverlayUtil.renderTextLocation(graphics, textLocation, HydraAnimation.MAGIC.getText(), - HydraAnimation.MAGIC.getColor()); - } - else - { - OverlayUtil.renderTextLocation(graphics, textLocation, HydraAnimation.RANGE.getText(), - HydraAnimation.RANGE.getColor()); - } - break; - case MAGIC: - if (attackCountIsMax) - { - OverlayUtil.renderTextLocation(graphics, textLocation, HydraAnimation.RANGE.getText(), - HydraAnimation.RANGE.getColor()); - } - else - { - OverlayUtil.renderTextLocation(graphics, textLocation, HydraAnimation.MAGIC.getText(), - HydraAnimation.MAGIC.getColor()); - } - break; - default: - break; - } - } - - private void renderAttackCount(final Graphics2D graphics, final Hydra hydra) - { - final int attackCount = hydra.getAttackCount(); - - final int heightOffset = 30; - - final Point textLocation = hydra.getCanvasTextLocation(graphics, Integer.toString(attackCount), - hydra.getLogicalHeight() + heightOffset); - - if (textLocation != null) - { - OverlayUtil.renderTextLocation(graphics, textLocation, Integer.toString(attackCount), Color.WHITE); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraConfig.java deleted file mode 100644 index 9733fbfcf3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraConfig.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2020, Dutta64 - * 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.hydra; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("hydra") -public interface HydraConfig extends Config -{ - - @ConfigItem( - position = 1, - keyName = "attackCounterOverlay", - name = "Attack Counter Overlay", - description = "Configures if an attack counter overlay is shown." - ) - default boolean isAttackCounterOverlay() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "boldAttackCounterOverlay", - name = "Bold Attack Counter", - description = "Configures if the attack counter is bold.
Attack Counter Overlay must be enabled." - ) - default boolean isBoldAttackCounterOverlay() - { - return false; - } - - @ConfigItem( - position = 3, - keyName = "prayerOverlay", - name = "Prayer Overlay", - description = "Configures if a prayer overlay is shown.
This overlay includes a mini attack counter." - ) - default boolean isPrayerOverlay() - { - return true; - } - - @ConfigItem( - position = 4, - keyName = "poisonProjectileOverlay", - name = "Poison Projectile Overlay", - description = "Configures if a poison projectile overlay is shown." - ) - default boolean isPoisonOverlay() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraPlugin.java deleted file mode 100644 index eef36dff89..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraPlugin.java +++ /dev/null @@ -1,421 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2020, Dutta64 - * 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.hydra; - -import com.google.inject.Provides; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -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.NPC; -import net.runelite.api.Player; -import net.runelite.api.Projectile; -import net.runelite.api.ProjectileID; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.AnimationChanged; -import net.runelite.api.events.InteractingChanged; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.events.ProjectileMoved; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "Hydra Helper", - description = "Overlays for normal Hydras.", - tags = {"hydra", "helper", "baby", "small", "normal", "regular"}, - type = PluginType.PVM, - enabledByDefault = false -) -@Slf4j -@Singleton -public class HydraPlugin extends Plugin -{ - static final Set VALID_HYDRA_ANIMATIONS = EnumSet.of( - HydraAnimation.RANGE, - HydraAnimation.MAGIC - ); - - private static final String CONFIG_GROUP_NAME = "hydra"; - private static final String CONFIG_ITEM_ATTACK_COUNTER = "attackCounterOverlay"; - private static final String CONFIG_ITEM_PRAYER_OVERLAY = "prayerOverlay"; - private static final String CONFIG_ITEM_POISON_PROJECTILE_OVERLAY = "poisonProjectileOverlay"; - private static final String CONFIG_ITEM_BOLD_ATTACK_COUNTER_OVERLAY = "boldAttackCounterOverlay"; - - private static final String NPC_NAME_HYDRA = "Hydra"; - - private static final int HYDRA_REGION_1 = 5279; - private static final int HYDRA_REGION_2 = 5280; - - @Inject - private Client client; - - @Inject - private HydraConfig hydraConfig; - - @Inject - private OverlayManager overlayManager; - - @Inject - private HydraAttackCounterOverlay hydraAttackCounterOverlay; - - @Inject - private HydraPrayerOverlay hydraPrayerOverlay; - - @Inject - private HydraPrayerAttackCounterOverlay hydraPrayerAttackCounterOverlay; - - @Inject - private HydraPoisonOverlay hydraPoisonOverlay; - - private final Map hydras = new HashMap<>(); - - private final Map poisonProjectiles = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private NPC interactingNpc = null; - - @Provides - HydraConfig provideConfig(final ConfigManager configManager) - { - return configManager.getConfig(HydraConfig.class); - } - - @Override - protected void startUp() - { - if (hydraConfig.isAttackCounterOverlay()) - { - overlayManager.add(hydraAttackCounterOverlay); - } - - if (hydraConfig.isPrayerOverlay()) - { - overlayManager.add(hydraPrayerOverlay); - overlayManager.add(hydraPrayerAttackCounterOverlay); - } - - if (hydraConfig.isPoisonOverlay()) - { - overlayManager.add(hydraPoisonOverlay); - } - - hydraAttackCounterOverlay.setBoldAttackCounterOverlay(hydraConfig.isBoldAttackCounterOverlay()); - - hydraAttackCounterOverlay.setHydras(hydras); - hydraPrayerOverlay.setHydras(hydras); - hydraPrayerAttackCounterOverlay.setHydras(hydras); - - hydraPoisonOverlay.setPoisonProjectiles(poisonProjectiles); - - resetHydras(); - poisonProjectiles.clear(); - } - - @Override - protected void shutDown() - { - overlayManager.remove(hydraAttackCounterOverlay); - overlayManager.remove(hydraPrayerOverlay); - overlayManager.remove(hydraPrayerAttackCounterOverlay); - overlayManager.remove(hydraPoisonOverlay); - resetHydras(); - poisonProjectiles.clear(); - - } - - @Subscribe - private void onConfigChanged(final ConfigChanged event) - { - if (!event.getGroup().equals(CONFIG_GROUP_NAME)) - { - return; - } - - final boolean newConfigValue = Boolean.parseBoolean(event.getNewValue()); - - switch (event.getKey()) - { - case CONFIG_ITEM_ATTACK_COUNTER: - if (newConfigValue) - { - overlayManager.add(hydraAttackCounterOverlay); - } - else - { - overlayManager.remove(hydraAttackCounterOverlay); - } - break; - case CONFIG_ITEM_PRAYER_OVERLAY: - if (newConfigValue) - { - overlayManager.add(hydraPrayerOverlay); - overlayManager.add(hydraPrayerAttackCounterOverlay); - } - else - { - overlayManager.remove(hydraPrayerOverlay); - overlayManager.remove(hydraPrayerAttackCounterOverlay); - } - break; - case CONFIG_ITEM_POISON_PROJECTILE_OVERLAY: - if (newConfigValue) - { - overlayManager.add(hydraPoisonOverlay); - } - else - { - overlayManager.remove(hydraPoisonOverlay); - } - break; - case CONFIG_ITEM_BOLD_ATTACK_COUNTER_OVERLAY: - hydraAttackCounterOverlay.setBoldAttackCounterOverlay(hydraConfig.isBoldAttackCounterOverlay()); - break; - default: - break; - } - } - - @Subscribe - private void onNpcSpawned(final NpcSpawned event) - { - final NPC npc = event.getNpc(); - - if (isActorHydra(npc)) - { - addHydra(npc); - } - } - - @Subscribe - private void onNpcDespawned(final NpcDespawned event) - { - final NPC npc = event.getNpc(); - - if (isActorHydra(npc)) - { - removeHydra(npc); - poisonProjectiles.clear(); - } - } - - @Subscribe - private void onInteractingChanged(final InteractingChanged event) - { - final Actor source = event.getSource(); - - if (!isActorHydra(source)) - { - return; - } - - final NPC npc = (NPC) source; - - addHydra(npc); - updateInteractingNpc(npc); - } - - @Subscribe - private void onAnimationChanged(final AnimationChanged event) - { - final Actor actor = event.getActor(); - - if (!isActorHydra(actor)) - { - return; - } - - final NPC npc = (NPC) event.getActor(); - - addHydra(npc); - updateInteractingNpc(npc); - - HydraAnimation hydraAnimation; - - try - { - hydraAnimation = HydraAnimation.fromId(npc.getAnimation()); - } - catch (final IllegalArgumentException e) - { - hydraAnimation = null; - } - - if (hydraAnimation == null || !VALID_HYDRA_ANIMATIONS.contains(hydraAnimation)) - { - // If the animation is not range/magic then do nothing. - return; - } - - final Hydra hydra = hydras.get(npc.getIndex()); - - if (hydra.getHydraAnimation() == null) - { - // If this is the first observed animation then set it - hydra.setHydraAnimation(hydraAnimation); - } - else - { - if (!Objects.equals(hydra.getHydraAnimation(), hydraAnimation)) - { - // If the animation switched from range/magic then set it and reset attack count - hydra.setHydraAnimation(hydraAnimation); - hydra.resetAttackCount(); - } - } - - hydra.updateAttackCount(); - - if (!poisonProjectiles.isEmpty()) - { - updatePoisonProjectiles(); - } - } - - /** - * See net.runelite.client.plugins.alchemicalhydra.AlchemicalHydraPlugin - * Copyright (c) 2019, Lucas - * - * @param event event object - */ - @Subscribe - private void onProjectileMoved(final ProjectileMoved event) - { - if (interactingNpc == null || client.getGameCycle() >= event.getProjectile().getStartMovementCycle()) - { - return; - } - - final Projectile projectile = event.getProjectile(); - - final int projectileId = projectile.getId(); - - if (projectileId == ProjectileID.HYDRA_POISON) - { - poisonProjectiles.put(event.getPosition(), projectile); - } - } - - /** - * See net.runelite.client.plugins.alchemicalhydra.AlchemicalHydraPlugin - * Copyright (c) 2019, Lucas - */ - private void updatePoisonProjectiles() - { - final Set expiredPoisonProjectiles = new HashSet<>(); - - for (final Map.Entry entry : poisonProjectiles.entrySet()) - { - if (entry.getValue().getEndCycle() < client.getGameCycle()) - { - expiredPoisonProjectiles.add(entry.getKey()); - } - } - - for (final LocalPoint projectileLocalPoint : expiredPoisonProjectiles) - { - poisonProjectiles.remove(projectileLocalPoint); - } - } - - boolean isPlayerAtHydraRegion() - { - final Player player = client.getLocalPlayer(); - - if (player == null) - { - return false; - } - - final WorldPoint worldPoint = player.getWorldLocation(); - - if (worldPoint == null) - { - return false; - } - - final int regionId = worldPoint.getRegionID(); - - return regionId == HYDRA_REGION_1 || regionId == HYDRA_REGION_2; - } - - private static boolean isActorHydra(final Actor actor) - { - return Objects.equals(actor.getName(), NPC_NAME_HYDRA); - } - - private void updateInteractingNpc(final NPC npc) - { - if (!Objects.equals(interactingNpc, npc) && - Objects.equals(npc.getInteracting(), client.getLocalPlayer())) - { - interactingNpc = npc; - } - } - - private void addHydra(final NPC npc) - { - final int npcIndex = npc.getIndex(); - - if (!hydras.containsKey(npcIndex)) - { - hydras.put(npcIndex, new Hydra(npc)); - } - } - - private void removeHydra(final NPC npc) - { - final int npcIndex = npc.getIndex(); - - hydras.remove(npcIndex); - - if (Objects.equals(interactingNpc, npc)) - { - interactingNpc = null; - } - } - - private void resetHydras() - { - hydras.clear(); - interactingNpc = null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraPoisonOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraPoisonOverlay.java deleted file mode 100644 index 847f4af5df..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraPoisonOverlay.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2020, Dutta64 - * 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.hydra; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.geom.Area; -import java.util.HashMap; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Setter; -import net.runelite.api.Client; -import static net.runelite.api.Perspective.getCanvasTileAreaPoly; -import net.runelite.api.Projectile; -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; - -@Singleton -public class HydraPoisonOverlay extends Overlay -{ - private static final Color poisonBorder = new Color(255, 0, 0, 100);; - private static final Color poisonFill = new Color(255, 0, 0, 50);; - - private final Client client; - - @Setter(AccessLevel.PACKAGE) - private Map poisonProjectiles; - - @Inject - public HydraPoisonOverlay(final Client client) - { - this.client = client; - this.poisonProjectiles = new HashMap<>(); - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.UNDER_WIDGETS); - } - - @Override - public Dimension render(final Graphics2D graphics) - { - if (!poisonProjectiles.isEmpty()) - { - drawPoisonArea(graphics, poisonProjectiles); - } - - return null; - } - - /** - * See net.runelite.client.plugins.alchemicalhydra.AlchemicalHydraSceneOverlay - * Copyright (c) 2019, Lucas - * - * @param graphics graphics object - * @param poisonProjectiles poisonProjectiles object - */ - private void drawPoisonArea(final Graphics2D graphics, final Map poisonProjectiles) - { - final Area poisonTiles = new Area(); - - for (final Map.Entry entry : poisonProjectiles.entrySet()) - { - if (entry.getValue().getEndCycle() < client.getGameCycle()) - { - continue; - } - - final LocalPoint point = entry.getKey(); - final Polygon poly = getCanvasTileAreaPoly(client, point, 3); - - if (poly != null) - { - poisonTiles.add(new Area(poly)); - } - } - - graphics.setPaintMode(); - graphics.setColor(poisonBorder); - graphics.draw(poisonTiles); - graphics.setColor(poisonFill); - graphics.fill(poisonTiles); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraPrayerAttackCounterOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraPrayerAttackCounterOverlay.java deleted file mode 100644 index 54075f119f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraPrayerAttackCounterOverlay.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2020, Dutta64 - * 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.hydra; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.HashMap; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Setter; -import net.runelite.api.NPC; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; - -@Singleton -public class HydraPrayerAttackCounterOverlay extends Overlay -{ - private final HydraPlugin hydraPlugin; - - private final PanelComponent panelComponent; - - @Setter(AccessLevel.PACKAGE) - private Map hydras; - - @Inject - private HydraPrayerAttackCounterOverlay(final HydraPlugin hydraPlugin) - { - this.hydraPlugin = hydraPlugin; - this.panelComponent = new PanelComponent(); - this.panelComponent.setPreferredSize(new Dimension(14, 0)); - this.hydras = new HashMap<>(); - setPosition(OverlayPosition.BOTTOM_RIGHT); - setPriority(OverlayPriority.MED); - } - - @Override - public Dimension render(final Graphics2D graphics) - { - final NPC npc = hydraPlugin.getInteractingNpc(); - - if (npc == null) - { - return null; - } - - final Hydra hydra = hydras.get(npc.getIndex()); - - if (hydra == null) - { - return null; - } - - final String attackCount = String.valueOf(hydra.getAttackCount()); - - panelComponent.getChildren().clear(); - panelComponent.getChildren().add(LineComponent.builder().right(attackCount).build()); - - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraPrayerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraPrayerOverlay.java deleted file mode 100644 index c74fdb1ad4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hydra/HydraPrayerOverlay.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2020, Dutta64 - * 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.hydra; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.util.HashMap; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Setter; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.Prayer; -import net.runelite.api.SpriteID; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; -import net.runelite.client.ui.overlay.components.ImageComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; - -@Singleton -public class HydraPrayerOverlay extends Overlay -{ - private static final Color ACTIVATED_BACKGROUND_COLOR = new Color(0, 150, 0, 150); - private static final Color NOT_ACTIVATED_BACKGROUND_COLOR = new Color(150, 0, 0, 150); - - private final HydraPlugin hydraPlugin; - - private final Client client; - - private final SpriteManager spriteManager; - - private final PanelComponent panelComponent; - - @Setter(AccessLevel.PACKAGE) - private Map hydras; - - private BufferedImage bufferedImageRange; - private BufferedImage bufferedImageMagic; - - @Inject - private HydraPrayerOverlay(final HydraPlugin hydraPlugin, final Client client, final SpriteManager spriteManager) - { - this.hydraPlugin = hydraPlugin; - this.client = client; - this.spriteManager = spriteManager; - this.panelComponent = new PanelComponent(); - this.hydras = new HashMap<>(); - this.bufferedImageRange = null; - this.bufferedImageMagic = null; - setPosition(OverlayPosition.BOTTOM_RIGHT); - setPriority(OverlayPriority.HIGH); - } - - @Override - public Dimension render(final Graphics2D graphics) - { - final NPC npc = hydraPlugin.getInteractingNpc(); - - if (npc == null) - { - return null; - } - - final Hydra hydra = hydras.get(npc.getIndex()); - - if (hydra == null) - { - return null; - } - - final HydraAnimation hydraAnimation = hydra.getHydraAnimation(); - - if (hydraAnimation == null || !HydraPlugin.VALID_HYDRA_ANIMATIONS.contains(hydraAnimation)) - { - return null; - } - - if (bufferedImageMagic == null) - { - bufferedImageMagic = spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MAGIC, 0); - } - - if (bufferedImageRange == null) - { - bufferedImageRange = spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MISSILES, 0); - } - - final boolean attackCountIsMax = hydra.getAttackCount() == Hydra.MAX_ATTACK_COUNT; - - switch (hydraAnimation) - { - case RANGE: - if (attackCountIsMax) - { - return renderPanelMagic(graphics); - } - else - { - return renderPanelRange(graphics); - } - case MAGIC: - if (attackCountIsMax) - { - return renderPanelRange(graphics); - } - else - { - return renderPanelMagic(graphics); - } - default: - break; - } - - return null; - } - - private Dimension renderPanelMagic(final Graphics2D graphics) - { - panelComponent.getChildren().clear(); - panelComponent.getChildren().add(new ImageComponent(bufferedImageMagic)); - panelComponent.setBackgroundColor(client.isPrayerActive(Prayer.PROTECT_FROM_MAGIC) - ? ACTIVATED_BACKGROUND_COLOR - : NOT_ACTIVATED_BACKGROUND_COLOR); - - return panelComponent.render(graphics); - } - - private Dimension renderPanelRange(final Graphics2D graphics) - { - panelComponent.getChildren().clear(); - panelComponent.getChildren().add(new ImageComponent(bufferedImageRange)); - panelComponent.setBackgroundColor(client.isPrayerActive(Prayer.PROTECT_FROM_MISSILES) - ? ACTIVATED_BACKGROUND_COLOR - : NOT_ACTIVATED_BACKGROUND_COLOR); - - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierConfig.java deleted file mode 100644 index 320a108e49..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierConfig.java +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright (c) 2017, Devin French - * 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.idlenotifier; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigSection; - -@ConfigGroup("idlenotifier") -public interface IdleNotifierConfig extends Config -{ - @ConfigItem( - keyName = "animationidle", - name = "Idle Animation Notifications", - description = "Configures if idle animation notifications are enabled", - position = 1 - ) - default boolean animationIdle() - { - return true; - } - - @ConfigItem( - keyName = "outOfItemsIdle", - name = "Out of Items Idle Notifications", - position = 2, - description = "Configures if notifications for running out of items for another action are enabled." - ) - default boolean outOfItemsIdle() - { - return true; - } - - @ConfigItem( - keyName = "animationidlesound", - name = "Idle Animation Sound", - description = "Plays a custom sound accompanying Idle Animation notifications", - position = 3 - ) - default boolean animationIdleSound() - { - return false; - } - - @ConfigItem( - keyName = "interactionidle", - name = "Idle Interaction Notifications", - description = "Configures if idle interaction notifications are enabled e.g. combat, fishing", - position = 4 - ) - default boolean interactionIdle() - { - return true; - } - - @ConfigItem( - keyName = "interactionidlesound", - name = "Idle Interaction Sound", - description = "Plays a custom sound accompanying Idle Interaction notifications", - position = 5 - ) - default boolean interactionIdleSound() - { - return false; - } - - @ConfigItem( - keyName = "movementidle", - name = "Idle Movement Notifications", - description = "Configures if idle movement notifications are enabled e.g. running, walking", - position = 6 - ) - default boolean movementIdle() - { - return false; - } - - @ConfigItem( - keyName = "logoutidle", - name = "Idle Logout Notifications", - description = "Configures if the idle logout notifications are enabled", - position = 7 - ) - default boolean logoutIdle() - { - return true; - } - - @ConfigItem( - keyName = "outofcombatsound", - name = "Out of Combat Sound", - description = "Plays a custom sound whenever you leave combat", - position = 8 - ) - default boolean outOfCombatSound() - { - return false; - } - - @ConfigItem( - keyName = "skullNotification", - name = "Skull Notification", - description = "Receive a notification when you skull.", - position = 9 - ) - default boolean showSkullNotification() - { - return false; - } - - @ConfigItem( - keyName = "unskullNotification", - name = "Unskull Notification", - description = "Receive a notification when you unskull.", - position = 10 - ) - default boolean showUnskullNotification() - { - return false; - } - - @ConfigItem( - keyName = "timeout", - name = "Idle Notification Delay (ms)", - description = "The notification delay after the player is idle", - position = 11 - ) - default int getIdleNotificationDelay() - { - return 5000; - } - - @ConfigItem( - keyName = "hitpoints", - name = "Hitpoints Notification Threshold", - description = "The amount of hitpoints to send a notification at. A value of 0 will disable notification.", - position = 12 - ) - default int getHitpointsThreshold() - { - return 0; - } - - @ConfigItem( - keyName = "playHealthSound", - name = "Play sound for Low Health", - description = "Will play a sound for every Low Health notification sent", - position = 13 - ) - default boolean getPlayHealthSound() - { - return false; - } - - @ConfigItem( - keyName = "prayer", - name = "Prayer Notification Threshold", - description = "The amount of prayer points to send a notification at. A value of 0 will disable notification.", - position = 14 - ) - default int getPrayerThreshold() - { - return 0; - } - - @ConfigItem( - keyName = "playPrayerSound", - name = "Play sound for Low Prayer", - description = "Will play a sound for every Low Prayer notification sent", - position = 15 - ) - default boolean getPlayPrayerSound() - { - return false; - } - - @ConfigItem( - keyName = "oxygen", - name = "Oxygen Notification Threshold", - description = "The amount of remaining oxygen to send a notification at. A value of 0 will disable notification.", - position = 16 - ) - default int getOxygenThreshold() - { - return 0; - } - - @ConfigItem( - keyName = "spec", - name = "Special Attack Energy Notification Threshold", - description = "The amount of spec energy reached to send a notification at. A value of 0 will disable notification.", - position = 17 - ) - default int getSpecEnergyThreshold() - { - return 0; - } - - @ConfigItem( - keyName = "specSound", - name = "Special Attack Energy Sound", - description = "Plays a custom sound accompanying Special Attack energy notifications", - position = 18 - ) - default boolean getSpecSound() - { - return false; - } - - @ConfigItem( - keyName = "overspec", - name = "Over Special Energy Notification", - description = "Will repeat notifications for any value over the special energy threshold", - position = 19 - ) - default boolean getOverSpecEnergy() - { - return false; - } - - - @ConfigSection( - position = 20, - keyName = "pvpSection", - name = "PvP", - description = "" - ) - default boolean pvpSection() - { - return false; - } - - @ConfigItem( - keyName = "pkers", - name = "PKer Notifier", - description = "Notifies if an attackable player based on your level range appears on screen.", - position = 21, - section = "pvpSection", - warning = "This will not notify you if the player is in your cc or is online on your friends list." - ) - default boolean notifyPkers() - { - return false; - } - - @ConfigItem( - keyName = "resourceDoor", - name = "Resource Door Notifier", - description = "Notifies if the wilderness resource area door is opened", - position = 22, - section = "pvpSection" - ) - default boolean notifyResourceDoor() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPlugin.java deleted file mode 100644 index 2bf947033d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPlugin.java +++ /dev/null @@ -1,1034 +0,0 @@ -/* - * Copyright (c) 2016-2017, Abel Briggs - * Copyright (c) 2017, Kronos - * 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.idlenotifier; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Provides; -import java.awt.TrayIcon; -import java.time.Duration; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.EnumSet; -import java.util.List; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Setter; -import net.runelite.api.Actor; -import net.runelite.api.AnimationID; -import static net.runelite.api.AnimationID.*; -import net.runelite.api.Client; -import net.runelite.api.Constants; -import net.runelite.api.GameState; -import net.runelite.api.GraphicID; -import net.runelite.api.Hitsplat; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.NPC; -import net.runelite.api.NPCDefinition; -import net.runelite.api.Player; -import net.runelite.api.Skill; -import net.runelite.api.SkullIcon; -import net.runelite.api.VarPlayer; -import net.runelite.api.Varbits; -import net.runelite.api.WallObject; -import net.runelite.api.WorldType; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.AnimationChanged; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.HitsplatApplied; -import net.runelite.api.events.InteractingChanged; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.PlayerSpawned; -import net.runelite.api.events.SpotAnimationChanged; -import net.runelite.api.events.WallObjectSpawned; -import net.runelite.client.Notifier; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.Sound; -import net.runelite.client.game.SoundManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.util.PvPUtil; -import org.apache.commons.lang3.ArrayUtils; - -@PluginDescriptor( - name = "Idle Notifier", - description = "Send a notification when going idle, or when HP/Prayer reaches a threshold", - tags = {"health", "hitpoints", "notifications", "prayer", "pvp", "pker"}, - type = PluginType.MISCELLANEOUS -) -@Singleton -public class IdleNotifierPlugin extends Plugin -{ - // This must be more than 500 client ticks (10 seconds) before you get AFK kicked - private static final int LOGOUT_WARNING_MILLIS = (4 * 60 + 40) * 1000; // 4 minutes and 40 seconds - private static final int COMBAT_WARNING_MILLIS = 19 * 60 * 1000; // 19 minutes - private static final int LOGOUT_WARNING_CLIENT_TICKS = LOGOUT_WARNING_MILLIS / Constants.CLIENT_TICK_LENGTH; - private static final int COMBAT_WARNING_CLIENT_TICKS = COMBAT_WARNING_MILLIS / Constants.CLIENT_TICK_LENGTH; - - private static final int HIGHEST_MONSTER_ATTACK_SPEED = 8; // Except Scarab Mage, but they are with other monsters - private static final Duration SIX_HOUR_LOGOUT_WARNING_AFTER_DURATION = Duration.ofMinutes(340); - - private static final String FISHING_SPOT = "Fishing spot"; - - private static final int RESOURCE_AREA_REGION = 12605; - - private static final Set nominalAnimations = new ImmutableSet.Builder() - .addAll( - Arrays.asList( - /* Woodcutting */ - WOODCUTTING_BRONZE, - WOODCUTTING_IRON, - WOODCUTTING_STEEL, - WOODCUTTING_BLACK, - WOODCUTTING_MITHRIL, - WOODCUTTING_ADAMANT, - WOODCUTTING_RUNE, - WOODCUTTING_DRAGON, - WOODCUTTING_INFERNAL, - WOODCUTTING_3A_AXE, - WOODCUTTING_CRYSTAL, - /* Cooking(Fire, Range) */ - COOKING_FIRE, - COOKING_RANGE, - COOKING_WINE, - /* Crafting(Gem Cutting, Glassblowing, Spinning, Battlestaves, Pottery) */ - GEM_CUTTING_OPAL, - GEM_CUTTING_JADE, - GEM_CUTTING_REDTOPAZ, - GEM_CUTTING_SAPPHIRE, - GEM_CUTTING_EMERALD, - GEM_CUTTING_RUBY, - GEM_CUTTING_DIAMOND, - GEM_CUTTING_AMETHYST, - CRAFTING_GLASSBLOWING, - CRAFTING_SPINNING, - CRAFTING_BATTLESTAVES, - CRAFTING_LEATHER, - CRAFTING_POTTERS_WHEEL, - CRAFTING_POTTERY_OVEN, - /* Fletching(Cutting, Stringing, Adding feathers and heads) */ - FLETCHING_BOW_CUTTING, - FLETCHING_STRING_NORMAL_SHORTBOW, - FLETCHING_STRING_OAK_SHORTBOW, - FLETCHING_STRING_WILLOW_SHORTBOW, - FLETCHING_STRING_MAPLE_SHORTBOW, - FLETCHING_STRING_YEW_SHORTBOW, - FLETCHING_STRING_MAGIC_SHORTBOW, - FLETCHING_STRING_NORMAL_LONGBOW, - FLETCHING_STRING_OAK_LONGBOW, - FLETCHING_STRING_WILLOW_LONGBOW, - FLETCHING_STRING_MAPLE_LONGBOW, - FLETCHING_STRING_YEW_LONGBOW, - FLETCHING_STRING_MAGIC_LONGBOW, - FLETCHING_ATTACH_FEATHERS_TO_ARROWSHAFT, - FLETCHING_ATTACH_HEADS, - /* Smithing(Anvil, Furnace, Cannonballs */ - SMITHING_ANVIL, - SMITHING_SMELTING, - SMITHING_CANNONBALL, - /* Fishing */ - FISHING_CRUSHING_INFERNAL_EELS, - FISHING_CUTTING_SACRED_EELS, - FISHING_BIG_NET, - FISHING_NET, - FISHING_POLE_CAST, - FISHING_CAGE, - FISHING_HARPOON, - FISHING_BARBTAIL_HARPOON, - FISHING_DRAGON_HARPOON, - FISHING_INFERNAL_HARPOON, - FISHING_OILY_ROD, - FISHING_KARAMBWAN, - FISHING_BAREHAND, - /* Mining(Normal) */ - MINING_BRONZE_PICKAXE, - MINING_IRON_PICKAXE, - MINING_STEEL_PICKAXE, - MINING_BLACK_PICKAXE, - MINING_MITHRIL_PICKAXE, - MINING_ADAMANT_PICKAXE, - MINING_RUNE_PICKAXE, - MINING_DRAGON_PICKAXE, - MINING_DRAGON_PICKAXE_UPGRADED, - MINING_DRAGON_PICKAXE_OR, - MINING_INFERNAL_PICKAXE, - MINING_3A_PICKAXE, - MINING_CRYSTAL_PICKAXE, - DENSE_ESSENCE_CHIPPING, - DENSE_ESSENCE_CHISELING, - /* Mining(Motherlode) */ - MINING_MOTHERLODE_BRONZE, - MINING_MOTHERLODE_IRON, - MINING_MOTHERLODE_STEEL, - MINING_MOTHERLODE_BLACK, - MINING_MOTHERLODE_MITHRIL, - MINING_MOTHERLODE_ADAMANT, - MINING_MOTHERLODE_RUNE, - MINING_MOTHERLODE_DRAGON, - MINING_MOTHERLODE_DRAGON_UPGRADED, - MINING_MOTHERLODE_DRAGON_OR, - MINING_MOTHERLODE_INFERNAL, - MINING_MOTHERLODE_3A, - MINING_MOTHERLODE_CRYSTAL, - /* Herblore */ - HERBLORE_PESTLE_AND_MORTAR, - HERBLORE_POTIONMAKING, - HERBLORE_MAKE_TAR, - /* Magic */ - MAGIC_CHARGING_ORBS, - MAGIC_LUNAR_PLANK_MAKE, - MAGIC_LUNAR_STRING_JEWELRY, - MAGIC_MAKE_TABLET, - MAGIC_ENCHANTING_JEWELRY, - MAGIC_ENCHANTING_AMULET_1, - MAGIC_ENCHANTING_AMULET_2, - MAGIC_ENCHANTING_AMULET_3, - /* Prayer */ - USING_GILDED_ALTAR, - /* Farming */ - FARMING_MIX_ULTRACOMPOST, - FARMING_HARVEST_BUSH, - FARMING_HARVEST_HERB, - FARMING_HARVEST_FRUIT_TREE, - FARMING_HARVEST_FLOWER, - FARMING_HARVEST_ALLOTMENT, - /* Misc */ - PISCARILIUS_CRANE_REPAIR, - HOME_MAKE_TABLET, - SAND_COLLECTION - ) - ).build(); - - @Inject - private Notifier notifier; - - @Inject - private Client client; - - @Inject - private SoundManager soundManager; - - @Inject - private IdleNotifierConfig config; - - private Instant lastAnimating; - private int lastAnimation = AnimationID.IDLE; - private Instant lastInteracting; - private Actor lastInteract; - private Instant lastMoving; - private WorldPoint lastPosition; - private boolean notifyPosition = false; - private boolean notifyHitpoints = true; - private boolean notifyPrayer = true; - private boolean notifyOxygen = true; - private boolean notifyIdleLogout = true; - private boolean notify6HourLogout = true; - private int lastSpecEnergy = 1000; - private int lastCombatCountdown = 0; - private Instant sixHourWarningTime; - private boolean ready; - private Instant lastTimeItemsUsedUp; - private List itemIdsPrevious = new ArrayList<>(); - private List itemQuantitiesPrevious = new ArrayList<>(); - private final List itemQuantitiesChange = new ArrayList<>(); - private boolean lastInteractWasCombat; - private boolean interactingNotified; - private SkullIcon lastTickSkull = null; - private boolean isFirstTick = true; - private boolean resourceDoorReady = false; - - @Setter(AccessLevel.PACKAGE) - private boolean animationIdle; - private boolean animationIdleSound; - @Setter(AccessLevel.PACKAGE) - private boolean interactionIdle; - private boolean interactionIdleSound; - @Setter(AccessLevel.PACKAGE) - private boolean logoutIdle; - private boolean outOfCombatSound; - private boolean showSkullNotification; - private boolean showUnskullNotification; - @Setter(AccessLevel.PACKAGE) - private int getIdleNotificationDelay; - @Setter(AccessLevel.PACKAGE) - private int getHitpointsThreshold; - private boolean getPlayHealthSound; - @Setter(AccessLevel.PACKAGE) - private int getPrayerThreshold; - private boolean getPlayPrayerSound; - private int getOxygenThreshold; - @Setter(AccessLevel.PACKAGE) - private int getSpecEnergyThreshold; - private boolean getSpecSound; - private boolean getOverSpecEnergy; - private boolean notifyPkers; - private boolean notifyResourceDoor; - private boolean outOfItemsIdle; - @Setter(AccessLevel.PACKAGE) - private boolean movementIdle; - - @Provides - IdleNotifierConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(IdleNotifierConfig.class); - } - - @Subscribe - void onAnimationChanged(AnimationChanged event) - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - Player localPlayer = client.getLocalPlayer(); - if (localPlayer != event.getActor()) - { - return; - } - - int graphic = localPlayer.getSpotAnimation(); - int animation = localPlayer.getAnimation(); - - if (nominalAnimations.contains(animation) || (animation == MAGIC_LUNAR_SHARED && graphic == GraphicID.BAKE_PIE)) - { - resetTimers(); - lastAnimation = animation; - lastAnimating = Instant.now(); - interactingNotified = false; - } - - else if (animation == IDLE) - { - lastAnimating = Instant.now(); - interactingNotified = false; - } - - // On unknown animation simply assume the animation is invalid and dont throw notification - else - { - lastAnimation = IDLE; - lastAnimating = null; - } - } - - @Subscribe - private void onPlayerSpawned(PlayerSpawned event) - { - final Player p = event.getPlayer(); - if (this.notifyPkers && p != null && p != client.getLocalPlayer() - && PvPUtil.isAttackable(client, p) && !client.isFriended(p.getName(), false) - && !client.isClanMember(p.getName())) - { - String playerName = p.getName(); - int combat = p.getCombatLevel(); - notifier.notify("PK'er warning! A level " + combat + " player named " + playerName + - " appeared!", TrayIcon.MessageType.WARNING); - } - } - - @Subscribe - private void onWallObjectSpawned(WallObjectSpawned event) - { - WallObject wall = event.getWallObject(); - - if (regionCheck()) - { - if (this.notifyResourceDoor && wall.getId() == 83 && resourceDoorReady) - { - notifier.notify("Door warning! The resource area door has been opened!"); - } - } - } - - @Subscribe - private void onItemContainerChanged(ItemContainerChanged event) - { - ItemContainer itemContainer = event.getItemContainer(); - - if (itemContainer != client.getItemContainer(InventoryID.INVENTORY) || !config.outOfItemsIdle()) - { - return; - } - - Item[] items = itemContainer.getItems(); - ArrayList itemQuantities = new ArrayList<>(); - ArrayList itemIds = new ArrayList<>(); - - // Populate list of items in inventory without duplicates - for (Item value : items) - { - int itemId = OutOfItemsMapping.mapFirst(value.getId()); - if (itemIds.indexOf(itemId) == -1) // -1 if item not yet in list - { - itemIds.add(itemId); - } - } - - // Populate quantity of each item in inventory - for (int j = 0; j < itemIds.size(); j++) - { - itemQuantities.add(0); - for (Item item : items) - { - if (itemIds.get(j) == OutOfItemsMapping.mapFirst(item.getId())) - { - itemQuantities.set(j, itemQuantities.get(j) + item.getQuantity()); - } - } - } - - itemQuantitiesChange.clear(); - - // Calculate the quantity of each item consumed by the last action - if (!itemIdsPrevious.isEmpty()) - { - for (int i = 0; i < itemIdsPrevious.size(); i++) - { - int id = itemIdsPrevious.get(i); - int currentIndex = itemIds.indexOf(id); - int currentQuantity; - if (currentIndex != -1) // -1 if item is no longer in inventory - { - currentQuantity = itemQuantities.get(currentIndex); - } - else - { - currentQuantity = 0; - } - itemQuantitiesChange.add(currentQuantity - itemQuantitiesPrevious.get(i)); - } - } - else - { - itemIdsPrevious = itemIds; - itemQuantitiesPrevious = itemQuantities; - return; - } - - // Check we have enough items left for another action. - for (int i = 0; i < itemQuantitiesPrevious.size(); i++) - { - if (-itemQuantitiesChange.get(i) * 2 > itemQuantitiesPrevious.get(i)) - { - lastTimeItemsUsedUp = Instant.now(); - return; - } - } - itemIdsPrevious = itemIds; - itemQuantitiesPrevious = itemQuantities; - } - - @Subscribe - void onInteractingChanged(InteractingChanged event) - { - final Actor source = event.getSource(); - if (source != client.getLocalPlayer()) - { - return; - } - - final Actor target = event.getTarget(); - - // Reset last interact - if (target != null) - { - lastInteract = null; - } - else - { - lastInteracting = Instant.now(); - } - - final boolean isNpc = target instanceof NPC; - - // If this is not NPC, do not process as we are not interested in other entities - if (!isNpc) - { - return; - } - - final NPC npc = (NPC) target; - final NPCDefinition npcComposition = npc.getDefinition(); - final List npcMenuActions = Arrays.asList(npcComposition.getActions()); - - if (npcMenuActions.contains("Attack")) - { - // Player is most likely in combat with attack-able NPC - resetTimers(); - lastInteract = target; - lastInteracting = Instant.now(); - lastInteractWasCombat = true; - } - else if (target.getName() != null && target.getName().contains(FISHING_SPOT)) - { - // Player is fishing - resetTimers(); - lastInteract = target; - lastInteracting = Instant.now(); - lastInteractWasCombat = false; - } - } - - @Subscribe - void onGameStateChanged(GameStateChanged gameStateChanged) - { - lastInteracting = null; - - GameState state = gameStateChanged.getGameState(); - - switch (state) - { - case LOGIN_SCREEN: - resetTimers(); - isFirstTick = true; - break; - case HOPPING: - isFirstTick = true; - ready = true; - break; - case LOGGING_IN: - case CONNECTION_LOST: - ready = true; - break; - case LOGGED_IN: - if (ready) - { - sixHourWarningTime = Instant.now().plus(SIX_HOUR_LOGOUT_WARNING_AFTER_DURATION); - ready = false; - resetTimers(); - } - resourceDoorReady = true; - - break; - } - } - - @Subscribe - void onHitsplatApplied(HitsplatApplied event) - { - if (event.getActor() != client.getLocalPlayer()) - { - return; - } - - final Hitsplat hitsplat = event.getHitsplat(); - - if (hitsplat.getHitsplatType() == Hitsplat.HitsplatType.DAMAGE - || hitsplat.getHitsplatType() == Hitsplat.HitsplatType.BLOCK) - { - lastCombatCountdown = HIGHEST_MONSTER_ATTACK_SPEED; - } - } - - @Subscribe - private void onSpotAnimationChanged(SpotAnimationChanged event) - { - Actor actor = event.getActor(); - - if (actor != client.getLocalPlayer()) - { - return; - } - - if (actor.getSpotAnimation() == GraphicID.SPLASH) - { - lastCombatCountdown = HIGHEST_MONSTER_ATTACK_SPEED; - } - } - - @Subscribe - void onGameTick(GameTick event) - { - skullNotifier(); - - final Player local = client.getLocalPlayer(); - final Duration waitDuration = Duration.ofMillis(this.getIdleNotificationDelay); - lastCombatCountdown = Math.max(lastCombatCountdown - 1, 0); - - if (client.getGameState() != GameState.LOGGED_IN - || local == null - // If user has clicked in the last second then they're not idle so don't send idle notification - || System.currentTimeMillis() - client.getMouseLastPressedMillis() < 1000 - || client.getKeyboardIdleTicks() < 10) - { - resetTimers(); - resetOutOfItemsIdleChecks(); - return; - } - - if (this.logoutIdle && checkIdleLogout()) - { - notifyWith(local, "is about to log out from idling too long!"); - } - - if (check6hrLogout()) - { - notifyWith(local, "is about to log out from being online for 6 hours!"); - } - - if (this.outOfItemsIdle && checkOutOfItemsIdle(waitDuration)) - { - notifyWith(local, "has run out of items!"); - // If this triggers, don't also trigger animation idle notification afterwards. - lastAnimation = IDLE; - } - - if (this.movementIdle && checkMovementIdle(waitDuration, local)) - { - notifier.notify("[" + local.getName() + "] has stopped moving!"); - } - - if (this.interactionIdle && checkInteractionIdle(waitDuration, local)) - { - if (lastInteractWasCombat) - { - notifyWith(local, "is now out of combat!"); - if (this.outOfCombatSound) - { - soundManager.playSound(Sound.OUT_OF_COMBAT); - } - } - else - { - notifyWith(local, "is now idle!"); - if (this.interactionIdleSound) - { - soundManager.playSound(Sound.IDLE); - } - } - interactingNotified = true; - } - - if (this.animationIdle && checkAnimationIdle(waitDuration, local)) - { - notifyWith(local, "is now idle!"); - if (this.animationIdleSound) - { - soundManager.playSound(Sound.IDLE); - } - } - - if (checkLowHitpoints()) - { - notifyWith(local, "has low hitpoints!"); - if (this.getPlayHealthSound) - { - soundManager.playSound(Sound.LOW_HEATLH); - } - } - - if (checkLowPrayer()) - { - notifyWith(local, "has low prayer!"); - if (this.getPlayPrayerSound) - { - soundManager.playSound(Sound.LOW_PRAYER); - } - } - - if (checkLowOxygen()) - { - notifyWith(local, "has low oxygen!"); - } - - if (checkFullSpecEnergy()) - { - notifyWith(local, "has restored spec energy!"); - if (this.getSpecSound) - { - soundManager.playSound(Sound.RESTORED_SPECIAL_ATTACK); - } - } - } - - private boolean checkFullSpecEnergy() - { - int currentSpecEnergy = client.getVar(VarPlayer.SPECIAL_ATTACK_PERCENT); - - int threshold = this.getSpecEnergyThreshold * 10; - if (threshold == 0) - { - lastSpecEnergy = currentSpecEnergy; - return false; - } - - // Check if we have regenerated over the threshold, and that the - // regen was small enough. - boolean notify = lastSpecEnergy < threshold && currentSpecEnergy >= threshold && currentSpecEnergy - lastSpecEnergy <= 100; - - notify = (notify) || ((this.getOverSpecEnergy) && (currentSpecEnergy >= threshold) && (currentSpecEnergy != lastSpecEnergy) && (currentSpecEnergy - lastSpecEnergy <= 100)); - - lastSpecEnergy = currentSpecEnergy; - return notify; - } - - private boolean checkLowOxygen() - { - if (this.getOxygenThreshold == 0) - { - return false; - } - if (this.getOxygenThreshold >= client.getVar(Varbits.OXYGEN_LEVEL) * 0.1) - { - if (!notifyOxygen) - { - notifyOxygen = true; - return true; - } - } - else - { - notifyOxygen = false; - } - return false; - } - - private boolean checkLowHitpoints() - { - if (this.getHitpointsThreshold == 0) - { - return false; - } - if (client.getRealSkillLevel(Skill.HITPOINTS) > this.getHitpointsThreshold) - { - if (client.getBoostedSkillLevel(Skill.HITPOINTS) + client.getVar(Varbits.NMZ_ABSORPTION) <= this.getHitpointsThreshold) - { - if (!notifyHitpoints) - { - notifyHitpoints = true; - return true; - } - } - else - { - notifyHitpoints = false; - } - } - - return false; - } - - private boolean checkLowPrayer() - { - if (this.getPrayerThreshold == 0) - { - return false; - } - if (client.getRealSkillLevel(Skill.PRAYER) > this.getPrayerThreshold) - { - if (client.getBoostedSkillLevel(Skill.PRAYER) <= this.getPrayerThreshold) - { - if (!notifyPrayer) - { - notifyPrayer = true; - return true; - } - } - else - { - notifyPrayer = false; - } - } - - return false; - } - - private boolean checkInteractionIdle(Duration waitDuration, Player local) - { - if (lastInteract == null) - { - return false; - } - - final Actor interact = local.getInteracting(); - - if (interact == null) - { - if (lastInteracting != null - && Instant.now().compareTo(lastInteracting.plus(waitDuration)) >= 0 - && lastCombatCountdown == 0) - { - lastInteract = null; - lastInteracting = null; - return true; - } - } - else - { - lastInteracting = Instant.now(); - } - - return false; - } - - private boolean checkIdleLogout() - { - // Check clientside AFK first, because this is required for the server to disconnect you for being first - int idleClientTicks = client.getKeyboardIdleTicks(); - if (client.getMouseIdleTicks() < idleClientTicks) - { - idleClientTicks = client.getMouseIdleTicks(); - } - - if (idleClientTicks < LOGOUT_WARNING_CLIENT_TICKS) - { - notifyIdleLogout = true; - return false; - } - - // If we are not receiving hitsplats then we can be afk kicked - if (lastCombatCountdown <= 0) - { - boolean warn = notifyIdleLogout; - notifyIdleLogout = false; - return warn; - } - - // We are in combat, so now we have to check for the timer that knocks you out of combat - // I think there are other conditions that I don't know about, because during testing I just didn't - // get removed from combat sometimes. - final long lastInteractionAgo = System.currentTimeMillis() - client.getMouseLastPressedMillis(); - if (lastInteractionAgo < COMBAT_WARNING_MILLIS || client.getKeyboardIdleTicks() < COMBAT_WARNING_CLIENT_TICKS) - { - notifyIdleLogout = true; - return false; - } - - boolean warn = notifyIdleLogout; - notifyIdleLogout = false; - return warn; - } - - private boolean check6hrLogout() - { - if (sixHourWarningTime == null) - { - return false; - } - - if (Instant.now().compareTo(sixHourWarningTime) >= 0) - { - if (notify6HourLogout) - { - notify6HourLogout = false; - return true; - } - } - else - { - notify6HourLogout = true; - } - - return false; - } - - private boolean checkAnimationIdle(Duration waitDuration, Player local) - { - if (lastAnimation == IDLE || interactingNotified) - { - return false; - } - - final int animation = local.getAnimation(); - - if (animation == IDLE) - { - if (lastAnimating != null && Instant.now().compareTo(lastAnimating.plus(waitDuration)) >= 0) - { - lastAnimation = IDLE; - lastAnimating = null; - return true; - } - } - else - { - lastAnimating = Instant.now(); - } - - return false; - } - - private boolean checkOutOfItemsIdle(Duration waitDuration) - { - if (lastTimeItemsUsedUp == null) - { - return false; - } - - if (Instant.now().compareTo(lastTimeItemsUsedUp.plus(waitDuration)) >= 0) - { - resetTimers(); - resetOutOfItemsIdleChecks(); - return true; - } - return false; - } - - private boolean checkMovementIdle(Duration waitDuration, Player local) - { - if (lastPosition == null) - { - lastPosition = local.getWorldLocation(); - return false; - } - - WorldPoint position = local.getWorldLocation(); - - if (lastPosition.equals(position)) - { - if (notifyPosition - && local.getAnimation() == IDLE - && Instant.now().compareTo(lastMoving.plus(waitDuration)) >= 0) - { - notifyPosition = false; - // Return true only if we weren't just breaking out of an animation - return lastAnimation == IDLE; - } - } - else - { - notifyPosition = true; - lastPosition = position; - lastMoving = Instant.now(); - } - return false; - } - - private void resetTimers() - { - final Player local = client.getLocalPlayer(); - - // Reset animation idle timer - lastAnimating = null; - if (client.getGameState() == GameState.LOGIN_SCREEN || local == null || local.getAnimation() != lastAnimation) - { - lastAnimation = IDLE; - } - - // Reset interaction idle timer - lastInteracting = null; - if (client.getGameState() == GameState.LOGIN_SCREEN || local == null || local.getInteracting() != lastInteract) - { - lastInteract = null; - } - } - - private void resetOutOfItemsIdleChecks() - { - lastTimeItemsUsedUp = null; - itemQuantitiesChange.clear(); - itemIdsPrevious.clear(); - itemQuantitiesPrevious.clear(); - } - - private void skullNotifier() - { - final Player local = client.getLocalPlayer(); - SkullIcon currentTickSkull = local.getSkullIcon(); - EnumSet worldTypes = client.getWorldType(); - if (!(worldTypes.contains(WorldType.DEADMAN))) - { - if (!isFirstTick) - { - if (this.showSkullNotification && lastTickSkull == null && currentTickSkull == SkullIcon.SKULL) - { - notifyWith(local, "is now skulled!"); - } - else if (this.showUnskullNotification && lastTickSkull == SkullIcon.SKULL && currentTickSkull == null) - { - notifyWith(local, "is now unskulled!"); - } - } - else - { - isFirstTick = false; - } - - lastTickSkull = currentTickSkull; - } - } - - private boolean regionCheck() - { - return ArrayUtils.contains(client.getMapRegions(), RESOURCE_AREA_REGION); - } - - private void notifyWith(Player local, String message) - { - notifier.notify("[" + local.getName() + "] " + message); - } - - @Override - protected void startUp() - { - updateConfig(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("idlenotifier")) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.animationIdle = config.animationIdle(); - this.animationIdleSound = config.animationIdleSound(); - this.interactionIdle = config.interactionIdle(); - this.interactionIdleSound = config.interactionIdleSound(); - this.logoutIdle = config.logoutIdle(); - this.outOfCombatSound = config.outOfCombatSound(); - this.showSkullNotification = config.showSkullNotification(); - this.showUnskullNotification = config.showUnskullNotification(); - this.getIdleNotificationDelay = config.getIdleNotificationDelay(); - this.getHitpointsThreshold = config.getHitpointsThreshold(); - this.getPlayHealthSound = config.getPlayHealthSound(); - this.getPrayerThreshold = config.getPrayerThreshold(); - this.getPlayPrayerSound = config.getPlayPrayerSound(); - this.getOxygenThreshold = config.getOxygenThreshold(); - this.getSpecEnergyThreshold = config.getSpecEnergyThreshold(); - this.getSpecSound = config.getSpecSound(); - this.getOverSpecEnergy = config.getOverSpecEnergy(); - this.notifyPkers = config.notifyPkers(); - this.notifyResourceDoor = config.notifyResourceDoor(); - this.outOfItemsIdle = config.outOfItemsIdle(); - this.movementIdle = config.movementIdle(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/OutOfItemsMapping.java b/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/OutOfItemsMapping.java deleted file mode 100644 index b2adb691cd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/OutOfItemsMapping.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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.plugins.idlenotifier; - -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import java.util.Collection; -import static net.runelite.api.ItemID.BLUEGILL; -import static net.runelite.api.ItemID.COMMON_TENCH; -import static net.runelite.api.ItemID.GREATER_SIREN; -import static net.runelite.api.ItemID.MOTTLED_EEL; - -public enum OutOfItemsMapping -{ - AERIAL_FISHING_CUTTING(BLUEGILL, COMMON_TENCH, MOTTLED_EEL, GREATER_SIREN); - - private static final Multimap MAPPINGS = HashMultimap.create(); - private final int groupedItemKey; - private final int[] groupedItemIDs; - - static - { - for (final OutOfItemsMapping item : values()) - { - for (int itemId : item.groupedItemIDs) - { - MAPPINGS.put(itemId, item.groupedItemKey); - } - } - } - - OutOfItemsMapping(int groupedItemKey, int... groupedItemIDs) - { - this.groupedItemKey = groupedItemKey; - this.groupedItemIDs = groupedItemIDs; - } - - /** - * Some actions consume multiple different items. To properly handle these - * cases for the out of items notification the different items must be - * recognised as belonging to a single group. - *

- * Map an item that is part of a group of items that are consumed by a single - * action to the first item in that group. - */ - public static int mapFirst(int itemId) - { - final Collection mapping = MAPPINGS.get(itemId); - - if (mapping == null || mapping.isEmpty()) - { - return itemId; - } - - return mapping.iterator().next(); - } - -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/implings/Impling.java b/runelite-client/src/main/java/net/runelite/client/plugins/implings/Impling.java deleted file mode 100644 index 04d1c6e2eb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/implings/Impling.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2018, 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.implings; - -import com.google.common.collect.ImmutableMap; -import java.util.Map; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.NpcID; - -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -enum Impling -{ - BABY(ImplingType.BABY, NpcID.BABY_IMPLING), - BABY_2(ImplingType.BABY, NpcID.BABY_IMPLING_1645), - - YOUNG(ImplingType.YOUNG, NpcID.YOUNG_IMPLING), - YOUNG_2(ImplingType.YOUNG, NpcID.YOUNG_IMPLING_1646), - - GOURMET(ImplingType.GOURMET, NpcID.GOURMET_IMPLING), - GOURMET_2(ImplingType.GOURMET, NpcID.GOURMET_IMPLING_1647), - - EARTH(ImplingType.EARTH, NpcID.EARTH_IMPLING), - EARTH_2(ImplingType.EARTH, NpcID.EARTH_IMPLING_1648), - - ESSENCE(ImplingType.ESSENCE, NpcID.ESSENCE_IMPLING), - ESSENCE_2(ImplingType.ESSENCE, NpcID.ESSENCE_IMPLING_1649), - - ECLECTIC(ImplingType.ECLECTIC, NpcID.ECLECTIC_IMPLING), - ECLECTIC_2(ImplingType.ECLECTIC, NpcID.ECLECTIC_IMPLING_1650), - - NATURE(ImplingType.NATURE, NpcID.NATURE_IMPLING), - NATURE_2(ImplingType.NATURE, NpcID.NATURE_IMPLING_1651), - - MAGPIE(ImplingType.MAGPIE, NpcID.MAGPIE_IMPLING), - MAGPIE_2(ImplingType.MAGPIE, NpcID.MAGPIE_IMPLING_1652), - - NINJA(ImplingType.NINJA, NpcID.NINJA_IMPLING), - NINJA_2(ImplingType.NINJA, NpcID.NINJA_IMPLING_1653), - - CRYSTAL(ImplingType.CRYSTAL, NpcID.CRYSTAL_IMPLING), - CRYSTAL_2(ImplingType.CRYSTAL, NpcID.CRYSTAL_IMPLING_8742), - CRYSTAL_3(ImplingType.CRYSTAL, NpcID.CRYSTAL_IMPLING_8743), - CRYSTAL_4(ImplingType.CRYSTAL, NpcID.CRYSTAL_IMPLING_8744), - CRYSTAL_5(ImplingType.CRYSTAL, NpcID.CRYSTAL_IMPLING_8745), - CRYSTAL_6(ImplingType.CRYSTAL, NpcID.CRYSTAL_IMPLING_8746), - CRYSTAL_7(ImplingType.CRYSTAL, NpcID.CRYSTAL_IMPLING_8747), - CRYSTAL_8(ImplingType.CRYSTAL, NpcID.CRYSTAL_IMPLING_8748), - CRYSTAL_9(ImplingType.CRYSTAL, NpcID.CRYSTAL_IMPLING_8749), - CRYSTAL_10(ImplingType.CRYSTAL, NpcID.CRYSTAL_IMPLING_8750), - CRYSTAL_11(ImplingType.CRYSTAL, NpcID.CRYSTAL_IMPLING_8751), - CRYSTAL_12(ImplingType.CRYSTAL, NpcID.CRYSTAL_IMPLING_8752), - CRYSTAL_13(ImplingType.CRYSTAL, NpcID.CRYSTAL_IMPLING_8753), - CRYSTAL_14(ImplingType.CRYSTAL, NpcID.CRYSTAL_IMPLING_8754), - CRYSTAL_15(ImplingType.CRYSTAL, NpcID.CRYSTAL_IMPLING_8755), - CRYSTAL_16(ImplingType.CRYSTAL, NpcID.CRYSTAL_IMPLING_8756), - CRYSTAL_17(ImplingType.CRYSTAL, NpcID.CRYSTAL_IMPLING_8757), - - DRAGON(ImplingType.DRAGON, NpcID.DRAGON_IMPLING), - DRAGON_2(ImplingType.DRAGON, NpcID.DRAGON_IMPLING_1654), - - LUCKY(ImplingType.LUCKY, NpcID.LUCKY_IMPLING), - LUCKY_2(ImplingType.LUCKY, NpcID.LUCKY_IMPLING_7302); - - private ImplingType implingType; - private final int npcId; - - private static final Map IMPLINGS; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (Impling impling : values()) - { - builder.put(impling.npcId, impling); - } - - IMPLINGS = builder.build(); - } - - static Impling findImpling(int npcId) - { - return IMPLINGS.get(npcId); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingCounterOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingCounterOverlay.java deleted file mode 100644 index d625eff9b2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingCounterOverlay.java +++ /dev/null @@ -1,52 +0,0 @@ -package net.runelite.client.plugins.implings; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -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.table.TableAlignment; -import net.runelite.client.ui.overlay.components.table.TableComponent; - -@Singleton -public class ImplingCounterOverlay extends Overlay -{ - private final ImplingsPlugin plugin; - - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - public ImplingCounterOverlay(final ImplingsPlugin plugin) - { - this.plugin = plugin; - setPosition(OverlayPosition.TOP_LEFT); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isShowSpawn() || plugin.getImplings().isEmpty()) - { - return null; - } - - panelComponent.getChildren().clear(); - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - for (Map.Entry entry : plugin.getImplingCounterMap().entrySet()) - { - if (plugin.showImplingType(entry.getKey()) != ImplingsConfig.ImplingMode.NONE && entry.getValue() != 0) - { - tableComponent.addRow(entry.getKey().getName(), entry.getValue().toString()); - } - } - - 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/implings/ImplingMinimapOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingMinimapOverlay.java deleted file mode 100644 index 3790b27f86..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingMinimapOverlay.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.implings; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -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.OverlayUtil; - -@Singleton -public class ImplingMinimapOverlay extends Overlay -{ - private final ImplingsPlugin plugin; - - @Inject - private ImplingMinimapOverlay(final ImplingsPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - List imps = plugin.getImplings(); - if (imps.isEmpty()) - { - return null; - } - - for (NPC imp : imps) - { - Point impLocation = imp.getMinimapLocation(); - Color color = plugin.npcToColor(imp); - if (!plugin.showNpc(imp) || impLocation == null || color == null) - { - continue; - } - - OverlayUtil.renderMinimapLocation(graphics, impLocation, color); - - if (plugin.isShowName()) - { - Point textLocation = new Point(impLocation.getX() + 1, impLocation.getY()); - OverlayUtil.renderTextLocation(graphics, textLocation, imp.getName(), color); - } - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingSpawn.java b/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingSpawn.java deleted file mode 100644 index 122c0b5583..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingSpawn.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2018, Mantautas Jurksa - * 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.implings; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.coords.WorldPoint; - -/** - * @author Juzzed - */ -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -enum ImplingSpawn -{ - //Baby spawns - SPAWN_BABY1(new WorldPoint(2563, 4291, 0), ImplingType.BABY), - SPAWN_BABY2(new WorldPoint(2563, 4348, 0), ImplingType.BABY), - SPAWN_BABY3(new WorldPoint(2569, 4323, 0), ImplingType.BABY), - SPAWN_BABY4(new WorldPoint(2571, 4305, 0), ImplingType.BABY), - SPAWN_BABY5(new WorldPoint(2581, 4300, 0), ImplingType.BABY), - SPAWN_BABY6(new WorldPoint(2596, 4296, 0), ImplingType.BABY), - SPAWN_BABY7(new WorldPoint(2609, 4339, 0), ImplingType.BABY), - SPAWN_BABY8(new WorldPoint(2610, 4304, 0), ImplingType.BABY), - SPAWN_BABY9(new WorldPoint(2615, 4322, 0), ImplingType.BABY), - SPAWN_BABY10(new WorldPoint(2620, 4291, 0), ImplingType.BABY), - SPAWN_BABY11(new WorldPoint(2620, 4348, 0), ImplingType.BABY), - - //Young spawns - SPAWN_YOUNG1(new WorldPoint(2564, 4321, 0), ImplingType.YOUNG), - SPAWN_YOUNG2(new WorldPoint(2573, 4330, 0), ImplingType.YOUNG), - SPAWN_YOUNG3(new WorldPoint(2574, 4321, 0), ImplingType.YOUNG), - SPAWN_YOUNG4(new WorldPoint(2590, 4348, 0), ImplingType.YOUNG), - SPAWN_YOUNG5(new WorldPoint(2592, 4291, 0), ImplingType.YOUNG), - SPAWN_YOUNG6(new WorldPoint(2595, 4343, 0), ImplingType.YOUNG), - SPAWN_YOUNG7(new WorldPoint(2612, 4327, 0), ImplingType.YOUNG), - SPAWN_YOUNG8(new WorldPoint(2612, 4309, 0), ImplingType.YOUNG), - SPAWN_YOUNG9(new WorldPoint(2619, 4322, 0), ImplingType.YOUNG), - SPAWN_YOUNG10(new WorldPoint(2587, 4300, 0), ImplingType.YOUNG), - - //Gourmet spawns - SPAWN_GOURMET1(new WorldPoint(2568, 4296, 0), ImplingType.GOURMET), - SPAWN_GOURMET2(new WorldPoint(2569, 4327, 0), ImplingType.GOURMET), - SPAWN_GOURMET3(new WorldPoint(2574, 4311, 0), ImplingType.GOURMET), - SPAWN_GOURMET4(new WorldPoint(2574, 4311, 0), ImplingType.GOURMET), - SPAWN_GOURMET5(new WorldPoint(2585, 4296, 0), ImplingType.GOURMET), - SPAWN_GOURMET6(new WorldPoint(2597, 4293, 0), ImplingType.GOURMET), - SPAWN_GOURMET7(new WorldPoint(2609, 4317, 0), ImplingType.GOURMET), - SPAWN_GOURMET8(new WorldPoint(2615, 4298, 0), ImplingType.GOURMET), - SPAWN_GOURMET9(new WorldPoint(2618, 4321, 0), ImplingType.GOURMET), - - //Earth spawns - SPAWN_EARTH1(new WorldPoint(2570, 4330, 0), ImplingType.EARTH), - SPAWN_EARTH2(new WorldPoint(2598, 4340, 0), ImplingType.EARTH), - SPAWN_EARTH3(new WorldPoint(2587, 4342, 0), ImplingType.EARTH), - SPAWN_EARTH4(new WorldPoint(2612, 4310, 0), ImplingType.EARTH), - SPAWN_EARTH5(new WorldPoint(2611, 4334, 0), ImplingType.EARTH), - - //Eclectic spawns - SPAWN_ECLECTIC1(new WorldPoint(2567, 4319, 0), ImplingType.ECLECTIC), - SPAWN_ECLECTIC2(new WorldPoint(2591, 4340, 0), ImplingType.ECLECTIC), - SPAWN_ECLECTIC3(new WorldPoint(2591, 4295, 0), ImplingType.ECLECTIC), - SPAWN_ECLECTIC4(new WorldPoint(2615, 4326, 0), ImplingType.ECLECTIC); - - private final WorldPoint spawnLocation; - private final ImplingType type; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingType.java b/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingType.java deleted file mode 100644 index 8a98bd7186..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingType.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2018, 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.implings; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -enum ImplingType -{ - BABY("Baby"), - YOUNG("Young"), - GOURMET("Gourmet"), - EARTH("Earth"), - ESSENCE("Essence"), - ECLECTIC("Eclectic"), - NATURE("Nature"), - MAGPIE("Magpie"), - NINJA("Ninja"), - CRYSTAL("Crystal"), - DRAGON("Dragon"), - LUCKY("Lucky"); - - private final String name; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsConfig.java deleted file mode 100644 index 1dd486c3f9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsConfig.java +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright (c) 2017, Robin - * 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.implings; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -/** - * @author robin - */ -@ConfigGroup("implings") -public interface ImplingsConfig extends Config -{ - enum ImplingMode - { - NONE, - HIGHLIGHT, - NOTIFY - } - - @ConfigItem( - position = 1, - keyName = "showbaby", - name = "Show Baby implings", - description = "Configures whether or not Baby impling tags are displayed" - ) - default ImplingMode showBaby() - { - return ImplingMode.NONE; - } - - @ConfigItem( - position = 2, - keyName = "babyColor", - name = "Baby impling color", - description = "Text color for Baby implings" - ) - default Color getBabyColor() - { - return new Color(177, 143, 179); - } - - @ConfigItem( - position = 3, - keyName = "showyoung", - name = "Show Young implings", - description = "Configures whether or not Young impling tags are displayed" - ) - default ImplingMode showYoung() - { - return ImplingMode.NONE; - } - - @ConfigItem( - position = 4, - keyName = "youngColor", - name = "Young impling color", - description = "Text color for Young implings" - ) - default Color getYoungColor() - { - return new Color(175, 164, 136); - } - - @ConfigItem( - position = 5, - keyName = "showgourmet", - name = "Show Gourmet implings", - description = "Configures whether or not Gourmet impling tags are displayed" - ) - default ImplingMode showGourmet() - { - return ImplingMode.NONE; - } - - @ConfigItem( - position = 6, - keyName = "gourmetColor", - name = "Gourmet impling color", - description = "Text color for Gourmet implings" - ) - default Color getGourmetColor() - { - return new Color(169, 131, 98); - } - - @ConfigItem( - position = 7, - keyName = "showearth", - name = "Show Earth implings", - description = "Configures whether or not Earth impling tags are displayed" - ) - default ImplingMode showEarth() - { - return ImplingMode.NONE; - } - - @ConfigItem( - position = 8, - keyName = "earthColor", - name = "Earth impling color", - description = "Text color for Earth implings" - ) - default Color getEarthColor() - { - return new Color(62, 86, 64); - } - - @ConfigItem( - position = 9, - keyName = "showessence", - name = "Show Essence implings", - description = "Configures whether or not Essence impling tags are displayed" - ) - default ImplingMode showEssence() - { - return ImplingMode.NONE; - } - - @ConfigItem( - position = 10, - keyName = "essenceColor", - name = "Essence impling color", - description = "Text color for Essence implings" - ) - default Color getEssenceColor() - { - return new Color(32, 89, 90); - } - - @ConfigItem( - position = 11, - keyName = "showeclectic", - name = "Show Eclectic implings", - description = "Configures whether or not Eclectic impling tags are displayed" - ) - default ImplingMode showEclectic() - { - return ImplingMode.NONE; - } - - @ConfigItem( - position = 12, - keyName = "eclecticColor", - name = "Eclectic impling color", - description = "Text color for Eclectic implings" - ) - default Color getEclecticColor() - { - return new Color(145, 155, 69); - } - - @ConfigItem( - position = 13, - keyName = "shownature", - name = "Show Nature implings", - description = "Configures whether or not Nature impling tags are displayed" - ) - default ImplingMode showNature() - { - return ImplingMode.NONE; - } - - @ConfigItem( - position = 14, - keyName = "natureColor", - name = "Nature impling color", - description = "Text color for Nature implings" - ) - default Color getNatureColor() - { - return new Color(92, 138, 95); - } - - @ConfigItem( - position = 15, - keyName = "showmagpie", - name = "Show Magpie implings", - description = "Configures whether or not Magpie impling tags are displayed" - ) - default ImplingMode showMagpie() - { - return ImplingMode.NONE; - } - - @ConfigItem( - position = 16, - keyName = "magpieColor", - name = "Magpie impling color", - description = "Text color for Magpie implings" - ) - default Color getMagpieColor() - { - return new Color(142, 142, 19); - } - - @ConfigItem( - position = 17, - keyName = "showninja", - name = "Show Ninja implings", - description = "Configures whether or not Ninja impling tags are displayed" - ) - default ImplingMode showNinja() - { - return ImplingMode.NONE; - } - - @ConfigItem( - position = 18, - keyName = "ninjaColor", - name = "Ninja impling color", - description = "Text color for Ninja implings" - ) - default Color getNinjaColor() - { - return new Color(71, 70, 75); - } - - @ConfigItem( - position = 19, - keyName = "showCrystal", - name = "Show Crystal implings", - description = "Configures whether or not Crystal impling tags are displayed" - ) - default ImplingMode showCrystal() - { - return ImplingMode.NONE; - } - - @ConfigItem( - position = 20, - keyName = "crystalColor", - name = "Crystal impling color", - description = "Text color for Crystal implings" - ) - default Color getCrystalColor() - { - return new Color(93, 188, 210); - } - - @ConfigItem( - position = 21, - keyName = "showdragon", - name = "Show Dragon implings", - description = "Configures whether or not Dragon impling tags are displayed" - ) - default ImplingMode showDragon() - { - return ImplingMode.HIGHLIGHT; - } - - @ConfigItem( - position = 22, - keyName = "dragonColor", - name = "Dragon impling color", - description = "Text color for Dragon implings" - ) - default Color getDragonColor() - { - return new Color(210, 85, 75); - } - - @ConfigItem( - position = 23, - keyName = "showlucky", - name = "Show Lucky implings", - description = "Configures whether or not Lucky impling tags are displayed" - ) - default ImplingMode showLucky() - { - return ImplingMode.HIGHLIGHT; - } - - @ConfigItem( - position = 24, - keyName = "luckyColor", - name = "Lucky impling color", - description = "Text color for Lucky implings" - ) - default Color getLuckyColor() - { - return new Color(102, 7, 101); - } - - @ConfigItem( - position = 25, - keyName = "showspawn", - name = "Show Spawn locations", - description = "Configures whether or not spawn locations are displayed in Puro Puro" - ) - default boolean showSpawn() - { - return false; - } - - @ConfigItem( - position = 26, - keyName = "spawnColor", - name = "Impling spawn color", - description = "Text color for impling spawns in Puro Puro" - ) - default Color getSpawnColor() - { - return Color.WHITE; - } - - @ConfigItem( - position = 27, - keyName = "showname", - name = "Show name on minimap", - description = "Configures whether or not impling names are displayed on minimap" - ) - default boolean showName() - { - return false; - } - - @ConfigItem( - position = 28, - keyName = "spawnColorDynamic", - name = "Impling dynamic spawn color", - description = "Text color for dynamic impling spawns in Puro Puro" - ) - default Color getDynamicSpawnColor() - { - return Color.WHITE; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsOverlay.java deleted file mode 100644 index 037235463c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsOverlay.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2017, Robin - * 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.implings; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.util.List; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Actor; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.NPCDefinition; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -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; - -/** - * @author robin - */ -@Singleton -public class ImplingsOverlay extends Overlay -{ - private final Client client; - private final ImplingsPlugin plugin; - - @Inject - private ImplingsOverlay(final Client client, final ImplingsPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - List implings = plugin.getImplings(); - - if (implings.isEmpty()) - { - return null; - } - - for (NPC imp : implings) - { - Color color = plugin.npcToColor(imp); - if (!plugin.showNpc(imp) || color == null) - { - continue; - } - - drawImp(graphics, imp, imp.getName(), color); - } - - //Draw static spawns - if (plugin.isShowSpawn()) - { - for (ImplingSpawn spawn : ImplingSpawn.values()) - { - if (plugin.showImplingType(spawn.getType()) == ImplingsConfig.ImplingMode.NONE) - { - continue; - } - - String impName = spawn.getType().getName(); - drawSpawn(graphics, spawn.getSpawnLocation(), impName, plugin.getGetSpawnColor()); - } - - //Draw dynamic spawns - Map dynamicSpawns = plugin.getDynamicSpawns(); - for (Map.Entry dynamicSpawn : dynamicSpawns.entrySet()) - { - drawDynamicSpawn(graphics, dynamicSpawn.getKey(), dynamicSpawn.getValue(), plugin.getGetDynamicSpawnColor()); - - } - } - - return null; - } - - private void drawDynamicSpawn(Graphics2D graphics, Integer spawnID, String text, Color color) - { - List npcs = client.getNpcs(); - for (NPC npc : npcs) - { - if (npc.getDefinition().getId() == spawnID) - { - NPCDefinition composition = npc.getDefinition(); - if (composition.getConfigs() != null) - { - NPCDefinition transformedComposition = composition.transform(); - if (transformedComposition == null) - { - OverlayUtil.renderActorOverlay(graphics, npc, text, color); - } - } - } - } - } - - private void drawSpawn(Graphics2D graphics, WorldPoint point, String text, Color color) - { - //Don't draw spawns if Player is not in range - if (point.distanceTo(client.getLocalPlayer().getWorldLocation()) >= 32) - { - return; - } - - LocalPoint localPoint = LocalPoint.fromWorld(client, point); - if (localPoint == null) - { - return; - } - - Polygon poly = Perspective.getCanvasTilePoly(client, localPoint); - if (poly != null) - { - OverlayUtil.renderPolygon(graphics, poly, color); - } - - Point textPoint = Perspective.getCanvasTextLocation(client, graphics, localPoint, text, 0); - if (textPoint != null) - { - OverlayUtil.renderTextLocation(graphics, textPoint, text, color); - } - } - - private void drawImp(Graphics2D graphics, Actor actor, String text, Color color) - { - Polygon poly = actor.getCanvasTilePoly(); - if (poly != null) - { - OverlayUtil.renderPolygon(graphics, poly, color); - } - - Point textLocation = actor.getCanvasTextLocation(graphics, text, actor.getLogicalHeight()); - if (textLocation != null) - { - OverlayUtil.renderTextLocation(graphics, textLocation, text, color); - } - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsPlugin.java deleted file mode 100644 index b4ab31cc99..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsPlugin.java +++ /dev/null @@ -1,370 +0,0 @@ -/* - * Copyright (c) 2017, Robin - * 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.implings; - -import com.google.inject.Provides; -import java.awt.Color; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.GameState; -import net.runelite.api.NPC; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.NpcDefinitionChanged; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.client.Notifier; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "Implings", - description = "Highlight nearby implings on the minimap and on-screen", - tags = {"hunter", "minimap", "overlay", "imp"}, - type = PluginType.SKILLING -) -@Singleton -public class ImplingsPlugin extends Plugin -{ - private static final int DYNAMIC_SPAWN_NATURE_DRAGON = 1618; - private static final int DYNAMIC_SPAWN_ECLECTIC = 1633; - private static final int DYNAMIC_SPAWN_BABY_ESSENCE = 1634; - - @Getter(AccessLevel.PACKAGE) - private Map implingCounterMap = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private final List implings = new ArrayList<>(); - - @Getter(AccessLevel.PACKAGE) - private Map dynamicSpawns = new HashMap<>(); - - @Inject - private ImplingsOverlay overlay; - - @Inject - private ImplingCounterOverlay implingCounterOverlay; - - @Inject - private OverlayManager overlayManager; - - @Inject - private ImplingMinimapOverlay minimapOverlay; - - @Inject - private ImplingsConfig config; - - @Inject - private Notifier notifier; - - private ImplingsConfig.ImplingMode showBaby; - private Color getBabyColor; - private ImplingsConfig.ImplingMode showYoung; - private Color getYoungColor; - private ImplingsConfig.ImplingMode showGourmet; - private Color getGourmetColor; - private ImplingsConfig.ImplingMode showEarth; - private Color getEarthColor; - private ImplingsConfig.ImplingMode showEssence; - private Color getEssenceColor; - private ImplingsConfig.ImplingMode showEclectic; - private Color getEclecticColor; - private ImplingsConfig.ImplingMode showNature; - private Color getNatureColor; - private ImplingsConfig.ImplingMode showMagpie; - private Color getMagpieColor; - private ImplingsConfig.ImplingMode showNinja; - private Color getNinjaColor; - private ImplingsConfig.ImplingMode showCrystal; - private Color getCrystalColor; - private ImplingsConfig.ImplingMode showDragon; - private Color getDragonColor; - private ImplingsConfig.ImplingMode showLucky; - private Color getLuckyColor; - @Getter(AccessLevel.PACKAGE) - private boolean showSpawn; - @Getter(AccessLevel.PACKAGE) - private Color getSpawnColor; - @Getter(AccessLevel.PACKAGE) - private boolean showName; - @Getter(AccessLevel.PACKAGE) - private Color getDynamicSpawnColor; - - @Provides - ImplingsConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(ImplingsConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - dynamicSpawns.put(DYNAMIC_SPAWN_NATURE_DRAGON, "T3 Nature-Lucky Dynamic"); - dynamicSpawns.put(DYNAMIC_SPAWN_ECLECTIC, "T2 Eclectic Dynamic"); - dynamicSpawns.put(DYNAMIC_SPAWN_BABY_ESSENCE, "T1 Baby-Essence Dynamic"); - - overlayManager.add(overlay); - overlayManager.add(minimapOverlay); - overlayManager.add(implingCounterOverlay); - } - - @Override - protected void shutDown() - { - implings.clear(); - overlayManager.remove(overlay); - overlayManager.remove(minimapOverlay); - overlayManager.remove(implingCounterOverlay); - } - - @Subscribe - private void onGameTick(GameTick event) - { - implingCounterMap.clear(); - for (NPC npc : implings) - { - Impling impling = Impling.findImpling(npc.getId()); - - if (impling == null || impling.getImplingType() == null) - { - continue; - } - - ImplingType type = impling.getImplingType(); - if (implingCounterMap.containsKey(type)) - { - implingCounterMap.put(type, implingCounterMap.get(type) + 1); - } - else - { - implingCounterMap.put(type, 1); - } - } - } - - @Subscribe - private void onNpcSpawned(NpcSpawned npcSpawned) - { - NPC npc = npcSpawned.getNpc(); - Impling impling = Impling.findImpling(npc.getId()); - - if (impling != null) - { - if (showImplingType(impling.getImplingType()) == ImplingsConfig.ImplingMode.NOTIFY) - { - notifier.notify(impling.getImplingType().getName() + " impling is in the area"); - } - - implings.add(npc); - } - } - - @Subscribe - private void onNpcDefinitionChanged(NpcDefinitionChanged npcCompositionChanged) - { - NPC npc = npcCompositionChanged.getNpc(); - Impling impling = Impling.findImpling(npc.getId()); - - if (impling != null && !implings.contains(npc)) - { - if (showImplingType(impling.getImplingType()) == ImplingsConfig.ImplingMode.NOTIFY) - { - notifier.notify(impling.getImplingType().getName() + " impling is in the area"); - } - - implings.add(npc); - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGIN_SCREEN || event.getGameState() == GameState.HOPPING) - { - implings.clear(); - implingCounterMap.clear(); - } - } - - @Subscribe - private void onNpcDespawned(NpcDespawned npcDespawned) - { - if (implings.isEmpty()) - { - return; - } - - NPC npc = npcDespawned.getNpc(); - implings.remove(npc); - - } - - boolean showNpc(NPC npc) - { - Impling impling = Impling.findImpling(npc.getId()); - if (impling == null) - { - return true; - } - - ImplingsConfig.ImplingMode impMode = showImplingType(impling.getImplingType()); - return impMode == ImplingsConfig.ImplingMode.HIGHLIGHT || impMode == ImplingsConfig.ImplingMode.NOTIFY; - } - - ImplingsConfig.ImplingMode showImplingType(ImplingType implingType) - { - switch (implingType) - { - case BABY: - return this.showBaby; - case YOUNG: - return this.showYoung; - case GOURMET: - return this.showGourmet; - case EARTH: - return this.showEarth; - case ESSENCE: - return this.showEssence; - case ECLECTIC: - return this.showEclectic; - case NATURE: - return this.showNature; - case MAGPIE: - return this.showMagpie; - case NINJA: - return this.showNinja; - case CRYSTAL: - return this.showCrystal; - case DRAGON: - return this.showDragon; - case LUCKY: - return this.showLucky; - default: - return ImplingsConfig.ImplingMode.NONE; - } - } - - Color npcToColor(NPC npc) - { - Impling impling = Impling.findImpling(npc.getId()); - if (impling == null) - { - return null; - } - - return typeToColor(impling.getImplingType()); - } - - private Color typeToColor(ImplingType type) - { - switch (type) - { - - case BABY: - return this.getBabyColor; - case YOUNG: - return this.getYoungColor; - case GOURMET: - return this.getGourmetColor; - case EARTH: - return this.getEarthColor; - case ESSENCE: - return this.getEssenceColor; - case ECLECTIC: - return this.getEclecticColor; - case NATURE: - return this.getNatureColor; - case MAGPIE: - return this.getMagpieColor; - case NINJA: - return this.getNinjaColor; - case CRYSTAL: - return this.getCrystalColor; - - case DRAGON: - return this.getDragonColor; - case LUCKY: - return this.getLuckyColor; - default: - return null; - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("implings")) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.showBaby = config.showBaby(); - this.getBabyColor = config.getBabyColor(); - this.showYoung = config.showYoung(); - this.getYoungColor = config.getYoungColor(); - this.showGourmet = config.showGourmet(); - this.getGourmetColor = config.getGourmetColor(); - this.showEarth = config.showEarth(); - this.getEarthColor = config.getEarthColor(); - this.showEssence = config.showEssence(); - this.getEssenceColor = config.getEssenceColor(); - this.showEclectic = config.showEclectic(); - this.getEclecticColor = config.getEclecticColor(); - this.showNature = config.showNature(); - this.getNatureColor = config.getNatureColor(); - this.showMagpie = config.showMagpie(); - this.getMagpieColor = config.getMagpieColor(); - this.showNinja = config.showNinja(); - this.getNinjaColor = config.getNinjaColor(); - this.showCrystal = config.showCrystal(); - this.getCrystalColor = config.getCrystalColor(); - this.showDragon = config.showDragon(); - this.getDragonColor = config.getDragonColor(); - this.showLucky = config.showLucky(); - this.getLuckyColor = config.getLuckyColor(); - this.showSpawn = config.showSpawn(); - this.getSpawnColor = config.getSpawnColor(); - this.showName = config.showName(); - this.getDynamicSpawnColor = config.getDynamicSpawnColor(); - } -} 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 deleted file mode 100644 index 27182e942c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoConfig.java +++ /dev/null @@ -1,976 +0,0 @@ -/* - * Copyright (c) 2019, Jacky - * 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.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.ConfigSection; -import net.runelite.client.plugins.inferno.displaymodes.InfernoNamingDisplayMode; -import net.runelite.client.plugins.inferno.displaymodes.InfernoPrayerDisplayMode; -import net.runelite.client.plugins.inferno.displaymodes.InfernoSafespotDisplayMode; -import net.runelite.client.plugins.inferno.displaymodes.InfernoWaveDisplayMode; -import net.runelite.client.plugins.inferno.displaymodes.InfernoZukShieldDisplayMode; - -@ConfigGroup("inferno") -public interface InfernoConfig extends Config -{ - - @ConfigSection( - name = "Prayer", - description = "Configuration options forPprayer", - position = 0, - keyName = "PrayerSection" - ) - default boolean prayerSection() - { - return false; - } - - @ConfigSection( - name = "Safespots", - description = "Configuration options for Safespots", - position = 1, - keyName = "SafespotsSection" - ) - default boolean safespotsSection() - { - return false; - } - - @ConfigSection( - name = "Waves", - description = "Configuration options for Waves", - position = 2, - keyName = "WavesSection" - ) - default boolean wavesSection() - { - return false; - } - - @ConfigSection( - name = "ExtraSection", - description = "Configuration options for Extras", - position = 3, - keyName = "ExtraSection" - ) - default boolean extraSection() - { - return false; - } - - @ConfigSection( - name = "Nibblers", - description = "Configuration options for Nibblers", - position = 4, - keyName = "NibblersSection" - ) - default boolean nibblersSection() - { - return false; - } - - @ConfigSection( - name = "Bats", - description = "Configuration options for Bats", - position = 5, - keyName = "BatsSection" - ) - default boolean batsSection() - { - return false; - } - - @ConfigSection( - name = "Blobs", - description = "Configuration options for Blobs", - position = 6, - keyName = "BlobsSection" - ) - default boolean blobsSection() - { - return false; - } - - @ConfigSection( - name = "Meleers", - description = "Configuration options for Meleers", - position = 7, - keyName = "MeleersSection" - ) - default boolean meleersSection() - { - return false; - } - - @ConfigSection( - name = "Rangers", - description = "Configuration options for Rangers", - position = 8, - keyName = "RangersSection" - ) - default boolean rangersSection() - { - return false; - } - - @ConfigSection( - name = "Magers", - description = "Configuration options for Magers", - position = 9, - keyName = "MagersSection" - ) - default boolean magersSection() - { - return false; - } - - @ConfigSection( - name = "Jad", - description = "Configuration options for Jad", - position = 10, - keyName = "JadSection" - ) - default boolean jadSection() - { - return false; - } - - @ConfigSection( - name = "Jad Healers", - description = "Configuration options for Jad Healers", - position = 11, - keyName = "JadHealersSection" - ) - default boolean jadHealersSection() - { - return false; - } - - @ConfigSection( - name = "Zuk", - description = "Configuration options for Zuk", - position = 12, - keyName = "ZukSection" - ) - default boolean zukSection() - { - return false; - } - - @ConfigSection( - name = "Zuk Healers", - description = "Configuration options for Zuk Healers", - position = 13, - keyName = "ZukHealersSection" - ) - default boolean zukHealersSection() - { - return false; - } - - - @ConfigItem( - position = 0, - keyName = "prayerDisplayMode", - name = "Prayer Display Mode", - description = "Display prayer indicator in the prayer tab or in the bottom right corner of the screen", - section = "PrayerSection" - ) - default InfernoPrayerDisplayMode prayerDisplayMode() - { - return InfernoPrayerDisplayMode.BOTH; - } - - @ConfigItem( - position = 1, - keyName = "indicateWhenPrayingCorrectly", - name = "Indicate When Praying Correctly", - description = "Indicate the correct prayer, even if you are already praying that prayer", - section = "PrayerSection" - ) - default boolean indicateWhenPrayingCorrectly() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "descendingBoxes", - name = "Descending Boxes", - description = "Draws timing boxes above the prayer icons, as if you were playing Piano Tiles", - section = "PrayerSection" - ) - default boolean descendingBoxes() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "indicateNonPriorityDescendingBoxes", - name = "Indicate Non-Priority Boxes", - description = "Render descending boxes for prayers that are not the priority prayer for that tick", - section = "PrayerSection" - ) - default boolean indicateNonPriorityDescendingBoxes() - { - return true; - } - - @ConfigItem( - position = 4, - keyName = "safespotDisplayMode", - name = "Tile Safespots", - description = "Indicate safespots on the ground: safespot (white), pray melee (red), pray range (green), pray magic (blue) and combinations of those", - section = "SafespotsSection" - ) - default InfernoSafespotDisplayMode safespotDisplayMode() - { - return InfernoSafespotDisplayMode.AREA; - } - - @ConfigItem( - position = 5, - keyName = "safespotsCheckSize", - name = "Tile Safespots Check Size", - description = "The size of the area around the player that should be checked for safespots (SIZE x SIZE area)", - section = "SafespotsSection" - ) - default int safespotsCheckSize() - { - return 6; - } - - @ConfigItem( - position = 6, - keyName = "indicateNonSafespotted", - name = "Non-safespotted NPC's Overlay", - description = "Red overlay for NPC's that can attack you", - section = "SafespotsSection" - ) - default boolean indicateNonSafespotted() - { - return false; - } - - @ConfigItem( - position = 7, - keyName = "indicateTemporarySafespotted", - name = "Temporary safespotted NPC's Overlay", - description = "Orange overlay for NPC's that have to move to attack you", - section = "SafespotsSection" - ) - default boolean indicateTemporarySafespotted() - { - return false; - } - - @ConfigItem( - position = 8, - keyName = "indicateSafespotted", - name = "Safespotted NPC's Overlay", - description = "Green overlay for NPC's that are safespotted (can't attack you)", - section = "SafespotsSection" - ) - default boolean indicateSafespotted() - { - return false; - } - - @ConfigItem( - position = 0, - keyName = "waveDisplay", - name = "Wave Display", - description = "Shows monsters that will spawn on the selected wave(s).", - section = "WavesSection" - ) - default InfernoWaveDisplayMode waveDisplay() - { - return InfernoWaveDisplayMode.BOTH; - } - - @ConfigItem( - position = 1, - keyName = "npcNaming", - name = "NPC Naming", - description = "Simple (ex: Bat) or Complex (ex: Jal-MejRah) NPC naming", - section = "WavesSection" - ) - default InfernoNamingDisplayMode npcNaming() - { - return InfernoNamingDisplayMode.SIMPLE; - } - - @ConfigItem( - position = 2, - keyName = "npcLevels", - name = "NPC Levels", - description = "Show the combat level of the NPC next to their name", - section = "WavesSection" - ) - default boolean npcLevels() - { - return false; - } - - @ConfigItem( - position = 3, - keyName = "getWaveOverlayHeaderColor", - name = "Wave Header", - description = "Color for Wave Header", - section = "WavesSection" - ) - default Color getWaveOverlayHeaderColor() - { - return Color.ORANGE; - } - - @ConfigItem( - position = 4, - keyName = "getWaveTextColor", - name = "Wave Text Color", - description = "Color for Wave Texts", - section = "WavesSection" - ) - default Color getWaveTextColor() - { - return Color.WHITE; - } - - @ConfigItem( - position = 0, - keyName = "indicateObstacles", - name = "Obstacles", - description = "Indicate obstacles that NPC's cannot pass through", - section = "ExtraSection" - ) - default boolean indicateObstacles() - { - return false; - } - - @ConfigItem( - position = 0, - keyName = "indicateNibblers", - name = "Indicate Nibblers", - description = "Indicate's nibblers that are alive", - section = "NibblersSection" - ) - default boolean indicateNibblers() - { - return true; - } - - @ConfigItem( - position = 1, - keyName = "hideJalNibDeath", - name = "Hide On Death", - description = "Hide Nibblers on death animation", - section = "NibblersSection" - ) - default boolean hideNibblerDeath() - { - return false; - } - - @ConfigItem( - position = 2, - keyName = "indicateCentralNibbler", - name = "Indicate Central Nibbler", - description = "Indicate the most central nibbler. If multiple nibblers will freeze the same amount of other nibblers, " + - "the nibbler closest to the player's location is chosen.", - section = "NibblersSection" - ) - default boolean indicateCentralNibbler() - { - return true; - } - - @ConfigItem( - position = 0, - keyName = "prayerBat", - name = "Prayer Helper", - description = "Indicate the correct prayer when this NPC attacks", - section = "BatsSection" - ) - default boolean prayerBat() - { - return true; - } - - @ConfigItem( - position = 1, - keyName = "ticksOnNpcBat", - name = "Ticks on NPC", - description = "Draws the amount of ticks before an NPC is going to attack on the NPC", - section = "BatsSection" - ) - default boolean ticksOnNpcBat() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "safespotsBat", - name = "Safespots", - description = "Enable or disable safespot calculation for this specific NPC. 'Tile Safespots' in the 'Safespots' category needs to be turned on for this to take effect.", - section = "BatsSection" - ) - default boolean safespotsBat() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "indicateNpcPositionBat", - name = "Indicate Main Tile", - description = "Indicate the main tile for multi-tile NPC's. This tile is used for and pathfinding.", - section = "BatsSection" - ) - default boolean indicateNpcPositionBat() - { - return false; - } - - @ConfigItem( - position = 4, - keyName = "hideJalMejRahDeath", - name = "Hide On Death", - description = "Hide Jal-MejRah on death animation", - section = "BatsSection" - ) - default boolean hideBatDeath() - { - return false; - } - - @ConfigItem( - position = 0, - keyName = "prayerBlob", - name = "Prayer Helper", - description = "Indicate the correct prayer when this NPC attacks", - section = "BlobsSection" - ) - default boolean prayerBlob() - { - return true; - } - - @ConfigItem( - position = 1, - keyName = "indicateBlobDetectionTick", - name = "Indicate Blob Dection Tick", - description = "Show a prayer indicator (default: magic) for the tick on which the blob will detect prayer", - section = "BlobsSection" - ) - default boolean indicateBlobDetectionTick() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "ticksOnNpcBlob", - name = "Ticks on NPC", - description = "Draws the amount of ticks before an NPC is going to attack on the NPC", - section = "BlobsSection" - ) - default boolean ticksOnNpcBlob() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "safespotsBlob", - name = "Safespots", - description = "Enable or disable safespot calculation for this specific NPC. 'Tile Safespots' in the 'Safespots' category needs to be turned on for this to take effect.", - section = "BlobsSection" - ) - default boolean safespotsBlob() - { - return true; - } - - @ConfigItem( - position = 4, - keyName = "indicateNpcPositionBlob", - name = "Indicate Main Tile", - description = "Indicate the main tile for multi-tile NPC's. This tile is used for pathfinding.", - section = "BlobsSection" - ) - default boolean indicateNpcPositionBlob() - { - return false; - } - - @ConfigItem( - position = 5, - keyName = "hideJalAkDeath", - name = "Hide Blob On Death", - description = "Hide Jal-Ak on death animation", - section = "BlobsSection" - ) - default boolean hideBlobDeath() - { - return false; - } - - - @ConfigItem( - position = 6, - keyName = "hideJalAkRekXilDeath", - name = "Hide Small Range Blob On Death", - description = "Hide Jal-AkRek-Xil on death animation", - section = "BlobsSection" - ) - default boolean hideBlobSmallRangedDeath() - { - return false; - } - - @ConfigItem( - position = 7, - keyName = "hideJalAkRekMejDeath", - name = "Hide Small Magic Blob On Death", - description = "Hide Jal-AkRek-Mej on death animation", - section = "BlobsSection" - ) - default boolean hideBlobSmallMagicDeath() - { - return false; - } - - @ConfigItem( - position = 8, - keyName = "hideJalAkRekKetDeath", - name = "Hide Small Melee Blob On Death", - description = "Hide Jal-AkRek-Ket on death animation", - section = "BlobsSection" - ) - default boolean hideBlobSmallMeleeDeath() - { - return false; - } - - @ConfigItem( - position = 0, - keyName = "prayerMeleer", - name = "Prayer Helper", - description = "Indicate the correct prayer when this NPC attacks", - section = "MeleersSection" - ) - default boolean prayerMeleer() - { - return true; - } - - @ConfigItem( - position = 1, - keyName = "ticksOnNpcMeleer", - name = "Ticks on NPC", - description = "Draws the amount of ticks before an NPC is going to attack on the NPC", - section = "MeleersSection" - ) - default boolean ticksOnNpcMeleer() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "safespotsMeleer", - name = "Safespots", - description = "Enable or disable safespot calculation for this specific NPC. 'Tile Safespots' in the 'Safespots' category needs to be turned on for this to take effect.", - section = "MeleersSection" - ) - default boolean safespotsMeleer() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "indicateNpcPositionMeleer", - name = "Indicate Main Tile", - description = "Indicate the main tile for multi-tile NPC's. This tile is used for pathfinding.", - section = "MeleersSection" - ) - default boolean indicateNpcPositionMeleer() - { - return false; - } - - @ConfigItem( - position = 4, - keyName = "hideJalImKotDeath", - name = "Hide On Death", - description = "Hide Jal-ImKot on death animation", - section = "MeleersSection" - ) - default boolean hideMeleerDeath() - { - return false; - } - - - @ConfigItem( - position = 0, - keyName = "prayerRanger", - name = "Prayer Helper", - description = "Indicate the correct prayer when this NPC attacks", - section = "RangersSection" - ) - default boolean prayerRanger() - { - return true; - } - - @ConfigItem( - position = 1, - keyName = "ticksOnNpcRanger", - name = "Ticks on NPC", - description = "Draws the amount of ticks before an NPC is going to attack on the NPC", - section = "RangersSection" - ) - default boolean ticksOnNpcRanger() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "safespotsRanger", - name = "Safespots", - description = "Enable or disable safespot calculation for this specific NPC. 'Tile Safespots' in the 'Safespots' category needs to be turned on for this to take effect.", - section = "RangersSection" - ) - default boolean safespotsRanger() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "indicateNpcPositionRanger", - name = "Indicate Main Tile", - description = "Indicate the main tile for multi-tile NPC's. This tile is used for pathfinding.", - section = "RangersSection" - ) - default boolean indicateNpcPositionRanger() - { - return false; - } - - @ConfigItem( - position = 4, - keyName = "hideJalXilDeath", - name = "Hide On Death", - description = "Hide Jal-Xil on death animation", - section = "RangersSection" - ) - default boolean hideRangerDeath() - { - return false; - } - - @ConfigItem( - position = 0, - keyName = "prayerMage", - name = "Prayer Helper", - description = "Indicate the correct prayer when this NPC attacks", - section = "MagersSection" - ) - default boolean prayerMage() - { - return true; - } - - @ConfigItem( - position = 1, - keyName = "ticksOnNpcMage", - name = "Ticks on NPC", - description = "Draws the amount of ticks before an NPC is going to attack on the NPC", - section = "MagersSection" - ) - default boolean ticksOnNpcMage() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "safespotsMage", - name = "Safespots", - description = "Enable or disable safespot calculation for this specific NPC. 'Tile Safespots' in the 'Safespots' category needs to be turned on for this to take effect.", - section = "MagersSection" - ) - default boolean safespotsMage() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "indicateNpcPositionMage", - name = "Indicate Main Tile", - description = "Indicate the main tile for multi-tile NPC's. This tile is used for pathfinding.", - section = "MagersSection" - ) - default boolean indicateNpcPositionMage() - { - return false; - } - - @ConfigItem( - position = 4, - keyName = "hideJalZekDeath", - name = "Hide On Death", - description = "Hide Jal-Zek on death animation", - section = "MagersSection" - ) - default boolean hideMagerDeath() - { - return false; - } - - @ConfigItem( - position = 0, - keyName = "prayerHealersJad", - name = "Prayer Helper", - description = "Indicate the correct prayer when this NPC attacks", - section = "JadHealersSection" - ) - default boolean prayerHealerJad() - { - return false; - } - - @ConfigItem( - position = 1, - keyName = "ticksOnNpcHealersJad", - name = "Ticks on NPC", - description = "Draws the amount of ticks before an NPC is going to attack on the NPC", - section = "JadHealersSection" - ) - default boolean ticksOnNpcHealerJad() - { - return false; - } - - @ConfigItem( - position = 2, - keyName = "safespotsHealersJad", - name = "Safespots", - description = "Enable or disable safespot calculation for this specific NPC. 'Tile Safespots' in the 'Safespots' category needs to be turned on for this to take effect.", - section = "JadHealersSection" - ) - default boolean safespotsHealerJad() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "indicateActiveHealersJad", - name = "Indicate Active Healers", - description = "Indicate healers that are still healing Jad", - section = "JadHealersSection" - ) - default boolean indicateActiveHealerJad() - { - return true; - } - - @ConfigItem( - position = 4, - keyName = "hideYtHurKotDeath", - name = "Hide On Death", - description = "Hide Yt-HurKot on death animation", - section = "JadHealersSection" - ) - default boolean hideHealerJadDeath() - { - return false; - } - - @ConfigItem( - position = 0, - keyName = "prayerJad", - name = "Prayer Helper", - description = "Indicate the correct prayer when this NPC attacks", - section = "JadSection" - ) - default boolean prayerJad() - { - return true; - } - - @ConfigItem( - position = 1, - keyName = "ticksOnNpcJad", - name = "Ticks on NPC", - description = "Draws the amount of ticks before an NPC is going to attack on the NPC", - section = "JadSection" - ) - default boolean ticksOnNpcJad() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "safespotsJad", - name = "Safespots (Melee Range Only)", - description = "Enable or disable safespot calculation for this specific NPC. 'Tile Safespots' in the 'Safespots' category needs to be turned on for this to take effect.", - section = "JadSection" - ) - default boolean safespotsJad() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "hideJalTokJadDeath", - name = "Hide On Death", - description = "Hide JalTok-Jad on death animation", - section = "JadSection" - ) - default boolean hideJadDeath() - { - return false; - } - - @ConfigItem( - position = 0, - keyName = "indicateActiveHealersZuk", - name = "Indicate Active Healers (UNTESTED)", - description = "Indicate healers that are still healing Zuk", - section = "ZukHealersSection" - ) - default boolean indicateActiveHealerZuk() - { - return true; - } - - @ConfigItem( - position = 1, - keyName = "hideJalMejJakDeath", - name = "Hide On Death", - description = "Hide Jal-MejJak on death animation", - section = "ZukHealersSection" - ) - default boolean hideHealerZukDeath() - { - return false; - } - - @ConfigItem( - position = 0, - keyName = "ticksOnNpcZuk", - name = "Ticks on NPC", - description = "Draws the amount of ticks before an NPC is going to attack on the NPC", - section = "ZukSection" - ) - default boolean ticksOnNpcZuk() - { - return true; - } - - @ConfigItem( - position = 1, - keyName = "safespotsZukShieldBeforeHealers", - name = "Safespots (Before Healers)", - description = "Indicate the zuk shield safespots. 'Tile Safespots' in the 'Safespots' category needs to be turned on for this to take effect.", - section = "ZukSection" - ) - default InfernoZukShieldDisplayMode safespotsZukShieldBeforeHealers() - { - return InfernoZukShieldDisplayMode.PREDICT; - } - - @ConfigItem( - position = 2, - keyName = "safespotsZukShieldAfterHealers", - name = "Safespots (After Healers)", - description = "Indicate the zuk shield safespots. 'Tile Safespots' in the 'Safespots' category needs to be turned on for this to take effect.", - section = "ZukSection" - ) - default InfernoZukShieldDisplayMode safespotsZukShieldAfterHealers() - { - return InfernoZukShieldDisplayMode.LIVE; - } - - @ConfigItem( - position = 3, - keyName = "hideTzKalZukDeath", - name = "Hide On Death", - description = "Hide TzKal-Zuk on death animation", - section = "ZukSection" - ) - default boolean hideZukDeath() - { - return false; - } - - @ConfigItem( - position = 4, - keyName = "ticksOnNpcZukShield", - name = "Ticks on Zuk Shield", - description = "Draws the amount of ticks before Zuk attacks on the floating shield", - section = "ZukSection" - ) - default boolean ticksOnNpcZukShield() - { - return false; - } - - @Getter - @AllArgsConstructor - 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(); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoInfoBoxOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoInfoBoxOverlay.java deleted file mode 100644 index 41e6f2411e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoInfoBoxOverlay.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2017, Devin French - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.inferno; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.SpriteID; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.plugins.inferno.displaymodes.InfernoPrayerDisplayMode; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; -import net.runelite.client.ui.overlay.components.ComponentConstants; -import net.runelite.client.ui.overlay.components.ImageComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; - -@Singleton -public class InfernoInfoBoxOverlay extends Overlay -{ - private static final Color NOT_ACTIVATED_BACKGROUND_COLOR = new Color(150, 0, 0, 150); - private final Client client; - private final InfernoPlugin plugin; - private final SpriteManager spriteManager; - private final PanelComponent imagePanelComponent = new PanelComponent(); - private BufferedImage prayMeleeSprite; - private BufferedImage prayRangedSprite; - private BufferedImage prayMagicSprite; - - @Inject - private InfernoInfoBoxOverlay(final Client client, final InfernoPlugin plugin, final SpriteManager spriteManager) - { - setPosition(OverlayPosition.BOTTOM_RIGHT); - setPriority(OverlayPriority.HIGH); - this.client = client; - this.plugin = plugin; - this.spriteManager = spriteManager; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.getPrayerDisplayMode() != InfernoPrayerDisplayMode.BOTTOM_RIGHT - && plugin.getPrayerDisplayMode() != InfernoPrayerDisplayMode.BOTH) - { - return null; - } - - imagePanelComponent.getChildren().clear(); - - if (plugin.getClosestAttack() != null) - { - final BufferedImage prayerImage = getPrayerImage(plugin.getClosestAttack()); - - imagePanelComponent.getChildren().add(new ImageComponent(prayerImage)); - imagePanelComponent.setBackgroundColor(client.isPrayerActive(plugin.getClosestAttack().getPrayer()) - ? ComponentConstants.STANDARD_BACKGROUND_COLOR - : NOT_ACTIVATED_BACKGROUND_COLOR); - } - else - { - imagePanelComponent.setBackgroundColor(ComponentConstants.STANDARD_BACKGROUND_COLOR); - } - - return imagePanelComponent.render(graphics); - } - - private BufferedImage getPrayerImage(InfernoNPC.Attack attack) - { - if (prayMeleeSprite == null) - { - prayMeleeSprite = spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MELEE, 0); - } - if (prayRangedSprite == null) - { - prayRangedSprite = spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MISSILES, 0); - } - if (prayMagicSprite == null) - { - prayMagicSprite = spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MAGIC, 0); - } - - switch (attack) - { - case MELEE: - return prayMeleeSprite; - case RANGED: - return prayRangedSprite; - case MAGIC: - return prayMagicSprite; - } - - return prayMagicSprite; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoNPC.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoNPC.java deleted file mode 100644 index 175c4bedb9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoNPC.java +++ /dev/null @@ -1,400 +0,0 @@ -/* - * Copyright (c) 2017, Devin French - * 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.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.AnimationID; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.Prayer; -import net.runelite.api.coords.WorldArea; -import net.runelite.api.coords.WorldPoint; -import org.apache.commons.lang3.ArrayUtils; - -class InfernoNPC -{ - @Getter(AccessLevel.PACKAGE) - private NPC npc; - @Getter(AccessLevel.PACKAGE) - private Type type; - @Getter(AccessLevel.PACKAGE) - private Attack nextAttack; - @Getter(AccessLevel.PACKAGE) - private int ticksTillNextAttack; - private int lastAnimation; - private boolean lastCanAttack; - //0 = not in LOS, 1 = in LOS after move, 2 = in LOS - private final Map safeSpotCache; - - InfernoNPC(NPC npc) - { - this.npc = npc; - this.type = Type.typeFromId(npc.getId()); - this.nextAttack = type.getDefaultAttack(); - this.ticksTillNextAttack = 0; - this.lastAnimation = -1; - this.lastCanAttack = false; - this.safeSpotCache = new HashMap<>(); - } - - void updateNextAttack(Attack nextAttack, int ticksTillNextAttack) - { - this.nextAttack = nextAttack; - this.ticksTillNextAttack = ticksTillNextAttack; - } - - private void updateNextAttack(Attack nextAttack) - { - this.nextAttack = nextAttack; - } - - boolean canAttack(Client client, WorldPoint target) - { - if (safeSpotCache.containsKey(target)) - { - return safeSpotCache.get(target) == 2; - } - - boolean hasLos = new WorldArea(target, 1, 1).hasLineOfSightTo(client, this.getNpc().getWorldArea()); - boolean hasRange = this.getType().getDefaultAttack() == Attack.MELEE ? this.getNpc().getWorldArea().isInMeleeDistance(target) - : this.getNpc().getWorldArea().distanceTo(target) <= this.getType().getRange(); - - if (hasLos && hasRange) - { - safeSpotCache.put(target, 2); - } - - return hasLos && hasRange; - } - - boolean canMoveToAttack(Client client, WorldPoint target, List obstacles) - { - if (safeSpotCache.containsKey(target)) - { - return safeSpotCache.get(target) == 1 || safeSpotCache.get(target) == 2; - } - - final List realObstacles = new ArrayList<>(); - for (WorldPoint obstacle : obstacles) - { - if (this.getNpc().getWorldArea().toWorldPointList().contains(obstacle)) - { - continue; - } - - realObstacles.add(obstacle); - } - - final WorldArea targetArea = new WorldArea(target, 1, 1); - WorldArea currentWorldArea = this.getNpc().getWorldArea(); - - int steps = 0; - while (true) - { - // Prevent infinite loop in case of pathfinding failure - steps++; - if (steps > 30) - { - return false; - } - - final WorldArea predictedWorldArea = currentWorldArea.calculateNextTravellingPoint(client, targetArea, true, x -> - { - for (WorldPoint obstacle : realObstacles) - { - if (new WorldArea(x, 1, 1).intersectsWith(new WorldArea(obstacle, 1, 1))) - { - return false; - } - } - return true; - }); - - // Will only happen when NPC is underneath player or moving out of scene (but this will never show on overlay) - if (predictedWorldArea == null) - { - safeSpotCache.put(target, 1); - return true; - } - - if (predictedWorldArea == currentWorldArea) - { - safeSpotCache.put(target, 0); - return false; - } - - boolean hasLos = new WorldArea(target, 1, 1).hasLineOfSightTo(client, predictedWorldArea); - boolean hasRange = this.getType().getDefaultAttack() == Attack.MELEE ? predictedWorldArea.isInMeleeDistance(target) - : predictedWorldArea.distanceTo(target) <= this.getType().getRange(); - - if (hasLos && hasRange) - { - safeSpotCache.put(target, 1); - return true; - } - - currentWorldArea = predictedWorldArea; - } - } - - private boolean couldAttackPrevTick(Client client, WorldPoint lastPlayerLocation) - { - return new WorldArea(lastPlayerLocation, 1, 1).hasLineOfSightTo(client, this.getNpc().getWorldArea()); - } - - void gameTick(Client client, WorldPoint lastPlayerLocation, boolean finalPhase) - { - safeSpotCache.clear(); - - if (ticksTillNextAttack > 0) - { - this.ticksTillNextAttack--; - } - - //Jad animation detection - if (this.getType() == Type.JAD && this.getNpc().getAnimation() != -1 && this.getNpc().getAnimation() != this.lastAnimation) - { - final InfernoNPC.Attack currentAttack = InfernoNPC.Attack.attackFromId(this.getNpc().getAnimation()); - - if (currentAttack != null && currentAttack != Attack.UNKNOWN) - { - this.updateNextAttack(currentAttack, this.getType().getTicksAfterAnimation()); - } - } - - if (ticksTillNextAttack <= 0) - { - switch (this.getType()) - { - case ZUK: - if (this.getNpc().getAnimation() == AnimationID.TZKAL_ZUK) - { - if (finalPhase) - { - this.updateNextAttack(this.getType().getDefaultAttack(), 7); - } - else - { - this.updateNextAttack(this.getType().getDefaultAttack(), 10); - } - } - break; - case JAD: - if (this.getNextAttack() != Attack.UNKNOWN) - { - // Jad's cycle continuous after his animation + attack but there's no animation to alert it - this.updateNextAttack(this.getType().getDefaultAttack(), 8); - } - break; - case BLOB: - //RS pathfinding + LOS = hell, so if it can attack you the tick you were on previously, start attack cycle - if (!this.lastCanAttack && this.couldAttackPrevTick(client, lastPlayerLocation)) - { - this.updateNextAttack(Attack.UNKNOWN, 3); - } - //If there's no animation when coming out of the safespot, the blob is detecting prayer - else if (!this.lastCanAttack && this.canAttack(client, client.getLocalPlayer().getWorldLocation())) - { - this.updateNextAttack(Attack.UNKNOWN, 4); - } - //This will activate another attack cycle - else if (this.getNpc().getAnimation() != -1) - { - this.updateNextAttack(this.getType().getDefaultAttack(), this.getType().getTicksAfterAnimation()); - } - break; - case BAT: - // Range + LOS check for bat because it suffers from the defense animation bug, also dont activate on "stand" animation - if (this.canAttack(client, client.getLocalPlayer().getWorldLocation()) - && this.getNpc().getAnimation() != AnimationID.JAL_MEJRAH_STAND && this.getNpc().getAnimation() != -1) - { - this.updateNextAttack(this.getType().getDefaultAttack(), this.getType().getTicksAfterAnimation()); - } - break; - case MELEE: - case RANGER: - case MAGE: - // For the meleer, ranger and mage the attack animation is always prioritized so only check for those - // Normal attack animation, doesnt suffer from defense animation bug. Activate usual attack cycle - if (this.getNpc().getAnimation() == AnimationID.JAL_IMKOT - || this.getNpc().getAnimation() == AnimationID.JAL_XIL_RANGE_ATTACK || this.getNpc().getAnimation() == AnimationID.JAL_XIL_MELEE_ATTACK - || this.getNpc().getAnimation() == AnimationID.JAL_ZEK_MAGE_ATTACK || this.getNpc().getAnimation() == AnimationID.JAL_ZEK_MELEE_ATTACK) - { - this.updateNextAttack(this.getType().getDefaultAttack(), this.getType().getTicksAfterAnimation()); - } - // Burrow into ground animation for meleer - else if (this.getNpc().getAnimation() == 7600) - { - this.updateNextAttack(this.getType().getDefaultAttack(), 12); - } - // Respawn enemy animation for mage - else if (this.getNpc().getAnimation() == 7611) - { - this.updateNextAttack(this.getType().getDefaultAttack(), 8); - } - break; - default: - if (this.getNpc().getAnimation() != -1) - { - // This will activate another attack cycle - this.updateNextAttack(this.getType().getDefaultAttack(), this.getType().getTicksAfterAnimation()); - } - break; - } - } - - //Blob prayer detection - if (this.getType() == Type.BLOB && this.getTicksTillNextAttack() == 3 - && client.getLocalPlayer().getWorldLocation().distanceTo(this.getNpc().getWorldArea()) <= Type.BLOB.getRange()) - { - InfernoNPC.Attack nextBlobAttack = InfernoNPC.Attack.UNKNOWN; - if (client.isPrayerActive(Prayer.PROTECT_FROM_MISSILES)) - { - nextBlobAttack = InfernoNPC.Attack.MAGIC; - } - else if (client.isPrayerActive(Prayer.PROTECT_FROM_MAGIC)) - { - nextBlobAttack = InfernoNPC.Attack.RANGED; - } - - this.updateNextAttack(nextBlobAttack); - } - - // This is for jad (jad's animation lasts till after the attack is launched, which fucks up the attack cycle) - lastAnimation = this.getNpc().getAnimation(); - // This is for blob (to check if player just came out of safespot) - lastCanAttack = this.canAttack(client, client.getLocalPlayer().getWorldLocation()); - } - - @Getter(AccessLevel.PACKAGE) - enum Attack - { - MELEE(Prayer.PROTECT_FROM_MELEE, - Color.ORANGE, - Color.RED, - new int[]{ - AnimationID.JAL_NIB, - AnimationID.JAL_AK_MELEE_ATTACK, - AnimationID.JAL_IMKOT, - AnimationID.JAL_XIL_MELEE_ATTACK, - AnimationID.JAL_ZEK_MELEE_ATTACK, //TODO: Yt-HurKot attack animation - }), - RANGED(Prayer.PROTECT_FROM_MISSILES, - Color.GREEN, - new Color(0, 128, 0), - new int[]{ - AnimationID.JAL_MEJRAH, - AnimationID.JAL_AK_RANGE_ATTACK, - AnimationID.JAL_XIL_RANGE_ATTACK, - AnimationID.JALTOK_JAD_RANGE_ATTACK, - }), - MAGIC(Prayer.PROTECT_FROM_MAGIC, - Color.CYAN, - Color.BLUE, - new int[]{ - AnimationID.JAL_AK_MAGIC_ATTACK, - AnimationID.JAL_ZEK_MAGE_ATTACK, - AnimationID.JALTOK_JAD_MAGE_ATTACK - }), - UNKNOWN(null, Color.WHITE, Color.GRAY, new int[]{}); - - private final Prayer prayer; - private final Color normalColor; - private final Color criticalColor; - private final int[] animationIds; - - Attack(Prayer prayer, Color normalColor, Color criticalColor, int[] animationIds) - { - this.prayer = prayer; - this.normalColor = normalColor; - this.criticalColor = criticalColor; - this.animationIds = animationIds; - } - - static Attack attackFromId(int animationId) - { - for (Attack attack : Attack.values()) - { - if (ArrayUtils.contains(attack.getAnimationIds(), animationId)) - { - return attack; - } - } - - return null; - } - } - - @Getter(AccessLevel.PACKAGE) - enum Type - { - NIBBLER(new int[]{NpcID.JALNIB}, Attack.MELEE, 4, 99, 100), - BAT(new int[]{NpcID.JALMEJRAH}, Attack.RANGED, 3, 4, 7), - BLOB(new int[]{NpcID.JALAK}, Attack.UNKNOWN, 6, 15, 4), - MELEE(new int[]{NpcID.JALIMKOT}, Attack.MELEE, 4, 1, 3), - RANGER(new int[]{NpcID.JALXIL, NpcID.JALXIL_7702}, Attack.RANGED, 4, 98, 2), - MAGE(new int[]{NpcID.JALZEK, NpcID.JALZEK_7703}, Attack.MAGIC, 4, 98, 1), - JAD(new int[]{NpcID.JALTOKJAD, NpcID.JALTOKJAD_7704}, Attack.UNKNOWN, 3, 99, 0), - HEALER_JAD(new int[]{NpcID.YTHURKOT, NpcID.YTHURKOT_7701, NpcID.YTHURKOT_7705}, Attack.MELEE, 4, 1, 6), - ZUK(new int[]{NpcID.TZKALZUK}, Attack.UNKNOWN, 10, 99, 99), - HEALER_ZUK(new int[]{NpcID.JALMEJJAK}, Attack.UNKNOWN, -1, 99, 100); - - private final int[] npcIds; - private final Attack defaultAttack; - private final int ticksAfterAnimation; - private final int range; - private final int priority; - - Type(int[] npcIds, Attack defaultAttack, int ticksAfterAnimation, int range, int priority) - { - this.npcIds = npcIds; - this.defaultAttack = defaultAttack; - this.ticksAfterAnimation = ticksAfterAnimation; - this.range = range; - this.priority = priority; - } - - static Type typeFromId(int npcId) - { - for (Type type : Type.values()) - { - if (ArrayUtils.contains(type.getNpcIds(), npcId)) - { - return type; - } - } - - return null; - } - } -} - diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoOverlay.java deleted file mode 100644 index b391325d13..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoOverlay.java +++ /dev/null @@ -1,479 +0,0 @@ -package net.runelite.client.plugins.inferno; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.Prayer; -import net.runelite.api.NPC; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.plugins.inferno.displaymodes.InfernoPrayerDisplayMode; -import net.runelite.client.plugins.inferno.displaymodes.InfernoSafespotDisplayMode; -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 InfernoOverlay extends Overlay -{ - private static final int TICK_PIXEL_SIZE = 60; - private static final int BOX_WIDTH = 10; - private static final int BOX_HEIGHT = 5; - - private final InfernoPlugin plugin; - private final Client client; - - @Inject - private InfernoOverlay(final Client client, final InfernoPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - setPriority(OverlayPriority.HIGHEST); - - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - final Widget meleePrayerWidget = client.getWidget(WidgetInfo.PRAYER_PROTECT_FROM_MELEE); - final Widget rangePrayerWidget = client.getWidget(WidgetInfo.PRAYER_PROTECT_FROM_MISSILES); - final Widget magicPrayerWidget = client.getWidget(WidgetInfo.PRAYER_PROTECT_FROM_MAGIC); - - if (plugin.isIndicateObstacles()) - { - renderObstacles(graphics); - } - - if (plugin.getSafespotDisplayMode() == InfernoSafespotDisplayMode.AREA) - { - renderAreaSafepots(graphics); - } - else if (plugin.getSafespotDisplayMode() == InfernoSafespotDisplayMode.INDIVIDUAL_TILES) - { - renderIndividualTilesSafespots(graphics); - } - - for (InfernoNPC infernoNPC : plugin.getInfernoNpcs()) - { - if (infernoNPC.getNpc().getConvexHull() != null) - { - if (plugin.isIndicateNonSafespotted() && plugin.isNormalSafespots(infernoNPC) - && infernoNPC.canAttack(client, client.getLocalPlayer().getWorldLocation())) - { - OverlayUtil.renderPolygon(graphics, infernoNPC.getNpc().getConvexHull(), Color.RED); - } - if (plugin.isIndicateTemporarySafespotted() && plugin.isNormalSafespots(infernoNPC) - && infernoNPC.canMoveToAttack(client, client.getLocalPlayer().getWorldLocation(), plugin.getObstacles())) - { - OverlayUtil.renderPolygon(graphics, infernoNPC.getNpc().getConvexHull(), Color.YELLOW); - } - if (plugin.isIndicateSafespotted() && plugin.isNormalSafespots(infernoNPC)) - { - OverlayUtil.renderPolygon(graphics, infernoNPC.getNpc().getConvexHull(), Color.GREEN); - } - if (plugin.isIndicateNibblers() && infernoNPC.getType() == InfernoNPC.Type.NIBBLER - && (!plugin.isIndicateCentralNibbler() || plugin.getCentralNibbler() != infernoNPC)) - { - OverlayUtil.renderPolygon(graphics, infernoNPC.getNpc().getConvexHull(), Color.CYAN); - } - if (plugin.isIndicateCentralNibbler() && infernoNPC.getType() == InfernoNPC.Type.NIBBLER - && plugin.getCentralNibbler() == infernoNPC) - { - OverlayUtil.renderPolygon(graphics, infernoNPC.getNpc().getConvexHull(), Color.BLUE); - } - if (plugin.isIndicateActiveHealersJad() && infernoNPC.getType() == InfernoNPC.Type.HEALER_JAD - && infernoNPC.getNpc().getInteracting() != client.getLocalPlayer()) - { - OverlayUtil.renderPolygon(graphics, infernoNPC.getNpc().getConvexHull(), Color.CYAN); - } - if (plugin.isIndicateActiveHealersZuk() && infernoNPC.getType() == InfernoNPC.Type.HEALER_ZUK - && infernoNPC.getNpc().getInteracting() != client.getLocalPlayer()) - { - OverlayUtil.renderPolygon(graphics, infernoNPC.getNpc().getConvexHull(), Color.CYAN); - } - } - - if (plugin.isIndicateNpcPosition(infernoNPC)) - { - renderNpcLocation(graphics, infernoNPC); - } - - if (plugin.isTicksOnNpc(infernoNPC) && infernoNPC.getTicksTillNextAttack() > 0) - { - renderTicksOnNpc(graphics, infernoNPC, infernoNPC.getNpc()); - } - - if (plugin.isTicksOnNpcZukShield() && infernoNPC.getType() == InfernoNPC.Type.ZUK && plugin.getZukShield() != null && infernoNPC.getTicksTillNextAttack() > 0) - { - renderTicksOnNpc(graphics, infernoNPC, plugin.getZukShield()); - } - } - - if ((plugin.getPrayerDisplayMode() == InfernoPrayerDisplayMode.PRAYER_TAB - || plugin.getPrayerDisplayMode() == InfernoPrayerDisplayMode.BOTH) - && (meleePrayerWidget != null && !meleePrayerWidget.isHidden() - && rangePrayerWidget != null && !rangePrayerWidget.isHidden() - && magicPrayerWidget != null && !magicPrayerWidget.isHidden())) - { - renderPrayerIconOverlay(graphics); - - if (plugin.isDescendingBoxes()) - { - renderDescendingBoxes(graphics); - } - } - - return null; - } - - private void renderObstacles(Graphics2D graphics) - { - for (WorldPoint worldPoint : plugin.getObstacles()) - { - final LocalPoint localPoint = LocalPoint.fromWorld(client, worldPoint); - - if (localPoint == null) - { - continue; - } - - final Polygon tilePoly = Perspective.getCanvasTilePoly(client, localPoint); - - if (tilePoly == null) - { - continue; - } - - OverlayUtil.renderPolygon(graphics, tilePoly, Color.BLUE); - } - } - - private void renderAreaSafepots(Graphics2D graphics) - { - for (int safeSpotId : plugin.getSafeSpotAreas().keySet()) - { - if (safeSpotId > 6) - { - continue; - } - - Color colorEdge1; - Color colorEdge2 = null; - Color colorFill; - - switch (safeSpotId) - { - case 0: - colorEdge1 = Color.WHITE; - colorFill = Color.WHITE; - break; - case 1: - colorEdge1 = Color.RED; - colorFill = Color.RED; - break; - case 2: - colorEdge1 = Color.GREEN; - colorFill = Color.GREEN; - break; - case 3: - colorEdge1 = Color.BLUE; - colorFill = Color.BLUE; - break; - case 4: - colorEdge1 = Color.RED; - colorEdge2 = Color.GREEN; - colorFill = Color.YELLOW; - break; - case 5: - colorEdge1 = Color.RED; - colorEdge2 = Color.BLUE; - colorFill = new Color(255, 0, 255); - break; - case 6: - colorEdge1 = Color.GREEN; - colorEdge2 = Color.BLUE; - colorFill = new Color(0, 255, 255); - break; - default: - continue; - } - - //Add all edges, calculate average edgeSize and indicate tiles - final List allEdges = new ArrayList<>(); - int edgeSizeSquared = 0; - - for (WorldPoint worldPoint : plugin.getSafeSpotAreas().get(safeSpotId)) - { - final LocalPoint localPoint = LocalPoint.fromWorld(client, worldPoint); - - if (localPoint == null) - { - continue; - } - - final Polygon tilePoly = Perspective.getCanvasTilePoly(client, localPoint); - - if (tilePoly == null) - { - continue; - } - - OverlayUtil.renderAreaTilePolygon(graphics, tilePoly, colorFill); - - final int[][] edge1 = new int[][]{{tilePoly.xpoints[0], tilePoly.ypoints[0]}, {tilePoly.xpoints[1], tilePoly.ypoints[1]}}; - edgeSizeSquared += Math.pow(tilePoly.xpoints[0] - tilePoly.xpoints[1], 2) + Math.pow(tilePoly.ypoints[0] - tilePoly.ypoints[1], 2); - allEdges.add(edge1); - final int[][] edge2 = new int[][]{{tilePoly.xpoints[1], tilePoly.ypoints[1]}, {tilePoly.xpoints[2], tilePoly.ypoints[2]}}; - edgeSizeSquared += Math.pow(tilePoly.xpoints[1] - tilePoly.xpoints[2], 2) + Math.pow(tilePoly.ypoints[1] - tilePoly.ypoints[2], 2); - allEdges.add(edge2); - final int[][] edge3 = new int[][]{{tilePoly.xpoints[2], tilePoly.ypoints[2]}, {tilePoly.xpoints[3], tilePoly.ypoints[3]}}; - edgeSizeSquared += Math.pow(tilePoly.xpoints[2] - tilePoly.xpoints[3], 2) + Math.pow(tilePoly.ypoints[2] - tilePoly.ypoints[3], 2); - allEdges.add(edge3); - final int[][] edge4 = new int[][]{{tilePoly.xpoints[3], tilePoly.ypoints[3]}, {tilePoly.xpoints[0], tilePoly.ypoints[0]}}; - edgeSizeSquared += Math.pow(tilePoly.xpoints[3] - tilePoly.xpoints[0], 2) + Math.pow(tilePoly.ypoints[3] - tilePoly.ypoints[0], 2); - allEdges.add(edge4); - } - - if (allEdges.size() <= 0) - { - continue; - } - - edgeSizeSquared /= allEdges.size(); - - //Find and indicate unique edges - final int toleranceSquared = (int) Math.ceil(edgeSizeSquared / 6); - - for (int i = 0; i < allEdges.size(); i++) - { - int[][] baseEdge = allEdges.get(i); - - boolean duplicate = false; - - for (int j = 0; j < allEdges.size(); j++) - { - if (i == j) - { - continue; - } - - int[][] checkEdge = allEdges.get(j); - - if (edgeEqualsEdge(baseEdge, checkEdge, toleranceSquared)) - { - duplicate = true; - break; - } - } - - if (!duplicate) - { - OverlayUtil.renderFullLine(graphics, baseEdge, colorEdge1); - - if (colorEdge2 != null) - { - OverlayUtil.renderDashedLine(graphics, baseEdge, colorEdge2); - } - } - } - - } - } - - private void renderIndividualTilesSafespots(Graphics2D graphics) - { - for (WorldPoint worldPoint : plugin.getSafeSpotMap().keySet()) - { - final int safeSpotId = plugin.getSafeSpotMap().get(worldPoint); - - if (safeSpotId > 6) - { - continue; - } - - final LocalPoint localPoint = LocalPoint.fromWorld(client, worldPoint); - - if (localPoint == null) - { - continue; - } - - final Polygon tilePoly = Perspective.getCanvasTilePoly(client, localPoint); - - if (tilePoly == null) - { - continue; - } - - Color color; - switch (safeSpotId) - { - case 0: - color = Color.WHITE; - break; - case 1: - color = Color.RED; - break; - case 2: - color = Color.GREEN; - break; - case 3: - color = Color.BLUE; - break; - case 4: - color = new Color(255, 255, 0); - break; - case 5: - color = new Color(255, 0, 255); - break; - case 6: - color = new Color(0, 255, 255); - break; - default: - continue; - } - - OverlayUtil.renderPolygon(graphics, tilePoly, color); - } - } - - private void renderTicksOnNpc(Graphics2D graphics, InfernoNPC infernoNPC, NPC renderOnNPC) - { - final Color color = (infernoNPC.getTicksTillNextAttack() == 1 - || (infernoNPC.getType() == InfernoNPC.Type.BLOB && infernoNPC.getTicksTillNextAttack() == 4)) - ? infernoNPC.getNextAttack().getCriticalColor() : infernoNPC.getNextAttack().getNormalColor(); - final Point canvasPoint = renderOnNPC.getCanvasTextLocation( - graphics, String.valueOf(infernoNPC.getTicksTillNextAttack()), 0); - OverlayUtil.renderTextLocation(graphics, String.valueOf(infernoNPC.getTicksTillNextAttack()), - plugin.getTextSize(), plugin.getFontStyle().getFont(), color, canvasPoint, false, 0); - } - - private void renderNpcLocation(Graphics2D graphics, InfernoNPC infernoNPC) - { - final LocalPoint localPoint = LocalPoint.fromWorld(client, infernoNPC.getNpc().getWorldLocation()); - - if (localPoint != null) - { - final Polygon tilePolygon = Perspective.getCanvasTilePoly(client, localPoint); - - if (tilePolygon != null) - { - OverlayUtil.renderPolygon(graphics, tilePolygon, Color.BLUE); - } - } - } - - private void renderDescendingBoxes(Graphics2D graphics) - { - for (Integer tick : plugin.getUpcomingAttacks().keySet()) - { - final Map attackPriority = plugin.getUpcomingAttacks().get(tick); - int bestPriority = 999; - InfernoNPC.Attack bestAttack = null; - - for (Map.Entry attackEntry : attackPriority.entrySet()) - { - if (attackEntry.getValue() < bestPriority) - { - bestAttack = attackEntry.getKey(); - bestPriority = attackEntry.getValue(); - } - } - - for (InfernoNPC.Attack currentAttack : attackPriority.keySet()) - { - //TODO: Config values for these colors - final Color color = (tick == 1 && currentAttack == bestAttack) ? Color.RED : Color.ORANGE; - final Widget prayerWidget = client.getWidget(currentAttack.getPrayer().getWidgetInfo()); - - int baseX = (int) prayerWidget.getBounds().getX(); - baseX += prayerWidget.getBounds().getWidth() / 2; - baseX -= BOX_WIDTH / 2; - - int baseY = (int) prayerWidget.getBounds().getY() - tick * TICK_PIXEL_SIZE - BOX_HEIGHT; - baseY += TICK_PIXEL_SIZE - ((plugin.getLastTick() + 600 - System.currentTimeMillis()) / 600.0 * TICK_PIXEL_SIZE); - - final Rectangle boxRectangle = new Rectangle(BOX_WIDTH, BOX_HEIGHT); - boxRectangle.translate(baseX, baseY); - - if (currentAttack == bestAttack) - { - OverlayUtil.renderFilledPolygon(graphics, boxRectangle, color); - } - else if (plugin.isIndicateNonPriorityDescendingBoxes()) - { - OverlayUtil.renderOutlinePolygon(graphics, boxRectangle, color); - } - } - } - } - - private void renderPrayerIconOverlay(Graphics2D graphics) - { - if (plugin.getClosestAttack() != null) - { - // Prayer indicator in prayer tab - InfernoNPC.Attack prayerForAttack = null; - if (client.isPrayerActive(Prayer.PROTECT_FROM_MAGIC)) - { - prayerForAttack = InfernoNPC.Attack.MAGIC; - } - else if (client.isPrayerActive(Prayer.PROTECT_FROM_MISSILES)) - { - prayerForAttack = InfernoNPC.Attack.RANGED; - } - else if (client.isPrayerActive(Prayer.PROTECT_FROM_MELEE)) - { - prayerForAttack = InfernoNPC.Attack.MELEE; - } - - if (plugin.getClosestAttack() != prayerForAttack || plugin.isIndicateWhenPrayingCorrectly()) - { - final Widget prayerWidget = client.getWidget(plugin.getClosestAttack().getPrayer().getWidgetInfo()); - final Rectangle prayerRectangle = new Rectangle((int) prayerWidget.getBounds().getWidth(), - (int) prayerWidget.getBounds().getHeight()); - prayerRectangle.translate((int) prayerWidget.getBounds().getX(), (int) prayerWidget.getBounds().getY()); - - //TODO: Config values for these colors - Color prayerColor; - if (plugin.getClosestAttack() == prayerForAttack) - { - prayerColor = Color.GREEN; - } - else - { - prayerColor = Color.RED; - } - - OverlayUtil.renderOutlinePolygon(graphics, prayerRectangle, prayerColor); - } - } - } - - private boolean edgeEqualsEdge(int[][] edge1, int[][] edge2, int toleranceSquared) - { - return (pointEqualsPoint(edge1[0], edge2[0], toleranceSquared) && pointEqualsPoint(edge1[1], edge2[1], toleranceSquared)) - || (pointEqualsPoint(edge1[0], edge2[1], toleranceSquared) && pointEqualsPoint(edge1[1], edge2[0], toleranceSquared)); - } - - private boolean pointEqualsPoint(int[] point1, int[] point2, int toleranceSquared) - { - double distanceSquared = Math.pow(point1[0] - point2[0], 2) + Math.pow(point1[1] - point2[1], 2); - - return distanceSquared <= toleranceSquared; - } -} 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 deleted file mode 100644 index 14d889ef73..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoPlugin.java +++ /dev/null @@ -1,1106 +0,0 @@ -/* - * Copyright (c) 2019, Jacky - * 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 com.google.inject.Provides; -import java.awt.Color; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.AnimationChanged; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.inferno.displaymodes.InfernoNamingDisplayMode; -import net.runelite.client.plugins.inferno.displaymodes.InfernoPrayerDisplayMode; -import net.runelite.client.plugins.inferno.displaymodes.InfernoSafespotDisplayMode; -import net.runelite.client.plugins.inferno.displaymodes.InfernoWaveDisplayMode; -import net.runelite.client.plugins.inferno.displaymodes.InfernoZukShieldDisplayMode; -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 -) -@Slf4j -@Singleton -public class InfernoPlugin extends Plugin -{ - private static final int INFERNO_REGION = 9043; - - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private InfernoOverlay infernoOverlay; - - @Inject - private InfernoWaveOverlay waveOverlay; - - @Inject - private InfernoInfoBoxOverlay jadOverlay; - - @Inject - private InfernoOverlay prayerOverlay; - - @Inject - private InfernoConfig config; - - @Getter(AccessLevel.PACKAGE) - private InfernoConfig.FontStyle fontStyle = InfernoConfig.FontStyle.BOLD; - @Getter(AccessLevel.PACKAGE) - private int textSize = 32; - - private WorldPoint lastLocation = new WorldPoint(0, 0, 0); - - @Getter(AccessLevel.PACKAGE) - private int currentWaveNumber; - - @Getter(AccessLevel.PACKAGE) - private final List infernoNpcs = new ArrayList<>(); - - @Getter(AccessLevel.PACKAGE) - private final Map> upcomingAttacks = new HashMap<>(); - @Getter(AccessLevel.PACKAGE) - private InfernoNPC.Attack closestAttack = null; - - @Getter(AccessLevel.PACKAGE) - private final List obstacles = new ArrayList<>(); - - @Getter(AccessLevel.PACKAGE) - private boolean finalPhase = false; - @Getter(AccessLevel.PACKAGE) - private NPC zukShield = null; - private WorldPoint zukShieldLastPosition = null; - private WorldPoint zukShieldBase = null; - private int zukShieldCornerTicks = -2; - - @Getter(AccessLevel.PACKAGE) - private InfernoNPC centralNibbler = null; - - // 0 = total safespot - // 1 = pray melee - // 2 = pray range - // 3 = pray magic - // 4 = pray melee, range - // 5 = pray melee, magic - // 6 = pray range, magic - // 7 = pray all - @Getter(AccessLevel.PACKAGE) - private final Map safeSpotMap = new HashMap<>(); - @Getter(AccessLevel.PACKAGE) - private final Map> safeSpotAreas = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private long lastTick; - - @Getter(AccessLevel.PACKAGE) - private InfernoPrayerDisplayMode prayerDisplayMode; - @Getter(AccessLevel.PACKAGE) - private boolean descendingBoxes; - @Getter(AccessLevel.PACKAGE) - private boolean indicateNonPriorityDescendingBoxes; - @Getter(AccessLevel.PACKAGE) - private boolean indicateBlobDetectionTick; - @Getter(AccessLevel.PACKAGE) - private boolean indicateWhenPrayingCorrectly; - - private InfernoWaveDisplayMode waveDisplay; - @Getter(AccessLevel.PACKAGE) - private InfernoNamingDisplayMode npcNaming; - @Getter(AccessLevel.PACKAGE) - private boolean npcLevels; - private Color getWaveOverlayHeaderColor; - private Color getWaveTextColor; - - @Getter(AccessLevel.PACKAGE) - private InfernoSafespotDisplayMode safespotDisplayMode; - @Getter(AccessLevel.PACKAGE) - private int safespotsCheckSize; - @Getter(AccessLevel.PACKAGE) - private boolean indicateNonSafespotted; - @Getter(AccessLevel.PACKAGE) - private boolean indicateTemporarySafespotted; - @Getter(AccessLevel.PACKAGE) - private boolean indicateSafespotted; - @Getter(AccessLevel.PACKAGE) - private boolean indicateObstacles; - - @Getter(AccessLevel.PACKAGE) - private boolean indicateNibblers; - @Getter(AccessLevel.PACKAGE) - private boolean indicateCentralNibbler; - - @Getter(AccessLevel.PACKAGE) - private boolean indicateActiveHealersJad; - @Getter(AccessLevel.PACKAGE) - private boolean indicateActiveHealersZuk; - - private boolean indicateNpcPositionBat; - private boolean indicateNpcPositionBlob; - private boolean indicateNpcPositionMeleer; - private boolean indicateNpcPositionRanger; - private boolean indicateNpcPositionMage; - - private boolean ticksOnNpcBat; - private boolean ticksOnNpcBlob; - private boolean ticksOnNpcMeleer; - private boolean ticksOnNpcRanger; - private boolean ticksOnNpcMage; - private boolean ticksOnNpcHealerJad; - private boolean ticksOnNpcJad; - private boolean ticksOnNpcZuk; - - @Getter(AccessLevel.PACKAGE) - private boolean ticksOnNpcZukShield; - - private boolean safespotsBat; - private boolean safespotsBlob; - private boolean safespotsMeleer; - private boolean safespotsRanger; - private boolean safespotsMage; - private boolean safespotsHealerJad; - private boolean safespotsJad; - private InfernoZukShieldDisplayMode safespotsZukShieldBeforeHealers; - private InfernoZukShieldDisplayMode safespotsZukShieldAfterHealers; - - private boolean prayerBat; - private boolean prayerBlob; - private boolean prayerMeleer; - private boolean prayerRanger; - private boolean prayerMage; - private boolean prayerHealerJad; - private boolean prayerJad; - - private boolean hideNibblerDeath; - private boolean hideBatDeath; - private boolean hideBlobDeath; - private boolean hideBlobSmallRangedDeath; - private boolean hideBlobSmallMagicDeath; - private boolean hideBlobSmallMeleeDeath; - private boolean hideMeleerDeath; - private boolean hideRangerDeath; - private boolean hideMagerDeath; - private boolean hideJadDeath; - private boolean hideHealerJadDeath; - private boolean hideHealerZukDeath; - private boolean hideZukDeath; - - @Provides - InfernoConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(InfernoConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - waveOverlay.setDisplayMode(this.waveDisplay); - waveOverlay.setWaveHeaderColor(this.getWaveOverlayHeaderColor); - waveOverlay.setWaveTextColor(this.getWaveTextColor); - - if (isInInferno()) - { - overlayManager.add(infernoOverlay); - - if (this.waveDisplay != InfernoWaveDisplayMode.NONE) - { - overlayManager.add(waveOverlay); - } - - overlayManager.add(jadOverlay); - overlayManager.add(prayerOverlay); - hideNpcDeaths(); - } - } - - @Override - protected void shutDown() - { - overlayManager.remove(infernoOverlay); - overlayManager.remove(waveOverlay); - overlayManager.remove(jadOverlay); - overlayManager.remove(prayerOverlay); - - currentWaveNumber = -1; - - showNpcDeaths(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!"inferno".equals(event.getGroup())) - { - return; - } - - updateConfig(); - hideNpcDeaths(); - showNpcDeaths(); - - if (event.getKey().endsWith("color")) - { - waveOverlay.setWaveHeaderColor(this.getWaveOverlayHeaderColor); - waveOverlay.setWaveTextColor(this.getWaveTextColor); - } - else if ("waveDisplay".equals(event.getKey())) - { - overlayManager.remove(waveOverlay); - - waveOverlay.setDisplayMode(this.waveDisplay); - - if (isInInferno() && this.waveDisplay != InfernoWaveDisplayMode.NONE) - { - overlayManager.add(waveOverlay); - } - } - } - - @Subscribe - private void onGameTick(GameTick GameTickEvent) - { - if (!isInInferno()) - { - return; - } - - lastTick = System.currentTimeMillis(); - - upcomingAttacks.clear(); - calculateUpcomingAttacks(); - - closestAttack = null; - calculateClosestAttack(); - - safeSpotMap.clear(); - calculateSafespots(); - - safeSpotAreas.clear(); - calculateSafespotAreas(); - - obstacles.clear(); - calculateObstacles(); - - centralNibbler = null; - calculateCentralNibbler(); - } - - @Subscribe - private void onNpcSpawned(NpcSpawned event) - { - if (!isInInferno()) - { - return; - } - - if (event.getNpc().getId() == NpcID.ANCESTRAL_GLYPH) - { - zukShield = event.getNpc(); - } - - final InfernoNPC.Type infernoNPCType = InfernoNPC.Type.typeFromId(event.getNpc().getId()); - - if (infernoNPCType == null) - { - return; - } - - if (infernoNPCType == InfernoNPC.Type.ZUK) - { - log.debug("[INFERNO] Zuk spawn detected, not in final phase"); - finalPhase = false; - zukShieldCornerTicks = -2; - zukShieldLastPosition = null; - zukShieldBase = null; - } - if (infernoNPCType == InfernoNPC.Type.HEALER_ZUK) - { - log.debug("[INFERNO] Final phase detected!"); - finalPhase = true; - } - - // Blobs need to be added to the end of the list because the prayer for their detection tick will be based - // on the upcoming attacks of other NPC's - if (infernoNPCType == InfernoNPC.Type.BLOB) - { - infernoNpcs.add(new InfernoNPC(event.getNpc())); - } - else - { - infernoNpcs.add(0, new InfernoNPC(event.getNpc())); - } - } - - @Subscribe - private void onNpcDespawned(NpcDespawned event) - { - if (!isInInferno()) - { - return; - } - - if (event.getNpc().getId() == NpcID.ANCESTRAL_GLYPH) - { - zukShield = null; - } - - infernoNpcs.removeIf(infernoNPC -> infernoNPC.getNpc() == event.getNpc()); - } - - @Subscribe - private void onAnimationChanged(AnimationChanged event) - { - if (!isInInferno()) - { - return; - } - - if (event.getActor() instanceof NPC) - { - final NPC npc = (NPC) event.getActor(); - - if (ArrayUtils.contains(InfernoNPC.Type.NIBBLER.getNpcIds(), npc.getId()) - && npc.getAnimation() == 7576) - { - infernoNpcs.removeIf(infernoNPC -> infernoNPC.getNpc() == npc); - } - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() != GameState.LOGGED_IN) - { - return; - } - - if (!isInInferno()) - { - infernoNpcs.clear(); - - currentWaveNumber = -1; - - overlayManager.remove(infernoOverlay); - overlayManager.remove(waveOverlay); - overlayManager.remove(jadOverlay); - overlayManager.remove(prayerOverlay); - } - else if (currentWaveNumber == -1) - { - infernoNpcs.clear(); - - currentWaveNumber = 1; - - overlayManager.add(infernoOverlay); - overlayManager.add(jadOverlay); - overlayManager.add(prayerOverlay); - - if (this.waveDisplay != InfernoWaveDisplayMode.NONE) - { - overlayManager.add(waveOverlay); - } - } - } - - @Subscribe - private void onChatMessage(ChatMessage event) - { - if (!isInInferno() || event.getType() != ChatMessageType.GAMEMESSAGE) - { - return; - } - - String message = event.getMessage(); - - if (event.getMessage().contains("Wave:")) - { - message = message.substring(message.indexOf(": ") + 2); - currentWaveNumber = Integer.parseInt(message.substring(0, message.indexOf('<'))); - } - } - - private boolean isInInferno() - { - return ArrayUtils.contains(client.getMapRegions(), INFERNO_REGION); - } - - int getNextWaveNumber() - { - return currentWaveNumber == -1 || currentWaveNumber == 69 ? -1 : currentWaveNumber + 1; - } - - private void calculateUpcomingAttacks() - { - for (InfernoNPC infernoNPC : infernoNpcs) - { - infernoNPC.gameTick(client, lastLocation, finalPhase); - - if (infernoNPC.getType() == InfernoNPC.Type.ZUK && zukShieldCornerTicks == -1) - { - infernoNPC.updateNextAttack(InfernoNPC.Attack.UNKNOWN, 12); // TODO: Could be 10 or 11. Test! - zukShieldCornerTicks = 0; - } - - // Map all upcoming attacks and their priority + determine which NPC is about to attack next - if (infernoNPC.getTicksTillNextAttack() > 0 && isPrayerHelper(infernoNPC) - && (infernoNPC.getNextAttack() != InfernoNPC.Attack.UNKNOWN - || (indicateBlobDetectionTick && infernoNPC.getType() == InfernoNPC.Type.BLOB - && infernoNPC.getTicksTillNextAttack() >= 4))) - { - upcomingAttacks.computeIfAbsent(infernoNPC.getTicksTillNextAttack(), k -> new HashMap<>()); - - if (indicateBlobDetectionTick && infernoNPC.getType() == InfernoNPC.Type.BLOB - && infernoNPC.getTicksTillNextAttack() >= 4) - { - upcomingAttacks.computeIfAbsent(infernoNPC.getTicksTillNextAttack() - 3, k -> new HashMap<>()); - upcomingAttacks.computeIfAbsent(infernoNPC.getTicksTillNextAttack() - 4, k -> new HashMap<>()); - - // If there's already a magic attack on the detection tick, group them - if (upcomingAttacks.get(infernoNPC.getTicksTillNextAttack() - 3).containsKey(InfernoNPC.Attack.MAGIC)) - { - if (upcomingAttacks.get(infernoNPC.getTicksTillNextAttack() - 3).get(InfernoNPC.Attack.MAGIC) > InfernoNPC.Type.BLOB.getPriority()) - { - upcomingAttacks.get(infernoNPC.getTicksTillNextAttack() - 3).put(InfernoNPC.Attack.MAGIC, InfernoNPC.Type.BLOB.getPriority()); - } - } - // If there's already a ranged attack on the detection tick, group them - else if (upcomingAttacks.get(infernoNPC.getTicksTillNextAttack() - 3).containsKey(InfernoNPC.Attack.RANGED)) - { - if (upcomingAttacks.get(infernoNPC.getTicksTillNextAttack() - 3).get(InfernoNPC.Attack.RANGED) > InfernoNPC.Type.BLOB.getPriority()) - { - upcomingAttacks.get(infernoNPC.getTicksTillNextAttack() - 3).put(InfernoNPC.Attack.RANGED, InfernoNPC.Type.BLOB.getPriority()); - } - } - // If there's going to be a magic attack on the blob attack tick, pray range on the detect tick so magic is prayed on the attack tick - else if (upcomingAttacks.get(infernoNPC.getTicksTillNextAttack()).containsKey(InfernoNPC.Attack.MAGIC) - || upcomingAttacks.get(infernoNPC.getTicksTillNextAttack() - 4).containsKey(InfernoNPC.Attack.MAGIC)) - { - if (!upcomingAttacks.get(infernoNPC.getTicksTillNextAttack() - 3).containsKey(InfernoNPC.Attack.RANGED) - || upcomingAttacks.get(infernoNPC.getTicksTillNextAttack() - 3).get(InfernoNPC.Attack.RANGED) > InfernoNPC.Type.BLOB.getPriority()) - { - upcomingAttacks.get(infernoNPC.getTicksTillNextAttack() - 3).put(InfernoNPC.Attack.RANGED, InfernoNPC.Type.BLOB.getPriority()); - } - } - // If there's going to be a ranged attack on the blob attack tick, pray magic on the detect tick so range is prayed on the attack tick - else if (upcomingAttacks.get(infernoNPC.getTicksTillNextAttack()).containsKey(InfernoNPC.Attack.RANGED) - || upcomingAttacks.get(infernoNPC.getTicksTillNextAttack() - 4).containsKey(InfernoNPC.Attack.RANGED)) - { - if (!upcomingAttacks.get(infernoNPC.getTicksTillNextAttack() - 3).containsKey(InfernoNPC.Attack.MAGIC) - || upcomingAttacks.get(infernoNPC.getTicksTillNextAttack() - 3).get(InfernoNPC.Attack.MAGIC) > InfernoNPC.Type.BLOB.getPriority()) - { - upcomingAttacks.get(infernoNPC.getTicksTillNextAttack() - 3).put(InfernoNPC.Attack.MAGIC, InfernoNPC.Type.BLOB.getPriority()); - } - } - // If there's no magic or ranged attack on the detection tick, create a magic pray blob - else - { - upcomingAttacks.get(infernoNPC.getTicksTillNextAttack() - 3).put(InfernoNPC.Attack.MAGIC, InfernoNPC.Type.BLOB.getPriority()); - } - } - else - { - final InfernoNPC.Attack attack = infernoNPC.getNextAttack(); - final int priority = infernoNPC.getType().getPriority(); - - if (!upcomingAttacks.get(infernoNPC.getTicksTillNextAttack()).containsKey(attack) - || upcomingAttacks.get(infernoNPC.getTicksTillNextAttack()).get(attack) > priority) - { - upcomingAttacks.get(infernoNPC.getTicksTillNextAttack()).put(attack, priority); - } - } - } - } - } - - private void calculateClosestAttack() - { - if (prayerDisplayMode == InfernoPrayerDisplayMode.PRAYER_TAB - || prayerDisplayMode == InfernoPrayerDisplayMode.BOTH) - { - int closestTick = 999; - int closestPriority = 999; - - for (Integer tick : upcomingAttacks.keySet()) - { - final Map attackPriority = upcomingAttacks.get(tick); - - for (InfernoNPC.Attack currentAttack : attackPriority.keySet()) - { - final int currentPriority = attackPriority.get(currentAttack); - if (tick < closestTick || (tick == closestTick && currentPriority < closestPriority)) - { - closestAttack = currentAttack; - closestPriority = currentPriority; - closestTick = tick; - } - } - } - } - } - - private void calculateSafespots() - { - if (currentWaveNumber < 69) - { - if (safespotDisplayMode != InfernoSafespotDisplayMode.OFF) - { - int checkSize = (int) Math.floor(safespotsCheckSize / 2.0); - - for (int x = -checkSize; x <= checkSize; x++) - { - for (int y = -checkSize; y <= checkSize; y++) - { - final WorldPoint checkLoc = client.getLocalPlayer().getWorldLocation().dx(x).dy(y); - - if (obstacles.contains(checkLoc)) - { - continue; - } - - for (InfernoNPC infernoNPC : infernoNpcs) - { - if (!isNormalSafespots(infernoNPC)) - { - continue; - } - - if (!safeSpotMap.containsKey(checkLoc)) - { - safeSpotMap.put(checkLoc, 0); - } - - if (infernoNPC.canAttack(client, checkLoc) - || infernoNPC.canMoveToAttack(client, checkLoc, obstacles)) - { - if (infernoNPC.getType().getDefaultAttack() == InfernoNPC.Attack.MELEE) - { - if (safeSpotMap.get(checkLoc) == 0) - { - safeSpotMap.put(checkLoc, 1); - } - else if (safeSpotMap.get(checkLoc) == 2) - { - safeSpotMap.put(checkLoc, 4); - } - else if (safeSpotMap.get(checkLoc) == 3) - { - safeSpotMap.put(checkLoc, 5); - } - else if (safeSpotMap.get(checkLoc) == 6) - { - safeSpotMap.put(checkLoc, 7); - } - } - - if (infernoNPC.getType().getDefaultAttack() == InfernoNPC.Attack.MAGIC - || (infernoNPC.getType() == InfernoNPC.Type.BLOB - && safeSpotMap.get(checkLoc) != 2 && safeSpotMap.get(checkLoc) != 4)) - { - if (safeSpotMap.get(checkLoc) == 0) - { - safeSpotMap.put(checkLoc, 3); - } - else if (safeSpotMap.get(checkLoc) == 1) - { - safeSpotMap.put(checkLoc, 5); - } - else if (safeSpotMap.get(checkLoc) == 2) - { - safeSpotMap.put(checkLoc, 6); - } - else if (safeSpotMap.get(checkLoc) == 5) - { - safeSpotMap.put(checkLoc, 7); - } - } - - if (infernoNPC.getType().getDefaultAttack() == InfernoNPC.Attack.RANGED - || (infernoNPC.getType() == InfernoNPC.Type.BLOB - && safeSpotMap.get(checkLoc) != 3 && safeSpotMap.get(checkLoc) != 5)) - { - if (safeSpotMap.get(checkLoc) == 0) - { - safeSpotMap.put(checkLoc, 2); - } - else if (safeSpotMap.get(checkLoc) == 1) - { - safeSpotMap.put(checkLoc, 4); - } - else if (safeSpotMap.get(checkLoc) == 3) - { - safeSpotMap.put(checkLoc, 6); - } - else if (safeSpotMap.get(checkLoc) == 4) - { - safeSpotMap.put(checkLoc, 7); - } - } - - if (infernoNPC.getType() == InfernoNPC.Type.JAD - && infernoNPC.getNpc().getWorldArea().isInMeleeDistance(checkLoc)) - { - if (safeSpotMap.get(checkLoc) == 0) - { - safeSpotMap.put(checkLoc, 1); - } - else if (safeSpotMap.get(checkLoc) == 2) - { - safeSpotMap.put(checkLoc, 4); - } - else if (safeSpotMap.get(checkLoc) == 3) - { - safeSpotMap.put(checkLoc, 5); - } - else if (safeSpotMap.get(checkLoc) == 6) - { - safeSpotMap.put(checkLoc, 7); - } - } - } - } - } - } - } - } - else if (currentWaveNumber == 69 && zukShield != null) - { - final WorldPoint zukShieldCurrentPosition = zukShield.getWorldLocation(); - - if (zukShieldLastPosition != null && zukShieldLastPosition.getX() != zukShieldCurrentPosition.getX() - && zukShieldCornerTicks == -2) - { - zukShieldBase = zukShieldLastPosition; - zukShieldCornerTicks = -1; - } - - zukShieldLastPosition = zukShield.getWorldLocation(); - - if (safespotDisplayMode != InfernoSafespotDisplayMode.OFF) - { - if ((finalPhase && safespotsZukShieldAfterHealers == InfernoZukShieldDisplayMode.LIVE) - || (!finalPhase && safespotsZukShieldBeforeHealers == InfernoZukShieldDisplayMode.LIVE)) - { - for (int x = zukShield.getWorldLocation().getX() - 1; x <= zukShield.getWorldLocation().getX() + 3; x++) - { - for (int y = zukShield.getWorldLocation().getY() - 4; y <= zukShield.getWorldLocation().getY() - 2; y++) - { - safeSpotMap.put(new WorldPoint(x, y, client.getPlane()), 0); - } - } - } - else if ((finalPhase && safespotsZukShieldAfterHealers == InfernoZukShieldDisplayMode.PREDICT) - || (!finalPhase && safespotsZukShieldBeforeHealers == InfernoZukShieldDisplayMode.PREDICT)) - { - if (zukShieldCornerTicks >= 0) - { - // TODO: Predict zuk shield safespots - // Calculate distance from zukShieldCurrentPosition to zukShieldBase. - // - If shield is not in corner: calculate next position in current direction (use - // difference between current and last position to get direction) - // - If shield is in corner: increment zukShieldCornerTicks and predict next shield - // position based on how many ticks the shield has been in the corner. - } - } - } - } - } - - private void calculateSafespotAreas() - { - if (safespotDisplayMode == InfernoSafespotDisplayMode.AREA) - { - for (WorldPoint worldPoint : safeSpotMap.keySet()) - { - if (!safeSpotAreas.containsKey(safeSpotMap.get(worldPoint))) - { - safeSpotAreas.put(safeSpotMap.get(worldPoint), new ArrayList<>()); - } - - safeSpotAreas.get(safeSpotMap.get(worldPoint)).add(worldPoint); - } - } - - lastLocation = client.getLocalPlayer().getWorldLocation(); - } - - private void calculateObstacles() - { - for (NPC npc : client.getNpcs()) - { - obstacles.addAll(npc.getWorldArea().toWorldPointList()); - } - } - - private void calculateCentralNibbler() - { - InfernoNPC bestNibbler = null; - int bestAmountInArea = 0; - int bestDistanceToPlayer = 999; - - for (InfernoNPC infernoNPC : infernoNpcs) - { - if (infernoNPC.getType() != InfernoNPC.Type.NIBBLER) - { - continue; - } - - int amountInArea = 0; - final int distanceToPlayer = infernoNPC.getNpc().getWorldLocation().distanceTo(client.getLocalPlayer().getWorldLocation()); - - for (InfernoNPC checkNpc : infernoNpcs) - { - if (checkNpc.getType() != InfernoNPC.Type.NIBBLER - || checkNpc.getNpc().getWorldArea().distanceTo(infernoNPC.getNpc().getWorldArea()) > 1) - { - continue; - } - - amountInArea++; - } - - if (amountInArea > bestAmountInArea - || (amountInArea == bestAmountInArea && distanceToPlayer < bestDistanceToPlayer)) - { - bestNibbler = infernoNPC; - } - } - - if (bestNibbler != null) - { - centralNibbler = bestNibbler; - } - } - - private boolean isPrayerHelper(InfernoNPC infernoNPC) - { - switch (infernoNPC.getType()) - { - case BAT: - return prayerBat; - case BLOB: - return prayerBlob; - case MELEE: - return prayerMeleer; - case RANGER: - return prayerRanger; - case MAGE: - return prayerMage; - case HEALER_JAD: - return prayerHealerJad; - case JAD: - return prayerJad; - default: - return false; - } - } - - boolean isTicksOnNpc(InfernoNPC infernoNPC) - { - switch (infernoNPC.getType()) - { - case BAT: - return ticksOnNpcBat; - case BLOB: - return ticksOnNpcBlob; - case MELEE: - return ticksOnNpcMeleer; - case RANGER: - return ticksOnNpcRanger; - case MAGE: - return ticksOnNpcMage; - case HEALER_JAD: - return ticksOnNpcHealerJad; - case JAD: - return ticksOnNpcJad; - case ZUK: - return ticksOnNpcZuk; - default: - return false; - } - } - - boolean isNormalSafespots(InfernoNPC infernoNPC) - { - switch (infernoNPC.getType()) - { - case BAT: - return safespotsBat; - case BLOB: - return safespotsBlob; - case MELEE: - return safespotsMeleer; - case RANGER: - return safespotsRanger; - case MAGE: - return safespotsMage; - case HEALER_JAD: - return safespotsHealerJad; - case JAD: - return safespotsJad; - default: - return false; - } - } - - boolean isIndicateNpcPosition(InfernoNPC infernoNPC) - { - switch (infernoNPC.getType()) - { - case BAT: - return indicateNpcPositionBat; - case BLOB: - return indicateNpcPositionBlob; - case MELEE: - return indicateNpcPositionMeleer; - case RANGER: - return indicateNpcPositionRanger; - case MAGE: - return indicateNpcPositionMage; - default: - return false; - } - } - - private void hideNpcDeaths() - { - - if (this.hideNibblerDeath) - { - client.addHiddenNpcDeath("Jal-Nib"); - } - if (this.hideBatDeath) - { - client.addHiddenNpcDeath("Jal-MejRah"); - } - if (this.hideBlobDeath) - { - client.addHiddenNpcDeath("Jal-Ak"); - } - if (this.hideBlobSmallMeleeDeath) - { - client.addHiddenNpcDeath("Jal-AkRek-Ket"); - } - if (this.hideBlobSmallMagicDeath) - { - client.addHiddenNpcDeath("Jal-AkRek-Mej"); - } - if (this.hideBlobSmallRangedDeath) - { - client.addHiddenNpcDeath("Jal-AkRek-Xil"); - } - if (this.hideMeleerDeath) - { - client.addHiddenNpcDeath("Jal-ImKot"); - } - if (this.hideRangerDeath) - { - client.addHiddenNpcDeath("Jal-Xil"); - } - if (this.hideMagerDeath) - { - client.addHiddenNpcDeath("Jal-Zek"); - } - if (this.hideHealerJadDeath && isInInferno()) - { - client.addHiddenNpcDeath("Yt-HurKot"); - } - if (this.hideJadDeath) - { - client.addHiddenNpcDeath("JalTok-Jad"); - } - if (this.hideHealerZukDeath) - { - client.addHiddenNpcDeath("Jal-MejJak"); - } - if (this.hideZukDeath) - { - client.addHiddenNpcDeath("TzKal-Zuk"); - } - } - - private void showNpcDeaths() - { - - if (!this.hideNibblerDeath) - { - client.removeHiddenNpcDeath("Jal-Nib"); - } - if (!this.hideBatDeath) - { - client.removeHiddenNpcDeath("Jal-MejRah"); - } - if (!this.hideBlobDeath) - { - client.removeHiddenNpcDeath("Jal-Ak"); - } - if (!this.hideBlobSmallMeleeDeath) - { - client.removeHiddenNpcDeath("Jal-AkRek-Ket"); - } - if (!this.hideBlobSmallMagicDeath) - { - client.removeHiddenNpcDeath("Jal-AkRek-Mej"); - } - if (!this.hideBlobSmallRangedDeath) - { - client.removeHiddenNpcDeath("Jal-AkRek-Xil"); - } - if (!this.hideMeleerDeath) - { - client.removeHiddenNpcDeath("Jal-ImKot"); - } - if (!this.hideRangerDeath) - { - client.removeHiddenNpcDeath("Jal-Xil"); - } - if (!this.hideMagerDeath) - { - client.removeHiddenNpcDeath("Jal-Zek"); - } - if (!this.hideHealerJadDeath) - { - client.removeHiddenNpcDeath("Yt-HurKot"); - } - if (!this.hideJadDeath) - { - client.removeHiddenNpcDeath("JalTok-Jad"); - } - if (!this.hideHealerZukDeath) - { - client.removeHiddenNpcDeath("Jal-MejJak"); - } - if (!this.hideZukDeath) - { - client.removeHiddenNpcDeath("TzKal-Zuk"); - } - } - - private void updateConfig() - { - this.prayerDisplayMode = config.prayerDisplayMode(); - this.descendingBoxes = config.descendingBoxes(); - this.indicateWhenPrayingCorrectly = config.indicateWhenPrayingCorrectly(); - this.indicateNonPriorityDescendingBoxes = config.indicateNonPriorityDescendingBoxes(); - this.indicateBlobDetectionTick = config.indicateBlobDetectionTick(); - - this.waveDisplay = config.waveDisplay(); - this.npcNaming = config.npcNaming(); - this.npcLevels = config.npcLevels(); - this.getWaveOverlayHeaderColor = config.getWaveOverlayHeaderColor(); - this.getWaveTextColor = config.getWaveTextColor(); - - this.safespotDisplayMode = config.safespotDisplayMode(); - this.safespotsCheckSize = config.safespotsCheckSize(); - this.indicateNonSafespotted = config.indicateNonSafespotted(); - this.indicateTemporarySafespotted = config.indicateTemporarySafespotted(); - this.indicateSafespotted = config.indicateSafespotted(); - this.indicateObstacles = config.indicateObstacles(); - this.safespotsZukShieldBeforeHealers = config.safespotsZukShieldBeforeHealers(); - - this.indicateNibblers = config.indicateNibblers(); - this.indicateCentralNibbler = config.indicateCentralNibbler(); - - this.indicateActiveHealersJad = config.indicateActiveHealerJad(); - this.indicateActiveHealersZuk = config.indicateActiveHealerZuk(); - - this.indicateNpcPositionBat = config.indicateNpcPositionBat(); - this.indicateNpcPositionBlob = config.indicateNpcPositionBlob(); - this.indicateNpcPositionMeleer = config.indicateNpcPositionMeleer(); - this.indicateNpcPositionRanger = config.indicateNpcPositionRanger(); - this.indicateNpcPositionMage = config.indicateNpcPositionMage(); - - this.ticksOnNpcBat = config.ticksOnNpcBat(); - this.ticksOnNpcBlob = config.ticksOnNpcBlob(); - this.ticksOnNpcMeleer = config.ticksOnNpcMeleer(); - this.ticksOnNpcRanger = config.ticksOnNpcRanger(); - this.ticksOnNpcMage = config.ticksOnNpcMage(); - this.ticksOnNpcHealerJad = config.ticksOnNpcHealerJad(); - this.ticksOnNpcJad = config.ticksOnNpcJad(); - this.ticksOnNpcZuk = config.ticksOnNpcZuk(); - this.ticksOnNpcZukShield = config.ticksOnNpcZukShield(); - - this.safespotsBat = config.safespotsBat(); - this.safespotsBlob = config.safespotsBlob(); - this.safespotsMeleer = config.safespotsMeleer(); - this.safespotsRanger = config.safespotsRanger(); - this.safespotsMage = config.safespotsMage(); - this.safespotsHealerJad = config.safespotsHealerJad(); - this.safespotsJad = config.safespotsJad(); - this.safespotsZukShieldBeforeHealers = config.safespotsZukShieldBeforeHealers(); - this.safespotsZukShieldAfterHealers = config.safespotsZukShieldAfterHealers(); - - this.prayerBat = config.prayerBat(); - this.prayerBlob = config.prayerBlob(); - this.prayerMeleer = config.prayerMeleer(); - this.prayerRanger = config.prayerRanger(); - this.prayerMage = config.prayerMage(); - this.prayerHealerJad = config.prayerHealerJad(); - this.prayerJad = config.prayerJad(); - - this.hideNibblerDeath = config.hideNibblerDeath(); - this.hideBatDeath = config.hideBatDeath(); - this.hideBlobDeath = config.hideBlobDeath(); - this.hideBlobSmallRangedDeath = config.hideBlobSmallRangedDeath(); - this.hideBlobSmallMagicDeath = config.hideBlobSmallMagicDeath(); - this.hideBlobSmallMeleeDeath = config.hideBlobSmallMeleeDeath(); - this.hideMeleerDeath = config.hideMeleerDeath(); - this.hideRangerDeath = config.hideRangerDeath(); - this.hideMagerDeath = config.hideMagerDeath(); - this.hideHealerJadDeath = config.hideHealerJadDeath(); - this.hideJadDeath = config.hideJadDeath(); - this.hideHealerZukDeath = config.hideHealerZukDeath(); - this.hideZukDeath = config.hideZukDeath(); - } -} \ 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 deleted file mode 100644 index 4ee86a2823..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveMappings.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * 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 com.google.common.collect.ImmutableMap; -import java.awt.Color; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.plugins.inferno.displaymodes.InfernoNamingDisplayMode; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -class InfernoWaveMappings -{ - @Getter(AccessLevel.PACKAGE) - private static final Map waveMapping; - @Getter(AccessLevel.PACKAGE) - private static final Map npcNameMappingComplex; - @Getter(AccessLevel.PACKAGE) - private static final Map npcNameMappingSimple; - - static - { - ImmutableMap.Builder waveMapBuilder = new ImmutableMap.Builder<>(); - - waveMapBuilder.put(1, new int[]{32, 32, 32, 85}); - waveMapBuilder.put(2, new int[]{32, 32, 32, 85, 85}); - waveMapBuilder.put(3, new int[]{32, 32, 32, 32, 32, 32}); - waveMapBuilder.put(4, new int[]{32, 32, 32, 165}); - waveMapBuilder.put(5, new int[]{32, 32, 32, 85, 165}); - waveMapBuilder.put(6, new int[]{32, 32, 32, 85, 85, 165}); - waveMapBuilder.put(7, new int[]{32, 32, 32, 165, 165}); - waveMapBuilder.put(8, new int[]{32, 32, 32, 32, 32, 32}); - waveMapBuilder.put(9, new int[]{32, 32, 32, 240}); - waveMapBuilder.put(10, new int[]{32, 32, 32, 85, 240}); - waveMapBuilder.put(11, new int[]{32, 32, 32, 85, 85, 240}); - waveMapBuilder.put(12, new int[]{32, 32, 32, 165, 240}); - waveMapBuilder.put(13, new int[]{32, 32, 32, 85, 165, 240}); - waveMapBuilder.put(14, new int[]{32, 32, 32, 85, 85, 165, 240}); - waveMapBuilder.put(15, new int[]{32, 32, 32, 165, 165, 240}); - waveMapBuilder.put(16, new int[]{32, 32, 32, 240, 240}); - waveMapBuilder.put(17, new int[]{32, 32, 32, 32, 32, 32}); - waveMapBuilder.put(18, new int[]{32, 32, 32, 370}); - waveMapBuilder.put(19, new int[]{32, 32, 32, 85, 370}); - waveMapBuilder.put(20, new int[]{32, 32, 32, 85, 85, 370}); - waveMapBuilder.put(21, new int[]{32, 32, 32, 165, 370}); - waveMapBuilder.put(22, new int[]{32, 32, 32, 85, 165, 370}); - waveMapBuilder.put(23, new int[]{32, 32, 32, 85, 85, 165, 370}); - waveMapBuilder.put(24, new int[]{32, 32, 32, 165, 165, 370}); - waveMapBuilder.put(25, new int[]{32, 32, 32, 240, 370}); - waveMapBuilder.put(26, new int[]{32, 32, 32, 85, 240, 370}); - waveMapBuilder.put(27, new int[]{32, 32, 32, 85, 85, 240, 370}); - waveMapBuilder.put(28, new int[]{32, 32, 32, 165, 240, 370}); - waveMapBuilder.put(29, new int[]{32, 32, 32, 85, 165, 240, 370}); - waveMapBuilder.put(30, new int[]{32, 32, 32, 85, 85, 165, 240, 370}); - waveMapBuilder.put(31, new int[]{32, 32, 32, 165, 165, 240, 370}); - waveMapBuilder.put(32, new int[]{32, 32, 32, 240, 240, 370}); - waveMapBuilder.put(33, new int[]{32, 32, 32, 370, 370}); - waveMapBuilder.put(34, new int[]{32, 32, 32, 32, 32, 32}); - waveMapBuilder.put(35, new int[]{32, 32, 32, 490}); - waveMapBuilder.put(36, new int[]{32, 32, 32, 85, 490}); - waveMapBuilder.put(37, new int[]{32, 32, 32, 85, 85, 490}); - waveMapBuilder.put(38, new int[]{32, 32, 32, 165, 490}); - waveMapBuilder.put(39, new int[]{32, 32, 32, 85, 165, 490}); - waveMapBuilder.put(40, new int[]{32, 32, 32, 85, 85, 165, 490}); - waveMapBuilder.put(41, new int[]{32, 32, 32, 165, 165, 490}); - waveMapBuilder.put(42, new int[]{32, 32, 32, 240, 490}); - waveMapBuilder.put(43, new int[]{32, 32, 32, 85, 240, 490}); - waveMapBuilder.put(44, new int[]{32, 32, 32, 85, 85, 240, 490}); - waveMapBuilder.put(45, new int[]{32, 32, 32, 165, 240, 490}); - waveMapBuilder.put(46, new int[]{32, 32, 32, 85, 165, 240, 490}); - waveMapBuilder.put(47, new int[]{32, 32, 32, 85, 85, 165, 240, 490}); - waveMapBuilder.put(48, new int[]{32, 32, 32, 165, 165, 240, 490}); - waveMapBuilder.put(49, new int[]{32, 32, 32, 240, 240, 490}); - waveMapBuilder.put(50, new int[]{32, 32, 32, 370, 490}); - waveMapBuilder.put(51, new int[]{32, 32, 32, 85, 370, 490}); - waveMapBuilder.put(52, new int[]{32, 32, 32, 85, 85, 370, 490}); - waveMapBuilder.put(53, new int[]{32, 32, 32, 165, 370, 490}); - waveMapBuilder.put(54, new int[]{32, 32, 32, 85, 165, 370, 490}); - waveMapBuilder.put(55, new int[]{32, 32, 32, 85, 85, 165, 370, 490}); - waveMapBuilder.put(56, new int[]{32, 32, 32, 165, 165, 370, 490}); - waveMapBuilder.put(57, new int[]{32, 32, 32, 240, 370, 490}); - waveMapBuilder.put(58, new int[]{32, 32, 32, 85, 240, 370, 490}); - waveMapBuilder.put(59, new int[]{32, 32, 32, 85, 85, 240, 370, 490}); - waveMapBuilder.put(60, new int[]{32, 32, 32, 165, 240, 370, 490}); - waveMapBuilder.put(61, new int[]{32, 32, 32, 85, 165, 240, 370, 490}); - waveMapBuilder.put(62, new int[]{32, 32, 32, 85, 85, 165, 240, 370, 490}); - waveMapBuilder.put(63, new int[]{32, 32, 32, 165, 165, 240, 370, 490}); - waveMapBuilder.put(64, new int[]{32, 32, 32, 240, 240, 370, 490}); - waveMapBuilder.put(65, new int[]{32, 32, 32, 370, 370, 490}); - waveMapBuilder.put(66, new int[]{32, 32, 32, 490, 490}); - waveMapBuilder.put(67, new int[]{900}); - waveMapBuilder.put(68, new int[]{900, 900, 900}); - waveMapBuilder.put(69, new int[]{1400}); - - waveMapping = waveMapBuilder.build(); - - ImmutableMap.Builder nameMapBuilderSimple = new ImmutableMap.Builder<>(); - - nameMapBuilderSimple.put(32, "Nibbler"); - nameMapBuilderSimple.put(85, "Bat"); - nameMapBuilderSimple.put(165, "Blob"); - nameMapBuilderSimple.put(240, "Meleer"); - nameMapBuilderSimple.put(370, "Ranger"); - nameMapBuilderSimple.put(490, "Mage"); - nameMapBuilderSimple.put(900, "Jad"); - nameMapBuilderSimple.put(1400, "Zuk"); - - npcNameMappingSimple = nameMapBuilderSimple.build(); - - ImmutableMap.Builder nameMapBuilderComplex = new ImmutableMap.Builder<>(); - - nameMapBuilderComplex.put(32, "Jal-Nib"); - nameMapBuilderComplex.put(85, "Jal-MejRah"); - nameMapBuilderComplex.put(165, "Jal-Ak"); - nameMapBuilderComplex.put(240, "Jal-ImKot"); - nameMapBuilderComplex.put(370, "Jal-Xil"); - nameMapBuilderComplex.put(490, "Jal-Zek"); - nameMapBuilderComplex.put(900, "JalTok-Jad"); - nameMapBuilderComplex.put(1400, "TzKal-Zuk"); - - npcNameMappingComplex = nameMapBuilderComplex.build(); - } - - static void addWaveComponent(InfernoPlugin plugin, PanelComponent panelComponent, String header, int wave, Color titleColor, Color color) - { - int[] monsters = waveMapping.get(wave); - - if (monsters == null) - { - return; - } - - panelComponent.getChildren() - .add(TitleComponent.builder() - .text(header) - .color(titleColor) - .build() - ); - - - for (int i = 0; i < monsters.length; i++) - { - int monsterType = monsters[i]; - int count = 1; - - for (; i < monsters.length - 1 && monsters[i + 1] == monsterType; i++) - { - count++; - } - - TitleComponent.TitleComponentBuilder builder = TitleComponent.builder(); - - String npcNameText = ""; - - if (plugin.getNpcNaming() == InfernoNamingDisplayMode.SIMPLE) - { - npcNameText += npcNameMappingSimple.get(monsterType); - } - else - { - npcNameText += npcNameMappingComplex.get(monsterType); - } - - if (plugin.isNpcLevels()) - { - npcNameText += " (" + monsterType + ")"; - } - - builder.text(count + "x " + npcNameText); - builder.color(color); - - panelComponent.getChildren().add(builder.build()); - } - } -} \ No newline at end of file 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 deleted file mode 100644 index 1e09ca3f6e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java +++ /dev/null @@ -1,75 +0,0 @@ -package net.runelite.client.plugins.inferno; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import lombok.AccessLevel; -import lombok.Setter; -import static net.runelite.client.plugins.inferno.InfernoWaveMappings.addWaveComponent; -import net.runelite.client.plugins.inferno.displaymodes.InfernoWaveDisplayMode; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; -import net.runelite.client.ui.overlay.components.PanelComponent; - -@Singleton -public class InfernoWaveOverlay extends Overlay -{ - private final InfernoPlugin plugin; - private final PanelComponent panelComponent; - - @Setter(AccessLevel.PACKAGE) - private Color waveHeaderColor; - - @Setter(AccessLevel.PACKAGE) - private Color waveTextColor; - - @Setter(AccessLevel.PACKAGE) - private InfernoWaveDisplayMode displayMode; - - @Inject - InfernoWaveOverlay(final InfernoPlugin plugin) - { - this.panelComponent = new PanelComponent(); - this.setPosition(OverlayPosition.TOP_RIGHT); - this.setPriority(OverlayPriority.HIGH); - this.plugin = plugin; - - panelComponent.setPreferredSize(new Dimension(160, 0)); - } - - public Dimension render(final Graphics2D graphics) - { - panelComponent.getChildren().clear(); - - if (displayMode == InfernoWaveDisplayMode.CURRENT || - displayMode == InfernoWaveDisplayMode.BOTH) - { - addWaveComponent( - plugin, - panelComponent, - "Current Wave (Wave " + plugin.getCurrentWaveNumber() + ")", - plugin.getCurrentWaveNumber(), - waveHeaderColor, - waveTextColor - ); - } - - if (displayMode == InfernoWaveDisplayMode.NEXT || - displayMode == InfernoWaveDisplayMode.BOTH) - { - addWaveComponent( - plugin, - panelComponent, - "Next Wave (Wave " + plugin.getNextWaveNumber() + ")", - plugin.getNextWaveNumber(), - waveHeaderColor, - waveTextColor - ); - } - - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/displaymodes/InfernoNamingDisplayMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/displaymodes/InfernoNamingDisplayMode.java deleted file mode 100644 index 8818ef210a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/displaymodes/InfernoNamingDisplayMode.java +++ /dev/null @@ -1,7 +0,0 @@ -package net.runelite.client.plugins.inferno.displaymodes; - -public enum InfernoNamingDisplayMode -{ - SIMPLE, - COMPLEX -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/displaymodes/InfernoPrayerDisplayMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/displaymodes/InfernoPrayerDisplayMode.java deleted file mode 100644 index 2d2b489e49..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/displaymodes/InfernoPrayerDisplayMode.java +++ /dev/null @@ -1,8 +0,0 @@ -package net.runelite.client.plugins.inferno.displaymodes; - -public enum InfernoPrayerDisplayMode -{ - PRAYER_TAB, - BOTTOM_RIGHT, - BOTH -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/displaymodes/InfernoSafespotDisplayMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/displaymodes/InfernoSafespotDisplayMode.java deleted file mode 100644 index fe3a35adde..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/displaymodes/InfernoSafespotDisplayMode.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.runelite.client.plugins.inferno.displaymodes; - -import lombok.AccessLevel; -import lombok.Getter; - -@Getter(AccessLevel.PACKAGE) -public enum InfernoSafespotDisplayMode -{ - OFF("Off"), - INDIVIDUAL_TILES("Individual tiles"), - AREA("Area (lower fps)"); - - final private String name; - - InfernoSafespotDisplayMode(String name) - { - this.name = name; - } - - @Override - public String toString() - { - return this.name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/displaymodes/InfernoWaveDisplayMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/displaymodes/InfernoWaveDisplayMode.java deleted file mode 100644 index dcb1ccb5fb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/displaymodes/InfernoWaveDisplayMode.java +++ /dev/null @@ -1,44 +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.displaymodes; - -import lombok.RequiredArgsConstructor; - -@RequiredArgsConstructor -public enum InfernoWaveDisplayMode -{ - CURRENT("Current wave"), - NEXT("Next wave"), - BOTH("Both"), - NONE("None"); - - private final String name; - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/displaymodes/InfernoZukShieldDisplayMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/displaymodes/InfernoZukShieldDisplayMode.java deleted file mode 100644 index 081fff8f56..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/displaymodes/InfernoZukShieldDisplayMode.java +++ /dev/null @@ -1,25 +0,0 @@ -package net.runelite.client.plugins.inferno.displaymodes; - -import lombok.AccessLevel; -import lombok.Getter; - -@Getter(AccessLevel.PACKAGE) -public enum InfernoZukShieldDisplayMode -{ - OFF("Off"), - LIVE("Live (follow shield)"), - PREDICT("Predict (NOT WORKING YET)"); - - final private String name; - - InfernoZukShieldDisplayMode(String name) - { - this.name = name; - } - - @Override - public String toString() - { - return this.name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/instancemap/InstanceMapInputListener.java b/runelite-client/src/main/java/net/runelite/client/plugins/instancemap/InstanceMapInputListener.java deleted file mode 100644 index 6e6cbd9732..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/instancemap/InstanceMapInputListener.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel - * 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.instancemap; - -import java.awt.Point; -import java.awt.event.KeyEvent; -import java.awt.event.MouseEvent; -import java.awt.event.MouseWheelEvent; -import javax.inject.Inject; -import javax.swing.SwingUtilities; -import net.runelite.client.input.KeyListener; -import net.runelite.client.input.MouseAdapter; -import net.runelite.client.input.MouseWheelListener; - -class InstanceMapInputListener extends MouseAdapter implements KeyListener, MouseWheelListener -{ - @Inject - private InstanceMapPlugin plugin; - - @Inject - private InstanceMapOverlay overlay; - - @Override - public void keyTyped(KeyEvent event) - { - - } - - @Override - public void keyPressed(KeyEvent event) - { - if (!overlay.isMapShown()) - { - return; - } - - if (event.getKeyCode() == KeyEvent.VK_ESCAPE) - { - plugin.closeMap(); - event.consume(); - } - } - - @Override - public void keyReleased(KeyEvent event) - { - - } - - @Override - public MouseWheelEvent mouseWheelMoved(MouseWheelEvent event) - { - if (!overlay.isMapShown() || isNotWithinOverlay(event.getPoint())) - { - return event; - } - - int direction = event.getWheelRotation(); - - if (direction > 0) - { - plugin.ascendMap(); - } - else - { - plugin.descendMap(); - } - - event.consume(); - return event; - } - - @Override - public MouseEvent mouseClicked(MouseEvent event) - { - if (!overlay.isMapShown() || isNotWithinOverlay(event.getPoint())) - { - return event; - } - - event.consume(); - return event; - } - - @Override - public MouseEvent mousePressed(MouseEvent event) - { - if (!overlay.isMapShown() || isNotWithinOverlay(event.getPoint())) - { - return event; - } - - if (SwingUtilities.isLeftMouseButton(event) && isWithinCloseButton(event.getPoint())) - { - plugin.closeMap(); - } - - event.consume(); - return event; - } - - @Override - public MouseEvent mouseMoved(MouseEvent event) - { - if (overlay.isMapShown()) - { - overlay.setCloseButtonHovered(isWithinCloseButton(event.getPoint())); - } - - return event; - } - - private boolean isNotWithinOverlay(final Point point) - { - return !overlay.getBounds().contains(point); - } - - private boolean isWithinCloseButton(final Point point) - { - Point overlayPoint = new Point(point.x - (int) overlay.getBounds().getX(), - point.y - (int) overlay.getBounds().getY()); - - return overlay.getCloseButtonBounds() != null - && overlay.getCloseButtonBounds().contains(overlayPoint); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/instancemap/InstanceMapOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/instancemap/InstanceMapOverlay.java deleted file mode 100644 index b76369c0b1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/instancemap/InstanceMapOverlay.java +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright (c) 2017, 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.instancemap; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.image.BufferedImage; -import javax.annotation.Nullable; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.Client; -import net.runelite.api.Player; -import net.runelite.api.Sprite; -import static net.runelite.api.SpriteID.WINDOW_CLOSE_BUTTON_RED_X; -import static net.runelite.api.SpriteID.WINDOW_CLOSE_BUTTON_RED_X_HOVERED; -import net.runelite.api.Tile; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.events.GameStateChanged; -import net.runelite.client.game.SpriteManager; -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.BackgroundComponent; - -@Singleton -class InstanceMapOverlay extends Overlay -{ - /** - * The size of tiles on the map. The way the client renders requires - * this value to be 4. Changing this will break the method for rendering - * complex tiles - */ - private static final int TILE_SIZE = 4; - - /** - * The size of the player's position marker on the map - */ - private static final int PLAYER_MARKER_SIZE = 4; - - private static final int MAX_PLANE = 3; - private static final int MIN_PLANE = 0; - - /** - * The plane to render on the instance map. When the map is opened this - * defaults to the current plane. The ascend and descend buttons raise - * and lower this This is used to render parts of an instance below or - * above the local player's current plane. - */ - private int viewedPlane = 0; - - private final Client client; - private final SpriteManager spriteManager; - - /** - * Saved image of the scene, no reason to draw the whole thing every - * frame. - */ - private volatile BufferedImage mapImage; - private volatile boolean showMap = false; - private final BackgroundComponent backgroundComponent = new BackgroundComponent(); - - @Setter(AccessLevel.PACKAGE) - private boolean isCloseButtonHovered; - - @Getter(AccessLevel.PACKAGE) - private Rectangle closeButtonBounds; - - private BufferedImage closeButtonImage; - private BufferedImage closeButtonHoveredImage; - - @Inject - InstanceMapOverlay(Client client, SpriteManager spriteManager) - { - this.client = client; - this.spriteManager = spriteManager; - setPriority(OverlayPriority.HIGH); - setPosition(OverlayPosition.TOP_LEFT); - setLayer(OverlayLayer.ABOVE_WIDGETS); - backgroundComponent.setFill(false); - } - - boolean isMapShown() - { - return showMap; - } - - /** - * Setter for showing the map. When the map is set to show, the map is - * re-rendered - * - * @param show Whether or not the map should be shown. - */ - synchronized void setShowMap(boolean show) - { - showMap = show; - if (showMap) - { - //When we open the map show the current plane - viewedPlane = client.getPlane(); - } - mapImage = null; - } - - /** - * Increases the viewed plane. The maximum viewedPlane is 3 - */ - synchronized void onAscend() - { - if (viewedPlane >= MAX_PLANE) - { - return; - } - - viewedPlane++;//Increment plane - mapImage = null; - } - - /** - * Decreases the viewed plane. The minimum viewedPlane is 0 - */ - synchronized void onDescend() - { - if (viewedPlane <= MIN_PLANE) - { - return; - } - - viewedPlane--; - mapImage = null; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!showMap) - { - return null; - } - - // avoid locking on fast path by creating a local ref - BufferedImage image = mapImage; - - if (image == null) - { - Sprite map = client.drawInstanceMap(viewedPlane); - image = minimapToBufferedImage(map); - synchronized (this) - { - if (showMap) - { - mapImage = image; - } - } - } - - BufferedImage closeButton = getCloseButtonImage(); - BufferedImage closeButtonHover = getCloseButtonHoveredImage(); - if (closeButton != null && closeButtonBounds == null) - { - closeButtonBounds = new Rectangle(image.getWidth() - closeButton.getWidth() - 5, 6, - closeButton.getWidth(), closeButton.getHeight()); - } - - graphics.drawImage(image, 0, 0, null); - backgroundComponent.setRectangle(new Rectangle(0, 0, image.getWidth(), image.getHeight())); - backgroundComponent.render(graphics); - - if (client.getPlane() == viewedPlane)//If we are not viewing the plane we are on, don't show player's position - { - drawPlayerDot(graphics, client.getLocalPlayer(), Color.white, Color.black); - } - - if (isCloseButtonHovered) - { - closeButton = closeButtonHover; - } - - if (closeButton != null) - { - graphics.drawImage(closeButton, (int) closeButtonBounds.getX(), (int) closeButtonBounds.getY(), null); - } - - return new Dimension(image.getWidth(), image.getHeight()); - } - - /** - * Get the files for the current viewed plane - * - * @return - */ - private Tile[][] getTiles() - { - Tile[][][] sceneTiles = client.getScene().getTiles(); - return sceneTiles[viewedPlane]; - } - - /** - * Draws the players position as a dot on the map. - * - * @param graphics graphics to be drawn to - */ - private void drawPlayerDot(Graphics2D graphics, Player player, - Color dotColor, Color outlineColor) - { - LocalPoint playerLoc = player.getLocalLocation(); - - Tile[][] tiles = getTiles(); - int tileX = playerLoc.getSceneX(); - int tileY = (tiles[0].length - 1) - playerLoc.getSceneY(); // flip the y value - - int x = tileX * TILE_SIZE; - int y = tileY * TILE_SIZE; - graphics.setColor(dotColor); - graphics.fillRect(x, y, PLAYER_MARKER_SIZE, PLAYER_MARKER_SIZE);//draw the players point on the map - graphics.setColor(outlineColor); - graphics.drawRect(x, y, PLAYER_MARKER_SIZE, PLAYER_MARKER_SIZE);//outline - } - - /** - * Handles game state changes and re-draws the map - * - * @param event The game state change event - */ - void onGameStateChange(GameStateChanged event) - { - mapImage = null; - } - - private static BufferedImage minimapToBufferedImage(Sprite spritePixels) - { - int width = spritePixels.getWidth(); - int height = spritePixels.getHeight(); - int[] pixels = spritePixels.getPixels(); - BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); - img.setRGB(0, 0, width, height, pixels, 0, width); - // 24624 / 512 and 24624 % 512 are both 48 - img = img.getSubimage(48, 48, TILE_SIZE * 104, TILE_SIZE * 104); - return img; - } - - @Nullable - private BufferedImage getCloseButtonImage() - { - if (closeButtonImage == null) - { - closeButtonImage = spriteManager.getSprite(WINDOW_CLOSE_BUTTON_RED_X, 0); - } - return closeButtonImage; - } - - @Nullable - private BufferedImage getCloseButtonHoveredImage() - { - if (closeButtonHoveredImage == null) - { - closeButtonHoveredImage = spriteManager.getSprite(WINDOW_CLOSE_BUTTON_RED_X_HOVERED, 0); - } - return closeButtonHoveredImage; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/instancemap/InstanceMapPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/instancemap/InstanceMapPlugin.java deleted file mode 100644 index ab6dd42ae0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/instancemap/InstanceMapPlugin.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2017, 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.instancemap; - -import com.google.inject.Binder; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.WidgetMenuOptionClicked; -import net.runelite.api.widgets.WidgetInfo; -import static net.runelite.api.widgets.WidgetInfo.WORLD_MAP_OPTION; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.input.KeyManager; -import net.runelite.client.input.MouseManager; -import net.runelite.client.menus.MenuManager; -import net.runelite.client.menus.WidgetMenuOption; -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; - -@PluginDescriptor( - name = "Instance Map", - description = "Add an instanced map, accessible by right-clicking the map button", - type = PluginType.UTILITY -) -@Singleton -public class InstanceMapPlugin extends Plugin -{ - private final WidgetMenuOption openMapOption = new WidgetMenuOption("Show", "Instance Map", WidgetInfo.WORLD_MAP_OPTION); - - @Inject - private InstanceMapInputListener inputListener; - - @Inject - private OverlayManager overlayManager; - - @Inject - private InstanceMapOverlay overlay; - - @Inject - private MenuManager menuManager; - - @Inject - private KeyManager keyManager; - - @Inject - private MouseManager mouseManager; - - @Override - public void configure(Binder binder) - { - binder.bind(InstanceMapInputListener.class); - } - - private void addCustomOptions() - { - menuManager.addManagedCustomMenu(openMapOption); - } - - private void removeCustomOptions() - { - menuManager.removeManagedCustomMenu(openMapOption); - } - - @Override - protected void startUp() - { - - overlayManager.add(overlay); - addCustomOptions(); - keyManager.registerKeyListener(inputListener); - mouseManager.registerMouseListener(inputListener); - mouseManager.registerMouseWheelListener(inputListener); - } - - @Override - protected void shutDown() - { - overlay.setShowMap(false); - overlayManager.remove(overlay); - removeCustomOptions(); - keyManager.unregisterKeyListener(inputListener); - mouseManager.unregisterMouseListener(inputListener); - mouseManager.unregisterMouseWheelListener(inputListener); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - overlay.onGameStateChange(event); - } - - private boolean clickedOptionEquals(WidgetMenuOptionClicked event, WidgetMenuOption widgetMenuOption) - { - return event.getMenuOption().equals(widgetMenuOption.getMenuOption()) && event.getMenuTarget().equals(widgetMenuOption.getMenuTarget()); - } - - @Subscribe - private void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event) - { - if (event.getWidget() != WORLD_MAP_OPTION) - { - return; - } - - if (clickedOptionEquals(event, openMapOption)) - { - if (overlay.isMapShown()) - { - closeMap(); - } - else - { - showMap(); - } - } - } - - private void showMap() - { - overlay.setShowMap(true); - openMapOption.setMenuOption("Hide"); - } - - void closeMap() - { - overlay.setShowMap(false); - openMapOption.setMenuOption("Show"); - } - - void ascendMap() - { - overlay.onAscend(); - } - - void descendMap() - { - overlay.onDescend(); - } -} 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 deleted file mode 100644 index a0d82a26d7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/HealthbarOverride.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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.AccessLevel; -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"); - - private static final Map MAP; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (HealthbarOverride override : values()) - { - builder.put(override.spriteId, override); - } - - MAP = builder.build(); - } - - @Getter(AccessLevel.PUBLIC) - private final int spriteId; - private final String fileName; - @Getter(AccessLevel.PACKAGE) - private int padding = 1; - - 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/InterfaceStylesConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesConfig.java deleted file mode 100644 index 3f64778e52..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesConfig.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * 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 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.client.plugins.interfacestyles; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("interfaceStyles") -public interface InterfaceStylesConfig extends Config -{ - @ConfigItem( - keyName = "gameframe", - name = "Gameframe", - description = "The gameframe to use for the interface" - ) - default Skin skin() - { - return Skin.AROUND_2010; - } - - @ConfigItem( - keyName = "hdHealthBars", - name = "High Detail health bars", - description = "Replaces health bars with the RuneScape High Detail mode design" - ) - default boolean hdHealthBars() - { - return false; - } - - @ConfigItem( - keyName = "hdMenu", - name = "High Detail menu", - description = "Replaces game menu with the RuneScape High Detail mode design" - ) - default boolean hdMenu() - { - return false; - } - - @ConfigItem( - keyName = "rsCrossSprites", - name = "RuneScape cross sprites", - description = "Replaces left-click cross sprites with the ones in RuneScape" - ) - default boolean rsCrossSprites() - { - return false; - } -} \ 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 deleted file mode 100644 index 87324b2677..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * 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 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.client.plugins.interfacestyles; - -import com.google.inject.Provides; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.HealthBar; -import net.runelite.api.Sprite; -import net.runelite.api.SpriteID; -import net.runelite.api.events.BeforeMenuRender; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.PostHealthBar; -import net.runelite.api.events.WidgetPositioned; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.util.ImageUtil; - -@Slf4j -@PluginDescriptor( - name = "Interface Styles", - description = "Change the interface style to the 2005/2010 interface", - tags = {"2005", "2010", "skin", "theme", "ui"}, - enabledByDefault = false, - type = PluginType.MISCELLANEOUS -) -@Singleton -public class InterfaceStylesPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private InterfaceStylesConfig config; - - @Inject - private SpriteManager spriteManager; - - private Sprite[] defaultCrossSprites; - - private Skin skin; - private boolean hdHealthBars; - private boolean hdMenu; - private boolean rsCrossSprites; - - @Provides - InterfaceStylesConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(InterfaceStylesConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - clientThread.invoke(this::updateAllOverrides); - } - - @Override - protected void shutDown() - { - clientThread.invoke(() -> - { - restoreWidgetDimensions(); - removeGameframe(); - restoreHealthBars(); - restoreCrossSprites(); - }); - } - - @Subscribe - private void onConfigChanged(ConfigChanged config) - { - if (config.getGroup().equals("interfaceStyles")) - { - updateConfig(); - clientThread.invoke(this::updateAllOverrides); - } - } - - @Subscribe - private void onWidgetPositioned(WidgetPositioned widgetPositioned) - { - adjustWidgetDimensions(); - } - - @Subscribe - private void onPostHealthBar(PostHealthBar postHealthBar) - { - if (!this.hdHealthBars) - { - return; - } - - HealthBar healthBar = postHealthBar.getHealthBar(); - HealthbarOverride override = HealthbarOverride.get(healthBar.getHealthBarFrontSpriteId()); - - // Check if this is the health bar we are replacing - if (override != null) - { - // Increase padding to show some more green at very low hp percentages - healthBar.setPadding(override.getPadding()); - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged gameStateChanged) - { - if (gameStateChanged.getGameState() != GameState.LOGIN_SCREEN) - { - return; - } - - /* - * The cross sprites aren't loaded yet when the initial config change event is received. - * So run the overriding for cross sprites when we reach the login screen, - * at which point the cross sprites will have been loaded. - */ - overrideCrossSprites(); - } - - private void updateAllOverrides() - { - removeGameframe(); - overrideSprites(); - overrideWidgetSprites(); - restoreWidgetDimensions(); - adjustWidgetDimensions(); - overrideHealthBars(); - overrideCrossSprites(); - } - - @Subscribe - private void onBeforeMenuRender(BeforeMenuRender event) - { - if (this.hdMenu) - { - client.draw2010Menu(); - event.consume(); - } - } - - private void overrideSprites() - { - for (SpriteOverride spriteOverride : SpriteOverride.values()) - { - for (Skin skin : spriteOverride.getSkin()) - { - if (skin == this.skin) - { - String file = this.skin.toString() + "/" + spriteOverride.getSpriteID() + ".png"; - Sprite spritePixels = getFileSpritePixels(file); - - if (spriteOverride.getSpriteID() == SpriteID.COMPASS_TEXTURE) - { - client.setCompass(spritePixels); - } - else - { - client.getSpriteOverrides().put(spriteOverride.getSpriteID(), spritePixels); - } - } - } - } - } - - private void restoreSprites() - { - client.getWidgetSpriteCache().reset(); - - for (SpriteOverride spriteOverride : SpriteOverride.values()) - { - client.getSpriteOverrides().remove(spriteOverride.getSpriteID()); - } - } - - private void overrideWidgetSprites() - { - for (WidgetOverride widgetOverride : WidgetOverride.values()) - { - if (widgetOverride.getSkin() == this.skin) - { - String file = this.skin.toString() + "/widget/" + widgetOverride.getName() + ".png"; - Sprite spritePixels = getFileSpritePixels(file); - - if (spritePixels != null) - { - for (WidgetInfo widgetInfo : widgetOverride.getWidgetInfo()) - { - client.getWidgetSpriteOverrides().put(widgetInfo.getPackedId(), spritePixels); - } - } - } - } - } - - private void restoreWidgetSprites() - { - for (WidgetOverride widgetOverride : WidgetOverride.values()) - { - for (WidgetInfo widgetInfo : widgetOverride.getWidgetInfo()) - { - client.getWidgetSpriteOverrides().remove(widgetInfo.getPackedId()); - } - } - } - - private Sprite getFileSpritePixels(String file) - { - try - { - log.debug("Loading: {}", file); - BufferedImage image = ImageUtil.getResourceStreamFromClass(this.getClass(), file); - return ImageUtil.getImageSprite(image, client); - } - catch (RuntimeException ex) - { - log.debug("Unable to load image: ", ex); - } - - return null; - } - - private void adjustWidgetDimensions() - { - for (WidgetOffset widgetOffset : WidgetOffset.values()) - { - if (widgetOffset.getSkin() != this.skin) - { - continue; - } - - Widget widget = client.getWidget(widgetOffset.getWidgetInfo()); - - if (widget != null) - { - if (widgetOffset.getOffsetX() != null) - { - widget.setRelativeX(widgetOffset.getOffsetX()); - } - - if (widgetOffset.getOffsetY() != null) - { - widget.setRelativeY(widgetOffset.getOffsetY()); - } - - if (widgetOffset.getWidth() != null) - { - widget.setWidth(widgetOffset.getWidth()); - } - - if (widgetOffset.getHeight() != null) - { - widget.setHeight(widgetOffset.getHeight()); - } - } - } - } - - private void overrideHealthBars() - { - if (this.hdHealthBars) - { - spriteManager.addSpriteOverrides(HealthbarOverride.values()); - // Reset health bar caches to apply the override - clientThread.invokeLater(client::resetHealthBarCaches); - } - else - { - restoreHealthBars(); - } - } - - private void restoreHealthBars() - { - spriteManager.removeSpriteOverrides(HealthbarOverride.values()); - clientThread.invokeLater(client::resetHealthBarCaches); - } - - private void overrideCrossSprites() - { - if (this.rsCrossSprites) - { - // If we've already replaced them, - // we don't need to replace them again - if (defaultCrossSprites != null) - { - return; - } - - Sprite[] crossSprites = client.getCrossSprites(); - - if (crossSprites == null) - { - return; - } - - defaultCrossSprites = new Sprite[crossSprites.length]; - System.arraycopy(crossSprites, 0, defaultCrossSprites, 0, defaultCrossSprites.length); - - for (int i = 0; i < crossSprites.length; i++) - { - Sprite newSprite = getFileSpritePixels("rs3/cross_sprites/" + i + ".png"); - - if (newSprite == null) - { - continue; - } - - crossSprites[i] = newSprite; - } - } - else - { - restoreCrossSprites(); - } - } - - private void restoreCrossSprites() - { - if (defaultCrossSprites == null) - { - return; - } - - Sprite[] crossSprites = client.getCrossSprites(); - - if (crossSprites != null && defaultCrossSprites.length == crossSprites.length) - { - System.arraycopy(defaultCrossSprites, 0, crossSprites, 0, defaultCrossSprites.length); - } - - defaultCrossSprites = null; - } - - private void restoreWidgetDimensions() - { - for (WidgetOffset widgetOffset : WidgetOffset.values()) - { - Widget widget = client.getWidget(widgetOffset.getWidgetInfo()); - - if (widget != null) - { - widget.revalidate(); - } - } - } - - private void removeGameframe() - { - restoreSprites(); - restoreWidgetSprites(); - - BufferedImage compassImage = spriteManager.getSprite(SpriteID.COMPASS_TEXTURE, 0); - - if (compassImage != null) - { - Sprite compass = ImageUtil.getImageSprite(compassImage, client); - client.setCompass(compass); - } - } - - private void updateConfig() - { - this.skin = config.skin(); - this.hdHealthBars = config.hdHealthBars(); - this.hdMenu = config.hdMenu(); - this.rsCrossSprites = config.rsCrossSprites(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/Skin.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/Skin.java deleted file mode 100644 index 3e9aad9be9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/Skin.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * 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 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.client.plugins.interfacestyles; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter(AccessLevel.PACKAGE) -@AllArgsConstructor -public enum Skin -{ - DEFAULT("Default"), - AROUND_2005("2005"), - AROUND_2010("2010"); - - private String name; - - @Override - public String toString() - { - return getName(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/SpriteOverride.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/SpriteOverride.java deleted file mode 100644 index 6b7c6f34fc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/SpriteOverride.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * 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 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.client.plugins.interfacestyles; - -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.SpriteID; -import static net.runelite.client.plugins.interfacestyles.Skin.AROUND_2005; -import static net.runelite.client.plugins.interfacestyles.Skin.AROUND_2010; - -@Getter(AccessLevel.PACKAGE) -enum SpriteOverride -{ - TAB_COMBAT(SpriteID.TAB_COMBAT, AROUND_2005, AROUND_2010), - TAB_STATS(SpriteID.TAB_STATS, AROUND_2005, AROUND_2010), - TAB_QUESTS(SpriteID.TAB_QUESTS, AROUND_2005), - TAB_QUESTS_PURPLE_KOUREND_1299(SpriteID.TAB_QUESTS_PURPLE_KOUREND, AROUND_2005), - TAB_QUESTS_RED_MINIGAMES(SpriteID.TAB_QUESTS_RED_MINIGAMES, AROUND_2005), - TAB_QUESTS_GREEN_ACHIEVEMENT_DIARIES(SpriteID.TAB_QUESTS_GREEN_ACHIEVEMENT_DIARIES, AROUND_2005), - TAB_INVENTORY(SpriteID.TAB_INVENTORY, AROUND_2005, AROUND_2010), - TAB_EQUIPMENT(SpriteID.TAB_EQUIPMENT, AROUND_2005, AROUND_2010), - TAB_PRAYER(SpriteID.TAB_PRAYER, AROUND_2005, AROUND_2010), - TAB_MAGIC(SpriteID.TAB_MAGIC, AROUND_2005, AROUND_2010), - TAB_MAGIC_SPELLBOOK_ANCIENT_MAGICKS(SpriteID.TAB_MAGIC_SPELLBOOK_ANCIENT_MAGICKS, AROUND_2005), - TAB_MAGIC_SPELLBOOK_LUNAR(SpriteID.TAB_MAGIC_SPELLBOOK_LUNAR, AROUND_2005), - TAB_MAGIC_SPELLBOOK_ARCEUUS(SpriteID.TAB_MAGIC_SPELLBOOK_ARCEUUS, AROUND_2005), - TAB_CLAN_CHAT(SpriteID.TAB_CLAN_CHAT, AROUND_2005, AROUND_2010), - TAB_FRIENDS(SpriteID.TAB_FRIENDS, AROUND_2005, AROUND_2010), - TAB_IGNORES(SpriteID.TAB_IGNORES, AROUND_2005, AROUND_2010), - TAB_LOGOUT(SpriteID.TAB_LOGOUT, AROUND_2005, AROUND_2010), - TAB_OPTIONS(SpriteID.TAB_OPTIONS, AROUND_2005, AROUND_2010), - TAB_EMOTES(SpriteID.TAB_EMOTES, AROUND_2005, AROUND_2010), - TAB_MUSIC(SpriteID.TAB_MUSIC, AROUND_2005, AROUND_2010), - TAB_CHATBOX(SpriteID.CHATBOX, AROUND_2005), - - BUTTON_FRIENDS(SpriteID.BUTTON_FRIENDS, AROUND_2005), - BUTTON_IGNORES(SpriteID.BUTTON_IGNORES, AROUND_2005), - - SKILL_ATTACK(SpriteID.SKILL_ATTACK, AROUND_2010), - SKILL_STRENGTH(SpriteID.SKILL_STRENGTH, AROUND_2010), - SKILL_DEFENCE(SpriteID.SKILL_DEFENCE, AROUND_2010), - SKILL_RANGED(SpriteID.SKILL_RANGED, AROUND_2010), - SKILL_PRAYER(SpriteID.SKILL_PRAYER, AROUND_2005, AROUND_2010), - SKILL_MAGIC(SpriteID.SKILL_MAGIC, AROUND_2010), - SKILL_HITPOINTS(SpriteID.SKILL_HITPOINTS, AROUND_2010), - SKILL_AGILITY(SpriteID.SKILL_AGILITY, AROUND_2010), - SKILL_HERBLORE(SpriteID.SKILL_HERBLORE, AROUND_2010), - SKILL_THIEVING(SpriteID.SKILL_THIEVING, AROUND_2010), - SKILL_CRAFTING(SpriteID.SKILL_CRAFTING, AROUND_2010), - SKILL_FLETCHING(SpriteID.SKILL_FLETCHING, AROUND_2010), - SKILL_MINING(SpriteID.SKILL_MINING, AROUND_2010), - SKILL_SMITHING(SpriteID.SKILL_SMITHING, AROUND_2010), - SKILL_FISHING(SpriteID.SKILL_FISHING, AROUND_2010), - SKILL_COOKING(SpriteID.SKILL_COOKING, AROUND_2010), - SKILL_FIREMAKING(SpriteID.SKILL_FIREMAKING, AROUND_2010), - SKILL_WOODCUTTING(SpriteID.SKILL_WOODCUTTING, AROUND_2010), - SKILL_RUNECRAFT(SpriteID.SKILL_RUNECRAFT, AROUND_2010), - SKILL_SLAYER(SpriteID.SKILL_SLAYER, AROUND_2010), - SKILL_HUNTER(SpriteID.SKILL_HUNTER, AROUND_2010), - SKILL_CONSTRUCTION(SpriteID.SKILL_CONSTRUCTION, AROUND_2010), - - COMPASS(SpriteID.COMPASS_TEXTURE, AROUND_2005), - WINDOW_CLOSE_BUTTON_RED_X(SpriteID.WINDOW_CLOSE_BUTTON_RED_X, AROUND_2010), - WINDOW_CLOSE_BUTTON_RED_X_HOVERED(SpriteID.WINDOW_CLOSE_BUTTON_RED_X_HOVERED, AROUND_2010), - WINDOW_CLOSE_BUTTON_BROWN_X(SpriteID.WINDOW_CLOSE_BUTTON_BROWN_X, AROUND_2010), - WINDOW_CLOSE_BUTTON_BROWN_X_HOVERED(SpriteID.WINDOW_CLOSE_BUTTON_BROWN_X_HOVERED, AROUND_2010), - MINIMAP_ORB_FRAME(SpriteID.MINIMAP_ORB_FRAME, AROUND_2010), - MINIMAP_ORB_FRAME_HOVERED(SpriteID.MINIMAP_ORB_FRAME_HOVERED, AROUND_2010), - MINIMAP_ORB_XP(SpriteID.MINIMAP_ORB_XP, AROUND_2010), - MINIMAP_ORB_XP_ACTIVATED(SpriteID.MINIMAP_ORB_XP_ACTIVATED, AROUND_2010), - MINIMAP_ORB_XP_HOVERED(SpriteID.MINIMAP_ORB_XP_HOVERED, AROUND_2010), - MINIMAP_ORB_XP_ACTIVATED_HOVERED(SpriteID.MINIMAP_ORB_XP_ACTIVATED_HOVERED, AROUND_2010), - MINIMAP_ORB_WORLD_MAP_FRAME(SpriteID.MINIMAP_ORB_WORLD_MAP_FRAME, AROUND_2010), - MINIMAP_ORB_WORLD_MAP_PLANET(SpriteID.MINIMAP_ORB_WORLD_MAP_PLANET, AROUND_2010), - - //CHATBOX(SpriteID.CHATBOX, AROUND_2005), - CHATBOX_BUTTONS_BACKGROUND_STONES(SpriteID.CHATBOX_BUTTONS_BACKGROUND_STONES, AROUND_2005), - CHATBOX_BUTTON(SpriteID.CHATBOX_BUTTON, AROUND_2005), - CHATBOX_BUTTON_HOVERED(SpriteID.CHATBOX_BUTTON_HOVERED, AROUND_2005), - CHATBOX_BUTTON_NEW_MESSAGES(SpriteID.CHATBOX_BUTTON_NEW_MESSAGES, AROUND_2005), - CHATBOX_BUTTON_SELECTED(SpriteID.CHATBOX_BUTTON_SELECTED, AROUND_2005), - CHATBOX_BUTTON_SELECTED_HOVERED(SpriteID.CHATBOX_BUTTON_SELECTED_HOVERED, AROUND_2005), - CHATBOX_REPORT_BUTTON(SpriteID.CHATBOX_REPORT_BUTTON, AROUND_2005), - CHATBOX_REPORT_BUTTON_HOVERED(SpriteID.CHATBOX_REPORT_BUTTON_HOVERED, AROUND_2005), - - SCROLLBAR_ARROW_UP(SpriteID.SCROLLBAR_ARROW_UP, AROUND_2005), - SCROLLBAR_ARROW_DOWN(SpriteID.SCROLLBAR_ARROW_DOWN, AROUND_2005), - SCROLLBAR_THUMB_TOP(SpriteID.SCROLLBAR_THUMB_TOP, AROUND_2005), - SCROLLBAR_THUMB_MIDDLE(SpriteID.SCROLLBAR_THUMB_MIDDLE, AROUND_2005), - SCROLLBAR_THUMB_BOTTOM(SpriteID.SCROLLBAR_THUMB_BOTTOM, AROUND_2005), - SCROLLBAR_THUMB_MIDDLE_DARK(SpriteID.SCROLLBAR_THUMB_MIDDLE_DARK, AROUND_2005), - - TAB_STONE_TOP_LEFT_SELECTED(SpriteID.TAB_STONE_TOP_LEFT_SELECTED, AROUND_2010), - TAB_STONE_TOP_RIGHT_SELECTED(SpriteID.TAB_STONE_TOP_RIGHT_SELECTED, AROUND_2010), - TAB_STONE_BOTTOM_LEFT_SELECTED(SpriteID.TAB_STONE_BOTTOM_LEFT_SELECTED, AROUND_2010), - TAB_STONE_BOTTOM_RIGHT_SELECTED(SpriteID.TAB_STONE_BOTTOM_RIGHT_SELECTED, AROUND_2010), - TAB_STONE_MIDDLE_SELECTED(SpriteID.TAB_STONE_MIDDLE_SELECTED, AROUND_2010), - - FIXED_MODE_SIDE_PANEL_BACKGROUND(SpriteID.FIXED_MODE_SIDE_PANEL_BACKGROUND, AROUND_2005), - FIXED_MODE_TABS_ROW_BOTTOM(SpriteID.FIXED_MODE_TABS_ROW_BOTTOM, AROUND_2005, AROUND_2010), - - OLD_SCHOOl_MODE_SIDE_PANEL_EDGE_LEFT_UPPER(SpriteID.OLD_SCHOOl_MODE_SIDE_PANEL_EDGE_LEFT_UPPER, AROUND_2005, AROUND_2010), - OLD_SCHOOl_MODE_SIDE_PANEL_EDGE_LEFT_LOWER(SpriteID.OLD_SCHOOl_MODE_SIDE_PANEL_EDGE_LEFT_LOWER, AROUND_2005, AROUND_2010), - OLD_SCHOOl_MODE_SIDE_PANEL_EDGE_RIGHT(SpriteID.OLD_SCHOOl_MODE_SIDE_PANEL_EDGE_RIGHT, AROUND_2005, AROUND_2010), - - FIXED_MODE_TABS_TOP_ROW(SpriteID.FIXED_MODE_TABS_TOP_ROW, AROUND_2005, AROUND_2010), - FIXED_MODE_MINIMAP_LEFT_EDGE(SpriteID.FIXED_MODE_MINIMAP_LEFT_EDGE, AROUND_2005, AROUND_2010), - FIXED_MODE_MINIMAP_RIGHT_EDGE(SpriteID.FIXED_MODE_MINIMAP_RIGHT_EDGE, AROUND_2005, AROUND_2010), - FIXED_MODE_WINDOW_FRAME_EDGE_TOP(SpriteID.FIXED_MODE_WINDOW_FRAME_EDGE_TOP, AROUND_2005, AROUND_2010), - FIXED_MODE_MINIMAP_AND_COMPASS_FRAME(SpriteID.FIXED_MODE_MINIMAP_AND_COMPASS_FRAME, AROUND_2005, AROUND_2010), - FIXED_MODE_MINIMAP_FRAME_BOTTOM(SpriteID.FIXED_MODE_MINIMAP_FRAME_BOTTOM, AROUND_2005), - FIXED_MODE_TOP_RIGHT_CORNER(SpriteID.FIXED_MODE_TOP_RIGHT_CORNER, AROUND_2005), - - RESIZEABLE_MODE_TABS_TOP_ROW(SpriteID.RESIZEABLE_MODE_TABS_TOP_ROW, AROUND_2010), - RESIZEABLE_MODE_TABS_BOTTOM_ROW(SpriteID.RESIZEABLE_MODE_TABS_BOTTOM_ROW, AROUND_2010), - RESIZEABLE_MODE_SIDE_PANEL_EDGE_LEFT(SpriteID.RESIZEABLE_MODE_SIDE_PANEL_EDGE_LEFT, AROUND_2010), - RESIZEABLE_MODE_SIDE_PANEL_EDGE_RIGHT(SpriteID.RESIZEABLE_MODE_SIDE_PANEL_EDGE_RIGHT, AROUND_2010), - RESIZEABLE_MODE_MINIMAP_AND_COMPASS_FRAME(SpriteID.RESIZEABLE_MODE_MINIMAP_AND_COMPASS_FRAME, AROUND_2010), - RESIZEABLE_MODE_TAB_STONE_MIDDLE(SpriteID.RESIZEABLE_MODE_TAB_STONE_MIDDLE, AROUND_2010), - RESIZEABLE_MODE_TAB_STONE_MIDDLE_SELECTED(SpriteID.RESIZEABLE_MODE_TAB_STONE_MIDDLE_SELECTED, AROUND_2010); - - private int spriteID; - private Skin[] skin; - - SpriteOverride(int spriteID, Skin... skin) - { - this.spriteID = spriteID; - this.skin = skin; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java deleted file mode 100644 index 0d5b7ea54e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOffset.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * 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 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.client.plugins.interfacestyles; - -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.widgets.WidgetInfo; - -@Getter(AccessLevel.PACKAGE) -enum WidgetOffset -{ - RESIZABLE_2010_COMBAT_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_COMBAT_TAB, -4, 1, null, null), - RESIZABLE_2010_COMBAT_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_COMBAT_ICON, 5, null, null, null), - RESIZABLE_2010_STATS_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_STATS_TAB, 35, 1, null, null), - RESIZABLE_2010_STATS_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_STATS_ICON, 35, null, null, null), - RESIZABLE_2010_QUESTS_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_QUESTS_TAB, 69, 1, 33, null), - RESIZABLE_2010_QUESTS_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_QUESTS_ICON, 70, 1, 33, null), - RESIZABLE_2010_INVENTORY_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_TAB, 103, 1, null, null), - RESIZABLE_2010_INVENTORY_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_ICON, null, null, null, null), - RESIZABLE_2010_EQUIPMENT_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_EQUIPMENT_ICON, null, 3, null, null), - RESIZABLE_2010_EQUIPMENT_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_EQUIPMENT_TAB, null, 1, null, null), - RESIZABLE_2010_PRAYER_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_PRAYER_TAB, 171, 1, null, null), - RESIZABLE_2010_PRAYER_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_PRAYER_ICON, 172, 1, null, null), - RESIZABLE_2010_MAGIC_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_MAGIC_TAB, 205, 1, null, null), - RESIZABLE_2010_MAGIC_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_MAGIC_ICON, 206, null, null, null), - RESIZABLE_2010_CLAN_CHAT_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_CLAN_CHAT_TAB, -4, 1, null, null), - RESIZABLE_2010_CLAN_CHAT_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_CLAN_CHAT_ICON, 2, 1, null, null), - RESIZABLE_2010_FRIENDS_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_FRIENDS_TAB, 35, 1, null, null), - RESIZABLE_2010_FRIENDS_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_FRIENDS_ICON, 37, 1, null, null), - RESIZABLE_2010_IGNORES_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_IGNORES_TAB, 69, 1, null, null), - RESIZABLE_2010_IGNORES_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_IGNORES_ICON, 71, null, null, null), - RESIZABLE_2010_LOGOUT_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_LOGOUT_TAB, 103, 1, null, null), - RESIZABLE_2010_LOGOUT_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_LOGOUT_ICON, 104, 2, null, null), - RESIZABLE_2010_OPTIONS_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_OPTIONS_TAB, null, 1, null, null), - RESIZABLE_2010_OPTIONS_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_OPTIONS_ICON, 138, null, null, null), - RESIZABLE_2010_EMOTES_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_EMOTES_TAB, 171, 1, null, null), - RESIZABLE_2010_EMOTES_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_EMOTES_ICON, 172, 2, null, null), - RESIZABLE_2010_MUSIC_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_MUSIC_TAB, 205, 1, null, null), - RESIZABLE_2010_MUSIC_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_MUSIC_ICON, 204, 3, null, null), - - RESIZABLE_BOTTOM_2010_COMBAT_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_COMBAT_ICON, 2, null, null, null), - RESIZABLE_BOTTOM_2010_STATS_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_STATS_ICON, 32, null, null, null), - RESIZABLE_BOTTOM_2010_QUESTS_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_QUESTS_ICON, null, 1, null, null), - RESIZABLE_BOTTOM_2010_EQUIPMENT_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_EQUIPMENT_ICON, 132, 3, null, null), - RESIZABLE_BOTTOM_2010_PRAYERS_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_PRAYER_ICON, 165, 1, null, null), - RESIZABLE_BOTTOM_2010_LOGOUT_BUTTON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_LOGOUT_BUTTON, 185, null, null, null), - RESIZABLE_BOTTOM_2010_MAGIC_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_MAGIC_ICON, null, 2, null, null), - RESIZABLE_BOTTOM_2010_FRIEND_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_FRIEND_ICON, null, 3, null, null), - RESIZABLE_BOTTOM_2010_FRIEND_CHAT_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_FRIEND_CHAT_ICON, null, 2, null, null), - RESIZABLE_BOTTOM_2010_OPTIONS_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_OPTIONS_ICON, null, 2, null, null), - RESIZABLE_BOTTOM_2010_EMOTES_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_EMOTES_ICON, null, 3, null, null), - RESIZABLE_BOTTOM_2010_MUSIC_ICON(Skin.AROUND_2010, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_MUSIC_ICON, null, 3, null, null), - - FIXED_2010_COMBAT_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_COMBAT_TAB, 2, 1, null, null), - FIXED_2010_COMBAT_ICON(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_COMBAT_ICON, 11, null, null, null), - FIXED_2010_STATS_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_STATS_TAB, 41, 1, null, null), - FIXED_2010_STATS_ICON(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_STATS_ICON, 41, null, null, null), - FIXED_2010_QUESTS_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_QUESTS_TAB, 75, 1, 33, null), - FIXED_2010_QUESTS_ICON(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_QUESTS_ICON, 75, 0, null, null), - FIXED_2010_INVENTORY_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB, 109, 1, null, null), - FIXED_2010_INVENTORY_ICON(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_INVENTORY_ICON, 111, -1, null, null), - FIXED_2010_EQUIPMENT_ICON(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_ICON, 143, 2, null, null), - FIXED_2010_PRAYER_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_PRAYER_TAB, 177, 1, null, null), - FIXED_2010_PRAYER_ICON(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_PRAYER_ICON, 178, 1, null, null), - FIXED_2010_MAGIC_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB, 211, 1, null, null), - FIXED_2010_MAGIC_ICON(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_MAGIC_ICON, 212, 1, null, null), - FIXED_2010_CLAN_CHAT_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_TAB, 0, 1, null, null), - FIXED_2010_CLAN_CHAT_ICON(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_ICON, 5, null, null, null), - FIXED_2010_FRIENDS_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_FRIENDS_TAB, 38, 1, 33, null), - FIXED_2010_FRIENDS_ICON(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_FRIENDS_ICON, 40, null, null, null), - FIXED_2010_IGNORES_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_IGNORES_TAB, 72, 1, null, null), - FIXED_2010_IGNORES_ICON(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_IGNORES_ICON, 74, null, null, null), - FIXED_2010_LOGOUT_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_LOGOUT_TAB, 106, 1, null, null), - FIXED_2010_LOGOUT_ICON(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_LOGOUT_ICON, 107, 2, null, null), - FIXED_2010_OPTIONS_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_OPTIONS_TAB, 140, 1, null, null), - FIXED_2010_OPTIONS_ICON(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_OPTIONS_ICON, 143, null, null, null), - FIXED_2010_EMOTES_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_EMOTES_TAB, 174, 1, null, null), - FIXED_2010_EMOTES_ICON(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_EMOTES_ICON, 177, 2, null, null), - FIXED_2010_MUSIC_HIGHLIGHT(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_MUSIC_TAB, 208, 1, null, null), - FIXED_2010_MUSIC_ICON(Skin.AROUND_2010, WidgetInfo.FIXED_VIEWPORT_MUSIC_ICON, 209, 2, null, null), - - RESIZABLE_2005_QUESTS_ICON(Skin.AROUND_2005, WidgetInfo.RESIZABLE_VIEWPORT_QUESTS_ICON, 72, 0, null, null), - RESIZABLE_2005_LOGOUT_ICON(Skin.AROUND_2005, WidgetInfo.RESIZABLE_VIEWPORT_LOGOUT_ICON, null, null, null, null), - RESIZABLE_2005_OPTIONS_ICON(Skin.AROUND_2005, WidgetInfo.RESIZABLE_VIEWPORT_OPTIONS_ICON, 137, null, null, null), - RESIZABLE_2005_EMOTE_ICON(Skin.AROUND_2005, WidgetInfo.RESIZABLE_VIEWPORT_EMOTES_ICON, 173, 1, null, null), - RESIZABLE_2005_INVENTORY_ICON(Skin.AROUND_2005, WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_ICON, null, -2, null, null), - RESIZABLE_2005_EQUIPMENT_ICON(Skin.AROUND_2005, WidgetInfo.RESIZABLE_VIEWPORT_EQUIPMENT_ICON, null, 2, null, null), - RESIZABLE_2005_MUSIC_ICON(Skin.AROUND_2005, WidgetInfo.RESIZABLE_VIEWPORT_MUSIC_ICON, null, 3, null, null), - - RESIZABLE_BOTTOM_2005_INVENTORY_ICON(Skin.AROUND_2005, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_ICON, 98, 2, null, null), - RESIZABLE_BOTTOM_2005_QUESTS_ICON(Skin.AROUND_2005, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_QUESTS_ICON, 67, 0, null, null), - RESIZABLE_BOTTOM_2005_EQUIPMENT_ICON(Skin.AROUND_2005, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_EQUIPMENT_ICON, 132, 2, null, null), - - FIXED_2005_ROOT_INTERFACE_CONTAINER(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_ROOT_INTERFACE_CONTAINER, null, null, 197, null), - FIXED_2005_INTERFACE_CONTAINER(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_INTERFACE_CONTAINER, 7, null, null, null), - FIXED_2005_BANK_CONTAINER(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_BANK_CONTAINER, 7, null, null, null), - FIXED_2005_COMBAT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_COMBAT_TAB, 19, 2, null, null), - FIXED_2005_COMBAT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_COMBAT_ICON, 28, 1, null, null), - FIXED_2005_STATS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_STATS_TAB, 55, null, 30, null), - FIXED_2005_STATS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_STATS_ICON, 51, null, null, null), - FIXED_2005_QUESTS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_QUESTS_TAB, 82, 1, 30, null), - FIXED_2005_QUESTS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_QUESTS_ICON, 80, null, null, null), - FIXED_2005_INVENTORY_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB, null, null, 45, null), - FIXED_2005_INVENTORY_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_INVENTORY_ICON, 113, 1, null, null), - FIXED_2005_EQUIPMENT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_TAB, 153, 1, 30, null), - FIXED_2005_EQUIPMENT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_ICON, 151, 4, null, null), - FIXED_2005_PRAYER_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_PRAYER_TAB, 180, null, 32, null), - FIXED_2005_PRAYER_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_PRAYER_ICON, 178, null, null, null), - FIXED_2005_MAGIC_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB, 209, 1, 30, null), - FIXED_2005_MAGIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MAGIC_ICON, 206, 2, null, null), - FIXED_2005_CLAN_CHAT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_TAB, 15, null, null, null), - FIXED_2005_CLAN_CHAT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_ICON, 22, 0, null, null), - FIXED_2005_FRIENDS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_FRIENDS_TAB, 51, null, 30, null), - FIXED_2005_FRIENDS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_FRIENDS_ICON, 49, -1, null, null), - FIXED_2005_IGNORES_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_IGNORES_TAB, 79, null, 30, null), - FIXED_2005_IGNORES_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_IGNORES_ICON, 78, null, null, null), - FIXED_2005_LOGOUT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_LOGOUT_TAB, 107, 1, 45, null), - FIXED_2005_LOGOUT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_LOGOUT_ICON, 112, null, null, null), - FIXED_2005_OPTIONS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_OPTIONS_TAB, 150, null, 30, null), - FIXED_2005_OPTIONS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_OPTIONS_ICON, 148, -1, null, null), - FIXED_2005_EMOTES_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EMOTES_TAB, 178, null, 30, null), - FIXED_2005_EMOTES_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EMOTES_ICON, 178, 1, null, null), - FIXED_2005_MUSIC_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MUSIC_TAB, 206, null, 30, null), - FIXED_2005_MUSIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MUSIC_ICON, 202, 2, null, null); - - private Skin skin; - private WidgetInfo widgetInfo; - private Integer offsetX; - private Integer offsetY; - private Integer width; - private Integer height; - - WidgetOffset(Skin skin, WidgetInfo widgetInfo, Integer offsetX, Integer offsetY, Integer width, Integer height) - { - this.skin = skin; - this.widgetInfo = widgetInfo; - this.offsetX = offsetX; - this.offsetY = offsetY; - this.width = width; - this.height = height; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOverride.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOverride.java deleted file mode 100644 index 0a83eb372d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/WidgetOverride.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * 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 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.client.plugins.interfacestyles; - -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.widgets.WidgetInfo; - -@Getter(AccessLevel.PACKAGE) -enum WidgetOverride -{ - FIXED_CORNER_TOP_LEFT_2005(Skin.AROUND_2005, "1026", WidgetInfo.FIXED_VIEWPORT_COMBAT_TAB), - FIXED_CORNER_TOP_RIGHT_2005(Skin.AROUND_2005, "1027", WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB), - FIXED_CORNER_BOTTOM_LEFT_2005(Skin.AROUND_2005, "1028", WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_TAB), - FIXED_CORNER_BOTTOM_RIGHT_2005(Skin.AROUND_2005, "1029", WidgetInfo.FIXED_VIEWPORT_MUSIC_TAB), - FIXED_TOP_LEFT_2005(Skin.AROUND_2005, "1030_top_left", WidgetInfo.FIXED_VIEWPORT_STATS_TAB, WidgetInfo.FIXED_VIEWPORT_QUESTS_TAB), - FIXED_TOP_RIGHT_2005(Skin.AROUND_2005, "1030_top_right", WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_TAB, WidgetInfo.FIXED_VIEWPORT_PRAYER_TAB), - FIXED_TOP_MIDDLE_2005(Skin.AROUND_2005, "1030_top_middle", WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB), - FIXED_BOTTOM_LEFT_2005(Skin.AROUND_2005, "1030_bottom_left", WidgetInfo.FIXED_VIEWPORT_FRIENDS_TAB, WidgetInfo.FIXED_VIEWPORT_IGNORES_TAB), - FIXED_BOTTOM_RIGHT_2005(Skin.AROUND_2005, "1030_bottom_middle", WidgetInfo.FIXED_VIEWPORT_LOGOUT_TAB), - FIXED_BOTTOM_MIDDLE_2005(Skin.AROUND_2005, "1030_bottom_right", WidgetInfo.FIXED_VIEWPORT_OPTIONS_TAB, WidgetInfo.FIXED_VIEWPORT_EMOTES_TAB); - - private Skin skin; - private String name; - private WidgetInfo[] widgetInfo; - - WidgetOverride(final Skin skin, final String name, final WidgetInfo... widgetInfo) - { - this.skin = skin; - this.name = name; - this.widgetInfo = widgetInfo; - } -} \ No newline at end of file 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 deleted file mode 100644 index 9eefb67cee..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorygrid/InventoryGridConfig.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2018, Jeremy Plsek - * 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.inventorygrid; - -import java.awt.Color; -import net.runelite.client.config.Alpha; -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 -{ - @ConfigItem( - keyName = "showItem", - name = "Show item", - description = "Show a preview of the item in the new slot", - position = 1 - ) - default boolean showItem() - { - return true; - } - - @ConfigItem( - keyName = "showGrid", - name = "Show grid", - description = "Show a grid on the inventory while dragging", - position = 2 - ) - default boolean showGrid() - { - return true; - } - - @ConfigItem( - keyName = "showHighlight", - name = "Highlight background", - description = "Show a background highlight on the new slot", - position = 3 - ) - default boolean showHighlight() - { - return true; - } - - @ConfigItem( - keyName = "dragDelay", - name = "Drag Delay", - description = "Time in ms to wait after item press before showing grid", - position = 4 - ) - @Range(min = 100) - default int dragDelay() - { - return 100; - } - - @Alpha - @ConfigItem( - keyName = "gridColor", - name = "Grid color", - description = "The color of the grid", - position = 5 - ) - default Color gridColor() - { - return new Color(255, 255, 255, 45); - } - - @Alpha - @ConfigItem( - keyName = "highlightColor", - name = "Highlight color", - description = "The color of the new inventory slot highlight", - position = 6 - ) - default Color highlightColor() - { - return new Color(0, 255, 0, 45); - } -} 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 deleted file mode 100644 index d63be48c39..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorygrid/InventoryGridOverlay.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2018, Jeremy Plsek - * 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.inventorygrid; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.awt.AlphaComposite; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.image.BufferedImage; -import net.runelite.api.Client; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.api.widgets.WidgetItem; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayPosition; - -@Singleton -class InventoryGridOverlay extends Overlay -{ - private static final int INVENTORY_SIZE = 28; - private static final int DISTANCE_TO_ACTIVATE_HOVER = 5; - - private final InventoryGridPlugin plugin; - private final Client client; - private final ItemManager itemManager; - - private Point initialMousePoint; - private boolean hoverActive = false; - - @Inject - private InventoryGridOverlay(final InventoryGridPlugin plugin, final Client client, final ItemManager itemManager) - { - this.itemManager = itemManager; - this.client = client; - this.plugin = plugin; - - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - } - - @Override - public Dimension render(Graphics2D graphics) - { - final Widget if1DraggingWidget = client.getIf1DraggedWidget(); - final Widget inventoryWidget = client.getWidget(WidgetInfo.INVENTORY); - - - if (if1DraggingWidget == null || if1DraggingWidget != inventoryWidget) - { - initialMousePoint = null; - hoverActive = false; - return null; - } - - final net.runelite.api.Point mouse = client.getMouseCanvasPosition(); - final Point mousePoint = new Point(mouse.getX(), mouse.getY()); - final int if1DraggedItemIndex = client.getIf1DraggedItemIndex(); - final WidgetItem draggedItem = inventoryWidget.getWidgetItem(if1DraggedItemIndex); - final Rectangle initialBounds = draggedItem.getCanvasBounds(); - - if (initialMousePoint == null) - { - initialMousePoint = mousePoint; - } - - if (draggedItem.getId() == -1 || !hoverActive && initialMousePoint.distance(mousePoint) < DISTANCE_TO_ACTIVATE_HOVER) - { - return null; - } - - hoverActive = true; - - for (int i = 0; i < INVENTORY_SIZE; ++i) - { - WidgetItem targetWidgetItem = inventoryWidget.getWidgetItem(i); - - final Rectangle bounds = targetWidgetItem.getCanvasBounds(); - boolean inBounds = bounds.contains(mousePoint); - - if (plugin.isShowItem() && inBounds) - { - drawItem(graphics, bounds, draggedItem); - drawItem(graphics, initialBounds, targetWidgetItem); - } - - if (plugin.isShowHighlight() && inBounds) - { - graphics.setColor(plugin.getHighlightColor()); - graphics.fill(bounds); - } - else if (plugin.isShowGrid()) - { - graphics.setColor(plugin.getGridColor()); - graphics.fill(bounds); - } - } - - return null; - } - - private void drawItem(Graphics2D graphics, Rectangle bounds, WidgetItem item) - { - if (item.getId() == -1) - { - return; - } - - final BufferedImage draggedItemImage = itemManager.getImage(item.getId(), item.getQuantity(), false); - final int x = (int) bounds.getX(); - final int y = (int) bounds.getY(); - - graphics.setComposite(AlphaComposite.SrcOver.derive(0.3f)); - graphics.drawImage(draggedItemImage, x, y, null); - graphics.setComposite(AlphaComposite.SrcOver); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorygrid/InventoryGridPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorygrid/InventoryGridPlugin.java deleted file mode 100644 index a800cc81b4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorygrid/InventoryGridPlugin.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2018, Jeremy Plsek - * 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.inventorygrid; - -import com.google.inject.Inject; -import com.google.inject.Provides; -import com.google.inject.Singleton; -import java.awt.Color; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "Inventory Grid", - description = "Shows a grid over the inventory and a preview of where items will be dragged", - tags = {"items", "overlay"}, - enabledByDefault = false, - type = PluginType.UTILITY -) -@Singleton -public class InventoryGridPlugin extends Plugin -{ - @Inject - private InventoryGridOverlay overlay; - - @Inject - private OverlayManager overlayManager; - - @Inject - private InventoryGridConfig config; - - @Getter(AccessLevel.PACKAGE) - private boolean showItem; - @Getter(AccessLevel.PACKAGE) - boolean showGrid; - @Getter(AccessLevel.PACKAGE) - private boolean showHighlight; - @Getter(AccessLevel.PACKAGE) - private int dragDelay; - @Getter(AccessLevel.PACKAGE) - private Color gridColor; - @Getter(AccessLevel.PACKAGE) - private Color highlightColor; - - @Override - public void startUp() - { - updateConfig(); - overlayManager.add(overlay); - } - - @Override - public void shutDown() - { - overlayManager.remove(overlay); - } - - @Provides - InventoryGridConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(InventoryGridConfig.class); - } - - @Subscribe - private void onConfigChanged(ConfigChanged config) - { - if (config.getGroup().equals("inventorygrid")) - { - updateConfig(); - } - } - - private void updateConfig() - { - this.showItem = config.showItem(); - this.showGrid = config.showGrid(); - this.showHighlight = config.showHighlight(); - this.dragDelay = config.dragDelay(); - this.gridColor = config.gridColor(); - this.highlightColor = config.highlightColor(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetup.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetup.java deleted file mode 100644 index 71f3b2567a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetup.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2019, dillydill123 - * 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.inventorysetups; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; -import java.awt.Color; -import java.util.ArrayList; - -@AllArgsConstructor -public class InventorySetup -{ - @Getter - private ArrayList inventory; - - @Getter - private ArrayList equipment; - - @Getter - private ArrayList rune_pouch; - - @Getter - @Setter - private String name; - - @Getter - @Setter - private Color highlightColor; - - @Getter - @Setter - private boolean stackDifference; - - @Getter - @Setter - private boolean variationDifference; - - @Getter - @Setter - private boolean highlightDifference; - - @Getter - @Setter - private boolean filterBank; - - @Getter - @Setter - private boolean unorderedHighlight; - - public void updateInventory(final ArrayList inv) - { - inventory = inv; - } - - public void updateEquipment(final ArrayList eqp) - { - equipment = eqp; - } - - public void updateRunePouch(final ArrayList rp) - { - rune_pouch = rp; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupConfig.java deleted file mode 100644 index 6c14ff0c4e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupConfig.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2019, dillydill123 - * 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.inventorysetups; - -import java.awt.Color; -import net.runelite.client.config.Alpha; -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(InventorySetupPlugin.CONFIG_GROUP) -public interface InventorySetupConfig extends Config -{ - @ConfigItem( - keyName = "bankFilter", - name = "Default Filter Bank", - description = "Configures the default setting for bank filtering in new setups", - position = 0 - ) - default boolean bankFilter() - { - return false; - } - - @ConfigItem( - keyName = "highlightStackDifference", - name = "Default Highlight Stack Difference", - description = "Configures the default setting for highlighting stack differences in new setups", - position = 1 - ) - default boolean highlightStackDifference() - { - return false; - } - - @ConfigItem( - keyName = "highlightVarianceDifference", - name = "Default Highlight Variation Difference", - description = "Configures the default setting for highlighting variations in new setups", - position = 2 - ) - default boolean highlightVariationDifference() - { - return false; - } - - @ConfigItem( - keyName = "highlightUnorderedDifference", - name = "Default Highlight Unordered Difference", - description = "Configures the default setting for unordered highlighting in new setups", - position = 3 - ) - default boolean highlightUnorderedDifference() - { - return false; - } - - @ConfigItem( - keyName = "highlightDifference", - name = "Default Highlight", - description = "Configures the default setting for highlighting differences in new setups", - position = 4 - ) - default boolean highlightDifference() - { - return false; - } - - @Alpha - @ConfigItem( - keyName = "highlightColor", - name = "Default Highlight Color", - description = "Configures the default highlighting color in new setups", - position = 5 - ) - default Color highlightColor() - { - return Color.RED; - } - - @ConfigItem( - keyName = "returnToSetupsHotkey", - name = "Return To Setups Hotkey", - description = "Configures the hotkey for returning to setups", - position = 6 - ) - default Keybind returnToSetupsHotkey() - { - return Keybind.NOT_SET; - } - - @ConfigItem( - keyName = "filterBankHotkey", - name = "Filter Bank Hotkey", - description = "Configures the hotkey for filtering the bank", - position = 7 - ) - default Keybind filterBankHotkey() - { - return Keybind.NOT_SET; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupItem.java deleted file mode 100644 index d20a723a1a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupItem.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2019, dillydill123 - * 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.inventorysetups; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@AllArgsConstructor -public class InventorySetupItem -{ - @Getter - private final int id; - @Getter - private final String name; - @Getter - private final int quantity; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupOld.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupOld.java deleted file mode 100644 index 7adf1254c5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupOld.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.runelite.client.plugins.inventorysetups; - -import java.util.List; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@AllArgsConstructor -public class InventorySetupOld -{ -@Getter(AccessLevel.PUBLIC) -private List inventory; -@Getter(AccessLevel.PUBLIC) -private List equipment; -} 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 deleted file mode 100644 index 35a27d439f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupPlugin.java +++ /dev/null @@ -1,943 +0,0 @@ -/* - * Copyright (c) 2019, dillydill123 - * 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.inventorysetups; - -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; -import com.google.inject.Provides; -import java.awt.Color; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.inventorysetups.ui.InventorySetupPluginPanel; -import net.runelite.client.plugins.inventorysetups.ui.InventorySetupSlot; -import joptsimple.internal.Strings; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemDefinition; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemID; -import net.runelite.api.Varbits; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.api.events.VarClientIntChanged; -import net.runelite.api.vars.InputType; -import net.runelite.client.account.AccountSession; -import net.runelite.client.account.SessionManager; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.config.Keybind; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.SessionClose; -import net.runelite.client.events.SessionOpen; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.ItemVariationMapping; -import net.runelite.client.game.chatbox.ChatboxItemSearch; -import net.runelite.client.game.chatbox.ChatboxPanelManager; -import net.runelite.client.game.chatbox.ChatboxTextInput; -import net.runelite.client.input.KeyManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.banktags.tabs.BankSearch; -import net.runelite.client.plugins.runepouch.Runes; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.ui.components.colorpicker.ColorPickerManager; -import net.runelite.client.util.HotkeyListener; -import net.runelite.client.util.ImageUtil; -import javax.inject.Inject; -import javax.swing.JOptionPane; -import javax.swing.SwingUtilities; -import java.awt.Toolkit; -import java.awt.datatransfer.StringSelection; -import java.awt.image.BufferedImage; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.stream.Collectors; - -@PluginDescriptor( - name = "Inventory Setups", - description = "Save gear setups for specific activities", - tags = {"items", "inventory", "setups"}, - type = PluginType.UTILITY, - enabledByDefault = false -) - -@Slf4j -public class InventorySetupPlugin extends Plugin -{ - - public static final String CONFIG_GROUP = "inventorysetups"; - public static final String CONFIG_KEY = "setups"; - public static final String INV_SEARCH = "inv:"; - private static final int NUM_INVENTORY_ITEMS = 28; - private static final int NUM_EQUIPMENT_ITEMS = 14; - private static final Varbits[] RUNE_POUCH_AMOUNT_VARBITS = - { - Varbits.RUNE_POUCH_AMOUNT1, Varbits.RUNE_POUCH_AMOUNT2, Varbits.RUNE_POUCH_AMOUNT3 - }; - private static final Varbits[] RUNE_POUCH_RUNE_VARBITS = - { - Varbits.RUNE_POUCH_RUNE1, Varbits.RUNE_POUCH_RUNE2, Varbits.RUNE_POUCH_RUNE3 - }; - @Inject - private Client client; - @Inject - private SessionManager sessionManager; - @Inject - private ItemManager itemManager; - @Inject - private ClientToolbar clientToolbar; - @Inject - private ClientThread clientThread; - @Inject - private ConfigManager configManager; - @Inject - private InventorySetupConfig config; - @Inject - @Getter - private ColorPickerManager colorPickerManager; - private InventorySetupPluginPanel panel; - @Getter - private ArrayList inventorySetups; - private NavigationButton navButton; - @Inject - private BankSearch bankSearch; - @Inject - private KeyManager keyManager; - @Inject - private ChatboxItemSearch itemSearch; - @Inject - private ChatboxPanelManager chatboxPanelManager; - private ChatboxTextInput searchInput; - - private boolean bankFilter; - private boolean highlightStackDifference; - private boolean highlightVariationDifference; - private boolean highlightUnorderedDifference; - private boolean highlightDifference; - private Color highlightColor; - private Keybind returnToSetupsHotkey; - private Keybind filterBankHotkey; - - private final HotkeyListener returnToSetupsHotkeyListener = new HotkeyListener(() -> this.returnToSetupsHotkey) - { - @Override - public void hotkeyPressed() - { - panel.returnToOverviewPanel(); - } - }; - - private final HotkeyListener filterBankHotkeyListener = new HotkeyListener(() -> this.filterBankHotkey) - { - @Override - public void hotkeyPressed() - { - // you must wait at least one game tick otherwise - // the bank filter will work but then go back to the previous tab. - // For some reason this can still happen but it is very rare, - // and only when the user clicks a tab and the hot key extremely shortly after. - int gameTick = client.getTickCount(); - clientThread.invokeLater(() -> - { - int gameTick2 = client.getTickCount(); - if (gameTick2 <= gameTick) - { - return false; - } - - doBankSearch(); - return true; - }); - } - }; - - @Provides - InventorySetupConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(InventorySetupConfig.class); - } - - @Override - public void startUp() - { - updateConfig(); - - panel = new InventorySetupPluginPanel(this, itemManager); - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "inventorysetups_icon.png"); - - navButton = NavigationButton.builder() - .tooltip("Inventory Setups") - .icon(icon) - .priority(9) - .panel(panel) - .build(); - - clientToolbar.addNavigation(navButton); - keyManager.registerKeyListener(returnToSetupsHotkeyListener); - keyManager.registerKeyListener(filterBankHotkeyListener); - - // load all the inventory setups from the config file - clientThread.invokeLater(() -> - { - if (client.getGameState() != GameState.LOGIN_SCREEN) - { - return false; - } - - loadConfig(); - - SwingUtilities.invokeLater(() -> - { - panel.rebuild(); - }); - - return true; - }); - } - - @Override - public void shutDown() - { - clientToolbar.removeNavigation(navButton); - bankSearch.reset(true); - } - - public void addInventorySetup() - { - final String name = JOptionPane.showInputDialog(panel, - "Enter the name of this setup.", - "Add New Setup", - JOptionPane.PLAIN_MESSAGE); - - // cancel button was clicked - if (name == null) - { - return; - } - - clientThread.invokeLater(() -> - { - ArrayList inv = getNormalizedContainer(InventoryID.INVENTORY); - ArrayList eqp = getNormalizedContainer(InventoryID.EQUIPMENT); - - ArrayList runePouchData = null; - if (checkIfContainerContainsItem(ItemID.RUNE_POUCH, inv, false)) - { - runePouchData = getRunePouchData(); - } - - final InventorySetup invSetup = new InventorySetup(inv, eqp, runePouchData, name, - this.highlightColor, - this.highlightStackDifference, - this.highlightVariationDifference, - this.highlightDifference, - this.bankFilter, - this.highlightUnorderedDifference); - addInventorySetupClientThread(invSetup); - }); - } - - @Subscribe - public void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals(CONFIG_GROUP)) - { - return; - } - - updateConfig(); - } - - public List filterSetups(String textToFilter) - { - final String textToFilterLower = textToFilter.toLowerCase(); - return inventorySetups.stream() - .filter(i -> i.getName().toLowerCase().contains(textToFilterLower)) - .collect(Collectors.toList()); - } - - public void doBankSearch() - { - final InventorySetup currentSelectedSetup = panel.getCurrentSelectedSetup(); - - if (currentSelectedSetup != null && currentSelectedSetup.isFilterBank()) - { - client.setVarbit(Varbits.CURRENT_BANK_TAB, 0); - bankSearch.search(InputType.SEARCH, INV_SEARCH + currentSelectedSetup.getName(), true); - } - } - - @Subscribe - public void onVarClientIntChanged(VarClientIntChanged event) - { - if (event.getIndex() != 386) - { - return; - } - - // must be invoked later otherwise causes freezing. - clientThread.invokeLater(() -> - { - // checks to see if the hide worn items button was clicked or bank was opened - int value = client.getVarcIntValue(386); - if (value == 0) - { - doBankSearch(); - } - }); - } - - public void resetBankSearch() - { - bankSearch.reset(true); - } - - public ArrayList getRunePouchData() - { - ArrayList runePouchData = new ArrayList<>(); - for (int i = 0; i < RUNE_POUCH_RUNE_VARBITS.length; i++) - { - int runeId = client.getVar(RUNE_POUCH_RUNE_VARBITS[i]); - Runes rune = Runes.getRune(runeId); - int runeAmount = rune == null ? 0 : client.getVar(RUNE_POUCH_AMOUNT_VARBITS[i]); - String runeName = rune == null ? "" : rune.getName(); - int runeItemId = rune == null ? -1 : rune.getItemId(); - - runePouchData.add(new InventorySetupItem(runeItemId, runeName, runeAmount)); - } - - return runePouchData; - } - - @Subscribe - public void onScriptCallbackEvent(ScriptCallbackEvent event) - { - String eventName = event.getEventName(); - - int[] intStack = client.getIntStack(); - String[] stringStack = client.getStringStack(); - int intStackSize = client.getIntStackSize(); - int stringStackSize = client.getStringStackSize(); - - if (eventName.equals("bankSearchFilter")) - { - String search = stringStack[stringStackSize - 1]; - - if (search.startsWith(INV_SEARCH)) - { - final InventorySetup currentSetup = panel.getCurrentSelectedSetup(); - - if (currentSetup != null) - { - int itemId = intStack[intStackSize - 1]; - - if (setupContainsItem(currentSetup, itemId)) - { - // return true - intStack[intStackSize - 2] = 1; - } - else - { - intStack[intStackSize - 2] = 0; - } - } - } - } - } - - public void updateCurrentSetup(InventorySetup setup) - { - int confirm = JOptionPane.showConfirmDialog(panel, - "Are you sure you want update this inventory setup?", - "Warning", JOptionPane.OK_CANCEL_OPTION); - - // cancel button was clicked - if (confirm != JOptionPane.YES_OPTION) - { - return; - } - - // must be on client thread to get names - clientThread.invokeLater(() -> - { - ArrayList inv = getNormalizedContainer(InventoryID.INVENTORY); - ArrayList eqp = getNormalizedContainer(InventoryID.EQUIPMENT); - - ArrayList runePouchData = null; - if (checkIfContainerContainsItem(ItemID.RUNE_POUCH, inv, false)) - { - runePouchData = getRunePouchData(); - } - - setup.updateRunePouch(runePouchData); - setup.updateInventory(inv); - setup.updateEquipment(eqp); - updateJsonConfig(); - panel.refreshCurrentSetup(); - }); - } - - public void updateSlotFromContainer(final InventorySetupSlot slot) - { - if (client.getGameState() != GameState.LOGGED_IN) - { - JOptionPane.showMessageDialog(panel, - "You must be logged in to update from " + (slot.getSlotID().toString().toLowerCase() + "."), - "Cannot Update Item", - JOptionPane.ERROR_MESSAGE); - return; - } - - final ArrayList container = getContainerFromSlot(slot); - - // must be invoked on client thread to get the name - clientThread.invokeLater(() -> - { - final ArrayList playerContainer = getNormalizedContainer(slot.getSlotID()); - final InventorySetupItem newItem = playerContainer.get(slot.getIndexInSlot()); - - // update the rune pouch data - if (!updateIfRunePouch(slot, container.get(slot.getIndexInSlot()), newItem)) - { - return; - } - - container.set(slot.getIndexInSlot(), newItem); - updateJsonConfig(); - panel.refreshCurrentSetup(); - }); - - } - - public void updateSlotFromSearch(final InventorySetupSlot slot) - { - - if (client.getGameState() != GameState.LOGGED_IN) - { - JOptionPane.showMessageDialog(panel, - "You must be logged in to search.", - "Cannot Search for Item", - JOptionPane.ERROR_MESSAGE); - return; - } - - final ArrayList container = getContainerFromSlot(slot); - - itemSearch - .tooltipText("Set slot to") - .onItemSelected((itemId) -> - { - clientThread.invokeLater(() -> - { - int finalId = itemManager.canonicalize(itemId); - - /* - NOTE: the itemSearch shows items from skill guides which can be selected - And it does not show equipment variants for worn items that reduce weight. - Variation mapping would fix this issue for the inventory, - but then it would cause rings, potions, etc to be the same when it may not be desired - If a worn item is selected for the equipment, it will not be the correct itemID since - only the inventory variant and the skill guide variants show up in the search - If there is a way to figure out if and item is a skill guide item, then the inventory - issue can be solved. For equipment, you would also need a way to get the equipment variant - of a worn item that has weight reduction from the inventory counterpart - - For now, it's possible that the user will pick a skill guide item, and it will cause highlighting - This only occurs if variation differences are turned on. Weight reducing equipment - will also be highlighted if selected for equipment if variation differences are turned on. - */ - - // if the item is stackable, ask for a quantity - if (itemManager.getItemDefinition(finalId).isStackable()) - { - final int finalIdCopy = finalId; - searchInput = chatboxPanelManager.openTextInput("Enter amount") - .addCharValidator(arg -> arg >= 48 && arg <= 57) // only allow numbers (ASCII) - .onDone((input) -> - { - clientThread.invokeLater(() -> - { - String inputParsed = input; - if (inputParsed.length() > 10) - { - inputParsed = inputParsed.substring(0, 10); - } - - // limit to max int value - long quantityLong = Long.parseLong(inputParsed); - int quantity = (int) Math.min(quantityLong, Integer.MAX_VALUE); - quantity = Math.max(quantity, 1); - - final String itemName = itemManager.getItemDefinition(finalIdCopy).getName(); - final InventorySetupItem newItem = new InventorySetupItem(finalIdCopy, itemName, quantity); - - // update the rune pouch data - if (!updateIfRunePouch(slot, container.get(slot.getIndexInSlot()), newItem)) - { - return; - } - - container.set(slot.getIndexInSlot(), newItem); - updateJsonConfig(); - panel.refreshCurrentSetup(); - - }); - }).build(); - } - else - { - final String itemName = itemManager.getItemDefinition(finalId).getName(); - final InventorySetupItem newItem = new InventorySetupItem(finalId, itemName, 1); - - // update the rune pouch data - if (!updateIfRunePouch(slot, container.get(slot.getIndexInSlot()), newItem)) - { - return; - } - - container.set(slot.getIndexInSlot(), newItem); - updateJsonConfig(); - panel.refreshCurrentSetup(); - } - - }); - }) - .build(); - } - - public void removeInventorySetup(final InventorySetup setup) - { - int confirm = JOptionPane.showConfirmDialog(panel, - "Are you sure you want to permanently delete this inventory setup?", - "Warning", JOptionPane.OK_CANCEL_OPTION); - - if (confirm != JOptionPane.YES_OPTION) - { - return; - } - - inventorySetups.remove(setup); - panel.rebuild(); - updateJsonConfig(); - } - - public void updateJsonConfig() - { - final Gson gson = new Gson(); - final String json = gson.toJson(inventorySetups); - configManager.setConfiguration(CONFIG_GROUP, CONFIG_KEY, json); - } - - @Subscribe - public void onSessionOpen(SessionOpen event) - { - final AccountSession session = sessionManager.getAccountSession(); - if (session != null && session.getUsername() != null) - { - // config will have changed to new account, load it up - clientThread.invokeLater(() -> - { - loadConfig(); - SwingUtilities.invokeLater(() -> - { - panel.rebuild(); - }); - - return true; - }); - } - } - - @Subscribe - public void onSessionClose(SessionClose event) - { - // config will have changed to local file - clientThread.invokeLater(() -> - { - loadConfig(); - SwingUtilities.invokeLater(() -> - { - panel.rebuild(); - }); - - return true; - }); - } - - @Subscribe - public void onItemContainerChanged(ItemContainerChanged event) - { - - // check to see that the container is the equipment or inventory - ItemContainer container = event.getItemContainer(); - - if (container == client.getItemContainer(InventoryID.INVENTORY)) - { - panel.highlightInventory(); - } - else if (container == client.getItemContainer(InventoryID.EQUIPMENT)) - { - panel.highlightEquipment(); - } - - } - - @Subscribe - public void onGameStateChanged(GameStateChanged event) - { - panel.highlightInventory(); - panel.highlightEquipment(); - } - - public ArrayList getNormalizedContainer(final InventorySetupSlotID id) - { - switch (id) - { - case INVENTORY: - return getNormalizedContainer(InventoryID.INVENTORY); - case EQUIPMENT: - return getNormalizedContainer(InventoryID.EQUIPMENT); - default: - assert false : "Wrong slot ID!"; - return null; - } - } - - public ArrayList getNormalizedContainer(final InventoryID id) - { - assert id == InventoryID.INVENTORY || id == InventoryID.EQUIPMENT : "invalid inventory ID"; - - final ItemContainer container = client.getItemContainer(id); - - ArrayList newContainer = new ArrayList<>(); - - Item[] items = null; - if (container != null) - { - items = container.getItems(); - } - - int size = id == InventoryID.INVENTORY ? NUM_INVENTORY_ITEMS : NUM_EQUIPMENT_ITEMS; - - for (int i = 0; i < size; i++) - { - if (items == null || i >= items.length) - { - // add a "dummy" item to fill the normalized container to the right size - // this will be useful to compare when no item is in a slot - newContainer.add(new InventorySetupItem(-1, "", 0)); - } - else - { - final Item item = items[i]; - String itemName = ""; - - // only the client thread can retrieve the name. Therefore, do not use names to compare! - if (client.isClientThread()) - { - itemName = itemManager.getItemDefinition(item.getId()).getName(); - } - newContainer.add(new InventorySetupItem(item.getId(), itemName, item.getQuantity())); - } - } - - return newContainer; - } - - public void exportSetup(final InventorySetup setup) - { - final Gson gson = new Gson(); - final String json = gson.toJson(setup); - final StringSelection contents = new StringSelection(json); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(contents, null); - - JOptionPane.showMessageDialog(panel, - "Setup data was copied to clipboard.", - "Export Setup Succeeded", - JOptionPane.PLAIN_MESSAGE); - } - - public void importSetup() - { - try - { - final String setup = JOptionPane.showInputDialog(panel, - "Enter setup data", - "Import New Setup", - JOptionPane.PLAIN_MESSAGE); - - // cancel button was clicked - if (setup == null) - { - return; - } - - final Gson gson = new Gson(); - Type type = new TypeToken() - { - - }.getType(); - - final InventorySetup newSetup = gson.fromJson(setup, type); - if (newSetup.getRune_pouch() == null && checkIfContainerContainsItem(ItemID.RUNE_POUCH, newSetup.getInventory(), false)) - { - newSetup.updateRunePouch(getRunePouchData()); - } - addInventorySetupClientThread(newSetup); - } - catch (Exception e) - { - JOptionPane.showMessageDialog(panel, - "Invalid setup data.", - "Import Setup Failed", - JOptionPane.ERROR_MESSAGE); - } - } - - public boolean isHighlightingAllowed() - { - return client.getGameState() == GameState.LOGGED_IN; - } - - private ArrayList getContainerFromSlot(final InventorySetupSlot slot) - { - ArrayList container = slot.getParentSetup().getInventory(); - - if (slot.getSlotID() == InventorySetupSlotID.EQUIPMENT) - { - container = slot.getParentSetup().getEquipment(); - } - - assert slot.getParentSetup() == panel.getCurrentSelectedSetup() : "Setup Mismatch"; - assert slot.getIndexInSlot() < container.size() : "Index is greater than container size"; - - return container; - } - - private void loadConfig() - { - // serialize the internal data structure from the json in the configuration - final String json = configManager.getConfiguration(CONFIG_GROUP, CONFIG_KEY); - if (Strings.isNullOrEmpty(json)) - { - inventorySetups = new ArrayList<>(); - } - else - { - try - { - final Gson gson = new Gson(); - Type type = new TypeToken>() - { - - }.getType(); - inventorySetups = gson.fromJson(json, type); - for (final InventorySetup setup : inventorySetups) - { - if (setup.getRune_pouch() == null && checkIfContainerContainsItem(ItemID.RUNE_POUCH, setup.getInventory(), false)) - { - setup.updateRunePouch(getRunePouchData()); - } - } - } - catch (Exception e) - { - inventorySetups = new ArrayList<>(); - - //Populate with old inventorysetups - final Gson gson = new Gson(); - Type type = new TypeToken>() - { - }.getType(); - - HashMap oldSetups = new HashMap<>(); - oldSetups.putAll(gson.fromJson(json, type)); - - for (String name : oldSetups.keySet()) - { - InventorySetup newSetup = new InventorySetup( - new ArrayList<>(oldSetups.get(name).getInventory()), - new ArrayList<>(oldSetups.get(name).getEquipment()), - null, - name, - this.highlightColor, - this.highlightStackDifference, - this.highlightVariationDifference, - this.highlightDifference, - this.bankFilter, - this.highlightUnorderedDifference); - - inventorySetups.add(newSetup); - } - - } - - inventorySetups = new ArrayList<>(inventorySetups.stream() - .sorted(Comparator.comparing(InventorySetup::getName, String::compareToIgnoreCase)) - .collect(Collectors.toList())); - } - } - - private void addInventorySetupClientThread(final InventorySetup newSetup) - { - SwingUtilities.invokeLater(() -> - { - inventorySetups.add(newSetup); - inventorySetups = new ArrayList<>(inventorySetups.stream() - .sorted(Comparator.comparing(InventorySetup::getName, String::compareToIgnoreCase)) - .collect(Collectors.toList())); - - panel.rebuild(); - - updateJsonConfig(); - }); - } - - private boolean setupContainsItem(final InventorySetup setup, int itemID) - { - - // So place holders will show up in the bank. - itemID = itemManager.canonicalize(itemID); - - // don't variation map unless it's been selected - if (!setup.isVariationDifference()) - { - itemID = ItemVariationMapping.map(itemID); - } - - // check the rune pouch to see if it has the item (runes in this case) - if (setup.getRune_pouch() != null) - { - if (checkIfContainerContainsItem(itemID, setup.getRune_pouch(), false)) - { - return true; - } - } - - return checkIfContainerContainsItem(itemID, setup.getInventory(), setup.isVariationDifference()) || - checkIfContainerContainsItem(itemID, setup.getEquipment(), setup.isVariationDifference()); - } - - private boolean checkIfContainerContainsItem(int itemID, final ArrayList container, boolean isVariationDifference) - { - for (final InventorySetupItem item : container) - { - if (itemID == getCorrectID(isVariationDifference, item.getId())) - { - return true; - } - } - - return false; - } - - private int getCorrectID(boolean variationDifference, int itemId) - { - - // if variation difference isn't selected, get the canonical ID - if (!variationDifference) - { - return ItemVariationMapping.map(itemManager.canonicalize(itemId)); - } - - int idToCompare = itemId; - - // if it is selected, make sure we aren't showing note form - ItemDefinition comp = itemManager.getItemDefinition(itemId); - if (comp.getNote() != -1) - { - idToCompare = comp.getLinkedNoteId(); - } - - return idToCompare; - - } - - private boolean updateIfRunePouch(final InventorySetupSlot slot, final InventorySetupItem oldItem, final InventorySetupItem newItem) - { - - if (ItemVariationMapping.map(newItem.getId()) == ItemID.RUNE_POUCH) - { - - if (slot.getSlotID() != InventorySetupSlotID.INVENTORY) - { - - SwingUtilities.invokeLater(() -> - { - JOptionPane.showMessageDialog(panel, - "You can't have a Rune Pouch there.", - "Invalid Item", - JOptionPane.ERROR_MESSAGE); - }); - - return false; - } - - // only display this message if we aren't replacing a rune pouch with a new rune pouch - if (slot.getParentSetup().getRune_pouch() != null && ItemVariationMapping.map(oldItem.getId()) != ItemID.RUNE_POUCH) - { - SwingUtilities.invokeLater(() -> - { - JOptionPane.showMessageDialog(panel, - "You can't have two Rune Pouches.", - "Invalid Item", - JOptionPane.ERROR_MESSAGE); - }); - return false; - } - - slot.getParentSetup().updateRunePouch(getRunePouchData()); - } - else if (ItemVariationMapping.map(oldItem.getId()) == ItemID.RUNE_POUCH) - { - // if the old item is a rune pouch, need to update it to null - slot.getParentSetup().updateRunePouch(null); - } - - return true; - } - - private void updateConfig() - { - this.bankFilter = config.bankFilter(); - this.highlightStackDifference = config.highlightStackDifference(); - this.highlightVariationDifference = config.highlightVariationDifference(); - this.highlightUnorderedDifference = config.highlightUnorderedDifference(); - this.highlightDifference = config.highlightDifference(); - this.highlightColor = config.highlightColor(); - this.returnToSetupsHotkey = config.returnToSetupsHotkey(); - this.filterBankHotkey = config.filterBankHotkey(); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupSlotID.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupSlotID.java deleted file mode 100644 index 5076c15700..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupSlotID.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.runelite.client.plugins.inventorysetups; - -public enum InventorySetupSlotID -{ - INVENTORY(0), - EQUIPMENT(1), - RUNE_POUCH(2), - SPELL_BOOK(3); - - private final int id; - - InventorySetupSlotID(int id) - { - this.id = id; - } - - public int getId() - { - return id; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupContainerPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupContainerPanel.java deleted file mode 100644 index 2c1d842ecc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupContainerPanel.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2019, dillydill123 - * 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.inventorysetups.ui; - -import net.runelite.client.plugins.inventorysetups.InventorySetupPlugin; -import net.runelite.client.util.AsyncBufferedImage; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.ItemVariationMapping; -import net.runelite.client.plugins.inventorysetups.InventorySetup; -import net.runelite.client.plugins.inventorysetups.InventorySetupItem; -import net.runelite.client.ui.ColorScheme; -import javax.swing.JLabel; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import java.awt.BorderLayout; -import java.util.ArrayList; - -public abstract class InventorySetupContainerPanel extends JPanel -{ - - protected final InventorySetupPlugin plugin; - protected ItemManager itemManager; - protected boolean isHighlighted; - - InventorySetupContainerPanel(final ItemManager itemManager, final InventorySetupPlugin plugin, String captionText) - { - this.itemManager = itemManager; - this.plugin = plugin; - this.isHighlighted = false; - JPanel containerPanel = new JPanel(); - - final JPanel containerSlotsPanel = new JPanel(); - - // sets up the custom container panel - setupContainerPanel(containerSlotsPanel); - - // caption - final JLabel caption = new JLabel(captionText); - caption.setHorizontalAlignment(JLabel.CENTER); - caption.setVerticalAlignment(JLabel.CENTER); - - // panel that holds the caption and any other graphics - final JPanel captionPanel = new JPanel(); - captionPanel.add(caption); - - containerPanel.setLayout(new BorderLayout()); - containerPanel.add(captionPanel, BorderLayout.NORTH); - containerPanel.add(containerSlotsPanel, BorderLayout.CENTER); - - add(containerPanel); - } - - protected void addMouseListenerToSlot(final InventorySetupSlot slot) - { - - JPopupMenu popupMenu = new JPopupMenu(); - - String updateContainerFrom = ""; - switch (slot.getSlotID()) - { - case INVENTORY: - updateContainerFrom = "Inventory"; - break; - case EQUIPMENT: - updateContainerFrom = "Equipment"; - break; - case RUNE_POUCH: - updateContainerFrom = "Rune Pouch"; - break; - case SPELL_BOOK: - updateContainerFrom = "Spell Book"; - break; - default: - assert false : "Wrong slot ID!"; - break; - } - JMenuItem updateFromContainer = new JMenuItem("Update Slot from " + updateContainerFrom); - JMenuItem updateFromSearch = new JMenuItem("Update Slot from Search"); - popupMenu.add(updateFromContainer); - popupMenu.add(updateFromSearch); - - updateFromContainer.addActionListener(e -> - { - plugin.updateSlotFromContainer(slot); - }); - - updateFromSearch.addActionListener(e -> - { - plugin.updateSlotFromSearch(slot); - }); - - // both the panel and image label need adapters - // because the image will cover the entire panel - slot.setComponentPopupMenu(popupMenu); - slot.getImageLabel().setComponentPopupMenu(popupMenu); - - } - - protected void setContainerSlot(int index, final InventorySetupSlot containerSlot, final InventorySetup setup) - { - ArrayList items = null; - switch (containerSlot.getSlotID()) - { - case INVENTORY: - items = setup.getInventory(); - break; - case EQUIPMENT: - items = setup.getEquipment(); - break; - case RUNE_POUCH: - items = setup.getRune_pouch(); - break; - default: - assert false : "Wrong slot ID!"; - break; - } - - assert index < items.size() && index >= 0 : "Index Off Array"; - - containerSlot.setParentSetup(setup); - - if (items.get(index).getId() == -1) - { - containerSlot.setImageLabel(null, null); - return; - } - - int itemId = items.get(index).getId(); - int quantity = items.get(index).getQuantity(); - final String itemName = items.get(index).getName(); - AsyncBufferedImage itemImg = itemManager.getImage(itemId, quantity, quantity > 1); - String toolTip = itemName; - if (quantity > 1) - { - toolTip += " (" + quantity + ")"; - } - containerSlot.setImageLabel(toolTip, itemImg); - } - - protected void highlightDifferentSlotColor(final InventorySetup setup, InventorySetupItem savedItem, InventorySetupItem currItem, final InventorySetupSlot containerSlot) - { - // important note: do not use item names for comparisons - // they are all empty to avoid clientThread usage when highlighting - - // first check if stack differences are enabled and compare quantities - if (setup.isStackDifference() && currItem.getQuantity() != savedItem.getQuantity()) - { - containerSlot.setBackground(setup.getHighlightColor()); - return; - } - - // obtain the correct item ids using the variation difference if applicable - int currId = currItem.getId(); - int checkId = savedItem.getId(); - - if (!setup.isVariationDifference()) - { - currId = ItemVariationMapping.map(currId); - checkId = ItemVariationMapping.map(checkId); - } - - // if the ids don't match, highlight the container slot - if (currId != checkId) - { - containerSlot.setBackground(setup.getHighlightColor()); - return; - } - - // set the color back to the original, because they match - containerSlot.setBackground(ColorScheme.DARKER_GRAY_COLOR); - } - - abstract public void setupContainerPanel(final JPanel containerSlotsPanel); - - abstract public void highlightSlotDifferences(final ArrayList currContainer, final InventorySetup inventorySetup); - - abstract public void setSlots(final InventorySetup setup); - - abstract public void resetSlotColors(); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupEquipmentPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupEquipmentPanel.java deleted file mode 100644 index 62a046a409..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupEquipmentPanel.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2019, dillydill123 - * 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.inventorysetups.ui; - -import net.runelite.client.plugins.inventorysetups.InventorySetupSlotID; -import net.runelite.client.plugins.inventorysetups.InventorySetupPlugin; -import net.runelite.api.EquipmentInventorySlot; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.inventorysetups.InventorySetup; -import net.runelite.client.plugins.inventorysetups.InventorySetupItem; -import net.runelite.client.ui.ColorScheme; -import javax.swing.JPanel; -import java.awt.GridLayout; -import java.util.ArrayList; -import java.util.HashMap; - -public class InventorySetupEquipmentPanel extends InventorySetupContainerPanel -{ - private HashMap equipmentSlots; - - InventorySetupEquipmentPanel(final ItemManager itemManager, final InventorySetupPlugin plugin) - { - super(itemManager, plugin, "Equipment"); - } - - @Override - public void setupContainerPanel(final JPanel containerSlotsPanel) - { - this.equipmentSlots = new HashMap<>(); - for (EquipmentInventorySlot slot : EquipmentInventorySlot.values()) - { - final InventorySetupSlot setupSlot = new InventorySetupSlot(ColorScheme.DARKER_GRAY_COLOR, InventorySetupSlotID.EQUIPMENT, slot.getSlotIdx()); - super.addMouseListenerToSlot(setupSlot); - equipmentSlots.put(slot, setupSlot); - } - - final GridLayout gridLayout = new GridLayout(5, 3, 1, 1); - containerSlotsPanel.setLayout(gridLayout); - - // add the grid layouts, including invisible ones - containerSlotsPanel.add(new InventorySetupSlot(ColorScheme.DARK_GRAY_COLOR, InventorySetupSlotID.EQUIPMENT, -1)); - containerSlotsPanel.add(equipmentSlots.get(EquipmentInventorySlot.HEAD)); - containerSlotsPanel.add(new InventorySetupSlot(ColorScheme.DARK_GRAY_COLOR, InventorySetupSlotID.EQUIPMENT, -1)); - containerSlotsPanel.add(equipmentSlots.get(EquipmentInventorySlot.CAPE)); - containerSlotsPanel.add(equipmentSlots.get(EquipmentInventorySlot.AMULET)); - containerSlotsPanel.add(equipmentSlots.get(EquipmentInventorySlot.AMMO)); - containerSlotsPanel.add(equipmentSlots.get(EquipmentInventorySlot.WEAPON)); - containerSlotsPanel.add(equipmentSlots.get(EquipmentInventorySlot.BODY)); - containerSlotsPanel.add(equipmentSlots.get(EquipmentInventorySlot.SHIELD)); - containerSlotsPanel.add(new InventorySetupSlot(ColorScheme.DARK_GRAY_COLOR, InventorySetupSlotID.EQUIPMENT, -1)); - containerSlotsPanel.add(equipmentSlots.get(EquipmentInventorySlot.LEGS)); - containerSlotsPanel.add(new InventorySetupSlot(ColorScheme.DARK_GRAY_COLOR, InventorySetupSlotID.EQUIPMENT, -1)); - containerSlotsPanel.add(equipmentSlots.get(EquipmentInventorySlot.GLOVES)); - containerSlotsPanel.add(equipmentSlots.get(EquipmentInventorySlot.BOOTS)); - containerSlotsPanel.add(equipmentSlots.get(EquipmentInventorySlot.RING)); - - } - - @Override - public void highlightSlotDifferences(final ArrayList currEquipment, final InventorySetup inventorySetup) - { - final ArrayList equipToCheck = inventorySetup.getEquipment(); - - assert currEquipment.size() == equipToCheck.size() : "size mismatch"; - - isHighlighted = true; - - for (final EquipmentInventorySlot slot : EquipmentInventorySlot.values()) - { - int slotIdx = slot.getSlotIdx(); - super.highlightDifferentSlotColor(inventorySetup, equipToCheck.get(slotIdx), currEquipment.get(slotIdx), equipmentSlots.get(slot)); - } - } - - @Override - public void setSlots(final InventorySetup setup) - { - for (final EquipmentInventorySlot slot : EquipmentInventorySlot.values()) - { - int i = slot.getSlotIdx(); - super.setContainerSlot(i, equipmentSlots.get(slot), setup); - } - - validate(); - repaint(); - } - - @Override - public void resetSlotColors() - { - // Don't waste time resetting if we were never highlighted to begin with - if (!isHighlighted) - { - return; - } - - for (final EquipmentInventorySlot slot : EquipmentInventorySlot.values()) - { - equipmentSlots.get(slot).setBackground(ColorScheme.DARKER_GRAY_COLOR); - } - - isHighlighted = false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupInventoryPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupInventoryPanel.java deleted file mode 100644 index bec4f59878..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupInventoryPanel.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) 2019, dillydill123 - * 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.inventorysetups.ui; - -import net.runelite.client.plugins.inventorysetups.InventorySetupSlotID; -import net.runelite.client.plugins.inventorysetups.InventorySetupPlugin; -import net.runelite.api.ItemID; -import org.apache.commons.lang3.tuple.ImmutablePair; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.inventorysetups.InventorySetup; -import net.runelite.client.plugins.inventorysetups.InventorySetupItem; -import net.runelite.client.game.ItemVariationMapping; -import net.runelite.client.ui.ColorScheme; -import javax.swing.JPanel; -import java.awt.GridLayout; -import java.util.ArrayList; -import java.util.HashMap; - -public class InventorySetupInventoryPanel extends InventorySetupContainerPanel -{ - - private static final int ITEMS_PER_ROW = 4; - private static final int NUM_INVENTORY_ITEMS = 28; - - private ArrayList inventorySlots; - private InventorySetupRunePouchPanel rpPanel; - - InventorySetupInventoryPanel(final ItemManager itemManager, final InventorySetupPlugin plugin, final InventorySetupRunePouchPanel rpPanel) - { - super(itemManager, plugin, "Inventory"); - this.rpPanel = rpPanel; - } - - @Override - public void setupContainerPanel(final JPanel containerSlotsPanel) - { - this.inventorySlots = new ArrayList<>(); - for (int i = 0; i < NUM_INVENTORY_ITEMS; i++) - { - inventorySlots.add(new InventorySetupSlot(ColorScheme.DARKER_GRAY_COLOR, InventorySetupSlotID.INVENTORY, i)); - } - - int numRows = (NUM_INVENTORY_ITEMS + ITEMS_PER_ROW - 1) / ITEMS_PER_ROW; - containerSlotsPanel.setLayout(new GridLayout(numRows, ITEMS_PER_ROW, 1, 1)); - for (int i = 0; i < NUM_INVENTORY_ITEMS; i++) - { - containerSlotsPanel.add(inventorySlots.get(i)); - super.addMouseListenerToSlot(inventorySlots.get(i)); - } - } - - @Override - public void highlightSlotDifferences(final ArrayList currInventory, final InventorySetup inventorySetup) - { - final ArrayList inventoryToCheck = inventorySetup.getInventory(); - - assert currInventory.size() == inventoryToCheck.size() : "size mismatch"; - - isHighlighted = true; - - if (inventorySetup.isUnorderedHighlight()) - { - doUnorderedHighlighting(currInventory, inventorySetup); - return; - } - - boolean currInvHasRunePouch = false; - for (int i = 0; i < NUM_INVENTORY_ITEMS; i++) - { - InventorySetupItem currInvItem = currInventory.get(i); - if (!currInvHasRunePouch && ItemVariationMapping.map(currInvItem.getId()) == ItemID.RUNE_POUCH) - { - currInvHasRunePouch = true; - } - super.highlightDifferentSlotColor(inventorySetup, inventoryToCheck.get(i), currInventory.get(i), inventorySlots.get(i)); - } - - handleRunePouchHighlighting(inventorySetup, currInvHasRunePouch); - - } - - @Override - public void setSlots(final InventorySetup setup) - { - for (int i = 0; i < NUM_INVENTORY_ITEMS; i++) - { - super.setContainerSlot(i, inventorySlots.get(i), setup); - } - - validate(); - repaint(); - } - - @Override - public void resetSlotColors() - { - // Don't waste time resetting if we were never highlighted to begin with - if (!isHighlighted) - { - return; - } - - for (InventorySetupSlot inventorySlot : inventorySlots) - { - inventorySlot.setBackground(ColorScheme.DARKER_GRAY_COLOR); - } - - rpPanel.resetSlotColors(); - - isHighlighted = false; - } - - private void doUnorderedHighlighting(final ArrayList currInventory, final InventorySetup inventorySetup) - { - HashMap, Integer> currInvMap = new HashMap<>(); - - boolean currInvHasRunePouch = false; - for (final InventorySetupItem item : currInventory) - { - // Use variation mapping if necessary and set the quantity to 1 if ignoring stacks - int itemId = inventorySetup.isVariationDifference() ? item.getId() : ItemVariationMapping.map(item.getId()); - int quantity = inventorySetup.isStackDifference() ? item.getQuantity() : 1; - - if (ItemVariationMapping.map(item.getId()) == ItemID.RUNE_POUCH) - { - currInvHasRunePouch = true; - } - - ImmutablePair key = new ImmutablePair<>(itemId, quantity); - int count = currInvMap.get(key) == null ? 0 : currInvMap.get(key); - currInvMap.put(key, count + 1); - } - - final ArrayList setupInv = inventorySetup.getInventory(); - for (int i = 0; i < setupInv.size(); i++) - { - final InventorySetupItem item = setupInv.get(i); - - /* - don't count empty spaces. We only want to show items that are missing, not "extra items" - that would be indicated by highlighting empty slots. - */ - if (item.getId() == -1) - { - inventorySlots.get(i).setBackground(ColorScheme.DARKER_GRAY_COLOR); - continue; - } - - // Use variation mapping if necessary and set the quantity to 1 if ignoring stacks - int itemId = inventorySetup.isVariationDifference() ? item.getId() : ItemVariationMapping.map(item.getId()); - int quantity = inventorySetup.isStackDifference() ? item.getQuantity() : 1; - - ImmutablePair key = new ImmutablePair<>(itemId, quantity); - Integer currentCount = currInvMap.get(key); - - // current inventory doesn't have this item, highlight - if (currentCount == null) - { - inventorySlots.get(i).setBackground(inventorySetup.getHighlightColor()); - continue; - } - - if (currentCount == 1) - { - currInvMap.remove(key); - } - else - { - currInvMap.put(key, currentCount - 1); - } - - inventorySlots.get(i).setBackground(ColorScheme.DARKER_GRAY_COLOR); - - } - - handleRunePouchHighlighting(inventorySetup, currInvHasRunePouch); - - } - - private void handleRunePouchHighlighting(final InventorySetup inventorySetup, boolean currInvHasRunePouch) - { - if (inventorySetup.getRune_pouch() != null) - { - - // attempt to highlight if rune pouch is available - if (currInvHasRunePouch) - { - ArrayList runePouchToCheck = plugin.getRunePouchData(); - rpPanel.highlightSlotDifferences(runePouchToCheck, inventorySetup); - } - else // if the current inventory doesn't have a rune pouch but the setup does, highlight the RP pouch - { - rpPanel.highlightAllSlots(inventorySetup); - } - } - else - { - rpPanel.resetSlotColors(); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupPanel.java deleted file mode 100644 index 6cb5404872..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupPanel.java +++ /dev/null @@ -1,626 +0,0 @@ -/* - * Copyright (c) 2019, dillydill123 - * 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.inventorysetups.ui; - -import net.runelite.client.plugins.inventorysetups.InventorySetup; -import net.runelite.client.plugins.inventorysetups.InventorySetupPlugin; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.components.FlatTextField; -import net.runelite.client.ui.components.colorpicker.RuneliteColorPicker; -import net.runelite.client.util.ImageUtil; -import javax.swing.BorderFactory; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import javax.swing.border.Border; -import javax.swing.border.CompoundBorder; -import javax.swing.border.EmptyBorder; -import javax.swing.border.MatteBorder; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.awt.image.BufferedImage; - -public class InventorySetupPanel extends JPanel -{ - - private static final Border NAME_BOTTOM_BORDER = new CompoundBorder( - BorderFactory.createMatteBorder(0, 0, 1, 0, ColorScheme.DARK_GRAY_COLOR), - BorderFactory.createLineBorder(ColorScheme.DARKER_GRAY_COLOR)); - - private static final int H_GAP_BTN = 4; - - private static final ImageIcon BANK_FILTER_ICON; - private static final ImageIcon BANK_FILTER_HOVER_ICON; - private static final ImageIcon NO_BANK_FILTER_ICON; - private static final ImageIcon NO_BANK_FILTER_HOVER_ICON; - - private static final ImageIcon HIGHLIGHT_COLOR_ICON; - private static final ImageIcon HIGHLIGHT_COLOR_HOVER_ICON; - private static final ImageIcon NO_HIGHLIGHT_COLOR_ICON; - private static final ImageIcon NO_HIGHLIGHT_COLOR_HOVER_ICON; - - private static final ImageIcon TOGGLE_HIGHLIGHT_ICON; - private static final ImageIcon TOGGLE_HIGHLIGHT_HOVER_ICON; - private static final ImageIcon NO_TOGGLE_HIGHLIGHT_ICON; - private static final ImageIcon NO_TOGGLE_HIGHLIGHT_HOVER_ICON; - - private static final ImageIcon UNORDERED_HIGHLIGHT_ICON; - private static final ImageIcon UNORDERED_HIGHLIGHT_HOVER_ICON; - private static final ImageIcon NO_UNORDERED_HIGHLIGHT_ICON; - private static final ImageIcon NO_UNORDERED_HIGHLIGHT_HOVER_ICON; - - private static final ImageIcon STACK_DIFFERENCE_ICON; - private static final ImageIcon STACK_DIFFERENCE_HOVER_ICON; - private static final ImageIcon NO_STACK_DIFFERENCE_ICON; - private static final ImageIcon NO_STACK_DIFFERENCE_HOVER_ICON; - - private static final ImageIcon VARIATION_DIFFERENCE_ICON; - private static final ImageIcon VARIATION_DIFFERENCE_HOVER_ICON; - private static final ImageIcon NO_VARIATION_DIFFERENCE_ICON; - private static final ImageIcon NO_VARIATION_DIFFERENCE_HOVER_ICON; - - private static final ImageIcon VIEW_SETUP_ICON; - private static final ImageIcon VIEW_SETUP_HOVER_ICON; - - private static final ImageIcon DELETE_ICON; - private static final ImageIcon DELETE_HOVER_ICON; - - private static final ImageIcon EXPORT_ICON; - private static final ImageIcon EXPORT_HOVER_ICON; - - static - { - final BufferedImage bankFilterImg = ImageUtil.getResourceStreamFromClass(InventorySetupPlugin.class, "filter_icon.png"); - final BufferedImage bankFilterHover = ImageUtil.luminanceOffset(bankFilterImg, -150); - BANK_FILTER_ICON = new ImageIcon(bankFilterImg); - BANK_FILTER_HOVER_ICON = new ImageIcon(bankFilterHover); - - NO_BANK_FILTER_ICON = new ImageIcon(bankFilterHover); - NO_BANK_FILTER_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(bankFilterHover, -100)); - - final BufferedImage stackImg = ImageUtil.getResourceStreamFromClass(InventorySetupPlugin.class, "stack_icon.png"); - final BufferedImage stackHover = ImageUtil.luminanceOffset(stackImg, -150); - STACK_DIFFERENCE_ICON = new ImageIcon(stackImg); - STACK_DIFFERENCE_HOVER_ICON = new ImageIcon(stackHover); - - NO_STACK_DIFFERENCE_ICON = new ImageIcon(stackHover); - NO_STACK_DIFFERENCE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(stackHover, -100)); - - final BufferedImage variationImg = ImageUtil.getResourceStreamFromClass(InventorySetupPlugin.class, "variation_icon.png"); - final BufferedImage variationHover = ImageUtil.luminanceOffset(variationImg, -150); - VARIATION_DIFFERENCE_ICON = new ImageIcon(variationImg); - VARIATION_DIFFERENCE_HOVER_ICON = new ImageIcon(variationHover); - - NO_VARIATION_DIFFERENCE_ICON = new ImageIcon(variationHover); - NO_VARIATION_DIFFERENCE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(variationHover, -100)); - - final BufferedImage unorderedHighlightImg = ImageUtil.getResourceStreamFromClass(InventorySetupPlugin.class, "unordered_highlight_icon.png"); - final BufferedImage unorderedHighlightHover = ImageUtil.luminanceOffset(unorderedHighlightImg, -150); - UNORDERED_HIGHLIGHT_ICON = new ImageIcon(unorderedHighlightImg); - UNORDERED_HIGHLIGHT_HOVER_ICON = new ImageIcon(unorderedHighlightHover); - - NO_UNORDERED_HIGHLIGHT_ICON = new ImageIcon(unorderedHighlightHover); - NO_UNORDERED_HIGHLIGHT_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(unorderedHighlightHover, -100)); - - final BufferedImage highlightToggleImg = ImageUtil.getResourceStreamFromClass(InventorySetupPlugin.class, "highlight_icon.png"); - final BufferedImage highlightToggleHover = ImageUtil.luminanceOffset(highlightToggleImg, -150); - TOGGLE_HIGHLIGHT_ICON = new ImageIcon(highlightToggleImg); - TOGGLE_HIGHLIGHT_HOVER_ICON = new ImageIcon(highlightToggleHover); - - NO_TOGGLE_HIGHLIGHT_ICON = new ImageIcon(highlightToggleHover); - NO_TOGGLE_HIGHLIGHT_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(highlightToggleHover, -100)); - - final BufferedImage highlightImg = ImageUtil.getResourceStreamFromClass(InventorySetupPlugin.class, "highlight_color_icon.png"); - final BufferedImage highlightHover = ImageUtil.luminanceOffset(highlightImg, -150); - HIGHLIGHT_COLOR_ICON = new ImageIcon(highlightImg); - HIGHLIGHT_COLOR_HOVER_ICON = new ImageIcon(highlightHover); - - NO_HIGHLIGHT_COLOR_ICON = new ImageIcon(highlightHover); - NO_HIGHLIGHT_COLOR_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(highlightHover, -100)); - - final BufferedImage viewImg = ImageUtil.getResourceStreamFromClass(InventorySetupPlugin.class, "visible_icon.png"); - final BufferedImage viewImgHover = ImageUtil.luminanceOffset(viewImg, -150); - VIEW_SETUP_ICON = new ImageIcon(viewImg); - VIEW_SETUP_HOVER_ICON = new ImageIcon(viewImgHover); - - final BufferedImage exportImg = ImageUtil.getResourceStreamFromClass(InventorySetupPlugin.class, "export_icon.png"); - final BufferedImage exportImgHover = ImageUtil.luminanceOffset(exportImg, -150); - EXPORT_ICON = new ImageIcon(exportImg); - EXPORT_HOVER_ICON = new ImageIcon(exportImgHover); - - final BufferedImage deleteImg = ImageUtil.getResourceStreamFromClass(InventorySetupPlugin.class, "delete_icon.png"); - DELETE_ICON = new ImageIcon(deleteImg); - DELETE_HOVER_ICON = new ImageIcon(ImageUtil.luminanceOffset(deleteImg, -100)); - } - - private final InventorySetupPlugin plugin; - private final InventorySetupPluginPanel panel; - private final InventorySetup inventorySetup; - private final JLabel bankFilterIndicator = new JLabel(); - private final JLabel highlightColorIndicator = new JLabel(); - private final JLabel stackDifferenceIndicator = new JLabel(); - private final JLabel variationDifferenceIndicator = new JLabel(); - private final JLabel unorderedHighlightIndicator = new JLabel(); - private final JLabel highlightIndicator = new JLabel(); - private final JLabel viewSetupLabel = new JLabel(); - private final JLabel exportLabel = new JLabel(); - private final JLabel deleteLabel = new JLabel(); - private final FlatTextField nameInput = new FlatTextField(); - private final JLabel save = new JLabel("Save"); - private final JLabel cancel = new JLabel("Cancel"); - private final JLabel rename = new JLabel("Rename"); - - InventorySetupPanel(InventorySetupPlugin plugin, InventorySetupPluginPanel panel, InventorySetup invSetup) - { - this.plugin = plugin; - this.panel = panel; - this.inventorySetup = invSetup; - - setLayout(new BorderLayout()); - setBackground(ColorScheme.DARKER_GRAY_COLOR); - - JPanel nameWrapper = new JPanel(new BorderLayout()); - nameWrapper.setBackground(ColorScheme.DARKER_GRAY_COLOR); - nameWrapper.setBorder(NAME_BOTTOM_BORDER); - - JPanel nameActions = new JPanel(new BorderLayout(3, 0)); - nameActions.setBorder(new EmptyBorder(0, 0, 0, 8)); - nameActions.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - save.setVisible(false); - save.setFont(FontManager.getRunescapeSmallFont()); - save.setForeground(ColorScheme.PROGRESS_COMPLETE_COLOR); - save.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - inventorySetup.setName(nameInput.getText()); - plugin.updateJsonConfig(); - - nameInput.setEditable(false); - updateNameActions(false); - requestFocusInWindow(); - panel.rebuild(); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - save.setForeground(ColorScheme.PROGRESS_COMPLETE_COLOR.darker()); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - save.setForeground(ColorScheme.PROGRESS_COMPLETE_COLOR); - } - }); - - cancel.setVisible(false); - cancel.setFont(FontManager.getRunescapeSmallFont()); - cancel.setForeground(ColorScheme.PROGRESS_ERROR_COLOR); - cancel.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - nameInput.setEditable(false); - nameInput.setText(inventorySetup.getName()); - updateNameActions(false); - requestFocusInWindow(); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - cancel.setForeground(ColorScheme.PROGRESS_ERROR_COLOR.darker()); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - cancel.setForeground(ColorScheme.PROGRESS_ERROR_COLOR); - } - }); - - rename.setFont(FontManager.getRunescapeSmallFont()); - rename.setForeground(ColorScheme.LIGHT_GRAY_COLOR.darker()); - rename.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - nameInput.setEditable(true); - updateNameActions(true); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - rename.setForeground(ColorScheme.LIGHT_GRAY_COLOR.darker().darker()); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - rename.setForeground(ColorScheme.LIGHT_GRAY_COLOR.darker()); - } - }); - - nameActions.add(save, BorderLayout.EAST); - nameActions.add(cancel, BorderLayout.WEST); - nameActions.add(rename, BorderLayout.CENTER); - - nameInput.setText(inventorySetup.getName()); - nameInput.setBorder(null); - nameInput.setEditable(false); - nameInput.setBackground(ColorScheme.DARKER_GRAY_COLOR); - nameInput.setPreferredSize(new Dimension(0, 24)); - nameInput.getTextField().setForeground(Color.WHITE); - nameInput.getTextField().setBorder(new EmptyBorder(0, 8, 0, 0)); - - nameWrapper.add(nameInput, BorderLayout.CENTER); - nameWrapper.add(nameActions, BorderLayout.EAST); - - JPanel bottomContainer = new JPanel(new BorderLayout()); - bottomContainer.setBorder(new EmptyBorder(8, 0, 8, 0)); - bottomContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - bankFilterIndicator.setToolTipText("Enable bank filtering"); - bankFilterIndicator.setIcon(inventorySetup.isFilterBank() ? BANK_FILTER_ICON : NO_BANK_FILTER_ICON); - bankFilterIndicator.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent e) - { - inventorySetup.setFilterBank(!inventorySetup.isFilterBank()); - bankFilterIndicator.setToolTipText(inventorySetup.isFilterBank() ? "Disable bank filtering" : "Enable bank filtering"); - updateBankFilterLabel(); - plugin.updateJsonConfig(); - } - - @Override - public void mouseEntered(MouseEvent e) - { - bankFilterIndicator.setIcon(inventorySetup.isFilterBank() ? BANK_FILTER_HOVER_ICON : NO_BANK_FILTER_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent e) - { - bankFilterIndicator.setIcon(inventorySetup.isFilterBank() ? BANK_FILTER_ICON : NO_BANK_FILTER_ICON); - } - }); - - stackDifferenceIndicator.setToolTipText("Enable highlighting for stack differences"); - stackDifferenceIndicator.setIcon(inventorySetup.isStackDifference() ? STACK_DIFFERENCE_ICON : NO_STACK_DIFFERENCE_ICON); - stackDifferenceIndicator.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - inventorySetup.setStackDifference(!inventorySetup.isStackDifference()); - stackDifferenceIndicator.setToolTipText(inventorySetup.isStackDifference() ? "Disable highlighting for stack differences" : "Enable highlighting for stack differences"); - updateStackDifferenceLabel(); - plugin.updateJsonConfig(); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - stackDifferenceIndicator.setIcon(inventorySetup.isStackDifference() ? STACK_DIFFERENCE_HOVER_ICON : NO_STACK_DIFFERENCE_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - stackDifferenceIndicator.setIcon(inventorySetup.isStackDifference() ? STACK_DIFFERENCE_ICON : NO_STACK_DIFFERENCE_ICON); - } - }); - - variationDifferenceIndicator.setToolTipText("Enable highlighting for variation differences"); - variationDifferenceIndicator.setIcon(inventorySetup.isVariationDifference() ? VARIATION_DIFFERENCE_ICON : NO_VARIATION_DIFFERENCE_ICON); - variationDifferenceIndicator.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - inventorySetup.setVariationDifference(!inventorySetup.isVariationDifference()); - variationDifferenceIndicator.setToolTipText(inventorySetup.isVariationDifference() ? "Disable highlighting for variation differences" : "Enable highlighting for variation differences"); - updateVariationDifferenceLabel(); - plugin.updateJsonConfig(); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - variationDifferenceIndicator.setIcon(inventorySetup.isVariationDifference() ? VARIATION_DIFFERENCE_HOVER_ICON : NO_VARIATION_DIFFERENCE_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - variationDifferenceIndicator.setIcon(inventorySetup.isVariationDifference() ? VARIATION_DIFFERENCE_ICON : NO_VARIATION_DIFFERENCE_ICON); - } - }); - - unorderedHighlightIndicator.setToolTipText("Only highlight items that are missing from the inventory and ignore order"); - unorderedHighlightIndicator.setIcon(inventorySetup.isUnorderedHighlight() ? UNORDERED_HIGHLIGHT_ICON : NO_UNORDERED_HIGHLIGHT_ICON); - unorderedHighlightIndicator.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent e) - { - inventorySetup.setUnorderedHighlight(!inventorySetup.isUnorderedHighlight()); - unorderedHighlightIndicator.setToolTipText(inventorySetup.isUnorderedHighlight() ? "Enable default ordered highlighting" : "Only highlight items that are missing from the inventory and ignore order"); - updateUnorderedHighlightIndicator(); - plugin.updateJsonConfig(); - } - - @Override - public void mouseEntered(MouseEvent e) - { - unorderedHighlightIndicator.setIcon(inventorySetup.isUnorderedHighlight() ? UNORDERED_HIGHLIGHT_HOVER_ICON : NO_UNORDERED_HIGHLIGHT_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent e) - { - unorderedHighlightIndicator.setIcon(inventorySetup.isUnorderedHighlight() ? UNORDERED_HIGHLIGHT_ICON : NO_UNORDERED_HIGHLIGHT_ICON); - } - }); - - highlightIndicator.setToolTipText("Enable highlighting"); - highlightIndicator.setIcon(inventorySetup.isHighlightDifference() ? TOGGLE_HIGHLIGHT_ICON : NO_TOGGLE_HIGHLIGHT_ICON); - highlightIndicator.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - inventorySetup.setHighlightDifference(!inventorySetup.isHighlightDifference()); - highlightIndicator.setToolTipText(inventorySetup.isHighlightDifference() ? "Disable highlighting" : "Enable highlighting"); - updateToggleHighlightLabel(); - updateHighlightColorLabel(); - plugin.updateJsonConfig(); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - highlightIndicator.setIcon(inventorySetup.isHighlightDifference() ? TOGGLE_HIGHLIGHT_HOVER_ICON : NO_TOGGLE_HIGHLIGHT_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - highlightIndicator.setIcon(inventorySetup.isHighlightDifference() ? TOGGLE_HIGHLIGHT_ICON : NO_TOGGLE_HIGHLIGHT_ICON); - } - }); - - highlightColorIndicator.setToolTipText("Edit highlight color"); - highlightColorIndicator.setIcon(inventorySetup.isHighlightDifference() ? HIGHLIGHT_COLOR_ICON : NO_HIGHLIGHT_COLOR_ICON); - highlightColorIndicator.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - openHighlightColorPicker(); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - highlightColorIndicator.setIcon(inventorySetup.isHighlightDifference() ? HIGHLIGHT_COLOR_HOVER_ICON : NO_HIGHLIGHT_COLOR_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - highlightColorIndicator.setIcon(inventorySetup.isHighlightDifference() ? HIGHLIGHT_COLOR_ICON : NO_HIGHLIGHT_COLOR_ICON); - } - }); - - JPanel leftActions = new JPanel(new FlowLayout(FlowLayout.LEFT, H_GAP_BTN, 0)); - leftActions.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - leftActions.add(bankFilterIndicator); - leftActions.add(stackDifferenceIndicator); - leftActions.add(variationDifferenceIndicator); - leftActions.add(unorderedHighlightIndicator); - leftActions.add(highlightIndicator); - leftActions.add(highlightColorIndicator); - - viewSetupLabel.setToolTipText("View setup"); - viewSetupLabel.setIcon(VIEW_SETUP_ICON); - viewSetupLabel.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - panel.setCurrentInventorySetup(inventorySetup, true); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - viewSetupLabel.setIcon(VIEW_SETUP_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - viewSetupLabel.setIcon(VIEW_SETUP_ICON); - } - }); - - exportLabel.setToolTipText("Export setup"); - exportLabel.setIcon(EXPORT_ICON); - exportLabel.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - plugin.exportSetup(inventorySetup); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - exportLabel.setIcon(EXPORT_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - exportLabel.setIcon(EXPORT_ICON); - } - }); - - deleteLabel.setToolTipText("Delete setup"); - deleteLabel.setIcon(DELETE_ICON); - deleteLabel.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - plugin.removeInventorySetup(inventorySetup); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - deleteLabel.setIcon(DELETE_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - deleteLabel.setIcon(DELETE_ICON); - } - }); - - JPanel rightActions = new JPanel(new FlowLayout(FlowLayout.RIGHT, H_GAP_BTN, 0)); - rightActions.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - rightActions.add(viewSetupLabel); - rightActions.add(exportLabel); - rightActions.add(deleteLabel); - - bottomContainer.add(leftActions, BorderLayout.WEST); - bottomContainer.add(rightActions, BorderLayout.EAST); - - add(nameWrapper, BorderLayout.NORTH); - add(bottomContainer, BorderLayout.CENTER); - - updateHighlightColorLabel(); - updateStackDifferenceLabel(); - updateVariationDifferenceLabel(); - updateToggleHighlightLabel(); - - } - - private void updateNameActions(boolean saveAndCancel) - { - save.setVisible(saveAndCancel); - cancel.setVisible(saveAndCancel); - rename.setVisible(!saveAndCancel); - - if (saveAndCancel) - { - nameInput.getTextField().requestFocusInWindow(); - nameInput.getTextField().selectAll(); - } - } - - private void updateHighlightColorLabel() - { - Color color = inventorySetup.getHighlightColor(); - highlightColorIndicator.setBorder(new MatteBorder(0, 0, 3, 0, color)); - highlightColorIndicator.setIcon(inventorySetup.isHighlightDifference() ? HIGHLIGHT_COLOR_ICON : NO_HIGHLIGHT_COLOR_ICON); - } - - private void updateBankFilterLabel() - { - bankFilterIndicator.setIcon(inventorySetup.isFilterBank() ? BANK_FILTER_ICON : NO_BANK_FILTER_ICON); - } - - private void updateStackDifferenceLabel() - { - stackDifferenceIndicator.setIcon(inventorySetup.isStackDifference() ? STACK_DIFFERENCE_ICON : NO_STACK_DIFFERENCE_ICON); - } - - private void updateVariationDifferenceLabel() - { - variationDifferenceIndicator.setIcon(inventorySetup.isVariationDifference() ? VARIATION_DIFFERENCE_ICON : NO_VARIATION_DIFFERENCE_ICON); - } - - private void updateUnorderedHighlightIndicator() - { - unorderedHighlightIndicator.setIcon(inventorySetup.isUnorderedHighlight() ? UNORDERED_HIGHLIGHT_ICON : NO_UNORDERED_HIGHLIGHT_ICON); - } - - private void updateToggleHighlightLabel() - { - highlightIndicator.setIcon(inventorySetup.isHighlightDifference() ? TOGGLE_HIGHLIGHT_ICON : NO_TOGGLE_HIGHLIGHT_ICON); - } - - private void openHighlightColorPicker() - { - - RuneliteColorPicker colorPicker = plugin.getColorPickerManager().create( - SwingUtilities.windowForComponent(this), - inventorySetup.getHighlightColor(), - inventorySetup.getName(), - false); - - colorPicker.setLocation(getLocationOnScreen()); - colorPicker.setOnColorChange(c -> - { - inventorySetup.setHighlightColor(c); - updateHighlightColorLabel(); - }); - - colorPicker.addWindowListener(new WindowAdapter() - { - @Override - public void windowClosing(WindowEvent e) - { - plugin.updateJsonConfig(); - } - }); - - colorPicker.setVisible(true); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupPluginPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupPluginPanel.java deleted file mode 100644 index 54575f8fd8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupPluginPanel.java +++ /dev/null @@ -1,455 +0,0 @@ -/* - * Copyright (c) 2019, dillydill123 - * 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.inventorysetups.ui; - -import net.runelite.client.plugins.inventorysetups.InventorySetup; -import net.runelite.client.plugins.inventorysetups.InventorySetupItem; -import net.runelite.client.plugins.inventorysetups.InventorySetupPlugin; -import lombok.Getter; -import net.runelite.api.InventoryID; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.ui.components.IconTextField; -import net.runelite.client.ui.components.PluginErrorPanel; -import net.runelite.client.util.ImageUtil; -import javax.swing.Box; -import javax.swing.BoxLayout; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.border.EmptyBorder; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; -import java.util.ArrayList; -import java.util.List; - -public class InventorySetupPluginPanel extends PluginPanel -{ - - private static ImageIcon ADD_ICON; - private static ImageIcon ADD_HOVER_ICON; - private static ImageIcon BACK_ICON; - private static ImageIcon BACK_HOVER_ICON; - private static ImageIcon IMPORT_ICON; - private static ImageIcon IMPORT_HOVER_ICON; - private static ImageIcon UPDATE_ICON; - private static ImageIcon UPDATE_HOVER_ICON; - - private static String MAIN_TITLE; - - static - { - final BufferedImage addIcon = ImageUtil.getResourceStreamFromClass(InventorySetupPlugin.class, "add_icon.png"); - ADD_ICON = new ImageIcon(addIcon); - ADD_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(addIcon, 0.53f)); - - final BufferedImage importIcon = ImageUtil.getResourceStreamFromClass(InventorySetupPlugin.class, "import_icon.png"); - IMPORT_ICON = new ImageIcon(importIcon); - IMPORT_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(importIcon, 0.53f)); - - final BufferedImage updateIcon = ImageUtil.getResourceStreamFromClass(InventorySetupPlugin.class, "update_icon.png"); - UPDATE_ICON = new ImageIcon(updateIcon); - UPDATE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(updateIcon, 0.53f)); - - final BufferedImage backIcon = ImageUtil.getResourceStreamFromClass(InventorySetupPlugin.class, "back_arrow_icon.png"); - BACK_ICON = new ImageIcon(backIcon); - BACK_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(backIcon, 0.53f)); - - MAIN_TITLE = "Inventory Setups"; - } - - private final JPanel noSetupsPanel; - private final JPanel invEqPanel; - private final JPanel overviewPanel; - private final JScrollPane contentWrapperPane; - private final JPanel overviewTopRightButtonsPanel; - private final JPanel setupTopRightButtonsPanel; - private final JLabel title; - private final JLabel addMarker; - private final JLabel addImportMarker; - private final JLabel updateMarker; - private final JLabel backMarker; - private final IconTextField searchBar; - private final InventorySetupInventoryPanel invPanel; - private final InventorySetupEquipmentPanel eqpPanel; - private final InventorySetupRunePouchPanel rpPanel; - private final InventorySetupPlugin plugin; - @Getter - private InventorySetup currentSelectedSetup; - - public InventorySetupPluginPanel(final InventorySetupPlugin plugin, final ItemManager itemManager) - { - super(false); - this.currentSelectedSetup = null; - this.plugin = plugin; - this.rpPanel = new InventorySetupRunePouchPanel(itemManager, plugin); - this.invPanel = new InventorySetupInventoryPanel(itemManager, plugin, rpPanel); - this.eqpPanel = new InventorySetupEquipmentPanel(itemManager, plugin); - this.noSetupsPanel = new JPanel(); - this.invEqPanel = new JPanel(); - this.overviewPanel = new JPanel(); - - // setup the title - this.title = new JLabel(); - title.setText(MAIN_TITLE); - title.setForeground(Color.WHITE); - - this.addImportMarker = new JLabel(IMPORT_ICON); - addImportMarker.setToolTipText ("Import a new inventory setup"); - addImportMarker.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent e) - { - plugin.importSetup(); - } - - @Override - public void mouseEntered(MouseEvent e) - { - addImportMarker.setIcon(IMPORT_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent e) - { - addImportMarker.setIcon(IMPORT_ICON); - } - }); - - // setup the add marker (+ sign in the top right) - this.addMarker = new JLabel(ADD_ICON); - addMarker.setToolTipText("Add a new inventory setup"); - addMarker.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent e) - { - plugin.addInventorySetup(); - } - - @Override - public void mouseEntered(MouseEvent e) - { - addMarker.setIcon(ADD_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent e) - { - addMarker.setIcon(ADD_ICON); - } - }); - - this.updateMarker = new JLabel(UPDATE_ICON); - updateMarker.setToolTipText("Update setup with current inventory and equipment"); - updateMarker.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent e) - { - plugin.updateCurrentSetup(currentSelectedSetup); - } - - @Override - public void mouseEntered(MouseEvent e) - { - updateMarker.setIcon(UPDATE_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent e) - { - updateMarker.setIcon(UPDATE_ICON); - } - }); - - this.backMarker = new JLabel(BACK_ICON); - backMarker.setToolTipText("Return to setups"); - backMarker.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent e) - { - returnToOverviewPanel(); - } - - @Override - public void mouseEntered(MouseEvent e) - { - backMarker.setIcon(BACK_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent e) - { - backMarker.setIcon(BACK_ICON); - } - }); - - this.overviewTopRightButtonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0)); - overviewTopRightButtonsPanel.add(addImportMarker); - overviewTopRightButtonsPanel.add(addMarker); - addMarker.setBorder(new EmptyBorder(0, 8, 0, 0)); - - this.setupTopRightButtonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0)); - setupTopRightButtonsPanel.add(updateMarker); - setupTopRightButtonsPanel.add(backMarker); - backMarker.setBorder(new EmptyBorder(0, 8, 0, 0)); - - // the panel on the top right that holds the buttons - final JPanel markersPanel = new JPanel(); - markersPanel.setLayout(new FlowLayout()); - markersPanel.add(overviewTopRightButtonsPanel); - markersPanel.add(setupTopRightButtonsPanel); - overviewTopRightButtonsPanel.setVisible(true); - setupTopRightButtonsPanel.setVisible(false); - - // the top panel that has the title and the buttons, and search bar - final JPanel titleAndMarkersPanel = new JPanel(); - titleAndMarkersPanel.setLayout(new BorderLayout()); - titleAndMarkersPanel.add(title, BorderLayout.WEST); - titleAndMarkersPanel.add(markersPanel, BorderLayout.EAST); - this.searchBar = new IconTextField(); - searchBar.setIcon(IconTextField.Icon.SEARCH); - searchBar.setPreferredSize(new Dimension(PluginPanel.PANEL_WIDTH - 20, 30)); - searchBar.setBackground(ColorScheme.DARKER_GRAY_COLOR); - searchBar.setHoverBackgroundColor(ColorScheme.DARK_GRAY_HOVER_COLOR); - searchBar.setMinimumSize(new Dimension(0, 30)); - searchBar.addKeyListener(new KeyListener() - { - @Override - public void keyTyped(KeyEvent e) - { - } - - @Override - public void keyPressed(KeyEvent e) - { - } - - @Override - public void keyReleased(KeyEvent e) - { - rebuild(); - } - }); - searchBar.addClearListener(actionEvent -> rebuild()); - - // the panel that stays at the top and doesn't scroll - // contains the title and buttons - final JPanel northAnchoredPanel = new JPanel(); - northAnchoredPanel.setLayout(new BoxLayout(northAnchoredPanel, BoxLayout.Y_AXIS)); - northAnchoredPanel.setBorder(new EmptyBorder(0, 0, 10, 0)); - northAnchoredPanel.add(titleAndMarkersPanel); - northAnchoredPanel.add(Box.createRigidArea(new Dimension(0, 5))); - northAnchoredPanel.add(searchBar); - - // the panel that holds the inventory and equipment panels - final BoxLayout invEqLayout = new BoxLayout(invEqPanel, BoxLayout.Y_AXIS); - invEqPanel.setLayout(invEqLayout); - invEqPanel.add(invPanel); - invEqPanel.add(Box.createRigidArea(new Dimension(0, 10))); - invEqPanel.add(rpPanel); - invEqPanel.add(Box.createRigidArea(new Dimension(0, 10))); - invEqPanel.add(eqpPanel); - - // setup the error panel. It's wrapped around a normal panel - // so it doesn't stretch to fill the parent panel - final PluginErrorPanel errorPanel = new PluginErrorPanel(); - errorPanel.setContent("Inventory Setups", "Create an inventory setup."); - noSetupsPanel.add(errorPanel); - - // the panel that holds the inventory panels, error panel, and the overview panel - final JPanel contentPanel = new JPanel(); - final BoxLayout contentLayout = new BoxLayout(contentPanel, BoxLayout.Y_AXIS); - contentPanel.setLayout(contentLayout); - contentPanel.add(invEqPanel); - contentPanel.add(noSetupsPanel); - contentPanel.add(overviewPanel); - - // wrapper for the main content panel to keep it from stretching - final JPanel contentWrapper = new JPanel(new BorderLayout()); - contentWrapper.add(Box.createGlue(), BorderLayout.CENTER); - contentWrapper.add(contentPanel, BorderLayout.NORTH); - this.contentWrapperPane = new JScrollPane(contentWrapper); - this.contentWrapperPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - - setLayout(new BorderLayout()); - setBorder(new EmptyBorder(10, 10, 10, 10)); - add(northAnchoredPanel, BorderLayout.NORTH); - add(this.contentWrapperPane, BorderLayout.CENTER); - - // make sure the invEq panel isn't visible upon startup - invEqPanel.setVisible(false); - - } - - public void init(List setups) - { - overviewPanel.setLayout(new GridBagLayout()); - overviewPanel.setBackground(ColorScheme.DARK_GRAY_COLOR); - - GridBagConstraints constraints = new GridBagConstraints(); - constraints.fill = GridBagConstraints.HORIZONTAL; - constraints.weightx = 1; - constraints.gridx = 0; - constraints.gridy = 0; - - for (final InventorySetup setup : setups) - { - InventorySetupPanel newPanel = new InventorySetupPanel(plugin, this, setup); - overviewPanel.add(newPanel, constraints); - constraints.gridy++; - - overviewPanel.add(Box.createRigidArea(new Dimension(0, 10)), constraints); - constraints.gridy++; - } - - invEqPanel.setVisible(false); - - noSetupsPanel.setVisible(plugin.getInventorySetups().isEmpty()); - overviewPanel.setVisible(!plugin.getInventorySetups().isEmpty()); - - } - - public void rebuild() - { - overviewPanel.removeAll(); - final String text = searchBar.getText(); - List setupsToAdd = searchBar.getText().isEmpty() ? plugin.getInventorySetups() : plugin.filterSetups(searchBar.getText()); - init(setupsToAdd); - revalidate(); - repaint(); - } - - public void refreshCurrentSetup() - { - if (currentSelectedSetup != null) - { - setCurrentInventorySetup(currentSelectedSetup, false); - } - } - - public void setCurrentInventorySetup(final InventorySetup inventorySetup, boolean resetScrollBar) - { - currentSelectedSetup = inventorySetup; - invPanel.setSlots(inventorySetup); - rpPanel.setSlots(inventorySetup); - eqpPanel.setSlots(inventorySetup); - - overviewTopRightButtonsPanel.setVisible(false); - setupTopRightButtonsPanel.setVisible(true); - - invEqPanel.setVisible(true); - noSetupsPanel.setVisible(false); - overviewPanel.setVisible(false); - - title.setText(inventorySetup.getName()); - searchBar.setVisible(false); - - // only show the rune pouch if the setup has a rune pouch - rpPanel.setVisible(currentSelectedSetup.getRune_pouch() != null); - - highlightInventory(); - highlightEquipment(); - - if (resetScrollBar) - { - // reset scrollbar back to top - this.contentWrapperPane.getVerticalScrollBar().setValue(0); - } - - plugin.doBankSearch(); - - validate(); - repaint(); - - } - - public void highlightInventory() - { - // if the panel itself isn't visible, don't waste time doing any highlighting logic - if (!invEqPanel.isVisible()) - { - return; - } - - // if the panel is visible, check if highlighting is enabled on the setup and globally - // if any of the two, reset the slots so they aren't highlighted - if (!currentSelectedSetup.isHighlightDifference() || !plugin.isHighlightingAllowed()) - { - invPanel.resetSlotColors(); - return; - } - - final ArrayList inv = plugin.getNormalizedContainer(InventoryID.INVENTORY); - invPanel.highlightSlotDifferences(inv, currentSelectedSetup); - } - - public void highlightEquipment() - { - // if the panel itself isn't visible, don't waste time doing any highlighting logic - if (!invEqPanel.isVisible()) - { - return; - } - - // if the panel is visible, check if highlighting is enabled on the setup and globally - // if any of the two, reset the slots so they aren't highlighted - if (!currentSelectedSetup.isHighlightDifference() || !plugin.isHighlightingAllowed()) - { - eqpPanel.resetSlotColors(); - return; - } - - final ArrayList eqp = plugin.getNormalizedContainer(InventoryID.EQUIPMENT); - eqpPanel.highlightSlotDifferences(eqp, currentSelectedSetup); - } - - public void returnToOverviewPanel() - { - noSetupsPanel.setVisible(false); - invEqPanel.setVisible(false); - overviewPanel.setVisible(true); - overviewTopRightButtonsPanel.setVisible(true); - setupTopRightButtonsPanel.setVisible(false); - title.setText(MAIN_TITLE); - currentSelectedSetup = null; - searchBar.setVisible(true); - plugin.resetBankSearch(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupRunePouchPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupRunePouchPanel.java deleted file mode 100644 index 9493baf077..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupRunePouchPanel.java +++ /dev/null @@ -1,130 +0,0 @@ -package net.runelite.client.plugins.inventorysetups.ui; - -import net.runelite.client.plugins.inventorysetups.InventorySetup; -import net.runelite.client.plugins.inventorysetups.InventorySetupItem; -import net.runelite.client.plugins.inventorysetups.InventorySetupSlotID; -import net.runelite.client.plugins.inventorysetups.InventorySetupPlugin; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.ColorScheme; -import javax.swing.JPanel; -import java.awt.GridLayout; -import java.util.ArrayList; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; - -public class InventorySetupRunePouchPanel extends InventorySetupContainerPanel -{ - private ArrayList runeSlots; - - InventorySetupRunePouchPanel(ItemManager itemManager, InventorySetupPlugin plugin) - { - super(itemManager, plugin, "Rune Pouch"); - } - - @Override - public void setupContainerPanel(JPanel containerSlotsPanel) - { - runeSlots = new ArrayList<>(); - for (int i = 0; i < 3; i++) - { - runeSlots.add(new InventorySetupSlot(ColorScheme.DARKER_GRAY_COLOR, InventorySetupSlotID.RUNE_POUCH, i)); - } - - final GridLayout gridLayout = new GridLayout(1, 4, 1, 1); - containerSlotsPanel.setLayout(gridLayout); - - for (final InventorySetupSlot slot : runeSlots) - { - containerSlotsPanel.add(slot); - } - } - - @Override - public void highlightSlotDifferences(ArrayList currContainer, InventorySetup inventorySetup) - { - assert inventorySetup.getRune_pouch() != null : "Rune Pouch container is null."; - - assert currContainer.size() == 3 : "Incorrect size"; - - isHighlighted = true; - - // Note, we don't care about order or stack size - - final ArrayList setupRunePouch = inventorySetup.getRune_pouch(); - - Map currInvMap = currContainer.stream() - .map(InventorySetupItem::getId) - .collect(Collectors.groupingBy(Function.identity(), Collectors.counting())); - - for (int i = setupRunePouch.size() - 1; i >= 0; i--) - { - int itemID = setupRunePouch.get(i).getId(); - Long currentCount = currInvMap.get(itemID); - - if (currentCount == null) - { - runeSlots.get(i).setBackground(inventorySetup.getHighlightColor()); - continue; - } - - if (currentCount == 1) - { - currInvMap.remove(itemID); - } - else - { - currInvMap.put(itemID, currentCount - 1); - } - - runeSlots.get(i).setBackground(ColorScheme.DARKER_GRAY_COLOR); - } - } - - @Override - public void setSlots(InventorySetup setup) - { - - if (setup.getRune_pouch() != null) - { - for (int i = 0; i < runeSlots.size(); i++) - { - super.setContainerSlot(i, runeSlots.get(i), setup); - } - } - else - { - for (final InventorySetupSlot slot : runeSlots) - { - slot.setImageLabel(null, null); - } - } - - validate(); - repaint(); - } - - @Override - public void resetSlotColors() - { - if (!isHighlighted) - { - return; - } - for (final InventorySetupSlot slot : runeSlots) - { - slot.setBackground(ColorScheme.DARKER_GRAY_COLOR); - } - isHighlighted = false; - - } - - public void highlightAllSlots(final InventorySetup setup) - { - for (final InventorySetupSlot slot : runeSlots) - { - slot.setBackground(setup.getHighlightColor()); - } - - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupSlot.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupSlot.java deleted file mode 100644 index 90be26cce6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/ui/InventorySetupSlot.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2019, dillydill123 - * 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.inventorysetups.ui; - -import net.runelite.client.plugins.inventorysetups.InventorySetup; -import net.runelite.client.plugins.inventorysetups.InventorySetupSlotID; -import lombok.Getter; -import lombok.Setter; -import net.runelite.client.util.AsyncBufferedImage; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingConstants; -import java.awt.Color; -import java.awt.Dimension; - -public class InventorySetupSlot extends JPanel -{ - @Getter - private final JLabel imageLabel; - - @Getter - private final InventorySetupSlotID slotID; - - @Getter - @Setter - private InventorySetup parentSetup; - - @Getter - private int indexInSlot; - - public InventorySetupSlot(Color color, InventorySetupSlotID id, int indexInSlot) - { - this.slotID = id; - this.imageLabel = new JLabel(); - this.parentSetup = null; - this.indexInSlot = indexInSlot; - imageLabel.setVerticalAlignment(SwingConstants.CENTER); - setPreferredSize(new Dimension(46, 42)); - setBackground(color); - add(imageLabel); - } - - public void setImageLabel(String toolTip, AsyncBufferedImage itemImage) - { - if (itemImage == null || toolTip == null) - { - imageLabel.setToolTipText(""); - imageLabel.setIcon(null); - imageLabel.revalidate(); - return; - } - - imageLabel.setToolTipText(toolTip); - itemImage.addTo(imageLabel); - - validate(); - repaint(); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsConfig.java deleted file mode 100644 index b8fc390c55..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsConfig.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (c) 2018 kulers - * 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.inventorytags; - -import java.awt.Color; -import lombok.RequiredArgsConstructor; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("inventorytags") -public interface InventoryTagsConfig extends Config -{ - String GROUP = "inventorytags"; - - @RequiredArgsConstructor - enum amount - { - ONE("1"), - TWO("2"), - THREE("3"), - FOUR("4"), - FIVE("5"), - SIX("6"), - SEVEN("7"), - EIGHT("8"), - NINE("9"), - TEN("10"), - ELEVEN("11"), - TWELVE("12"); - - private final String name; - - @Override - public String toString() - { - return name; - } - - public int toInt() - { - return Integer.parseInt(name); - } - } - - @ConfigItem( - position = 0, - keyName = "amount", - name = "Amount of groups", - description = "The amount of inventory groups" - ) - default amount getAmount() - { - return amount.FOUR; - } - - @ConfigItem( - position = 1, - keyName = "groupColor1", - name = "Group 1 Color", - description = "Color of the Tag", - hidden = true, - unhide = "amount", - unhideValue = "1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12" - ) - default Color getGroup1Color() - { - return new Color(255, 0, 0); - } - - @ConfigItem( - position = 2, - keyName = "groupColor2", - name = "Group 2 Color", - description = "Color of the Tag", - hidden = true, - unhide = "amount", - unhideValue = "2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12" - ) - default Color getGroup2Color() - { - return new Color(0, 255, 0); - } - - @ConfigItem( - position = 3, - keyName = "groupColor3", - name = "Group 3 Color", - description = "Color of the Tag", - hidden = true, - unhide = "amount", - unhideValue = "3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12" - ) - default Color getGroup3Color() - { - return new Color(0, 0, 255); - } - - @ConfigItem( - position = 4, - keyName = "groupColor4", - name = "Group 4 Color", - description = "Color of the Tag", - hidden = true, - unhide = "amount", - unhideValue = "4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12" - ) - default Color getGroup4Color() - { - return new Color(255, 0, 255); - } - - @ConfigItem( - position = 5, - keyName = "groupColor5", - name = "Group 5 Color", - description = "Color of the Tag", - hidden = true, - unhide = "amount", - unhideValue = "5 || 6 || 7 || 8 || 9 || 10 || 11 || 12" - ) - default Color getGroup5Color() - { - return new Color(0, 255, 246); - } - - @ConfigItem( - position = 6, - keyName = "groupColor6", - name = "Group 6 Color", - description = "Color of the Tag", - hidden = true, - unhide = "amount", - unhideValue = "6 || 7 || 8 || 9 || 10 || 11 || 12" - ) - default Color getGroup6Color() - { - return new Color(248, 255, 244); - } - - @ConfigItem( - position = 7, - keyName = "groupColor7", - name = "Group 7 Color", - description = "Color of the Tag", - hidden = true, - unhide = "amount", - unhideValue = "7 || 8 || 9 || 10 || 11 || 12" - ) - default Color getGroup7Color() - { - return new Color(0, 0, 0); - } - - @ConfigItem( - position = 8, - keyName = "groupColor8", - name = "Group 8 Color", - description = "Color of the Tag", - hidden = true, - unhide = "amount", - unhideValue = "8 || 9 || 10 || 11 || 12" - ) - default Color getGroup8Color() - { - return new Color(104, 105, 255); - } - - @ConfigItem( - position = 9, - keyName = "groupColor9", - name = "Group 9 Color", - description = "Color of the Tag", - hidden = true, - unhide = "amount", - unhideValue = "9 || 10 || 11 || 12" - ) - default Color getGroup9Color() - { - return new Color(255, 81, 0); - } - - @ConfigItem( - position = 10, - keyName = "groupColor10", - name = "Group 10 Color", - description = "Color of the Tag", - hidden = true, - unhide = "amount", - unhideValue = "10 || 11 || 12" - ) - default Color getGroup10Color() - { - return new Color(255, 107, 229); - } - - @ConfigItem( - position = 11, - keyName = "groupColor11", - name = "Group 11 Color", - description = "Color of the Tag", - hidden = true, - unhide = "amount", - unhideValue = "11 || 12" - ) - default Color getGroup11Color() - { - return new Color(121, 255, 157); - } - - @ConfigItem( - position = 12, - keyName = "groupColor12", - name = "Group 12 Color", - description = "Color of the Tag", - hidden = true, - unhide = "amount", - unhideValue = "12" - ) - default Color getGroup12Color() - { - return new Color(65, 61, 64); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsOverlay.java deleted file mode 100644 index 85560e0133..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsOverlay.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2018 kulers - * 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.inventorytags; - -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.widgets.WidgetItem; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.overlay.WidgetItemOverlay; - -@Singleton -public class InventoryTagsOverlay extends WidgetItemOverlay -{ - private final ItemManager itemManager; - private final InventoryTagsPlugin plugin; - - @Inject - private InventoryTagsOverlay(final ItemManager itemManager, final InventoryTagsPlugin plugin) - { - this.itemManager = itemManager; - this.plugin = plugin; - showOnEquipment(); - showOnInventory(); - } - - @Override - public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget) - { - final String group = plugin.getTag(itemId); - if (group != null) - { - final Color color = plugin.getGroupNameColor(group); - if (color != null) - { - Rectangle bounds = itemWidget.getCanvasBounds(); - final BufferedImage outline = itemManager.getItemOutline(itemId, itemWidget.getQuantity(), color); - graphics.drawImage(outline, (int) bounds.getX(), (int) bounds.getY(), null); - } - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsPlugin.java deleted file mode 100644 index 198e36e618..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsPlugin.java +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Copyright (c) 2018 kulers - * 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.inventorytags; - -import com.google.common.base.MoreObjects; -import com.google.common.collect.ImmutableList; -import com.google.inject.Provides; -import java.awt.Color; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.MenuEntry; -import net.runelite.api.MenuOpcode; -import net.runelite.api.events.MenuOpened; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.WidgetMenuOptionClicked; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.menus.MenuManager; -import net.runelite.client.menus.WidgetMenuOption; -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.ColorUtil; - -@PluginDescriptor( - name = "Inventory Tags", - description = "Add the ability to tag items in your inventory", - tags = {"highlight", "items", "overlay", "tagging"}, - enabledByDefault = false, - type = PluginType.UTILITY -) -@Singleton -public class InventoryTagsPlugin extends Plugin -{ - private static final String ITEM_KEY_PREFIX = "item_"; - - private static final String SETNAME_GROUP_1 = "Group 1"; - private static final String SETNAME_GROUP_2 = "Group 2"; - private static final String SETNAME_GROUP_3 = "Group 3"; - private static final String SETNAME_GROUP_4 = "Group 4"; - private static final String SETNAME_GROUP_5 = "Group 5"; - private static final String SETNAME_GROUP_6 = "Group 6"; - private static final String SETNAME_GROUP_7 = "Group 7"; - private static final String SETNAME_GROUP_8 = "Group 8"; - private static final String SETNAME_GROUP_9 = "Group 9"; - private static final String SETNAME_GROUP_10 = "Group 10"; - private static final String SETNAME_GROUP_11 = "Group 11"; - private static final String SETNAME_GROUP_12 = "Group 12"; - - - private static final String CONFIGURE = "Configure"; - private static final String SAVE = "Save"; - private static final String MENU_TARGET = "Inventory Tags"; - private static final String MENU_SET = "Mark"; - private static final String MENU_REMOVE = "Remove"; - - private static final WidgetMenuOption FIXED_INVENTORY_TAB_CONFIGURE = new WidgetMenuOption(CONFIGURE, - MENU_TARGET, WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB); - private static final WidgetMenuOption FIXED_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE, - MENU_TARGET, WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB); - private static final WidgetMenuOption RESIZABLE_INVENTORY_TAB_CONFIGURE = new WidgetMenuOption(CONFIGURE, - MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_TAB); - private static final WidgetMenuOption RESIZABLE_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE, - MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_TAB); - private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_CONFIGURE = new WidgetMenuOption(CONFIGURE, - MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB); - private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE, - MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB); - - private static final List GROUPS = ImmutableList.of(SETNAME_GROUP_12, SETNAME_GROUP_11, SETNAME_GROUP_10, SETNAME_GROUP_9, - SETNAME_GROUP_8, SETNAME_GROUP_7, SETNAME_GROUP_6, SETNAME_GROUP_5, SETNAME_GROUP_4, SETNAME_GROUP_3, SETNAME_GROUP_2, SETNAME_GROUP_1); - - @Inject - private ConfigManager configManager; - - @Inject - private InventoryTagsConfig config; - - @Inject - private MenuManager menuManager; - - @Inject - private InventoryTagsOverlay overlay; - - @Inject - private OverlayManager overlayManager; - - private boolean editorMode; - - private InventoryTagsConfig.amount amount; - private Color group1Color; - private Color group2Color; - private Color group3Color; - private Color group4Color; - private Color group5Color; - private Color group6Color; - private Color group7Color; - private Color group8Color; - private Color group9Color; - private Color group10Color; - private Color group11Color; - private Color group12Color; - - @Provides - InventoryTagsConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(InventoryTagsConfig.class); - } - - String getTag(int itemId) - { - String tag = configManager.getConfiguration(InventoryTagsConfig.GROUP, ITEM_KEY_PREFIX + itemId); - if (tag == null || tag.isEmpty()) - { - return null; - } - - return tag; - } - - private void setTag(int itemId, String tag) - { - configManager.setConfiguration(InventoryTagsConfig.GROUP, ITEM_KEY_PREFIX + itemId, tag); - } - - private void unsetTag(int itemId) - { - configManager.unsetConfiguration(InventoryTagsConfig.GROUP, ITEM_KEY_PREFIX + itemId); - } - - @Override - protected void startUp() - { - updateConfig(); - - refreshInventoryMenuOptions(); - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - removeInventoryMenuOptions(); - overlayManager.remove(overlay); - editorMode = false; - } - - @Subscribe - private void onWidgetMenuOptionClicked(final WidgetMenuOptionClicked event) - { - if (event.getWidget() == WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB - || event.getWidget() == WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_TAB - || event.getWidget() == WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB) - { - editorMode = event.getMenuOption().equals(CONFIGURE) && Text.removeTags(event.getMenuTarget()).equals(MENU_TARGET); - refreshInventoryMenuOptions(); - } - } - - @Subscribe - private void onMenuOptionClicked(final MenuOptionClicked event) - { - if (event.getMenuOpcode() != MenuOpcode.RUNELITE) - { - return; - } - - final String selectedMenu = Text.removeTags(event.getTarget()); - - if (event.getOption().equals(MENU_SET)) - { - setTag(event.getIdentifier(), selectedMenu); - } - else if (event.getOption().equals(MENU_REMOVE)) - { - unsetTag(event.getIdentifier()); - } - } - - @Subscribe - private void onMenuOpened(final MenuOpened event) - { - final MenuEntry firstEntry = event.getFirstEntry(); - - if (firstEntry == null) - { - return; - } - - final int widgetId = firstEntry.getParam1(); - - // Inventory item menu - if (widgetId == WidgetInfo.INVENTORY.getId() && editorMode) - { - int itemId = firstEntry.getIdentifier(); - - if (itemId == -1) - { - return; - } - - MenuEntry[] menuList = new MenuEntry[amount.toInt() + 1]; - int num = 0; - - // preserve the 'Cancel' option as the client will reuse the first entry for Cancel and only resets option/action - menuList[num++] = event.getMenuEntries()[0]; - - List groups = GROUPS.subList(Math.max(GROUPS.size() - amount.toInt(), 0), GROUPS.size()); - - for (final String groupName : groups) - { - final String group = getTag(itemId); - final MenuEntry newMenu = new MenuEntry(); - final Color color = getGroupNameColor(groupName); - newMenu.setOption(groupName.equals(group) ? MENU_REMOVE : MENU_SET); - newMenu.setTarget(ColorUtil.prependColorTag(groupName, MoreObjects.firstNonNull(color, Color.WHITE))); - newMenu.setIdentifier(itemId); - newMenu.setParam1(widgetId); - newMenu.setOpcode(MenuOpcode.RUNELITE.getId()); - menuList[num++] = newMenu; - } - - // Need to set the event entries to prevent conflicts - event.setMenuEntries(menuList); - event.setModified(); - } - } - - Color getGroupNameColor(final String name) - { - switch (name) - { - case SETNAME_GROUP_1: - return this.group1Color; - case SETNAME_GROUP_2: - return this.group2Color; - case SETNAME_GROUP_3: - return this.group3Color; - case SETNAME_GROUP_4: - return this.group4Color; - case SETNAME_GROUP_5: - return this.group5Color; - case SETNAME_GROUP_6: - return this.group6Color; - case SETNAME_GROUP_7: - return this.group7Color; - case SETNAME_GROUP_8: - return this.group8Color; - case SETNAME_GROUP_9: - return this.group9Color; - case SETNAME_GROUP_10: - return this.group10Color; - case SETNAME_GROUP_11: - return this.group11Color; - case SETNAME_GROUP_12: - return this.group12Color; - } - return null; - } - - private void removeInventoryMenuOptions() - { - menuManager.removeManagedCustomMenu(FIXED_INVENTORY_TAB_CONFIGURE); - menuManager.removeManagedCustomMenu(FIXED_INVENTORY_TAB_SAVE); - menuManager.removeManagedCustomMenu(RESIZABLE_INVENTORY_TAB_CONFIGURE); - menuManager.removeManagedCustomMenu(RESIZABLE_INVENTORY_TAB_SAVE); - menuManager.removeManagedCustomMenu(RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_CONFIGURE); - menuManager.removeManagedCustomMenu(RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE); - } - - private void refreshInventoryMenuOptions() - { - removeInventoryMenuOptions(); - if (editorMode) - { - menuManager.addManagedCustomMenu(FIXED_INVENTORY_TAB_SAVE); - menuManager.addManagedCustomMenu(RESIZABLE_INVENTORY_TAB_SAVE); - menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE); - } - else - { - menuManager.addManagedCustomMenu(FIXED_INVENTORY_TAB_CONFIGURE); - menuManager.addManagedCustomMenu(RESIZABLE_INVENTORY_TAB_CONFIGURE); - menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_CONFIGURE); - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("inventorytags")) - { - updateConfig(); - } - } - - private void updateConfig() - { - this.amount = config.getAmount(); - this.group1Color = config.getGroup1Color(); - this.group2Color = config.getGroup2Color(); - this.group3Color = config.getGroup3Color(); - this.group4Color = config.getGroup4Color(); - this.group5Color = config.getGroup5Color(); - this.group6Color = config.getGroup6Color(); - this.group7Color = config.getGroup7Color(); - this.group8Color = config.getGroup8Color(); - this.group9Color = config.getGroup9Color(); - this.group10Color = config.getGroup10Color(); - this.group11Color = config.getGroup11Color(); - this.group12Color = config.getGroup12Color(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerConfig.java deleted file mode 100644 index dcf99eea39..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerConfig.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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.inventoryviewer; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup(InventoryViewerPlugin.CONFIG_GROUP_KEY) -public interface InventoryViewerConfig extends Config -{ - @ConfigItem( - keyName = "viewerMode", - name = "Mode", - description = "The mode to display the inventory viewer with" - ) - default InventoryViewerMode viewerMode() - { - return InventoryViewerMode.FULL; - } - - @ConfigItem( - keyName = "showFreeSlots", - name = "Show Free Slots", - description = "Whether to show a label with the free slots in the inventory" - ) - default boolean showFreeSlots() - { - return false; - } - - @ConfigItem( - keyName = "hideWhenInvOpen", - name = "Hide when inventory is open", - description = "Hide the inventory viewer when the player's inventory is open" - ) - default boolean hideWhenInvOpen() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerMode.java deleted file mode 100644 index c6707f8701..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerMode.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.inventoryviewer; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter(AccessLevel.PACKAGE) -@RequiredArgsConstructor -public enum InventoryViewerMode -{ - FULL("Full"), - GROUPED("Grouped"); - - private final String name; - - @Override - public String toString() - { - return name; - } -} \ No newline at end of file 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 deleted file mode 100644 index 0b13bf9149..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerOverlay.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (c) 2018 AWPH-I - * 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.inventoryviewer; - -import com.google.common.collect.HashMultiset; -import com.google.common.collect.Multiset; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -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; -import net.runelite.api.ItemDefinition; -import net.runelite.api.VarClientInt; -import net.runelite.api.vars.InterfaceTab; -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; -import net.runelite.client.ui.overlay.components.ComponentOrientation; -import net.runelite.client.ui.overlay.components.ImageComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -@Singleton -class InventoryViewerOverlay extends Overlay -{ - private static final int INVENTORY_SIZE = 28; - 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; - private final InventoryViewerPlugin plugin; - - private final PanelComponent wrapperComponent = new PanelComponent(); - private final PanelComponent inventoryComponent = new PanelComponent(); - private final TitleComponent freeSlotsComponent = TitleComponent.builder().build(); - - @Inject - private InventoryViewerOverlay(final Client client, final ItemManager itemManager, final InventoryViewerPlugin plugin) - { - setPosition(OverlayPosition.BOTTOM_RIGHT); - - inventoryComponent.setWrapping(4); - inventoryComponent.setGap(new Point(6, 4)); - inventoryComponent.setOrientation(ComponentOrientation.HORIZONTAL); - inventoryComponent.setBackgroundColor(null); - inventoryComponent.setBorder(new Rectangle( - 0, - ComponentConstants.STANDARD_BORDER, - 0, - ComponentConstants.STANDARD_BORDER)); - - wrapperComponent.setOrientation(ComponentOrientation.HORIZONTAL); - wrapperComponent.setWrapping(2); - wrapperComponent.setBorder(new Rectangle( - ComponentConstants.STANDARD_BORDER * 2, - ComponentConstants.STANDARD_BORDER, - ComponentConstants.STANDARD_BORDER * 2, - ComponentConstants.STANDARD_BORDER)); - - this.itemManager = itemManager; - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.isHideWhenInvOpen() - && client.getVar(VarClientInt.INTERFACE_TAB) == InterfaceTab.INVENTORY.getId()) - { - return null; - } - - final ItemContainer itemContainer = client.getItemContainer(InventoryID.INVENTORY); - - if (itemContainer == null) - { - return null; - } - - inventoryComponent.getChildren().clear(); - wrapperComponent.getChildren().clear(); - - final Item[] items = itemContainer.getItems(); - - if (plugin.getViewerMode() == InventoryViewerMode.GROUPED) - { - Multiset totals = HashMultiset.create(); - for (Item item : items) - { - if (item.getId() != -1) - { - totals.add(item.getId(), item.getQuantity()); - } - } - - final long remaining = INVENTORY_SIZE - totals.size(); - if (remaining == INVENTORY_SIZE) - { - return null; - } - - for (Multiset.Entry cursor : totals.entrySet()) - { - final BufferedImage image = itemManager.getImage(cursor.getElement(), cursor.getCount(), true); - if (image != null) - { - inventoryComponent.getChildren().add(new ImageComponent(image)); - } - } - wrapperComponent.getChildren().add(inventoryComponent); - - if (plugin.isShowFreeSlots()) - { - freeSlotsComponent.setText(remaining + " free"); - wrapperComponent.setPreferredSize(new Dimension(Math.min(totals.elementSet().size(), 4) * (PLACEHOLDER_WIDTH + 6) + ComponentConstants.STANDARD_BORDER * 2, 0)); - wrapperComponent.getChildren().add(freeSlotsComponent); - } - - return wrapperComponent.render(graphics); - } - - int remaining = 28; - - for (int i = 0; i < INVENTORY_SIZE; i++) - { - if (i < items.length) - { - final Item item = items[i]; - if (item.getQuantity() > 0) - { - remaining -= 1; - final BufferedImage image = getImage(item); - if (image != null) - { - inventoryComponent.getChildren().add(new ImageComponent(image)); - continue; - } - } - } - - // put a placeholder image so each item is aligned properly and the panel is not resized - inventoryComponent.getChildren().add(PLACEHOLDER_IMAGE); - } - - wrapperComponent.getChildren().add(inventoryComponent); - - if (plugin.isShowFreeSlots()) - { - freeSlotsComponent.setText(remaining + " free"); - wrapperComponent.setPreferredSize(new Dimension(4 * (PLACEHOLDER_WIDTH + 6) + ComponentConstants.STANDARD_BORDER * 2, 0)); - wrapperComponent.getChildren().add(freeSlotsComponent); - } - - return wrapperComponent.render(graphics); - } - - private BufferedImage getImage(Item item) - { - ItemDefinition itemComposition = itemManager.getItemDefinition(item.getId()); - return itemManager.getImage(item.getId(), item.getQuantity(), itemComposition.isStackable()); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerPlugin.java deleted file mode 100644 index 1633df6e84..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerPlugin.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2018 AWPH-I - * 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.inventoryviewer; - -import com.google.inject.Provides; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "Inventory Viewer", - description = "Add an overlay showing the contents of your inventory", - tags = {"alternate", "items", "overlay", "second"}, - enabledByDefault = false, - type = PluginType.UTILITY -) -@Singleton -public class InventoryViewerPlugin extends Plugin -{ - static final String CONFIG_GROUP_KEY = "inventoryviewer"; - - @Inject - private InventoryViewerOverlay overlay; - - @Inject - private OverlayManager overlayManager; - - @Inject - private InventoryViewerConfig config; - - @Getter(AccessLevel.PACKAGE) - private InventoryViewerMode viewerMode; - @Getter(AccessLevel.PACKAGE) - private boolean showFreeSlots; - @Getter(AccessLevel.PACKAGE) - private boolean hideWhenInvOpen; - - @Provides - InventoryViewerConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(InventoryViewerConfig.class); - } - - @Override - public void startUp() - { - updateConfig(); - overlayManager.add(overlay); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals(CONFIG_GROUP_KEY)) - { - updateConfig(); - } - } - - @Override - public void shutDown() - { - overlayManager.remove(overlay); - } - - private void updateConfig() - { - this.viewerMode = config.viewerMode(); - this.showFreeSlots = config.showFreeSlots(); - this.hideWhenInvOpen = config.hideWhenInvOpen(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java deleted file mode 100644 index 12b3f1e237..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java +++ /dev/null @@ -1,507 +0,0 @@ -/* - * Copyright (c) 2017, Devin French - * Copyright (c) 2019, Aleios - * 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.itemcharges; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("itemCharge") -public interface ItemChargeConfig extends Config -{ - @ConfigItem( - keyName = "veryLowWarningColor", - name = "Very Low Warning Color", - description = "Configure the color of the overlay when charges are very low", - position = 1 - ) - default Color veryLowWarningColor() - { - return Color.RED; - } - - @ConfigItem( - keyName = "lowWarningColor", - name = "Low Warning Color", - description = "Configure the color of the overlay when charges are low", - position = 2 - ) - default Color lowWarningolor() - { - return Color.YELLOW; - } - - @ConfigItem( - keyName = "veryLowWarning", - name = "Very Low Warning", - description = "Configure the charge count for the very low warning color", - position = 3 - ) - default int veryLowWarning() - { - return 1; - } - - @ConfigItem( - keyName = "lowWarning", - name = "Low Warning", - description = "Configure the charge count for the low warning color", - position = 4 - ) - default int lowWarning() - { - return 2; - } - - @ConfigItem( - keyName = "showTeleportCharges", - name = "Show Teleport Charges", - description = "Configures if teleport item count is shown", - position = 5 - ) - default boolean showTeleportCharges() - { - return true; - } - - @ConfigItem( - keyName = "showDodgyCount", - name = "Dodgy Necklace Count", - description = "Configures if Dodgy Necklace charge count is shown", - position = 6 - ) - default boolean showDodgyCount() - { - return true; - } - - @ConfigItem( - keyName = "dodgyNotification", - name = "Dodgy Necklace Notification", - description = "Configures if the dodgy necklace breaking notification is shown", - position = 7 - ) - default boolean dodgyNotification() - { - return true; - } - - @ConfigItem( - keyName = "dodgyNecklace", - name = "", - description = "", - hidden = true - ) - default int dodgyNecklace() - { - return -1; - } - - @ConfigItem( - keyName = "dodgyNecklace", - name = "", - description = "" - ) - void dodgyNecklace(int dodgyNecklace); - - @ConfigItem( - keyName = "showImpCharges", - name = "Show Imp-in-a-box charges", - description = "Configures if imp-in-a-box item charges is shown", - position = 8 - ) - default boolean showImpCharges() - { - return true; - } - - @ConfigItem( - keyName = "showFungicideCharges", - name = "Show Fungicide Charges", - description = "Configures if fungicide item charges is shown", - position = 9 - ) - default boolean showFungicideCharges() - { - return true; - } - - @ConfigItem( - keyName = "showWateringCanCharges", - name = "Show Watering Can Charges", - description = "Configures if watering can item charge is shown", - position = 10 - ) - default boolean showWateringCanCharges() - { - return true; - } - - @ConfigItem( - keyName = "showWaterskinCharges", - name = "Show Waterskin Charges", - description = "Configures if waterskin item charge is shown", - position = 11 - ) - default boolean showWaterskinCharges() - { - return true; - } - - @ConfigItem( - keyName = "showBellowCharges", - name = "Show Bellow Charges", - description = "Configures if ogre bellow item charge is shown", - position = 12 - ) - default boolean showBellowCharges() - { - return true; - } - - @ConfigItem( - keyName = "showAbyssalBraceletCharges", - name = "Show Abyssal Bracelet Charges", - description = "Configures if abyssal bracelet item charge is shown", - position = 13 - ) - default boolean showAbyssalBraceletCharges() - { - return true; - } - - @ConfigItem( - keyName = "recoilNotification", - name = "Ring of Recoil Notification", - description = "Configures if the ring of recoil breaking notification is shown", - position = 14 - ) - default boolean recoilNotification() - { - return false; - } - - @ConfigItem( - keyName = "showBindingNecklaceCharges", - name = "Show Binding Necklace Charges", - description = "Configures if binding necklace item charge is shown", - position = 15 - ) - default boolean showBindingNecklaceCharges() - { - return true; - } - - @ConfigItem( - keyName = "bindingNecklace", - name = "", - description = "", - hidden = true - ) - default int bindingNecklace() - { - return -1; - } - - @ConfigItem( - keyName = "bindingNecklace", - name = "", - description = "" - ) - void bindingNecklace(int bindingNecklace); - - @ConfigItem( - keyName = "bindingNotification", - name = "Binding Necklace Notification", - description = "Configures if the binding necklace breaking notification is shown", - position = 16 - ) - default boolean bindingNotification() - { - return true; - } - - @ConfigItem( - keyName = "showExplorerRingCharges", - name = "Show Explorer's Ring Alch Charges", - description = "Configures if explorer's ring alchemy charges are shown", - position = 17 - ) - default boolean showExplorerRingCharges() - { - return true; - } - - @ConfigItem( - keyName = "explorerRing", - name = "", - description = "", - hidden = true - ) - default int explorerRing() - { - return -1; - } - - @ConfigItem( - keyName = "explorerRing", - name = "", - description = "" - ) - void explorerRing(int explorerRing); - - @ConfigItem( - keyName = "showSlayerBracelets", - name = "Show Slayer Bracelets Charges", - description = "Configures if slayer bracelets' item charges are shown", - position = 18 - ) - default boolean showSlayerBracelets() - { - return true; - } - - - @ConfigItem( - keyName = "expeditious", - name = "", - description = "", - hidden = true - ) - default int expeditious() - { - return -1; - } - - @ConfigItem( - keyName = "expeditious", - name = "", - description = "" - ) - void expeditious(int expeditious); - - @ConfigItem( - keyName = "slaughter", - name = "", - description = "", - hidden = true - ) - default int slaughter() - { - return -1; - } - - @ConfigItem( - keyName = "slaughter", - name = "", - description = "" - ) - void slaughter(int slaughter); - - - @ConfigItem( - keyName = "xericTalisman", - name = "", - description = "", - hidden = true - ) - default int xericTalisman() - { - return -1; - } - - @ConfigItem( - keyName = "xericTalisman", - name = "", - description = "" - ) - void xericTalisman(int xericTalisman); - - @ConfigItem( - keyName = "showSoulBearerCharges", - name = "Show Soul Bearer Charges", - description = "Configures if Soul Bearer item charge is shown", - position = 19 - ) - default boolean showSoulBearerCharges() - { - return false; - } - - @ConfigItem( - keyName = "soulBearer", - name = "", - description = "", - hidden = true - ) - default int soulBearer() - { - return -1; - } - - @ConfigItem( - keyName = "soulBearer", - name = "", - description = "" - ) - void soulBearer(int soulBearer); - - @ConfigItem( - keyName = "showChronicleCharges", - name = "Show Chronicle Charges", - description = "Configures if Chronicle item charge is shown", - position = 20 - ) - default boolean showChronicleCharges() - { - return false; - } - - @ConfigItem( - keyName = "showXericTalismanCharges", - name = "Show Xeric's Talisman Charges", - description = "Configures if Xeric's Talisman item charge is shown", - position = 21 - ) - default boolean showXericTalismanCharges() - { - return false; - } - - @ConfigItem( - keyName = "showrecoil", - name = "Show If Recoil is activated", - description = "Configures if Recoil is activated", - position = 22 - ) - default boolean showrecoil() - { - return false; - } - - @ConfigItem( - keyName = "chronicle", - name = "", - description = "", - hidden = true - ) - default int chronicle() - { - return -1; - } - - @ConfigItem( - keyName = "chronicle", - name = "", - description = "" - ) - void chronicle(int chronicle); - - @ConfigItem( - keyName = "showRingOfForgingCount", - name = "Show Ring of Forging Charges", - description = "Configures if the Ring of Forging charge count is shown", - position = 23 - ) - default boolean showRingOfForgingCount() - { - return true; - } - - @ConfigItem( - keyName = "ringOfForging", - name = "", - description = "", - hidden = true - ) - default int ringOfForging() - { - return -1; - } - - @ConfigItem( - keyName = "ringOfForging", - name = "", - description = "" - ) - void ringOfForging(int ringOfForging); - - @ConfigItem( - keyName = "ringOfForgingNotification", - name = "Ring of Forging Notification", - description = "Configures if the Ring of Forging breaking notification is enabled", - position = 24 - ) - default boolean ringOfForgingNotification() - { - return true; - } - - @ConfigItem( - keyName = "showSackCharges", - name = "Show Sack Quantity", - description = "Configures if the number of vegetables in sacks is shown", - position = 25 - ) - default boolean showSackCharges() - { - return true; - } - - @ConfigItem( - keyName = "showBasketCharges", - name = "Show Basket Quantity", - description = "Configures if the number of fruit in a basket is shown", - position = 26 - ) - default boolean showBasketCharges() - { - return true; - } - - @ConfigItem( - keyName = "showKharedstsMemoirsCharges", - name = "Show Kharedst's Memoirs Charges", - description = "Configures if Kharedst's Memoirs item charge is shown", - position = 27 - ) - default boolean showKharedstsMemoirsCharges() - { - return true; - } - - @ConfigItem( - keyName = "showInfoboxes", - name = "Show Infoboxes", - description = "Configures whether to show an infobox equipped charge items", - position = 28 - ) - default boolean showInfoboxes() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeInfobox.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeInfobox.java deleted file mode 100644 index 82bd2e411a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeInfobox.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2018, 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.itemcharges; - -import java.awt.Color; -import java.awt.image.BufferedImage; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.EquipmentInventorySlot; -import net.runelite.client.ui.overlay.infobox.Counter; - -@Getter(AccessLevel.PACKAGE) -class ItemChargeInfobox extends Counter -{ - private final ItemChargePlugin plugin; - private final ItemWithSlot item; - private final EquipmentInventorySlot slot; - - ItemChargeInfobox( - final ItemChargePlugin plugin, - final BufferedImage image, - final String name, - final int charges, - final ItemWithSlot item, - final EquipmentInventorySlot slot) - { - super(image, plugin, charges); - setTooltip(name); - this.plugin = plugin; - this.item = item; - this.slot = slot; - } - - @Override - public Color getTextColor() - { - return getPlugin().getColor(getCount()); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java deleted file mode 100644 index f3f4c01fc0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * Copyright (c) 2019, Aleios - * 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.itemcharges; - -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.Rectangle; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.ItemID; -import net.runelite.api.widgets.WidgetItem; -import static net.runelite.client.plugins.itemcharges.ItemChargeType.ABYSSAL_BRACELET; -import static net.runelite.client.plugins.itemcharges.ItemChargeType.BELLOWS; -import static net.runelite.client.plugins.itemcharges.ItemChargeType.FRUIT_BASKET; -import static net.runelite.client.plugins.itemcharges.ItemChargeType.FUNGICIDE_SPRAY; -import static net.runelite.client.plugins.itemcharges.ItemChargeType.IMPBOX; -import static net.runelite.client.plugins.itemcharges.ItemChargeType.SACK; -import static net.runelite.client.plugins.itemcharges.ItemChargeType.TELEPORT; -import static net.runelite.client.plugins.itemcharges.ItemChargeType.WATERCAN; -import static net.runelite.client.plugins.itemcharges.ItemChargeType.WATERSKIN; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.overlay.WidgetItemOverlay; -import net.runelite.client.ui.overlay.components.TextComponent; - -@Singleton -class ItemChargeOverlay extends WidgetItemOverlay -{ - private final ItemChargePlugin plugin; - - @Inject - ItemChargeOverlay(final ItemChargePlugin itemChargePlugin) - { - this.plugin = itemChargePlugin; - showOnInventory(); - showOnEquipment(); - } - - @Override - public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget) - { - if (!displayOverlay()) - { - return; - } - - graphics.setFont(FontManager.getRunescapeSmallFont()); - - int charges; - if (itemId == ItemID.DODGY_NECKLACE) - { - if (!plugin.isShowDodgyCount()) - { - return; - } - - charges = plugin.getDodgyNecklace(); - } - else if (itemId == ItemID.BRACELET_OF_SLAUGHTER) - { - if (!plugin.isShowSlayerBracelets()) - { - return; - } - - charges = plugin.getSlaughter(); - } - else if (itemId == ItemID.EXPEDITIOUS_BRACELET) - { - if (!plugin.isShowSlayerBracelets()) - { - return; - } - - charges = plugin.getExpeditious(); - } - else if (itemId == ItemID.BINDING_NECKLACE) - { - if (!plugin.isShowBindingNecklaceCharges()) - { - return; - } - - charges = plugin.getBindingNecklace(); - } - else if (itemId == ItemID.XERICS_TALISMAN) - { - if (!plugin.isShowXericTalismanCharges()) - { - return; - } - charges = plugin.getXericTalisman(); - } - else if (itemId == ItemID.SOUL_BEARER) - { - if (!plugin.isShowSoulBearerCharges()) - { - return; - } - charges = plugin.getSoulBearer(); - } - else if (itemId == ItemID.CHRONICLE) - { - if (!plugin.isShowChronicleCharges()) - { - return; - } - charges = plugin.getChronicle(); - } - else if (itemId == ItemID.KHAREDSTS_MEMOIRS) - { - if (!plugin.isShowKharedstsMemoirs()) - { - return; - } - charges = plugin.getKharedstsMemoirs(); - } - else if (itemId >= ItemID.EXPLORERS_RING_1 && itemId <= ItemID.EXPLORERS_RING_4) - { - if (!plugin.isShowExplorerRingCharges()) - { - return; - } - - charges = plugin.getExplorerRing(); - } - else if (itemId == ItemID.RING_OF_FORGING) - { - if (!plugin.isShowRingOfForgingCount()) - { - return; - } - - charges = plugin.getRingOfForging(); - } - else - { - ItemWithCharge chargeItem = ItemWithCharge.findItem(itemId); - if (chargeItem == null) - { - return; - } - - ItemChargeType type = chargeItem.getType(); - if ((type == TELEPORT && !plugin.isShowTeleportCharges()) - || (type == FUNGICIDE_SPRAY && !plugin.isShowFungicideCharges()) - || (type == IMPBOX && !plugin.isShowImpCharges()) - || (type == WATERCAN && !plugin.isShowWateringCanCharges()) - || (type == WATERSKIN && !plugin.isShowWaterskinCharges()) - || (type == BELLOWS && !plugin.isShowBellowCharges()) - || (type == FRUIT_BASKET && !plugin.isShowBasketCharges()) - || (type == SACK && !plugin.isShowSackCharges()) - || (type == ABYSSAL_BRACELET && !plugin.isShowAbyssalBraceletCharges())) - { - return; - } - - charges = chargeItem.getCharges(); - } - - final Rectangle bounds = itemWidget.getCanvasBounds(); - final TextComponent textComponent = new TextComponent(); - textComponent.setPosition(new Point(bounds.x - 1, bounds.y + 15)); - textComponent.setText(charges < 0 ? "?" : String.valueOf(charges)); - textComponent.setColor(plugin.getColor(charges)); - textComponent.render(graphics); - } - - private boolean displayOverlay() - { - return plugin.isShowTeleportCharges() || plugin.isShowDodgyCount() || plugin.isShowFungicideCharges() - || plugin.isShowImpCharges() || plugin.isShowWateringCanCharges() || plugin.isShowWaterskinCharges() - || plugin.isShowBellowCharges() || plugin.isShowBasketCharges() || plugin.isShowSackCharges() || plugin.isShowAbyssalBraceletCharges() || plugin.isShowExplorerRingCharges() - || plugin.isShowRingOfForgingCount(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java deleted file mode 100644 index c69c52df92..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java +++ /dev/null @@ -1,958 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * Copyright (c) 2018, Hydrox6 - * Copyright (c) 2019, Aleios - * 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.itemcharges; - -import com.google.common.primitives.Ints; -import com.google.inject.Provides; -import java.awt.Color; -import java.awt.image.BufferedImage; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.EquipmentInventorySlot; -import net.runelite.api.GraphicID; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemID; -import static net.runelite.api.ItemID.RING_OF_RECOIL; -import net.runelite.api.Varbits; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.api.events.SpotAnimationChanged; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.Notifier; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -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.ui.overlay.infobox.InfoBoxManager; - -@PluginDescriptor( - name = "Item Charges", - description = "Show number of item charges remaining", - tags = {"inventory", "notifications", "overlay"}, - type = PluginType.UTILITY -) -@Singleton -public class ItemChargePlugin extends Plugin -{ - private static final Pattern DODGY_CHECK_PATTERN = Pattern.compile( - "Your dodgy necklace has (\\d+) charges? left\\."); - private static final String CHAT_BRACELET_SLAUGHTER = "Your bracelet of slaughter prevents your slayer"; - private static final Pattern CHAT_BRACELET_SLAUGHTER_REGEX = Pattern.compile( - "Your bracelet of slaughter prevents your slayer count decreasing. It has (\\d{1,2}) charge[s]? left."); - private static final String CHAT_BRACELET_EXPEDITIOUS = "Your expeditious bracelet helps you progress your"; - private static final Pattern CHAT_BRACELET_EXPEDITIOUS_REGEX = Pattern.compile( - "Your expeditious bracelet helps you progress your slayer (?:task )?faster. It has (\\d{1,2}) charge[s]? left."); - private static final Pattern CHAT_BRACELET_SLAUGHTER_CHARGE_REGEX = Pattern.compile( - "Your bracelet of slaughter has (\\d{1,2}) charge[s]? left."); - private static final Pattern CHAT_BRACELET_EXPEDITIOUS_CHARGE_REGEX = Pattern.compile( - "Your expeditious bracelet has (\\d{1,2}) charge[s]? left."); - private static final Pattern DODGY_PROTECT_PATTERN = Pattern.compile( - "Your dodgy necklace protects you\\..*It has (\\d+) charges? left\\."); - private static final Pattern DODGY_BREAK_PATTERN = Pattern.compile( - "Your dodgy necklace protects you\\..*It then crumbles to dust\\."); - private static final String RING_OF_RECOIL_BREAK_MESSAGE = "Your Ring of Recoil has shattered."; - private static final Pattern BINDING_CHECK_PATTERN = Pattern.compile( - "You have ([0-9]+|one) charges? left before your Binding necklace disintegrates."); - private static final Pattern BINDING_USED_PATTERN = Pattern.compile( - "You bind the temple's power into (mud|lava|steam|dust|smoke|mist) runes\\."); - private static final String BINDING_BREAK_TEXT = "Your Binding necklace has disintegrated."; - private static final Pattern XERIC_CHECK_CHARGE_PATTERN = Pattern.compile( - "talisman has (\\d+|one) charges?"); - private static final Pattern XERIC_RECHARGEWIDGET_PATTERN = Pattern.compile( - "Your talisman now has (\\d+|one) charges?\\."); - private static final Pattern XERIC_OUT_OF_CHARGES = Pattern.compile( - "Your talisman has run out of charges"); - private static final Pattern XERIC_UNCHARGE_PATTERN = Pattern.compile( - "lizard fangs? from your talisman\\."); - private static final Pattern SOULBEARER_RECHARGE_PATTERN = Pattern.compile( - "You add (\\d+|a) charges? to your soul bearer.It now has (\\d+) charges\\."); - private static final Pattern SOULBEARER_RECHARGE_PATTERN2 = Pattern.compile( - "Your soul bearer now has one charge\\."); - private static final Pattern SOULBEARER_CHECK_CHARGE_PATTERN = Pattern.compile( - "soul bearer has (\\d+|one) charges?\\."); - private static final Pattern SOULBEARER_UNCHARGE_PATTERN = Pattern.compile( - "You remove the runes from the soul bearer\\."); - private static final Pattern SOULBEARER_BANKHEADS_PATTERN = Pattern.compile( - "Your soul bearer carries the ensouled heads? to your ?bank\\. It has (\\d+|one) charges? left\\."); - private static final Pattern SOULBEARER_OUT_OF_CHARGES = Pattern.compile( - "Your soul bearer carries the ensouled heads? to (.+)\\. It has run out of charges\\."); - private static final Pattern CHRONICLE_CHECK_CHARGE_PATTERN = Pattern.compile( - "Your book has (\\d+) charges left\\."); - private static final Pattern CHRONICLE_ADD_CHARGE_PATTERN = Pattern.compile( - "You add (\\d+|a single) charges? to your book. It now has (\\d+) charges\\."); - private static final Pattern CHRONICLE_LAST_CHARGE_PATTERN = Pattern.compile( - "You have one charge left in your book\\."); - private static final Pattern CHRONICLE_OUT_OF_CHARGES_PATTERN = Pattern.compile( - "Your book has run out of charges\\."); - private static final Pattern RING_OF_FORGING_CHECK_PATTERN = Pattern.compile( - "You can smelt ([0-9+]+|one) more pieces? of iron ore before a ring melts\\."); - private static final String RING_OF_FORGING_USED_TEXT = "You retrieve a bar of iron."; - private static final String RING_OF_FORGING_BREAK_TEXT = "Your Ring of Forging has melted."; - - private static final int MAX_DODGY_CHARGES = 10; - private static final int MAX_SLAUGHTER_CHARGES = 30; - private static final int MAX_EXPEDITIOUS_CHARGES = 30; - private static final int MAX_BINDING_CHARGES = 16; - private static final int MAX_EXPLORER_RING_CHARGES = 30; - private static final int MAX_RING_OF_FORGING_CHARGES = 140; - - @Getter(AccessLevel.PACKAGE) - private boolean ringOfRecoilAvailable = false; - - @Getter(AccessLevel.PACKAGE) - private boolean ringOfRecoilEquipped = false; - - @Getter(AccessLevel.PACKAGE) - private BufferedImage recoilRingImage; - - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private ItemChargeOverlay overlay; - - @Inject - private ItemRecoilOverlay recoilOverlay; - - @Inject - private ItemManager itemManager; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private Notifier notifier; - - @Inject - private ItemChargeConfig config; - - // Limits destroy callback to once per tick - private int lastCheckTick; - - private Color veryLowWarningColor; - private Color lowWarningolor; - private int veryLowWarning; - private int lowWarning; - @Getter(AccessLevel.PACKAGE) - private boolean showTeleportCharges; - @Getter(AccessLevel.PACKAGE) - private boolean showDodgyCount; - private boolean dodgyNotification; - @Getter(AccessLevel.PACKAGE) - private int dodgyNecklace; - @Getter(AccessLevel.PACKAGE) - private boolean showImpCharges; - @Getter(AccessLevel.PACKAGE) - private boolean showFungicideCharges; - @Getter(AccessLevel.PACKAGE) - private boolean showWateringCanCharges; - @Getter(AccessLevel.PACKAGE) - private boolean showWaterskinCharges; - @Getter(AccessLevel.PACKAGE) - private boolean showBellowCharges; - @Getter(AccessLevel.PACKAGE) - private boolean showBasketCharges; - @Getter(AccessLevel.PACKAGE) - private boolean showSackCharges; - @Getter(AccessLevel.PACKAGE) - private boolean showAbyssalBraceletCharges; - private boolean recoilNotification; - @Getter(AccessLevel.PACKAGE) - private boolean showBindingNecklaceCharges; - @Getter(AccessLevel.PACKAGE) - private int bindingNecklace; - private boolean bindingNotification; - @Getter(AccessLevel.PACKAGE) - private boolean showExplorerRingCharges; - @Getter(AccessLevel.PACKAGE) - private int explorerRing; - private boolean showInfoboxes; - @Getter(AccessLevel.PACKAGE) - private boolean showSlayerBracelets; - @Getter(AccessLevel.PACKAGE) - private int expeditious; - @Getter(AccessLevel.PACKAGE) - private int slaughter; - @Getter(AccessLevel.PACKAGE) - private int xericTalisman; - @Getter(AccessLevel.PACKAGE) - private boolean showSoulBearerCharges; - @Getter(AccessLevel.PACKAGE) - private int soulBearer; - @Getter(AccessLevel.PACKAGE) - private boolean showChronicleCharges; - @Getter(AccessLevel.PACKAGE) - private boolean showKharedstsMemoirs; - @Getter(AccessLevel.PACKAGE) - private boolean showXericTalismanCharges; - @Getter(AccessLevel.PACKAGE) - private boolean showrecoil; - @Getter(AccessLevel.PACKAGE) - private int chronicle; - @Getter(AccessLevel.PACKAGE) - private int kharedstsMemoirs; - @Getter(AccessLevel.PACKAGE) - private boolean showRingOfForgingCount; - @Getter(AccessLevel.PACKAGE) - private int ringOfForging; - - @Provides - ItemChargeConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(ItemChargeConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - overlayManager.add(recoilOverlay); - recoilRingImage = itemManager.getImage(RING_OF_RECOIL); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - overlayManager.remove(recoilOverlay); - infoBoxManager.removeIf(ItemChargeInfobox.class::isInstance); - lastCheckTick = -1; - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("itemCharge")) - { - return; - } - - updateConfig(); - - if (!this.showInfoboxes) - { - infoBoxManager.removeIf(ItemChargeInfobox.class::isInstance); - return; - } - - if (!this.showTeleportCharges) - { - removeInfobox(ItemWithSlot.TELEPORT); - } - - if (!this.showAbyssalBraceletCharges) - { - removeInfobox(ItemWithSlot.ABYSSAL_BRACELET); - } - - if (!this.showDodgyCount) - { - removeInfobox(ItemWithSlot.DODGY_NECKLACE); - } - - if (!this.showSlayerBracelets) - { - removeInfobox(ItemWithSlot.BRACELET_OF_SLAUGHTER); - removeInfobox(ItemWithSlot.EXPEDITIOUS_BRACELET); - } - - if (!this.showBindingNecklaceCharges) - { - removeInfobox(ItemWithSlot.BINDING_NECKLACE); - } - - if (!this.showExplorerRingCharges) - { - removeInfobox(ItemWithSlot.EXPLORER_RING); - } - - if (!this.showRingOfForgingCount) - { - removeInfobox(ItemWithSlot.RING_OF_FORGING); - } - } - - @Subscribe - void onChatMessage(ChatMessage event) - { - String message = event.getMessage(); - Matcher dodgyCheckMatcher = DODGY_CHECK_PATTERN.matcher(message); - Matcher dodgyProtectMatcher = DODGY_PROTECT_PATTERN.matcher(message); - Matcher dodgyBreakMatcher = DODGY_BREAK_PATTERN.matcher(message); - Matcher bindingNecklaceCheckMatcher = BINDING_CHECK_PATTERN.matcher(event.getMessage()); - Matcher bindingNecklaceUsedMatcher = BINDING_USED_PATTERN.matcher(event.getMessage()); - Matcher xericRechargeMatcher = XERIC_CHECK_CHARGE_PATTERN.matcher(message); - Matcher xericOutOfChargesMatcher = XERIC_OUT_OF_CHARGES.matcher(message); - Matcher soulbearerCheckMatcher = SOULBEARER_CHECK_CHARGE_PATTERN.matcher(message); - Matcher chronicleCheckMatcher = CHRONICLE_CHECK_CHARGE_PATTERN.matcher(message); - Matcher chronicleRechargeMatcher = CHRONICLE_ADD_CHARGE_PATTERN.matcher(message); - Matcher chronicleLastChargeMatcher = CHRONICLE_LAST_CHARGE_PATTERN.matcher(message); - Matcher chronicleOutOfChargesMatcher = CHRONICLE_OUT_OF_CHARGES_PATTERN.matcher(message); - Matcher ringOfForgingCheckMatcher = RING_OF_FORGING_CHECK_PATTERN.matcher(message); - Matcher slaughterMatcher = CHAT_BRACELET_SLAUGHTER_REGEX.matcher(Text.removeTags(message)); - Matcher expeditiousMatcher = CHAT_BRACELET_EXPEDITIOUS_REGEX.matcher(Text.removeTags(message)); - Matcher slaughterChargeMatcher = CHAT_BRACELET_SLAUGHTER_CHARGE_REGEX.matcher(Text.removeTags(message)); - Matcher expeditiousChargeMatcher = CHAT_BRACELET_EXPEDITIOUS_CHARGE_REGEX.matcher(Text.removeTags(message)); - - if (event.getType() == ChatMessageType.GAMEMESSAGE || event.getType() == ChatMessageType.SPAM) - { - if (this.recoilNotification && message.contains(RING_OF_RECOIL_BREAK_MESSAGE)) - { - notifier.notify("Your Ring of Recoil has shattered"); - } - else if (Text.removeTags(message).startsWith(CHAT_BRACELET_SLAUGHTER)) - { - updateBraceletOfSlaughterCharges(slaughterMatcher.find() ? Integer.parseInt(slaughterMatcher.group(1)) : MAX_SLAUGHTER_CHARGES); - } - else if (Text.removeTags(message).startsWith(CHAT_BRACELET_EXPEDITIOUS)) - { - updateExpeditiousCharges(expeditiousMatcher.find() ? Integer.parseInt(expeditiousMatcher.group(1)) : MAX_EXPEDITIOUS_CHARGES); - } - else if (slaughterChargeMatcher.find()) - { - updateBraceletOfSlaughterCharges(Integer.parseInt(slaughterChargeMatcher.group(1))); - } - else if (expeditiousChargeMatcher.find()) - { - updateExpeditiousCharges(Integer.parseInt(expeditiousChargeMatcher.group(1))); - } - else if (dodgyCheckMatcher.find()) - { - updateDodgyNecklaceCharges(Integer.parseInt(dodgyCheckMatcher.group(1))); - } - else if (dodgyProtectMatcher.find()) - { - updateDodgyNecklaceCharges(Integer.parseInt(dodgyProtectMatcher.group(1))); - } - else if (dodgyBreakMatcher.find()) - { - if (this.dodgyNotification) - { - notifier.notify("Your dodgy necklace has crumbled to dust."); - } - - updateDodgyNecklaceCharges(MAX_DODGY_CHARGES); - } - else if (message.contains(BINDING_BREAK_TEXT)) - { - if (this.bindingNotification) - { - notifier.notify(BINDING_BREAK_TEXT); - } - - // This chat message triggers before the used message so add 1 to the max charges to ensure proper sync - updateBindingNecklaceCharges(MAX_BINDING_CHARGES + 1); - } - else if (bindingNecklaceUsedMatcher.find()) - { - updateBindingNecklaceCharges(this.bindingNecklace - 1); - } - else if (bindingNecklaceCheckMatcher.find()) - { - final String match = bindingNecklaceCheckMatcher.group(1); - - int charges = 1; - if (!match.equals("one")) - { - charges = Integer.parseInt(match); - } - - updateBindingNecklaceCharges(charges); - } - else if (xericRechargeMatcher.find()) - { - final int xericCharges = xericRechargeMatcher.group(1).equals("one") ? 1 : (Integer.parseInt(xericRechargeMatcher.group(1))); - updateXericCharges(xericCharges); - } - else if (xericOutOfChargesMatcher.find()) - { - final int xericCharges = 0; - updateXericCharges(xericCharges); - } - else if (soulbearerCheckMatcher.find()) - { - final int soulbearerCharges = soulbearerCheckMatcher.group(1).equals("one") ? 1 : (Integer.parseInt(soulbearerCheckMatcher.group(1))); - updateSoulBearerCharges(soulbearerCharges); - } - else if (chronicleCheckMatcher.find()) - { - final int chronicleCharges = chronicleCheckMatcher.group(1).equals("one") ? 1 : (Integer.parseInt(chronicleCheckMatcher.group(1))); - updateChronicleCharges(chronicleCharges); - } - else if (chronicleRechargeMatcher.find()) - { - final int chronicleCharges = chronicleRechargeMatcher.group(2).equals("one") ? 1 : (Integer.parseInt(chronicleRechargeMatcher.group(2))); - updateChronicleCharges(chronicleCharges); - } - else if (chronicleLastChargeMatcher.find()) - { - final int chronicleCharges = 1; - updateChronicleCharges(chronicleCharges); - } - else if (chronicleOutOfChargesMatcher.find()) - { - final int chronicleCharges = 0; - updateChronicleCharges(chronicleCharges); - } - else if (ringOfForgingCheckMatcher.find()) - { - final String match = ringOfForgingCheckMatcher.group(1); - - int charges = 1; - if (!match.equals("one")) - { - charges = Integer.parseInt(match); - } - updateRingOfForgingCharges(charges); - } - else if (message.equals(RING_OF_FORGING_USED_TEXT)) - { - final ItemContainer equipment = client.getItemContainer(InventoryID.EQUIPMENT); - - // Determine if the player smelted with a Ring of Forging equipped. - if (equipment == null) - { - return; - } - - Item[] items = equipment.getItems(); - if (EquipmentInventorySlot.RING.getSlotIdx() < items.length - && items[EquipmentInventorySlot.RING.getSlotIdx()].getId() == ItemID.RING_OF_FORGING) - { - int charges = Ints.constrainToRange(this.ringOfForging - 1, 0, MAX_RING_OF_FORGING_CHARGES); - updateRingOfForgingCharges(charges); - } - } - else if (message.equals(RING_OF_FORGING_BREAK_TEXT)) - { - if (config.ringOfForgingNotification()) - { - notifier.notify("Your ring of forging has melted."); - } - - updateRingOfForgingCharges(MAX_RING_OF_FORGING_CHARGES); - } - } - } - - @Subscribe - private void onItemContainerChanged(ItemContainerChanged event) - { - if (event.getItemContainer() != client.getItemContainer(InventoryID.EQUIPMENT) || !this.showInfoboxes) - { - return; - } - - final Item[] items = event.getItemContainer().getItems(); - - if (this.showTeleportCharges) - { - updateJewelleryInfobox(ItemWithSlot.TELEPORT, items); - } - - if (this.showDodgyCount) - { - updateJewelleryInfobox(ItemWithSlot.DODGY_NECKLACE, items); - } - - if (this.showAbyssalBraceletCharges) - { - updateJewelleryInfobox(ItemWithSlot.ABYSSAL_BRACELET, items); - } - - if (this.showSlayerBracelets) - { - updateJewelleryInfobox(ItemWithSlot.BRACELET_OF_SLAUGHTER, items); - updateJewelleryInfobox(ItemWithSlot.EXPEDITIOUS_BRACELET, items); - } - - if (this.showBindingNecklaceCharges) - { - updateJewelleryInfobox(ItemWithSlot.BINDING_NECKLACE, items); - } - - if (this.showExplorerRingCharges) - { - updateJewelleryInfobox(ItemWithSlot.EXPLORER_RING, items); - } - - if (this.showRingOfForgingCount) - { - updateJewelleryInfobox(ItemWithSlot.RING_OF_FORGING, items); - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - Widget braceletBreakWidget = client.getWidget(WidgetInfo.DIALOG_SPRITE_TEXT); - - if (braceletBreakWidget != null) - { - String braceletText = Text.removeTags(braceletBreakWidget.getText()); //remove color and linebreaks - if (braceletText.contains("bracelet of slaughter")) - { - config.slaughter(MAX_SLAUGHTER_CHARGES); - this.slaughter = MAX_SLAUGHTER_CHARGES; - } - else if (braceletText.contains("expeditious bracelet")) - { - config.expeditious(MAX_EXPEDITIOUS_CHARGES); - this.expeditious = MAX_EXPEDITIOUS_CHARGES; - } - } - - ItemContainer equipment = client.getItemContainer(InventoryID.EQUIPMENT); - ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); - ringOfRecoilAvailable = false; - ringOfRecoilEquipped = false; - - if (equipment != null && inventory != null) - { - for (Item item : equipment.getItems()) - { - if (item.getId() == RING_OF_RECOIL) - { - ringOfRecoilEquipped = true; - ringOfRecoilAvailable = true; - break; - } - } - - for (Item item : inventory.getItems()) - { - if (item.getId() == RING_OF_RECOIL) - { - ringOfRecoilAvailable = true; - break; - } - } - } - - Widget dialog1 = client.getWidget(WidgetInfo.DIALOG_SPRITE_TEXT); - Widget dialog2 = client.getWidget(WidgetInfo.DIALOG2_SPRITE_TEXT); - - if (dialog1 != null) - { - String widgetText = Text.removeTags(dialog1.getText()); - Matcher xericRechargeMatcher = XERIC_RECHARGEWIDGET_PATTERN.matcher(widgetText); - Matcher soulbearerRechargeMatcher = SOULBEARER_RECHARGE_PATTERN.matcher(widgetText); - Matcher soulbearerRecharge2Matcher = SOULBEARER_RECHARGE_PATTERN2.matcher(widgetText); - - if (xericRechargeMatcher.find()) - { - final int xericCharges = xericRechargeMatcher.group(1).equals("one") ? 1 : (Integer.parseInt(xericRechargeMatcher.group(1))); - updateXericCharges(xericCharges); - } - else if (soulbearerRechargeMatcher.find()) - { - final int soulbearerCharges = soulbearerRechargeMatcher.group(2).equals("one") ? 1 : (Integer.parseInt(soulbearerRechargeMatcher.group(2))); - updateSoulBearerCharges(soulbearerCharges); - } - else if (soulbearerRecharge2Matcher.find()) - { - final int soulbearerCharges = 1; - updateSoulBearerCharges(soulbearerCharges); - } - } - - if (dialog2 != null) - { - String widgetText = Text.removeTags(dialog2.getText()); - Matcher xericUnchargeMatcher = XERIC_UNCHARGE_PATTERN.matcher(widgetText); - Matcher soulbearerUnchargeMatcher = SOULBEARER_UNCHARGE_PATTERN.matcher(widgetText); - Matcher soulbearerBankHeadsMatcher = SOULBEARER_BANKHEADS_PATTERN.matcher(widgetText); - Matcher soulbearerOutOfCharges = SOULBEARER_OUT_OF_CHARGES.matcher(widgetText); - - if (xericUnchargeMatcher.find()) - { - final int xericCharges = 0; - updateXericCharges(xericCharges); - } - else if (soulbearerUnchargeMatcher.find() || soulbearerOutOfCharges.find()) - { - final int soulbearerCharges = 0; - updateSoulBearerCharges(soulbearerCharges); - } - else if (soulbearerBankHeadsMatcher.find()) - { - final int soulbearerCharges = soulbearerBankHeadsMatcher.group(1).equals("one") ? 1 : (Integer.parseInt(soulbearerBankHeadsMatcher.group(1))); - updateSoulBearerCharges(soulbearerCharges); - } - } - } - - @Subscribe - private void onSpotAnimationChanged(SpotAnimationChanged event) - { - if (event.getActor() == client.getLocalPlayer() && client.getLocalPlayer().getSpotAnimation() == GraphicID.XERIC_TELEPORT) - { - final int xericCharges = Math.max(this.xericTalisman - 1, 0); - updateXericCharges(xericCharges); - } - } - - @Subscribe - private void onScriptCallbackEvent(ScriptCallbackEvent event) - { - if (!"destroyOnOpKey".equals(event.getEventName())) - { - return; - } - - final int yesOption = client.getIntStack()[client.getIntStackSize() - 1]; - if (yesOption == 1) - { - checkDestroyWidget(); - } - } - - @Subscribe - private void onVarbitChanged(VarbitChanged event) - { - int explorerRingCharge = client.getVar(Varbits.EXPLORER_RING_ALCHS); - int lastExplorerRingCharge = -1; - if (lastExplorerRingCharge != explorerRingCharge) - { - lastExplorerRingCharge = explorerRingCharge; - updateExplorerRingCharges(explorerRingCharge); - } - - this.kharedstsMemoirs = client.getVar(Varbits.KHAREDSTS_MEMOIRS_CHARGES); - } - - private void updateDodgyNecklaceCharges(final int value) - { - config.dodgyNecklace(value); - this.dodgyNecklace = value; - - if (this.showInfoboxes && this.showDodgyCount) - { - final ItemContainer itemContainer = client.getItemContainer(InventoryID.EQUIPMENT); - - if (itemContainer == null) - { - return; - } - - updateJewelleryInfobox(ItemWithSlot.DODGY_NECKLACE, itemContainer.getItems()); - } - } - - private void updateBraceletOfSlaughterCharges(final int value) - { - config.slaughter(value); - this.slaughter = value; - - if (this.showInfoboxes && this.showSlayerBracelets) - { - final ItemContainer itemContainer = client.getItemContainer(InventoryID.EQUIPMENT); - - if (itemContainer == null) - { - return; - } - - updateJewelleryInfobox(ItemWithSlot.BRACELET_OF_SLAUGHTER, itemContainer.getItems()); - } - } - - private void updateExpeditiousCharges(final int value) - { - config.expeditious(value); - this.expeditious = value; - - if (this.showInfoboxes && this.showSlayerBracelets) - { - final ItemContainer itemContainer = client.getItemContainer(InventoryID.EQUIPMENT); - - if (itemContainer == null) - { - return; - } - - updateJewelleryInfobox(ItemWithSlot.EXPEDITIOUS_BRACELET, itemContainer.getItems()); - } - } - - private void updateBindingNecklaceCharges(final int value) - { - config.bindingNecklace(value); - this.bindingNecklace = value; - - if (this.showInfoboxes && this.showBindingNecklaceCharges) - { - final ItemContainer itemContainer = client.getItemContainer(InventoryID.EQUIPMENT); - - if (itemContainer == null) - { - return; - } - - updateJewelleryInfobox(ItemWithSlot.BINDING_NECKLACE, itemContainer.getItems()); - } - } - - private void updateXericCharges(int xericCharges) - { - config.xericTalisman(xericCharges); - this.xericTalisman = xericCharges; - } - - private void updateSoulBearerCharges(int soulBearerCharges) - { - config.soulBearer(soulBearerCharges); - this.soulBearer = soulBearerCharges; - } - - private void updateChronicleCharges(int chronicleCharges) - { - config.chronicle(chronicleCharges); - this.chronicle = chronicleCharges; - } - - private void updateExplorerRingCharges(final int value) - { - // Note: Varbit counts upwards. We count down from the maximum charges. - config.explorerRing(MAX_EXPLORER_RING_CHARGES - value); - this.explorerRing = MAX_EXPLORER_RING_CHARGES - value; - - if (this.showInfoboxes && this.showExplorerRingCharges) - { - final ItemContainer itemContainer = client.getItemContainer(InventoryID.EQUIPMENT); - - if (itemContainer == null) - { - return; - } - - updateJewelleryInfobox(ItemWithSlot.EXPLORER_RING, itemContainer.getItems()); - } - } - - private void checkDestroyWidget() - { - final int currentTick = client.getTickCount(); - if (lastCheckTick == currentTick) - { - return; - } - lastCheckTick = currentTick; - - final Widget widgetDestroyItemName = client.getWidget(WidgetInfo.DESTROY_ITEM_NAME); - if (widgetDestroyItemName == null) - { - return; - } - - switch (widgetDestroyItemName.getText()) - { - case "Binding necklace": - updateBindingNecklaceCharges(MAX_BINDING_CHARGES); - break; - case "Dodgy necklace": - updateDodgyNecklaceCharges(MAX_DODGY_CHARGES); - break; - } - } - - private void updateJewelleryInfobox(ItemWithSlot item, Item[] items) - { - for (final EquipmentInventorySlot equipmentInventorySlot : item.getSlots()) - { - updateJewelleryInfobox(item, items, equipmentInventorySlot); - } - } - - private void updateJewelleryInfobox(ItemWithSlot type, Item[] items, EquipmentInventorySlot slot) - { - removeInfobox(type, slot); - - if (slot.getSlotIdx() >= items.length) - { - return; - } - - final int id = items[slot.getSlotIdx()].getId(); - if (id < 0) - { - return; - } - - final ItemWithCharge itemWithCharge = ItemWithCharge.findItem(id); - int charges = -1; - - if (itemWithCharge == null) - { - if (id == ItemID.DODGY_NECKLACE && type == ItemWithSlot.DODGY_NECKLACE) - { - charges = this.dodgyNecklace; - } - else if (id == ItemID.BRACELET_OF_SLAUGHTER && type == ItemWithSlot.BRACELET_OF_SLAUGHTER) - { - charges = this.slaughter; - } - else if (id == ItemID.EXPEDITIOUS_BRACELET && type == ItemWithSlot.EXPEDITIOUS_BRACELET) - { - charges = this.expeditious; - } - else if (id == ItemID.BINDING_NECKLACE && type == ItemWithSlot.BINDING_NECKLACE) - { - charges = this.bindingNecklace; - } - else if ((id >= ItemID.EXPLORERS_RING_1 && id <= ItemID.EXPLORERS_RING_4) && type == ItemWithSlot.EXPLORER_RING) - { - charges = this.explorerRing; - } - } - else if (itemWithCharge.getType() == type.getType()) - { - charges = itemWithCharge.getCharges(); - } - - if (charges <= 0) - { - return; - } - - final String name = itemManager.getItemDefinition(id).getName(); - final BufferedImage image = itemManager.getImage(id); - final ItemChargeInfobox infobox = new ItemChargeInfobox(this, image, name, charges, type, slot); - infoBoxManager.addInfoBox(infobox); - } - - private void updateRingOfForgingCharges(final int value) - { - config.ringOfForging(value); - this.ringOfForging = value; - - if (this.showInfoboxes && this.showRingOfForgingCount) - { - final ItemContainer itemContainer = client.getItemContainer(InventoryID.EQUIPMENT); - - if (itemContainer == null) - { - return; - } - - updateJewelleryInfobox(ItemWithSlot.RING_OF_FORGING, itemContainer.getItems()); - } - } - - private void removeInfobox(final ItemWithSlot item) - { - infoBoxManager.removeIf(t -> t instanceof ItemChargeInfobox && ((ItemChargeInfobox) t).getItem() == item); - } - - private void removeInfobox(final ItemWithSlot item, final EquipmentInventorySlot slot) - { - infoBoxManager.removeIf(t -> - { - if (!(t instanceof ItemChargeInfobox)) - { - return false; - } - - final ItemChargeInfobox i = (ItemChargeInfobox) t; - return i.getItem() == item && i.getSlot() == slot; - }); - } - - Color getColor(int charges) - { - Color color = Color.WHITE; - if (charges <= this.veryLowWarning) - { - color = this.veryLowWarningColor; - } - else if (charges <= this.lowWarning) - { - color = this.lowWarningolor; - } - return color; - } - - private void updateConfig() - { - this.veryLowWarningColor = config.veryLowWarningColor(); - this.lowWarningolor = config.lowWarningolor(); - this.veryLowWarning = config.veryLowWarning(); - this.lowWarning = config.lowWarning(); - this.showTeleportCharges = config.showTeleportCharges(); - this.showDodgyCount = config.showDodgyCount(); - this.dodgyNotification = config.dodgyNotification(); - this.dodgyNecklace = config.dodgyNecklace(); - this.showImpCharges = config.showImpCharges(); - this.showFungicideCharges = config.showFungicideCharges(); - this.showWateringCanCharges = config.showWateringCanCharges(); - this.showWaterskinCharges = config.showWaterskinCharges(); - this.showBellowCharges = config.showBellowCharges(); - this.showAbyssalBraceletCharges = config.showAbyssalBraceletCharges(); - this.recoilNotification = config.recoilNotification(); - this.showBindingNecklaceCharges = config.showBindingNecklaceCharges(); - this.bindingNecklace = config.bindingNecklace(); - this.bindingNotification = config.bindingNotification(); - this.showExplorerRingCharges = config.showExplorerRingCharges(); - this.explorerRing = config.explorerRing(); - this.showInfoboxes = config.showInfoboxes(); - this.showSlayerBracelets = config.showSlayerBracelets(); - this.expeditious = config.expeditious(); - this.slaughter = config.slaughter(); - this.xericTalisman = config.xericTalisman(); - this.showSoulBearerCharges = config.showSoulBearerCharges(); - this.soulBearer = config.soulBearer(); - this.showChronicleCharges = config.showChronicleCharges(); - this.showKharedstsMemoirs = config.showKharedstsMemoirsCharges(); - this.showXericTalismanCharges = config.showXericTalismanCharges(); - this.showrecoil = config.showrecoil(); - this.chronicle = config.chronicle(); - this.showBasketCharges = config.showBasketCharges(); - this.showSackCharges = config.showSackCharges(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeType.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeType.java deleted file mode 100644 index 2cc177130e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeType.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2017, Mitchell - * 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.itemcharges; - -enum ItemChargeType -{ - ABYSSAL_BRACELET, - BELLOWS, - FUNGICIDE_SPRAY, - IMPBOX, - TELEPORT, - WATERCAN, - WATERSKIN, - DODGY_NECKLACE, - BRACELET_OF_SLAUGHTER, - EXPEDITIOUS_BRACELET, - BINDING_NECKLACE, - EXPLORER_RING, - FRUIT_BASKET, - SACK, - RING_OF_FORGING, - GUTHIX_REST, -} 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 deleted file mode 100644 index eebd7786e0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemRecoilOverlay.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2018, https://github.com/openosrsplus - * 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.itemcharges; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -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; - -@Singleton -class ItemRecoilOverlay extends Overlay -{ - private static final Color NOT_ACTIVATED_BACKGROUND_COLOR = new Color(150, 0, 0, 150); - private static final Color ACTIVATED_BACKGROUND_COLOR = new Color(0, 150, 0, 150); - private final ItemChargePlugin plugin; - private final PanelComponent imagePanelComponent = new PanelComponent(); - - @Inject - public ItemRecoilOverlay(final ItemChargePlugin plugin) - { - setPosition(OverlayPosition.TOP_LEFT); - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - this.imagePanelComponent.getChildren().clear(); - if (plugin.isShowrecoil() && plugin.isRingOfRecoilAvailable()) - { - BufferedImage recoilImage = plugin.getRecoilRingImage(); - 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); - } - - return null; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithCharge.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithCharge.java deleted file mode 100644 index c539543a23..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithCharge.java +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.itemcharges; - -import com.google.common.collect.ImmutableMap; -import java.util.Map; -import javax.annotation.Nullable; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import static net.runelite.api.ItemID.*; -import static net.runelite.client.plugins.itemcharges.ItemChargeType.*; - -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -enum ItemWithCharge -{ - ABRACE1(ABYSSAL_BRACELET, ABYSSAL_BRACELET1, 1), - ABRACE2(ABYSSAL_BRACELET, ABYSSAL_BRACELET2, 2), - ABRACE3(ABYSSAL_BRACELET, ABYSSAL_BRACELET3, 3), - ABRACE4(ABYSSAL_BRACELET, ABYSSAL_BRACELET4, 4), - ABRACE5(ABYSSAL_BRACELET, ABYSSAL_BRACELET5, 5), - BASKET_APPLES1(FRUIT_BASKET, APPLES1, 1), - BASKET_APPLES2(FRUIT_BASKET, APPLES2, 2), - BASKET_APPLES3(FRUIT_BASKET, APPLES3, 3), - BASKET_APPLES4(FRUIT_BASKET, APPLES4, 4), - BASKET_APPLES5(FRUIT_BASKET, APPLES5, 5), - BASKET_BANANAS1(FRUIT_BASKET, BANANAS1, 1), - BASKET_BANANAS2(FRUIT_BASKET, BANANAS2, 2), - BASKET_BANANAS3(FRUIT_BASKET, BANANAS3, 3), - BASKET_BANANAS4(FRUIT_BASKET, BANANAS4, 4), - BASKET_BANANAS5(FRUIT_BASKET, BANANAS5, 5), - BASKET_ORANGES1(FRUIT_BASKET, ORANGES1, 1), - BASKET_ORANGES2(FRUIT_BASKET, ORANGES2, 2), - BASKET_ORANGES3(FRUIT_BASKET, ORANGES3, 3), - BASKET_ORANGES4(FRUIT_BASKET, ORANGES4, 4), - BASKET_ORANGES5(FRUIT_BASKET, ORANGES5, 5), - BASKET_STRAWBERRIES1(FRUIT_BASKET, STRAWBERRIES1, 1), - BASKET_STRAWBERRIES2(FRUIT_BASKET, STRAWBERRIES2, 2), - BASKET_STRAWBERRIES3(FRUIT_BASKET, STRAWBERRIES3, 3), - BASKET_STRAWBERRIES4(FRUIT_BASKET, STRAWBERRIES4, 4), - BASKET_STRAWBERRIES5(FRUIT_BASKET, STRAWBERRIES5, 5), - BASKET_TOMATOES1(FRUIT_BASKET, TOMATOES1, 1), - BASKET_TOMATOES2(FRUIT_BASKET, TOMATOES2, 2), - BASKET_TOMATOES3(FRUIT_BASKET, TOMATOES3, 3), - BASKET_TOMATOES4(FRUIT_BASKET, TOMATOES4, 4), - BASKET_TOMATOES5(FRUIT_BASKET, TOMATOES5, 5), - BELLOWS0(BELLOWS, OGRE_BELLOWS, 0), - BELLOWS1(BELLOWS, OGRE_BELLOWS_1, 1), - BELLOWS2(BELLOWS, OGRE_BELLOWS_2, 2), - BELLOWS3(BELLOWS, OGRE_BELLOWS_3, 3), - BURNING1(TELEPORT, BURNING_AMULET1, 1), - BURNING2(TELEPORT, BURNING_AMULET2, 2), - BURNING3(TELEPORT, BURNING_AMULET3, 3), - BURNING4(TELEPORT, BURNING_AMULET4, 4), - BURNING5(TELEPORT, BURNING_AMULET5, 5), - CBRACE1(TELEPORT, COMBAT_BRACELET1, 1), - CBRACE2(TELEPORT, COMBAT_BRACELET2, 2), - CBRACE3(TELEPORT, COMBAT_BRACELET3, 3), - CBRACE4(TELEPORT, COMBAT_BRACELET4, 4), - CBRACE5(TELEPORT, COMBAT_BRACELET5, 5), - CBRACE6(TELEPORT, COMBAT_BRACELET6, 6), - DIGSITE1(TELEPORT, DIGSITE_PENDANT_1, 1), - DIGSITE2(TELEPORT, DIGSITE_PENDANT_2, 2), - DIGSITE3(TELEPORT, DIGSITE_PENDANT_3, 3), - DIGSITE4(TELEPORT, DIGSITE_PENDANT_4, 4), - DIGSITE5(TELEPORT, DIGSITE_PENDANT_5, 5), - ELYRE1(TELEPORT, ENCHANTED_LYRE1, 1), - ELYRE2(TELEPORT, ENCHANTED_LYRE2, 2), - ELYRE3(TELEPORT, ENCHANTED_LYRE3, 3), - ELYRE4(TELEPORT, ENCHANTED_LYRE4, 4), - ELYRE5(TELEPORT, ENCHANTED_LYRE5, 5), - FUNGICIDE0(FUNGICIDE_SPRAY, FUNGICIDE_SPRAY_0, 0), - FUNGICIDE1(FUNGICIDE_SPRAY, FUNGICIDE_SPRAY_1, 1), - FUNGICIDE2(FUNGICIDE_SPRAY, FUNGICIDE_SPRAY_2, 2), - FUNGICIDE3(FUNGICIDE_SPRAY, FUNGICIDE_SPRAY_3, 3), - FUNGICIDE4(FUNGICIDE_SPRAY, FUNGICIDE_SPRAY_4, 4), - FUNGICIDE5(FUNGICIDE_SPRAY, FUNGICIDE_SPRAY_5, 5), - FUNGICIDE6(FUNGICIDE_SPRAY, FUNGICIDE_SPRAY_6, 6), - FUNGICIDE7(FUNGICIDE_SPRAY, FUNGICIDE_SPRAY_7, 7), - FUNGICIDE8(FUNGICIDE_SPRAY, FUNGICIDE_SPRAY_8, 8), - FUNGICIDE9(FUNGICIDE_SPRAY, FUNGICIDE_SPRAY_9, 9), - FUNGICIDE10(FUNGICIDE_SPRAY, FUNGICIDE_SPRAY_10, 10), - GAMES1(TELEPORT, GAMES_NECKLACE1, 1), - GAMES2(TELEPORT, GAMES_NECKLACE2, 2), - GAMES3(TELEPORT, GAMES_NECKLACE3, 3), - GAMES4(TELEPORT, GAMES_NECKLACE4, 4), - GAMES5(TELEPORT, GAMES_NECKLACE5, 5), - GAMES6(TELEPORT, GAMES_NECKLACE6, 6), - GAMES7(TELEPORT, GAMES_NECKLACE7, 7), - GAMES8(TELEPORT, GAMES_NECKLACE8, 8), - GLORY1(TELEPORT, AMULET_OF_GLORY1, 1), - GLORY2(TELEPORT, AMULET_OF_GLORY2, 2), - GLORY3(TELEPORT, AMULET_OF_GLORY3, 3), - GLORY4(TELEPORT, AMULET_OF_GLORY4, 4), - GLORY5(TELEPORT, AMULET_OF_GLORY5, 5), - GLORY6(TELEPORT, AMULET_OF_GLORY6, 6), - GLORYT1(TELEPORT, AMULET_OF_GLORY_T1, 1), - GLORYT2(TELEPORT, AMULET_OF_GLORY_T2, 2), - GLORYT3(TELEPORT, AMULET_OF_GLORY_T3, 3), - GLORYT4(TELEPORT, AMULET_OF_GLORY_T4, 4), - GLORYT5(TELEPORT, AMULET_OF_GLORY_T5, 5), - GLORYT6(TELEPORT, AMULET_OF_GLORY_T6, 6), - IMP_IN_A_BOX1(IMPBOX, IMPINABOX1, 1), - IMP_IN_A_BOX2(IMPBOX, IMPINABOX2, 2), - PASSAGE1(TELEPORT, NECKLACE_OF_PASSAGE1, 1), - PASSAGE2(TELEPORT, NECKLACE_OF_PASSAGE2, 2), - PASSAGE3(TELEPORT, NECKLACE_OF_PASSAGE3, 3), - PASSAGE4(TELEPORT, NECKLACE_OF_PASSAGE4, 4), - PASSAGE5(TELEPORT, NECKLACE_OF_PASSAGE5, 5), - PHARAO1(TELEPORT, PHARAOHS_SCEPTRE_1, 1), - PHARAO2(TELEPORT, PHARAOHS_SCEPTRE_2, 2), - PHARAO3(TELEPORT, PHARAOHS_SCEPTRE_3, 3), - PHARAO4(TELEPORT, PHARAOHS_SCEPTRE_4, 4), - PHARAO5(TELEPORT, PHARAOHS_SCEPTRE_5, 5), - PHARAO6(TELEPORT, PHARAOHS_SCEPTRE_6, 6), - PHARAO7(TELEPORT, PHARAOHS_SCEPTRE_7, 7), - PHARAO8(TELEPORT, PHARAOHS_SCEPTRE_8, 8), - RETURNING1(TELEPORT, RING_OF_RETURNING1, 1), - RETURNING2(TELEPORT, RING_OF_RETURNING2, 2), - RETURNING3(TELEPORT, RING_OF_RETURNING3, 3), - RETURNING4(TELEPORT, RING_OF_RETURNING4, 4), - RETURNING5(TELEPORT, RING_OF_RETURNING5, 5), - ROD1(TELEPORT, RING_OF_DUELING1, 1), - ROD2(TELEPORT, RING_OF_DUELING2, 2), - ROD3(TELEPORT, RING_OF_DUELING3, 3), - ROD4(TELEPORT, RING_OF_DUELING4, 4), - ROD5(TELEPORT, RING_OF_DUELING5, 5), - ROD6(TELEPORT, RING_OF_DUELING6, 6), - ROD7(TELEPORT, RING_OF_DUELING7, 7), - ROD8(TELEPORT, RING_OF_DUELING8, 8), - ROS1(TELEPORT, SLAYER_RING_1, 1), - ROS2(TELEPORT, SLAYER_RING_2, 2), - ROS3(TELEPORT, SLAYER_RING_3, 3), - ROS4(TELEPORT, SLAYER_RING_4, 4), - ROS5(TELEPORT, SLAYER_RING_5, 5), - ROS6(TELEPORT, SLAYER_RING_6, 6), - ROS7(TELEPORT, SLAYER_RING_7, 7), - ROS8(TELEPORT, SLAYER_RING_8, 8), - ROW1(TELEPORT, RING_OF_WEALTH_1, 1), - ROW2(TELEPORT, RING_OF_WEALTH_2, 2), - ROW3(TELEPORT, RING_OF_WEALTH_3, 3), - ROW4(TELEPORT, RING_OF_WEALTH_4, 4), - ROW5(TELEPORT, RING_OF_WEALTH_5, 5), - SKILLS1(TELEPORT, SKILLS_NECKLACE1, 1), - SKILLS2(TELEPORT, SKILLS_NECKLACE2, 2), - SKILLS3(TELEPORT, SKILLS_NECKLACE3, 3), - SKILLS4(TELEPORT, SKILLS_NECKLACE4, 4), - SKILLS5(TELEPORT, SKILLS_NECKLACE5, 5), - SKILLS6(TELEPORT, SKILLS_NECKLACE6, 6), - TCRYSTAL1(TELEPORT, TELEPORT_CRYSTAL_1, 1), - TCRYSTAL2(TELEPORT, TELEPORT_CRYSTAL_2, 2), - TCRYSTAL3(TELEPORT, TELEPORT_CRYSTAL_3, 3), - TCRYSTAL4(TELEPORT, TELEPORT_CRYSTAL_4, 4), - TCRYSTAL5(TELEPORT, TELEPORT_CRYSTAL_5, 5), - WCAN0(WATERCAN, WATERING_CAN, 0), - WCAN1(WATERCAN, WATERING_CAN1, 1), - WCAN2(WATERCAN, WATERING_CAN2, 2), - WCAN3(WATERCAN, WATERING_CAN3, 3), - WCAN4(WATERCAN, WATERING_CAN4, 4), - WCAN5(WATERCAN, WATERING_CAN5, 5), - WCAN6(WATERCAN, WATERING_CAN6, 6), - WCAN7(WATERCAN, WATERING_CAN7, 7), - WCAN8(WATERCAN, WATERING_CAN8, 8), - WSKIN0(WATERSKIN, WATERSKIN0, 0), - WSKIN1(WATERSKIN, WATERSKIN1, 1), - WSKIN2(WATERSKIN, WATERSKIN2, 2), - WSKIN3(WATERSKIN, WATERSKIN3, 3), - WSKIN4(WATERSKIN, WATERSKIN4, 4), - EMPTYSACK(SACK, EMPTY_SACK, 0), - POTAT1(SACK, POTATOES1, 1), - POTAT2(SACK, POTATOES2, 2), - POTAT3(SACK, POTATOES3, 3), - POTAT4(SACK, POTATOES4, 4), - POTAT5(SACK, POTATOES5, 5), - POTAT6(SACK, POTATOES6, 6), - POTAT7(SACK, POTATOES7, 7), - POTAT8(SACK, POTATOES8, 8), - POTAT9(SACK, POTATOES9, 9), - POTAT10(SACK, POTATOES10, 10), - CABAG1(SACK, CABBAGES1, 1), - CABAG2(SACK, CABBAGES2, 2), - CABAG3(SACK, CABBAGES3, 3), - CABAG4(SACK, CABBAGES4, 4), - CABAG5(SACK, CABBAGES5, 5), - CABAG6(SACK, CABBAGES6, 6), - CABAG7(SACK, CABBAGES7, 7), - CABAG8(SACK, CABBAGES8, 8), - CABAG9(SACK, CABBAGES9, 9), - CABAG10(SACK, CABBAGES10, 10), - ONIO1(SACK, ONIONS1, 1), - ONIO2(SACK, ONIONS2, 2), - ONIO3(SACK, ONIONS3, 3), - ONIO4(SACK, ONIONS4, 4), - ONIO5(SACK, ONIONS5, 5), - ONIO6(SACK, ONIONS6, 6), - ONIO7(SACK, ONIONS7, 7), - ONIO8(SACK, ONIONS8, 8), - ONIO9(SACK, ONIONS9, 9), - ONIO10(SACK, ONIONS10, 10), - GREST1(GUTHIX_REST, GUTHIX_REST1, 1), - GREST2(GUTHIX_REST, GUTHIX_REST2, 2), - GREST3(GUTHIX_REST, GUTHIX_REST3, 3), - GREST4(GUTHIX_REST, GUTHIX_REST4, 4); - - private final ItemChargeType type; - private final int id; - private final int charges; - - private static final Map ID_MAP; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (ItemWithCharge itemCharge : values()) - { - builder.put(itemCharge.getId(), itemCharge); - } - - ID_MAP = builder.build(); - } - - @Nullable - static ItemWithCharge findItem(int itemId) - { - return ID_MAP.get(itemId); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithSlot.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithSlot.java deleted file mode 100644 index 5e0616c9f9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithSlot.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2019, Tomas Slusny - * Copyright (c) 2019, Aleios - * 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.itemcharges; - -import com.google.common.collect.Sets; -import java.util.Set; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.EquipmentInventorySlot; - -@Getter(AccessLevel.PACKAGE) -enum ItemWithSlot -{ - ABYSSAL_BRACELET(ItemChargeType.ABYSSAL_BRACELET, EquipmentInventorySlot.GLOVES), - BRACELET_OF_SLAUGHTER(ItemChargeType.BRACELET_OF_SLAUGHTER, EquipmentInventorySlot.GLOVES), - EXPEDITIOUS_BRACELET(ItemChargeType.EXPEDITIOUS_BRACELET, EquipmentInventorySlot.GLOVES), - DODGY_NECKLACE(ItemChargeType.DODGY_NECKLACE, EquipmentInventorySlot.AMULET), - BINDING_NECKLACE(ItemChargeType.BINDING_NECKLACE, EquipmentInventorySlot.AMULET), - EXPLORER_RING(ItemChargeType.EXPLORER_RING, EquipmentInventorySlot.RING), - RING_OF_FORGING(ItemChargeType.RING_OF_FORGING, EquipmentInventorySlot.RING), - TELEPORT(ItemChargeType.TELEPORT, EquipmentInventorySlot.WEAPON, EquipmentInventorySlot.AMULET, EquipmentInventorySlot.GLOVES, EquipmentInventorySlot.RING); - - private final ItemChargeType type; - private final Set slots; - - ItemWithSlot(final ItemChargeType type, final EquipmentInventorySlot... slots) - { - this.type = type; - this.slots = Sets.newHashSet(slots); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentification.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentification.java deleted file mode 100644 index 83341fe60d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentification.java +++ /dev/null @@ -1,239 +0,0 @@ -/* - * 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.itemidentification; - -import com.google.common.collect.ImmutableMap; -import java.util.Map; -import net.runelite.api.ItemID; - -enum ItemIdentification -{ - //Seeds - GUAM_SEED(Type.SEED, "Guam", "G", ItemID.GUAM_SEED), - MARRENTILL_SEED(Type.SEED, "Marren", "M", ItemID.MARRENTILL_SEED), - TARROMIN_SEED(Type.SEED, "Tarro", "TAR", ItemID.TARROMIN_SEED), - HARRALANDER_SEED(Type.SEED, "Harra", "H", ItemID.HARRALANDER_SEED), - RANARR_SEED(Type.SEED, "Ranarr", "R", ItemID.RANARR_SEED), - TOADFLAX_SEED(Type.SEED, "Toad", "TOA", ItemID.TOADFLAX_SEED), - IRIT_SEED(Type.SEED, "Irit", "I", ItemID.IRIT_SEED), - AVANTOE_SEED(Type.SEED, "Avan", "A", ItemID.AVANTOE_SEED), - KWUARM_SEED(Type.SEED, "Kwuarm", "K", ItemID.KWUARM_SEED), - SNAPDRAGON_SEED(Type.SEED, "Snap", "S", ItemID.SNAPDRAGON_SEED), - CADANTINE_SEED(Type.SEED, "Cadan", "C", ItemID.CADANTINE_SEED), - LANTADYME_SEED(Type.SEED, "Lanta", "L", ItemID.LANTADYME_SEED), - DWARF_WEED_SEED(Type.SEED, "Dwarf", "D", ItemID.DWARF_WEED_SEED), - TORSTOL_SEED(Type.SEED, "Torstol", "TOR", ItemID.TORSTOL_SEED), - POISON_IVY_SEED(Type.SEED, "Ivy", "I", ItemID.POISON_IVY_SEED), - WHITEBERRY_SEED(Type.SEED, "White", "W", ItemID.WHITEBERRY_SEED), - - //Herbs - GUAM(Type.HERB, "Guam", "G", ItemID.GUAM_LEAF, ItemID.GRIMY_GUAM_LEAF), - MARRENTILL(Type.HERB, "Marren", "M", ItemID.MARRENTILL, ItemID.GRIMY_MARRENTILL), - TARROMIN(Type.HERB, "Tarro", "TAR", ItemID.TARROMIN, ItemID.GRIMY_TARROMIN), - HARRALANDER(Type.HERB, "Harra", "H", ItemID.HARRALANDER, ItemID.GRIMY_HARRALANDER), - RANARR(Type.HERB, "Ranarr", "R", ItemID.RANARR_WEED, ItemID.GRIMY_RANARR_WEED), - TOADFLAX(Type.HERB, "Toad", "TOA", ItemID.TOADFLAX, ItemID.GRIMY_TOADFLAX), - IRIT(Type.HERB, "Irit", "I", ItemID.IRIT_LEAF, ItemID.GRIMY_IRIT_LEAF), - AVANTOE(Type.HERB, "Avan", "A", ItemID.AVANTOE, ItemID.GRIMY_AVANTOE), - KWUARM(Type.HERB, "Kwuarm", "K", ItemID.KWUARM, ItemID.GRIMY_KWUARM), - SNAPDRAGON(Type.HERB, "Snap", "S", ItemID.SNAPDRAGON, ItemID.GRIMY_SNAPDRAGON), - CADANTINE(Type.HERB, "Cadan", "C", ItemID.CADANTINE, ItemID.GRIMY_CADANTINE), - LANTADYME(Type.HERB, "Lanta", "L", ItemID.LANTADYME, ItemID.GRIMY_LANTADYME), - DWARF_WEED(Type.HERB, "Dwarf", "D", ItemID.DWARF_WEED, ItemID.GRIMY_DWARF_WEED), - TORSTOL(Type.HERB, "Torstol", "TOR", ItemID.TORSTOL, ItemID.GRIMY_TORSTOL), - - //Saplings - OAK_SAPLING(Type.SAPLING, "Oak", "OAK", ItemID.OAK_SAPLING, ItemID.OAK_SEEDLING, ItemID.OAK_SEEDLING_W), - WILLOW_SAPLING(Type.SAPLING, "Willow", "WIL", ItemID.WILLOW_SAPLING, ItemID.WILLOW_SEEDLING, ItemID.WILLOW_SEEDLING_W), - MAPLE_SAPLING(Type.SAPLING, "Maple", "MAP", ItemID.MAPLE_SAPLING, ItemID.MAPLE_SEEDLING, ItemID.MAPLE_SEEDLING_W), - YEW_SAPLING(Type.SAPLING, "Yew", "YEW", ItemID.YEW_SAPLING, ItemID.YEW_SEEDLING, ItemID.YEW_SEEDLING_W), - MAGIC_SAPLING(Type.SAPLING, "Magic", "MAG", ItemID.MAGIC_SAPLING, ItemID.MAGIC_SEEDLING, ItemID.MAGIC_SEEDLING_W), - REDWOOD_SAPLING(Type.SAPLING, "Red", "RED", ItemID.REDWOOD_SAPLING, ItemID.REDWOOD_SEEDLING, ItemID.REDWOOD_SEEDLING_W), - SPIRIT_SAPLING(Type.SAPLING, "Spirit", "SPI", ItemID.SPIRIT_SAPLING, ItemID.SPIRIT_SEEDLING, ItemID.SPIRIT_SEEDLING_W), - CRYSTAL_SAPLING(Type.SAPLING, "Crystal", "CRY", ItemID.CRYSTAL_SAPLING, ItemID.CRYSTAL_SEEDLING, ItemID.CRYSTAL_SEEDLING_W), - - APPLE_SAPLING(Type.SAPLING, "Apple", "APP", ItemID.APPLE_SAPLING, ItemID.APPLE_SEEDLING, ItemID.APPLE_SEEDLING_W), - BANANA_SAPLING(Type.SAPLING, "Banana", "BAN", ItemID.BANANA_SAPLING, ItemID.BANANA_SEEDLING, ItemID.BANANA_SEEDLING_W), - ORANGE_SAPLING(Type.SAPLING, "Orange", "ORA", ItemID.ORANGE_SAPLING, ItemID.ORANGE_SEEDLING, ItemID.ORANGE_SEEDLING_W), - CURRY_SAPLING(Type.SAPLING, "Curry", "CUR", ItemID.CURRY_SAPLING, ItemID.CURRY_SEEDLING, ItemID.CURRY_SEEDLING_W), - PINEAPPLE_SAPLING(Type.SAPLING, "Pine", "PINE", ItemID.PINEAPPLE_SAPLING, ItemID.PINEAPPLE_SEEDLING, ItemID.PINEAPPLE_SEEDLING_W), - PAPAYA_SAPLING(Type.SAPLING, "Papaya", "PAP", ItemID.PAPAYA_SAPLING, ItemID.PAPAYA_SEEDLING, ItemID.PAPAYA_SEEDLING_W), - PALM_SAPLING(Type.SAPLING, "Palm", "PALM", ItemID.PALM_SAPLING, ItemID.PALM_SEEDLING, ItemID.PALM_SEEDLING_W), - DRAGONFRUIT_SAPLING(Type.SAPLING, "Dragon", "DRAG", ItemID.DRAGONFRUIT_SAPLING, ItemID.DRAGONFRUIT_SEEDLING, ItemID.DRAGONFRUIT_SEEDLING_W), - - TEAK_SAPLING(Type.SAPLING, "Teak", "TEAK", ItemID.TEAK_SAPLING, ItemID.TEAK_SEEDLING, ItemID.TEAK_SEEDLING_W), - MAHOGANY_SAPLING(Type.SAPLING, "Mahog", "MAHOG", ItemID.MAHOGANY_SAPLING, ItemID.MAHOGANY_SEEDLING, ItemID.MAHOGANY_SEEDLING_W), - CALQUAT_SAPLING(Type.SAPLING, "Calquat", "CALQ", ItemID.CALQUAT_SAPLING, ItemID.CALQUAT_SEEDLING, ItemID.CALQUAT_SEEDLING_W), - CELASTRUS_SAPLING(Type.SAPLING, "Celas", "CEL", ItemID.CELASTRUS_SAPLING, ItemID.CELASTRUS_SEEDLING, ItemID.CELASTRUS_SEEDLING_W), - - //Ores - COPPER_ORE(Type.ORE, "Copper", "COP", ItemID.COPPER_ORE), - TIN_ORE(Type.ORE, "Tin", "TIN", ItemID.TIN_ORE), - IRON_ORE(Type.ORE, "Iron", "IRO", ItemID.IRON_ORE), - SILVER_ORE(Type.ORE, "Silver", "SIL", ItemID.SILVER_ORE), - COAL_ORE(Type.ORE, "Coal", "COA", ItemID.COAL), - GOLD_ORE(Type.ORE, "Gold", "GOL", ItemID.GOLD_ORE), - MITHRIL_ORE(Type.ORE, "Mithril", "MIT", ItemID.MITHRIL_ORE), - ADAMANTITE_ORE(Type.ORE, "Adaman", "ADA", ItemID.ADAMANTITE_ORE), - RUNITE_ORE(Type.ORE, "Runite", "RUN", ItemID.RUNITE_ORE), - - RUNE_ESSENCE(Type.ORE, "R.Ess", "R.E.", ItemID.RUNE_ESSENCE), - PURE_ESSENCE(Type.ORE, "P.Ess", "P.E.", ItemID.PURE_ESSENCE), - - PAYDIRT(Type.ORE, "Paydirt", "PAY", ItemID.PAYDIRT), - AMETHYST(Type.ORE, "Amethy", "AME", ItemID.AMETHYST), - LOVAKITE_ORE(Type.ORE, "Lovakit", "LOV", ItemID.LOVAKITE_ORE), - BLURITE_ORE(Type.ORE, "Blurite", "BLU", ItemID.BLURITE_ORE), - ELEMENTAL_ORE(Type.ORE, "Element", "ELE", ItemID.ELEMENTAL_ORE), - DAEYALT_ORE(Type.ORE, "Daeyalt", "DAE", ItemID.DAEYALT_ORE), - LUNAR_ORE(Type.ORE, "Lunar", "LUN", ItemID.LUNAR_ORE), - - //Gems - SAPPHIRE(Type.GEM, "Sapphir", "S", ItemID.UNCUT_SAPPHIRE, ItemID.SAPPHIRE), - EMERALD(Type.GEM, "Emerald", "E", ItemID.UNCUT_EMERALD, ItemID.EMERALD), - RUBY(Type.GEM, "Ruby", "R", ItemID.UNCUT_RUBY, ItemID.RUBY), - DIAMOND(Type.GEM, "Diamon", "DI", ItemID.UNCUT_DIAMOND, ItemID.DIAMOND), - OPAL(Type.GEM, "Opal", "OP", ItemID.UNCUT_OPAL, ItemID.OPAL), - JADE(Type.GEM, "Jade", "J", ItemID.UNCUT_JADE, ItemID.JADE), - RED_TOPAZ(Type.GEM, "Topaz", "T", ItemID.UNCUT_RED_TOPAZ, ItemID.RED_TOPAZ), - DRAGONSTONE(Type.GEM, "Dragon", "DR", ItemID.UNCUT_DRAGONSTONE, ItemID.DRAGONSTONE), - ONYX(Type.GEM, "Onyx", "ON", ItemID.UNCUT_ONYX, ItemID.ONYX), - ZENYTE(Type.GEM, "Zenyte", "Z", ItemID.UNCUT_ZENYTE, ItemID.ZENYTE), - - // Potions - ATTACK(Type.POTION, "Att", "A", ItemID.ATTACK_POTION4, ItemID.ATTACK_POTION3, ItemID.ATTACK_POTION2, ItemID.ATTACK_POTION1), - STRENGTH(Type.POTION, "Str", "S", ItemID.STRENGTH_POTION4, ItemID.STRENGTH_POTION3, ItemID.STRENGTH_POTION2, ItemID.STRENGTH_POTION1), - DEFENCE(Type.POTION, "Def", "D", ItemID.DEFENCE_POTION4, ItemID.DEFENCE_POTION3, ItemID.DEFENCE_POTION2, ItemID.DEFENCE_POTION1), - COMBAT(Type.POTION, "Com", "D", ItemID.COMBAT_POTION4, ItemID.COMBAT_POTION3, ItemID.COMBAT_POTION2, ItemID.COMBAT_POTION1), - MAGIC(Type.POTION, "Magic", "M", ItemID.MAGIC_POTION4, ItemID.MAGIC_POTION3, ItemID.MAGIC_POTION2, ItemID.MAGIC_POTION1), - RANGING(Type.POTION, "Range", "R", ItemID.RANGING_POTION4, ItemID.RANGING_POTION3, ItemID.RANGING_POTION2, ItemID.RANGING_POTION1), - BASTION(Type.POTION, "Bastion", "B", ItemID.BASTION_POTION4, ItemID.BASTION_POTION3, ItemID.BASTION_POTION2, ItemID.BASTION_POTION1), - BATTLEMAGE(Type.POTION, "BatMage", "B.M", ItemID.BATTLEMAGE_POTION4, ItemID.BATTLEMAGE_POTION3, ItemID.BATTLEMAGE_POTION2, ItemID.BATTLEMAGE_POTION1), - - SUPER_ATTACK(Type.POTION, "S.Att", "S.A", ItemID.SUPER_ATTACK4, ItemID.SUPER_ATTACK3, ItemID.SUPER_ATTACK2, ItemID.SUPER_ATTACK1), - SUPER_STRENGTH(Type.POTION, "S.Str", "S.S", ItemID.SUPER_STRENGTH4, ItemID.SUPER_STRENGTH3, ItemID.SUPER_STRENGTH2, ItemID.SUPER_STRENGTH1), - SUPER_DEFENCE(Type.POTION, "S.Def", "S.D", ItemID.SUPER_DEFENCE4, ItemID.SUPER_DEFENCE3, ItemID.SUPER_DEFENCE2, ItemID.SUPER_DEFENCE1), - SUPER_COMBAT(Type.POTION, "S.Com", "S.C", ItemID.SUPER_COMBAT_POTION4, ItemID.SUPER_COMBAT_POTION3, ItemID.SUPER_COMBAT_POTION2, ItemID.SUPER_COMBAT_POTION1), - SUPER_RANGING(Type.POTION, "S.Range", "S.Ra", ItemID.SUPER_RANGING_4, ItemID.SUPER_RANGING_3, ItemID.SUPER_RANGING_2, ItemID.SUPER_RANGING_1), - SUPER_MAGIC(Type.POTION, "S.Magic", "S.M", ItemID.SUPER_MAGIC_POTION_4, ItemID.SUPER_MAGIC_POTION_3, ItemID.SUPER_MAGIC_POTION_2, ItemID.SUPER_MAGIC_POTION_1), - - DIVINE_SUPER_ATTACK(Type.POTION, "S.Att", "S.A", ItemID.DIVINE_SUPER_ATTACK_POTION4, ItemID.DIVINE_SUPER_ATTACK_POTION3, ItemID.DIVINE_SUPER_ATTACK_POTION2, ItemID.DIVINE_SUPER_ATTACK_POTION1), - DIVINE_SUPER_DEFENCE(Type.POTION, "S.Def", "S.D", ItemID.DIVINE_SUPER_DEFENCE_POTION4, ItemID.DIVINE_SUPER_DEFENCE_POTION3, ItemID.DIVINE_SUPER_DEFENCE_POTION2, ItemID.DIVINE_SUPER_DEFENCE_POTION1), - DIVINE_SUPER_STRENGTH(Type.POTION, "S.Str", "S.S", ItemID.DIVINE_SUPER_STRENGTH_POTION4, ItemID.DIVINE_SUPER_STRENGTH_POTION3, ItemID.DIVINE_SUPER_STRENGTH_POTION2, ItemID.DIVINE_SUPER_STRENGTH_POTION1), - DIVINE_SUPER_COMBAT(Type.POTION, "S.Com", "S.C", ItemID.DIVINE_SUPER_COMBAT_POTION4, ItemID.DIVINE_SUPER_COMBAT_POTION3, ItemID.DIVINE_SUPER_COMBAT_POTION2, ItemID.DIVINE_SUPER_COMBAT_POTION1), - DIVINE_RANGING(Type.POTION, "Range", "R", ItemID.DIVINE_RANGING_POTION4, ItemID.DIVINE_RANGING_POTION3, ItemID.DIVINE_RANGING_POTION2, ItemID.DIVINE_RANGING_POTION1), - DIVINE_MAGIC(Type.POTION, "Magic", "M", ItemID.DIVINE_MAGIC_POTION4, ItemID.DIVINE_MAGIC_POTION3, ItemID.DIVINE_MAGIC_POTION2, ItemID.DIVINE_MAGIC_POTION1), - - RESTORE(Type.POTION, "Restore", "Re", ItemID.RESTORE_POTION4, ItemID.RESTORE_POTION3, ItemID.RESTORE_POTION2, ItemID.RESTORE_POTION1), - SUPER_RESTORE(Type.POTION, "S.Rest", "S.Re", ItemID.SUPER_RESTORE4, ItemID.SUPER_RESTORE3, ItemID.SUPER_RESTORE2, ItemID.SUPER_RESTORE1), - PRAYER(Type.POTION, "Prayer", "P", ItemID.PRAYER_POTION4, ItemID.PRAYER_POTION3, ItemID.PRAYER_POTION2, ItemID.PRAYER_POTION1), - ENERGY(Type.POTION, "Energy", "En", ItemID.ENERGY_POTION4, ItemID.ENERGY_POTION3, ItemID.ENERGY_POTION2, ItemID.ENERGY_POTION1), - SUPER_ENERGY(Type.POTION, "S.Energ", "S.En", ItemID.SUPER_ENERGY4, ItemID.SUPER_ENERGY3, ItemID.SUPER_ENERGY2, ItemID.SUPER_ENERGY1), - STAMINA(Type.POTION, "Stamina", "St", ItemID.STAMINA_POTION4, ItemID.STAMINA_POTION3, ItemID.STAMINA_POTION2, ItemID.STAMINA_POTION1), - OVERLOAD(Type.POTION, "Overloa", "OL", ItemID.OVERLOAD_4, ItemID.OVERLOAD_3, ItemID.OVERLOAD_2, ItemID.OVERLOAD_1), - ABSORPTION(Type.POTION, "Absorb", "Ab", ItemID.ABSORPTION_4, ItemID.ABSORPTION_3, ItemID.ABSORPTION_2, ItemID.ABSORPTION_1), - - ZAMORAK_BREW(Type.POTION, "ZammyBr", "Za", ItemID.ZAMORAK_BREW4, ItemID.ZAMORAK_BREW3, ItemID.ZAMORAK_BREW2, ItemID.ZAMORAK_BREW1), - SARADOMIN_BREW(Type.POTION, "SaraBr", "Sa", ItemID.SARADOMIN_BREW4, ItemID.SARADOMIN_BREW3, ItemID.SARADOMIN_BREW2, ItemID.SARADOMIN_BREW1), - - ANTIPOISON(Type.POTION, "AntiP", "AP", ItemID.ANTIPOISON4, ItemID.ANTIPOISON3, ItemID.ANTIPOISON2, ItemID.ANTIPOISON1), - SUPERANTIPOISON(Type.POTION, "S.AntiP", "S.AP", ItemID.SUPERANTIPOISON4, ItemID.SUPERANTIPOISON3, ItemID.SUPERANTIPOISON2, ItemID.SUPERANTIPOISON1), - ANTIDOTE_P(Type.POTION, "Antid+", "A+", ItemID.ANTIDOTE4, ItemID.ANTIDOTE3, ItemID.ANTIDOTE2, ItemID.ANTIDOTE1), - ANTIDOTE_PP(Type.POTION, "Antid++", "A++", ItemID.ANTIDOTE4_5952, ItemID.ANTIDOTE3_5954, ItemID.ANTIDOTE2_5956, ItemID.ANTIDOTE1_5958), - ANTIVENOM(Type.POTION, "Anti-V", "AV", ItemID.ANTIVENOM4, ItemID.ANTIVENOM3, ItemID.ANTIVENOM2, ItemID.ANTIVENOM1), - ANTIVENOM_P(Type.POTION, "Anti-V+", "AV+", ItemID.ANTIVENOM4_12913, ItemID.ANTIVENOM3_12915, ItemID.ANTIVENOM2_12917, ItemID.ANTIVENOM1_12919), - - RELICYMS_BALM(Type.POTION, "Relicym", "R.B", ItemID.RELICYMS_BALM4, ItemID.RELICYMS_BALM3, ItemID.RELICYMS_BALM2, ItemID.RELICYMS_BALM1), - SANFEW_SERUM(Type.POTION, "Sanfew", "Sf", ItemID.SANFEW_SERUM4, ItemID.SANFEW_SERUM3, ItemID.SANFEW_SERUM2, ItemID.SANFEW_SERUM1), - ANTIFIRE(Type.POTION, "Antif", "Af", ItemID.ANTIFIRE_POTION4, ItemID.ANTIFIRE_POTION3, ItemID.ANTIFIRE_POTION2, ItemID.ANTIFIRE_POTION1), - EXTENDED_ANTIFIRE(Type.POTION, "E.Antif", "E.Af", ItemID.EXTENDED_ANTIFIRE4, ItemID.EXTENDED_ANTIFIRE3, ItemID.EXTENDED_ANTIFIRE2, ItemID.EXTENDED_ANTIFIRE1), - SUPER_ANTIFIRE(Type.POTION, "S.Antif", "S.Af", ItemID.SUPER_ANTIFIRE_POTION4, ItemID.SUPER_ANTIFIRE_POTION3, ItemID.SUPER_ANTIFIRE_POTION2, ItemID.SUPER_ANTIFIRE_POTION1), - EXTENDED_SUPER_ANTIFIRE(Type.POTION, "ES.Antif", "ES.Af", ItemID.EXTENDED_SUPER_ANTIFIRE4, ItemID.EXTENDED_SUPER_ANTIFIRE3, ItemID.EXTENDED_SUPER_ANTIFIRE2, ItemID.EXTENDED_SUPER_ANTIFIRE1), - - SERUM_207(Type.POTION, "Ser207", "S7", ItemID.SERUM_207_4, ItemID.SERUM_207_3, ItemID.SERUM_207_2, ItemID.SERUM_207_1), - SERUM_208(Type.POTION, "Ser208", "S8", ItemID.SERUM_208_4, ItemID.SERUM_208_3, ItemID.SERUM_208_2, ItemID.SERUM_208_1), - COMPOST(Type.POTION, "Compost", "Cp", ItemID.COMPOST_POTION4, ItemID.COMPOST_POTION3, ItemID.COMPOST_POTION2, ItemID.COMPOST_POTION1), - - // Unfinished Potions - GUAM_POTION(Type.POTION, "Guam", "G", ItemID.GUAM_POTION_UNF), - MARRENTILL_POTION(Type.POTION, "Marren", "M", ItemID.MARRENTILL_POTION_UNF), - TARROMIN_POTION(Type.POTION, "Tarro", "TAR", ItemID.TARROMIN_POTION_UNF), - HARRALANDER_POTION(Type.POTION, "Harra", "H", ItemID.HARRALANDER_POTION_UNF), - RANARR_POTION(Type.POTION, "Ranarr", "R", ItemID.RANARR_POTION_UNF), - TOADFLAX_POTION(Type.POTION, "Toad", "TOA", ItemID.TOADFLAX_POTION_UNF), - IRIT_POTION(Type.POTION, "Irit", "I", ItemID.IRIT_POTION_UNF), - AVANTOE_POTION(Type.POTION, "Avan", "A", ItemID.AVANTOE_POTION_UNF), - KWUARM_POTION(Type.POTION, "Kwuarm", "K", ItemID.KWUARM_POTION_UNF), - SNAPDRAGON_POTION(Type.POTION, "Snap", "S", ItemID.SNAPDRAGON_POTION_UNF), - CADANTINE_POTION(Type.POTION, "Cadan", "C", ItemID.CADANTINE_POTION_UNF), - LANTADYME_POTION(Type.POTION, "Lanta", "L", ItemID.LANTADYME_POTION_UNF), - DWARF_WEED_POTION(Type.POTION, "Dwarf", "D", ItemID.DWARF_WEED_POTION_UNF), - TORSTOL_POTION(Type.POTION, "Torstol", "TOR", ItemID.TORSTOL_POTION_UNF); - - final Type type; - final String medName; - final String shortName; - private final int[] itemIDs; - - ItemIdentification(Type type, String medName, String shortName, int... ids) - { - this.type = type; - this.medName = medName; - this.shortName = shortName; - this.itemIDs = ids; - } - - private static final Map itemIdentifications; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (ItemIdentification i : values()) - { - for (int id : i.itemIDs) - { - builder.put(id, i); - } - } - - itemIdentifications = builder.build(); - } - - static ItemIdentification get(int id) - { - return itemIdentifications.get(id); - } - - enum Type - { - SEED, - HERB, - SAPLING, - ORE, - GEM, - POTION - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentificationConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentificationConfig.java deleted file mode 100644 index ca05bfdcba..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentificationConfig.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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.itemidentification; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("itemidentification") -public interface ItemIdentificationConfig extends Config -{ - @ConfigItem( - keyName = "identificationType", - name = "Identification Type", - position = -4, - description = "How much to show of the item name" - ) - default ItemIdentificationMode identificationType() - { - return ItemIdentificationMode.SHORT; - } - - @ConfigItem( - keyName = "textColor", - name = "Color", - position = -3, - description = "The colour of the identification text" - ) - default Color textColor() - { - return Color.WHITE; - } - - @ConfigItem( - keyName = "showSeeds", - name = "Seeds", - description = "Show identification on Seeds" - ) - default boolean showSeeds() - { - return true; - } - - @ConfigItem( - keyName = "showHerbs", - name = "Herbs", - description = "Show identification on Herbs" - ) - default boolean showHerbs() - { - return false; - } - - @ConfigItem( - keyName = "showSaplings", - name = "Saplings", - description = "Show identification on Saplings and Seedlings" - ) - default boolean showSaplings() - { - return true; - } - - @ConfigItem( - keyName = "showOres", - name = "Ores", - description = "Show identification on Ores" - ) - default boolean showOres() - { - return false; - } - - @ConfigItem( - keyName = "showGems", - name = "Gems", - description = "Show identification on Gems" - ) - default boolean showGems() - { - return false; - } - - @ConfigItem( - keyName = "showPotions", - name = "Potions", - description = "Show identification on Potions" - ) - default boolean showPotions() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentificationMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentificationMode.java deleted file mode 100644 index 3a692822b9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentificationMode.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.itemidentification; - -public enum ItemIdentificationMode -{ - SHORT, - MEDIUM -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentificationOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentificationOverlay.java deleted file mode 100644 index b7f53aad43..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentificationOverlay.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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.itemidentification; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.Rectangle; -import static net.runelite.api.widgets.WidgetID.GUIDE_PRICE_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.KEPT_ON_DEATH_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.KINGDOM_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.LOOTING_BAG_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.SEED_BOX_GROUP_ID; -import net.runelite.api.widgets.WidgetItem; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.overlay.WidgetItemOverlay; -import net.runelite.client.ui.overlay.components.TextComponent; - -@Singleton -class ItemIdentificationOverlay extends WidgetItemOverlay -{ - private final ItemIdentificationPlugin plugin; - private final ItemManager itemManager; - - @Inject - ItemIdentificationOverlay(ItemIdentificationPlugin plugin, ItemManager itemManager) - { - this.plugin = plugin; - this.itemManager = itemManager; - - showOnInventory(); - showOnBank(); - showOnInterfaces(KEPT_ON_DEATH_GROUP_ID, GUIDE_PRICE_GROUP_ID, LOOTING_BAG_GROUP_ID, SEED_BOX_GROUP_ID, KINGDOM_GROUP_ID); - } - - @Override - public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget) - { - ItemIdentification iden = findItemIdentification(itemId); - if (iden == null) - { - return; - } - - switch (iden.type) - { - case SEED: - if (!plugin.isShowSeeds()) - { - return; - } - break; - case HERB: - if (!plugin.isShowHerbs()) - { - return; - } - break; - case SAPLING: - if (!plugin.isShowSaplings()) - { - return; - } - break; - case ORE: - if (!plugin.isShowOres()) - { - return; - } - break; - case GEM: - if (!plugin.isShowGems()) - { - return; - } - break; - case POTION: - if (!plugin.isShowPotions()) - { - return; - } - break; - } - - graphics.setFont(FontManager.getRunescapeSmallFont()); - renderText(graphics, itemWidget.getCanvasBounds(), iden); - } - - private void renderText(Graphics2D graphics, Rectangle bounds, ItemIdentification iden) - { - final TextComponent textComponent = new TextComponent(); - textComponent.setPosition(new Point(bounds.x - 1, bounds.y + bounds.height - 1)); - textComponent.setColor(plugin.getTextColor()); - switch (plugin.getIdentificationType()) - { - case SHORT: - textComponent.setText(iden.shortName); - break; - case MEDIUM: - textComponent.setText(iden.medName); - break; - } - textComponent.render(graphics); - } - - private ItemIdentification findItemIdentification(final int itemID) - { - final int realItemId = itemManager.canonicalize(itemID); - return ItemIdentification.get(realItemId); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentificationPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentificationPlugin.java deleted file mode 100644 index 4d5da8776b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemidentification/ItemIdentificationPlugin.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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.itemidentification; - -import com.google.inject.Provides; -import java.awt.Color; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "Item Identification", - description = "Show identifying text over items with difficult to distinguish sprites", - enabledByDefault = false, - type = PluginType.UTILITY -) -@Singleton -public class ItemIdentificationPlugin extends Plugin -{ - @Inject - private OverlayManager overlayManager; - - @Inject - private ItemIdentificationOverlay overlay; - - @Inject - private ItemIdentificationConfig config; - - @Getter(AccessLevel.PACKAGE) - private ItemIdentificationMode identificationType; - @Getter(AccessLevel.PACKAGE) - private Color textColor; - @Getter(AccessLevel.PACKAGE) - private boolean showSeeds; - @Getter(AccessLevel.PACKAGE) - private boolean showHerbs; - @Getter(AccessLevel.PACKAGE) - private boolean showSaplings; - @Getter(AccessLevel.PACKAGE) - private boolean showOres; - @Getter(AccessLevel.PACKAGE) - private boolean showGems; - @Getter(AccessLevel.PACKAGE) - private boolean showPotions; - - @Provides - ItemIdentificationConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(ItemIdentificationConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("itemidentification")) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.identificationType = config.identificationType(); - this.textColor = config.textColor(); - this.showSeeds = config.showSeeds(); - this.showHerbs = config.showHerbs(); - this.showSaplings = config.showSaplings(); - this.showOres = config.showOres(); - this.showGems = config.showGems(); - this.showPotions = config.showPotions(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesConfig.java deleted file mode 100644 index 2880d1b8f0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesConfig.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2018 Charlie Waters - * 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.itemprices; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("itemprices") -public interface ItemPricesConfig extends Config -{ - @ConfigItem( - keyName = "showGEPrice", - name = "Show Grand Exchange Prices", - description = "Grand exchange prices should be shown on tooltips", - position = 1 - ) - default boolean showGEPrice() - { - return true; - } - - @ConfigItem( - keyName = "showHAValue", - name = "Show High Alchemy Values", - description = "High Alchemy values should be shown on tooltips", - position = 2 - ) - default boolean showHAValue() - { - return true; - } - - @ConfigItem( - keyName = "showEA", - name = "Show Price Each on Stacks", - description = "The price/value of each item should be shown on stacks", - position = 3 - ) - default boolean showEA() - { - return true; - } - - @ConfigItem( - keyName = "hideInventory", - name = "Hide Tooltips on Inventory Items", - description = "Tooltips should be hidden on items in the inventory", - position = 4 - ) - default boolean hideInventory() - { - return true; - } - - @ConfigItem( - keyName = "showAlchProfit", - name = "Show High Alchemy Profit", - description = "Show the profit from casting high alchemy on items", - position = 5 - ) - default boolean showAlchProfit() - { - return false; - } - - @ConfigItem( - keyName = "showWhileAlching", - name = "Show prices while alching", - description = "Show the price overlay while using High Alchemy", - position = 6 - ) - default boolean showWhileAlching() - { - return true; - } -} 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 deleted file mode 100644 index 324cc7d21f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java +++ /dev/null @@ -1,298 +0,0 @@ -/* - * Copyright (c) 2018, Charlie Waters - * 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.itemprices; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -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; -import net.runelite.api.ItemDefinition; -import net.runelite.api.ItemID; -import net.runelite.api.MenuEntry; -import net.runelite.api.MenuOpcode; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.tooltip.Tooltip; -import net.runelite.client.ui.overlay.tooltip.TooltipManager; -import net.runelite.client.util.ColorUtil; -import net.runelite.client.util.QuantityFormatter; - -@Singleton -class ItemPricesOverlay extends Overlay -{ - 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(); - private static final int EXPLORERS_RING_ITEM_WIDGETID = WidgetInfo.EXPLORERS_RING_ALCH_INVENTORY.getPackedId(); - - private final Client client; - private final ItemPricesPlugin plugin; - private final TooltipManager tooltipManager; - private final StringBuilder itemStringBuilder = new StringBuilder(); - - @Inject - ItemManager itemManager; - - @Inject - ItemPricesOverlay(final Client client, final ItemPricesPlugin plugin, final TooltipManager tooltipManager) - { - setPosition(OverlayPosition.DYNAMIC); - this.client = client; - this.plugin = plugin; - this.tooltipManager = tooltipManager; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (client.isMenuOpen()) - { - return null; - } - - final MenuEntry[] menuEntries = client.getMenuEntries(); - final int last = menuEntries.length - 1; - - if (last < 0) - { - return null; - } - - final MenuEntry menuEntry = menuEntries[last]; - final MenuOpcode action = MenuOpcode.of(menuEntry.getOpcode()); - final int widgetId = menuEntry.getParam1(); - final int groupId = WidgetInfo.TO_GROUP(widgetId); - - // Tooltip action type handling - switch (action) - { - case ITEM_USE_ON_WIDGET: - if (!plugin.isShowWhileAlching() || !menuEntry.getOption().equals("Cast") || !menuEntry.getTarget().contains("High Level Alchemy")) - { - break; - } - case CC_OP: - case ITEM_USE: - case ITEM_FIRST_OPTION: - case ITEM_SECOND_OPTION: - case ITEM_THIRD_OPTION: - case ITEM_FOURTH_OPTION: - case ITEM_FIFTH_OPTION: - // Item tooltip values - switch (groupId) - { - case WidgetID.EXPLORERS_RING_ALCH_GROUP_ID: - if (!plugin.isShowWhileAlching()) - { - return null; - } - case WidgetID.INVENTORY_GROUP_ID: - if (plugin.isHideInventory()) - { - return null; - } - // intentional fallthrough - case WidgetID.BANK_GROUP_ID: - case WidgetID.BANK_INVENTORY_GROUP_ID: - // Make tooltip - final String text = makeValueTooltip(menuEntry); - if (text != null) - { - tooltipManager.add(new Tooltip(ColorUtil.prependColorTag(text, new Color(238, 238, 238)))); - } - break; - } - break; - } - return null; - } - - private String makeValueTooltip(MenuEntry menuEntry) - { - // Disabling both disables all value tooltips - if (!plugin.isShowGEPrice() && !plugin.isShowHAValue()) - { - return null; - } - - final int widgetId = menuEntry.getParam1(); - ItemContainer container = null; - - // Inventory item - if (widgetId == INVENTORY_ITEM_WIDGETID || widgetId == BANK_INVENTORY_ITEM_WIDGETID || widgetId == EXPLORERS_RING_ITEM_WIDGETID) - { - container = client.getItemContainer(InventoryID.INVENTORY); - } - // Bank item - else if (widgetId == BANK_ITEM_WIDGETID) - { - container = client.getItemContainer(InventoryID.BANK); - } - - if (container == null) - { - return null; - } - - // Find the item in the container to get stack size - final Item[] items = container.getItems(); - final int index = menuEntry.getParam0(); - if (index < items.length) - { - final Item item = items[index]; - return getItemStackValueText(item); - } - - return null; - } - - private String getItemStackValueText(Item item) - { - int id = item.getId(); - int qty = item.getQuantity(); - - // Special case for coins and platinum tokens - if (id == ItemID.COINS_995) - { - return QuantityFormatter.formatNumber(qty) + " gp"; - } - else if (id == ItemID.PLATINUM_TOKEN) - { - return QuantityFormatter.formatNumber(qty * 1000) + " gp"; - } - - ItemDefinition itemDef = itemManager.getItemDefinition(id); - if (itemDef.getNote() != -1) - { - id = itemDef.getLinkedNoteId(); - itemDef = itemManager.getItemDefinition(id); - } - - // Only check prices for things with store prices - if (itemDef.getPrice() <= 0) - { - return null; - } - - int gePrice = 0; - int haPrice = 0; - int haProfit = 0; - final int itemHaPrice = Math.round(itemDef.getPrice() * Constants.HIGH_ALCHEMY_MULTIPLIER); - - if (plugin.isShowGEPrice()) - { - gePrice = itemManager.getItemPrice(id); - } - if (plugin.isShowHAValue()) - { - haPrice = itemManager.getAlchValue(id); - } - if (gePrice > 0 && itemHaPrice > 0 && plugin.isShowAlchProfit()) - { - haProfit = calculateHAProfit(itemHaPrice, gePrice); - } - - if (gePrice > 0 || haPrice > 0) - { - return stackValueText(qty, gePrice, haPrice, haProfit); - } - - return null; - } - - private String stackValueText(int qty, int gePrice, int haValue, int haProfit) - { - if (gePrice > 0) - { - itemStringBuilder.append("EX: ") - .append(QuantityFormatter.quantityToStackSize((long) gePrice * qty)) - .append(" gp"); - if (plugin.isShowEA() && qty > 1) - { - itemStringBuilder.append(" (") - .append(QuantityFormatter.quantityToStackSize(gePrice)) - .append(" ea)"); - } - } - if (haValue > 0) - { - if (gePrice > 0) - { - itemStringBuilder.append("
"); - } - - itemStringBuilder.append("HA: ") - .append(QuantityFormatter.quantityToStackSize((long) haValue * qty)) - .append(" gp"); - if (plugin.isShowEA() && qty > 1) - { - itemStringBuilder.append(" (") - .append(QuantityFormatter.quantityToStackSize(haValue)) - .append(" ea)"); - } - } - - if (haProfit != 0) - { - Color haColor = haProfitColor(haProfit); - - itemStringBuilder.append("
"); - itemStringBuilder.append("HA Profit: ") - .append(ColorUtil.wrapWithColorTag(String.valueOf((long) haProfit * qty), haColor)) - .append(" gp"); - if (plugin.isShowEA() && qty > 1) - { - itemStringBuilder.append(" (") - .append(ColorUtil.wrapWithColorTag(String.valueOf(haProfit), haColor)) - .append(" ea)"); - } - } - - // Build string and reset builder - final String text = itemStringBuilder.toString(); - itemStringBuilder.setLength(0); - return text; - } - - private int calculateHAProfit(int haPrice, int gePrice) - { - int natureRunePrice = itemManager.getItemPrice(ItemID.NATURE_RUNE); - return haPrice - gePrice - natureRunePrice; - } - - private static Color haProfitColor(int haProfit) - { - return haProfit >= 0 ? Color.GREEN : Color.RED; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesPlugin.java deleted file mode 100644 index 066eeea0fb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesPlugin.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2018 Charlie Waters - * 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.itemprices; - -import com.google.inject.Provides; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "Item Prices", - description = "Show prices on hover for items in your inventory and bank", - tags = {"bank", "inventory", "overlay", "high", "alchemy", "grand", "exchange", "tooltips"}, - enabledByDefault = false, - type = PluginType.UTILITY -) -@Singleton -public class ItemPricesPlugin extends Plugin -{ - @Inject - private OverlayManager overlayManager; - - @Inject - private ItemPricesOverlay overlay; - - @Inject - private ItemPricesConfig config; - - @Getter(AccessLevel.PACKAGE) - private boolean showGEPrice; - @Getter(AccessLevel.PACKAGE) - private boolean showHAValue; - @Getter(AccessLevel.PACKAGE) - private boolean showEA; - @Getter(AccessLevel.PACKAGE) - private boolean hideInventory; - @Getter(AccessLevel.PACKAGE) - private boolean showAlchProfit; - @Getter(AccessLevel.PACKAGE) - private boolean showWhileAlching; - - @Provides - ItemPricesConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(ItemPricesConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("itemprices")) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.showGEPrice = config.showGEPrice(); - this.showHAValue = config.showHAValue(); - this.showEA = config.showEA(); - this.hideInventory = config.hideInventory(); - this.showAlchProfit = config.showAlchProfit(); - this.showWhileAlching = config.showWhileAlching(); - } -} 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 deleted file mode 100644 index 48d2df85f4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/AlwaysLostItem.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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.AccessLevel; -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(AccessLevel.PACKAGE) -enum AlwaysLostItem -{ - RUNE_POUCH(ItemID.RUNE_POUCH, true), - LOOTING_BAG(ItemID.LOOTING_BAG, false), - CLUE_BOX(ItemID.CLUE_BOX, false), - BRACELET_OF_ETHEREUM(ItemID.BRACELET_OF_ETHEREUM, false), - BRACELET_OF_ETHEREUM_UNCHARGED(ItemID.BRACELET_OF_ETHEREUM_UNCHARGED, 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/DynamicPriceItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/DynamicPriceItem.java deleted file mode 100644 index 3e5a47564f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/DynamicPriceItem.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.ItemID; - -/** - * Degradable/Non-rechargeable Jewelry death prices are usually determined by the amount of charges the item has left. - * The price of each charge is based on the GE price of the fully charged item divided by the maximum item charges - * Charge price = GE Price / Max Charges - * Death Price = Charge price * Current Charges - */ -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -enum DynamicPriceItem -{ - GAMES_NECKLACE1(ItemID.GAMES_NECKLACE1, 1, 8, ItemID.GAMES_NECKLACE8), - GAMES_NECKLACE2(ItemID.GAMES_NECKLACE2, 2, 8, ItemID.GAMES_NECKLACE8), - GAMES_NECKLACE3(ItemID.GAMES_NECKLACE3, 3, 8, ItemID.GAMES_NECKLACE8), - GAMES_NECKLACE4(ItemID.GAMES_NECKLACE4, 4, 8, ItemID.GAMES_NECKLACE8), - GAMES_NECKLACE5(ItemID.GAMES_NECKLACE5, 5, 8, ItemID.GAMES_NECKLACE8), - GAMES_NECKLACE6(ItemID.GAMES_NECKLACE6, 6, 8, ItemID.GAMES_NECKLACE8), - GAMES_NECKLACE7(ItemID.GAMES_NECKLACE7, 7, 8, ItemID.GAMES_NECKLACE8), - - RING_OF_DUELING1(ItemID.RING_OF_DUELING1, 1, 8, ItemID.RING_OF_DUELING8), - RING_OF_DUELING2(ItemID.RING_OF_DUELING2, 2, 8, ItemID.RING_OF_DUELING8), - RING_OF_DUELING3(ItemID.RING_OF_DUELING3, 3, 8, ItemID.RING_OF_DUELING8), - RING_OF_DUELING4(ItemID.RING_OF_DUELING4, 4, 8, ItemID.RING_OF_DUELING8), - RING_OF_DUELING5(ItemID.RING_OF_DUELING5, 5, 8, ItemID.RING_OF_DUELING8), - RING_OF_DUELING6(ItemID.RING_OF_DUELING6, 6, 8, ItemID.RING_OF_DUELING8), - RING_OF_DUELING7(ItemID.RING_OF_DUELING7, 7, 8, ItemID.RING_OF_DUELING8), - - RING_OF_RETURNING1(ItemID.RING_OF_RETURNING1, 1, 5, ItemID.RING_OF_RETURNING5), - RING_OF_RETURNING2(ItemID.RING_OF_RETURNING2, 2, 5, ItemID.RING_OF_RETURNING5), - RING_OF_RETURNING3(ItemID.RING_OF_RETURNING3, 3, 5, ItemID.RING_OF_RETURNING5), - RING_OF_RETURNING4(ItemID.RING_OF_RETURNING4, 4, 5, ItemID.RING_OF_RETURNING5), - - NECKLACE_OF_PASSAGE1(ItemID.NECKLACE_OF_PASSAGE1, 1, 5, ItemID.NECKLACE_OF_PASSAGE5), - NECKLACE_OF_PASSAGE2(ItemID.NECKLACE_OF_PASSAGE2, 2, 5, ItemID.NECKLACE_OF_PASSAGE5), - NECKLACE_OF_PASSAGE3(ItemID.NECKLACE_OF_PASSAGE3, 3, 5, ItemID.NECKLACE_OF_PASSAGE5), - NECKLACE_OF_PASSAGE4(ItemID.NECKLACE_OF_PASSAGE4, 4, 5, ItemID.NECKLACE_OF_PASSAGE5), - - BURNING_AMULET1(ItemID.BURNING_AMULET1, 1, 5, ItemID.BURNING_AMULET5), - BURNING_AMULET2(ItemID.BURNING_AMULET2, 2, 5, ItemID.BURNING_AMULET5), - BURNING_AMULET3(ItemID.BURNING_AMULET3, 3, 5, ItemID.BURNING_AMULET5), - BURNING_AMULET4(ItemID.BURNING_AMULET4, 4, 5, ItemID.BURNING_AMULET5); - - private final int itemId; - private final int currentCharges; - private final int maxCharges; - private final int chargedId; - - private static final Map DYNAMIC_ITEMS; - - static - { - final ImmutableMap.Builder map = ImmutableMap.builder(); - for (final DynamicPriceItem p : values()) - { - map.put(p.itemId, p); - } - DYNAMIC_ITEMS = map.build(); - } - - /** - * Calculates the price off the partially charged jewelry based on the base items price - * - * @param basePrice price of the base item, usually the trade-able variant - * @return death price of the current DynamicPriceItem - */ - int calculateDeathPrice(final int basePrice) - { - return (basePrice / maxCharges) * currentCharges; - } - - @Nullable - static DynamicPriceItem find(int itemId) - { - return DYNAMIC_ITEMS.get(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 deleted file mode 100644 index 34e1ee25b5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/FixedPriceItem.java +++ /dev/null @@ -1,258 +0,0 @@ -/* - * 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.AccessLevel; -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. - */ -@Getter(AccessLevel.PACKAGE) -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), - - GRACEFUL_HOOD(ItemID.GRACEFUL_HOOD, 1965), - GRACEFUL_CAPE(ItemID.GRACEFUL_CAPE, 2460), - GRACEFUL_TOP(ItemID.GRACEFUL_TOP, 2345), - GRACEFUL_LEGS(ItemID.GRACEFUL_LEGS, 2290), - GRACEFUL_GLOVES(ItemID.GRACEFUL_GLOVES, 1970), - GRACEFUL_BOOTS(ItemID.GRACEFUL_BOOTS, 2060), - - ANGLER_HAT(ItemID.ANGLER_HAT, 2600), - ANGLER_TOP(ItemID.ANGLER_TOP, 3550), - ANGLER_WADERS(ItemID.ANGLER_WADERS, 4400), - ANGLER_BOOTS(ItemID.ANGLER_BOOTS, 5300), - - PROSPECTOR_HELMET(ItemID.PROSPECTOR_HELMET, 2640), - PROSPECTOR_JACKET(ItemID.PROSPECTOR_JACKET, 3550), - PROSPECTOR_LEGS(ItemID.PROSPECTOR_LEGS, 4460), - PROSPECTOR_BOOTS(ItemID.PROSPECTOR_BOOTS, 5370), - - LUMBERJACK_HAT(ItemID.LUMBERJACK_HAT, 19950), - LUMBERJACK_TOP(ItemID.LUMBERJACK_TOP, 19950), - LUMBERJACK_LEGS(ItemID.LUMBERJACK_LEGS, 19950), - LUMBERJACK_BOOTS(ItemID.LUMBERJACK_BOOTS, 19950), - - ROGUE_MASK(ItemID.ROGUE_MASK, 725), - ROGUE_TOP(ItemID.ROGUE_TOP, 575), - ROGUE_TROUSERS(ItemID.ROGUE_TROUSERS, 500), - ROGUE_GLOVES(ItemID.ROGUE_GLOVES, 650), - ROGUE_BOOTS(ItemID.ROGUE_BOOTS, 650), - - SALVE_AMULET_EI(ItemID.SALVE_AMULETEI, 209900), - - RING_OF_WEALTH_1(ItemID.RING_OF_WEALTH_1, 500, ItemID.RING_OF_WEALTH), - RING_OF_WEALTH_2(ItemID.RING_OF_WEALTH_2, 1000, ItemID.RING_OF_WEALTH), - RING_OF_WEALTH_3(ItemID.RING_OF_WEALTH_3, 1500, ItemID.RING_OF_WEALTH), - RING_OF_WEALTH_4(ItemID.RING_OF_WEALTH_4, 2000, ItemID.RING_OF_WEALTH), - - AMULET_OF_GLORY1(ItemID.AMULET_OF_GLORY1, 500, ItemID.AMULET_OF_GLORY), - AMULET_OF_GLORY2(ItemID.AMULET_OF_GLORY2, 1000, ItemID.AMULET_OF_GLORY), - AMULET_OF_GLORY3(ItemID.AMULET_OF_GLORY3, 1500, ItemID.AMULET_OF_GLORY), - AMULET_OF_GLORY5(ItemID.AMULET_OF_GLORY5, 2500, ItemID.AMULET_OF_GLORY), - - COMBAT_BRACELET1(ItemID.COMBAT_BRACELET1, 500, ItemID.COMBAT_BRACELET), - COMBAT_BRACELET2(ItemID.COMBAT_BRACELET2, 1000, ItemID.COMBAT_BRACELET), - COMBAT_BRACELET3(ItemID.COMBAT_BRACELET3, 1500, ItemID.COMBAT_BRACELET), - COMBAT_BRACELET5(ItemID.COMBAT_BRACELET5, 2500, ItemID.COMBAT_BRACELET), - - SKILLS_NECKLACE1(ItemID.SKILLS_NECKLACE1, 500, ItemID.SKILLS_NECKLACE), - SKILLS_NECKLACE2(ItemID.SKILLS_NECKLACE2, 1000, ItemID.SKILLS_NECKLACE), - SKILLS_NECKLACE3(ItemID.SKILLS_NECKLACE3, 1500, ItemID.SKILLS_NECKLACE), - SKILLS_NECKLACE4(ItemID.SKILLS_NECKLACE5, 2500, ItemID.SKILLS_NECKLACE), - - AHRIMS_HOOD_25(ItemID.AHRIMS_HOOD_25, 2500, ItemID.AHRIMS_HOOD_0), - AHRIMS_HOOD_50(ItemID.AHRIMS_HOOD_50, 5000, ItemID.AHRIMS_HOOD_0), - AHRIMS_HOOD_75(ItemID.AHRIMS_HOOD_75, 7500, ItemID.AHRIMS_HOOD_0), - AHRIMS_HOOD_100(ItemID.AHRIMS_HOOD_100, 10000, ItemID.AHRIMS_HOOD_0), - AHRIMS_ROBETOP_25(ItemID.AHRIMS_ROBETOP_25, 2500, ItemID.AHRIMS_ROBETOP_0), - AHRIMS_ROBETOP_50(ItemID.AHRIMS_ROBETOP_50, 5000, ItemID.AHRIMS_ROBETOP_0), - AHRIMS_ROBETOP_75(ItemID.AHRIMS_ROBETOP_75, 7500, ItemID.AHRIMS_ROBETOP_0), - AHRIMS_ROBETOP_100(ItemID.AHRIMS_ROBETOP_100, 10000, ItemID.AHRIMS_ROBETOP_0), - AHRIMS_ROBESKIRT_25(ItemID.AHRIMS_ROBESKIRT_25, 2500, ItemID.AHRIMS_ROBESKIRT_0), - AHRIMS_ROBESKIRT_50(ItemID.AHRIMS_ROBESKIRT_50, 5000, ItemID.AHRIMS_ROBESKIRT_0), - AHRIMS_ROBESKIRT_75(ItemID.AHRIMS_ROBESKIRT_75, 7500, ItemID.AHRIMS_ROBESKIRT_0), - AHRIMS_ROBESKIRT_100(ItemID.AHRIMS_ROBESKIRT_100, 10000, ItemID.AHRIMS_ROBESKIRT_0), - AHRIMS_STAFF_25(ItemID.AHRIMS_STAFF_25, 2500, ItemID.AHRIMS_STAFF_0), - AHRIMS_STAFF_50(ItemID.AHRIMS_STAFF_50, 5000, ItemID.AHRIMS_STAFF_0), - AHRIMS_STAFF_75(ItemID.AHRIMS_STAFF_75, 7500, ItemID.AHRIMS_STAFF_0), - AHRIMS_STAFF_100(ItemID.AHRIMS_STAFF_100, 10000, ItemID.AHRIMS_STAFF_0), - - KARILS_COIF_25(ItemID.KARILS_COIF_25, 2500, ItemID.KARILS_COIF_0), - KARILS_COIF_50(ItemID.KARILS_COIF_50, 5000, ItemID.KARILS_COIF_0), - KARILS_COIF_75(ItemID.KARILS_COIF_75, 7500, ItemID.KARILS_COIF_0), - KARILS_COIF_100(ItemID.KARILS_COIF_100, 10000, ItemID.KARILS_COIF_0), - KARILS_LEATHERTOP_25(ItemID.KARILS_LEATHERTOP_25, 2500, ItemID.KARILS_LEATHERTOP_0), - KARILS_LEATHERTOP_50(ItemID.KARILS_LEATHERTOP_50, 5000, ItemID.KARILS_LEATHERTOP_0), - KARILS_LEATHERTOP_75(ItemID.KARILS_LEATHERTOP_75, 7500, ItemID.KARILS_LEATHERTOP_0), - KARILS_LEATHERTOP_100(ItemID.KARILS_LEATHERTOP_100, 10000, ItemID.KARILS_LEATHERTOP_0), - KARILS_LEATHERSKIRT_25(ItemID.KARILS_LEATHERSKIRT_25, 2500, ItemID.KARILS_LEATHERSKIRT_0), - KARILS_LEATHERSKIRT_50(ItemID.KARILS_LEATHERSKIRT_50, 5000, ItemID.KARILS_LEATHERSKIRT_0), - KARILS_LEATHERSKIRT_75(ItemID.KARILS_LEATHERSKIRT_75, 7500, ItemID.KARILS_LEATHERSKIRT_0), - KARILS_LEATHERSKIRT_100(ItemID.KARILS_LEATHERSKIRT_100, 10000, ItemID.KARILS_LEATHERSKIRT_0), - KARILS_CROSSBOW_25(ItemID.KARILS_CROSSBOW_25, 2500, ItemID.KARILS_CROSSBOW_0), - KARILS_CROSSBOW_50(ItemID.KARILS_CROSSBOW_50, 5000, ItemID.KARILS_CROSSBOW_0), - KARILS_CROSSBOW_75(ItemID.KARILS_CROSSBOW_75, 7500, ItemID.KARILS_CROSSBOW_0), - KARILS_CROSSBOW_100(ItemID.KARILS_CROSSBOW_100, 10000, ItemID.KARILS_CROSSBOW_0), - - DHAROKS_HELM_25(ItemID.DHAROKS_HELM_25, 2500, ItemID.DHAROKS_HELM_0), - DHAROKS_HELM_50(ItemID.DHAROKS_HELM_50, 5000, ItemID.DHAROKS_HELM_0), - DHAROKS_HELM_75(ItemID.DHAROKS_HELM_75, 7500, ItemID.DHAROKS_HELM_0), - DHAROKS_HELM_100(ItemID.DHAROKS_HELM_100, 10000, ItemID.DHAROKS_HELM_0), - DHAROKS_PLATEBODY_25(ItemID.DHAROKS_PLATEBODY_25, 2500, ItemID.DHAROKS_PLATEBODY_0), - DHAROKS_PLATEBODY_50(ItemID.DHAROKS_PLATEBODY_50, 5000, ItemID.DHAROKS_PLATEBODY_0), - DHAROKS_PLATEBODY_75(ItemID.DHAROKS_PLATEBODY_75, 7500, ItemID.DHAROKS_PLATEBODY_0), - DHAROKS_PLATEBODY_100(ItemID.DHAROKS_PLATEBODY_100, 10000, ItemID.DHAROKS_PLATEBODY_0), - DHAROKS_PLATELEGS_25(ItemID.DHAROKS_PLATELEGS_25, 2500, ItemID.DHAROKS_PLATELEGS_0), - DHAROKS_PLATELEGS_50(ItemID.DHAROKS_PLATELEGS_50, 5000, ItemID.DHAROKS_PLATELEGS_0), - DHAROKS_PLATELEGS_75(ItemID.DHAROKS_PLATELEGS_75, 7500, ItemID.DHAROKS_PLATELEGS_0), - DHAROKS_PLATELEGS_100(ItemID.DHAROKS_PLATELEGS_100, 10000, ItemID.DHAROKS_PLATELEGS_0), - DHAROKS_GREATAXE_25(ItemID.DHAROKS_GREATAXE_25, 2500, ItemID.DHAROKS_GREATAXE_0), - DHAROKS_GREATAXE_50(ItemID.DHAROKS_GREATAXE_50, 5000, ItemID.DHAROKS_GREATAXE_0), - DHAROKS_GREATAXE_75(ItemID.DHAROKS_GREATAXE_75, 7500, ItemID.DHAROKS_GREATAXE_0), - DHAROKS_GREATAXE_100(ItemID.DHAROKS_GREATAXE_100, 10000, ItemID.DHAROKS_GREATAXE_0), - - GUTHANS_HELM_25(ItemID.GUTHANS_HELM_25, 2500, ItemID.GUTHANS_HELM_0), - GUTHANS_HELM_50(ItemID.GUTHANS_HELM_50, 5000, ItemID.GUTHANS_HELM_0), - GUTHANS_HELM_75(ItemID.GUTHANS_HELM_75, 7500, ItemID.GUTHANS_HELM_0), - GUTHANS_HELM_100(ItemID.GUTHANS_HELM_100, 10000, ItemID.GUTHANS_HELM_0), - GUTHANS_PLATEBODY_25(ItemID.GUTHANS_PLATEBODY_25, 2500, ItemID.GUTHANS_PLATEBODY_0), - GUTHANS_PLATEBODY_50(ItemID.GUTHANS_PLATEBODY_50, 5000, ItemID.GUTHANS_PLATEBODY_0), - GUTHANS_PLATEBODY_75(ItemID.GUTHANS_PLATEBODY_75, 7500, ItemID.GUTHANS_PLATEBODY_0), - GUTHANS_PLATEBODY_100(ItemID.GUTHANS_PLATEBODY_100, 10000, ItemID.GUTHANS_PLATEBODY_0), - GUTHANS_CHAINSKIRT_25(ItemID.GUTHANS_CHAINSKIRT_25, 2500, ItemID.GUTHANS_CHAINSKIRT_0), - GUTHANS_CHAINSKIRT_50(ItemID.GUTHANS_CHAINSKIRT_50, 5000, ItemID.GUTHANS_CHAINSKIRT_0), - GUTHANS_CHAINSKIRT_75(ItemID.GUTHANS_CHAINSKIRT_75, 7500, ItemID.GUTHANS_CHAINSKIRT_0), - GUTHANS_CHAINSKIRT_100(ItemID.GUTHANS_CHAINSKIRT_100, 10000, ItemID.GUTHANS_CHAINSKIRT_0), - GUTHANS_WARSPEAR_25(ItemID.GUTHANS_WARSPEAR_25, 2500, ItemID.GUTHANS_WARSPEAR_0), - GUTHANS_WARSPEAR_50(ItemID.GUTHANS_WARSPEAR_50, 5000, ItemID.GUTHANS_WARSPEAR_0), - GUTHANS_WARSPEAR_75(ItemID.GUTHANS_WARSPEAR_75, 7500, ItemID.GUTHANS_WARSPEAR_0), - GUTHANS_WARSPEAR_100(ItemID.GUTHANS_WARSPEAR_100, 10000, ItemID.GUTHANS_WARSPEAR_0), - - TORAGS_HELM_25(ItemID.TORAGS_HELM_25, 2500, ItemID.TORAGS_HELM_0), - TORAGS_HELM_50(ItemID.TORAGS_HELM_50, 5000, ItemID.TORAGS_HELM_0), - TORAGS_HELM_75(ItemID.TORAGS_HELM_75, 7500, ItemID.TORAGS_HELM_0), - TORAGS_HELM_100(ItemID.TORAGS_HELM_100, 10000, ItemID.TORAGS_HELM_0), - TORAGS_PLATEBODY_25(ItemID.TORAGS_PLATEBODY_25, 2500, ItemID.TORAGS_PLATEBODY_0), - TORAGS_PLATEBODY_50(ItemID.TORAGS_PLATEBODY_50, 5000, ItemID.TORAGS_PLATEBODY_0), - TORAGS_PLATEBODY_75(ItemID.TORAGS_PLATEBODY_75, 7500, ItemID.TORAGS_PLATEBODY_0), - TORAGS_PLATEBODY_100(ItemID.TORAGS_PLATEBODY_100, 10000, ItemID.TORAGS_PLATEBODY_0), - TORAGS_PLATELEGS_25(ItemID.TORAGS_PLATELEGS_25, 2500, ItemID.TORAGS_PLATELEGS_0), - TORAGS_PLATELEGS_50(ItemID.TORAGS_PLATELEGS_50, 5000, ItemID.TORAGS_PLATELEGS_0), - TORAGS_PLATELEGS_75(ItemID.TORAGS_PLATELEGS_75, 7500, ItemID.TORAGS_PLATELEGS_0), - TORAGS_PLATELEGS_100(ItemID.TORAGS_PLATELEGS_100, 10000, ItemID.TORAGS_PLATELEGS_0), - TORAGS_HAMMERS_25(ItemID.TORAGS_HAMMERS_25, 2500, ItemID.TORAGS_HAMMERS_0), - TORAGS_HAMMERS_50(ItemID.TORAGS_HAMMERS_50, 5000, ItemID.TORAGS_HAMMERS_0), - TORAGS_HAMMERS_75(ItemID.TORAGS_HAMMERS_75, 7500, ItemID.TORAGS_HAMMERS_0), - TORAGS_HAMMERS_100(ItemID.TORAGS_HAMMERS_100, 10000, ItemID.TORAGS_HAMMERS_0), - - VERACS_HELM_25(ItemID.VERACS_HELM_25, 2500, ItemID.VERACS_HELM_0), - VERACS_HELM_50(ItemID.VERACS_HELM_50, 5000, ItemID.VERACS_HELM_0), - VERACS_HELM_75(ItemID.VERACS_HELM_75, 7500, ItemID.VERACS_HELM_0), - VERACS_HELM_100(ItemID.VERACS_HELM_100, 10000, ItemID.VERACS_HELM_0), - VERACS_BRASSARD_25(ItemID.VERACS_BRASSARD_25, 2500, ItemID.VERACS_BRASSARD_0), - VERACS_BRASSARD_50(ItemID.VERACS_BRASSARD_50, 5000, ItemID.VERACS_BRASSARD_0), - VERACS_BRASSARD_75(ItemID.VERACS_BRASSARD_75, 7500, ItemID.VERACS_BRASSARD_0), - VERACS_BRASSARD_100(ItemID.VERACS_BRASSARD_100, 10000, ItemID.VERACS_BRASSARD_0), - VERACS_PLATESKIRT_25(ItemID.VERACS_PLATESKIRT_25, 2500, ItemID.VERACS_PLATESKIRT_0), - VERACS_PLATESKIRT_50(ItemID.VERACS_PLATESKIRT_50, 5000, ItemID.VERACS_PLATESKIRT_0), - VERACS_PLATESKIRT_75(ItemID.VERACS_PLATESKIRT_75, 7500, ItemID.VERACS_PLATESKIRT_0), - VERACS_PLATESKIRT_100(ItemID.VERACS_PLATESKIRT_100, 10000, ItemID.VERACS_PLATESKIRT_0), - VERACS_FLAIL_25(ItemID.VERACS_FLAIL_25, 2500, ItemID.VERACS_FLAIL_0), - VERACS_FLAIL_50(ItemID.VERACS_FLAIL_50, 5000, ItemID.VERACS_FLAIL_0), - VERACS_FLAIL_75(ItemID.VERACS_FLAIL_75, 7500, ItemID.VERACS_FLAIL_0), - VERACS_FLAIL_100(ItemID.VERACS_FLAIL_100, 10000, ItemID.VERACS_FLAIL_0), - - AVERNIC_DEFENDER(ItemID.AVERNIC_DEFENDER, 4040000), - ; - - private final int itemId; - private final int offset; - private final int baseId; - - 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(); - } - - FixedPriceItem(final int itemId, final int offset, final int baseId) - { - this.itemId = itemId; - this.offset = offset; - this.baseId = baseId; - } - - FixedPriceItem(final int itemId, final int offset) - { - this(itemId, offset, -1); - } - - @Nullable - static FixedPriceItem find(int itemId) - { - return FIXED_ITEMS.get(itemId); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/ItemStack.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/ItemStack.java deleted file mode 100644 index d2f09dd856..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/ItemStack.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -class ItemStack -{ - private int id; - private int qty; -} 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 deleted file mode 100644 index 8538d39248..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPlugin.java +++ /dev/null @@ -1,790 +0,0 @@ -/* - * 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 com.google.common.annotations.VisibleForTesting; -import java.awt.Color; -import java.util.ArrayList; -import java.util.Collection; -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 java.util.stream.Collectors; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -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.ItemContainer; -import net.runelite.api.ItemDefinition; -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.game.ItemMapping; -import net.runelite.client.game.ItemReclaimCost; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.util.ColorUtil; -import net.runelite.client.util.QuantityFormatter; - -@PluginDescriptor( - name = "Items Kept on Death", - description = "Updates the Items Kept on Death interface to be more accurate", - enabledByDefault = false, - type = PluginType.UTILITY -) -@Slf4j -@Singleton -public class ItemsKeptOnDeathPlugin extends Plugin -{ - private static final int DEEP_WILDY = 20; - private static final Pattern WILDERNESS_LEVEL_PATTERN = Pattern.compile("^Level: (\\d+).*"); - - @AllArgsConstructor - @Getter(AccessLevel.PACKAGE) - @VisibleForTesting - static class DeathItems - { - private final List keptItems; - private final List lostItems; - private final boolean hasAlwaysLost; - } - - // 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; - - @VisibleForTesting - boolean isSkulled; - @VisibleForTesting - boolean protectingItem; - @VisibleForTesting - int wildyLevel; - - @Subscribe - private 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 DeathItems deathItems = calculateKeptLostItems(inv, equip); - - final List keptItems = deathItems.getKeptItems().stream() - .map(item -> createItemWidget(kept, item, true)).collect(Collectors.toList()); - final List lostItems = deathItems.getLostItems().stream() - .map(item -> createItemWidget(lost, item, false)).collect(Collectors.toList()); - - 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(deathItems.isHasAlwaysLost(), keptItems, lostItems); - } - - /** - * Calculates which items will be kept/lost. first list is kept items, second is lost. - * - * @param inv players inventory - * @param equip players equipement - * @return list of items kept followed by a list of items lost - */ - @VisibleForTesting - DeathItems calculateKeptLostItems(final Item[] inv, final Item[] equip) - { - 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 hasClueBox = false; - 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 qty = i.getQuantity(); - if (id == -1) - { - continue; - } - - // Bonds are always kept and do not count towards the limit. - if (id == ItemID.OLD_SCHOOL_BOND || id == ItemID.OLD_SCHOOL_BOND_UNTRADEABLE) - { - keptItems.add(new ItemStack(id, qty)); - continue; - } - - final AlwaysLostItem alwaysLostItem = AlwaysLostItem.getByItemID(id); - if (alwaysLostItem != null && (!alwaysLostItem.isKeptOutsideOfWilderness() || wildyLevel > 0)) - { - hasAlwaysLost = true; - hasClueBox = hasClueBox || id == ItemID.CLUE_BOX; - lostItems.add(new ItemStack(id, qty)); - continue; - } - - if (keepCount > 0) - { - // Keep most valuable items regardless of trade-ability. - if (i.getQuantity() > keepCount) - { - keptItems.add(new ItemStack(id, keepCount)); - qty -= keepCount; - keepCount = 0; - // Fall through to determine if the rest of the stack should drop - } - else - { - keptItems.add(new ItemStack(id, qty)); - keepCount -= qty; - continue; - } - } - - // Items are kept if: - // 1) is not tradeable - // 2) Outside the wilderness: All are kept excluding `Pets` & `LostIfNotProtected`. (`AlwaysLostItem` are handled above) - // 3) In low level wilderness: (<=20) only `LockedItem`s and `BrokenOnDeathItem`s are kept - // 4) In deep level wilderness: (>=21) only `LockedItem`s are kept - if (!Pets.isPet(id) - && !LostIfNotProtected.isLostIfNotProtected(id) - && !isTradeable(itemManager.getItemDefinition(id)) - && (wildyLevel <= 0 - || LockedItem.getBaseIdFromLockedId(id) != null - || (wildyLevel <= DEEP_WILDY && ItemReclaimCost.of(id) != null)) - ) - { - keptItems.add(new ItemStack(id, qty)); - } - else - { - // Otherwise, the item is lost - lostItems.add(new ItemStack(id, qty)); - } - } - - if (hasClueBox) - { - boolean alreadyProtectingClue = false; - for (final ItemStack item : keptItems) - { - if (isClueBoxable(item.getId())) - { - alreadyProtectingClue = true; - break; - } - } - - if (!alreadyProtectingClue) - { - int clueId = -1; - // Clue box protects the last clue in your inventory so loop over the players inv - for (final Item i : inv) - { - final int id = i.getId(); - if (id != -1 && isClueBoxable(id)) - { - clueId = id; - } - } - - if (clueId != -1) - { - // Move the boxed item to the kept items container and remove it from the lost items container - for (final ItemStack boxableItem : lostItems) - { - if (boxableItem.getId() == clueId) - { - if (boxableItem.getQty() > 1) - { - boxableItem.setQty(boxableItem.getQty() - 1); - keptItems.add(new ItemStack(clueId, 1)); - } - else - { - lostItems.remove(boxableItem); - keptItems.add(boxableItem); - } - break; - } - } - } - } - } - - return new DeathItems(keptItems, lostItems, hasAlwaysLost); - } - - @VisibleForTesting - boolean isClueBoxable(final int itemID) - { - final String name = itemManager.getItemDefinition(itemID).getName(); - return name.contains("Clue scroll (") || name.contains("Reward casket ("); - } - - /** - * Get the price of an item - * - * @param item - * @return - */ - @VisibleForTesting - int getDeathPrice(Item item) - { - return getDeathPriceById(item.getId()); - } - - /** - * Get the price of an item by its id - * - * @param itemId - * @return - */ - private int getDeathPriceById(final int itemId) - { - // 1) Check if the death price is dynamically calculated, if so return that value - // 2) If death price is based off another item default to that price, otherwise apply normal ItemMapping GE price - // 3) If still no price, default to store price - // 4) Apply fixed price offset if applicable - // Unnote/unplaceholder item - int canonicalizedItemId = itemManager.canonicalize(itemId); - int exchangePrice = 0; - - - final Integer lockedBase = LockedItem.getBaseIdFromLockedId(canonicalizedItemId); - if (lockedBase != null) - { - return getDeathPriceById(lockedBase); - } - - final DynamicPriceItem dynamicPrice = DynamicPriceItem.find(canonicalizedItemId); - if (dynamicPrice != null) - { - final int basePrice = itemManager.getItemPrice(dynamicPrice.getChargedId(), true); - return dynamicPrice.calculateDeathPrice(basePrice); - } - - // Some items have artificially offset death prices - such as ring imbues - // which are +2k over the non imbues. Check if the item has a fixed price offset - final FixedPriceItem fixedPrice = FixedPriceItem.find(canonicalizedItemId); - if (fixedPrice != null && fixedPrice.getBaseId() != -1) - { - // Grab base item price - exchangePrice = itemManager.getItemPrice(fixedPrice.getBaseId(), true); - } - - // Jagex uses the repair price when determining which items are kept on death. - final ItemReclaimCost repairPrice = ItemReclaimCost.of(canonicalizedItemId); - if (repairPrice != null) - { - exchangePrice = repairPrice.getValue(); - } - - if (exchangePrice == 0) - { - // Account for items whose death value comes from their tradeable variant (barrows) or components (ornate kits) - // ItemMapping.map will always return a collection with at least the passed ID - for (final int mappedID : ItemMapping.map(canonicalizedItemId)) - { - exchangePrice += itemManager.getItemPrice(mappedID, true); - } - - // If for some reason it still has no price default to the items store price - if (exchangePrice == 0) - { - final ItemDefinition c1 = itemManager.getItemDefinition(canonicalizedItemId); - exchangePrice = c1.getPrice(); - } - } - - // Apply fixed price offset - exchangePrice += fixedPrice == null ? 0 : 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 theyGet = 0; - long youLose = 0; - - for (final Widget w : lostItems) - { - final int cid = itemManager.canonicalize(w.getItemId()); - final TrueItemValue trueItemValue = TrueItemValue.map(cid); - final Collection mapping = ItemMapping.map(cid); - final int breakValue = itemManager.getRepairValue(cid); - - if (breakValue != 0) - { - youLose -= breakValue; - theyGet += breakValue; - } - - if (trueItemValue != null) - { - int truePrice = 0; - - for (int id : trueItemValue.getDeconstructedItem()) - { - if (mapping.contains(id)) - { - continue; - } - truePrice += itemManager.getItemPrice(id); - } - - youLose += truePrice; - } - - int price = itemManager.getItemPrice(cid); - - if (price == 0 && breakValue == 0) - { - // Default to alch price - price = (int) (itemManager.getItemDefinition(cid).getPrice() * Constants.HIGH_ALCHEMY_MULTIPLIER); - } - - theyGet += (long) price * w.getItemQuantity(); - } - final Widget lostValue = client.getWidget(WidgetInfo.ITEMS_LOST_VALUE); - lostValue.setText("They get: " + QuantityFormatter.quantityToStackSize(theyGet) + - "
You lose: " + ColorUtil.prependColorTag("(" + QuantityFormatter.quantityToStackSize(theyGet + youLose) + ")", Color.red)); - - // 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 ItemDefinition c) - { - // 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()) - { - 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 parent Widget to add element too as a child - * @param item the TempItem representing the item - * @param kept is the item being shown in the kept items container - * @return the Widget that was added to the `parent` - */ - private Widget createItemWidget(final Widget parent, final ItemStack item, boolean kept) - { - final int id = item.getId(); - final int qty = item.getQty(); - final ItemDefinition c = itemManager.getItemDefinition(id); - - final Widget itemWidget = parent.createChild(-1, WidgetType.GRAPHIC); - itemWidget.setOriginalWidth(Constants.ITEM_SPRITE_WIDTH); - itemWidget.setOriginalHeight(Constants.ITEM_SPRITE_HEIGHT); - itemWidget.setItemId(id); - itemWidget.setItemQuantity(qty); - itemWidget.setAction(1, String.format("Item: %s", c.getName())); - itemWidget.setOnOpListener(ScriptID.DEATH_KEEP_ITEM_EXAMINE, kept ? 1 : 0, qty, c.getName()); - itemWidget.setHasListener(true); - - final AlwaysLostItem alwaysLostItem = AlwaysLostItem.getByItemID(id); - final boolean whiteBorder = alwaysLostItem != null && (!alwaysLostItem.isKeptOutsideOfWilderness() || wildyLevel > 0); - itemWidget.setBorderType(whiteBorder ? 2 : 1); - - return itemWidget; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/LockedItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/LockedItem.java deleted file mode 100644 index 6c1689eb53..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/LockedItem.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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 net.runelite.api.ItemID; - -/** - * A locked item will be kept in its unbroken state upon dying with it past level 20 Wildy but its locked status will be lost. - * Only certain untradeable items can be combined with a Trouver parchment by talking to Perdu and paying a fee. - *

- * View the Trouver parchment wiki page for more information: https://oldschool.runescape.wiki/w/Trouver_parchment - */ -@AllArgsConstructor -public enum LockedItem -{ - LOCKED_INFERNAL_CAPE(ItemID.INFERNAL_CAPE_L, ItemID.INFERNAL_CAPE), - LOCKED_INFERNAL_MAX_CAPE(ItemID.INFERNAL_MAX_CAPE_L, ItemID.INFERNAL_MAX_CAPE), - LOCKED_FIRE_CAPE(ItemID.FIRE_CAPE_L, ItemID.FIRE_CAPE), - LOCKED_FIRE_MAX_CAPE(ItemID.FIRE_MAX_CAPE_L, ItemID.FIRE_MAX_CAPE), - LOCKED_AVAS_ASSEMBLER(ItemID.AVAS_ASSEMBLER_L, ItemID.AVAS_ASSEMBLER), - LOCKED_ASSEMBLER_MAX_CAPE(ItemID.ASSEMBLER_MAX_CAPE_L, ItemID.ASSEMBLER_MAX_CAPE), - LOCKED_IMBUED_SARADOMIN_CAPE(ItemID.IMBUED_SARADOMIN_CAPE_L, ItemID.IMBUED_SARADOMIN_CAPE), - LOCKED_IMBUED_SARADOMIN_MAX_CAPE(ItemID.IMBUED_SARADOMIN_MAX_CAPE_L, ItemID.IMBUED_SARADOMIN_MAX_CAPE), - LOCKED_IMBUED_GUTHIX_CAPE(ItemID.IMBUED_GUTHIX_CAPE_L, ItemID.IMBUED_GUTHIX_CAPE), - LOCKED_IMBUED_GUTHIX_MAX_CAPE(ItemID.IMBUED_GUTHIX_MAX_CAPE_L, ItemID.IMBUED_GUTHIX_MAX_CAPE), - LOCKED_IMBUED_ZAMORAK_CAPE(ItemID.IMBUED_ZAMORAK_CAPE_L, ItemID.IMBUED_ZAMORAK_CAPE), - LOCKED_IMBUED_ZAMORAK_MAX_CAPE(ItemID.IMBUED_ZAMORAK_MAX_CAPE_L, ItemID.IMBUED_ZAMORAK_MAX_CAPE), - LOCKED_BRONZE_DEFENDER(ItemID.BRONZE_DEFENDER_L, ItemID.BRONZE_DEFENDER), - LOCKED_IRON_DEFENDER(ItemID.IRON_DEFENDER_L, ItemID.IRON_DEFENDER), - LOCKED_STEEL_DEFENDER(ItemID.STEEL_DEFENDER_L, ItemID.STEEL_DEFENDER), - LOCKED_BLACK_DEFENDER(ItemID.BLACK_DEFENDER_L, ItemID.BLACK_DEFENDER), - LOCKED_MITHRIL_DEFENDER(ItemID.MITHRIL_DEFENDER_L, ItemID.MITHRIL_DEFENDER), - LOCKED_ADAMANT_DEFENDER(ItemID.ADAMANT_DEFENDER_L, ItemID.ADAMANT_DEFENDER), - LOCKED_RUNE_DEFENDER(ItemID.RUNE_DEFENDER_L, ItemID.RUNE_DEFENDER), - LOCKED_DRAGON_DEFENDER(ItemID.DRAGON_DEFENDER_L, ItemID.DRAGON_DEFENDER), - LOCKED_AVERNIC_DEFENDER(ItemID.AVERNIC_DEFENDER_L, ItemID.AVERNIC_DEFENDER), - LOCKED_SARADOMIN_HALO(ItemID.SARADOMIN_HALO_L, ItemID.SARADOMIN_HALO), - LOCKED_ZAMORAK_HALO(ItemID.ZAMORAK_HALO_L, ItemID.ZAMORAK_HALO), - LOCKED_GUTHIX_HALO(ItemID.GUTHIX_HALO_L, ItemID.GUTHIX_HALO), - LOCKED_ARMADYL_HALO(ItemID.ARMADYL_HALO_L, ItemID.ARMADYL_HALO), - LOCKED_BANDOS_HALO(ItemID.BANDOS_HALO_L, ItemID.BANDOS_HALO), - LOCKED_SEREN_HALO(ItemID.SEREN_HALO_L, ItemID.SEREN_HALO), - LOCKED_ANCIENT_HALO(ItemID.ANCIENT_HALO_L, ItemID.ANCIENT_HALO), - LOCKED_BRASSICA_HALO(ItemID.BRASSICA_HALO_L, ItemID.BRASSICA_HALO), - LOCKED_HEALER_HAT(ItemID.HEALER_HAT_L, ItemID.HEALER_HAT), - LOCKED_FIGHTER_HAT(ItemID.FIGHTER_HAT_L, ItemID.FIGHTER_HAT), - LOCKED_RANGER_HAT(ItemID.RANGER_HAT_L, ItemID.RANGER_HAT), - LOCKED_FIGHTER_TORSO(ItemID.FIGHTER_TORSO_L, ItemID.FIGHTER_TORSO), - LOCKED_PENANCE_SKIRT(ItemID.PENANCE_SKIRT_L, ItemID.PENANCE_SKIRT), - LOCKED_VOID_KNIGHT_TOP(ItemID.VOID_KNIGHT_TOP_L, ItemID.VOID_KNIGHT_TOP), - LOCKED_ELITE_VOID_TOP(ItemID.ELITE_VOID_TOP_L, ItemID.ELITE_VOID_TOP), - LOCKED_VOID_KNIGHT_ROBE(ItemID.VOID_KNIGHT_ROBE_L, ItemID.VOID_KNIGHT_ROBE), - LOCKED_ELITE_VOID_ROBE(ItemID.ELITE_VOID_ROBE_L, ItemID.ELITE_VOID_ROBE), - LOCKED_VOID_KNIGHT_MACE(ItemID.VOID_KNIGHT_MACE_L, ItemID.VOID_KNIGHT_MACE), - LOCKED_VOID_KNIGHT_GLOVES(ItemID.VOID_KNIGHT_GLOVES_L, ItemID.VOID_KNIGHT_GLOVES), - LOCKED_VOID_MAGE_HELM(ItemID.VOID_MAGE_HELM_L, ItemID.VOID_MAGE_HELM), - LOCKED_VOID_RANGER_HELM(ItemID.VOID_RANGER_HELM_L, ItemID.VOID_RANGER_HELM), - LOCKED_VOID_MELEE_HELM(ItemID.VOID_MELEE_HELM_L, ItemID.VOID_MELEE_HELM), - LOCKED_GOLD_DECORATIVE_SWORD(ItemID.DECORATIVE_SWORD_L, ItemID.DECORATIVE_SWORD_4508), - LOCKED_GOLD_DECORATIVE_BODY(ItemID.DECORATIVE_ARMOUR_L, ItemID.DECORATIVE_ARMOUR_4509), - LOCKED_GOLD_DECORATIVE_LEGS(ItemID.DECORATIVE_ARMOUR_L_24159, ItemID.DECORATIVE_ARMOUR_4510), - LOCKED_GOLD_DECORATIVE_HELM(ItemID.DECORATIVE_HELM_L, ItemID.DECORATIVE_HELM_4511), - LOCKED_GOLD_DECORATIVE_SHIELD(ItemID.DECORATIVE_SHIELD_L, ItemID.DECORATIVE_SHIELD_4512), - LOCKED_GOLD_DECORATIVE_SKIRT(ItemID.DECORATIVE_ARMOUR_L_24162, ItemID.DECORATIVE_ARMOUR_11895), - LOCKED_DECORATIVE_MAGE_HAT(ItemID.DECORATIVE_ARMOUR_L_24165, ItemID.DECORATIVE_ARMOUR_11898), - LOCKED_DECORATIVE_MAGE_ROBE_TOP(ItemID.DECORATIVE_ARMOUR_L_24163, ItemID.DECORATIVE_ARMOUR_11896), - LOCKED_DECORATIVE_MAGE_ROBE_LEGS(ItemID.DECORATIVE_ARMOUR_L_24164, ItemID.DECORATIVE_ARMOUR_11897), - LOCKED_DECORATIVE_RANGE_TOP(ItemID.DECORATIVE_ARMOUR_L_24166, ItemID.DECORATIVE_ARMOUR_11899), - LOCKED_DECORATIVE_RANGE_BOTTOM(ItemID.DECORATIVE_ARMOUR_L_24167, ItemID.DECORATIVE_ARMOUR_11900), - LOCKED_DECORATIVE_RANGE_QUIVER(ItemID.DECORATIVE_ARMOUR_L_24168, ItemID.DECORATIVE_ARMOUR_11901), - LOCKED_RUNE_POUCH(ItemID.RUNE_POUCH_L, ItemID.RUNE_POUCH), - ; - - final private int lockedID; - final private int baseID; - - private final static Map ITEMS; - - static - { - final ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (final LockedItem item : values()) - { - builder.put(item.lockedID, item.baseID); - } - - ITEMS = builder.build(); - } - - @Nullable - public static Integer getBaseIdFromLockedId(final int itemID) - { - return ITEMS.get(itemID); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/LostIfNotProtected.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/LostIfNotProtected.java deleted file mode 100644 index edfa3bb7ea..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/LostIfNotProtected.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.ImmutableSet; -import java.util.Set; -import net.runelite.api.ItemID; - -final class LostIfNotProtected -{ - private static final Set ITEMS = ImmutableSet.of( - ItemID.AMULET_OF_THE_DAMNED, - ItemID.RING_OF_CHAROS, ItemID.RING_OF_CHAROSA, - ItemID.LUNAR_STAFF, - ItemID.SHADOW_SWORD, - ItemID.KERIS, ItemID.KERISP, ItemID.KERISP_10583, ItemID.KERISP_10584 - ); - - static boolean isLostIfNotProtected(int id) - { - return ITEMS.contains(id); - } -} 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 deleted file mode 100644 index 32fd8798a3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/Pets.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * 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( - //Cats - HELL_CAT, - HELLKITTEN, - LAZY_CAT, - LAZY_CAT_6550, - LAZY_CAT_6551, - LAZY_CAT_6552, - LAZY_CAT_6553, - LAZY_CAT_6554, - LAZY_HELL_CAT, - OVERGROWN_HELLCAT, - 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, - PET_KITTEN, - PET_KITTEN_1556, - PET_KITTEN_1557, - PET_KITTEN_1558, - PET_KITTEN_1559, - PET_KITTEN_1560, - WILY_CAT, - WILY_CAT_6556, - WILY_CAT_6557, - WILY_CAT_6558, - WILY_CAT_6559, - WILY_CAT_6560, - WILY_HELLCAT, - - //ClueScroll Pets - BLOODHOUND, - - //PVM Pets - ABYSSAL_ORPHAN, - BABY_MOLE, - CALLISTO_CUB, - CORRUPTED_YOUNGLLEF, - HELLPUPPY, - IKKLE_HYDRA, - IKKLE_HYDRA_22748, - IKKLE_HYDRA_22750, - IKKLE_HYDRA_22752, - JALNIBREK, - KALPHITE_PRINCESS, - KALPHITE_PRINCESS_12654, - LIL_ZIK, - MIDNIGHT, - NOON, - OLMLET, - PET_CHAOS_ELEMENTAL, - PET_CORPOREAL_CRITTER, - PET_DAGANNOTH_PRIME, - PET_DAGANNOTH_REX, - PET_DAGANNOTH_SUPREME, - PET_DARK_CORE, - PET_GENERAL_GRAARDOR, - PET_KRAKEN, - PET_KREEARRA, - PET_KRIL_TSUTSAROTH, - PET_PENANCE_QUEEN, - PET_SMOKE_DEVIL, - PET_SMOKE_DEVIL_22663, - PET_SNAKELING, - PET_SNAKELING_12939, - PET_SNAKELING_12940, - PET_ZILYANA, - PRINCE_BLACK_DRAGON, - PUPPADILE, - SCORPIAS_OFFSPRING, - SKOTOS, - SMOLCANO, - SRARACHA, - TEKTINY, - TZREKJAD, - TZREKZUK, - VANGUARD, - VASA_MINIRIO, - VENENATIS_SPIDERLING, - VESPINA, - VETION_JR, - VETION_JR_13180, - VORKI, - YOUNGLLEF, - - //Skilling Pets - BABY_CHINCHOMPA, - BABY_CHINCHOMPA_13324, - BABY_CHINCHOMPA_13325, - BABY_CHINCHOMPA_13326, - BEAVER, - CHOMPY_CHICK, - GIANT_SQUIRREL, - HERBI, - HERON, - PHOENIX, - 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 - ); - - public static boolean isPet(int id) - { - return PETS.contains(id); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/TrueItemValue.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/TrueItemValue.java deleted file mode 100644 index 11bdcc6e01..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/TrueItemValue.java +++ /dev/null @@ -1,46 +0,0 @@ -package net.runelite.client.plugins.itemskeptondeath; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import java.util.Set; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import static net.runelite.api.ItemID.ABYSSAL_TENTACLE; -import static net.runelite.api.ItemID.ABYSSAL_WHIP; -import static net.runelite.api.ItemID.GRANITE_CLAMP; -import static net.runelite.api.ItemID.GRANITE_MAUL; -import static net.runelite.api.ItemID.GRANITE_MAUL_24225; -import static net.runelite.api.ItemID.GRANITE_MAUL_24227; -import static net.runelite.api.ItemID.KRAKEN_TENTACLE; -import static net.runelite.api.ItemID.ORNATE_MAUL_HANDLE; - -@Getter(AccessLevel.PACKAGE) -@RequiredArgsConstructor -public enum TrueItemValue -{ - GRANITE_MAUL_HANDLE(GRANITE_MAUL_24225, ImmutableSet.of(ORNATE_MAUL_HANDLE, GRANITE_MAUL)), - GRANITE_MAUL_HANDLE_OR(GRANITE_MAUL_24227, ImmutableSet.of(ORNATE_MAUL_HANDLE, GRANITE_MAUL, GRANITE_CLAMP)), - TENTACLE_WHIP(ABYSSAL_TENTACLE, ImmutableSet.of(ABYSSAL_WHIP, KRAKEN_TENTACLE)); - - private static final ImmutableMap TRUE_ITEM_VALUE_MAP; - - private final int itemID; - private final Set deconstructedItem; - - static - { - ImmutableMap.Builder map = ImmutableMap.builder(); - for (TrueItemValue p : values()) - { - map.put(p.getItemID(), p); - } - TRUE_ITEM_VALUE_MAP = map.build(); - } - - public static TrueItemValue map(int itemId) - { - return TRUE_ITEM_VALUE_MAP.getOrDefault(itemId, null); - } -} - 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 deleted file mode 100644 index 15fdd40534..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/WidgetButton.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * 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 = Math.max(maxRowItems, 1); - - 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/java/net/runelite/client/plugins/itemstats/BoostedStatBoost.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/BoostedStatBoost.java deleted file mode 100644 index 1de61aa8c2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/BoostedStatBoost.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats; - -import net.runelite.api.Client; -import net.runelite.client.plugins.itemstats.delta.DeltaCalculator; -import net.runelite.client.plugins.itemstats.stats.Stat; - -/** - * A stat boost using the current boosted (or drained) stat. - */ -public class BoostedStatBoost extends StatBoost -{ - private final DeltaCalculator deltaCalculator; - - public BoostedStatBoost(Stat stat, boolean boost, DeltaCalculator deltaCalculator) - { - super(stat, boost); - this.deltaCalculator = deltaCalculator; - } - - @Override - public int heals(Client client) - { - int value = getStat().getValue(client); - return deltaCalculator.calculateDelta(value); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/Builders.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/Builders.java deleted file mode 100644 index e5cee44b35..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/Builders.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats; - -import net.runelite.client.plugins.itemstats.delta.DeltaCalculator; -import net.runelite.client.plugins.itemstats.delta.DeltaPercentage; -import net.runelite.client.plugins.itemstats.stats.Stat; - -public class Builders -{ - public static Food food(int diff) - { - return food((max) -> diff); - } - - public static Food food(DeltaCalculator p) - { - return new Food(p); - } - - public static Effect combo(int primaries, SingleEffect... effect) - { - return new Combo(primaries, effect); - } - - public static Effect combo(SingleEffect... effect) - { - return new Combo(effect); - } - - public static SimpleStatBoost boost(Stat stat, int boost) - { - return boost(stat, (max) -> boost); - } - - public static SimpleStatBoost boost(Stat stat, DeltaCalculator p) - { - return new SimpleStatBoost(stat, true, p); - } - - public static SimpleStatBoost heal(Stat stat, int boost) - { - return heal(stat, (max) -> boost); - } - - public static SimpleStatBoost heal(Stat stat, DeltaCalculator p) - { - return new SimpleStatBoost(stat, false, p); - } - - public static SimpleStatBoost dec(Stat stat, int boost) - { - return heal(stat, -boost); - } - - public static DeltaPercentage perc(double perc, int delta) - { - return new DeltaPercentage(perc, delta); - } - - public static RangeStatBoost range(StatBoost a, StatBoost b) - { - return new RangeStatBoost(a, b); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/Combo.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/Combo.java deleted file mode 100644 index 9749f1a17b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/Combo.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats; - -import net.runelite.api.Client; - -public class Combo implements Effect -{ - private final SingleEffect[] calcs; - private final int numPrimaries; - - public Combo(SingleEffect[] calcs) - { - this(1, calcs); - } - - public Combo(int numPrimaries, SingleEffect[] calcs) - { - this.numPrimaries = numPrimaries; - this.calcs = calcs; - } - - @Override - public StatsChanges calculate(Client client) - { - StatsChanges out = new StatsChanges(calcs.length); - StatChange[] statChanges = out.getStatChanges(); - for (int i = 0; i < calcs.length; i++) - { - statChanges[i] = calcs[i].effect(client); - } - Positivity positivity = Positivity.NO_CHANGE; - for (int i = 0; i < numPrimaries; i++) - { - if (positivity.ordinal() < statChanges[i].getPositivity().ordinal()) - { - positivity = statChanges[i].getPositivity(); - } - } - out.setPositivity(positivity); - return out; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/Effect.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/Effect.java deleted file mode 100644 index d937405ed9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/Effect.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats; - -import net.runelite.api.Client; - -public interface Effect -{ - StatsChanges calculate(Client client); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/Food.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/Food.java deleted file mode 100644 index a00ad41f6c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/Food.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats; - -import net.runelite.api.Client; -import net.runelite.client.plugins.itemstats.delta.DeltaCalculator; - -public class Food extends FoodBase -{ - private final DeltaCalculator p; - - public Food(DeltaCalculator p) - { - this.p = p; - } - - @Override - public int heals(Client client) - { - return p.calculateDelta(getStat().getMaximum(client)); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/FoodBase.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/FoodBase.java deleted file mode 100644 index b8aaf11616..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/FoodBase.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats; - -import net.runelite.client.plugins.itemstats.stats.Stats; - -public abstract class FoodBase extends StatBoost -{ - protected FoodBase() - { - super(Stats.HITPOINTS, false); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChanges.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChanges.java deleted file mode 100644 index 7c59ab9c98..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChanges.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (c) 2016-2018, Adam - * 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.itemstats; - -import com.google.inject.Singleton; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import lombok.extern.slf4j.Slf4j; -import static net.runelite.api.ItemID.*; -import static net.runelite.client.plugins.itemstats.Builders.boost; -import static net.runelite.client.plugins.itemstats.Builders.combo; -import static net.runelite.client.plugins.itemstats.Builders.dec; -import static net.runelite.client.plugins.itemstats.Builders.food; -import static net.runelite.client.plugins.itemstats.Builders.heal; -import static net.runelite.client.plugins.itemstats.Builders.perc; -import static net.runelite.client.plugins.itemstats.Builders.range; -import net.runelite.client.plugins.itemstats.food.Anglerfish; -import net.runelite.client.plugins.itemstats.potions.GauntletPotion; -import net.runelite.client.plugins.itemstats.potions.PrayerPotion; -import net.runelite.client.plugins.itemstats.potions.SaradominBrew; -import net.runelite.client.plugins.itemstats.potions.SuperRestore; -import net.runelite.client.plugins.itemstats.special.CastleWarsBandage; -import net.runelite.client.plugins.itemstats.special.SpicyStew; -import static net.runelite.client.plugins.itemstats.stats.Stats.*; - -@Singleton -@Slf4j -class ItemStatChanges -{ - ItemStatChanges() - { - init(); - } - - private void init() - { - add(food(-5), POISON_KARAMBWAN); - add(food(1), POTATO, ONION, CABBAGE, POT_OF_CREAM, CHOPPED_ONION, ANCHOVIES); - add(food(2), TOMATO, CHOPPED_TOMATO, BANANA, SLICED_BANANA, ORANGE, ORANGE_SLICES, ORANGE_CHUNKS, - PINEAPPLE_RING, PINEAPPLE_CHUNKS, SPICY_SAUCE, CHEESE, SPINACH_ROLL, LEMON, LEMON_CHUNKS, LEMON_SLICES, - LIME, LIME_CHUNKS, LIME_SLICES, DWELLBERRIES); - add(food(3), SHRIMPS, COOKED_MEAT, COOKED_CHICKEN, ROE, CHOCOLATE_BAR); - add(food(4), SARDINE, CAKE, _23_CAKE, SLICE_OF_CAKE, CHOCOLATEY_MILK, BAKED_POTATO, EDIBLE_SEAWEED, MOONLIGHT_MEAD); - add(food(5), BREAD, HERRING, CHOCOLATE_CAKE, _23_CHOCOLATE_CAKE, CHOCOLATE_SLICE, COOKED_RABBIT, CHILLI_CON_CARNE, - FRIED_MUSHROOMS, FRIED_ONIONS, REDBERRY_PIE, HALF_A_REDBERRY_PIE, CAVIAR, PYSK_FISH_0); - add(food(6), CHOCICE, MACKEREL, MEAT_PIE, HALF_A_MEAT_PIE, GUANIC_BAT_0, ROAST_BIRD_MEAT, - SQUARE_SANDWICH, ROLL, BAGUETTE, TRIANGLE_SANDWICH, GIANT_CARP); - add(food(7), TROUT, COD, PLAIN_PIZZA, _12_PLAIN_PIZZA, APPLE_PIE, HALF_AN_APPLE_PIE, ROAST_RABBIT, - PREMADE_CH_CRUNCH, CHOCCHIP_CRUNCHIES, PREMADE_SY_CRUNCH, SPICY_CRUNCHIES); - add(food(8), PIKE, ROAST_BEAST_MEAT, MEAT_PIZZA, _12_MEAT_PIZZA, PREMADE_WM_CRUN, WORM_CRUNCHIES, PREMADE_TD_CRUNCH, - TOAD_CRUNCHIES, EGG_AND_TOMATO, PRAEL_BAT_1, PEACH, SUPHI_FISH_1); - add(food(9), PREMADE_P_PUNCH, PINEAPPLE_PUNCH, PREMADE_FR_BLAST, FRUIT_BLAST, SALMON, ANCHOVY_PIZZA, - _12_ANCHOVY_PIZZA); - add(food(10), TUNA, COOKED_CRAB_MEAT, CHOPPED_TUNA, COOKED_CHOMPY, FIELD_RATION); - add(food(11), RAINBOW_FISH, STEW, PINEAPPLE_PIZZA, _12_PINEAPPLE_PIZZA, COOKED_FISHCAKE, - PREMADE_VEG_BATTA, VEGETABLE_BATTA, PREMADE_WM_BATTA, WORM_BATTA, PREMADE_TD_BATTA, TOAD_BATTA, PREMADE_CT_BATTA, - CHEESETOM_BATTA, PREMADE_FRT_BATTA, FRUIT_BATTA, MUSHROOM__ONION, GIRAL_BAT_2, LAVA_EEL, LECKISH_FISH_2); - add(food(12), LOBSTER, PREMADE_WORM_HOLE, WORM_HOLE, PREMADE_VEG_BALL, VEG_BALL); - add(food(13), BASS, TUNA_AND_CORN); - add(food(14), POTATO_WITH_BUTTER, CHILLI_POTATO, SWORDFISH, PHLUXIA_BAT_3, PUMPKIN, EASTER_EGG, BRAWK_FISH_3); - add(food(15), PREMADE_TTL, TANGLED_TOADS_LEGS, PREMADE_CHOC_BOMB, CHOCOLATE_BOMB, COOKED_JUBBLY); - add(food(16), MONKFISH, POTATO_WITH_CHEESE, EGG_POTATO); - add(food(17), MYCIL_FISH_4, KRYKET_BAT_4); - add(food(18), COOKED_KARAMBWAN); - add(food(19), CURRY, UGTHANKI_KEBAB, UGTHANKI_KEBAB_1885); - add(food(20), MUSHROOM_POTATO, SHARK, ROQED_FISH_5, MURNG_BAT_5, STUFFED_SNAKE); - add(food(21), SEA_TURTLE); - add(food(22), MANTA_RAY, DARK_CRAB, TUNA_POTATO); - add(food(23), KYREN_FISH_6, PSYKK_BAT_6); - add(new Anglerfish(), ANGLERFISH); - add(food(maxHP -> (int) Math.ceil(maxHP * .06)), STRAWBERRY); - add(food(maxHP -> (int) Math.ceil(maxHP * .05)), WATERMELON_SLICE); - add(food(perc(.1, 1)), COOKED_SWEETCORN, SWEETCORN_7088 /* Bowl of cooked sweetcorn */); - add(combo(food(1), boost(DEFENCE, perc(.02, 1))), CABBAGE_1967 /* Draynor Manor */); - add(combo(2, food(8), heal(RUN_ENERGY, 5)), PAPAYA_FRUIT); - add(range(food(5), food(7)), THIN_SNAIL_MEAT); - add(range(food(7), food(9)), FAT_SNAIL_MEAT); - add(range(food(7), food(10)), SPIDER_ON_STICK_6297, SPIDER_ON_SHAFT_6299); - - // Dorgeshuun Cuisine - add(food(2), BAT_SHISH, COATED_FROGS_LEGS, FILLETS, FINGERS, FROGBURGER, FROGSPAWN_GUMBO, GREEN_GLOOP_SOUP, - GRUBS__LA_MODE, MUSHROOMS, ROAST_FROG); - add(food(3), LOACH); - add(range(food(3), food(6)), FROG_SPAWN); - add(range(food(6), food(10)), COOKED_SLIMY_EEL); - add(range(food(8), food(12)), CAVE_EEL); - add(food(10), EEL_SUSHI); - - // Alcoholic Beverages - add(combo(food(11), dec(ATTACK, 2)), JUG_OF_WINE); - add(combo(food(14), dec(ATTACK, 3)), BOTTLE_OF_WINE); - add(combo(2, food(5), boost(STRENGTH, 6), heal(ATTACK, -4)), PREMADE_WIZ_BLZD, WIZARD_BLIZZARD); - add(combo(2, food(5), boost(STRENGTH, 4), heal(ATTACK, -3)), PREMADE_SGG, SHORT_GREEN_GUY); - add(combo(2, food(5), boost(STRENGTH, 7), heal(ATTACK, -4)), PREMADE_DR_DRAGON, DRUNK_DRAGON); - add(combo(2, food(5), boost(STRENGTH, 7), heal(ATTACK, -4)), PREMADE_CHOC_SDY, CHOC_SATURDAY); - - // Sq'irk Juice - add(heal(RUN_ENERGY, 5), WINTER_SQIRKJUICE); - add(combo(heal(RUN_ENERGY, 10), boost(THIEVING, 1)), SPRING_SQIRKJUICE); - add(combo(heal(RUN_ENERGY, 15), boost(THIEVING, 2)), AUTUMN_SQIRKJUICE); - add(combo(heal(RUN_ENERGY, 20), boost(THIEVING, 3)), SUMMER_SQIRKJUICE); - - // Combat potions - add(boost(ATTACK, perc(.10, 3)), ATTACK_POTION1, ATTACK_POTION2, ATTACK_POTION3, ATTACK_POTION4); - add(boost(STRENGTH, perc(.10, 3)), STRENGTH_POTION1, STRENGTH_POTION2, STRENGTH_POTION3, STRENGTH_POTION4); - add(boost(DEFENCE, perc(.10, 3)), DEFENCE_POTION1, DEFENCE_POTION2, DEFENCE_POTION3, DEFENCE_POTION4); - add(boost(MAGIC, 4), MAGIC_POTION1, MAGIC_POTION2, MAGIC_POTION3, MAGIC_POTION4); - add(boost(RANGED, perc(.10, 4)), RANGING_POTION1, RANGING_POTION2, RANGING_POTION3, RANGING_POTION4); - add(combo(2, boost(ATTACK, perc(.10, 3)), boost(STRENGTH, perc(.10, 3))), COMBAT_POTION1, COMBAT_POTION2, COMBAT_POTION3, COMBAT_POTION4); - add(boost(ATTACK, perc(.15, 5)), SUPER_ATTACK1, SUPER_ATTACK2, SUPER_ATTACK3, SUPER_ATTACK4); - add(boost(STRENGTH, perc(.15, 5)), SUPER_STRENGTH1, SUPER_STRENGTH2, SUPER_STRENGTH3, SUPER_STRENGTH4); - add(boost(DEFENCE, perc(.15, 5)), SUPER_DEFENCE1, SUPER_DEFENCE2, SUPER_DEFENCE3, SUPER_DEFENCE4); - add(boost(MAGIC, 3), MAGIC_ESSENCE1, MAGIC_ESSENCE2, MAGIC_ESSENCE3, MAGIC_ESSENCE4); - add(combo(3, boost(ATTACK, perc(.15, 5)), boost(STRENGTH, perc(.15, 5)), boost(DEFENCE, perc(.15, 5))), SUPER_COMBAT_POTION1, SUPER_COMBAT_POTION2, SUPER_COMBAT_POTION3, SUPER_COMBAT_POTION4); - add(combo(3, boost(ATTACK, perc(.20, 2)), boost(STRENGTH, perc(.12, 2)), heal(PRAYER, perc(.10, 0)), heal(DEFENCE, perc(.10, -2)), new BoostedStatBoost(HITPOINTS, false, perc(-.12, 0))), ZAMORAK_BREW1, ZAMORAK_BREW2, ZAMORAK_BREW3, ZAMORAK_BREW4); - add(new SaradominBrew(0.15, 0.2, 0.1, 2, 2), SARADOMIN_BREW1, SARADOMIN_BREW2, SARADOMIN_BREW3, SARADOMIN_BREW4); - add(boost(RANGED, perc(.15, 5)), SUPER_RANGING_1, SUPER_RANGING_2, SUPER_RANGING_3, SUPER_RANGING_4); - add(boost(MAGIC, perc(.15, 5)), SUPER_MAGIC_POTION_1, SUPER_MAGIC_POTION_2, SUPER_MAGIC_POTION_3, SUPER_MAGIC_POTION_4); - add(combo(2, boost(RANGED, perc(0.1, 4)), boost(DEFENCE, perc(0.15, 5))), BASTION_POTION1, BASTION_POTION2, BASTION_POTION3, BASTION_POTION4); - add(combo(2, boost(MAGIC, 4), boost(DEFENCE, perc(0.15, 5))), BATTLEMAGE_POTION1, BATTLEMAGE_POTION2, BATTLEMAGE_POTION3, BATTLEMAGE_POTION4); - add(combo(boost(MAGIC, 4), heal(HITPOINTS, -10)), DIVINE_MAGIC_POTION1, DIVINE_MAGIC_POTION2, DIVINE_MAGIC_POTION3, DIVINE_MAGIC_POTION4); - add(combo(boost(RANGED, perc(.10, 4)), heal(HITPOINTS, -10)), DIVINE_RANGING_POTION1, DIVINE_RANGING_POTION2, DIVINE_RANGING_POTION3, DIVINE_RANGING_POTION4); - add(combo(boost(ATTACK, perc(.15, 5)), heal(HITPOINTS, -10)), DIVINE_SUPER_ATTACK_POTION1, DIVINE_SUPER_ATTACK_POTION2, DIVINE_SUPER_ATTACK_POTION3, DIVINE_SUPER_ATTACK_POTION4); - add(combo(boost(STRENGTH, perc(.15, 5)), heal(HITPOINTS, -10)), DIVINE_SUPER_STRENGTH_POTION1, DIVINE_SUPER_STRENGTH_POTION2, DIVINE_SUPER_STRENGTH_POTION3, DIVINE_SUPER_STRENGTH_POTION4); - add(combo(boost(DEFENCE, perc(.15, 5)), heal(HITPOINTS, -10)), DIVINE_SUPER_DEFENCE_POTION1, DIVINE_SUPER_DEFENCE_POTION2, DIVINE_SUPER_DEFENCE_POTION3, DIVINE_SUPER_DEFENCE_POTION4); - add(combo(3, boost(ATTACK, perc(.15, 5)), boost(STRENGTH, perc(.15, 5)), boost(DEFENCE, perc(.15, 5)), heal(HITPOINTS, -10)), DIVINE_SUPER_COMBAT_POTION1, DIVINE_SUPER_COMBAT_POTION2, DIVINE_SUPER_COMBAT_POTION3, DIVINE_SUPER_COMBAT_POTION4); - - // Regular overload (NMZ) - add(combo(5, boost(ATTACK, perc(.15, 5)), boost(STRENGTH, perc(.15, 5)), boost(DEFENCE, perc(.15, 5)), boost(RANGED, perc(.15, 5)), boost(MAGIC, perc(.15, 5)), heal(HITPOINTS, -50)), OVERLOAD_1, OVERLOAD_2, OVERLOAD_3, OVERLOAD_4); - - // Bandages (Castle Wars) - add(new CastleWarsBandage(), BANDAGES); - - // Recovery potions - add(combo(5, heal(ATTACK, perc(.30, 10)), heal(STRENGTH, perc(.30, 10)), heal(DEFENCE, perc(.30, 10)), heal(RANGED, perc(.30, 10)), heal(MAGIC, perc(.30, 10))), RESTORE_POTION1, RESTORE_POTION2, RESTORE_POTION3, RESTORE_POTION4); - add(heal(RUN_ENERGY, 10), ENERGY_POTION1, ENERGY_POTION2, ENERGY_POTION3, ENERGY_POTION4); - add(new PrayerPotion(7), PRAYER_POTION1, PRAYER_POTION2, PRAYER_POTION3, PRAYER_POTION4); - add(heal(RUN_ENERGY, 20), SUPER_ENERGY1, SUPER_ENERGY2, SUPER_ENERGY3, SUPER_ENERGY4); - add(new SuperRestore(.25, 8), SUPER_RESTORE1, SUPER_RESTORE2, SUPER_RESTORE3, SUPER_RESTORE4); - add(new SuperRestore(.25, 9), SANFEW_SERUM1, SANFEW_SERUM2, SANFEW_SERUM3, SANFEW_SERUM4); - add(heal(RUN_ENERGY, 20), STAMINA_POTION1, STAMINA_POTION2, STAMINA_POTION3, STAMINA_POTION4); - - // Raids potions (+) - add(combo(5, boost(ATTACK, perc(.16, 6)), boost(STRENGTH, perc(.16, 6)), boost(DEFENCE, perc(.16, 6)), boost(RANGED, perc(.16, 6)), boost(MAGIC, perc(.16, 6)), heal(HITPOINTS, -50)), OVERLOAD_1_20993, OVERLOAD_2_20994, OVERLOAD_3_20995, OVERLOAD_4_20996); - add(combo(3, boost(ATTACK, perc(.16, 6)), boost(STRENGTH, perc(.16, 6)), boost(DEFENCE, perc(.16, 6))), ELDER_1_20921, ELDER_2_20922, ELDER_3_20923, ELDER_4_20924); - add(combo(2, boost(RANGED, perc(.16, 6)), boost(DEFENCE, perc(.16, 6))), TWISTED_1_20933, TWISTED_2_20934, TWISTED_3_20935, TWISTED_4_20936); - add(combo(2, boost(MAGIC, perc(.16, 6)), boost(DEFENCE, perc(.16, 6))), KODAI_1_20945, KODAI_2_20946, KODAI_3_20947, KODAI_4_20948); - add(new SuperRestore(.30, 11), REVITALISATION_1_20957, REVITALISATION_2_20958, REVITALISATION_3_20959, REVITALISATION_4_20960); - add(new SaradominBrew(0.15, 0.2, 0.1, 5, 4), XERICS_AID_1_20981, XERICS_AID_2_20982, XERICS_AID_3_20983, XERICS_AID_4_20984); - - // Raids potions - add(combo(5, boost(ATTACK, perc(.13, 5)), boost(STRENGTH, perc(.13, 5)), boost(DEFENCE, perc(.13, 5)), boost(RANGED, perc(.13, 5)), boost(MAGIC, perc(.13, 5)), heal(HITPOINTS, -50)), OVERLOAD_1_20989, OVERLOAD_2_20990, OVERLOAD_3_20991, OVERLOAD_4_20992); - add(combo(3, boost(ATTACK, perc(.13, 5)), boost(STRENGTH, perc(.13, 5)), boost(DEFENCE, perc(.13, 5))), ELDER_POTION_1, ELDER_POTION_2, ELDER_POTION_3, ELDER_POTION_4); - add(combo(2, boost(RANGED, perc(.13, 5)), boost(DEFENCE, perc(.13, 5))), TWISTED_POTION_1, TWISTED_POTION_2, TWISTED_POTION_3, TWISTED_POTION_4); - add(combo(2, boost(MAGIC, perc(.13, 5)), boost(DEFENCE, perc(.13, 5))), KODAI_POTION_1, KODAI_POTION_2, KODAI_POTION_3, KODAI_POTION_4); - - // Raids potions (-) - add(combo(5, boost(ATTACK, perc(.10, 4)), boost(STRENGTH, perc(.10, 4)), boost(DEFENCE, perc(.10, 4)), boost(RANGED, perc(.10, 4)), boost(MAGIC, perc(.10, 4)), heal(HITPOINTS, -50)), OVERLOAD_1_20985, OVERLOAD_2_20986, OVERLOAD_3_20987, OVERLOAD_4_20988); - add(combo(3, boost(ATTACK, perc(.10, 4)), boost(STRENGTH, perc(.10, 4)), boost(DEFENCE, perc(.10, 4))), ELDER_1, ELDER_2, ELDER_3, ELDER_4); - add(combo(3, boost(RANGED, perc(.10, 4)), boost(DEFENCE, perc(.10, 4))), TWISTED_1, TWISTED_2, TWISTED_3, TWISTED_4); - add(combo(3, boost(MAGIC, perc(.10, 4)), boost(DEFENCE, perc(.10, 4))), KODAI_1, KODAI_2, KODAI_3, KODAI_4); - - // Skill potions - add(boost(AGILITY, 3), AGILITY_POTION1, AGILITY_POTION2, AGILITY_POTION3, AGILITY_POTION4); - add(boost(FISHING, 3), FISHING_POTION1, FISHING_POTION2, FISHING_POTION3, FISHING_POTION4); - add(boost(HUNTER, 3), HUNTER_POTION1, HUNTER_POTION2, HUNTER_POTION3, HUNTER_POTION4); - add(combo(2, boost(HITPOINTS, 5), heal(RUN_ENERGY, 5)), GUTHIX_REST1, GUTHIX_REST2, GUTHIX_REST3, GUTHIX_REST4); - - // Misc/run energy - add(combo(food(3), range(heal(RUN_ENERGY, 5), heal(RUN_ENERGY, 10))), WHITE_TREE_FRUIT); - add(heal(RUN_ENERGY, 30), STRANGE_FRUIT); - add(heal(RUN_ENERGY, 50), MINT_CAKE); - add(combo(food(12), heal(RUN_ENERGY, 50)), GOUT_TUBER); - - // Pies - add(combo(2, heal(HITPOINTS, 6), boost(FARMING, 3)), GARDEN_PIE, HALF_A_GARDEN_PIE); - add(combo(2, heal(HITPOINTS, 6), boost(FISHING, 3)), FISH_PIE, HALF_A_FISH_PIE); - add(combo(2, heal(HITPOINTS, 7), boost(HERBLORE, 4)), BOTANICAL_PIE, HALF_A_BOTANICAL_PIE); - add(combo(2, heal(HITPOINTS, 8), boost(CRAFTING, 4)), MUSHROOM_PIE, HALF_A_MUSHROOM_PIE); - add(combo(2, heal(HITPOINTS, 8), boost(FISHING, 5)), ADMIRAL_PIE, HALF_AN_ADMIRAL_PIE); - add(combo(2, heal(HITPOINTS, 11), boost(SLAYER, 5), boost(RANGED, 4)), WILD_PIE, HALF_A_WILD_PIE); - add(combo(2, heal(HITPOINTS, 11), boost(AGILITY, 5), heal(RUN_ENERGY, 10)), SUMMER_PIE, HALF_A_SUMMER_PIE); - - // Other - add(combo(range(food(1), food(3)), heal(RUN_ENERGY, 10)), PURPLE_SWEETS_10476); - add(new SpicyStew(), SPICY_STEW); - add(boost(MAGIC, perc(.10, 1)), IMBUED_HEART); - add(combo(boost(ATTACK, 2), boost(STRENGTH, 1), heal(DEFENCE, -1)), JANGERBERRIES); - - // Gauntlet items - add(heal(HITPOINTS, 20), PADDLEFISH); - add(new GauntletPotion(), EGNIOL_POTION_1, EGNIOL_POTION_2, EGNIOL_POTION_3, EGNIOL_POTION_4); - - log.debug("{} items; {} behaviours loaded", effects.size(), new HashSet<>(effects.values()).size()); - } - - private final Map effects = new HashMap<>(); - - private void add(Effect effect, int... items) - { - assert items.length > 0; - for (int item : items) - { - Effect prev = effects.put(item, effect); - assert prev == null : "Item already added"; - } - } - - public Effect get(int id) - { - return effects.get(id); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChangesService.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChangesService.java deleted file mode 100644 index 1189b83be1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChangesService.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2018, Jos - * 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.itemstats; - -public interface ItemStatChangesService -{ - /** - * Get the item stat value - * - * @return ItemStatChanges - */ - Effect getItemStatChanges(int id); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChangesServiceImpl.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChangesServiceImpl.java deleted file mode 100644 index 80ce669e6c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatChangesServiceImpl.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2018, Jos - * 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.itemstats; - -import javax.inject.Inject; -import javax.inject.Singleton; - -@Singleton -class ItemStatChangesServiceImpl implements ItemStatChangesService -{ - private final ItemStatChanges itemstatchanges; - - @Inject - private ItemStatChangesServiceImpl(ItemStatChanges itemstatchanges) - { - this.itemstatchanges = itemstatchanges; - } - - @Override - public Effect getItemStatChanges(int id) - { - return itemstatchanges.get(id); - } -} 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 deleted file mode 100644 index 1bf4c37222..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatConfig.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * 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.itemstats; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("itemstat") -public interface ItemStatConfig extends Config -{ - @ConfigItem( - keyName = "consumableStats", - name = "Enable consumable stats", - description = "Enables tooltips for consumable items (food, boosts)" - ) - default boolean consumableStats() - { - return true; - } - - @ConfigItem( - keyName = "equipmentStats", - name = "Enable equipment stats", - description = "Enables tooltips for equipment items (combat bonuses, weight, prayer bonuses)" - ) - default boolean equipmentStats() - { - return true; - } - - @ConfigItem( - keyName = "geStats", - name = "Enable GE item information", - description = "Shows an item information panel when buying items in the GE" - ) - default boolean geStats() - { - return true; - } - - @ConfigItem( - keyName = "relative", - name = "Show Relative", - description = "Show relative stat change in tooltip" - ) - default boolean relative() - { - return true; - } - - @ConfigItem( - keyName = "absolute", - name = "Show Absolute", - description = "Show absolute stat change in tooltip" - ) - default boolean absolute() - { - return true; - } - - @ConfigItem( - keyName = "theoretical", - name = "Show Theoretical", - description = "Show theoretical stat change in tooltip" - ) - default boolean theoretical() - { - return false; - } - - @ConfigItem( - keyName = "showWeight", - name = "Show Weight", - description = "Show weight in tooltip" - ) - default boolean showWeight() - { - return true; - } - - @ConfigItem( - keyName = "colorBetterUncapped", - name = "Better (Uncapped)", - description = "Color to show when the stat change is fully consumed", - position = 10 - ) - default Color colorBetterUncapped() - { - return new Color(0x33EE33); - } - - @ConfigItem( - keyName = "colorBetterSomecapped", - name = "Better (Some capped)", - description = "Color to show when some stat changes are capped, but some ar not", - position = 11 - ) - default Color colorBetterSomeCapped() - { - return new Color(0x9CEE33); - } - - - @ConfigItem( - keyName = "colorBetterCapped", - name = "Better (Capped)", - description = "Color to show when the stat change is positive, but not fully consumed", - position = 12 - ) - default Color colorBetterCapped() - { - return new Color(0xEEEE33); - } - - @ConfigItem( - keyName = "colorNoChange", - name = "No change", - description = "Color to show when there is no change", - position = 13 - ) - default Color colorNoChange() - { - return new Color(0xEEEEEE); - } - - @ConfigItem( - keyName = "colorWorse", - name = "Worse", - description = "Color to show when the stat goes down", - position = 14 - ) - default Color colorWorse() - { - return new Color(0xEE3333); - } -} 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 deleted file mode 100644 index a9a3c766ee..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatOverlay.java +++ /dev/null @@ -1,295 +0,0 @@ -/* - * 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.itemstats; - -import com.google.inject.Inject; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import net.runelite.api.Client; -import net.runelite.api.EquipmentInventorySlot; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.MenuEntry; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.JagexColors; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.tooltip.Tooltip; -import net.runelite.client.ui.overlay.tooltip.TooltipManager; -import net.runelite.client.util.ColorUtil; -import net.runelite.http.api.item.ItemEquipmentStats; -import net.runelite.http.api.item.ItemStats; - -public class ItemStatOverlay extends Overlay -{ - // Unarmed attack speed is 6 - private static final ItemStats UNARMED = new ItemStats(false, true, 0, - ItemEquipmentStats.builder() - .aspeed(6) - .build()); - - private final Client client; - private final ItemManager itemManager; - private final TooltipManager tooltipManager; - private final ItemStatChanges statChanges; - private final ItemStatPlugin plugin; - - @Inject - ItemStatOverlay(Client client, ItemStatPlugin plugin, ItemManager itemManager, TooltipManager tooltipManager, ItemStatChanges itemStatChanges) - { - this.client = client; - this.itemManager = itemManager; - this.tooltipManager = tooltipManager; - this.statChanges = itemStatChanges; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (client.isMenuOpen() || (!plugin.isRelative() && !plugin.isAbsolute() && !plugin.isTheoretical())) - { - return null; - } - - final MenuEntry[] menu = client.getMenuEntries(); - final int menuSize = menu.length; - - if (menuSize <= 0) - { - return null; - } - - final MenuEntry entry = menu[menuSize - 1]; - final int group = WidgetInfo.TO_GROUP(entry.getParam1()); - final int child = WidgetInfo.TO_CHILD(entry.getParam1()); - final Widget widget = client.getWidget(group, child); - - if (widget == null || (group != WidgetInfo.INVENTORY.getGroupId() && - group != WidgetInfo.EQUIPMENT.getGroupId() && - group != WidgetInfo.EQUIPMENT_INVENTORY_ITEMS_CONTAINER.getGroupId())) - { - return null; - } - - int itemId = entry.getIdentifier(); - - if (group == WidgetInfo.EQUIPMENT.getGroupId()) - { - final Widget widgetItem = widget.getChild(1); - if (widgetItem != null) - { - itemId = widgetItem.getItemId(); - } - } - else if (group == WidgetInfo.EQUIPMENT_INVENTORY_ITEMS_CONTAINER.getGroupId()) - { - final Widget widgetItem = widget.getChild(entry.getParam0()); - if (widgetItem != null) - { - itemId = widgetItem.getItemId(); - } - } - - if (plugin.isConsumableStats()) - { - final Effect change = statChanges.get(itemId); - if (change != null) - { - final StringBuilder b = new StringBuilder(); - final StatsChanges statsChanges = change.calculate(client); - - for (final StatChange c : statsChanges.getStatChanges()) - { - b.append(buildStatChangeString(c)); - } - - final String tooltip = b.toString(); - - if (!tooltip.isEmpty()) - { - tooltipManager.add(new Tooltip(tooltip)); - } - } - } - - if (plugin.isEquipmentStats()) - { - final ItemStats stats = itemManager.getItemStats(itemId, false); - - if (stats != null) - { - final String tooltip = buildStatBonusString(stats); - - if (!tooltip.isEmpty()) - { - tooltipManager.add(new Tooltip(tooltip)); - } - } - } - - return null; - } - - private String getChangeString( - final String label, - final double value, - final boolean inverse, - final boolean showPercent) - { - final Color plus = Positivity.getColor(plugin, Positivity.BETTER_UNCAPPED); - final Color minus = Positivity.getColor(plugin, Positivity.WORSE); - - if (value == 0) - { - return ""; - } - - final Color color; - - if (inverse) - { - color = value > 0 ? minus : plus; - } - else - { - color = value > 0 ? plus : minus; - } - - final String prefix = value > 0 ? "+" : ""; - final String suffix = showPercent ? "%" : ""; - final String valueString = (int) value == value ? String.valueOf((int) value) : String.valueOf(value); - return label + ": " + ColorUtil.wrapWithColorTag(prefix + valueString + suffix, color) + "
"; - } - - private String buildStatBonusString(ItemStats s) - { - final StringBuilder b = new StringBuilder(); - if (plugin.isShowWeight()) - { - b.append(getChangeString("Weight", s.getWeight(), true, false)); - } - - ItemStats other = null; - final ItemEquipmentStats currentEquipment = s.getEquipment(); - - ItemContainer c = client.getItemContainer(InventoryID.EQUIPMENT); - if (s.isEquipable() && currentEquipment != null && c != null) - { - final Item[] items = c.getItems(); - final int slot = currentEquipment.getSlot(); - - if (slot != -1 && slot < items.length) - { - final Item item = items[slot]; - if (item != null) - { - other = itemManager.getItemStats(item.getId(), false); - } - } - - if (other == null && slot == EquipmentInventorySlot.WEAPON.getSlotIdx()) - { - // Unarmed - other = UNARMED; - } - } - - final ItemStats subtracted = s.subtract(other); - final ItemEquipmentStats e = subtracted.getEquipment(); - - if (subtracted.isEquipable() && e != null) - { - b.append(getChangeString("Prayer", e.getPrayer(), false, false)); - b.append(getChangeString("Speed", e.getAspeed(), true, false)); - b.append(getChangeString("Melee Str", e.getStr(), false, false)); - b.append(getChangeString("Range Str", e.getRstr(), false, false)); - b.append(getChangeString("Magic Dmg", e.getMdmg(), false, true)); - - if (e.getAstab() != 0 || e.getAslash() != 0 || e.getAcrush() != 0 || e.getAmagic() != 0 || e.getArange() != 0) - { - b.append(ColorUtil.wrapWithColorTag("Attack Bonus
", JagexColors.MENU_TARGET)); - b.append(getChangeString("Stab", e.getAstab(), false, false)); - b.append(getChangeString("Slash", e.getAslash(), false, false)); - b.append(getChangeString("Crush", e.getAcrush(), false, false)); - b.append(getChangeString("Magic", e.getAmagic(), false, false)); - b.append(getChangeString("Range", e.getArange(), false, false)); - } - - if (e.getDstab() != 0 || e.getDslash() != 0 || e.getDcrush() != 0 || e.getDmagic() != 0 || e.getDrange() != 0) - { - b.append(ColorUtil.wrapWithColorTag("Defence Bonus
", JagexColors.MENU_TARGET)); - b.append(getChangeString("Stab", e.getDstab(), false, false)); - b.append(getChangeString("Slash", e.getDslash(), false, false)); - b.append(getChangeString("Crush", e.getDcrush(), false, false)); - b.append(getChangeString("Magic", e.getDmagic(), false, false)); - b.append(getChangeString("Range", e.getDrange(), false, false)); - } - } - - return b.toString(); - } - - private String buildStatChangeString(StatChange c) - { - StringBuilder b = new StringBuilder(); - b.append(ColorUtil.colorTag(Positivity.getColor(plugin, c.getPositivity()))); - - if (plugin.isRelative()) - { - b.append(c.getFormattedRelative()); - } - - if (plugin.isTheoretical()) - { - if (plugin.isRelative()) - { - b.append("/"); - } - b.append(c.getFormattedTheoretical()); - } - - if (plugin.isAbsolute() && (plugin.isRelative() || plugin.isTheoretical())) - { - b.append(" ("); - } - if (plugin.isAbsolute()) - { - b.append(c.getAbsolute()); - } - - if (plugin.isAbsolute() && (plugin.isRelative() || plugin.isTheoretical())) - { - b.append(")"); - } - b.append(" ").append(c.getStat().getName()); - b.append("
"); - - return b.toString(); - } -} 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 deleted file mode 100644 index 04faa57ec4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java +++ /dev/null @@ -1,482 +0,0 @@ -/* - * 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.itemstats; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.inject.Binder; -import com.google.inject.Inject; -import com.google.inject.Provides; -import java.awt.Color; -import java.awt.FontMetrics; -import java.util.List; -import java.util.Map; -import java.util.Set; -import lombok.AccessLevel; -import lombok.Getter; -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.ItemContainer; -import net.runelite.api.ItemID; -import net.runelite.api.SpriteID; -import net.runelite.api.VarPlayer; -import net.runelite.api.Varbits; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.widgets.JavaScriptCallback; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.api.widgets.WidgetTextAlignment; -import net.runelite.api.widgets.WidgetType; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.JagexColors; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.util.QuantityFormatter; -import net.runelite.http.api.item.ItemEquipmentStats; -import net.runelite.http.api.item.ItemStats; - -@PluginDescriptor( - name = "Item Stats", - description = "Show information about food and potion effects", - tags = {"food", "inventory", "overlay", "potion"}, - type = PluginType.UTILITY -) -public class ItemStatPlugin extends Plugin -{ - private static final int ORANGE_TEXT = JagexColors.DARK_ORANGE_INTERFACE_TEXT.getRGB(); - private static final int YELLOW_TEXT = JagexColors.YELLOW_INTERFACE_TEXT.getRGB(); - private static final int TEXT_HEIGHT = 11; - - @Inject - private OverlayManager overlayManager; - - @Inject - private ItemStatOverlay overlay; - - @Inject - private Client client; - - @Inject - private ItemManager itemManager; - - @Inject - private ItemStatConfig config; - - @Inject - private ClientThread clientThread; - - private Widget itemInformationTitle; - - @Getter(AccessLevel.PACKAGE) - private boolean consumableStats; - @Getter(AccessLevel.PACKAGE) - private boolean equipmentStats; - private boolean geStats; - @Getter(AccessLevel.PACKAGE) - private boolean relative; - @Getter(AccessLevel.PACKAGE) - private boolean absolute; - @Getter(AccessLevel.PACKAGE) - private boolean theoretical; - @Getter(AccessLevel.PACKAGE) - private boolean showWeight; - @Getter(AccessLevel.PACKAGE) - private Color colorBetterUncapped; - @Getter(AccessLevel.PACKAGE) - private Color colorBetterSomeCapped; - @Getter(AccessLevel.PACKAGE) - private Color colorBetterCapped; - @Getter(AccessLevel.PACKAGE) - private Color colorNoChange; - @Getter(AccessLevel.PACKAGE) - private Color colorWorse; - - @Provides - ItemStatConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(ItemStatConfig.class); - } - - @Override - public void configure(Binder binder) - { - binder.bind(ItemStatChangesService.class).to(ItemStatChangesServiceImpl.class); - } - - @Override - protected void startUp() - { - updateConfig(); - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - clientThread.invokeLater(this::resetGEInventory); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getKey().equals("geStats")) - { - updateConfig(); - clientThread.invokeLater(this::resetGEInventory); - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - if (itemInformationTitle != null && this.geStats - && (client.getWidget(WidgetInfo.GRAND_EXCHANGE_WINDOW_CONTAINER) == null - || client.getWidget(WidgetInfo.GRAND_EXCHANGE_WINDOW_CONTAINER).isHidden())) - { - resetGEInventory(); - } - } - - - @Subscribe - private void onVarbitChanged(VarbitChanged event) - { - if (client.getVar(VarPlayer.CURRENT_GE_ITEM) == -1 && this.geStats) - { - resetGEInventory(); - } - } - - @Subscribe - private void onScriptCallbackEvent(ScriptCallbackEvent event) - { - if (event.getEventName().equals("geBuilt") && this.geStats) - { - int currentGeItem = client.getVar(VarPlayer.CURRENT_GE_ITEM); - if (currentGeItem != -1 && client.getVar(Varbits.GE_OFFER_CREATION_TYPE) == 0) - { - createItemInformation(currentGeItem); - } - } - } - - private void createItemInformation(int id) - { - final ItemStats itemStats = itemManager.getItemStats(id, false); - - if (itemStats == null || !itemStats.isEquipable()) - { - return; - } - - final ItemEquipmentStats equipmentStats = itemStats.getEquipment(); - - if (equipmentStats == null) - { - return; - } - - final Widget geInv = client.getWidget(WidgetInfo.GRAND_EXCHANGE_INVENTORY_ITEMS_CONTAINER); - - if (geInv == null) - { - return; - } - - final Widget invContainer = getInventoryContainer(); - - if (invContainer == null) - { - return; - } - - invContainer.deleteAllChildren(); - geInv.setHidden(true); - - int yPos = 0; - - final FontMetrics smallFM = client.getCanvas().getFontMetrics(FontManager.getRunescapeSmallFont()); - - // HEADER - - itemInformationTitle = createText(invContainer, "Item Information", FontID.BOLD_12, ORANGE_TEXT, - 8, 8, invContainer.getWidth(), 16); - itemInformationTitle.setYTextAlignment(WidgetTextAlignment.CENTER); - - Widget closeButton = invContainer.createChild(-1, WidgetType.GRAPHIC); - closeButton.setOriginalY(8); - closeButton.setOriginalX(invContainer.getWidth() - 24); - closeButton.setOriginalHeight(16); - closeButton.setOriginalWidth(16); - closeButton.setSpriteId(SpriteID.BOTTOM_LINE_MODE_WINDOW_CLOSE_BUTTON_SMALL); - closeButton.setAction(0, "Close"); - closeButton.setOnMouseOverListener((JavaScriptCallback) (ev) -> - closeButton.setSpriteId(SpriteID.BOTTOM_LINE_MODE_WINDOW_CLOSE_BUTTON_SMALL_HOVERED)); - closeButton.setOnMouseLeaveListener((JavaScriptCallback) (ev) -> - closeButton.setSpriteId(SpriteID.BOTTOM_LINE_MODE_WINDOW_CLOSE_BUTTON_SMALL)); - closeButton.setOnOpListener((JavaScriptCallback) (ev) -> resetGEInventory()); - closeButton.setHasListener(true); - closeButton.revalidate(); - - yPos += 15; - - createSeparator(invContainer, yPos); - - // ICON AND TITLE - - yPos += 25; - - Widget icon = invContainer.createChild(-1, WidgetType.GRAPHIC); - icon.setOriginalX(8); - icon.setOriginalY(yPos); - icon.setOriginalWidth(Constants.ITEM_SPRITE_WIDTH); - icon.setOriginalHeight(Constants.ITEM_SPRITE_HEIGHT); - icon.setItemId(id); - icon.setItemQuantityMode(0); - icon.setBorderType(1); - icon.revalidate(); - - Widget itemName = createText(invContainer, itemManager.getItemDefinition(id).getName(), FontID.PLAIN_12, ORANGE_TEXT, - 50, yPos, invContainer.getWidth() - 40, 30); - itemName.setYTextAlignment(WidgetTextAlignment.CENTER); - - yPos += 20; - - createSeparator(invContainer, yPos); - - // STATS HEADER - - yPos += 25; - - createText(invContainer, "Attack", FontID.PLAIN_11, ORANGE_TEXT, 5, yPos, 50, -1); - - int defenceXPos = invContainer.getWidth() - (smallFM.stringWidth("Defence") + 5); - createText(invContainer, "Defence", FontID.PLAIN_11, ORANGE_TEXT, defenceXPos, yPos, 50, -1); - - // STYLE BONUSES - - final Set stats = ImmutableSet.of( - "Stab", - "Slash", - "Crush", - "Magic", - "Ranged" - ); - - final List attackStats = ImmutableList.of( - equipmentStats.getAstab(), - equipmentStats.getAslash(), - equipmentStats.getAcrush(), - equipmentStats.getAmagic(), - equipmentStats.getArange() - ); - - final List defenceStats = ImmutableList.of( - equipmentStats.getDstab(), - equipmentStats.getDslash(), - equipmentStats.getDcrush(), - equipmentStats.getDmagic(), - equipmentStats.getDrange() - ); - - int index = 0; - - for (final String stat : stats) - { - yPos += TEXT_HEIGHT + 2; - - // Style label - final Widget styleText = createText(invContainer, stat, FontID.PLAIN_11, ORANGE_TEXT, - 0, yPos, invContainer.getWidth(), -1); - styleText.setXTextAlignment(WidgetTextAlignment.CENTER); - - // Attack bonus - createText(invContainer, attackStats.get(index).toString(), FontID.PLAIN_11, YELLOW_TEXT, - 5, yPos, 50, -1); - - // Defence bonus - final int defenceX = invContainer.getWidth() - (smallFM.stringWidth(defenceStats.get(index).toString()) + 5); - createText(invContainer, defenceStats.get(index).toString(), FontID.PLAIN_11, YELLOW_TEXT, - defenceX, yPos, 50, -1); - - index++; - } - - // MISC BONUSES - - yPos += TEXT_HEIGHT + 8; - - final Map miscStats = ImmutableMap.of( - "Strength", equipmentStats.getStr(), - "Ranged Strength", equipmentStats.getRstr(), - "Magic Damage", equipmentStats.getMdmg(), - "Prayer Bonus", equipmentStats.getPrayer() - ); - - for (final Map.Entry miscStat : miscStats.entrySet()) - { - final String name = miscStat.getKey(); - final String value = miscStat.getValue().toString(); - - // Stat label - createText(invContainer, name, FontID.PLAIN_11, ORANGE_TEXT, 5, yPos, 50, -1); - - // Stat bonus - int valueXPos = invContainer.getWidth() - (smallFM.stringWidth(value) + 5); - createText(invContainer, value, FontID.PLAIN_11, YELLOW_TEXT, valueXPos, yPos, 50, -1); - - yPos += TEXT_HEIGHT + 2; - } - - // COINS - - createSeparator(invContainer, invContainer.getHeight() - 40); - - final String coinText = "You have " + QuantityFormatter.quantityToStackSize(getCurrentGP()) - + (getCurrentGP() == 1 ? " coin." : " coins."); - - final Widget coinWidget = createText(invContainer, coinText, FontID.PLAIN_12, ORANGE_TEXT, - 0, invContainer.getHeight() - 18, invContainer.getWidth(), -1); - - coinWidget.setXTextAlignment(WidgetTextAlignment.CENTER); - } - - private static Widget createText(Widget parent, String text, int fontId, int textColor, - int x, int y, int width, int height) - { - final Widget widget = parent.createChild(-1, WidgetType.TEXT); - widget.setText(text); - widget.setFontId(fontId); - widget.setTextColor(textColor); - widget.setTextShadowed(true); - widget.setOriginalHeight(height == -1 ? TEXT_HEIGHT : height); - widget.setOriginalWidth(width); - widget.setOriginalY(y); - widget.setOriginalX(x); - widget.revalidate(); - return widget; - } - - private static void createSeparator(Widget parent, int y) - { - Widget separator = parent.createChild(-1, WidgetType.GRAPHIC); - separator.setOriginalWidth(parent.getWidth()); - separator.setOriginalY(y); - separator.setOriginalHeight(32); - separator.setSpriteId(SpriteID.UNKNOWN_BORDER_EDGE_HORIZONTAL_995); - separator.revalidate(); - } - - private void resetGEInventory() - { - final Widget invContainer = getInventoryContainer(); - - if (invContainer == null) - { - return; - } - - if (itemInformationTitle != null && invContainer.getChild(0) == itemInformationTitle) - { - invContainer.deleteAllChildren(); - itemInformationTitle = null; - } - - final Widget geInv = client.getWidget(WidgetInfo.GRAND_EXCHANGE_INVENTORY_ITEMS_CONTAINER); - if (geInv != null) - { - geInv.setHidden(false); - } - } - - private int getCurrentGP() - { - final ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); - - if (inventory == null) - { - return 0; - } - - for (final Item item : inventory.getItems()) - { - if (item.getId() == ItemID.COINS_995) - { - return item.getQuantity(); - } - } - - return 0; - } - - private Widget getInventoryContainer() - { - if (client.isResized()) - { - if (client.getVar(Varbits.SIDE_PANELS) == 1) - { - return client.getWidget(WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_CONTAINER); - } - else - { - return client.getWidget(WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_CONTAINER); - } - } - else - { - return client.getWidget(WidgetInfo.FIXED_VIEWPORT_INVENTORY_CONTAINER); - } - } - - private void updateConfig() - { - this.consumableStats = config.consumableStats(); - this.equipmentStats = config.equipmentStats(); - this.geStats = config.geStats(); - this.relative = config.relative(); - this.absolute = config.absolute(); - this.theoretical = config.theoretical(); - this.showWeight = config.showWeight(); - this.colorBetterUncapped = config.colorBetterUncapped(); - this.colorBetterSomeCapped = config.colorBetterSomeCapped(); - this.colorBetterCapped = config.colorBetterCapped(); - this.colorNoChange = config.colorNoChange(); - this.colorWorse = config.colorWorse(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/Positivity.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/Positivity.java deleted file mode 100644 index ea83360a9b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/Positivity.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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.itemstats; - -import java.awt.Color; - -/** - * Positivity represents how positive or negative a stat change is. This is - * turned into the color shown to the user in the toolip. - */ -public enum Positivity -{ - /** - * The stat is lower than it was before. - */ - WORSE, - /** - * There is no change, ie: The stat is already capped. - */ - NO_CHANGE, - /** - * The stat change goes over the cap, but does not net 0 - */ - BETTER_CAPPED, - /** - * Some stat changes were fully consumed, some were not. This should NOT - * be returned by a single stat change. This should only be used by a - * StatChangeCalculator - */ - BETTER_SOMECAPPED, - /** - * The stat change is fully consumed. NB: a boost that hits the cap, but - * does not go over it is still considered BETTER_UNCAPPED - */ - BETTER_UNCAPPED; - - public static Color getColor(ItemStatPlugin plugin, Positivity positivity) - { - switch (positivity) - { - case BETTER_UNCAPPED: - return plugin.getColorBetterUncapped(); - case BETTER_SOMECAPPED: - return plugin.getColorBetterSomeCapped(); - case BETTER_CAPPED: - return plugin.getColorBetterCapped(); - case NO_CHANGE: - return plugin.getColorNoChange(); - case WORSE: - return plugin.getColorWorse(); - default: - return Color.WHITE; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/RangeStatBoost.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/RangeStatBoost.java deleted file mode 100644 index 13011b9f6a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/RangeStatBoost.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.itemstats; - -import net.runelite.api.Client; - -public class RangeStatBoost extends SingleEffect -{ - private final StatBoost a; - private final StatBoost b; - - RangeStatBoost(StatBoost a, StatBoost b) - { - assert a.getStat() == b.getStat(); - - this.a = a; - this.b = b; - } - - @Override - public StatChange effect(Client client) - { - final StatChange changeA = this.a.effect(client); - final StatChange changeB = this.b.effect(client); - - final RangeStatChange r = new RangeStatChange(); - r.setMinAbsolute(Math.min(changeA.getAbsolute(), changeB.getAbsolute())); - r.setAbsolute(Math.max(changeA.getAbsolute(), changeB.getAbsolute())); - r.setMinRelative(Math.min(changeA.getRelative(), changeB.getRelative())); - r.setRelative(Math.max(changeA.getRelative(), changeB.getRelative())); - r.setMinTheoretical(Math.min(changeA.getTheoretical(), changeB.getTheoretical())); - r.setTheoretical(Math.max(changeA.getTheoretical(), changeB.getTheoretical())); - r.setStat(changeA.getStat()); - - final int avg = (changeA.getPositivity().ordinal() + changeB.getPositivity().ordinal()) / 2; - r.setPositivity(Positivity.values()[avg]); - - return r; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/RangeStatChange.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/RangeStatChange.java deleted file mode 100644 index 90b614bf10..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/RangeStatChange.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2016-2019, 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.itemstats; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * A stat change which can result in different magnitudes of change to the stat - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class RangeStatChange extends StatChange -{ - /** - * Minimum relative change that will occur if the stat boost is applied now. - * In this class, {@code relative} is representative of the maximum relative change that will - * occur. - */ - private int minRelative; - - /** - * Minimum theoretical change that can occur before boost cap is enforced. - * In this class, {@code theoretical} is representative of the maximum theoretical change that - * will occur. - */ - private int minTheoretical; - - /** - * Minimum absolute total of the stat after applying the boost. - * In this class, {@code absolute} is representative of the maximum absolute change that will - * occur. - */ - private int minAbsolute; - - /** - * Returns a human-readable formatted relative boost. - * Should be the boost range in the format "±N" (for minimum -N and maximum +N values), - * "+MIN~MAX" (for minimum and maximum values of the same sign), - * "-MIN~+MAX" (for negative minimum and positive maximum values), or - * "+MAX" (for equal minimum and maximum values). - * - * @return The formatted relative boost amount - */ - @Override - public String getFormattedRelative() - { - return concat(minRelative, getRelative()); - } - - /** - * Returns a human-readable formatted theoretical boost. - * Should be the boost range in the format "±N" (for minimum -N and maximum +N values), - * "+MIN~MAX" (for minimum and maximum values of the same sign), - * "-MIN~+MAX" (for negative minimum and positive maximum values), or - * "+MAX" (for equal minimum and maximum values). - * - * @return The formatted theoretical boost amount - */ - @Override - public String getFormattedTheoretical() - { - return concat(minTheoretical, getTheoretical()); - } - - private static String concat(int changeA, int changeB) - { - if (changeA == changeB) - { - return formatBoost(changeA); - } - else if (changeA * -1 == changeB) - { - return "±" + Math.abs(changeA); - } - - final StringBuilder sb = new StringBuilder(); - - sb.append(String.format("%+d", changeA)); - sb.append('~'); - - // If they share a operator, strip b's duplicate - if (changeA < 0 && changeB < 0 - || changeA >= 0 && changeB >= 0) - { - sb.append(Math.abs(changeB)); - } - else - { - sb.append(String.format("%+d", changeB)); - } - - return sb.toString(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/SimpleStatBoost.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/SimpleStatBoost.java deleted file mode 100644 index 3b6eccd4f8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/SimpleStatBoost.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats; - -import net.runelite.api.Client; -import net.runelite.client.plugins.itemstats.delta.DeltaCalculator; -import net.runelite.client.plugins.itemstats.stats.Stat; - -/** - * A stat boost using the real stat level. Eg, non-boosted. - */ -public class SimpleStatBoost extends StatBoost -{ - private final DeltaCalculator deltaCalculator; - - public SimpleStatBoost(Stat stat, boolean boost, DeltaCalculator deltaCalculator) - { - super(stat, boost); - this.deltaCalculator = deltaCalculator; - } - - @Override - public int heals(Client client) - { - int max = getStat().getMaximum(client); - return deltaCalculator.calculateDelta(max); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/SingleEffect.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/SingleEffect.java deleted file mode 100644 index 31059ac1b9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/SingleEffect.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats; - -import net.runelite.api.Client; - -public abstract class SingleEffect implements Effect -{ - @Override - public final StatsChanges calculate(Client client) - { - StatsChanges c = new StatsChanges(1); - StatChange[] statChanges = c.getStatChanges(); - statChanges[0] = effect(client); - c.setPositivity(statChanges[0].getPositivity()); - return c; - } - - public abstract StatChange effect(Client client); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/StatBoost.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/StatBoost.java deleted file mode 100644 index cab36f3003..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/StatBoost.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.Client; -import net.runelite.client.plugins.itemstats.stats.Stat; - -public abstract class StatBoost extends SingleEffect -{ - @Getter(AccessLevel.PUBLIC) - @Setter(AccessLevel.PUBLIC) - private Stat stat; - @Getter(AccessLevel.PUBLIC) - @Setter(AccessLevel.PUBLIC) - private boolean boost; - - protected StatBoost(Stat stat, boolean boost) - { - this.stat = stat; - this.boost = boost; - } - - protected abstract int heals(Client client); - - @Override - public StatChange effect(Client client) - { - int value = stat.getValue(client); - int max = stat.getMaximum(client); - - boolean hitCap = false; - - int calcedDelta = heals(client); - if (boost && calcedDelta > 0) - { - max += calcedDelta; - } - if (value > max) - { - max = value; - } - int newValue = value + calcedDelta; - if (newValue > max) - { - newValue = max; - hitCap = true; - } - if (newValue < 0) - { - newValue = 0; - } - int delta = newValue - value; - StatChange out = new StatChange(); - out.setStat(stat); - if (delta > 0) - { - out.setPositivity(hitCap ? Positivity.BETTER_CAPPED : Positivity.BETTER_UNCAPPED); - } - else if (delta == 0) - { - out.setPositivity(Positivity.NO_CHANGE); - } - else - { - out.setPositivity(Positivity.WORSE); - } - out.setAbsolute(newValue); - out.setRelative(delta); - out.setTheoretical(calcedDelta); - return out; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/StatChange.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/StatChange.java deleted file mode 100644 index e9453984f4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/StatChange.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats; - -import lombok.Data; -import net.runelite.client.plugins.itemstats.stats.Stat; - -/** - * A single stat change - */ -@Data -public class StatChange -{ - /** - * The stat which will be boosted (or damaged). - */ - private Stat stat; - - /** - * Relative change that will occur if the stat boost is applied now. - */ - private int relative; - - /** - * Theoretical change that can occur before boost cap is enforced. - */ - private int theoretical; - - /** - * Absolute total of the stat after applying the boost. - */ - private int absolute; - - /** - * How beneficial this stat boost will be to the player. - */ - private Positivity positivity; - - /** - * Returns a human-readable formatted relative boost. - * Should be the boost amount prefixed by "+" or "-". - * - * @return The formatted relative boost amount - */ - public String getFormattedRelative() - { - return formatBoost(relative); - } - - /** - * Returns a human-readable formatted theoretical boost. - * Should be the boost amount prefixed by "+" or "-". - * - * @return The formatted theoretical boost amount - */ - public String getFormattedTheoretical() - { - return formatBoost(theoretical); - } - - static String formatBoost(int boost) - { - return String.format("%+d", boost); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/StatsChanges.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/StatsChanges.java deleted file mode 100644 index 87c454c30c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/StatsChanges.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; - -public class StatsChanges -{ - /** - * How positive the entire set of stat changes is - * - * @see Positivity - */ - @Getter(AccessLevel.PUBLIC) - @Setter(AccessLevel.PUBLIC) - private Positivity positivity; - @Getter(AccessLevel.PUBLIC) - @Setter(AccessLevel.PUBLIC) - private StatChange[] statChanges; - - public StatsChanges(int len) - { - this.statChanges = new StatChange[len]; - this.positivity = Positivity.NO_CHANGE; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/delta/DeltaCalculator.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/delta/DeltaCalculator.java deleted file mode 100644 index 0174af327e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/delta/DeltaCalculator.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats.delta; - -@FunctionalInterface -public interface DeltaCalculator -{ - int calculateDelta(int max); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/delta/DeltaPercentage.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/delta/DeltaPercentage.java deleted file mode 100644 index f1f9df4573..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/delta/DeltaPercentage.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats.delta; - -import lombok.RequiredArgsConstructor; - -@RequiredArgsConstructor -public class DeltaPercentage implements DeltaCalculator -{ - private final double perc; - private final int delta; - - @Override - public int calculateDelta(int max) - { - return (((int) (max * perc)) * (delta >= 0 ? 1 : -1)) + delta; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/food/Anglerfish.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/food/Anglerfish.java deleted file mode 100644 index 01e44eff8a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/food/Anglerfish.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats.food; - -import net.runelite.api.Client; -import net.runelite.client.plugins.itemstats.FoodBase; - -public class Anglerfish extends FoodBase -{ - public Anglerfish() - { - setBoost(true); - } - - @Override - public int heals(Client client) - { - int maxHP = getStat().getMaximum(client); - - int C; - if (maxHP <= 24) - { - C = 2; - } - else if (maxHP <= 49) - { - C = 4; - } - else if (maxHP <= 74) - { - C = 6; - } - else if (maxHP <= 92) - { - C = 8; - } - else - { - C = 13; - } - return (maxHP / 10) + C; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/potions/GauntletPotion.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/potions/GauntletPotion.java deleted file mode 100644 index e0be4bcfe7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/potions/GauntletPotion.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.itemstats.potions; - -import lombok.RequiredArgsConstructor; -import net.runelite.api.Client; -import net.runelite.api.Skill; -import static net.runelite.client.plugins.itemstats.Builders.heal; -import net.runelite.client.plugins.itemstats.Effect; -import net.runelite.client.plugins.itemstats.StatChange; -import net.runelite.client.plugins.itemstats.StatsChanges; -import net.runelite.client.plugins.itemstats.stats.Stats; - -/** - * Acts like a prayer potion and stamina dose combined but restores 40 energy instead of 20 - */ -@RequiredArgsConstructor -public class GauntletPotion implements Effect -{ - private static final int PRAYER_RESTORE_DELTA = 7; - private static final double PRAYER_RESTORE_PERCENT = .25; - - @Override - public StatsChanges calculate(Client client) - { - // Restores prayer similar to PrayerPotion but there aren't any possible boost so simplify the calculation - final int restorePerc = (int) (client.getRealSkillLevel(Skill.PRAYER) * PRAYER_RESTORE_PERCENT); - final StatChange prayer = heal(Stats.PRAYER, restorePerc + PRAYER_RESTORE_DELTA).effect(client); - - final StatChange runEnergy = heal(Stats.RUN_ENERGY, 40).effect(client); - - final StatsChanges changes = new StatsChanges(2); - changes.setStatChanges(new StatChange[]{runEnergy, prayer}); - return changes; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/potions/PrayerPotion.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/potions/PrayerPotion.java deleted file mode 100644 index 47198e4a29..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/potions/PrayerPotion.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats.potions; - -import com.google.common.collect.ImmutableSet; -import net.runelite.api.Client; -import net.runelite.api.EquipmentInventorySlot; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemID; -import net.runelite.client.plugins.itemstats.StatBoost; -import static net.runelite.client.plugins.itemstats.stats.Stats.PRAYER; -import net.runelite.client.util.ItemUtil; - -public class PrayerPotion extends StatBoost -{ - private final int delta; - - public PrayerPotion(int delta) - { - super(PRAYER, false); - this.delta = delta; - } - - private static final ImmutableSet HOLY_WRENCH_IDS = ImmutableSet.of( - ItemID.HOLY_WRENCH, ItemID.PRAYER_CAPE, ItemID.PRAYER_CAPET, ItemID.MAX_CAPE, ItemID.MAX_CAPE_13342, - // No idea what these are - ItemID.PRAYER_CAPE_10643, ItemID.MAX_CAPE_13282 - ); - - @Override - public int heals(Client client) - { - boolean hasHolyWrench = false; - - ItemContainer equipContainer = client.getItemContainer(InventoryID.EQUIPMENT); - if (equipContainer != null) - { - Item[] equip = equipContainer.getItems(); - final int ring = ItemUtil.safeGetItemIdAtIndex(equip, EquipmentInventorySlot.RING.getSlotIdx()); - final int cape = ItemUtil.safeGetItemIdAtIndex(equip, EquipmentInventorySlot.CAPE.getSlotIdx()); - - hasHolyWrench = ring == ItemID.RING_OF_THE_GODS_I; - hasHolyWrench |= HOLY_WRENCH_IDS.contains(cape); - } - if (!hasHolyWrench) - { - ItemContainer invContainer = client.getItemContainer(InventoryID.INVENTORY); - if (invContainer != null) - { - hasHolyWrench = ItemUtil.containsAnyItemId(invContainer.getItems(), HOLY_WRENCH_IDS); - } - } - - double perc = hasHolyWrench ? .27 : .25; - int max = getStat().getMaximum(client); - return (((int) (max * perc)) * (delta >= 0 ? 1 : -1)) + delta; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/potions/SaradominBrew.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/potions/SaradominBrew.java deleted file mode 100644 index ae816900cc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/potions/SaradominBrew.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats.potions; - -import java.util.Comparator; -import java.util.stream.Stream; -import lombok.RequiredArgsConstructor; -import net.runelite.api.Client; -import net.runelite.client.plugins.itemstats.BoostedStatBoost; -import static net.runelite.client.plugins.itemstats.Builders.perc; -import net.runelite.client.plugins.itemstats.Effect; -import net.runelite.client.plugins.itemstats.SimpleStatBoost; -import net.runelite.client.plugins.itemstats.StatChange; -import net.runelite.client.plugins.itemstats.StatsChanges; -import net.runelite.client.plugins.itemstats.stats.Stat; -import static net.runelite.client.plugins.itemstats.stats.Stats.ATTACK; -import static net.runelite.client.plugins.itemstats.stats.Stats.DEFENCE; -import static net.runelite.client.plugins.itemstats.stats.Stats.HITPOINTS; -import static net.runelite.client.plugins.itemstats.stats.Stats.MAGIC; -import static net.runelite.client.plugins.itemstats.stats.Stats.RANGED; -import static net.runelite.client.plugins.itemstats.stats.Stats.STRENGTH; - -@RequiredArgsConstructor -public class SaradominBrew implements Effect -{ - private static final Stat[] saradominBrewStats = new Stat[] - { - ATTACK, STRENGTH, RANGED, MAGIC - }; - - private final double percH; //percentage heal - private final double percD; //percentage defence boost - private final double percSD; //percentage stat drain - private final int deltaB; //delta boosted - private final int deltaR; //delta reduced - - @Override - public StatsChanges calculate(Client client) - { - StatsChanges changes = new StatsChanges(0); - SimpleStatBoost hitpoints = new SimpleStatBoost(HITPOINTS, true, perc(percH, deltaB)); - SimpleStatBoost defence = new SimpleStatBoost(DEFENCE, true, perc(percD, deltaB)); - BoostedStatBoost calc = new BoostedStatBoost(null, false, perc(percSD, -deltaR)); - changes.setStatChanges(Stream.concat( - Stream.of(hitpoints.effect(client)), - Stream.concat( - Stream.of(defence.effect(client)), - Stream.of(saradominBrewStats) - .filter(stat -> 1 < stat.getValue(client)) - .map(stat -> - { - calc.setStat(stat); - return calc.effect(client); - }) - ) - ).toArray(StatChange[]::new)); - changes.setPositivity(Stream.of(changes.getStatChanges()) - .map(StatChange::getPositivity) - .max(Comparator.comparing(Enum::ordinal)).get()); - return changes; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/potions/SuperRestore.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/potions/SuperRestore.java deleted file mode 100644 index c3b69d8619..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/potions/SuperRestore.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats.potions; - -import java.util.Comparator; -import java.util.stream.Stream; -import lombok.RequiredArgsConstructor; -import net.runelite.api.Client; -import static net.runelite.client.plugins.itemstats.Builders.perc; -import net.runelite.client.plugins.itemstats.Effect; -import net.runelite.client.plugins.itemstats.SimpleStatBoost; -import net.runelite.client.plugins.itemstats.StatChange; -import net.runelite.client.plugins.itemstats.StatsChanges; -import net.runelite.client.plugins.itemstats.stats.Stat; -import static net.runelite.client.plugins.itemstats.stats.Stats.*; - -@RequiredArgsConstructor -public class SuperRestore implements Effect -{ - private static final Stat[] superRestoreStats = new Stat[] - { - ATTACK, DEFENCE, STRENGTH, RANGED, MAGIC, COOKING, - WOODCUTTING, FLETCHING, FISHING, FIREMAKING, CRAFTING, SMITHING, MINING, - HERBLORE, AGILITY, THIEVING, SLAYER, FARMING, RUNECRAFT, HUNTER, - CONSTRUCTION - }; - - private final double percR; //percentage restored - private final int delta; - - @Override - public StatsChanges calculate(Client client) - { - StatsChanges changes = new StatsChanges(0); - - SimpleStatBoost calc = new SimpleStatBoost(null, false, perc(percR, delta)); - PrayerPotion prayer = new PrayerPotion(delta); - changes.setStatChanges(Stream.concat( - Stream.of(prayer.effect(client)), - Stream.of(superRestoreStats) - .filter(stat -> stat.getValue(client) < stat.getMaximum(client)) - .map(stat -> - { - calc.setStat(stat); - return calc.effect(client); - }) - ).toArray(StatChange[]::new)); - changes.setPositivity(Stream.of(changes.getStatChanges()).map(StatChange::getPositivity).max(Comparator.comparing(Enum::ordinal)).get()); - return changes; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/special/CastleWarsBandage.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/special/CastleWarsBandage.java deleted file mode 100644 index 11c0bdc077..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/special/CastleWarsBandage.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2019, Giovds - * 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.itemstats.special; - -import com.google.common.collect.ImmutableSet; -import java.util.Comparator; -import java.util.stream.Stream; -import net.runelite.api.Client; -import net.runelite.api.EquipmentInventorySlot; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemID; -import static net.runelite.client.plugins.itemstats.Builders.heal; -import static net.runelite.client.plugins.itemstats.Builders.perc; -import net.runelite.client.plugins.itemstats.Effect; -import net.runelite.client.plugins.itemstats.StatChange; -import net.runelite.client.plugins.itemstats.StatsChanges; -import static net.runelite.client.plugins.itemstats.stats.Stats.HITPOINTS; -import static net.runelite.client.plugins.itemstats.stats.Stats.RUN_ENERGY; - -public class CastleWarsBandage implements Effect -{ - private static final ImmutableSet BRACELETS = ImmutableSet.of( - ItemID.CASTLE_WARS_BRACELET1, ItemID.CASTLE_WARS_BRACELET2, ItemID.CASTLE_WARS_BRACELET3 - ); - - private static final double BASE_HP_PERC = .10; - private static final double BRACELET_HP_PERC = .50; - - @Override - public StatsChanges calculate(Client client) - { - final ItemContainer equipmentContainer = client.getItemContainer(InventoryID.EQUIPMENT); - final double percH = hasBracelet(equipmentContainer) ? BRACELET_HP_PERC : BASE_HP_PERC; - final StatChange hitPoints = heal(HITPOINTS, perc(percH, 0)).effect(client); - final StatChange runEnergy = heal(RUN_ENERGY, 30).effect(client); - final StatsChanges changes = new StatsChanges(2); - changes.setStatChanges(new StatChange[]{hitPoints, runEnergy}); - changes.setPositivity(Stream.of(changes.getStatChanges()) - .map(StatChange::getPositivity) - .max(Comparator.comparing(Enum::ordinal)).get()); - - return changes; - } - - private boolean hasBracelet(ItemContainer equipmentContainer) - { - if (equipmentContainer == null) - { - return false; - } - - final Item[] equipment = equipmentContainer.getItems(); - - if (equipment.length > EquipmentInventorySlot.GLOVES.getSlotIdx()) - { - return BRACELETS.contains(equipment[EquipmentInventorySlot.GLOVES.getSlotIdx()].getId()); - } - - return false; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/special/SpicyStew.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/special/SpicyStew.java deleted file mode 100644 index a2baa6a09e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/special/SpicyStew.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2018, 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.itemstats.special; - -import java.util.ArrayList; -import java.util.List; -import net.runelite.api.Client; -import net.runelite.api.Varbits; -import net.runelite.client.plugins.itemstats.Effect; -import net.runelite.client.plugins.itemstats.Positivity; -import net.runelite.client.plugins.itemstats.RangeStatChange; -import net.runelite.client.plugins.itemstats.StatChange; -import net.runelite.client.plugins.itemstats.StatsChanges; -import net.runelite.client.plugins.itemstats.stats.Stat; -import net.runelite.client.plugins.itemstats.stats.Stats; - -public class SpicyStew implements Effect -{ - - @Override - public StatsChanges calculate(Client client) - { - /* - * Spice boosts listed in the colour order of [Spicy stew -> Smell] - */ - int redBoost = spiceBoostOf(client.getVar(Varbits.SPICY_STEW_RED_SPICES)); - int yellowBoost = spiceBoostOf(client.getVar(Varbits.SPICY_STEW_YELLOW_SPICES)); - int orangeBoost = spiceBoostOf(client.getVar(Varbits.SPICY_STEW_ORANGE_SPICES)); - int brownBoost = spiceBoostOf(client.getVar(Varbits.SPICY_STEW_BROWN_SPICES)); - - List changes = new ArrayList<>(); - - /* - * Red spices: Attack, Strength, Defence, Ranged, Magic - */ - if (redBoost > 0) - { - changes.add(statChangeOf(Stats.ATTACK, redBoost, client)); - changes.add(statChangeOf(Stats.STRENGTH, redBoost, client)); - changes.add(statChangeOf(Stats.DEFENCE, redBoost, client)); - changes.add(statChangeOf(Stats.RANGED, redBoost, client)); - changes.add(statChangeOf(Stats.MAGIC, redBoost, client)); - } - - /* - * Yellow spices: Prayer, Agility, Thieving, Slayer, Hunter - */ - if (yellowBoost > 0) - { - changes.add(statChangeOf(Stats.PRAYER, yellowBoost, client)); - changes.add(statChangeOf(Stats.AGILITY, yellowBoost, client)); - changes.add(statChangeOf(Stats.THIEVING, yellowBoost, client)); - changes.add(statChangeOf(Stats.SLAYER, yellowBoost, client)); - changes.add(statChangeOf(Stats.HUNTER, yellowBoost, client)); - } - - /* - * Orange spices: Smithing, Cooking, Crafting, Firemaking, Fletching, Runecraft, Construction - */ - if (orangeBoost > 0) - { - changes.add(statChangeOf(Stats.SMITHING, orangeBoost, client)); - changes.add(statChangeOf(Stats.COOKING, orangeBoost, client)); - changes.add(statChangeOf(Stats.CRAFTING, orangeBoost, client)); - changes.add(statChangeOf(Stats.FIREMAKING, orangeBoost, client)); - changes.add(statChangeOf(Stats.FLETCHING, orangeBoost, client)); - changes.add(statChangeOf(Stats.RUNECRAFT, orangeBoost, client)); - changes.add(statChangeOf(Stats.CONSTRUCTION, orangeBoost, client)); - } - - /* - * Brown spices: Mining, Herblore, Fishing, Woodcutting, Farming - */ - if (brownBoost > 0) - { - changes.add(statChangeOf(Stats.MINING, brownBoost, client)); - changes.add(statChangeOf(Stats.HERBLORE, brownBoost, client)); - changes.add(statChangeOf(Stats.FISHING, brownBoost, client)); - changes.add(statChangeOf(Stats.WOODCUTTING, brownBoost, client)); - changes.add(statChangeOf(Stats.FARMING, brownBoost, client)); - } - - StatsChanges changesReturn = new StatsChanges(4); - changesReturn.setStatChanges(changes.toArray(new StatChange[0])); - - return changesReturn; - } - - /** - * Calculate the potential boost that a spice currently offers, - * based on its number of doses in the stew. - * - * @param spiceDoses Number of doses between 0 and 3. - * @return Either 0, +1, +3, or +5. - */ - private static int spiceBoostOf(int spiceDoses) - { - return Math.max(0, (spiceDoses * 2) - 1); - } - - /** - * Calculate the fields of a stat change tooltip row. - * - * @param stat Stat that the spice boost affects. - * @param spiceBoost Potential spice boost before capping. - * @param client Client API, needed to check current stat values. - * @return StatChange object with all required values. - */ - private static StatChange statChangeOf(Stat stat, int spiceBoost, Client client) - { - int currentValue = stat.getValue(client); - int currentBase = stat.getMaximum(client); - - int currentBoost = currentValue - currentBase; // Can be negative - int spiceBoostCapped = (currentBoost <= 0) ? spiceBoost : Math.max(0, spiceBoost - currentBoost); - - final RangeStatChange change = new RangeStatChange(); - change.setStat(stat); - change.setMinRelative(-spiceBoost); - change.setRelative(spiceBoostCapped); - change.setMinTheoretical(-spiceBoost); - change.setTheoretical(spiceBoost); - change.setMinAbsolute(Math.max(-spiceBoost, -currentValue)); - change.setAbsolute(stat.getValue(client) + spiceBoostCapped); - - Positivity positivity; - if (spiceBoostCapped == 0) - { - positivity = Positivity.NO_CHANGE; - } - else if (spiceBoost > spiceBoostCapped) - { - positivity = Positivity.BETTER_CAPPED; - } - else - { - positivity = Positivity.BETTER_UNCAPPED; - } - change.setPositivity(positivity); - - return change; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/stats/EnergyStat.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/stats/EnergyStat.java deleted file mode 100644 index ca4b05b892..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/stats/EnergyStat.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats.stats; - -import net.runelite.api.Client; - -public class EnergyStat extends Stat -{ - EnergyStat() - { - super("Run Energy"); - } - - @Override - public int getValue(Client client) - { - return client.getEnergy(); - } - - @Override - public int getMaximum(Client client) - { - return 100; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/stats/SkillStat.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/stats/SkillStat.java deleted file mode 100644 index 892783e8b5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/stats/SkillStat.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats.stats; - -import net.runelite.api.Client; -import net.runelite.api.Skill; - -public class SkillStat extends Stat -{ - private final Skill skill; - - SkillStat(Skill skill) - { - super(skill.getName()); - this.skill = skill; - } - - @Override - public int getValue(Client client) - { - return client.getBoostedSkillLevel(this.skill); - } - - @Override - public int getMaximum(Client client) - { - return client.getRealSkillLevel(this.skill); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/stats/Stat.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/stats/Stat.java deleted file mode 100644 index 1f2a3bad8e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/stats/Stat.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.itemstats.stats; - -import net.runelite.api.Client; - -/** - * Abstract stat of a player. - */ -public abstract class Stat -{ - private final String name; - - Stat(String name) - { - this.name = name; - } - - public String getName() - { - return name; - } - - /** - * Get the current stat value including any boosts or damage. - */ - public abstract int getValue(Client client); - - /** - * Get the base stat maximum, ie. the bottom half of the stat fraction. - */ - public abstract int getMaximum(Client client); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/stats/Stats.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/stats/Stats.java deleted file mode 100644 index 8398ebff94..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/stats/Stats.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats.stats; - -import net.runelite.api.Skill; - -public class Stats -{ - public static final Stat ATTACK = new SkillStat(Skill.ATTACK); - public static final Stat DEFENCE = new SkillStat(Skill.DEFENCE); - public static final Stat STRENGTH = new SkillStat(Skill.STRENGTH); - public static final Stat HITPOINTS = new SkillStat(Skill.HITPOINTS); - public static final Stat RANGED = new SkillStat(Skill.RANGED); - public static final Stat PRAYER = new SkillStat(Skill.PRAYER); - public static final Stat MAGIC = new SkillStat(Skill.MAGIC); - public static final Stat COOKING = new SkillStat(Skill.COOKING); - public static final Stat WOODCUTTING = new SkillStat(Skill.WOODCUTTING); - public static final Stat FLETCHING = new SkillStat(Skill.FLETCHING); - public static final Stat FISHING = new SkillStat(Skill.FISHING); - public static final Stat FIREMAKING = new SkillStat(Skill.FIREMAKING); - public static final Stat CRAFTING = new SkillStat(Skill.CRAFTING); - public static final Stat SMITHING = new SkillStat(Skill.SMITHING); - public static final Stat MINING = new SkillStat(Skill.MINING); - public static final Stat HERBLORE = new SkillStat(Skill.HERBLORE); - public static final Stat AGILITY = new SkillStat(Skill.AGILITY); - public static final Stat THIEVING = new SkillStat(Skill.THIEVING); - public static final Stat SLAYER = new SkillStat(Skill.SLAYER); - public static final Stat FARMING = new SkillStat(Skill.FARMING); - public static final Stat RUNECRAFT = new SkillStat(Skill.RUNECRAFT); - public static final Stat HUNTER = new SkillStat(Skill.HUNTER); - public static final Stat CONSTRUCTION = new SkillStat(Skill.CONSTRUCTION); - public static final Stat RUN_ENERGY = new EnergyStat(); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/keyremapping/KeyRemappingConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/keyremapping/KeyRemappingConfig.java deleted file mode 100644 index dfb3a76e9c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/keyremapping/KeyRemappingConfig.java +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright (c) 2018, 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.keyremapping; - -import java.awt.event.KeyEvent; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ModifierlessKeybind; - -@ConfigGroup("keyremapping") -public interface KeyRemappingConfig extends Config -{ - @ConfigItem( - position = 0, - keyName = "hideDisplayName", - name = "Hide display name", - description = "Hides the display name from showing before \"Press Enter to Chat...\"" - ) - default boolean hideDisplayName() - { - return false; - } - - @ConfigItem( - position = 1, - keyName = "cameraRemap", - name = "Remap Camera", - description = "Configures whether the camera movement uses remapped keys" - ) - default boolean cameraRemap() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "up", - name = "Camera Up key", - description = "The key which will replace up." - ) - default ModifierlessKeybind up() - { - return new ModifierlessKeybind(KeyEvent.VK_W, 0); - } - - @ConfigItem( - position = 3, - keyName = "down", - name = "Camera Down key", - description = "The key which will replace down." - ) - default ModifierlessKeybind down() - { - return new ModifierlessKeybind(KeyEvent.VK_S, 0); - } - - @ConfigItem( - position = 4, - keyName = "left", - name = "Camera Left key", - description = "The key which will replace left." - ) - default ModifierlessKeybind left() - { - return new ModifierlessKeybind(KeyEvent.VK_A, 0); - } - - @ConfigItem( - position = 5, - keyName = "right", - name = "Camera Right key", - description = "The key which will replace right." - ) - default ModifierlessKeybind right() - { - return new ModifierlessKeybind(KeyEvent.VK_D, 0); - } - - @ConfigItem( - position = 6, - keyName = "fkeyRemap", - name = "Remap F Keys", - description = "Configures whether F-Keys use remapped keys" - ) - default boolean fkeyRemap() - { - return false; - } - - @ConfigItem( - position = 7, - keyName = "f1", - name = "F1", - description = "The key which will replace {F1}." - ) - default ModifierlessKeybind f1() - { - return new ModifierlessKeybind(KeyEvent.VK_1, 0); - } - - @ConfigItem( - position = 8, - keyName = "f2", - name = "F2", - description = "The key which will replace {F2}." - ) - default ModifierlessKeybind f2() - { - return new ModifierlessKeybind(KeyEvent.VK_2, 0); - } - - @ConfigItem( - position = 9, - keyName = "f3", - name = "F3", - description = "The key which will replace {F3}." - ) - default ModifierlessKeybind f3() - { - return new ModifierlessKeybind(KeyEvent.VK_3, 0); - } - - @ConfigItem( - position = 10, - keyName = "f4", - name = "F4", - description = "The key which will replace {F4}." - ) - default ModifierlessKeybind f4() - { - return new ModifierlessKeybind(KeyEvent.VK_4, 0); - } - - @ConfigItem( - position = 11, - keyName = "f5", - name = "F5", - description = "The key which will replace {F5}." - ) - default ModifierlessKeybind f5() - { - return new ModifierlessKeybind(KeyEvent.VK_5, 0); - } - - @ConfigItem( - position = 12, - keyName = "f6", - name = "F6", - description = "The key which will replace {F6}." - ) - default ModifierlessKeybind f6() - { - return new ModifierlessKeybind(KeyEvent.VK_6, 0); - } - - @ConfigItem( - position = 13, - keyName = "f7", - name = "F7", - description = "The key which will replace {F7}." - ) - default ModifierlessKeybind f7() - { - return new ModifierlessKeybind(KeyEvent.VK_7, 0); - } - - @ConfigItem( - position = 14, - keyName = "f8", - name = "F8", - description = "The key which will replace {F8}." - ) - default ModifierlessKeybind f8() - { - return new ModifierlessKeybind(KeyEvent.VK_8, 0); - } - - @ConfigItem( - position = 15, - keyName = "f9", - name = "F9", - description = "The key which will replace {F9}." - ) - default ModifierlessKeybind f9() - { - return new ModifierlessKeybind(KeyEvent.VK_9, 0); - } - - @ConfigItem( - position = 16, - keyName = "f10", - name = "F10", - description = "The key which will replace {F10}." - ) - default ModifierlessKeybind f10() - { - return new ModifierlessKeybind(KeyEvent.VK_0, 0); - } - - @ConfigItem( - position = 17, - keyName = "f11", - name = "F11", - description = "The key which will replace {F11}." - ) - default ModifierlessKeybind f11() - { - return new ModifierlessKeybind(KeyEvent.VK_MINUS, 0); - } - - @ConfigItem( - position = 18, - keyName = "f12", - name = "F12", - description = "The key which will replace {F12}." - ) - default ModifierlessKeybind f12() - { - return new ModifierlessKeybind(KeyEvent.VK_EQUALS, 0); - } - - @ConfigItem( - position = 19, - keyName = "esc", - name = "ESC", - description = "The key which will replace {ESC}." - ) - default ModifierlessKeybind esc() - { - return new ModifierlessKeybind(KeyEvent.VK_ESCAPE, 0); - } - - @ConfigItem( - position = 20, - keyName = "ctrl", - name = "CTRL", - description = "The key which will replace {CTRL}." - ) - default ModifierlessKeybind ctrl() - { - return new ModifierlessKeybind(KeyEvent.VK_CONTROL, 0); - } - - @ConfigItem( - position = 21, - keyName = "alt", - name = "ALT", - description = "The key which will replace {ALT}." - ) - default ModifierlessKeybind alt() - { - return new ModifierlessKeybind(KeyEvent.VK_ALT, 0); - } - - @ConfigItem( - position = 22, - keyName = "shift", - name = "SHIFT", - description = "The key which will replace {SHIFT}." - ) - default ModifierlessKeybind shift() - { - return new ModifierlessKeybind(KeyEvent.VK_SHIFT, 0); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/keyremapping/KeyRemappingListener.java b/runelite-client/src/main/java/net/runelite/client/plugins/keyremapping/KeyRemappingListener.java deleted file mode 100644 index a2669f202d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/keyremapping/KeyRemappingListener.java +++ /dev/null @@ -1,336 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * Copyright (c) 2018, Abexlry - * 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.keyremapping; - -import com.google.common.base.Strings; -import java.awt.event.KeyEvent; -import java.util.HashMap; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.VarClientStr; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.input.KeyListener; -import net.runelite.client.input.MouseAdapter; - -@Singleton -class KeyRemappingListener extends MouseAdapter implements KeyListener -{ - - @Inject - private KeyRemappingPlugin plugin; - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - private final Map modified = new HashMap<>(); - - @Override - public void keyTyped(KeyEvent e) - { - } - - @Override - public void keyPressed(KeyEvent e) - { - if (client.getGameState() == GameState.LOGIN_SCREEN || !plugin.chatboxFocused()) - { - return; - } - - if (!plugin.isTyping()) - { - if (plugin.isCameraRemap()) - { - if (plugin.getUp().matches(e)) - { - modified.put(e.getKeyCode(), KeyEvent.VK_UP); - e.setKeyCode(KeyEvent.VK_UP); - } - else if (plugin.getDown().matches(e)) - { - modified.put(e.getKeyCode(), KeyEvent.VK_DOWN); - e.setKeyCode(KeyEvent.VK_DOWN); - } - else if (plugin.getLeft().matches(e)) - { - modified.put(e.getKeyCode(), KeyEvent.VK_LEFT); - e.setKeyCode(KeyEvent.VK_LEFT); - } - else if (plugin.getRight().matches(e)) - { - modified.put(e.getKeyCode(), KeyEvent.VK_RIGHT); - e.setKeyCode(KeyEvent.VK_RIGHT); - } - } - - // In addition to the above checks, the F-key remapping shouldn't - // activate when dialogs are open which listen for number keys - // to select options - if (plugin.isFkeyRemap() && !plugin.isDialogOpen()) - { - if (plugin.getF1().matches(e)) - { - modified.put(e.getKeyCode(), KeyEvent.VK_F1); - e.setKeyCode(KeyEvent.VK_F1); - } - else if (plugin.getF2().matches(e)) - { - modified.put(e.getKeyCode(), KeyEvent.VK_F2); - e.setKeyCode(KeyEvent.VK_F2); - } - else if (plugin.getF3().matches(e)) - { - modified.put(e.getKeyCode(), KeyEvent.VK_F3); - e.setKeyCode(KeyEvent.VK_F3); - } - else if (plugin.getF4().matches(e)) - { - modified.put(e.getKeyCode(), KeyEvent.VK_F4); - e.setKeyCode(KeyEvent.VK_F4); - } - else if (plugin.getF5().matches(e)) - { - modified.put(e.getKeyCode(), KeyEvent.VK_F5); - e.setKeyCode(KeyEvent.VK_F5); - } - else if (plugin.getF6().matches(e)) - { - modified.put(e.getKeyCode(), KeyEvent.VK_F6); - e.setKeyCode(KeyEvent.VK_F6); - } - else if (plugin.getF7().matches(e)) - { - modified.put(e.getKeyCode(), KeyEvent.VK_F7); - e.setKeyCode(KeyEvent.VK_F7); - } - else if (plugin.getF8().matches(e)) - { - modified.put(e.getKeyCode(), KeyEvent.VK_F8); - e.setKeyCode(KeyEvent.VK_F8); - } - else if (plugin.getF9().matches(e)) - { - modified.put(e.getKeyCode(), KeyEvent.VK_F9); - e.setKeyCode(KeyEvent.VK_F9); - } - else if (plugin.getF10().matches(e)) - { - modified.put(e.getKeyCode(), KeyEvent.VK_F10); - e.setKeyCode(KeyEvent.VK_F10); - } - else if (plugin.getF11().matches(e)) - { - modified.put(e.getKeyCode(), KeyEvent.VK_F11); - e.setKeyCode(KeyEvent.VK_F11); - } - else if (plugin.getF12().matches(e)) - { - modified.put(e.getKeyCode(), KeyEvent.VK_F12); - e.setKeyCode(KeyEvent.VK_F12); - } - else if (plugin.getEsc().matches(e)) - { - modified.put(e.getKeyCode(), KeyEvent.VK_ESCAPE); - e.setKeyCode(KeyEvent.VK_ESCAPE); - } - else if (plugin.getCtrl().matches(e)) - { - modified.put(e.getKeyCode(), KeyEvent.VK_CONTROL); - e.setKeyCode(KeyEvent.VK_CONTROL); - } - else if (plugin.getAlt().matches(e)) - { - modified.put(e.getKeyCode(), KeyEvent.VK_ALT); - e.setKeyCode(KeyEvent.VK_ALT); - } - else if (plugin.getShift().matches(e)) - { - modified.put(e.getKeyCode(), KeyEvent.VK_SHIFT); - e.setKeyCode(KeyEvent.VK_SHIFT); - } - } - - switch (e.getKeyCode()) - { - case KeyEvent.VK_ENTER: - case KeyEvent.VK_SLASH: - case KeyEvent.VK_COLON: - // refocus chatbox - plugin.setTyping(true); - clientThread.invoke(plugin::unlockChat); - break; - } - - } - else - { - switch (e.getKeyCode()) - { - case KeyEvent.VK_ESCAPE: - // When exiting typing mode, block the escape key - // so that it doesn't trigger the in-game hotkeys - e.consume(); - plugin.setTyping(false); - clientThread.invoke(() -> - { - client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, ""); - plugin.lockChat(); - }); - break; - case KeyEvent.VK_ENTER: - plugin.setTyping(false); - clientThread.invoke(plugin::lockChat); - break; - case KeyEvent.VK_BACK_SPACE: - // Only lock chat on backspace when the typed text is now empty - if (Strings.isNullOrEmpty(client.getVar(VarClientStr.CHATBOX_TYPED_TEXT))) - { - plugin.setTyping(false); - clientThread.invoke(plugin::lockChat); - } - break; - } - } - } - - @Override - public void keyReleased(KeyEvent e) - { - if (client.getGameState() == GameState.LOGIN_SCREEN) - { - return; - } - - if (plugin.chatboxFocused() && !plugin.isTyping()) - { - modified.remove(e.getKeyCode()); - - if (plugin.isCameraRemap()) - { - if (plugin.getUp().matches(e)) - { - e.setKeyCode(KeyEvent.VK_UP); - } - else if (plugin.getDown().matches(e)) - { - e.setKeyCode(KeyEvent.VK_DOWN); - } - else if (plugin.getLeft().matches(e)) - { - e.setKeyCode(KeyEvent.VK_LEFT); - } - else if (plugin.getRight().matches(e)) - { - e.setKeyCode(KeyEvent.VK_RIGHT); - } - } - - if (plugin.isFkeyRemap()) - { - if (plugin.getF1().matches(e)) - { - e.setKeyCode(KeyEvent.VK_F1); - } - else if (plugin.getF2().matches(e)) - { - e.setKeyCode(KeyEvent.VK_F2); - } - else if (plugin.getF3().matches(e)) - { - e.setKeyCode(KeyEvent.VK_F3); - } - else if (plugin.getF4().matches(e)) - { - e.setKeyCode(KeyEvent.VK_F4); - } - else if (plugin.getF5().matches(e)) - { - e.setKeyCode(KeyEvent.VK_F5); - } - else if (plugin.getF6().matches(e)) - { - e.setKeyCode(KeyEvent.VK_F6); - } - else if (plugin.getF7().matches(e)) - { - e.setKeyCode(KeyEvent.VK_F7); - } - else if (plugin.getF8().matches(e)) - { - e.setKeyCode(KeyEvent.VK_F8); - } - else if (plugin.getF9().matches(e)) - { - e.setKeyCode(KeyEvent.VK_F9); - } - else if (plugin.getF10().matches(e)) - { - e.setKeyCode(KeyEvent.VK_F10); - } - else if (plugin.getF11().matches(e)) - { - e.setKeyCode(KeyEvent.VK_F11); - } - else if (plugin.getF12().matches(e)) - { - e.setKeyCode(KeyEvent.VK_F12); - } - else if (plugin.getEsc().matches(e)) - { - e.setKeyCode(KeyEvent.VK_ESCAPE); - } - else if (plugin.getCtrl().matches(e)) - { - e.setKeyCode(KeyEvent.VK_CONTROL); - } - else if (plugin.getAlt().matches(e)) - { - e.setKeyCode(KeyEvent.VK_ALT); - } - else if (plugin.getShift().matches(e)) - { - e.setKeyCode(KeyEvent.VK_SHIFT); - } - } - } - else - { - // press d + enter + release d - causes the right arrow to never be released - Integer m = modified.get(e.getKeyCode()); - if (m != null) - { - modified.remove(e.getKeyCode()); - e.setKeyCode(m); - } - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/keyremapping/KeyRemappingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/keyremapping/KeyRemappingPlugin.java deleted file mode 100644 index 7215139ffc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/keyremapping/KeyRemappingPlugin.java +++ /dev/null @@ -1,314 +0,0 @@ -/*' - * Copyright (c) 2018, Adam - * Copyright (c) 2018, Abexlry - * 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.keyremapping; - -import com.google.inject.Provides; -import java.awt.Color; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.VarClientInt; -import net.runelite.api.VarClientStr; -import net.runelite.api.Varbits; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.config.ModifierlessKeybind; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.input.KeyManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.ui.JagexColors; -import net.runelite.client.util.ColorUtil; - -@PluginDescriptor( - name = "Key Remapping", - description = "Allows use of WASD keys for camera movement with 'Press Enter to Chat', and remapping number keys to F-keys", - tags = {"enter", "chat", "wasd", "camera"}, - enabledByDefault = false, - type = PluginType.MISCELLANEOUS -) -@Singleton -public class KeyRemappingPlugin extends Plugin -{ - private static final String PRESS_ENTER_TO_CHAT = "Press Enter to Chat..."; - private static final String SCRIPT_EVENT_SET_CHATBOX_INPUT = "setChatboxInput"; - private static final String SCRIPT_EVENT_BLOCK_CHAT_INPUT = "blockChatInput"; - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private KeyRemappingConfig config; - - @Inject - private KeyManager keyManager; - - @Inject - private KeyRemappingListener inputListener; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private boolean typing; - - private boolean hideDisplayName; - @Getter(AccessLevel.PACKAGE) - private boolean cameraRemap; - @Getter(AccessLevel.PACKAGE) - private ModifierlessKeybind up; - @Getter(AccessLevel.PACKAGE) - private ModifierlessKeybind down; - @Getter(AccessLevel.PACKAGE) - private ModifierlessKeybind left; - @Getter(AccessLevel.PACKAGE) - private ModifierlessKeybind right; - @Getter(AccessLevel.PACKAGE) - private boolean fkeyRemap; - @Getter(AccessLevel.PACKAGE) - private ModifierlessKeybind f1; - @Getter(AccessLevel.PACKAGE) - private ModifierlessKeybind f2; - @Getter(AccessLevel.PACKAGE) - private ModifierlessKeybind f3; - @Getter(AccessLevel.PACKAGE) - private ModifierlessKeybind f4; - @Getter(AccessLevel.PACKAGE) - private ModifierlessKeybind f5; - @Getter(AccessLevel.PACKAGE) - private ModifierlessKeybind f6; - @Getter(AccessLevel.PACKAGE) - private ModifierlessKeybind f7; - @Getter(AccessLevel.PACKAGE) - private ModifierlessKeybind f8; - @Getter(AccessLevel.PACKAGE) - private ModifierlessKeybind f9; - @Getter(AccessLevel.PACKAGE) - private ModifierlessKeybind f10; - @Getter(AccessLevel.PACKAGE) - private ModifierlessKeybind f11; - @Getter(AccessLevel.PACKAGE) - private ModifierlessKeybind f12; - @Getter(AccessLevel.PACKAGE) - private ModifierlessKeybind esc; - @Getter(AccessLevel.PACKAGE) - private ModifierlessKeybind ctrl; - @Getter(AccessLevel.PACKAGE) - private ModifierlessKeybind alt; - @Getter(AccessLevel.PACKAGE) - private ModifierlessKeybind shift; - - @Override - protected void startUp() - { - updateConfig(); - - typing = false; - keyManager.registerKeyListener(inputListener); - - clientThread.invoke(() -> - { - if (client.getGameState() == GameState.LOGGED_IN) - { - lockChat(); - // Clear any typed text - client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, ""); - } - }); - } - - @Override - protected void shutDown() - { - clientThread.invoke(() -> - { - if (client.getGameState() == GameState.LOGGED_IN) - { - unlockChat(); - } - }); - - keyManager.unregisterKeyListener(inputListener); - } - - @Provides - KeyRemappingConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(KeyRemappingConfig.class); - } - - boolean chatboxFocused() - { - Widget chatboxParent = client.getWidget(WidgetInfo.CHATBOX_PARENT); - if (chatboxParent == null || chatboxParent.getOnKeyListener() == null) - { - return false; - } - - // the search box on the world map can be focused, and chat input goes there, even - // though the chatbox still has its key listener. - Widget worldMapSearch = client.getWidget(WidgetInfo.WORLD_MAP_SEARCH); - return worldMapSearch == null || client.getVar(VarClientInt.WORLD_MAP_SEARCH_FOCUSED) != 1; - } - - /** - * Check if a dialog is open that will grab numerical input, to prevent F-key remapping - * from triggering. - * - * @return - */ - boolean isDialogOpen() - { - // Most chat dialogs with numerical input are added without the chatbox or its key listener being removed, - // so chatboxFocused() is true. The chatbox onkey script uses the following logic to ignore key presses, - // so we will use it too to not remap F-keys. - return isHidden(WidgetInfo.CHATBOX_MESSAGES) || isHidden(WidgetInfo.CHATBOX_TRANSPARENT_LINES); - } - - private boolean isHidden(WidgetInfo widgetInfo) - { - Widget w = client.getWidget(widgetInfo); - return w == null || w.isSelfHidden(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged configChanged) - { - if (!configChanged.getGroup().equals("keyremapping")) - { - return; - } - - updateConfig(); - - clientThread.invoke(() -> - { - Widget chatboxInput = client.getWidget(WidgetInfo.CHATBOX_INPUT); - if (chatboxInput != null && chatboxInput.getText().endsWith(PRESS_ENTER_TO_CHAT)) - { - setChatboxWidgetInput(chatboxInput, PRESS_ENTER_TO_CHAT); - } - } - ); - } - - @Subscribe - private void onScriptCallbackEvent(ScriptCallbackEvent scriptCallbackEvent) - { - switch (scriptCallbackEvent.getEventName()) - { - case SCRIPT_EVENT_SET_CHATBOX_INPUT: - Widget chatboxInput = client.getWidget(WidgetInfo.CHATBOX_INPUT); - if (chatboxInput != null && chatboxFocused() && !typing) - { - setChatboxWidgetInput(chatboxInput, PRESS_ENTER_TO_CHAT); - } - break; - case SCRIPT_EVENT_BLOCK_CHAT_INPUT: - if (!typing) - { - int[] intStack = client.getIntStack(); - int intStackSize = client.getIntStackSize(); - intStack[intStackSize - 1] = 1; - } - break; - } - } - - void lockChat() - { - Widget chatboxInput = client.getWidget(WidgetInfo.CHATBOX_INPUT); - if (chatboxInput != null) - { - setChatboxWidgetInput(chatboxInput, PRESS_ENTER_TO_CHAT); - } - } - - void unlockChat() - { - Widget chatboxInput = client.getWidget(WidgetInfo.CHATBOX_INPUT); - if (chatboxInput != null && client.getGameState() == GameState.LOGGED_IN) - { - final boolean isChatboxTransparent = client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1; - final Color textColor = isChatboxTransparent ? JagexColors.CHAT_TYPED_TEXT_TRANSPARENT_BACKGROUND : JagexColors.CHAT_TYPED_TEXT_OPAQUE_BACKGROUND; - setChatboxWidgetInput(chatboxInput, ColorUtil.wrapWithColorTag(client.getVar(VarClientStr.CHATBOX_TYPED_TEXT) + "*", textColor)); - } - } - - private void setChatboxWidgetInput(Widget widget, String input) - { - if (this.hideDisplayName) - { - widget.setText(input); - return; - } - - String text = widget.getText(); - int idx = text.indexOf(':'); - if (idx != -1) - { - String newText = text.substring(0, idx) + ": " + input; - widget.setText(newText); - } - } - - private void updateConfig() - { - this.hideDisplayName = config.hideDisplayName(); - this.cameraRemap = config.cameraRemap(); - this.up = config.up(); - this.down = config.down(); - this.left = config.left(); - this.right = config.right(); - this.fkeyRemap = config.fkeyRemap(); - this.f1 = config.f1(); - this.f2 = config.f2(); - this.f3 = config.f3(); - this.f4 = config.f4(); - this.f5 = config.f5(); - this.f6 = config.f6(); - this.f7 = config.f7(); - this.f8 = config.f8(); - this.f9 = config.f9(); - this.f10 = config.f10(); - this.f11 = config.f11(); - this.f12 = config.f12(); - this.esc = config.esc(); - this.ctrl = config.ctrl(); - this.alt = config.alt(); - this.shift = config.shift(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomConfig.java deleted file mode 100644 index d1e8ea9747..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomConfig.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2019, Parker - * 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.kingdomofmiscellania; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("kingdomofmiscellania") -public interface KingdomConfig extends Config -{ - @ConfigItem( - keyName = "showInfoboxAnywhere", - name = "Show kingdom infobox anywhere", - description = "Show the infobox containing your favor/coffer amount even when outside Miscellania", - position = 0 - ) - default boolean showInfoboxAnywhere() - { - return false; - } - - @ConfigItem( - keyName = "notifyFavorThreshold", - name = "Notify chat favor", - description = "Sends a message to your chatbox when your kingdom favor percentage is below the threshold. Leave at 0 to disable.", - position = 1 - - ) - default int notifyFavorThreshold() - { - return 0; - } - - @ConfigItem( - keyName = "notifyCofferThreshold", - name = "Notify chat coffer value", - description = "Sends a message to your chatbox when your kingdom's coffer is below the threshold. Leave at 0 to disable.", - position = 2 - ) - default int notifyCofferThreshold() - { - return 0; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomCounter.java deleted file mode 100644 index 37f5096b44..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomCounter.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2018, Infinitay - * Copyright (c) 2019, Parker - * 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.kingdomofmiscellania; - -import java.awt.image.BufferedImage; -import javax.inject.Singleton; -import net.runelite.client.ui.overlay.infobox.Counter; -import net.runelite.client.util.QuantityFormatter; - -@Singleton -class KingdomCounter extends Counter -{ - private final KingdomPlugin plugin; - - KingdomCounter(final BufferedImage image, final KingdomPlugin plugin) - { - super(image, plugin, plugin.getFavor()); - this.plugin = plugin; - } - - @Override - public String getText() - { - return KingdomPlugin.getFavorPercent(plugin.getFavor()) + "%"; - } - - @Override - public String getTooltip() - { - return "Favor: " + - plugin.getFavor() + - "/127" + - "
" + - "Coffer: " + - QuantityFormatter.quantityToStackSize(plugin.getCoffer()); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomPlugin.java deleted file mode 100644 index 85a3dabc51..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomPlugin.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) 2018, Infinitay - * Copyright (c) 2019, Parker - * 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.kingdomofmiscellania; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Provides; -import java.text.NumberFormat; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import static net.runelite.api.ItemID.TEAK_CHEST; -import net.runelite.api.VarPlayer; -import net.runelite.api.Varbits; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.VarbitChanged; -import net.runelite.client.callback.ClientThread; -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.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; - -@PluginDescriptor( - name = "Kingdom of Miscellania", - description = "Show various informations about your Kingdom of Miscellania", - tags = {"favor", "favour", "managing", "overlay", "indication", "notification"}, - enabledByDefault = false, - type = PluginType.UTILITY -) -@Slf4j -@Singleton -public class KingdomPlugin extends Plugin -{ - private static final ImmutableSet KINGDOM_REGION = ImmutableSet.of(10044, 10300); - - @Inject - private Client client; - - @Inject - private KingdomConfig config; - - @Inject - private ClientThread clientThread; - - @Inject - private ChatMessageManager chatMessageManager; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private ItemManager itemManager; - - @Getter(AccessLevel.PACKAGE) - private int favor = 0, coffer = 0; - - private KingdomCounter counter; - private boolean showInfoboxAnywhere; - private int notifyFavorThreshold; - private int notifyCofferThreshold; - - @Provides - KingdomConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(KingdomConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - } - - @Override - protected void shutDown() - { - removeKingdomInfobox(); - } - - @Subscribe - private void onVarbitChanged(VarbitChanged event) - { - updateKingdomVarbits(); - processInfobox(); - } - - @Subscribe - public void onGameStateChanged(GameStateChanged event) - { - - if (event.getGameState() == GameState.LOGGED_IN) - { - clientThread.invokeLater(() -> - { - updateKingdomVarbits(); - processInfobox(); - notifyFavor(); - notifyCoffer(); - }); - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("kingdomofmiscellania")) - { - return; - } - - updateConfig(); - processInfobox(); - } - - private void processInfobox() - { - if (client.getGameState() == GameState.LOGGED_IN && hasCompletedQuest() && (isInKingdom() || this.showInfoboxAnywhere)) - { - addKingdomInfobox(); - } - else - { - removeKingdomInfobox(); - } - - } - - private void updateKingdomVarbits() - { - if (!hasCompletedQuest()) - { - return; - } - - this.favor = client.getVar(Varbits.KINGDOM_FAVOR); - this.coffer = client.getVar(Varbits.KINGDOM_COFFER); - } - - private void addKingdomInfobox() - { - if (counter == null) - { - counter = new KingdomCounter(itemManager.getImage(TEAK_CHEST), this); - infoBoxManager.addInfoBox(counter); - } - } - - private void removeKingdomInfobox() - { - if (counter != null) - { - infoBoxManager.removeInfoBox(counter); - counter = null; - } - } - - private boolean isInKingdom() - { - return client.getLocalPlayer() != null - && KINGDOM_REGION.contains(client.getLocalPlayer().getWorldLocation().getRegionID()); - } - - private boolean hasCompletedQuest() - { - return client.getVar(VarPlayer.THRONE_OF_MISCELLANIA) > 0; - } - - static int getFavorPercent(int favor) - { - return (favor * 100) / 127; - } - - private void notifyFavor() - { - if (hasCompletedQuest() && getFavorPercent(favor) < this.notifyFavorThreshold) - { - sendChatMessage("Your favor with your kingdom is below " + this.notifyFavorThreshold + "%."); - } - } - - private void notifyCoffer() - { - if (hasCompletedQuest() && coffer < this.notifyCofferThreshold) - { - sendChatMessage("Your kingdom's coffer has less than " + NumberFormat.getIntegerInstance().format(this.notifyCofferThreshold) + " coins in it."); - } - } - - private void sendChatMessage(String chatMessage) - { - final String message = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append(chatMessage) - .build(); - - chatMessageManager.queue( - QueuedMessage.builder() - .type(ChatMessageType.CONSOLE) - .runeLiteFormattedMessage(message) - .build()); - } - - private void updateConfig() - { - this.showInfoboxAnywhere = config.showInfoboxAnywhere(); - this.notifyFavorThreshold = config.notifyFavorThreshold(); - this.notifyCofferThreshold = config.notifyCofferThreshold(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/Book.java b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/Book.java deleted file mode 100644 index 56cd385f6f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/Book.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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.kourendlibrary; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ItemID; -import net.runelite.client.game.ItemManager; -import net.runelite.client.util.AsyncBufferedImage; - -enum Book -{ - DARK_MANUSCRIPT_13514(ItemID.DARK_MANUSCRIPT), - DARK_MANUSCRIPT_13515(ItemID.DARK_MANUSCRIPT_13515), - DARK_MANUSCRIPT_13516(ItemID.DARK_MANUSCRIPT_13516), - DARK_MANUSCRIPT_13517(ItemID.DARK_MANUSCRIPT_13517), - DARK_MANUSCRIPT_13518(ItemID.DARK_MANUSCRIPT_13518), - DARK_MANUSCRIPT_13519(ItemID.DARK_MANUSCRIPT_13519), - DARK_MANUSCRIPT_13520(ItemID.DARK_MANUSCRIPT_13520), - DARK_MANUSCRIPT_13521(ItemID.DARK_MANUSCRIPT_13521), - DARK_MANUSCRIPT_13522(ItemID.DARK_MANUSCRIPT_13522), - DARK_MANUSCRIPT_13523(ItemID.DARK_MANUSCRIPT_13523), - - RADAS_CENSUS(ItemID.RADAS_CENSUS, "Rada's Census", "Census of King Rada III, by Matthias Vorseth."), - RICKTORS_DIARY_7(ItemID.RICKTORS_DIARY_7, "Ricktor's Diary 7", "Diary of Steklan Ricktor, volume 7."), - EATHRAM_RADA_EXTRACT(ItemID.EATHRAM__RADA_EXTRACT, "Eathram & Rada extract", "An extract from Eathram & Rada, by Anonymous."), - KILLING_OF_A_KING(ItemID.KILLING_OF_A_KING, "Killing of a King", "Killing of a King, by Griselle."), - HOSIDIUS_LETTER(ItemID.HOSIDIUS_LETTER, "Hosidius Letter", "A letter from Lord Hosidius to the Council of Elders."), - WINTERTODT_PARABLE(ItemID.WINTERTODT_PARABLE, "Wintertodt Parable", "The Parable of the Wintertodt, by Anonymous."), - TWILL_ACCORD(ItemID.TWILL_ACCORD, "Twill Accord", "The Royal Accord of Twill."), - BYRNES_CORONATION_SPEECH(ItemID.BYRNES_CORONATION_SPEECH, "Byrnes Coronation Speech", "Speech of King Byrne I, on the occasion of his coronation."), - IDEOLOGY_OF_DARKNESS(ItemID.IDEOLOGY_OF_DARKNESS, "The Ideology of Darkness", "The Ideology of Darkness, by Philophaire."), - RADAS_JOURNEY(ItemID.RADAS_JOURNEY, "Rada's Journey", "The Journey of Rada, by Griselle."), - TRANSVERGENCE_THEORY(ItemID.TRANSVERGENCE_THEORY, "Transvergence Theory", "The Theory of Transvergence, by Amon Ducot."), - TRISTESSAS_TRAGEDY(ItemID.TRISTESSAS_TRAGEDY, "Tristessa's Tragedy", "The Tragedy of Tristessa."), - TREACHERY_OF_ROYALTY(ItemID.TREACHERY_OF_ROYALTY, "The Treachery of Royalty", "The Treachery of Royalty, by Professor Answith."), - TRANSPORTATION_INCANTATIONS(ItemID.TRANSPORTATION_INCANTATIONS, "Transportation Incantations", "Transportation Incantations, by Amon Ducot."), - SOUL_JOURNEY(ItemID.SOUL_JOURNEY, "Soul Journey", "The Journey of Souls, by Aretha."), - VARLAMORE_ENVOY(ItemID.VARLAMORE_ENVOY, "Varlamore Envoy", "The Envoy to Varlamore, by Deryk Paulson."); - - private static final Map BY_ID = buildById(); - - private static final Map BY_NAME = buildByName(); - - private static Map buildById() - { - HashMap byId = new HashMap<>(); - for (Book b : Book.values()) - { - byId.put(b.item, b); - } - return Collections.unmodifiableMap(byId); - } - - private static Map buildByName() - { - HashMap byName = new HashMap<>(); - for (Book b : Book.values()) - { - if (!b.isDarkManuscript) - { - byName.put(b.name, b); - } - } - return Collections.unmodifiableMap(byName); - } - - static Book byId(int id) - { - return BY_ID.get(id); - } - - static Book byName(String name) - { - return BY_NAME.get(name); - } - - @Getter(AccessLevel.PACKAGE) - private final int item; - - @Getter(AccessLevel.PACKAGE) - private final String name; - - @Getter(AccessLevel.PACKAGE) - private final String shortName; - - @Getter(AccessLevel.PACKAGE) - private AsyncBufferedImage icon; - - @Getter(AccessLevel.PACKAGE) - private final boolean isDarkManuscript; - - Book(final int id, final String shortName, final String name) - { - this.item = id; - this.isDarkManuscript = false; - this.shortName = shortName; - this.name = name; - } - - Book(final int id) - { - this.item = id; - this.isDarkManuscript = true; - this.name = "Dark Manuscript"; - this.shortName = "Dark Manuscript"; - } - - static void fillImages(ItemManager itemManager) - { - for (Book b : values()) - { - b.icon = itemManager.getImage(b.item); - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/BookPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/BookPanel.java deleted file mode 100644 index ab4f6a6ac1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/BookPanel.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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.kourendlibrary; - -import java.awt.Color; -import javax.inject.Singleton; -import javax.swing.GroupLayout; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; - -@Singleton -class BookPanel extends JPanel -{ - private final JLabel location = new JLabel(); - - BookPanel(final Book b) - { - setBorder(new EmptyBorder(3, 3, 3, 3)); - setBackground(ColorScheme.DARK_GRAY_COLOR); - - GroupLayout layout = new GroupLayout(this); - this.setLayout(layout); - - JLabel image = new JLabel(); - b.getIcon().addTo(image); - JLabel name = new JLabel(b.getShortName()); - location.setFont(FontManager.getRunescapeSmallFont()); - - layout.setVerticalGroup(layout.createParallelGroup() - .addComponent(image) - .addGroup(layout.createSequentialGroup() - .addComponent(name) - .addComponent(location) - ) - ); - - layout.setHorizontalGroup(layout.createSequentialGroup() - .addComponent(image) - .addGap(8) - .addGroup(layout.createParallelGroup() - .addComponent(name) - .addComponent(location) - ) - ); - - // AWT's Z order is weird. This put image at the back of the stack - setComponentZOrder(image, getComponentCount() - 1); - } - - void setLocation(String location) - { - this.location.setText(location); - } - - void setIsTarget(boolean target) - { - location.setForeground(target ? Color.GREEN : Color.WHITE); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/Bookcase.java b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/Bookcase.java deleted file mode 100644 index c4a95d7215..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/Bookcase.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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.kourendlibrary; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.coords.WorldPoint; - -class Bookcase -{ - Bookcase(final WorldPoint location) - { - this.location = location; - this.index = new ArrayList<>(); - } - - @Getter(AccessLevel.PACKAGE) - private final WorldPoint location; - - @Getter(AccessLevel.PACKAGE) - private final List index; - - @Getter(AccessLevel.PACKAGE) - private boolean isBookSet; - - /** - * Book in this bookcase as found by the player. - * Will be correct as long as isBookSet is true, unless the library has reset; - */ - @Getter(AccessLevel.PACKAGE) - private Book book; - - /** - * Books that can be in this slot. Will only be populated if library.state != SolvedState.NO_DATA - */ - @Getter(AccessLevel.PACKAGE) - private Set possibleBooks = new HashSet<>(); - - void clearBook() - { - book = null; - isBookSet = false; - } - - void setBook(Book book) - { - this.book = book; - this.isBookSet = true; - } - - String getLocationString() - { - StringBuilder b = new StringBuilder(); - - // Floors 2 and 3 - boolean north = location.getY() > 3815; - boolean west = location.getX() < 1625; - - // Floor 1 has slightly different dimensions - if (location.getPlane() == 0) - { - north = location.getY() > 3813; - west = location.getX() < 1627; - } - - if (north && west) - { - b.append("Northwest"); - } - else if (north) - { - b.append("Northeast"); - } - else if (west) - { - b.append("Southwest"); - } - else - { - b.append("Center"); - } - - b.append(" "); - - switch (location.getPlane()) - { - case 0: - b.append("ground floor"); - break; - case 1: - b.append("middle floor"); - break; - case 2: - b.append("top floor"); - break; - } - - if (KourendLibraryPlugin.debug) - { - b.append(" ").append(index.stream().map(Object::toString).collect(Collectors.joining(", "))); - } - return b.toString(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryConfig.java deleted file mode 100644 index 2abb7c2255..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryConfig.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.kourendlibrary; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("kourendLibrary") -public interface KourendLibraryConfig extends Config -{ - String GROUP_KEY = "kourendLibrary"; - - @ConfigItem( - keyName = "hideButton", - name = "Hide when outside of the library", - description = "Don't show the button in the sidebar when you're not in the library" - ) - default boolean hideButton() - { - return true; - } - - @ConfigItem( - keyName = "hideDuplicateBook", - name = "Hide duplicate book", - description = "Don't show the duplicate book locations in the library" - ) - default boolean hideDuplicateBook() - { - return true; - } - - @ConfigItem( - keyName = "hideVarlamoreEnvoy", - name = "Hide Varlamore Envoy", - description = "Whether to hide Varlamore Envoy, as it is only required in the Depths of Despair quest, and is never asked for." - ) - default boolean hideVarlamoreEnvoy() - { - return false; - } - - @ConfigItem( - keyName = "showTutorialOverlay", - name = "Show tutorial overlay", - description = "Whether to show an overlay to help understand how to use the plugin" - ) - default boolean showTutorialOverlay() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryOverlay.java deleted file mode 100644 index 2b54575b48..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryOverlay.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * 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.kourendlibrary; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FontMetrics; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.geom.Rectangle2D; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.stream.Collectors; -import javax.annotation.Nullable; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.Perspective; -import static net.runelite.api.Perspective.getCanvasTilePoly; -import net.runelite.api.Player; -import net.runelite.api.Point; -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; - -@Singleton -class KourendLibraryOverlay extends Overlay -{ - private static final int MAXIMUM_DISTANCE = 24; - private final Library library; - private final Client client; - private final KourendLibraryPlugin plugin; - - @Inject - private KourendLibraryOverlay(final Library library, final Client client, final KourendLibraryPlugin plugin) - { - this.library = library; - this.client = client; - this.plugin = plugin; - - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D g) - { - Player player = client.getLocalPlayer(); - if (player == null) - { - return null; - } - - WorldPoint playerLoc = player.getWorldLocation(); - - if (playerLoc.getRegionID() != KourendLibraryPlugin.REGION) - { - return null; - } - - List allBookcases = library.getBookcasesOnLevel(client.getPlane()); - - for (Bookcase bookcase : allBookcases) - { - // AABB - WorldPoint caseLoc = bookcase.getLocation(); - if (Math.abs(playerLoc.getX() - caseLoc.getX()) > MAXIMUM_DISTANCE - || Math.abs(playerLoc.getY() - caseLoc.getY()) > MAXIMUM_DISTANCE) - { - continue; - } - - LocalPoint localBookcase = LocalPoint.fromWorld(client, caseLoc); - if (localBookcase == null) - { - continue; - } - Point screenBookcase = Perspective.localToCanvas(client, localBookcase, caseLoc.getPlane(), 25); - - if (screenBookcase != null) - { - boolean bookIsKnown = bookcase.isBookSet(); - Book book = bookcase.getBook(); - Set possible = bookcase.getPossibleBooks(); - if (bookIsKnown && book == null) - { - for (Book b : possible) - { - if (b != null && b.isDarkManuscript()) - { - book = b; - break; - } - } - } - - if (!bookIsKnown && possible.size() == 1) - { - book = possible.iterator().next(); - bookIsKnown = true; - } - - if (book == Book.VARLAMORE_ENVOY && plugin.isHideVarlamoreEnvoy()) - { - continue; - } - Color color = bookIsKnown ? (book == library.getCustomerBook() ? Color.GREEN : Color.ORANGE) : Color.WHITE; - - // Render the poly on the floor - if (!(bookIsKnown && book == null) && (library.getState() == SolvedState.NO_DATA || book != null || !possible.isEmpty()) && shouldShowOverlayIfDuplicateBook(book)) - { - Polygon poly = getCanvasTilePoly(client, localBookcase); - if (poly != null) - { - OverlayUtil.renderPolygon(g, poly, color); - } - } - - int height = 0; - // If the book is singled out, render the text and the book's icon - if (bookIsKnown) - { - if (book != null && shouldShowOverlayIfDuplicateBook(book)) - { - FontMetrics fm = g.getFontMetrics(); - Rectangle2D bounds = fm.getStringBounds(book.getShortName(), g); - height = (int) bounds.getHeight() + book.getIcon().getHeight() + 6; - Point textLoc = new Point( - (int) (screenBookcase.getX() - (bounds.getWidth() / 2)), - screenBookcase.getY() - (height / 2) + (int) bounds.getHeight() - ); - OverlayUtil.renderTextLocation(g, textLoc, book.getShortName(), color); - g.drawImage( - book.getIcon(), - screenBookcase.getX() - (book.getIcon().getWidth() / 2), - screenBookcase.getY() + (height / 2) - book.getIcon().getHeight(), - null - ); - } - } - else - { - // otherwise render up to 9 icons of the possible books in the bookcase in a square - final int BOOK_ICON_SIZE = 32; - Book[] books = possible.stream() - .filter(Objects::nonNull) - .limit(9) - .toArray(Book[]::new); - if (books.length > 1 && books.length <= 9) - { - int cols = (int) Math.ceil(Math.sqrt(books.length)); - int rows = (int) Math.ceil((double) books.length / cols); - height = rows * BOOK_ICON_SIZE; - int xbase = screenBookcase.getX() - ((cols * BOOK_ICON_SIZE) / 2); - int ybase = screenBookcase.getY() - rows * BOOK_ICON_SIZE / 2; - - for (int i = 0; i < books.length; i++) - { - int col = i % cols; - int row = i / cols; - int x = col * BOOK_ICON_SIZE; - int y = row * BOOK_ICON_SIZE; - if (row == rows - 1) - { - x += (BOOK_ICON_SIZE * (books.length % rows)) / 2; - } - g.drawImage(books[i].getIcon(), xbase + x, ybase + y, null); - } - } - } - - // Draw the bookcase's ID on top - if (KourendLibraryPlugin.debug) - { - FontMetrics fm = g.getFontMetrics(); - String str = bookcase.getIndex().stream().map(Object::toString).collect(Collectors.joining(", ")); - Rectangle2D bounds = fm.getStringBounds(str, g); - Point textLoc = new Point((int) (screenBookcase.getX() - (bounds.getWidth() / 2)), screenBookcase.getY() - (height / 2)); - OverlayUtil.renderTextLocation(g, textLoc, str, Color.WHITE); - } - } - } - - // Render the customer's wanted book on their head and a poly under their feet - int customerId = library.getCustomerId(); - if (customerId != -1) - { - for (NPC n : plugin.getNpcsToMark()) - { - if (n.getId() != customerId) - { - continue; - } - - Book b = library.getCustomerBook(); - boolean doesPlayerContainBook = plugin.doesPlayerContainBook(b); - LocalPoint local = n.getLocalLocation(); - Polygon poly = getCanvasTilePoly(client, local); - OverlayUtil.renderPolygon(g, poly, doesPlayerContainBook ? Color.GREEN : Color.WHITE); - Point screen = Perspective.localToCanvas(client, local, client.getPlane(), n.getLogicalHeight()); - if (screen != null) - { - g.drawImage(b.getIcon(), screen.getX() - (b.getIcon().getWidth() / 2), screen.getY() - b.getIcon().getHeight(), null); - } - } - } - - return null; - } - - private boolean shouldShowOverlayIfDuplicateBook(@Nullable Book book) - { - return !plugin.isHideDuplicateBook() - || book == null - || book.isDarkManuscript() - || !plugin.doesPlayerContainBook(book); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryPanel.java deleted file mode 100644 index ad822f5f85..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryPanel.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2018 Abex - * Copyright (c) 2018 Psikoi - * 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.kourendlibrary; - -import com.google.inject.Inject; -import java.awt.BorderLayout; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.image.BufferedImage; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.stream.Stream; -import javax.inject.Singleton; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import javax.swing.border.EmptyBorder; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.util.ImageUtil; - -@Singleton -class KourendLibraryPanel extends PluginPanel -{ - private static final ImageIcon RESET_ICON; - private static final ImageIcon RESET_HOVER_ICON; - - private final KourendLibraryConfig config; - private final Library library; - - private final HashMap bookPanels = new HashMap<>(); - - static - { - final BufferedImage resetIcon = ImageUtil.getResourceStreamFromClass(KourendLibraryPanel.class, "/util/reset.png"); - RESET_ICON = new ImageIcon(resetIcon); - RESET_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(resetIcon, -100)); - } - - @Inject - KourendLibraryPanel(KourendLibraryConfig config, Library library) - { - super(); - - this.config = config; - this.library = library; - } - - void init() - { - setLayout(new BorderLayout(0, 5)); - setBorder(new EmptyBorder(10, 10, 10, 10)); - setBackground(ColorScheme.DARK_GRAY_COLOR); - - JPanel books = new JPanel(new GridBagLayout()); - GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.HORIZONTAL; - c.weightx = 1; - c.gridx = 0; - c.gridy = 0; - Stream.of(Book.values()) - .filter(b -> !b.isDarkManuscript()) - .filter(b -> !config.hideVarlamoreEnvoy() || b != Book.VARLAMORE_ENVOY) - .sorted(Comparator.comparing(Book::getShortName)) - .forEach(b -> - { - BookPanel p = new BookPanel(b); - bookPanels.put(b, p); - books.add(p, c); - c.gridy++; - }); - - JButton reset = new JButton("Reset", RESET_ICON); - reset.setRolloverIcon(RESET_HOVER_ICON); - reset.addActionListener(ev -> - { - library.reset(); - update(); - }); - - add(reset, BorderLayout.NORTH); - add(books, BorderLayout.CENTER); - update(); - } - - void update() - { - SwingUtilities.invokeLater(() -> - { - Book customerBook = library.getCustomerBook(); - for (Map.Entry b : bookPanels.entrySet()) - { - b.getValue().setIsTarget(customerBook == b.getKey()); - } - - HashMap> bookLocations = new HashMap<>(); - - for (Bookcase bookcase : library.getBookcases()) - { - if (bookcase.getBook() != null) - { - bookLocations.computeIfAbsent(bookcase.getBook(), a -> new HashSet<>()).add(bookcase.getLocationString()); - } - else - { - for (Book book : bookcase.getPossibleBooks()) - { - if (book != null) - { - bookLocations.computeIfAbsent(book, a -> new HashSet<>()).add(bookcase.getLocationString()); - } - } - } - } - - for (Map.Entry e : bookPanels.entrySet()) - { - HashSet locs = bookLocations.get(e.getKey()); - if (locs == null || locs.size() > 3) - { - e.getValue().setLocation("Unknown"); - } - else - { - e.getValue().setLocation("" + String.join("
", locs) + ""); - } - } - }); - } - - void reload() - { - bookPanels.clear(); - removeAll(); - init(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryPlugin.java deleted file mode 100644 index d58e55de97..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryPlugin.java +++ /dev/null @@ -1,386 +0,0 @@ -/* - * 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.kourendlibrary; - -import com.google.inject.Provides; -import java.awt.image.BufferedImage; -import java.util.EnumSet; -import java.util.HashSet; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.swing.SwingUtilities; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.AnimationID; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.MenuOpcode; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.Player; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.AnimationChanged; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.util.ImageUtil; - -@PluginDescriptor( - name = "Kourend Library", - description = "Show where the books are found in the Kourend Library", - tags = {"arceuus", "magic", "runecrafting", "overlay", "panel"}, - type = PluginType.MINIGAME -) -@Slf4j -@Singleton -public class KourendLibraryPlugin extends Plugin -{ - private static final Pattern BOOK_EXTRACTOR = Pattern.compile("'(.*)'"); - private static final Pattern TAG_MATCHER = Pattern.compile("(<[^>]*>)"); - static final int REGION = 6459; - - static final boolean debug = false; - - @Inject - private ClientToolbar clientToolbar; - - @Inject - private Client client; - - @Inject - private Library library; - - @Inject - private OverlayManager overlayManager; - - @Inject - private KourendLibraryOverlay overlay; - - @Inject - private KourendLibraryConfig config; - - @Inject - private KourendLibraryTutorialOverlay tutorialOverlay; - - @Inject - private ItemManager itemManager; - - private KourendLibraryPanel panel; - private NavigationButton navButton; - private boolean buttonAttached = false; - private WorldPoint lastBookcaseClick = null; - private WorldPoint lastBookcaseAnimatedOn = null; - private EnumSet playerBooks = null; - - @Getter(AccessLevel.PACKAGE) - private final Set npcsToMark = new HashSet<>(); - - private boolean hideButton; - @Getter(AccessLevel.PACKAGE) - private boolean hideDuplicateBook; - @Getter(AccessLevel.PACKAGE) - private boolean hideVarlamoreEnvoy; - @Getter(AccessLevel.PACKAGE) - private boolean showTutorialOverlay; - - @Provides - KourendLibraryConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(KourendLibraryConfig.class); - } - - @Override - protected void startUp() - { - - hideButton = config.hideButton(); - hideDuplicateBook = config.hideDuplicateBook(); - hideVarlamoreEnvoy = config.hideVarlamoreEnvoy(); - showTutorialOverlay = config.showTutorialOverlay(); - - Book.fillImages(itemManager); - - panel = injector.getInstance(KourendLibraryPanel.class); - panel.init(); - - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "panel_icon.png"); - - navButton = NavigationButton.builder() - .tooltip("Kourend Library") - .priority(6) - .icon(icon) - .panel(panel) - .build(); - - overlayManager.add(overlay); - overlayManager.add(tutorialOverlay); - - updatePlayerBooks(); - - if (!this.hideButton) - { - clientToolbar.addNavigation(navButton); - } - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - overlayManager.remove(tutorialOverlay); - clientToolbar.removeNavigation(navButton); - buttonAttached = false; - lastBookcaseClick = null; - lastBookcaseAnimatedOn = null; - playerBooks = null; - npcsToMark.clear(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged ev) - { - if (!KourendLibraryConfig.GROUP_KEY.equals(ev.getGroup())) - { - return; - } - - if (ev.getKey().equals("hideVarlamoreEnvoy")) - { - SwingUtilities.invokeLater(panel::reload); - } - else if (ev.getKey().equals("hideButton")) - { - SwingUtilities.invokeLater(() -> - { - if (!config.hideButton()) - { - clientToolbar.addNavigation(navButton); - } - else - { - Player lp = client.getLocalPlayer(); - boolean inRegion = lp != null && lp.getWorldLocation().getRegionID() == REGION; - if (inRegion) - { - clientToolbar.addNavigation(navButton); - } - else - { - clientToolbar.removeNavigation(navButton); - } - } - }); - } - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked menuOpt) - { - if (MenuOpcode.GAME_OBJECT_FIRST_OPTION == menuOpt.getMenuOpcode() && menuOpt.getTarget().contains("Bookshelf")) - { - lastBookcaseClick = WorldPoint.fromScene(client, menuOpt.getParam0(), menuOpt.getParam1(), client.getPlane()); - } - } - - @Subscribe - private void onAnimationChanged(AnimationChanged anim) - { - if (anim.getActor() == client.getLocalPlayer() && anim.getActor().getAnimation() == AnimationID.LOOKING_INTO) - { - lastBookcaseAnimatedOn = lastBookcaseClick; - } - } - - @Subscribe - private void onChatMessage(ChatMessage event) - { - if (lastBookcaseAnimatedOn != null && event.getType() == ChatMessageType.GAMEMESSAGE) - { - if (event.getMessage().equals("You don't find anything useful here.")) - { - library.mark(lastBookcaseAnimatedOn, null); - panel.update(); - lastBookcaseAnimatedOn = null; - } - } - } - - @Subscribe - public void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGIN_SCREEN || - event.getGameState() == GameState.HOPPING) - { - npcsToMark.clear(); - } - } - - @Subscribe - public void onGameTick(GameTick tick) - { - boolean inRegion = client.getLocalPlayer().getWorldLocation().getRegionID() == REGION; - if (this.hideButton && inRegion != buttonAttached) - { - SwingUtilities.invokeLater(() -> - { - if (inRegion) - { - clientToolbar.addNavigation(navButton); - } - else - { - clientToolbar.removeNavigation(navButton); - } - }); - buttonAttached = inRegion; - } - - if (!inRegion) - { - return; - } - - if (lastBookcaseAnimatedOn != null) - { - Widget find = client.getWidget(WidgetInfo.DIALOG_SPRITE_SPRITE); - if (find != null) - { - Book book = Book.byId(find.getItemId()); - if (book != null) - { - library.mark(lastBookcaseAnimatedOn, book); - panel.update(); - lastBookcaseAnimatedOn = null; - } - } - } - - Widget npcHead = client.getWidget(WidgetInfo.DIALOG_NPC_HEAD_MODEL); - if (npcHead != null) - { - if (isLibraryCustomer(npcHead.getModelId())) - { - Widget textw = client.getWidget(WidgetInfo.DIALOG_NPC_TEXT); - String text = textw.getText(); - Matcher m = BOOK_EXTRACTOR.matcher(text); - if (m.find()) - { - String bookName = TAG_MATCHER.matcher(m.group(1).replace("
", " ")).replaceAll(""); - Book book = Book.byName(bookName); - if (book == null) - { - log.warn("Book '{}' is not recognised", bookName); - return; - } - - library.setCustomer(npcHead.getModelId(), book); - panel.update(); - } - else if (text.contains("You can have this other book") || text.contains("please accept a token of my thanks.") || text.contains("Thanks, I'll get on with reading it.")) - { - library.setCustomer(-1, null); - panel.update(); - } - } - } - } - - @Subscribe - private void onItemContainerChanged(ItemContainerChanged itemContainerChangedEvent) - { - updatePlayerBooks(); - } - - @Subscribe - public void onNpcSpawned(NpcSpawned event) - { - if (isLibraryCustomer(event.getNpc().getId())) - { - npcsToMark.add(event.getNpc()); - } - } - - @Subscribe - public void onNpcDespawned(NpcDespawned event) - { - npcsToMark.remove(event.getNpc()); - } - - boolean doesPlayerContainBook(Book book) - { - return playerBooks.contains(book); - } - - private void updatePlayerBooks() - { - ItemContainer itemContainer = client.getItemContainer(InventoryID.INVENTORY); - - if (itemContainer != null) - { - EnumSet books = EnumSet.noneOf(Book.class); - - for (Item item : itemContainer.getItems()) - { - Book book = Book.byId(item.getId()); - - if (book != null) - { - books.add(book); - } - } - - playerBooks = books; - } - } - - static boolean isLibraryCustomer(int npcId) - { - return npcId == NpcID.VILLIA || npcId == NpcID.PROFESSOR_GRACKLEBONE || npcId == NpcID.SAM_7049; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryTutorialOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryTutorialOverlay.java deleted file mode 100644 index 6d6f3b4796..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryTutorialOverlay.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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.kourendlibrary; - -import net.runelite.api.Client; -import net.runelite.api.Player; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import javax.inject.Inject; -import java.awt.Dimension; -import java.awt.Graphics2D; - -class KourendLibraryTutorialOverlay extends Overlay -{ - private final Client client; - private final KourendLibraryConfig config; - private final Library library; - - private final PanelComponent panelComponent; - private final LineComponent noDataMessageComponent; - private final LineComponent incompleteMessageComponent; - private final LineComponent completeMessageComponent; - private final LineComponent sidebarMessageComponent; - - @Inject - private KourendLibraryTutorialOverlay(Client client, KourendLibraryConfig config, Library library) - { - this.client = client; - this.config = config; - this.library = library; - - panelComponent = new PanelComponent(); - panelComponent.setPreferredSize(new Dimension(177, 0)); - - noDataMessageComponent = LineComponent.builder().left("Click on the white squares to start finding books.").build(); - incompleteMessageComponent = LineComponent.builder().left("Some books have been found. Keep checking marked bookcases to find more.").build(); - completeMessageComponent = LineComponent.builder().left("All books found.").build(); - sidebarMessageComponent = LineComponent.builder().left("Locations are in the sidebar.").build(); - - setPriority(OverlayPriority.LOW); - setPosition(OverlayPosition.TOP_LEFT); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!config.showTutorialOverlay()) - { - return null; - } - - Player player = client.getLocalPlayer(); - if (player == null) - { - return null; - } - - WorldPoint playerLoc = player.getWorldLocation(); - if (playerLoc.getRegionID() != KourendLibraryPlugin.REGION) - { - return null; - } - - panelComponent.getChildren().clear(); - - switch (library.getState()) - { - case NO_DATA: - panelComponent.getChildren().add(noDataMessageComponent); - break; - case INCOMPLETE: - panelComponent.getChildren().add(incompleteMessageComponent); - panelComponent.getChildren().add(sidebarMessageComponent); - break; - case COMPLETE: - panelComponent.getChildren().add(completeMessageComponent); - panelComponent.getChildren().add(sidebarMessageComponent); - break; - } - - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/Library.java b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/Library.java deleted file mode 100644 index 61874bfed9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/Library.java +++ /dev/null @@ -1,805 +0,0 @@ -/* - * 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.kourendlibrary; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.stream.IntStream; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.coords.WorldPoint; -import static net.runelite.client.plugins.kourendlibrary.Book.*; - -/** - * Library represents a instance of the Kourend/Arceuus House library. - *

- * The library changes the locations of it's books every 60-90 minutes. - * Of the 554 bookcases in the library, only 346 of them can ever have books. - * 6 of the bookcases in the south-west corner of the top floor are duplicated. - * These 6 bookcases are not handled 100% correctly due to their low chance - * of being used to train the predictor. - *

- * Each of the 352 bookcase slots "Bookcase"s has an index which is used to - * place the book inside of them. The game chooses one of the 5 sequences and a - * bookcase starting index, then places a book from the sequence into every 13th - * bookcase, by index. Each sequence contains 26 Books, consisting of 16 books - * and 10 dark manuscripts. You can only get one dark manuscript at a time, though - * they are all placed into shelves. - */ -@Singleton -@Slf4j -class Library -{ - private final Map byPoint = new HashMap<>(); - private final Map> byLevel = new HashMap<>(); - private final List byIndex = new ArrayList<>(); - - private final List> sequences = populateSequences(); - - private final int step; - - @Getter(AccessLevel.PACKAGE) - private SolvedState state; - - @Getter(AccessLevel.PACKAGE) - private Book customerBook; - - @Getter(AccessLevel.PACKAGE) - private int customerId; - - Library() - { - populateBooks(); - step = byIndex.size() / Book.values().length; - reset(); - } - - synchronized List getBookcasesOnLevel(int z) - { - return Collections.unmodifiableList(byLevel.get(z)); - } - - synchronized List getBookcases() - { - return Collections.unmodifiableList(byIndex); - } - - void setCustomer(int customerId, Book book) - { - this.customerId = customerId; - this.customerBook = book; - } - - synchronized void reset() - { - state = SolvedState.NO_DATA; - for (Bookcase b : byIndex) - { - b.clearBook(); - b.getPossibleBooks().clear(); - } - log.debug("Library is now reset"); - } - - synchronized void mark(WorldPoint loc, Book book) - { - Bookcase bookcase = byPoint.get(loc); - if (bookcase == null) - { - log.debug("Requested non-existent bookcase at {}", loc); - return; - } - - if (bookcase.isBookSet()) - { - // Bookcase is set from a previous mark - // Check for a mismatch, unless it is now null and had a dark manuscript - if (book != bookcase.getBook() && !(book == null && bookcase.getBook().isDarkManuscript())) - { - reset(); - } - } - else if (state != SolvedState.NO_DATA) - { - // Reset if the book we found isn't what we expected - - if (book != null && !bookcase.getPossibleBooks().contains(book)) - { - reset(); - } - } - - if (state == SolvedState.COMPLETE) - { - // Reset if we found nothing when we expected something that wasn't a Dark Manuscript, since the layout has changed - if (book == null && !bookcase.getPossibleBooks().isEmpty() && bookcase.getPossibleBooks().stream().noneMatch(Book::isDarkManuscript)) - { - reset(); - } - else - { - // Everything is known, nothing to do - return; - } - } - - log.debug("Setting bookcase {} to {}", bookcase.getIndex(), book); - for (; ; ) - { - bookcase.setBook(book); - - // Basing the sequences on null is not supported, though possible - if (book == null) - { - return; - } - - // This is one of the 6 bookcases with 2 ids. Not fully supported. - if (bookcase.getIndex().size() != 1) - { - return; - } - - int bookcaseIndex = bookcase.getIndex().get(0); - - state = SolvedState.INCOMPLETE; - - // Map each sequence to the number of bookcases that match the sequence - // return 0 if it is a mismatch. - // Keep in mind that Bookcases with dark manuscripts may be set to null. - int[] certainty = sequences.stream().mapToInt(sequence -> - { - int zero = getBookcaseZeroIndexForSequenceWithBook(sequence, bookcaseIndex, book); - - int found = 0; - for (int i = 0; i < byIndex.size(); i++) - { - int ai = (i + zero) % byIndex.size(); - Bookcase iBookcase = byIndex.get(ai); - if (i % step == 0) - { - int seqI = i / step; - if (iBookcase.isBookSet() && seqI < sequence.size()) - { - Book seqBook = sequence.get(seqI); - boolean isSeqManuscript = seqBook == null || seqBook.isDarkManuscript(); - if (!((isSeqManuscript && iBookcase.getBook() == null) || (iBookcase.getBook() == seqBook))) - { - log.debug("Bailing @ i={} ai={} {}; {} != {}", i, ai, iBookcase.getIndex(), iBookcase.getBook(), seqBook); - found = 0; - break; - } - found++; - } - } - else - { - // Only bail if this isn't a double bookcase - if (iBookcase.isBookSet() && iBookcase.getBook() != null && iBookcase.getIndex().size() == 1) - { - log.debug("Bailing @ i={} ai={} {}; {} is set", i, ai, iBookcase.getIndex(), iBookcase.getBook()); - found = 0; - break; - } - } - } - return found; - }).toArray(); - log.debug("Certainty is now {}", certainty); - - for (Bookcase b : byIndex) - { - b.getPossibleBooks().clear(); - } - - // Write the most likely sequences onto the bookcases - int max = IntStream.of(certainty).max().getAsInt(); - - // We have books set, but 0 sequences match, Something is wrong, reset. - if (max == 0) - { - reset(); - continue; - } - - IntStream.range(0, sequences.size()) - .filter(i -> certainty[i] == max) - .forEach(isequence -> - { - List sequence = sequences.get(isequence); - int zero = getBookcaseZeroIndexForSequenceWithBook(sequence, bookcaseIndex, book); - - for (int i = 0; i < byIndex.size(); i++) - { - int ai = (i + zero) % byIndex.size(); - Bookcase iBookcase = byIndex.get(ai); - if (iBookcase.getBook() == null) - { - int iseq = i / step; - if (i % step == 0 && iseq < sequence.size()) - { - Book seqBook = sequence.get(iseq); - iBookcase.getPossibleBooks().add(seqBook); - } - } - } - }); - if (IntStream.range(0, certainty.length).filter(i -> certainty[i] == max).count() == 1) - { - state = SolvedState.COMPLETE; - } - return; - } - } - - /** - * Find the bookcase index that is index zero in the sequence, identifying by the book in bookcase - */ - private int getBookcaseZeroIndexForSequenceWithBook(List sequences, int bookcaseIndex, Book book) - { - int bookSequence = sequences.indexOf(book); - assert bookSequence >= 0; - - bookcaseIndex -= step * bookSequence; - for (; bookcaseIndex < 0; ) - { - bookcaseIndex += byIndex.size(); - } - return bookcaseIndex; - } - - private List> populateSequences() - { - List> books = Arrays.asList( - Arrays.asList( - DARK_MANUSCRIPT_13516, - KILLING_OF_A_KING, - DARK_MANUSCRIPT_13520, - IDEOLOGY_OF_DARKNESS, - RADAS_JOURNEY, - TRANSVERGENCE_THEORY, - TRISTESSAS_TRAGEDY, - DARK_MANUSCRIPT_13523, - DARK_MANUSCRIPT_13521, - RADAS_CENSUS, - TREACHERY_OF_ROYALTY, - HOSIDIUS_LETTER, - DARK_MANUSCRIPT_13519, - RICKTORS_DIARY_7, - DARK_MANUSCRIPT_13514, - EATHRAM_RADA_EXTRACT, - DARK_MANUSCRIPT_13522, - VARLAMORE_ENVOY, - WINTERTODT_PARABLE, - TWILL_ACCORD, - DARK_MANUSCRIPT_13515, - BYRNES_CORONATION_SPEECH, - DARK_MANUSCRIPT_13517, - SOUL_JOURNEY, - DARK_MANUSCRIPT_13518, - TRANSPORTATION_INCANTATIONS - ), - Arrays.asList( - DARK_MANUSCRIPT_13516, - KILLING_OF_A_KING, - DARK_MANUSCRIPT_13520, - IDEOLOGY_OF_DARKNESS, - RADAS_JOURNEY, - TRANSVERGENCE_THEORY, - TRISTESSAS_TRAGEDY, - DARK_MANUSCRIPT_13523, - DARK_MANUSCRIPT_13521, - RADAS_CENSUS, - TREACHERY_OF_ROYALTY, - HOSIDIUS_LETTER, - VARLAMORE_ENVOY, - DARK_MANUSCRIPT_13519, - RICKTORS_DIARY_7, - DARK_MANUSCRIPT_13514, - EATHRAM_RADA_EXTRACT, - DARK_MANUSCRIPT_13522, - SOUL_JOURNEY, - WINTERTODT_PARABLE, - TWILL_ACCORD, - DARK_MANUSCRIPT_13515, - BYRNES_CORONATION_SPEECH, - DARK_MANUSCRIPT_13517, - DARK_MANUSCRIPT_13518, - TRANSPORTATION_INCANTATIONS - ), - Arrays.asList( - RICKTORS_DIARY_7, - VARLAMORE_ENVOY, - DARK_MANUSCRIPT_13514, - EATHRAM_RADA_EXTRACT, - IDEOLOGY_OF_DARKNESS, - DARK_MANUSCRIPT_13516, - DARK_MANUSCRIPT_13521, - RADAS_CENSUS, - DARK_MANUSCRIPT_13515, - KILLING_OF_A_KING, - DARK_MANUSCRIPT_13520, - TREACHERY_OF_ROYALTY, - HOSIDIUS_LETTER, - DARK_MANUSCRIPT_13519, - BYRNES_CORONATION_SPEECH, - DARK_MANUSCRIPT_13517, - SOUL_JOURNEY, - DARK_MANUSCRIPT_13522, - WINTERTODT_PARABLE, - TWILL_ACCORD, - RADAS_JOURNEY, - TRANSVERGENCE_THEORY, - TRISTESSAS_TRAGEDY, - DARK_MANUSCRIPT_13523, - DARK_MANUSCRIPT_13518, - TRANSPORTATION_INCANTATIONS - ), - Arrays.asList( - RADAS_CENSUS, - DARK_MANUSCRIPT_13522, - RICKTORS_DIARY_7, - DARK_MANUSCRIPT_13514, - EATHRAM_RADA_EXTRACT, - DARK_MANUSCRIPT_13516, - KILLING_OF_A_KING, - DARK_MANUSCRIPT_13520, - HOSIDIUS_LETTER, - DARK_MANUSCRIPT_13519, - DARK_MANUSCRIPT_13521, - WINTERTODT_PARABLE, - TWILL_ACCORD, - DARK_MANUSCRIPT_13515, - BYRNES_CORONATION_SPEECH, - DARK_MANUSCRIPT_13517, - IDEOLOGY_OF_DARKNESS, - RADAS_JOURNEY, - TRANSVERGENCE_THEORY, - TRISTESSAS_TRAGEDY, - DARK_MANUSCRIPT_13523, - TREACHERY_OF_ROYALTY, - DARK_MANUSCRIPT_13518, - TRANSPORTATION_INCANTATIONS, - SOUL_JOURNEY, - VARLAMORE_ENVOY - ), - Arrays.asList( - RADAS_CENSUS, - TRANSVERGENCE_THEORY, - TREACHERY_OF_ROYALTY, - RADAS_JOURNEY, - KILLING_OF_A_KING, - DARK_MANUSCRIPT_13520, - VARLAMORE_ENVOY, - DARK_MANUSCRIPT_13522, - BYRNES_CORONATION_SPEECH, - DARK_MANUSCRIPT_13517, - HOSIDIUS_LETTER, - DARK_MANUSCRIPT_13516, - DARK_MANUSCRIPT_13519, - TRISTESSAS_TRAGEDY, - DARK_MANUSCRIPT_13523, - DARK_MANUSCRIPT_13521, - RICKTORS_DIARY_7, - DARK_MANUSCRIPT_13514, - IDEOLOGY_OF_DARKNESS, - WINTERTODT_PARABLE, - TWILL_ACCORD, - SOUL_JOURNEY, - DARK_MANUSCRIPT_13515, - EATHRAM_RADA_EXTRACT, - DARK_MANUSCRIPT_13518, - TRANSPORTATION_INCANTATIONS - ) - ); - - for (int i = 0; i < books.size(); i++) - { - assert new HashSet<>(books.get(i)).size() == books.get(i).size(); - books.set(i, Collections.unmodifiableList(books.get(i))); - } - return Collections.unmodifiableList(books); - } - - private void add(int x, int y, int z, int i) - { - // 'i' is added as a parameter for readability - WorldPoint p = new WorldPoint(x, y, z); - Bookcase b = byPoint.get(p); - if (b == null) - { - b = new Bookcase(p); - byPoint.put(p, b); - byLevel.computeIfAbsent(z, a -> new ArrayList<>()).add(b); - } - b.getIndex().add(i); - assert i == byIndex.size(); - byIndex.add(b); - } - - private void populateBooks() - { - add(1626, 3795, 0, 0); - add(1625, 3793, 0, 1); - add(1623, 3793, 0, 2); - add(1620, 3792, 0, 3); - add(1624, 3792, 0, 4); - add(1626, 3788, 0, 5); - add(1626, 3787, 0, 6); - add(1624, 3784, 0, 7); - add(1623, 3784, 0, 8); - add(1621, 3784, 0, 9); - add(1615, 3785, 0, 10); - add(1615, 3788, 0, 11); - add(1615, 3790, 0, 12); - add(1614, 3790, 0, 13); - add(1614, 3788, 0, 14); - add(1614, 3786, 0, 15); - add(1612, 3784, 0, 16); - add(1610, 3784, 0, 17); - add(1609, 3784, 0, 18); - add(1607, 3786, 0, 19); - add(1607, 3789, 0, 20); - add(1607, 3795, 0, 21); - add(1607, 3796, 0, 22); - add(1607, 3799, 0, 23); - add(1610, 3801, 0, 24); - add(1612, 3801, 0, 25); - add(1618, 3801, 0, 26); - add(1620, 3801, 0, 27); - add(1620, 3814, 0, 28); - add(1618, 3814, 0, 29); - add(1617, 3814, 0, 30); - add(1615, 3816, 0, 31); - add(1615, 3817, 0, 32); - add(1615, 3820, 0, 33); - add(1614, 3820, 0, 34); - add(1614, 3817, 0, 35); - add(1614, 3816, 0, 36); - add(1612, 3814, 0, 37); - add(1610, 3814, 0, 38); - add(1607, 3816, 0, 39); - add(1607, 3817, 0, 40); - add(1607, 3820, 0, 41); - add(1607, 3826, 0, 42); - add(1607, 3828, 0, 43); - add(1609, 3831, 0, 44); - add(1612, 3831, 0, 45); - add(1614, 3831, 0, 46); - add(1619, 3831, 0, 47); - add(1621, 3831, 0, 48); - add(1624, 3831, 0, 49); - add(1626, 3829, 0, 50); - add(1626, 3827, 0, 51); - add(1624, 3823, 0, 52); - add(1622, 3823, 0, 53); - add(1620, 3823, 0, 54); - add(1621, 3822, 0, 55); - add(1624, 3822, 0, 56); - add(1626, 3820, 0, 57); - add(1639, 3821, 0, 58); - add(1639, 3822, 0, 59); - add(1639, 3827, 0, 60); - add(1639, 3829, 0, 61); - add(1642, 3831, 0, 62); - add(1645, 3831, 0, 63); - add(1646, 3829, 0, 64); - add(1646, 3827, 0, 65); - add(1646, 3826, 0, 66); - add(1647, 3827, 0, 67); - add(1647, 3829, 0, 68); - add(1647, 3830, 0, 69); - add(1652, 3831, 0, 70); - add(1653, 3831, 0, 71); - add(1656, 3831, 0, 72); - add(1658, 3829, 0, 73); - add(1658, 3826, 0, 74); - add(1658, 3825, 0, 75); - add(1658, 3820, 0, 76); - add(1658, 3819, 0, 77); - add(1658, 3816, 0, 78); - add(1655, 3814, 0, 79); - add(1654, 3814, 0, 80); - add(1651, 3817, 0, 81); - add(1651, 3819, 0, 82); - add(1651, 3820, 0, 83); - add(1650, 3821, 0, 84); - add(1650, 3819, 0, 85); - add(1650, 3816, 0, 86); - add(1648, 3814, 0, 87); - add(1646, 3814, 0, 88); - add(1645, 3814, 0, 89); - add(1607, 3820, 1, 90); - add(1607, 3821, 1, 91); - add(1609, 3822, 1, 92); - add(1612, 3823, 1, 93); - add(1611, 3823, 1, 94); - add(1607, 3824, 1, 95); - add(1607, 3825, 1, 96); - add(1607, 3827, 1, 97); - add(1611, 3831, 1, 98); - add(1612, 3831, 1, 99); - add(1613, 3831, 1, 100); - add(1617, 3831, 1, 101); - add(1618, 3831, 1, 102); - add(1620, 3831, 1, 103); - add(1624, 3831, 1, 104); - add(1624, 3829, 1, 105); - add(1624, 3825, 1, 106); - add(1624, 3824, 1, 107); - add(1624, 3819, 1, 108); - add(1624, 3817, 1, 109); - add(1623, 3816, 1, 110); - add(1621, 3816, 1, 111); - add(1617, 3816, 1, 112); - add(1616, 3816, 1, 113); - add(1611, 3816, 1, 114); - add(1609, 3816, 1, 115); - add(1620, 3820, 1, 116); - add(1620, 3822, 1, 117); - add(1620, 3824, 1, 118); - add(1620, 3825, 1, 119); - add(1620, 3827, 1, 120); - add(1621, 3826, 1, 121); - add(1621, 3822, 1, 122); - add(1621, 3820, 1, 123); - add(1607, 3788, 1, 124); - add(1607, 3789, 1, 125); - add(1609, 3790, 1, 126); - add(1611, 3790, 1, 127); - add(1613, 3790, 1, 128); - add(1614, 3789, 1, 129); - add(1615, 3788, 1, 130); - add(1615, 3790, 1, 131); - add(1614, 3791, 1, 132); - add(1613, 3791, 1, 133); - add(1610, 3791, 1, 134); - add(1609, 3791, 1, 135); - add(1608, 3791, 1, 136); - add(1607, 3793, 1, 137); - add(1607, 3794, 1, 138); - add(1608, 3799, 1, 139); - add(1610, 3799, 1, 140); - add(1615, 3799, 1, 141); - add(1616, 3799, 1, 142); - add(1621, 3799, 1, 143); - add(1623, 3799, 1, 144); - add(1624, 3798, 1, 145); - add(1624, 3796, 1, 146); - add(1624, 3792, 1, 147); - add(1624, 3791, 1, 148); - add(1623, 3789, 1, 149); - add(1621, 3789, 1, 150); - add(1620, 3788, 1, 151); - add(1621, 3788, 1, 152); - add(1624, 3787, 1, 153); - add(1624, 3786, 1, 154); - add(1619, 3784, 1, 155); - add(1618, 3784, 1, 156); - add(1616, 3784, 1, 157); - add(1612, 3784, 1, 158); - add(1611, 3784, 1, 159); - add(1625, 3801, 1, 160); - add(1625, 3802, 1, 161); - add(1625, 3803, 1, 162); - add(1625, 3804, 1, 163); - add(1625, 3806, 1, 164); - add(1625, 3807, 1, 165); - add(1625, 3808, 1, 166); - add(1625, 3809, 1, 167); - add(1625, 3811, 1, 168); - add(1625, 3812, 1, 169); - add(1625, 3813, 1, 170); - add(1625, 3814, 1, 171); - add(1626, 3815, 1, 172); - add(1627, 3815, 1, 173); - add(1631, 3815, 1, 174); - add(1632, 3815, 1, 175); - add(1633, 3815, 1, 176); - add(1634, 3815, 1, 177); - add(1638, 3815, 1, 178); - add(1639, 3815, 1, 179); - add(1640, 3814, 1, 180); - add(1640, 3813, 1, 181); - add(1640, 3803, 1, 182); - add(1640, 3802, 1, 183); - add(1640, 3801, 1, 184); - add(1639, 3800, 1, 185); - add(1638, 3800, 1, 186); - add(1634, 3800, 1, 187); - add(1633, 3800, 1, 188); - add(1632, 3800, 1, 189); - add(1631, 3800, 1, 190); - add(1627, 3800, 1, 191); - add(1626, 3800, 1, 192); - add(1641, 3817, 1, 193); - add(1641, 3818, 1, 194); - add(1641, 3819, 1, 195); - add(1641, 3824, 1, 196); - add(1641, 3825, 1, 197); - add(1641, 3829, 1, 198); - add(1645, 3831, 1, 199); - add(1646, 3831, 1, 200); - add(1647, 3831, 1, 201); - add(1648, 3831, 1, 202); - add(1649, 3830, 1, 203); - add(1649, 3828, 1, 204); - add(1650, 3829, 1, 205); - add(1652, 3831, 1, 206); - add(1653, 3831, 1, 207); - add(1658, 3827, 1, 208); - add(1658, 3826, 1, 209); - add(1658, 3823, 1, 210); - add(1658, 3822, 1, 211); - add(1658, 3821, 1, 212); - add(1658, 3820, 1, 213); - add(1656, 3816, 1, 214); - add(1655, 3816, 1, 215); - add(1651, 3816, 1, 216); - add(1649, 3816, 1, 217); - add(1648, 3816, 1, 218); - add(1644, 3816, 1, 219); - add(1643, 3816, 1, 220); - add(1607, 3785, 2, 221); - add(1607, 3786, 2, 222); - add(1607, 3796, 2, 223); - add(1607, 3797, 2, 224); - add(1608, 3799, 2, 225); - add(1610, 3799, 2, 226); - add(1611, 3799, 2, 227); - add(1618, 3799, 2, 228); - add(1621, 3799, 2, 229); - add(1624, 3797, 2, 230); - add(1624, 3795, 2, 231); - add(1624, 3794, 2, 232); - add(1624, 3792, 2, 233); - add(1623, 3791, 2, 234); - add(1622, 3791, 2, 235); - add(1618, 3792, 2, 236); - add(1618, 3793, 2, 237); - add(1618, 3794, 2, 238); - add(1617, 3793, 2, 239); - add(1617, 3792, 2, 240); - add(1618, 3790, 2, 241); - add(1620, 3790, 2, 242); - add(1622, 3790, 2, 243); - add(1624, 3789, 2, 244); - add(1624, 3788, 2, 245); - add(1624, 3786, 2, 246); - add(1624, 3785, 2, 247); - add(1623, 3784, 2, 248); - add(1621, 3784, 2, 249); - add(1611, 3784, 2, 250); - add(1609, 3784, 2, 251); - add(1612, 3789, 2, 252); - add(1612, 3791, 2, 253); - add(1612, 3794, 2, 254); - add(1613, 3793, 2, 255); - add(1613, 3792, 2, 256); - add(1613, 3791, 2, 257); - add(1617, 3791, 2, 258); - add(1617, 3793, 2, 259); - add(1618, 3794, 2, 260); - add(1618, 3792, 2, 261); - add(1619, 3791, 2, 262); - add(1623, 3791, 2, 263); - add(1623, 3790, 2, 264); - add(1622, 3790, 2, 265); - add(1619, 3790, 2, 266); - add(1611, 3816, 2, 267); - add(1610, 3816, 2, 268); - add(1609, 3816, 2, 269); - add(1607, 3817, 2, 270); - add(1607, 3819, 2, 271); - add(1607, 3829, 2, 272); - add(1608, 3831, 2, 273); - add(1610, 3831, 2, 274); - add(1611, 3831, 2, 275); - add(1622, 3831, 2, 276); - add(1623, 3831, 2, 277); - add(1624, 3829, 2, 278); - add(1624, 3828, 2, 279); - add(1624, 3821, 2, 280); - add(1624, 3819, 2, 281); - add(1622, 3816, 2, 282); - add(1620, 3816, 2, 283); - add(1618, 3816, 2, 284); - add(1615, 3821, 2, 285); - add(1617, 3821, 2, 286); - add(1619, 3822, 2, 287); - add(1619, 3824, 2, 288); - add(1618, 3826, 2, 289); - add(1617, 3826, 2, 290); - add(1615, 3827, 2, 291); - add(1616, 3827, 2, 292); - add(1618, 3827, 2, 293); - add(1620, 3826, 2, 294); - add(1620, 3824, 2, 295); - add(1620, 3822, 2, 296); - add(1620, 3821, 2, 297); - add(1619, 3820, 2, 298); - add(1617, 3820, 2, 299); - add(1615, 3820, 2, 300); - add(1641, 3818, 2, 301); - add(1641, 3820, 2, 302); - add(1641, 3821, 2, 303); - add(1641, 3829, 2, 304); - add(1643, 3831, 2, 305); - add(1644, 3831, 2, 306); - add(1654, 3831, 2, 307); - add(1656, 3831, 2, 308); - add(1658, 3830, 2, 309); - add(1658, 3828, 2, 310); - add(1658, 3818, 2, 311); - add(1658, 3817, 2, 312); - add(1656, 3816, 2, 313); - add(1655, 3816, 2, 314); - add(1652, 3816, 2, 315); - add(1648, 3817, 2, 316); - add(1648, 3819, 2, 317); - add(1648, 3821, 2, 318); - add(1649, 3823, 2, 319); - add(1650, 3823, 2, 320); - add(1652, 3823, 2, 321); - add(1654, 3822, 2, 322); - add(1654, 3820, 2, 323); - add(1655, 3820, 2, 324); - add(1655, 3821, 2, 325); - add(1655, 3823, 2, 326); - add(1653, 3824, 2, 327); - add(1652, 3824, 2, 328); - add(1649, 3824, 2, 329); - add(1648, 3824, 2, 330); - add(1647, 3822, 2, 331); - add(1647, 3820, 2, 332); - add(1647, 3818, 2, 333); - add(1645, 3816, 2, 334); - add(1644, 3816, 2, 335); - add(1625, 3802, 2, 336); - add(1625, 3804, 2, 337); - add(1625, 3811, 2, 338); - add(1625, 3812, 2, 339); - add(1627, 3815, 2, 340); - add(1628, 3815, 2, 341); - add(1635, 3815, 2, 342); - add(1637, 3815, 2, 343); - add(1638, 3815, 2, 344); - add(1640, 3813, 2, 345); - add(1640, 3811, 2, 346); - add(1640, 3810, 2, 347); - add(1638, 3800, 2, 348); - add(1632, 3800, 2, 349); - add(1630, 3800, 2, 350); - add(1629, 3800, 2, 351); - add(1627, 3800, 2, 352); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/LibraryCustomer.java b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/LibraryCustomer.java deleted file mode 100644 index 9de04a826a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/LibraryCustomer.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.kourendlibrary; - -import java.util.HashMap; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.NpcID; - -enum LibraryCustomer -{ - VILLIA(NpcID.VILLIA, "Villia"), - PROFESSOR_GRACKLEBONE(NpcID.PROFESSOR_GRACKLEBONE, "Prof. Gracklebone"), - SAM(NpcID.SAM_7049, "Sam"); - - @Getter(AccessLevel.PACKAGE) - private final int id; - - @Getter(AccessLevel.PACKAGE) - private final String name; - - private static final Map byId = buildIdMap(); - - LibraryCustomer(int id, String name) - { - this.id = id; - this.name = name; - } - - static LibraryCustomer getById(int id) - { - return byId.get(id); - } - - private static Map buildIdMap() - { - Map byId = new HashMap<>(); - for (LibraryCustomer c : values()) - { - byId.put(c.id, c); - } - return byId; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/SolvedState.java b/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/SolvedState.java deleted file mode 100644 index 095d7c8a1e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/SolvedState.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.kourendlibrary; - -enum SolvedState -{ - NO_DATA, - INCOMPLETE, - COMPLETE -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/leaguechaticons/LeagueChatIconsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/leaguechaticons/LeagueChatIconsPlugin.java deleted file mode 100644 index cf418e3a26..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/leaguechaticons/LeagueChatIconsPlugin.java +++ /dev/null @@ -1,351 +0,0 @@ -/* - * Copyright (c) 2019, hsamoht - * 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.leaguechaticons; - -import java.awt.image.BufferedImage; -import java.util.Arrays; -import javax.inject.Inject; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatPlayer; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.IconID; -import net.runelite.api.IndexedSprite; -import net.runelite.api.MessageNode; -import net.runelite.api.Player; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.chat.ChatMessageManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.game.WorldService; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.util.ImageUtil; -import net.runelite.http.api.worlds.World; -import net.runelite.http.api.worlds.WorldResult; -import net.runelite.http.api.worlds.WorldType; - -@PluginDescriptor( - name = "League Chat Icons", - description = "Changes the chat icon for players on league worlds", - enabledByDefault = false, - type = PluginType.MISCELLANEOUS -) -@Slf4j -public class LeagueChatIconsPlugin extends Plugin -{ - private static final String SCRIPT_EVENT_SET_CHATBOX_INPUT = "setChatboxInput"; - private static final String IRONMAN_PREFIX = ""; - - @Inject - private Client client; - - @Inject - private ChatMessageManager chatMessageManager; - - @Inject - private WorldService worldService; - - @Inject - private ClientThread clientThread; - - private int leagueIconOffset = -1; // offset for league icon - private boolean onLeagueWorld; - - @Override - protected void startUp() - { - onLeagueWorld = false; - - clientThread.invoke(() -> - { - if (client.getGameState() == GameState.LOGGED_IN) - { - loadLeagueIcon(); - onLeagueWorld = isLeagueWorld(client.getWorld()); - if (onLeagueWorld) - { - setChatboxName(getNameChatbox()); - } - } - }); - } - - @Override - protected void shutDown() - { - clientThread.invoke(() -> - { - if (client.getGameState() == GameState.LOGGED_IN && onLeagueWorld) - { - setChatboxName(getNameDefault()); - } - }); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged gameStateChanged) - { - if (gameStateChanged.getGameState() == GameState.LOGGED_IN) - { - loadLeagueIcon(); - onLeagueWorld = isLeagueWorld(client.getWorld()); - } - } - - @Subscribe - private void onScriptCallbackEvent(ScriptCallbackEvent scriptCallbackEvent) - { - if (scriptCallbackEvent.getEventName().equals(SCRIPT_EVENT_SET_CHATBOX_INPUT) && onLeagueWorld) - { - setChatboxName(getNameChatbox()); - } - } - - @Subscribe - private void onChatMessage(ChatMessage chatMessage) - { - if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - switch (chatMessage.getType()) - { - case PRIVATECHAT: - case MODPRIVATECHAT: - // Note this is unable to change icon on PMs if they are not a friend or in clan chat - case FRIENDSCHAT: - String name = Text.removeTags(chatMessage.getName()); - if (isChatPlayerOnLeague(name)) - { - addLeagueIconToMessage(chatMessage); - } - break; - case PUBLICCHAT: - case MODCHAT: - if (onLeagueWorld) - { - addLeagueIconToMessage(chatMessage); - } - break; - } - } - - /** - * Adds the League Icon in front of player names chatting from a league world. - * - * @param chatMessage chat message to edit sender name on - */ - private void addLeagueIconToMessage(ChatMessage chatMessage) - { - String name = chatMessage.getName(); - if (!name.startsWith(IRONMAN_PREFIX)) - { - // don't replace non-ironman icons, like mods - return; - } - - name = Text.removeTags(name); - - final MessageNode messageNode = chatMessage.getMessageNode(); - messageNode.setName(getNameWithIcon(leagueIconOffset, name)); - - chatMessageManager.update(messageNode); - client.refreshChat(); - } - - /** - * Update the player name in the chatbox input - */ - private void setChatboxName(String name) - { - Widget chatboxInput = client.getWidget(WidgetInfo.CHATBOX_INPUT); - if (chatboxInput != null) - { - String text = chatboxInput.getText(); - int idx = text.indexOf(':'); - if (idx != -1) - { - String newText = name + text.substring(idx); - chatboxInput.setText(newText); - } - } - } - - /** - * Gets the league name, including possible icon, of the local player. - * - * @return String of icon + name - */ - private String getNameChatbox() - { - Player player = client.getLocalPlayer(); - if (player != null) - { - return getNameWithIcon(leagueIconOffset, player.getName()); - } - return null; - } - - /** - * Gets the default name, including possible icon, of the local player. - * - * @return String of icon + name - */ - private String getNameDefault() - { - Player player = client.getLocalPlayer(); - if (player == null) - { - return null; - } - - int iconIndex; - switch (client.getAccountType()) - { - case IRONMAN: - iconIndex = IconID.IRONMAN.getIndex(); - break; - case HARDCORE_IRONMAN: - iconIndex = IconID.HARDCORE_IRONMAN.getIndex(); - break; - case ULTIMATE_IRONMAN: - iconIndex = IconID.ULTIMATE_IRONMAN.getIndex(); - break; - default: - return player.getName(); - } - - return getNameWithIcon(iconIndex, player.getName()); - } - - /** - * Get a name formatted with icon - * - * @param iconIndex index of the icon - * @param name name of the player - * @return String of icon + name - */ - private static String getNameWithIcon(int iconIndex, String name) - { - String icon = ""; - return icon + name; - } - - /** - * Checks if a player name is a friend or clan member on a league world. - * - * @param name name of player to check. - * @return boolean true/false. - */ - private boolean isChatPlayerOnLeague(String name) - { - ChatPlayer player = getChatPlayerFromName(name); - - if (player == null) - { - return false; - } - - int world = player.getWorld(); - return isLeagueWorld(world); - } - - /** - * Checks if the world is a League world. - * - * @param worldNumber number of the world to check. - * @return boolean true/false if it is a league world or not. - */ - private boolean isLeagueWorld(int worldNumber) - { - WorldResult worlds = worldService.getWorlds(); - if (worlds == null) - { - return false; - } - - World world = worlds.findWorld(worldNumber); - return world != null && world.getTypes().contains(WorldType.LEAGUE); - } - - /** - * Loads the league icon into the client. - */ - private void loadLeagueIcon() - { - final IndexedSprite[] modIcons = client.getModIcons(); - - if (leagueIconOffset != -1 || modIcons == null) - { - return; - } - - BufferedImage image = ImageUtil.getResourceStreamFromClass(getClass(), "league_icon.png"); - IndexedSprite indexedSprite = ImageUtil.getImageIndexedSprite(image, client); - - leagueIconOffset = modIcons.length; - - final IndexedSprite[] newModIcons = Arrays.copyOf(modIcons, modIcons.length + 1); - newModIcons[newModIcons.length - 1] = indexedSprite; - - client.setModIcons(newModIcons); - } - - /** - * Gets a ChatPlayer object from a clean name by searching clan and friends list. - * - * @param name name of player to find. - * @return ChatPlayer if found, else null. - */ - private ChatPlayer getChatPlayerFromName(String name) - { - if (client.isClanMember(name)) - { - return Arrays.stream(client.getClanMembers()) - .filter(clanMember -> Text.removeTags(clanMember.getUsername()).equals(name)) - .findFirst() - .orElse(null); - } - - if (client.isFriended(name, true)) - { - return Arrays.stream(client.getFriends()) - .filter(friend -> Text.removeTags(friend.getName()).equals(name)) - .findFirst() - .orElse(null); - } - - return null; - } -} 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 deleted file mode 100644 index b0f9613a27..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/learntoclick/LearnToClickConfig.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.learntoclick; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("learntoclick") -public interface LearnToClickConfig extends Config -{ - @ConfigItem( - position = 1, - keyName = "blockCompass", - name = "Compass", - description = "Prevents the camera from moving when you misclick on the compass" - ) - default boolean shouldBlockCompass() - { - return false; - } - - @ConfigItem( - position = 2, - keyName = "rightClickMap", - name = "World Map", - description = "Prevents the world map from opening on left click without disabling it entirely" - ) - default boolean shouldRightClickMap() - { - return false; - } - - @ConfigItem( - position = 3, - keyName = "rightClickXp", - name = "Xp Drops Toggle", - description = "Prevents toggling xp drops on left click without disabling the toggle function entirely" - ) - default boolean shouldRightClickXp() - { - return false; - } - - @ConfigItem( - position = 4, - keyName = "rightClickRetaliate", - name = "Auto Retaliate", - description = "Prevents toggling auto retaliate on left click without disabling the toggle function entirely" - ) - default boolean shouldRightClickRetaliate() - { - 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 deleted file mode 100644 index 41b1c520d9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/learntoclick/LearnToClickPlugin.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2019. PKLite - All Rights Reserved - * Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited. - * Proprietary and confidential. Refer to PKLite License file for more information on - * full terms of this copyright and to determine what constitutes authorized use. - * Written by PKLite(ST0NEWALL, others) , 2019 - * - * Plugin by Tom C (@tomcylke on GitHub) - */ - -package net.runelite.client.plugins.learntoclick; - -import com.google.common.collect.ImmutableList; -import com.google.inject.Provides; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.MenuEntry; -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.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import org.apache.commons.lang3.ArrayUtils; - -@PluginDescriptor( - name = "Learn to Click", - description = "A few modifications to prevent misclicks", - tags = {"pk", "misclick", "compass", "map", "auto retaliate"}, - type = PluginType.PVP, - enabledByDefault = false -) -@Slf4j -@Singleton -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; - - @Inject - private Client client; - - private boolean forceRightClickFlag; - - private boolean shouldBlockCompass; - private boolean shouldRightClickMap; - private boolean shouldRightClickXp; - private boolean shouldRightClickRetaliate; - private boolean hideOrbs; - - @Provides - LearnToClickConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(LearnToClickConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - } - - @Override - protected void shutDown() - { - forceRightClickFlag = false; - hideOrbWidgets(false); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("learntoclick")) - { - return; - } - - updateConfig(); - - if (this.hideOrbs) - { - hideOrbWidgets(true); - } - else - { - hideOrbWidgets(false); - } - - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded event) - { - if (!this.hideOrbs) - { - return; - } - if (event.getGroupId() == WidgetID.MINIMAP_GROUP_ID) - { - hideOrbWidgets(true); - } - } - - @Subscribe - private void onMenuShouldLeftClick(MenuShouldLeftClick event) - { - if (!forceRightClickFlag) - { - return; - } - forceRightClickFlag = false; - MenuEntry[] menuEntries = client.getMenuEntries(); - for (MenuEntry entry : menuEntries) - { - if ((entry.getOption().equals("Floating World Map") && this.shouldRightClickMap) || - (entry.getTarget().equals("XP drops") && this.shouldRightClickXp) || - (entry.getOption().equals("Auto retaliate") && this.shouldRightClickRetaliate)) - { - event.setForceRightClick(true); - return; - } - } - } - - @Subscribe - private void onMenuEntryAdded(MenuEntryAdded event) - { - if ((event.getOption().equals("Floating World Map") && this.shouldRightClickMap) || - (event.getTarget().equals("XP drops") && this.shouldRightClickXp) || - (event.getOption().equals("Auto retaliate") && this.shouldRightClickRetaliate)) - { - forceRightClickFlag = true; - } - MenuEntry[] entries = client.getMenuEntries(); - if (this.shouldBlockCompass) - { - for (int i = entries.length - 1; i >= 0; i--) - { - if (entries[i].getOption().equals("Look North")) - { - entries = ArrayUtils.remove(entries, i); - i--; - } - } - 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)); - } - - private void updateConfig() - { - this.shouldBlockCompass = config.shouldBlockCompass(); - this.shouldRightClickMap = config.shouldRightClickMap(); - this.shouldRightClickXp = config.shouldRightClickXp(); - this.shouldRightClickRetaliate = config.shouldRightClickRetaliate(); - this.hideOrbs = config.hideOrbs(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/leftclickonly/LeftClickOnlyPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/leftclickonly/LeftClickOnlyPlugin.java deleted file mode 100644 index c93d5a75a1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/leftclickonly/LeftClickOnlyPlugin.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2019, dekvall - * 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.leftclickonly; - -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.MenuEntry; -import net.runelite.api.events.MenuOpened; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.input.MouseManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Left Click Only", - description = "Only allow leftclicks", - tags = {"left", "click", "only", "gamemode", "leftclick"}, - type = PluginType.GAMEMODE, - enabledByDefault = false -) -public class LeftClickOnlyPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private RightClickConsumer rightClickConsumer; - - @Inject - private MouseManager mouseManager; - - @Override - protected void startUp() throws Exception - { - mouseManager.registerMouseListener(rightClickConsumer); - } - - @Override - protected void shutDown() throws Exception - { - mouseManager.unregisterMouseListener(rightClickConsumer); - } - - @Subscribe - public void onMenuOpened(MenuOpened event) - { - MenuEntry first = event.getFirstEntry(); - client.setMenuEntries(new MenuEntry[]{first}); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/leftclickonly/RightClickConsumer.java b/runelite-client/src/main/java/net/runelite/client/plugins/leftclickonly/RightClickConsumer.java deleted file mode 100644 index cfca0dea94..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/leftclickonly/RightClickConsumer.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2019, dekvall - * 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.leftclickonly; - -import java.awt.event.MouseEvent; -import net.runelite.client.input.MouseAdapter; - -public class RightClickConsumer extends MouseAdapter -{ - @Override - public MouseEvent mouseClicked(MouseEvent event) - { - if (event.getButton() != MouseEvent.BUTTON1) - { - event.consume(); - } - return event; - } - - @Override - public MouseEvent mousePressed(MouseEvent event) - { - if (event.getButton() != MouseEvent.BUTTON1) - { - event.consume(); - } - return event; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/lizardmanshaman/LizardmanShamanConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/lizardmanshaman/LizardmanShamanConfig.java deleted file mode 100644 index c0e9bb69fd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/lizardmanshaman/LizardmanShamanConfig.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com Dutta64 - * 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.lizardmanshaman; - -import java.awt.Color; -import lombok.RequiredArgsConstructor; -import net.runelite.client.config.Alpha; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigSection; - -@ConfigGroup("lizardmanshaman") -public interface LizardmanShamanConfig extends Config -{ - @RequiredArgsConstructor - enum SpawnOverlayConfig - { - EXPLOSION_ONLY("Explosion Only"), - ALWAYS("Always"), - DISABLED("Disabled"); - - private final String name; - - @Override - public String toString() - { - return name; - } - } - - @ConfigSection( - keyName = "features", - name = "Features", - description = "Enable or disable plugin features.", - position = 0 - ) - default boolean features() - { - return true; - } - - @ConfigItem( - keyName = "spawnOverlay", - name = "Spawn Overlay", - description = "Show an overlay for Spawn's explosion tiles.", - section = "features", - position = 1 - ) - default SpawnOverlayConfig showSpawnOverlay() - { - return SpawnOverlayConfig.ALWAYS; - } - - @ConfigSection( - keyName = "colors", - name = "Colors", - description = "Customize overlay colors.", - position = 1 - ) - default boolean colors() - { - return false; - } - - @Alpha - @ConfigItem( - keyName = "explosionBorderColor", - name = "Explosion Border", - description = "Spawn explosion tiles overlay border.", - section = "colors", - position = 1 - ) - default Color explosionBorderColor() - { - return Color.RED; - } - - @Alpha - @ConfigItem( - keyName = "explosionFillColor", - name = "Explosion Fill", - description = "Spawn explosion tiles overlay fill.", - section = "colors", - position = 2 - ) - default Color explosionFillColor() - { - return new Color(255, 0, 0, 20); - } - - @Alpha - @ConfigItem( - keyName = "spawnWalkableBorderColor", - name = "Walkable Border", - description = "Spawn walkable tiles overlay border.", - section = "colors", - position = 3 - ) - default Color spawnWalkableBorderColor() - { - return Color.ORANGE; - } - - @Alpha - @ConfigItem( - keyName = "spawnWalkableFillColor", - name = "Walkable Fill", - description = "Spawn walkable tiles overlay fill.", - section = "colors", - position = 4 - ) - default Color spawnWalkableFillColor() - { - return new Color(255, 165, 0, 20); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/lizardmanshaman/LizardmanShamanOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/lizardmanshaman/LizardmanShamanOverlay.java deleted file mode 100644 index 76af012196..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/lizardmanshaman/LizardmanShamanOverlay.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com Dutta64 - * 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.lizardmanshaman; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.Shape; -import java.awt.Stroke; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Actor; -import net.runelite.api.AnimationID; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.Perspective; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldArea; -import static net.runelite.client.plugins.lizardmanshaman.LizardmanShamanConfig.SpawnOverlayConfig; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayPosition; - -@Slf4j -@Singleton -class LizardmanShamanOverlay extends Overlay -{ - private final Client client; - private final LizardmanShamanPlugin plugin; - - @Inject - private LizardmanShamanOverlay(final Client client, final LizardmanShamanPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.getSpawnOverlayConfig().equals(SpawnOverlayConfig.DISABLED)) - { - renderValidMovement(graphics); - } - - return null; - } - - /** - * Adapted from net.runelite.client.plugins.devtools.SceneOverlay - * - * @param graphics - */ - private void renderValidMovement(Graphics2D graphics) - { - for (NPC npc : client.getNpcs()) - { - if (!isSpawnNpc(npc)) - { - continue; - } - - for (int dx = -1; dx <= 1; dx++) - { - for (int dy = -1; dy <= 1; dy++) - { - if (dx == 0 && dy == 0) - { - continue; - } - - renderTileIfValidForMovement(graphics, npc, dx, dy); - } - } - } - } - - /** - * Adapted from net.runelite.client.plugins.devtools.SceneOverlay - * - * @param graphics - * @param actor - * @param dx - * @param dy - */ - private void renderTileIfValidForMovement(Graphics2D graphics, Actor actor, int dx, int dy) - { - WorldArea area = actor.getWorldArea(); - - if (area == null) - { - return; - } - - if (area.canTravelInDirection(client, dx, dy)) - { - LocalPoint lp = actor.getLocalLocation(); - - if (lp == null) - { - return; - } - - lp = new LocalPoint( - lp.getX() + dx * Perspective.LOCAL_TILE_SIZE + dx * Perspective.LOCAL_TILE_SIZE * (area.getWidth() - 1) / 2, - lp.getY() + dy * Perspective.LOCAL_TILE_SIZE + dy * Perspective.LOCAL_TILE_SIZE * (area.getHeight() - 1) / 2); - - Polygon poly = Perspective.getCanvasTilePoly(client, lp); - - if (poly == null) - { - return; - } - - if (isExplodingAnimation(actor)) - { - renderPolygon(graphics, poly, 1, plugin.getExplosionBorderColor(), plugin.getExplosionFillColor()); - } - else if (plugin.getSpawnOverlayConfig().equals(SpawnOverlayConfig.ALWAYS)) - { - renderPolygon(graphics, poly, 1, plugin.getSpawnWalkableBorderColor(), plugin.getSpawnWalkableFillColor()); - } - } - } - - /** - * Adapted from net.runelite.client.ui.overlay.OverlayUtil - * - * @param graphics - * @param poly - * @param strokeWidth - * @param strokeColor - * @param fillColor - */ - private static void renderPolygon(Graphics2D graphics, Shape poly, int strokeWidth, Color strokeColor, Color fillColor) - { - graphics.setColor(strokeColor); - final Stroke originalStroke = graphics.getStroke(); - graphics.setStroke(new BasicStroke(strokeWidth)); - graphics.draw(poly); - graphics.setColor(fillColor); - graphics.fill(poly); - graphics.setStroke(originalStroke); - } - - /** - * Returns true if the Actor's animation is exploding. - * - * @param actor an Actor object. - * @return true if the Actor is exploding, else returns false. - */ - private static boolean isExplodingAnimation(Actor actor) - { - return actor.getAnimation() == AnimationID.LIZARDMAN_SHAMAN_SPAWN_EXPLOSION; - } - - /** - * Returns true if the NPC is a Lizardman Shaman Spawn. - * - * @param npc an NPC object. - * @return true if the NPC is a lizardman shaman spawn, else returns false. - */ - private static boolean isSpawnNpc(NPC npc) - { - final int NPC_ID_SPAWN = 6768; - - return npc.getId() == NPC_ID_SPAWN; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/lizardmanshaman/LizardmanShamanPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/lizardmanshaman/LizardmanShamanPlugin.java deleted file mode 100644 index ea7a943546..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/lizardmanshaman/LizardmanShamanPlugin.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com Dutta64 - * 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.lizardmanshaman; - -import com.google.inject.Provides; -import java.awt.Color; -import java.util.Objects; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import static net.runelite.client.plugins.lizardmanshaman.LizardmanShamanConfig.SpawnOverlayConfig; -import net.runelite.client.ui.overlay.OverlayManager; - -@PluginDescriptor( - name = "Lizardman Shamans", - description = "Display an overlay for spawn explosion tiles", - tags = {"lizardman", "shaman", "lizard"}, - type = PluginType.PVM, - enabledByDefault = false -) -@Slf4j -@Singleton -public class LizardmanShamanPlugin extends Plugin -{ - private static final String CONFIG_GROUP_NAME = "lizardmanshaman"; - - @Getter(AccessLevel.PACKAGE) - private SpawnOverlayConfig spawnOverlayConfig; - - @Getter(AccessLevel.PACKAGE) - private Color explosionBorderColor; - - @Getter(AccessLevel.PACKAGE) - private Color explosionFillColor; - - @Getter(AccessLevel.PACKAGE) - private Color spawnWalkableBorderColor; - - @Getter(AccessLevel.PACKAGE) - private Color spawnWalkableFillColor; - - @Inject - private OverlayManager overlayManager; - - @Inject - private LizardmanShamanOverlay overlay; - - @Inject - private LizardmanShamanConfig config; - - @Provides - LizardmanShamanConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(LizardmanShamanConfig.class); - } - - @Override - protected void startUp() - { - initConfig(); - - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (Objects.equals(event.getGroup(), CONFIG_GROUP_NAME)) - { - initConfig(); - } - } - - private void initConfig() - { - this.spawnOverlayConfig = config.showSpawnOverlay(); - - this.explosionBorderColor = config.explosionBorderColor(); - this.explosionFillColor = config.explosionFillColor(); - - this.spawnWalkableBorderColor = config.spawnWalkableBorderColor(); - this.spawnWalkableFillColor = config.spawnWalkableFillColor(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loginscreen/LoginScreenConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/loginscreen/LoginScreenConfig.java deleted file mode 100644 index e2aaf3a9c5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loginscreen/LoginScreenConfig.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.loginscreen; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("loginscreen") -public interface LoginScreenConfig extends Config -{ - @ConfigItem( - keyName = "syncusername", - name = "Sync username", - description = "Syncs the username that is currently remembered between computers", - position = 1 - ) - default boolean syncUsername() - { - return true; - } - - @ConfigItem( - keyName = "pasteenabled", - name = "Ctrl-V paste", - description = "Enables Ctrl+V pasting on the login screen", - position = 2 - ) - default boolean pasteEnabled() - { - return false; - } - - @ConfigItem( - keyName = "hideDisconnect", - name = "Hide 5 min log message", - description = "Hides the \"You have been disconnected\" message which appears when you get 5 minute logged", - position = 3 - ) - default boolean hideDisconnected() - { - return false; - } - - @ConfigItem( - keyName = "username", - name = "", - description = "", - hidden = true - ) - default String username() - { - return ""; - } - - @ConfigItem( - keyName = "username", - name = "", - description = "" - ) - void username(String key); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loginscreen/LoginScreenPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loginscreen/LoginScreenPlugin.java deleted file mode 100644 index a04f374873..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loginscreen/LoginScreenPlugin.java +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.loginscreen; - -import com.google.common.base.Strings; -import com.google.inject.Provides; -import java.awt.Toolkit; -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.UnsupportedFlavorException; -import java.awt.event.KeyEvent; -import java.io.IOException; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.events.GameStateChanged; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.events.SessionOpen; -import net.runelite.client.input.KeyListener; -import net.runelite.client.input.KeyManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.util.OSType; - -@PluginDescriptor( - name = "Login Screen", - description = "Provides various enhancements for login screen", - type = PluginType.MISCELLANEOUS -) -@Slf4j -@Singleton -public class LoginScreenPlugin extends Plugin implements KeyListener -{ - private static final int MAX_USERNAME_LENGTH = 254; - private static final int MAX_PIN_LENGTH = 6; - - @Inject - private Client client; - - @Inject - private LoginScreenConfig config; - - @Inject - private KeyManager keyManager; - - private String usernameCache; - - private boolean syncUsername; - private boolean pasteEnabled; - private String username; - - @Override - protected void startUp() - { - updateConfig(); - - client.setHideDisconnect(config.hideDisconnected()); - - applyUsername(); - keyManager.registerKeyListener(this); - } - - @Override - protected void shutDown() - { - if (this.syncUsername) - { - client.getPreferences().setRememberedUsername(usernameCache); - } - - client.setHideDisconnect(false); - - keyManager.unregisterKeyListener(this); - } - - @Provides - LoginScreenConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(LoginScreenConfig.class); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (!this.syncUsername) - { - return; - } - - if (event.getGameState() == GameState.LOGIN_SCREEN) - { - applyUsername(); - } - else if (event.getGameState() == GameState.LOGGED_IN) - { - String username = ""; - - if (client.getPreferences().getRememberedUsername() != null) - { - username = client.getUsername(); - } - - if (this.username.equals(username)) - { - return; - } - - log.debug("Saving username: {}", username); - config.username(username); - this.username = username; - } - } - - @Subscribe - private void onSessionOpen(SessionOpen event) - { - // configuation for the account is available now, so update the username - applyUsername(); - } - - private void applyUsername() - { - if (!this.syncUsername) - { - return; - } - - GameState gameState = client.getGameState(); - if (gameState == GameState.LOGIN_SCREEN) - { - String username = this.username; - - if (Strings.isNullOrEmpty(username)) - { - return; - } - - // Save it only once - if (usernameCache == null) - { - usernameCache = client.getPreferences().getRememberedUsername(); - } - - client.getPreferences().setRememberedUsername(username); - } - } - - @Override - public void keyTyped(KeyEvent e) - { - } - - @Override - public void keyPressed(KeyEvent e) - { - if (!this.pasteEnabled || ( - client.getGameState() != GameState.LOGIN_SCREEN && - client.getGameState() != GameState.LOGIN_SCREEN_AUTHENTICATOR)) - { - return; - } - - // enable pasting on macOS with the Command (meta) key - boolean isModifierDown = OSType.getOSType() == OSType.MacOS ? e.isMetaDown() : e.isControlDown(); - - if (e.getKeyCode() == KeyEvent.VK_V && isModifierDown) - { - try - { - final String data = Toolkit - .getDefaultToolkit() - .getSystemClipboard() - .getData(DataFlavor.stringFlavor) - .toString() - .trim(); - - switch (client.getLoginIndex()) - { - // Username/password form - case 2: - if (client.getCurrentLoginField() == 0) - { - // Truncate data to maximum username length if necessary - client.setUsername(data.substring(0, Math.min(data.length(), MAX_USERNAME_LENGTH))); - } - - break; - // Authenticator form - case 4: - // Truncate data to maximum OTP code length if necessary - client.setOtp(data.substring(0, Math.min(data.length(), MAX_PIN_LENGTH))); - break; - } - } - catch (UnsupportedFlavorException | IOException ex) - { - log.warn("failed to fetch clipboard data", ex); - } - } - } - - @Override - public void keyReleased(KeyEvent e) - { - - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("loginscreen")) - { - return; - } - - if (event.getKey().equals("hideDisconnect")) - { - client.setHideDisconnect(config.hideDisconnected()); - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.syncUsername = config.syncUsername(); - this.pasteEnabled = config.pasteEnabled(); - this.username = config.username(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/lootassist/LootAssistOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/lootassist/LootAssistOverlay.java deleted file mode 100644 index 10ef9f2f04..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/lootassist/LootAssistOverlay.java +++ /dev/null @@ -1,103 +0,0 @@ -package net.runelite.client.plugins.lootassist; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.text.DecimalFormat; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -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.OverlayPriority; -import net.runelite.client.ui.overlay.OverlayUtil; - -@Singleton -public class LootAssistOverlay extends Overlay -{ - private final Client client; - private final DecimalFormat d = new DecimalFormat("##.#"); - - @Inject - public LootAssistOverlay(final Client client) - { - this.client = client; - setLayer(OverlayLayer.ABOVE_SCENE); - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.MED); - } - - @Override - public Dimension render(Graphics2D graphics) - { - for (Map.Entry entry : LootAssistPlugin.lootPiles.entrySet()) - { - WorldPoint localPoint = entry.getKey(); - LootPile pile = entry.getValue(); - int x; - int y; - LocalPoint lp = LocalPoint.fromWorld(client, pile.getLocation()); - if (lp != null) - { - x = lp.getSceneX(); - y = lp.getSceneY(); - } - else - { - continue; - } - - if (!localPoint.isInScene(client)) - { - continue; - } - - int timeRemaining = (int) ((pile.getTimeAppearing() - System.currentTimeMillis()) / 1000); - - if (timeRemaining < 0) - { - LootAssistPlugin.lootPiles.remove(localPoint); - client.clearHintArrow(); - } - else - { - String nameOverlay = pile.getPlayerName(); - String timeOverlay = d.format((pile.getTimeAppearing() - System.currentTimeMillis()) / 1000f); - final Polygon poly = Perspective.getCanvasTilePoly(client, - client.getScene().getTiles()[client.getPlane()][x][y].getLocalLocation()); - if (poly != null) - { - Point textLoc = Perspective.getCanvasTextLocation(client, graphics, lp, - nameOverlay, graphics.getFontMetrics().getHeight() * 7); - Point timeLoc = Perspective.getCanvasTextLocation(client, graphics, lp, - timeOverlay, graphics.getFontMetrics().getHeight()); - OverlayUtil.renderPolygon(graphics, poly, Color.WHITE); - if (timeRemaining < 5 && timeRemaining > 0) - { - OverlayUtil.renderTextLocation(graphics, timeLoc, timeOverlay, Color.RED); - OverlayUtil.renderTextLocation(graphics, textLoc, nameOverlay, Color.RED); - } - else if (timeRemaining <= 60) - { - OverlayUtil.renderTextLocation(graphics, timeLoc, timeOverlay, Color.WHITE); - OverlayUtil.renderTextLocation(graphics, textLoc, nameOverlay, Color.WHITE); - } - if (timeRemaining < 2) - { - client.setHintArrow(WorldPoint.fromLocal(client, lp)); - } - - - } - } - } - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/lootassist/LootAssistPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/lootassist/LootAssistPlugin.java deleted file mode 100644 index 7cc3426bd4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/lootassist/LootAssistPlugin.java +++ /dev/null @@ -1,68 +0,0 @@ -package net.runelite.client.plugins.lootassist; - -import java.util.concurrent.ConcurrentHashMap; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Actor; -import net.runelite.api.AnimationID; -import net.runelite.api.Player; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.AnimationChanged; -import net.runelite.api.events.GameStateChanged; -import net.runelite.client.eventbus.Subscribe; -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; - -@PluginDescriptor( - name = "Loot Assist Plugin", - description = "Creates a tile overlay with a timer that counts down to when the loot will appear to you", - tags = {"pklite", "loot", "looting", "loot assist", "assist", "loot assist"}, - type = PluginType.PVP, - enabledByDefault = false -) -@Singleton -public class LootAssistPlugin extends Plugin -{ - @Inject - private OverlayManager overlayManager; - - @Inject - private LootAssistOverlay lootAssistOverlay; - - static final ConcurrentHashMap lootPiles = new ConcurrentHashMap<>(); - - @Override - protected void startUp() - { - - overlayManager.add(lootAssistOverlay); - } - - @Override - protected void shutDown() - { - lootPiles.clear(); - overlayManager.remove(lootAssistOverlay); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - lootPiles.clear(); - } - - @Subscribe - private void onAnimationChanged(AnimationChanged event) - { - final Actor actor = event.getActor(); - if (actor.getAnimation() == AnimationID.DEATH && actor instanceof Player) - { - LootPile pile = new LootPile(actor.getWorldLocation(), actor.getName()); - lootPiles.put(pile.getLocation(), pile); - } - } - - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/lootassist/LootPile.java b/runelite-client/src/main/java/net/runelite/client/plugins/lootassist/LootPile.java deleted file mode 100644 index e3798d1c64..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/lootassist/LootPile.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.runelite.client.plugins.lootassist; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.coords.WorldPoint; - -class LootPile -{ - private static final long TIME_UNTIL_VISIBLE = 62400; - - @Getter(AccessLevel.PACKAGE) - private final long timeAppearing; - - @Getter(AccessLevel.PACKAGE) - private final WorldPoint location; - - @Getter(AccessLevel.PACKAGE) - private final String playerName; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private boolean beingRendered = false; - - LootPile(WorldPoint location, String playerName) - { - long timeCreated = System.currentTimeMillis(); - this.location = location; - this.playerName = playerName; - this.timeAppearing = timeCreated + TIME_UNTIL_VISIBLE; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/lootingbagviewer/LootingBagViewerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/lootingbagviewer/LootingBagViewerConfig.java deleted file mode 100644 index eb9d3e13a0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/lootingbagviewer/LootingBagViewerConfig.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.lootingbagviewer; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigTitleSection; -import net.runelite.client.config.Title; - -@ConfigGroup("lootingbagviewer") -public interface LootingBagViewerConfig extends Config -{ - @ConfigTitleSection( - keyName = "overlayTitle", - name = "Overlays", - description = "", - position = 0 - ) - default Title overlayTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "renderViewer", - name = "Render Viewer", - description = "Shows second inventory on screen with looting bag items.", - position = 1, - titleSection = "overlayTitle" - ) - default boolean renderViewer() - { - return true; - } - - @ConfigItem( - keyName = "renderLootingBag", - name = "Render Looting Bag Worth", - description = "Shows current amount of GP over the looting bag.", - position = 2, - titleSection = "overlayTitle" - ) - default boolean renderLootingBag() - { - return true; - } -} 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 deleted file mode 100644 index dc426083f3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/lootingbagviewer/LootingBagViewerOverlay.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2018 AWPH-I - * 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.lootingbagviewer; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.components.ComponentOrientation; -import net.runelite.client.ui.overlay.components.ImageComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; - -@Singleton -public class LootingBagViewerOverlay extends Overlay -{ - private static final int INVENTORY_SIZE = 28; - 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)); - - private final Client client; - private final ItemManager itemManager; - - private final PanelComponent panelComponent = new PanelComponent(); - - private ItemContainer itemContainer; - private Item[] items; - - @Inject - private LootingBagViewerOverlay(final Client client, final ItemManager itemManager) - { - setPosition(OverlayPosition.BOTTOM_RIGHT); - panelComponent.setWrapping(4); - panelComponent.setGap(new Point(6, 4)); - panelComponent.setOrientation(ComponentOrientation.HORIZONTAL); - this.itemManager = itemManager; - this.client = client; - - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (itemContainer == null) - { - if (client.getItemContainer(InventoryID.LOOTING_BAG) != null) - { - itemContainer = client.getItemContainer(InventoryID.LOOTING_BAG); - if (itemContainer != null) - { - items = itemContainer.getItems(); - } - } - return null; - } - else if (items != null && client.getItemContainer(InventoryID.LOOTING_BAG) != null) - { - itemContainer = client.getItemContainer(InventoryID.LOOTING_BAG); - if (itemContainer != null) - { - Item[] tempItems = itemContainer.getItems(); - - for (int i = 0; i < items.length; i++) - { - if (!items[i].equals(tempItems[i])) - { - items = tempItems; - break; - } - } - } - } - - panelComponent.getChildren().clear(); - - for (int i = 0; i < INVENTORY_SIZE; i++) - { - if (i < items.length) - { - final Item item = items[i]; - if (item.getQuantity() > 0) - { - final BufferedImage image = getImage(item); - if (image != null) - { - panelComponent.getChildren().add(new ImageComponent(image)); - continue; - } - } - } - - // put a placeholder image so each item is aligned properly and the panel is not resized - panelComponent.getChildren().add(PLACEHOLDER_IMAGE); - } - - return panelComponent.render(graphics); - } - - private BufferedImage getImage(Item item) - { - return itemManager.getImage(item.getId(), item.getQuantity(), item.getQuantity() > 1); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/lootingbagviewer/LootingBagViewerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/lootingbagviewer/LootingBagViewerPlugin.java deleted file mode 100644 index 97b9e2528c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/lootingbagviewer/LootingBagViewerPlugin.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2018 AWPH-I - * 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.lootingbagviewer; - -import com.google.common.base.Strings; -import com.google.inject.Provides; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.events.WidgetHiddenChanged; -import net.runelite.api.widgets.Widget; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "PvP Looting Bag Viewer", - description = "Add an overlay showing the contents of your looting bag", - tags = {"alternate", "items", "overlay", "second"}, - type = PluginType.PVP, - enabledByDefault = false -) -/** - * TODO: Remember current looting bag value when client restarts - * TODO: Write an event for picking up an item (with opened looting bag) and add its price to the current looting bag value - * TODO: Write something to capture adding items to a looting bag and add its price to the current looting bag value - */ -@Slf4j -@Singleton // WHY IS THIS PLUGIN EVEN MERGED IT'S AGES FROM BEING DONE!?!?!?!? -public class LootingBagViewerPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private LootingBagViewerOverlay overlay; - - @Inject - private LootingBagViewerWidgetOverlay widgetOverlay; - - @Inject - private OverlayManager overlayManager; - - @Inject - private LootingBagViewerConfig config; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private int valueToShow = -1; - - @Provides - LootingBagViewerConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(LootingBagViewerConfig.class); - } - - @Override - public void startUp() - { - - if (config.renderViewer()) - { - overlayManager.add(overlay); - } - - if (config.renderLootingBag()) - { - overlayManager.add(widgetOverlay); - } - } - - @Override - public void shutDown() - { - overlayManager.remove(overlay); - overlayManager.remove(widgetOverlay); - } - - @Subscribe - private void onConfigChanged(ConfigChanged configChanged) - { - if (configChanged.getKey().equals("renderViewer")) - { - if (Boolean.parseBoolean(configChanged.getNewValue())) - { - overlayManager.add(overlay); - } - else - { - overlayManager.remove(overlay); - } - } - if (configChanged.getKey().equals("renderLootingBag")) - { - if (Boolean.parseBoolean(configChanged.getNewValue())) - { - overlayManager.add(widgetOverlay); - } - else - { - overlayManager.remove(widgetOverlay); - } - } - } - - - /** - * @param widgetHiddenChanged - */ - @Subscribe - private void onWidgetHiddenChanged(WidgetHiddenChanged widgetHiddenChanged) - { - Widget widget = widgetHiddenChanged.getWidget(); - if (widget.getParentId() == 5308416 && !widget.isHidden()) - { - clientThread.invokeLater(() -> - { - Widget value = client.getWidget(81, 6); - log.debug("val: {}", value.getText()); - - if (!Strings.isNullOrEmpty(value.getText())) - { - if (value.getText().equals("Value: -")) - { - setValueToShow(-1); - } - else - { - String str = value.getText(); - str = str.replace("Bag value: ", "") - .replace("Value: ", "") - .replace(" coins", "") - .replace(",", ""); - - int val = Integer.parseInt(str); - setValueToShow(Math.round(val) / 1000); - } - } - }); - } - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/lootingbagviewer/LootingBagViewerWidgetOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/lootingbagviewer/LootingBagViewerWidgetOverlay.java deleted file mode 100644 index ebd7d4be8e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/lootingbagviewer/LootingBagViewerWidgetOverlay.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.lootingbagviewer; - -import java.awt.Color; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.ItemID; -import net.runelite.api.Point; -import net.runelite.api.widgets.WidgetItem; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.ui.overlay.WidgetItemOverlay; - -@Singleton -public class LootingBagViewerWidgetOverlay extends WidgetItemOverlay -{ - private final LootingBagViewerPlugin plugin; - - @Inject - LootingBagViewerWidgetOverlay(final LootingBagViewerPlugin plugin) - { - this.plugin = plugin; - showOnInventory(); - } - - @Override - public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget) - { - if (plugin.getValueToShow() != -1) - { - switch (itemId) - { - case ItemID.LOOTING_BAG: - case ItemID.LOOTING_BAG_22586: - Point point = new Point(itemWidget.getCanvasLocation().getX() + lineX(plugin.getValueToShow()), itemWidget.getCanvasLocation().getY() + 25); - OverlayUtil.renderTextLocation(graphics, point, (plugin.getValueToShow() + "K"), Color.WHITE); - break; - } - } - } - - /** - * To align 16k (gp) or 4213k (gp) correctly between the looting bag without looking off - * - * @return - */ - private static int lineX(int lootingBagValue) - { - switch ((int) (Math.log10(lootingBagValue) + 1)) - { - case 3: - case 4: - return 6; - default: - return 8; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootRecordDateFilter.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootRecordDateFilter.java deleted file mode 100644 index 47e25c686b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootRecordDateFilter.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * ****************************************************************************** - * * Copyright (c) 2019 openosrs - * * 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 - * * openosrs Discord: https://discord.gg/Q7wFtCe - * * openosrs website: https://openosrs.com - * ***************************************************************************** - */ - -package net.runelite.client.plugins.loottracker; - -import java.lang.management.ManagementFactory; -import java.lang.management.RuntimeMXBean; -import java.time.Duration; -import lombok.AccessLevel; -import lombok.Getter; - -public enum LootRecordDateFilter -{ - - SESSION("Session", Duration.ofMillis(LootTrackerPlugin.SESSION_START_TIME.toEpochMilli())), - HOUR("Hour", Duration.ofHours(1)), - DAY("Day", Duration.ofDays(1)), - WEEK("Week", Duration.ofDays(7)), - MONTH("Month", Duration.ofDays(30)), - YEAR("Year", Duration.ofDays(365)), - ALL("All", Duration.ZERO); - - private final String name; - @Getter(AccessLevel.PACKAGE) - private final Duration duration; - static RuntimeMXBean mxBean = ManagementFactory.getRuntimeMXBean(); - - - /** - * Constructor for a Loot Tracker filter that filters by date, more specifically Duration. - * - * @param name - String the name that represents the date filter. This is what will be displayed in the GUI - * @param duration - The duration the current time - the time of the loot record must be greater than to display if - * a date filter other than all or Session is enabled - */ - LootRecordDateFilter(String name, Duration duration) - { - this.name = name; - this.duration = duration; - } - - @Override - public String toString() - { - return this.name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootRecordSortType.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootRecordSortType.java deleted file mode 100644 index da2c0f8e34..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootRecordSortType.java +++ /dev/null @@ -1,77 +0,0 @@ -package net.runelite.client.plugins.loottracker; - -import java.util.Arrays; -import java.util.Comparator; -import java.util.stream.IntStream; -import lombok.extern.slf4j.Slf4j; -import net.runelite.http.api.loottracker.LootRecordType; - -/** - * - */ -@Slf4j -public enum LootRecordSortType implements Comparator -{ - TIMESTAMP - { - @Override - public int compare(LootTrackerRecord o1, LootTrackerRecord o2) - { - return Long.compare(o1.getTimestamp().toEpochMilli(), o2.getTimestamp().toEpochMilli()); - } - }, - TOTAL_VALUE - { - @Override - public int compare(LootTrackerRecord o1, LootTrackerRecord o2) - { - - // We want deaths at the bottom of the list - if (o1.getSubTitle().equals(LootRecordType.DEATH.name())) - { - return Arrays.stream(o1.getItems()).flatMapToInt(lootTrackerItem -> - IntStream.of((int) lootTrackerItem.getGePrice() * lootTrackerItem.getQuantity())).sum(); - } - if (o2.getSubTitle().equals(LootRecordType.DEATH.name())) - { - return Arrays.stream(o1.getItems()).flatMapToInt(lootTrackerItem -> - IntStream.of((int) lootTrackerItem.getGePrice() * lootTrackerItem.getQuantity())).sum(); - } - int sum = Arrays.stream(o1.getItems()).flatMapToInt(lootTrackerItem -> - IntStream.of((int) lootTrackerItem.getGePrice() * lootTrackerItem.getQuantity())).sum(); - return sum + Arrays.stream(o2.getItems()).flatMapToInt(lootTrackerItem -> - IntStream.of((int) lootTrackerItem.getGePrice() * lootTrackerItem.getQuantity())).sum(); - } - }, - TOTAL_HA_VALUE - { - @Override - public int compare(LootTrackerRecord o1, LootTrackerRecord o2) - { - - // We want deaths at the bottom of the list - if (o1.getSubTitle().equals(LootRecordType.DEATH.name())) - { - return Arrays.stream(o1.getItems()).flatMapToInt(lootTrackerItem -> - IntStream.of((int) lootTrackerItem.getHaPrice() * lootTrackerItem.getQuantity())).sum(); - } - if (o2.getSubTitle().equals(LootRecordType.DEATH.name())) - { - return Arrays.stream(o1.getItems()).flatMapToInt(lootTrackerItem -> - IntStream.of((int) lootTrackerItem.getHaPrice() * lootTrackerItem.getQuantity())).sum(); - } - int sum = Arrays.stream(o1.getItems()).flatMapToInt(lootTrackerItem -> - IntStream.of((int) lootTrackerItem.getHaPrice() * lootTrackerItem.getQuantity())).sum(); - return sum + Arrays.stream(o2.getItems()).flatMapToInt(lootTrackerItem -> - IntStream.of((int) lootTrackerItem.getHaPrice() * lootTrackerItem.getQuantity())).sum(); - } - }, - ITEM_COUNT - { - @Override - public int compare(LootTrackerRecord o1, LootTrackerRecord o2) - { - return Integer.compare(o1.getItems().length, o2.getItems().length); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java deleted file mode 100644 index bab4320e56..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java +++ /dev/null @@ -1,400 +0,0 @@ -/* - * Copyright (c) 2018, Psikoi - * Copyright (c) 2018, Tomas Slusny - * 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.loottracker; - -import com.google.common.base.Strings; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.GridLayout; -import java.awt.image.BufferedImage; -import java.text.DateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.function.BiConsumer; -import javax.annotation.Nullable; -import javax.swing.Box; -import javax.swing.BoxLayout; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.util.Text; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.util.AsyncBufferedImage; -import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.QuantityFormatter; - -class LootTrackerBox extends JPanel -{ - private static final int ITEMS_PER_ROW = 5; - private static final int TITLE_PADDING = 5; - - private final JPanel itemContainer = new JPanel(); - private final JLabel priceLabel = new JLabel(); - private final JLabel subTitleLabel = new JLabel(); - private final JPanel logTitle = new JPanel(); - private final ItemManager itemManager; - @Getter(AccessLevel.PACKAGE) - private final String id; - private final LootTrackerPriceType priceType; - private final boolean showPriceType; - - @Getter(AccessLevel.PACKAGE) - private final List records = new ArrayList<>(); - - private long totalPrice; - private final boolean hideIgnoredItems; - private final BiConsumer onItemToggle; - - LootTrackerBox( - final long timeStamp, - final ItemManager itemManager, - final String id, - @Nullable final String subtitle, - final boolean hideIgnoredItems, - final LootTrackerPriceType priceType, - final boolean showPriceType, - @Nullable final Boolean showDate, - final BiConsumer onItemToggle) - { - this.id = id; - this.itemManager = itemManager; - this.onItemToggle = onItemToggle; - this.hideIgnoredItems = hideIgnoredItems; - this.priceType = priceType; - this.showPriceType = showPriceType; - - setLayout(new BorderLayout(0, 1)); - setBorder(new EmptyBorder(5, 0, 0, 0)); - - logTitle.setLayout(new BoxLayout(logTitle, BoxLayout.X_AXIS)); - logTitle.setBorder(new EmptyBorder(7, 7, 7, 7)); - logTitle.setBackground(ColorScheme.DARKER_GRAY_COLOR.darker()); - - JLabel titleLabel = new JLabel(); - titleLabel.setText(Text.removeTags(id)); - titleLabel.setFont(FontManager.getRunescapeSmallFont()); - titleLabel.setForeground(Color.WHITE); - // Set a size to make BoxLayout truncate the name - titleLabel.setMinimumSize(new Dimension(1, titleLabel.getPreferredSize().height)); - logTitle.add(titleLabel); - - subTitleLabel.setFont(FontManager.getRunescapeSmallFont()); - subTitleLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR); - - JLabel dateLabel = new JLabel(); - dateLabel.setFont(FontManager.getRunescapeSmallFont().deriveFont(Font.PLAIN, FontManager.getRunescapeSmallFont().getSize() - 2)); - dateLabel.setForeground(Color.LIGHT_GRAY); - dateLabel.setText(DateFormat.getDateInstance().format(new Date(timeStamp))); - - if (showDate) - { - logTitle.add(dateLabel, BorderLayout.SOUTH); - } - - - if (!Strings.isNullOrEmpty(subtitle)) - { - subTitleLabel.setText(subtitle); - } - - logTitle.add(Box.createRigidArea(new Dimension(TITLE_PADDING, 0))); - logTitle.add(subTitleLabel); - logTitle.add(Box.createHorizontalGlue()); - logTitle.add(Box.createRigidArea(new Dimension(TITLE_PADDING, 0))); - - priceLabel.setFont(FontManager.getRunescapeSmallFont()); - priceLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR); - logTitle.add(priceLabel); - - add(logTitle, BorderLayout.NORTH); - add(itemContainer, BorderLayout.CENTER); - - } - - /** - * Returns total amount of kills, removing ignored kills when necessary - * - * @return total amount of kills - */ - private long getTotalKills() - { - return hideIgnoredItems - ? records.stream().filter( - r -> !Arrays.stream(r.getItems()).allMatch(LootTrackerItem::isIgnored)).count() - : records.size(); - } - - /** - * Checks if this box matches specified record - * - * @param record loot record - * @return true if match is made - */ - boolean matches(final LootTrackerRecord record) - { - return record.getTitle().equals(id); - } - - /** - * Checks if this box matches specified id - * - * @param id other record id - * @return true if match is made - */ - boolean matches(final String id) - { - if (id == null) - { - return true; - } - - return this.id.equals(id); - } - - /** - * Adds an record's data into a loot box. - * This will add new items to the list, re-calculating price and kill count. - */ - void combine(final LootTrackerRecord record) - { - if (!matches(record)) - { - throw new IllegalArgumentException(record.toString()); - } - - records.add(record); - } - - void rebuild() - { - buildItems(); - - String priceTypeString = " "; - if (showPriceType) - { - priceTypeString = priceType == LootTrackerPriceType.HIGH_ALCHEMY ? "HA: " : "GE: "; - } - - priceLabel.setText(priceTypeString + QuantityFormatter.quantityToStackSize(totalPrice) + " gp"); - priceLabel.setToolTipText(QuantityFormatter.formatNumber(totalPrice) + " gp"); - - final long kills = getTotalKills(); - if (kills > 1) - { - subTitleLabel.setText("x " + kills); - } - - validate(); - repaint(); - } - - void collapse() - { - if (!isCollapsed()) - { - itemContainer.setVisible(false); - applyDimmer(false, logTitle); - } - } - - void expand() - { - if (isCollapsed()) - { - itemContainer.setVisible(true); - applyDimmer(true, logTitle); - } - } - - boolean isCollapsed() - { - return !itemContainer.isVisible(); - } - - private void applyDimmer(boolean brighten, JPanel panel) - { - for (Component component : panel.getComponents()) - { - Color color = component.getForeground(); - - component.setForeground(brighten ? color.brighter() : color.darker()); - } - } - - /** - * This method creates stacked items from the item list, calculates total price and then - * displays all the items in the UI. - */ - private void buildItems() - { - final List allItems = new ArrayList<>(); - final List items = new ArrayList<>(); - totalPrice = 0; - - for (LootTrackerRecord record : records) - { - allItems.addAll(Arrays.asList(record.getItems())); - } - - if (hideIgnoredItems) - { - /* If all the items in this box are ignored */ - boolean hideBox = allItems.stream().allMatch(LootTrackerItem::isIgnored); - setVisible(!hideBox); - - if (hideBox) - { - return; - } - } - - for (final LootTrackerItem entry : allItems) - { - if (entry.isIgnored() && hideIgnoredItems) - { - continue; - } - - totalPrice += priceType == LootTrackerPriceType.HIGH_ALCHEMY ? entry.getHaPrice() : entry.getGePrice(); - - int quantity = 0; - for (final LootTrackerItem i : items) - { - if (i.getId() == entry.getId()) - { - quantity = i.getQuantity(); - items.remove(i); - break; - } - } - - if (quantity != 0) - { - int newQuantity = entry.getQuantity() + quantity; - long gePricePerItem = entry.getGePrice() == 0 ? 0 : (entry.getGePrice() / entry.getQuantity()); - long haPricePerItem = entry.getHaPrice() == 0 ? 0 : (entry.getHaPrice() / entry.getQuantity()); - - items.add(new LootTrackerItem(entry.getId(), entry.getName(), newQuantity, gePricePerItem * newQuantity, haPricePerItem * newQuantity, entry.isIgnored())); - } - else - { - items.add(entry); - } - } - - if (priceType == LootTrackerPriceType.HIGH_ALCHEMY) - { - items.sort((i1, i2) -> Long.compare(i2.getHaPrice(), i1.getHaPrice())); - } - else - { - items.sort((i1, i2) -> Long.compare(i2.getGePrice(), i1.getGePrice())); - } - - // Calculates how many rows need to be display to fit all items - final int rowSize = ((items.size() % ITEMS_PER_ROW == 0) ? 0 : 1) + items.size() / ITEMS_PER_ROW; - - itemContainer.removeAll(); - itemContainer.setLayout(new GridLayout(rowSize, ITEMS_PER_ROW, 1, 1)); - - for (int i = 0; i < rowSize * ITEMS_PER_ROW; i++) - { - final JPanel slotContainer = new JPanel(); - slotContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - if (i < items.size()) - { - final LootTrackerItem item = items.get(i); - final JLabel imageLabel = new JLabel(); - imageLabel.setToolTipText(buildToolTip(item)); - imageLabel.setVerticalAlignment(SwingConstants.CENTER); - imageLabel.setHorizontalAlignment(SwingConstants.CENTER); - - AsyncBufferedImage itemImage = itemManager.getImage(item.getId(), Math.abs(item.getQuantity()), Math.abs(item.getQuantity()) > 1); - - if (item.isIgnored()) - { - Runnable addTransparency = () -> - { - BufferedImage transparentImage = ImageUtil.alphaOffset(itemImage, .3f); - imageLabel.setIcon(new ImageIcon(transparentImage)); - }; - itemImage.onLoaded(addTransparency); - addTransparency.run(); - } - else - { - itemImage.addTo(imageLabel); - } - - slotContainer.add(imageLabel); - - // Create popup menu - final JPopupMenu popupMenu = new JPopupMenu(); - popupMenu.setBorder(new EmptyBorder(5, 5, 5, 5)); - slotContainer.setComponentPopupMenu(popupMenu); - - final JMenuItem toggle = new JMenuItem("Toggle item"); - toggle.addActionListener(e -> - { - item.setIgnored(!item.isIgnored()); - onItemToggle.accept(item.getName(), item.isIgnored()); - }); - - popupMenu.add(toggle); - } - - itemContainer.add(slotContainer); - } - - itemContainer.repaint(); - } - - private static String buildToolTip(LootTrackerItem item) - { - final String name = item.getName(); - final int quantity = item.getQuantity(); - final long gePrice = item.getGePrice(); - final long haPrice = item.getHaPrice(); - final String ignoredLabel = item.isIgnored() ? " - Ignored" : ""; - return "" + name + " x " + quantity + ignoredLabel - + "
GE: " + QuantityFormatter.quantityToStackSize(gePrice) - + "
HA: " + QuantityFormatter.quantityToStackSize(haPrice) + ""; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java deleted file mode 100644 index ac1290381a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (c) 2018, Psikoi - * 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.loottracker; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigSection; - -@ConfigGroup("loottracker") -public interface LootTrackerConfig extends Config -{ - @ConfigSection( - position = 1, - keyName = "filterSection", - name = "Filter", - description = "" - ) - default boolean filterSection() - { - return false; - } - - @ConfigItem( - keyName = "ignoredItems", - name = "Ignored items", - description = "Configures which items should be ignored when calculating loot prices.", - position = 0, - section = "filterSection" - ) - default String getIgnoredItems() - { - return ""; - } - - @ConfigItem( - keyName = "ignoredItems", - name = "", - description = "" - ) - void setIgnoredItems(String key); - - @ConfigItem( - keyName = "ignoredNPCs", - name = "Ignored NPCs", - description = "Configures which NPCs should be ignored ", - position = 1, - section = "filterSection" - ) - default String getIgnoredNPCs() - { - return ""; - } - - @ConfigItem( - keyName = "ignoredNPCs", - name = "", - description = "" - ) - void setIgnoredNPCs(String key); - - @ConfigItem( - keyName = "saveLoot", - name = "Submit loot tracker data", - description = "Submit loot tracker data (requires being logged in)" - ) - default boolean saveLoot() - { - return true; - } - - @ConfigItem( - keyName = "chestLootChat", - name = "Show chest loot value in chat", - description = "Show the value of items from CoX/ToB/Barrows chests in chat" - ) - default boolean chestLootChat() - { - return true; - } - - @ConfigItem( - keyName = "syncPanel", - name = "Synchronize panel contents", - description = "Synchronize your local loot tracker with your online (requires being logged in). This means" + - " that panel is filled with portion of your remote data on startup and deleting data in panel deletes them" + - " also on server." - ) - default boolean syncPanel() - { - return true; - } - - @ConfigItem( - keyName = "localPersistence", - name = "Local Record Persistence", - description = "Stores/syncs loot records locally in the JSON format. Note: records will not be saved locally" + - " if they are successfully saved online. " - ) - default boolean localPersistence() - { - return true; - } - - @ConfigItem( - keyName = "sortType", - name = "Sorting", - description = "The method for sorting Loot Tracker entries" - ) - default LootRecordSortType sortType() - { - return LootRecordSortType.TIMESTAMP; - } - - @ConfigItem( - keyName = "whitelistEnabled", - name = "NPC Whitelist", - description = "Only track drops from specific NPCs", - position = 1, - section = "filterSection", - disabledBy = "blacklistEnabled" - ) - default boolean whitelistEnabled() - { - return false; - } - - @ConfigItem( - keyName = "getWhitelist", - name = "Whitelist", - description = "Comma-separated list of NPCs to track drops from", - position = 2, - section = "filterSection", - hidden = true, - unhide = "whitelistEnabled" - ) - default String getWhitelist() - { - return ""; - } - - @ConfigItem( - keyName = "blacklistEnabled", - name = "NPC Blacklist", - description = "Track drops from all NPCs except for specified ones", - position = 3, - section = "filterSection", - disabledBy = "whitelistEnabled" - ) - default boolean blacklistEnabled() - { - return false; - } - - @ConfigItem( - keyName = "getBlacklist", - name = "Blacklist", - description = "Comma-separated list of NPCs to not track drops from", - position = 4, - section = "filterSection", - hidden = true, - unhide = "blacklistEnabled" - ) - default String getBlacklist() - { - return ""; - } - - @ConfigItem( - keyName = "lootValueMessage", - name = "Loot Value Messages", - description = "Sends a game message with the total value you of your loot when you get a kill", - position = 5 - ) - default boolean sendLootValueMessages() - { - return true; - } - - @ConfigItem( - keyName = "showDeaths", - name = "Show PvP Deaths", - description = "Shows your deaths to help you calculate PvP profit" - ) - default boolean showDeaths() - { - return true; - } - - @ConfigItem( - keyName = "displayDate", - name = "Display Date", - description = "Displays the date the loot was received" - ) - default boolean displayDate() - { - return true; - } - - @ConfigItem( - keyName = "priceType", - name = "Price Type", - description = "What type of price to use for calculating value." - ) - default LootTrackerPriceType priceType() - { - return LootTrackerPriceType.GRAND_EXCHANGE; - } - - @ConfigItem( - keyName = "showPriceType", - name = "Show Price Type", - description = "Whether to show a GE: or HA: next to the total values in the tracker" - ) - default boolean showPriceType() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerItem.java deleted file mode 100644 index 1b4d389560..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerItem.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.loottracker; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; - -@AllArgsConstructor -class LootTrackerItem -{ - @Getter(AccessLevel.PACKAGE) - private final int id; - @Getter(AccessLevel.PACKAGE) - private final String name; - @Getter(AccessLevel.PACKAGE) - private final int quantity; - @Getter(AccessLevel.PACKAGE) - private final long gePrice; - @Getter(AccessLevel.PACKAGE) - private final long haPrice; - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private boolean ignored; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java deleted file mode 100644 index b01fef82f3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java +++ /dev/null @@ -1,856 +0,0 @@ -/* - * Copyright (c) 2018, Psikoi - * Copyright (c) 2018, Tomas Slusny - * 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.loottracker; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.Objects; -import java.util.Vector; -import javax.inject.Singleton; -import javax.swing.BorderFactory; -import javax.swing.BoxLayout; -import javax.swing.ImageIcon; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.border.EmptyBorder; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.GameState; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.ui.components.PluginErrorPanel; -import net.runelite.client.util.ColorUtil; -import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.QuantityFormatter; -import net.runelite.http.api.loottracker.LootTrackerClient; - -@Slf4j -@Singleton -class LootTrackerPanel extends PluginPanel -{ - private static final int MAX_LOOT_BOXES = 500; - - private static final ImageIcon SINGLE_LOOT_VIEW; - private static final ImageIcon SINGLE_LOOT_VIEW_FADED; - private static final ImageIcon SINGLE_LOOT_VIEW_HOVER; - private static final ImageIcon GROUPED_LOOT_VIEW; - private static final ImageIcon GROUPED_LOOT_VIEW_FADED; - private static final ImageIcon GROUPED_LOOT_VIEW_HOVER; - private static final ImageIcon BACK_ARROW_ICON; - private static final ImageIcon BACK_ARROW_ICON_HOVER; - private static final ImageIcon VISIBLE_ICON; - private static final ImageIcon VISIBLE_ICON_HOVER; - private static final ImageIcon INVISIBLE_ICON; - private static final ImageIcon INVISIBLE_ICON_HOVER; - private static final ImageIcon RESET_ICON; - private static final ImageIcon RESET_ICON_FADED; - private static final ImageIcon RESET_ICON_HOVER; - private static final ImageIcon COLLAPSE_ICON; - private static final ImageIcon EXPAND_ICON; - - - private static final String HTML_LABEL_TEMPLATE = - "%s%s"; - private static final String SYNC_RESET_ALL_WARNING_TEXT = - "This will permanently delete the current loot from both the client and the RuneLite website."; - private static final String NO_SYNC_RESET_ALL_WARNING_TEXT = - "This will permanently delete the current loot from the client."; - - // When there is no loot, display this - private final PluginErrorPanel errorPanel = new PluginErrorPanel(); - - // Handle loot boxes - private final JPanel logsContainer = new JPanel(); - - // Handle overall session data - private final JPanel overallPanel = new JPanel(); - private final JLabel overallKillsLabel = new JLabel(); - private final JLabel overallGpLabel = new JLabel(); - private final JLabel overallIcon = new JLabel(); - - // Details and navigation - private final JPanel actionsContainer = new JPanel(); - private final JLabel detailsTitle = new JLabel(); - private final JLabel backBtn = new JLabel(); - private final JLabel viewHiddenBtn = new JLabel(); - private final JLabel singleLootBtn = new JLabel(); - private final JLabel groupedLootBtn = new JLabel(); - private final JLabel resetIcon = new JLabel(); - private final JLabel collapseBtn = new JLabel(); - - // Log collection - private final List records = new ArrayList<>(); - private final List boxes = new ArrayList<>(); - - private final ItemManager itemManager; - private final LootTrackerPlugin plugin; - private final LootTrackerConfig config; - - private boolean groupLoot; - // Set default date filter to session data - private LootRecordDateFilter dateFilter = LootRecordDateFilter.SESSION; - private boolean hideIgnoredItems; - private String currentView; - - static - { - final BufferedImage singleLootImg = ImageUtil.getResourceStreamFromClass(LootTrackerPlugin.class, "single_loot_icon.png"); - final BufferedImage groupedLootImg = ImageUtil.getResourceStreamFromClass(LootTrackerPlugin.class, "grouped_loot_icon.png"); - final BufferedImage backArrowImg = ImageUtil.getResourceStreamFromClass(LootTrackerPlugin.class, "back_icon.png"); - final BufferedImage visibleImg = ImageUtil.getResourceStreamFromClass(LootTrackerPlugin.class, "visible_icon.png"); - final BufferedImage invisibleImg = ImageUtil.getResourceStreamFromClass(LootTrackerPlugin.class, "invisible_icon.png"); - final BufferedImage resetImg = ImageUtil.getResourceStreamFromClass(LootTrackerPlugin.class, "delete-white.png"); - final BufferedImage collapseImg = ImageUtil.getResourceStreamFromClass(LootTrackerPlugin.class, "collapsed.png"); - final BufferedImage expandedImg = ImageUtil.getResourceStreamFromClass(LootTrackerPlugin.class, "expanded.png"); - - SINGLE_LOOT_VIEW = new ImageIcon(singleLootImg); - SINGLE_LOOT_VIEW_FADED = new ImageIcon(ImageUtil.alphaOffset(singleLootImg, -180)); - SINGLE_LOOT_VIEW_HOVER = new ImageIcon(ImageUtil.alphaOffset(singleLootImg, -220)); - - RESET_ICON = new ImageIcon(resetImg); - RESET_ICON_FADED = new ImageIcon(ImageUtil.alphaOffset(resetImg, -180)); - RESET_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(resetImg, -220)); - - - GROUPED_LOOT_VIEW = new ImageIcon(groupedLootImg); - GROUPED_LOOT_VIEW_FADED = new ImageIcon(ImageUtil.alphaOffset(groupedLootImg, -180)); - GROUPED_LOOT_VIEW_HOVER = new ImageIcon(ImageUtil.alphaOffset(groupedLootImg, -220)); - - BACK_ARROW_ICON = new ImageIcon(backArrowImg); - BACK_ARROW_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(backArrowImg, -180)); - - VISIBLE_ICON = new ImageIcon(visibleImg); - VISIBLE_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(visibleImg, -220)); - - INVISIBLE_ICON = new ImageIcon(invisibleImg); - INVISIBLE_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(invisibleImg, -220)); - - COLLAPSE_ICON = new ImageIcon(collapseImg); - EXPAND_ICON = new ImageIcon(expandedImg); - } - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private LootRecordSortType lootRecordSortType = LootRecordSortType.TIMESTAMP; - - LootTrackerPanel(final LootTrackerPlugin plugin, final ItemManager itemManager, final LootTrackerConfig config) - { - this.itemManager = itemManager; - this.plugin = plugin; - this.config = config; - this.hideIgnoredItems = true; - - setBorder(new EmptyBorder(6, 6, 6, 6)); - setBackground(ColorScheme.DARK_GRAY_COLOR); - setLayout(new BorderLayout()); - - // Create layout panel for wrapping - final JPanel layoutPanel = new JPanel(); - layoutPanel.setLayout(new BoxLayout(layoutPanel, BoxLayout.Y_AXIS)); - add(layoutPanel, BorderLayout.NORTH); - - actionsContainer.setLayout(new BorderLayout()); - actionsContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR); - actionsContainer.setPreferredSize(new Dimension(0, 30)); - actionsContainer.setBorder(new EmptyBorder(5, 5, 5, 10)); - actionsContainer.setVisible(false); - - final JPanel viewControls = new JPanel(new GridLayout(1, 5, 5, 0)); - viewControls.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - collapseBtn.setIcon(EXPAND_ICON); - collapseBtn.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent e) - { - changeCollapse(); - } - }); - - singleLootBtn.setIcon(SINGLE_LOOT_VIEW); - singleLootBtn.setToolTipText("Show each kill separately"); - singleLootBtn.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - changeGrouping(false); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - singleLootBtn.setIcon(groupLoot ? SINGLE_LOOT_VIEW_FADED : SINGLE_LOOT_VIEW); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - singleLootBtn.setIcon(groupLoot ? SINGLE_LOOT_VIEW_HOVER : SINGLE_LOOT_VIEW); - } - }); - - groupedLootBtn.setIcon(GROUPED_LOOT_VIEW); - groupedLootBtn.setToolTipText("Group loot by source"); - groupedLootBtn.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - changeGrouping(true); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - groupedLootBtn.setIcon(groupLoot ? GROUPED_LOOT_VIEW : GROUPED_LOOT_VIEW_FADED); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - groupedLootBtn.setIcon(groupLoot ? GROUPED_LOOT_VIEW : GROUPED_LOOT_VIEW_HOVER); - } - }); - - viewHiddenBtn.setIcon(VISIBLE_ICON); - viewHiddenBtn.setToolTipText("Show ignored items"); - viewHiddenBtn.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - changeItemHiding(!hideIgnoredItems); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - viewHiddenBtn.setIcon(hideIgnoredItems ? INVISIBLE_ICON : VISIBLE_ICON); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - viewHiddenBtn.setIcon(hideIgnoredItems ? INVISIBLE_ICON_HOVER : VISIBLE_ICON_HOVER); - } - }); - - resetIcon.setIcon(RESET_ICON); - resetIcon.setToolTipText("Resets all locally saved data (cannot be undone)"); - resetIcon.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent e) - { - resetRecords(); - } - - @Override - public void mouseEntered(MouseEvent e) - { - resetIcon.setIcon(RESET_ICON_HOVER); - } - - @Override - public void mouseExited(MouseEvent e) - { - resetIcon.setIcon(records.isEmpty() ? RESET_ICON_FADED : RESET_ICON); - } - }); - - JComboBox dateFilterComboBox = new JComboBox<>(new Vector<>(Arrays.asList(LootRecordDateFilter.values()))); - dateFilterComboBox.setSelectedItem(this.dateFilter); - dateFilterComboBox.setToolTipText("Filter the displayed loot records by date"); - dateFilterComboBox.setMaximumSize(new Dimension(15, 0)); - dateFilterComboBox.setMaximumRowCount(3); - dateFilterComboBox.addItemListener(e -> - { - dateFilter = (LootRecordDateFilter) e.getItem(); - rebuild(); - } - ); - - viewControls.add(collapseBtn); - //viewControls.add(dateFilterComboBox); - viewControls.add(resetIcon); - viewControls.add(groupedLootBtn); - viewControls.add(singleLootBtn); - viewControls.add(viewHiddenBtn); - changeGrouping(true); - changeItemHiding(true); - - final JPanel leftTitleContainer = new JPanel(new BorderLayout(5, 0)); - leftTitleContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - detailsTitle.setForeground(Color.WHITE); - - backBtn.setIcon(BACK_ARROW_ICON); - backBtn.setVisible(false); - backBtn.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - currentView = null; - backBtn.setVisible(false); - detailsTitle.setText(""); - rebuild(); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - backBtn.setIcon(BACK_ARROW_ICON); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - backBtn.setIcon(BACK_ARROW_ICON_HOVER); - } - }); - - leftTitleContainer.add(backBtn, BorderLayout.WEST); - leftTitleContainer.add(detailsTitle, BorderLayout.CENTER); - - actionsContainer.add(dateFilterComboBox); - actionsContainer.add(viewControls, BorderLayout.EAST); - actionsContainer.add(leftTitleContainer, BorderLayout.WEST); - - // Create panel that will contain overall data - overallPanel.setBorder(BorderFactory.createCompoundBorder( - BorderFactory.createMatteBorder(5, 0, 0, 0, ColorScheme.DARK_GRAY_COLOR), - BorderFactory.createEmptyBorder(8, 10, 8, 10) - )); - overallPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - overallPanel.setLayout(new BorderLayout()); - overallPanel.setVisible(false); - - // Add icon and contents - final JPanel overallInfo = new JPanel(); - overallInfo.setBackground(ColorScheme.DARKER_GRAY_COLOR); - overallInfo.setLayout(new GridLayout(2, 1)); - overallInfo.setBorder(new EmptyBorder(2, 10, 2, 0)); - overallKillsLabel.setFont(FontManager.getRunescapeSmallFont()); - overallGpLabel.setFont(FontManager.getRunescapeSmallFont()); - overallInfo.add(overallKillsLabel); - overallInfo.add(overallGpLabel); - overallPanel.add(overallIcon, BorderLayout.WEST); - overallPanel.add(overallInfo, BorderLayout.CENTER); - - JPanel displaySelector = new JPanel(); - displaySelector.setLayout(new GridLayout(1, 1)); - displaySelector.setBorder(new EmptyBorder(2, 10, 10, 10)); - displaySelector.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - // Create reset all menu - final JMenuItem reset = new JMenuItem("Reset All"); - reset.addActionListener(e -> - { - final LootTrackerClient client = plugin.getLootTrackerClient(); - final boolean syncLoot = client != null && config.syncPanel(); - final int result = JOptionPane.showOptionDialog(overallPanel, - syncLoot ? SYNC_RESET_ALL_WARNING_TEXT : NO_SYNC_RESET_ALL_WARNING_TEXT, - "Are you sure?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, - null, new String[]{"Yes", "No"}, "No"); - - if (result != JOptionPane.YES_OPTION) - { - return; - } - - // If not in detailed view, remove all, otherwise only remove for the currently detailed title - records.removeIf(r -> r.matches(currentView)); - boxes.removeIf(b -> b.matches(currentView)); - updateOverall(); - logsContainer.removeAll(); - logsContainer.repaint(); - - // Delete all loot, or loot matching the current view - if (syncLoot) - { - client.delete(currentView); - } - }); - - // Create popup menu - final JPopupMenu popupMenu = new JPopupMenu(); - popupMenu.setBorder(new EmptyBorder(5, 5, 5, 5)); - popupMenu.add(reset); - overallPanel.setComponentPopupMenu(popupMenu); - - // Create loot boxes wrapper - logsContainer.setLayout(new BoxLayout(logsContainer, BoxLayout.Y_AXIS)); - layoutPanel.add(actionsContainer); - layoutPanel.add(overallPanel); - layoutPanel.add(displaySelector); - layoutPanel.add(logsContainer); - - // Add error pane - errorPanel.setContent("Loot tracker", "You have not received any loot yet."); - add(errorPanel); - actionsContainer.setVisible(true); - } - - private void updateCollapseText() - { - if (isAllCollapsed()) - { - collapseBtn.setToolTipText("Un-Collapse All"); - collapseBtn.setIcon(COLLAPSE_ICON); - } - else - { - collapseBtn.setToolTipText("Collapse All"); - collapseBtn.setIcon(EXPAND_ICON); - } - } - - private boolean isAllCollapsed() - { - return boxes.stream() - .filter(LootTrackerBox::isCollapsed) - .count() == boxes.size(); - } - - void loadHeaderIcon(BufferedImage img) - { - overallIcon.setIcon(new ImageIcon(img)); - } - - /** - * Adds a new entry to the plugin. - * Creates a subtitle, adds a new entry and then passes off to the render methods, that will decide - * how to display this new data. - */ - void add(final String eventName, final String localUsername, final int actorLevel, LootTrackerItem[] items) - { - final String subTitle = actorLevel > -1 ? "(lvl-" + actorLevel + ")" : ""; - final LootTrackerRecord record = new LootTrackerRecord(eventName, localUsername, subTitle, items, Instant.now()); - records.add(record); - LootTrackerBox box = buildBox(record); - if (box != null) - { - box.rebuild(); - updateOverall(); - } - } - - /** - * Adds a Collection of records to the panel - */ - void addRecords(Collection recs) - { - records.addAll(recs); - rebuild(); - } - - /** - * Changes grouping mode of panel - * - * @param group if loot should be grouped or not - */ - private void changeGrouping(boolean group) - { - groupLoot = group; - rebuild(); - groupedLootBtn.setIcon(group ? GROUPED_LOOT_VIEW : GROUPED_LOOT_VIEW_FADED); - singleLootBtn.setIcon(group ? SINGLE_LOOT_VIEW_FADED : SINGLE_LOOT_VIEW); - } - - /** - * Changes item hiding mode of panel - * - * @param hide if ignored items should be hidden or not - */ - private void changeItemHiding(boolean hide) - { - hideIgnoredItems = hide; - rebuild(); - viewHiddenBtn.setIcon(hideIgnoredItems ? VISIBLE_ICON : INVISIBLE_ICON); - } - - /** - * Clears all loaded records. This will also attempt to delete the local storage file - */ - private void resetRecords() - { - records.clear(); - boxes.clear(); - logsContainer.removeAll(); - logsContainer.repaint(); - plugin.deleteLocalRecords(); - } - - /** - * Changes the collapse status of loot entries - */ - private void changeCollapse() - { - boolean isAllCollapsed = isAllCollapsed(); - - for (LootTrackerBox box : boxes) - { - if (isAllCollapsed) - { - box.expand(); - } - else if (!box.isCollapsed()) - { - box.collapse(); - } - } - - updateCollapseText(); - } - - /** - * After an item changed it's ignored state, iterate all the records and make - * sure all items of the same name also get updated - */ - void updateIgnoredRecords() - { - for (LootTrackerRecord r : records) - { - if (plugin.isIgnoredNPC(r.getTitle())) - { - for (LootTrackerItem item : r.getItems()) - { - if (plugin.isIgnored(item.getName()) != item.isIgnored()) - { - item.setIgnored(plugin.isIgnored(item.getName())); - } - } - } - } - - rebuild(); - } - - /** - * Rebuilds all the boxes from scratch using existing listed records, depending on the grouping mode. - */ - public void rebuild() - { - - logsContainer.removeAll(); - boxes.clear(); - int start = 0; - records.sort(lootRecordSortType); - if (!groupLoot && records.size() > MAX_LOOT_BOXES) - { - start = records.size() - MAX_LOOT_BOXES; - } - for (int i = start; i < records.size(); i++) - { - - // Check to see if we should even show this record - if (this.hideIgnoredItems) - { - if (this.plugin.isIgnoredNPC(records.get(i).getTitle())) - { - continue; - } - } - - if (this.plugin.client.getGameState().equals(GameState.LOGGED_IN)) - { - if (this.plugin.client.getLocalPlayer() == null || !(this.plugin.client.getLocalPlayer().getName().equals(records.get(i).getLocalUsername()))) - { - continue; - } - } - if (this.dateFilter.equals(LootRecordDateFilter.ALL)) - { - buildBox(records.get(i)); - continue; - } - if (dateFilter.equals(LootRecordDateFilter.SESSION)) - { - if (records.get(i).getTimestamp().toEpochMilli() > dateFilter.getDuration().toMillis()) - { - buildBox(records.get(i)); - } - } - else - { - if (Instant.now().toEpochMilli() - records.get(i).getTimestamp().toEpochMilli() <= this.dateFilter.getDuration().toMillis()) - { - buildBox(records.get(i)); - } - } - - - } - boxes.forEach(LootTrackerBox::rebuild); - updateOverall(); - logsContainer.revalidate(); - logsContainer.repaint(); - } - - /** - * This method decides what to do with a new record, if a similar log exists, it will - * add its items to it, updating the log's overall price and kills. If not, a new log will be created - * to hold this entry's information. - */ - private LootTrackerBox buildBox(LootTrackerRecord record) - { - - // If this record is not part of current view, return - if (!record.matches(currentView)) - { - return null; - } - - if (this.plugin.client.getGameState().equals(GameState.LOGGED_IN)) - { - if (!(this.plugin.client.getLocalPlayer().getName().equals(record.getLocalUsername()))) - { - return null; - } - } - - // Check to see if we should even show this record - if (this.hideIgnoredItems) - { - if (this.plugin.isIgnoredNPC(record.getTitle())) - { - return null; - } - } - - - // Group all similar loot together - if (groupLoot) - { - for (LootTrackerBox box : boxes) - { - if (box.matches(record)) - { - box.combine(record); - return box; - } - } - } - - // Show main view - remove(errorPanel); - actionsContainer.setVisible(true); - overallPanel.setVisible(true); - - // Create box - final LootTrackerBox box = new LootTrackerBox(record.getTimestamp().toEpochMilli(), itemManager, record.getTitle(), record.getSubTitle(), - hideIgnoredItems, config.priceType(), config.showPriceType(), config.displayDate(), plugin::toggleItem); - box.combine(record); - - // Create popup menu - final JPopupMenu popupMenu = new JPopupMenu(); - popupMenu.setBorder(new EmptyBorder(5, 5, 5, 5)); - box.setComponentPopupMenu(popupMenu); - - // Create collapse event - box.addMouseListener(new MouseAdapter() - { - @Override - public void mouseClicked(MouseEvent e) - { - if (e.getButton() == MouseEvent.BUTTON1) - { - if (box.isCollapsed()) - { - box.expand(); - } - else - { - box.collapse(); - } - updateCollapseText(); - } - } - }); - - // Create Hide Menu item - - final JMenuItem hide; - if (this.hideIgnoredItems) - { - hide = new JMenuItem("Hide " + box.getId()); - } - else - { - hide = new JMenuItem("Unhide " + box.getId()); - } - - hide.addActionListener(e -> - { - this.plugin.toggleNPC(box.getId(), this.hideIgnoredItems); - rebuild(); - }); - - popupMenu.add(hide); - - // Create reset menu - final JMenuItem reset = new JMenuItem("Reset"); - reset.addActionListener(e -> - { - records.removeAll(box.getRecords()); - boxes.remove(box); - updateOverall(); - logsContainer.remove(box); - logsContainer.repaint(); - - LootTrackerClient client = plugin.getLootTrackerClient(); - // Without loot being grouped we have no way to identify single kills to be deleted - if (client != null && groupLoot && config.syncPanel()) - { - client.delete(box.getId()); - } - }); - - popupMenu.add(reset); - - // Create details menu - final JMenuItem details = new JMenuItem("View details"); - details.addActionListener(e -> - { - currentView = record.getTitle(); - detailsTitle.setText(currentView); - backBtn.setVisible(true); - rebuild(); - }); - - popupMenu.add(details); - - // Add box to panel - boxes.add(box); - logsContainer.add(box, 0); - - if (!groupLoot && boxes.size() > MAX_LOOT_BOXES) - { - logsContainer.remove(boxes.remove(0)); - } - - return box; - } - - private void updateOverall() - { - long overallKills = 0; - long overallGe = 0; - long overallHa = 0; - - for (LootTrackerRecord record : records) - { - if (!record.matches(currentView)) - { - continue; - } - if (Objects.nonNull(record.getLocalUsername()) && Objects.nonNull(plugin.client.getLocalPlayer())) - { - if (!record.getLocalUsername().equals(plugin.client.getLocalPlayer().getName())) - { - continue; - } - } - if (!dateFilter.equals(LootRecordDateFilter.ALL)) - { - if (dateFilter.equals(LootRecordDateFilter.SESSION)) - { - if (!(record.getTimestamp().toEpochMilli() > dateFilter.getDuration().toMillis())) - { - continue; - } - } - else - { - if (Instant.now().toEpochMilli() - record.getTimestamp().toEpochMilli() - > this.dateFilter.getDuration().toMillis()) - { - continue; - } - } - } - - int present = record.getItems().length; - - for (LootTrackerItem item : record.getItems()) - { - if (hideIgnoredItems && item.isIgnored()) - { - present--; - continue; - } - - overallGe += item.getGePrice(); - overallHa += item.getHaPrice(); - } - - if (present > 0) - { - overallKills++; - } - } - - String priceType = ""; - if (config.showPriceType()) - { - priceType = config.priceType() == LootTrackerPriceType.HIGH_ALCHEMY ? "HA " : "GE "; - } - - overallKillsLabel.setText(htmlLabel("Total count: ", overallKills)); - overallGpLabel.setText(htmlLabel("Total " + priceType + "value: ", config.priceType() == LootTrackerPriceType.HIGH_ALCHEMY ? overallHa : overallGe)); - overallGpLabel.setToolTipText("Total GE price: " + QuantityFormatter.formatNumber(overallGe) - + "
Total HA price: " + QuantityFormatter.formatNumber(overallHa) + ""); - - updateCollapseText(); - } - - private static String htmlLabel(String key, long value) - { - final String valueStr = QuantityFormatter.quantityToStackSize(value); - return String.format(HTML_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR), key, valueStr); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java deleted file mode 100644 index 3e3d54d545..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java +++ /dev/null @@ -1,1562 +0,0 @@ -/* - * Copyright (c) 2018, Psikoi - * Copyright (c) 2018, 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.loottracker; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.collect.HashMultiset; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Multiset; -import com.google.common.collect.Multisets; -import com.google.gson.reflect.TypeToken; -import com.google.inject.Provides; -import io.reactivex.Completable; -import io.reactivex.schedulers.Schedulers; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.sql.Timestamp; -import java.time.Instant; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.ScheduledExecutorService; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.swing.SwingUtilities; -import lombok.AccessLevel; -import lombok.Getter; -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.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemDefinition; -import net.runelite.api.NPC; -import net.runelite.api.Player; -import net.runelite.api.SpriteID; -import net.runelite.api.Varbits; -import net.runelite.api.WorldType; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.PlayerDeath; -import net.runelite.api.events.PlayerSpawned; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.RuneLite; -import net.runelite.client.account.AccountSession; -import net.runelite.client.account.SessionManager; -import net.runelite.client.callback.ClientThread; -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.database.DatabaseManager; -import static net.runelite.client.database.data.Tables.LOOTTRACKEREVENTS; -import static net.runelite.client.database.data.Tables.LOOTTRACKERLINK; -import static net.runelite.client.database.data.Tables.LOOTTRACKERLOOT; -import static net.runelite.client.database.data.Tables.USER; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.events.NpcLootReceived; -import net.runelite.client.events.PlayerLootReceived; -import net.runelite.client.events.SessionClose; -import net.runelite.client.events.SessionOpen; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.ItemStack; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.loottracker.localstorage.LTItemEntry; -import net.runelite.client.plugins.loottracker.localstorage.LTRecord; -import net.runelite.client.plugins.loottracker.localstorage.LootRecordWriter; -import net.runelite.client.task.Schedule; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.QuantityFormatter; -import net.runelite.http.api.RuneLiteAPI; -import net.runelite.http.api.loottracker.GameItem; -import net.runelite.http.api.loottracker.LootRecord; -import net.runelite.http.api.loottracker.LootRecordType; -import net.runelite.http.api.loottracker.LootTrackerClient; -import org.apache.commons.lang3.ArrayUtils; -import org.jooq.DSLContext; -import org.jooq.Record; -import org.jooq.Record1; -import org.jooq.Record2; -import org.jooq.Result; -import static org.jooq.impl.DSL.constraint; -import org.jooq.impl.SQLDataType; - -@PluginDescriptor( - name = "Loot Tracker", - description = "Tracks loot from monsters and minigames", - tags = {"drops"}, - enabledByDefault = false, - type = PluginType.UTILITY -) -@Slf4j -@Singleton -public class LootTrackerPlugin extends Plugin -{ - // Activity/Event loot handling - private static final Pattern CLUE_SCROLL_PATTERN = Pattern.compile("You have completed ([0-9]+) ([a-z]+) Treasure Trails."); - private static final int THEATRE_OF_BLOOD_REGION = 12867; - - private static final Pattern BOSS_NAME_NUMBER_PATTERN = Pattern.compile("Your (.*) kill count is: ([0-9]*)."); - private static final Pattern NUMBER_PATTERN = Pattern.compile("([0-9]+)"); - - // Herbiboar loot handling - private static final String HERBIBOAR_LOOTED_MESSAGE = "You harvest herbs from the herbiboar, whereupon it escapes."; - private static final String HERBIBOAR_EVENT = "Herbiboar"; - - // Wintertodt loot handling - private static final Pattern WINTERTODT_NUMBER_PATTERN = Pattern.compile("Your subdued Wintertodt count is: ([0-9]*)."); - private static final String WINTERTODT_EVENT = "Wintertodt"; - - // Hespori loot handling - private static final String HESPORI_LOOTED_MESSAGE = "You have successfully cleared this patch for new crops."; - private static final String HESPORI_EVENT = "Hespori"; - private static final int HESPORI_REGION = 5021; - - // Gauntlet loot handling - private static final String GAUNTLET_LOOTED_MESSAGE = "You open the chest."; - private static final String GAUNTLET_EVENT = "The Gauntlet"; - private static final int GAUNTLET_LOBBY_REGION = 12127; - - private static final String MASTER_FARMER_EVENT = "Master farmer"; - - // Chest loot handling - private static final String CHEST_LOOTED_MESSAGE = "You find some treasure in the chest!"; - private static final Pattern LARRAN_LOOTED_PATTERN = Pattern.compile("You have opened Larran's (big|small) chest .*"); - private static final Map CHEST_EVENT_TYPES = ImmutableMap.of( - 5179, "Brimstone Chest", - 11573, "Crystal Chest", - 12093, "Larran's big chest", - 13113, "Larran's small chest", - 13151, "Elven Crystal Chest" - ); - private static final File LOOT_RECORDS_FILE = new File(RuneLite.RUNELITE_DIR, "lootRecords.json"); - private static final Set RESPAWN_REGIONS = ImmutableSet.of( - 12850, // Lumbridge - 11828, // Falador - 12342, // Edgeville - 11062 // Camelot - ); - - private static final Set PET_MESSAGES = ImmutableSet.of("You have a funny feeling like you're being followed", - "You feel something weird sneaking into your backpack", - "You have a funny feeling like you would have been followed"); - - // Instant for showing session loot. this gets set on plugin startup - - static final Instant SESSION_START_TIME = Instant.now(); - - @Inject - public Client client; - @VisibleForTesting - private Collection lootRecords = new ArrayList<>(); - private boolean pvpDeath = false; - - // Last man standing map regions - private static final Set LAST_MAN_STANDING_REGIONS = ImmutableSet.of(13658, 13659, 13914, 13915, 13916); - - @Inject - private ClientToolbar clientToolbar; - - @Inject - private ItemManager itemManager; - - @Inject - private ChatMessageManager chatMessageManager; - - @Inject - private SpriteManager spriteManager; - - @Inject - private LootTrackerConfig config; - - @Inject - private ClientThread clientThread; - - @Inject - private SessionManager sessionManager; - - @Inject - private ScheduledExecutorService executor; - - @Inject - private LootRecordWriter writer; - - @Inject - private DatabaseManager databaseManager; - - private LootTrackerPanel panel; - private NavigationButton navButton; - private String eventType; - private boolean chestLooted; - - private List ignoredItems = new ArrayList<>(); - private List ignoredNPCs = new ArrayList<>(); - private Multiset inventorySnapshot; - @Getter(AccessLevel.PACKAGE) - private LootTrackerClient lootTrackerClient; - private final List queuedLoots = new ArrayList<>(); - - private final Map killCountMap = new HashMap<>(); - private boolean gotPet = false; - private final Map userUuidMap = new HashMap<>(); - - private static Collection stack(Collection items) - { - final List list = new ArrayList<>(); - - for (final ItemStack item : items) - { - int quantity = 0; - for (final ItemStack i : list) - { - if (i.getId() == item.getId()) - { - quantity = i.getQuantity(); - list.remove(i); - break; - } - } - if (quantity > 0) - { - list.add(new ItemStack(item.getId(), item.getQuantity() + quantity, item.getLocation())); - } - else - { - list.add(item); - } - } - - return list; - } - - private static Collection toGameItems(Collection items) - { - return items.stream() - .map(item -> new GameItem(item.getId(), item.getQuantity())) - .collect(Collectors.toList()); - } - - private String getIgnoredItems; - private boolean saveLoot; - private boolean chestLootChat; - private boolean syncPanel; - private boolean localPersistence; - private LootRecordSortType sortType; - private boolean whitelistEnabled; - private String getWhitelist; - private boolean blacklistEnabled; - private String getBlacklist; - private boolean sendLootValueMessages; - - @Provides - LootTrackerConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(LootTrackerConfig.class); - } - - @Subscribe - private void onSessionOpen(SessionOpen sessionOpen) - { - AccountSession accountSession = sessionManager.getAccountSession(); - if (accountSession.getUuid() != null) - { - lootTrackerClient = new LootTrackerClient(accountSession.getUuid()); - } - else - { - lootTrackerClient = null; - } - } - - @Subscribe - private void onSessionClose(SessionClose sessionClose) - { - submitLoot(); - lootTrackerClient = null; - } - - @Subscribe - private void onPlayerDeath(PlayerDeath event) - { - if ((client.getVar(Varbits.IN_WILDERNESS) == 1 || WorldType.isPvpWorld(client.getWorldType())) && event.getPlayer() == client.getLocalPlayer()) - { - deathInventorySnapshot(); - pvpDeath = true; - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("loottracker")) - { - updateConfig(); - - if (event.getKey().equals("ignoredItems")) - { - ignoredItems = Text.fromCSV(this.getIgnoredItems); - SwingUtilities.invokeLater(panel::updateIgnoredRecords); - } - if (event.getKey().equals("ignoredNPCs")) - { - ignoredNPCs = Text.fromCSV(config.getIgnoredNPCs()); - SwingUtilities.invokeLater(panel::updateIgnoredRecords); - } - if (event.getKey().equals("sortType")) - { - panel.setLootRecordSortType(this.sortType); - SwingUtilities.invokeLater(panel::rebuild); - } - } - - } - - @Override - protected void startUp() - { - - ignoredItems = Text.fromCSV(config.getIgnoredItems()); - ignoredNPCs = Text.fromCSV(config.getIgnoredNPCs()); - updateConfig(); - panel = new LootTrackerPanel(this, itemManager, config); - spriteManager.getSpriteAsync(SpriteID.TAB_INVENTORY, 0, panel::loadHeaderIcon); - - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "panel_icon.png"); - - navButton = NavigationButton.builder() - .tooltip("Loot Tracker") - .icon(icon) - .priority(5) - .panel(panel) - .build(); - - clientToolbar.addNavigation(navButton); - - Completable.fromAction(this::initDatabase) - .subscribeOn(Schedulers.io()) - .subscribe(() -> - { - AccountSession accountSession = sessionManager.getAccountSession(); - if (accountSession != null || this.localPersistence) - { - clientThread.invokeLater(() -> - { - switch (client.getGameState()) - { - case STARTING: - case UNKNOWN: - return false; - } - - executor.submit(() -> - { - if (this.syncPanel && lootTrackerClient != null) - { - if (accountSession != null) - { - lootTrackerClient = new LootTrackerClient(accountSession.getUuid()); - } - try - { - lootRecords = lootTrackerClient.get(); - } - catch (IOException e) - { - log.debug("Unable to look up loot", e); - return; - } - log.info("Loaded {} remote data entries", lootRecords.size()); - } - - if (this.localPersistence) - { - DSLContext dslContext = databaseManager.getDsl(); - - Result records = dslContext - .selectDistinct( - LOOTTRACKEREVENTS.UNIQUEID - ).select( - LOOTTRACKEREVENTS.EVENTID, - LOOTTRACKEREVENTS.TYPE, - LOOTTRACKEREVENTS.TIME, - USER.USERNAME - ) - .from(LOOTTRACKEREVENTS) - .join(LOOTTRACKERLINK).on(LOOTTRACKERLINK.EVENTUNIQUEID.eq(LOOTTRACKEREVENTS.UNIQUEID)) - .join(USER).on(LOOTTRACKERLINK.USERUNIQUEID.eq(USER.UNIQUEID)) - .fetch(); - - for (Record record : records) - { - Result> drops = dslContext - .select( - LOOTTRACKERLOOT.ITEMID, - LOOTTRACKERLOOT.QUANTITY - ) - .from(LOOTTRACKERLOOT) - .join(LOOTTRACKERLINK).on(LOOTTRACKERLOOT.UNIQUEID.eq(LOOTTRACKERLINK.DROPUNIQUEID)) - .where(LOOTTRACKERLINK.EVENTUNIQUEID.eq(record.getValue(LOOTTRACKEREVENTS.UNIQUEID))) - .fetch(); - - final List gameItems = new ArrayList<>(); - - for (Record drop : drops) - { - GameItem gameItem = new GameItem(); - gameItem.setId(drop.getValue(LOOTTRACKERLOOT.ITEMID)); - gameItem.setQty(drop.getValue(LOOTTRACKERLOOT.QUANTITY)); - - gameItems.add(gameItem); - } - - LootRecord lootRecord = new LootRecord(); - lootRecord.setEventId(record.getValue(LOOTTRACKEREVENTS.EVENTID)); - lootRecord.setUsername(record.getValue(USER.USERNAME)); - lootRecord.setType(record.getValue(LOOTTRACKEREVENTS.TYPE, LootRecordType.class)); - lootRecord.setDrops(gameItems); - lootRecord.setTime(record.getValue(LOOTTRACKEREVENTS.TIME).toInstant()); - - lootRecords.add(lootRecord); - } - - if (lootRecords.size() > 0) - { - log.info("Loaded {} locally stored loot records", lootRecords.size()); - } - } - - Collection finalLootRecords = lootRecords; - clientThread.invokeLater(() -> - { - Collection records = convertToLootTrackerRecord(finalLootRecords); - SwingUtilities.invokeLater(() -> panel.addRecords(records)); - }); - }); - return true; - }); - } - }); - } - - @Override - protected void shutDown() - { - submitLoot(); - - clientToolbar.removeNavigation(navButton); - lootTrackerClient = null; - lootRecords = new ArrayList<>(); - chestLooted = false; - } - - @Subscribe - private void onGameStateChanged(final GameStateChanged event) - { - if (client.getLocalPlayer() == null) - { - return; - } - - if (event.getGameState() == GameState.LOADING) - { - chestLooted = false; - } - - if (event.getGameState() == GameState.LOGGING_IN) - { - clientThread.invokeLater(() -> - { - switch (client.getGameState()) - { - case LOGGED_IN: - break; - case LOGGING_IN: - case LOADING: - return false; - default: - // Quit running if any other state - return true; - } - - String name = client.getLocalPlayer().getName(); - if (name != null) - { - writer.setPlayerUsername(name); - userUuid(name); - - return true; - } - else - { - return false; - } - }); - } - } - - @Subscribe - private void onNpcLootReceived(final NpcLootReceived npcLootReceived) - { - if (client.getLocalPlayer() == null) - { - return; - } - - final NPC npc = npcLootReceived.getNpc(); - final Collection items = npcLootReceived.getItems(); - final String name = npc.getName(); - final int combat = npc.getCombatLevel(); - final LootTrackerItem[] entries = buildEntries(stack(items)); - String localUsername = client.getLocalPlayer().getName(); - - final int killCount = killCountMap.getOrDefault(name.toUpperCase(), -1); - - if (this.whitelistEnabled) - { - final String configNpcs = this.getWhitelist.toLowerCase(); - List whitelist = Text.fromCSV(configNpcs); - if (!whitelist.contains(name.toLowerCase())) - { - return; - } - } - else if (this.blacklistEnabled) - { - final String configNpcs = this.getBlacklist.toLowerCase(); - List blacklist = Text.fromCSV(configNpcs); - if (blacklist.contains(name.toLowerCase())) - { - return; - } - } - - if (gotPet) - { - ItemStack pet = handlePet(name); - if (pet == null) - { - log.warn("Error finding pet for npc name: {}", name); - } - else - { - items.add(pet); - } - } - - SwingUtilities.invokeLater(() -> panel.add(name, localUsername, combat, entries)); - LootRecord lootRecord = new LootRecord(name, localUsername, LootRecordType.NPC, - toGameItems(items), Instant.now()); - - if (config.saveLoot()) - { - synchronized (queuedLoots) - { - queuedLoots.add(lootRecord); - } - } - if (this.localPersistence) - { - saveLocalLootRecord(lootRecord); - } - - LTRecord record = new LTRecord(npc.getId(), npc.getName(), combat, killCount, convertToLTItemEntries(items)); - writer.addLootTrackerRecord(record); - } - - @Subscribe - private void onPlayerSpawned(PlayerSpawned event) - { - if (event.getPlayer().equals(client.getLocalPlayer())) - { - SwingUtilities.invokeLater(() -> panel.rebuild()); - } - } - - @Subscribe - private void onPlayerLootReceived(final PlayerLootReceived playerLootReceived) - { - if (client.getLocalPlayer() == null) - { - return; - } - - // Ignore Last Man Standing player loots - if (isAtLMS()) - { - return; - } - - if (this.sendLootValueMessages) - { - if (WorldType.isDeadmanWorld(client.getWorldType()) || WorldType.isHighRiskWorld(client.getWorldType()) || - WorldType.isPvpWorld(client.getWorldType()) || client.getVar(Varbits.IN_WILDERNESS) == 1) - { - final String totalValue = QuantityFormatter.quantityToStackSize(playerLootReceived.getItems().stream() - .mapToInt(itemStack -> itemManager.getItemPrice(itemStack.getId()) * itemStack.getQuantity()).sum()); - - chatMessageManager.queue(QueuedMessage.builder().type(ChatMessageType.CONSOLE).runeLiteFormattedMessage( - new ChatMessageBuilder().append("The total value of your loot is " + totalValue + " GP.") - .build()).build()); - } - } - - final Player player = playerLootReceived.getPlayer(); - final Collection items = playerLootReceived.getItems(); - final String name = player.getName(); - final int combat = player.getCombatLevel(); - final LootTrackerItem[] entries = buildEntries(stack(items)); - String localUsername = client.getLocalPlayer().getName(); - SwingUtilities.invokeLater(() -> panel.add(name, localUsername, combat, entries)); - LootRecord lootRecord = new LootRecord(name, localUsername, LootRecordType.PLAYER, - toGameItems(items), Instant.now()); - if (this.saveLoot) - { - synchronized (queuedLoots) - { - queuedLoots.add(lootRecord); - } - } - if (config.localPersistence()) - { - saveLocalLootRecord(lootRecord); - } - - LTRecord record = new LTRecord(-1, name, combat, -1, convertToLTItemEntries(items)); - writer.addLootTrackerRecord(record); - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded event) - { - if (client.getLocalPlayer() == null) - { - return; - } - - final ItemContainer container; - switch (event.getGroupId()) - { - case (WidgetID.BARROWS_REWARD_GROUP_ID): - eventType = "Barrows"; - container = client.getItemContainer(InventoryID.BARROWS_REWARD); - break; - case (WidgetID.CHAMBERS_OF_XERIC_REWARD_GROUP_ID): - if (chestLooted) - { - return; - } - eventType = "Chambers of Xeric"; - container = client.getItemContainer(InventoryID.CHAMBERS_OF_XERIC_CHEST); - chestLooted = true; - break; - case (WidgetID.THEATRE_OF_BLOOD_REWARD_GROUP_ID): - if (chestLooted) - { - return; - } - - WorldPoint p = WorldPoint.fromLocalInstance(client, client.getLocalPlayer().getLocalLocation()); - - if (p != null && p.getRegionID() != THEATRE_OF_BLOOD_REGION) - { - return; - } - - eventType = "Theatre of Blood"; - container = client.getItemContainer(InventoryID.THEATRE_OF_BLOOD_CHEST); - chestLooted = true; - break; - case (WidgetID.CLUE_SCROLL_REWARD_GROUP_ID): - // event opcode should be set via ChatMessage for clue scrolls. - // Clue Scrolls use same InventoryID as Barrows - container = client.getItemContainer(InventoryID.BARROWS_REWARD); - break; - case (WidgetID.KINGDOM_GROUP_ID): - eventType = "Kingdom of Miscellania"; - container = client.getItemContainer(InventoryID.KINGDOM_OF_MISCELLANIA); - break; - case (WidgetID.FISHING_TRAWLER_REWARD_GROUP_ID): - eventType = "Fishing Trawler"; - container = client.getItemContainer(InventoryID.FISHING_TRAWLER_REWARD); - break; - default: - return; - } - - if (container == null) - { - return; - } - - if (!(event.getGroupId() == WidgetID.CLUE_SCROLL_REWARD_GROUP_ID) && this.chestLootChat) - { - Item[] items = container.getItems(); - long chestPrice = 0; - for (Item item : items) - { - long itemStack = (long) itemManager.getItemPrice(item.getId()) * (long) item.getQuantity(); - chestPrice += itemStack; - } - - final ChatMessageBuilder message = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append("Your loot is worth around ") - .append(QuantityFormatter.formatNumber(chestPrice)) - .append(" coins.") - .append(ChatColorType.NORMAL); - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.ITEM_EXAMINE) - .runeLiteFormattedMessage(message.build()) - .build()); - } - - if (event.getGroupId() == WidgetID.CHATBOX_GROUP_ID) - { - panel.rebuild(); - } - - // Convert container items to array of ItemStack - final Collection items = Arrays.stream(container.getItems()) - .filter(item -> item.getId() > 0) - .map(item -> new ItemStack(item.getId(), item.getQuantity(), client.getLocalPlayer().getLocalLocation())) - .collect(Collectors.toList()); - - if (items.isEmpty()) - { - log.debug("No items to find for Event: {} | Container: {}", eventType, container); - return; - } - - final LootTrackerItem[] entries = buildEntries(stack(items)); - - SwingUtilities.invokeLater(() -> panel.add(eventType, client.getLocalPlayer().getName(), -1, entries)); - LootRecord lootRecord = new LootRecord(eventType, client.getLocalPlayer().getName(), LootRecordType.EVENT, - toGameItems(items), Instant.now()); - - if (this.saveLoot) - { - synchronized (queuedLoots) - { - queuedLoots.add(lootRecord); - } - } - if (config.localPersistence()) - { - saveLocalLootRecord(lootRecord); - } - - LTRecord record = new LTRecord(-1, eventType, -1, eventType == null ? -1 : killCountMap.getOrDefault(eventType.toUpperCase(), -1), convertToLTItemEntries(items)); - writer.addLootTrackerRecord(record); - } - - @Subscribe - private void onChatMessage(ChatMessage event) - { - if (client.getLocalPlayer() == null) - { - return; - } - - if (event.getType() != ChatMessageType.GAMEMESSAGE && event.getType() != ChatMessageType.SPAM) - { - return; - } - - final String message = event.getMessage(); - - if (PET_MESSAGES.stream().anyMatch(message::contains)) - { - gotPet = true; - } - - if (message.equals(CHEST_LOOTED_MESSAGE) || LARRAN_LOOTED_PATTERN.matcher(message).matches()) - { - final int regionID = client.getLocalPlayer().getWorldLocation().getRegionID(); - if (!CHEST_EVENT_TYPES.containsKey(regionID)) - { - return; - } - - eventType = CHEST_EVENT_TYPES.get(regionID); - takeInventorySnapshot(); - - return; - } - - if (message.equals(HERBIBOAR_LOOTED_MESSAGE)) - { - eventType = HERBIBOAR_EVENT; - takeInventorySnapshot(); - - return; - } - - // Remove all tags - final String chatMessage = Text.removeTags(message); - - final int regionID = client.getLocalPlayer().getWorldLocation().getRegionID(); - if (HESPORI_REGION == regionID && message.equals(HESPORI_LOOTED_MESSAGE)) - { - eventType = HESPORI_EVENT; - takeInventorySnapshot(); - return; - } - - if (GAUNTLET_LOBBY_REGION == regionID && message.equals(GAUNTLET_LOOTED_MESSAGE)) - { - eventType = GAUNTLET_EVENT; - takeInventorySnapshot(); - return; - } - - // Check if message is for a clue scroll reward - final Matcher m = CLUE_SCROLL_PATTERN.matcher(chatMessage); - if (m.find()) - { - final String type = m.group(2).toLowerCase(); - switch (type) - { - case "beginner": - eventType = "Clue Scroll (Beginner)"; - break; - case "easy": - eventType = "Clue Scroll (Easy)"; - break; - case "medium": - eventType = "Clue Scroll (Medium)"; - break; - case "hard": - eventType = "Clue Scroll (Hard)"; - break; - case "elite": - eventType = "Clue Scroll (Elite)"; - break; - case "master": - eventType = "Clue Scroll (Master)"; - break; - } - - int killCount = Integer.parseInt(m.group(1)); - killCountMap.put(eventType.toUpperCase(), killCount); - return; - } - - // Barrows KC - if (chatMessage.startsWith("Your Barrows chest count is")) - { - Matcher n = NUMBER_PATTERN.matcher(chatMessage); - if (n.find()) - { - killCountMap.put("BARROWS", Integer.valueOf(n.group())); - return; - } - } - - // Raids KC - if (chatMessage.startsWith("Your completed Chambers of Xeric count is")) - { - Matcher n = NUMBER_PATTERN.matcher(chatMessage); - if (n.find()) - { - killCountMap.put("CHAMBERS OF XERIC", Integer.valueOf(n.group())); - return; - } - } - // Raids KC - if (chatMessage.startsWith("Your completed Theatre of Blood count is")) - { - Matcher n = NUMBER_PATTERN.matcher(chatMessage); - if (n.find()) - { - killCountMap.put("THEATRE OF BLOOD", Integer.valueOf(n.group())); - return; - } - } - // Handle wintertodt - Matcher wintertodt = WINTERTODT_NUMBER_PATTERN.matcher(chatMessage); - if (wintertodt.find()) - { - int killCount = Integer.parseInt(wintertodt.group(1)); - killCountMap.put(WINTERTODT_EVENT, killCount); - } - // Handle all other boss - Matcher boss = BOSS_NAME_NUMBER_PATTERN.matcher(chatMessage); - if (boss.find()) - { - String bossName = boss.group(1); - int killCount = Integer.parseInt(boss.group(2)); - killCountMap.put(bossName.toUpperCase(), killCount); - } - - if (chatMessage.equals("You pick the Master Farmer's pocket.")) - { - eventType = MASTER_FARMER_EVENT; - takeInventorySnapshot(); - } - } - - @SuppressWarnings("unchecked") - @Subscribe - public void onItemContainerChanged(ItemContainerChanged event) - { - if (client.getLocalPlayer() == null) - { - return; - } - - if (pvpDeath && RESPAWN_REGIONS.contains(client.getLocalPlayer().getWorldLocation().getRegionID())) - { - Multiset snapshot; - snapshot = inventorySnapshot; - deathInventorySnapshot(); - if (inventorySnapshot != snapshot) - { - inventorySnapshot = snapshot; - ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); - if (inventorySnapshot != null) - { - Multiset currentInventory = HashMultiset.create(); - if (inventory != null) - { - Arrays.stream(Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) - .forEach(item -> currentInventory.add(item.getId(), item.getQuantity())); - } - - final Multiset diff = Multisets.difference(inventorySnapshot, currentInventory); - - List itemsLost = diff.entrySet().stream() - .map(e -> new ItemStack(e.getElement(), (-1 * e.getCount()), client.getLocalPlayer().getLocalLocation())) - .collect(Collectors.toList()); - - final LootTrackerItem[] entries = buildEntries(stack(itemsLost)); - String name = "Death: " + client.getLocalPlayer().getName(); - SwingUtilities.invokeLater(() -> panel.add(name, client.getLocalPlayer().getName(), - client.getLocalPlayer().getCombatLevel(), entries)); - LootRecord lootRecord = new LootRecord(name, client.getLocalPlayer().getName(), LootRecordType.DEATH, - toGameItems(itemsLost), Instant.now()); - if (this.saveLoot) - { - synchronized (queuedLoots) - { - queuedLoots.add(lootRecord); - } - } - if (this.localPersistence) - { - saveLocalLootRecord(lootRecord); - } - - pvpDeath = false; - inventorySnapshot = null; - } - } - - } - if (CHEST_EVENT_TYPES.containsValue(eventType) - || HERBIBOAR_EVENT.equals(eventType) - || HESPORI_EVENT.equals(eventType) - || GAUNTLET_EVENT.equals(eventType) - || WINTERTODT_EVENT.equals(eventType) - || MASTER_FARMER_EVENT.equals(eventType)) - { - if (event.getItemContainer() != client.getItemContainer(InventoryID.INVENTORY)) - { - return; - } - - processChestLoot(eventType, event.getItemContainer()); - eventType = null; - } - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked event) - { - if (event.getParam1() != WidgetInfo.INVENTORY.getId()) - { - return; - } - - int itemId = event.getIdentifier(); - - if (itemId == -1) - { - return; - } - - String option = event.getOption(); - ItemDefinition itemComposition = client.getItemDefinition(itemId); - - if (option.equals("Open") && itemComposition.getName().equals("Supply crate")) - { - eventType = WINTERTODT_EVENT; - takeInventorySnapshot(); - } - } - - private void saveLocalLootRecord(LootRecord lootRecord) - { - lootRecords.add(lootRecord); - addLootRecord(databaseManager.getDsl(), lootRecord); - } - - void deleteLocalRecords() - { - lootRecords.clear(); - DSLContext dslContext = databaseManager.getDsl(); - dslContext.delete(LOOTTRACKEREVENTS).execute(); - dslContext.delete(LOOTTRACKERLOOT).execute(); - dslContext.delete(LOOTTRACKERLINK).execute(); - } - - /** - * Takes a snapshot of the local player's inventory and equipment right before respawn. - */ - private void deathInventorySnapshot() - { - final ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); - final ItemContainer equipment = client.getItemContainer(InventoryID.EQUIPMENT); - inventorySnapshot = HashMultiset.create(); - if (inventory != null) - { - - Arrays.stream(inventory.getItems()) - .forEach(item -> inventorySnapshot.add(item.getId(), item.getQuantity())); - } - - if (equipment != null) - { - Arrays.stream(equipment.getItems()) - .forEach(item -> inventorySnapshot.add(item.getId(), item.getQuantity())); - } - } - - @Schedule( - period = 5, - unit = ChronoUnit.MINUTES, - asynchronous = true - ) - public void submitLootTask() - { - submitLoot(); - } - - private void submitLoot() - { - List copy; - synchronized (queuedLoots) - { - if (queuedLoots.isEmpty()) - { - return; - } - - copy = new ArrayList<>(queuedLoots); - queuedLoots.clear(); - } - - if (lootTrackerClient == null || !config.saveLoot()) - { - return; - } - - log.debug("Submitting {} loot records", copy.size()); - - lootTrackerClient.submit(copy); - } - - private void takeInventorySnapshot() - { - final ItemContainer itemContainer = client.getItemContainer(InventoryID.INVENTORY); - if (itemContainer != null) - { - inventorySnapshot = HashMultiset.create(); - Arrays.stream(itemContainer.getItems()) - .forEach(item -> inventorySnapshot.add(item.getId(), item.getQuantity())); - } - } - - private void processChestLoot(String chestType, ItemContainer inventoryContainer) - { - if (client.getLocalPlayer() == null) - { - return; - } - - if (inventorySnapshot != null) - { - Multiset currentInventory = HashMultiset.create(); - Arrays.stream(inventoryContainer.getItems()) - .forEach(item -> currentInventory.add(item.getId(), item.getQuantity())); - - final Multiset diff = Multisets.difference(currentInventory, inventorySnapshot); - - List items = diff.entrySet().stream() - .map(e -> new ItemStack(e.getElement(), e.getCount(), client.getLocalPlayer().getLocalLocation())) - .collect(Collectors.toList()); - - if (gotPet) - { - ItemStack pet = null; - switch (chestType) - { - case HERBIBOAR_EVENT: - pet = handlePet("Herbiboar"); - break; - case WINTERTODT_EVENT: - pet = handlePet("Wintertodt"); - break; - case GAUNTLET_EVENT: - pet = handlePet("Gauntlet"); - break; - } - - if (pet == null) - { - log.warn("Error finding pet for npc name: Herbiboar"); - } - else - { - items.add(pet); - } - } - - final LootTrackerItem[] entries = buildEntries(stack(items)); - SwingUtilities.invokeLater(() -> panel.add(chestType, client.getLocalPlayer().getName(), -1, entries)); - - LootRecord lootRecord = new LootRecord(chestType, client.getLocalPlayer().getName(), - LootRecordType.EVENT, toGameItems(items), Instant.now()); - if (config.saveLoot()) - { - synchronized (queuedLoots) - { - queuedLoots.add(lootRecord); - } - } - - if (config.localPersistence()) - { - saveLocalLootRecord(lootRecord); - } - - LTRecord record = new LTRecord(-1, chestType, -1, -1, convertToLTItemEntries(items)); - writer.addLootTrackerRecord(record); - - inventorySnapshot = null; - } - } - - void toggleItem(String name, boolean ignore) - { - final Set ignoredItemSet = new HashSet<>(ignoredItems); - - if (ignore) - { - ignoredItemSet.add(name); - } - else - { - ignoredItemSet.remove(name); - } - - config.setIgnoredItems(Text.toCSV(ignoredItemSet)); - this.getIgnoredItems = Text.toCSV(ignoredItemSet); - panel.updateIgnoredRecords(); - } - - boolean isIgnored(String name) - { - return ignoredItems.contains(name); - } - - /** - * Toggles the hidden status for a particular record - * - * @param name - The String name of the record to toggle the hidden status of - * @param ignore - true to ignore, false to remove - */ - void toggleNPC(String name, boolean ignore) - { - final Set ignoredNPCSet = new HashSet<>(ignoredNPCs); - if (ignore) - { - ignoredNPCSet.add(name); - } - else - { - ignoredNPCSet.remove(name); - } - - config.setIgnoredNPCs(Text.toCSV(ignoredNPCSet)); - panel.rebuild(); - } - - /** - * Checks to see if a record name is in the list of ignored NPCs - * - * @param name - The String of the name to check - * @return - true if it is being ignored, false otherwise - */ - boolean isIgnoredNPC(String name) - { - return ignoredNPCs.contains(name); - } - - @VisibleForTesting - private LootTrackerItem buildLootTrackerItem(int itemId, int quantity) - { - final ItemDefinition itemDefinition = itemManager.getItemDefinition(itemId); - final int realItemId = itemDefinition.getNote() != -1 ? itemDefinition.getLinkedNoteId() : itemId; - final long gePrice; - final long haPrice; - // If it's a death we want to get a coin value for untradeables lost - if (!itemDefinition.isTradeable() && quantity < 0) - { - gePrice = (long) itemDefinition.getPrice() * (long) quantity; - haPrice = (long) Math.round(itemDefinition.getPrice() * Constants.HIGH_ALCHEMY_MULTIPLIER) * (long) quantity; - } - else - { - gePrice = (long) itemManager.getItemPrice(realItemId) * (long) quantity; - haPrice = (long) Math.round(itemManager.getItemPrice(realItemId) * Constants.HIGH_ALCHEMY_MULTIPLIER) * (long) quantity; - } - final boolean ignored = ignoredItems.contains(itemDefinition.getName()); - - return new LootTrackerItem( - itemId, - itemDefinition.getName(), - quantity, - gePrice, - haPrice, - ignored); - } - - private LootTrackerItem[] buildEntries(final Collection itemStacks) - { - return itemStacks.stream() - .map(itemStack -> buildLootTrackerItem(itemStack.getId(), itemStack.getQuantity())) - .toArray(LootTrackerItem[]::new); - } - - private Collection convertToLootTrackerRecord(final Collection records) - { - return records.stream() - .sorted(Comparator.comparing(LootRecord::getTime)) - .map(record -> - { - LootTrackerItem[] drops = record.getDrops().stream().map(itemStack -> - buildLootTrackerItem(itemStack.getId(), itemStack.getQty()) - ).toArray(LootTrackerItem[]::new); - return new LootTrackerRecord(record.getEventId(), record.getUsername(), - "", drops, record.getTime()); - }) - .collect(Collectors.toCollection(ArrayList::new)); - } - - private Collection convertToLTItemEntries(Collection stacks) - { - return stacks.stream().map(i -> - { - final ItemDefinition c = itemManager.getItemDefinition(i.getId()); - final int id = c.getNote() == -1 ? c.getId() : c.getLinkedNoteId(); - final int price = itemManager.getItemPrice(id); - return new LTItemEntry(c.getName(), i.getId(), i.getQuantity(), price); - }).collect(Collectors.toList()); - } - - /** - * Is player at the Last Man Standing minigame - */ - private boolean isAtLMS() - { - final int[] mapRegions = client.getMapRegions(); - - for (int region : LAST_MAN_STANDING_REGIONS) - { - if (ArrayUtils.contains(mapRegions, region)) - { - return true; - } - } - - return false; - } - - // Pet Handling - private ItemStack handlePet(String name) - { - if (client.getLocalPlayer() == null) - { - return null; - } - - gotPet = false; - - int petID = getPetId(name); - if (petID == -1) - { - return null; - } - - return new ItemStack(petID, 1, client.getLocalPlayer().getLocalLocation()); - } - - private int getPetId(String name) - { - Pet pet = Pet.getByBossName(name); - if (pet != null) - { - return pet.getPetID(); - } - return -1; - } - - private void updateConfig() - { - this.getIgnoredItems = config.getIgnoredItems(); - this.saveLoot = config.saveLoot(); - this.chestLootChat = config.chestLootChat(); - this.syncPanel = config.syncPanel(); - this.localPersistence = config.localPersistence(); - this.sortType = config.sortType(); - this.whitelistEnabled = config.whitelistEnabled(); - this.getWhitelist = config.getWhitelist(); - this.blacklistEnabled = config.blacklistEnabled(); - this.getBlacklist = config.getBlacklist(); - this.sendLootValueMessages = config.sendLootValueMessages(); - } - - private void initDatabase() - { - boolean lootTrackerEvents = databaseManager.checkTableExists("LootTrackerEvents"); - boolean lootTrackerLoot = databaseManager.checkTableExists("LootTrackerLoot"); - boolean user = databaseManager.checkTableExists("User"); - boolean lootTrackerLink = databaseManager.checkTableExists("LootTrackerLink"); - - if (!lootTrackerEvents) - { - databaseManager.getDsl().createTable(LOOTTRACKEREVENTS) - .column(LOOTTRACKEREVENTS.UNIQUEID, SQLDataType.UUID.nullable(false)) - .column(LOOTTRACKEREVENTS.EVENTID, SQLDataType.VARCHAR.length(255).nullable(false)) - .column(LOOTTRACKEREVENTS.TYPE, SQLDataType.VARCHAR.length(255).nullable(false)) - .column(LOOTTRACKEREVENTS.TIME, SQLDataType.TIMESTAMP(0).nullable(false)) - .constraints( - constraint("PK_LOOTTRACKEREVENTS").primaryKey(LOOTTRACKEREVENTS.UNIQUEID) - ) - .execute(); - } - - if (!lootTrackerLoot) - { - databaseManager.getDsl().createTable(LOOTTRACKERLOOT) - .column(LOOTTRACKERLOOT.UNIQUEID, SQLDataType.UUID.nullable(false)) - .column(LOOTTRACKERLOOT.ITEMID, SQLDataType.INTEGER.nullable(false)) - .column(LOOTTRACKERLOOT.QUANTITY, SQLDataType.INTEGER.nullable(false)) - .constraints( - constraint("PK_LOOTTRACKERDROPS").primaryKey(LOOTTRACKERLOOT.UNIQUEID) - ) - .execute(); - } - - if (!user) - { - databaseManager.getDsl().createTable(USER) - .column(USER.UNIQUEID, SQLDataType.UUID.nullable(false)) - .column(USER.USERNAME, SQLDataType.VARCHAR(12).nullable(false)) - .constraints( - constraint("PK_USER").primaryKey(USER.UNIQUEID), - constraint("UN_USERNAME").unique(USER.USERNAME) - ) - .execute(); - } - - if (!lootTrackerLink) - { - databaseManager.getDsl().createTable(LOOTTRACKERLINK) - .column(LOOTTRACKERLINK.LINKUNIQUEID, SQLDataType.UUID.nullable(false)) - .column(LOOTTRACKERLINK.EVENTUNIQUEID, SQLDataType.UUID.nullable(false)) - .column(LOOTTRACKERLINK.DROPUNIQUEID, SQLDataType.UUID.nullable(false)) - .column(LOOTTRACKERLINK.USERUNIQUEID, SQLDataType.UUID.nullable(false)) - .constraints( - constraint("FK_LOOTTRACKEREVENT").foreignKey(LOOTTRACKERLINK.EVENTUNIQUEID).references(LOOTTRACKEREVENTS, LOOTTRACKEREVENTS.UNIQUEID).onDeleteCascade().onUpdateCascade(), - constraint("FK_LOOTTRACKERDROP").foreignKey(LOOTTRACKERLINK.DROPUNIQUEID).references(LOOTTRACKERLOOT, LOOTTRACKERLOOT.UNIQUEID).onDeleteCascade().onUpdateCascade(), - constraint("FK_USER").foreignKey(LOOTTRACKERLINK.USERUNIQUEID).references(USER, USER.UNIQUEID).onDeleteCascade().onUpdateCascade() - ) - .execute(); - } - - if (!lootTrackerEvents || !lootTrackerLoot || !lootTrackerLink || !user) - { - if (LOOT_RECORDS_FILE.exists()) - { - migrateData(); - } - } - } - - private void migrateData() - { - try - { - Collection lootRecords = new ArrayList<>(RuneLiteAPI.GSON.fromJson(new FileReader(LOOT_RECORDS_FILE), - new TypeToken>() - { - }.getType())); - - DSLContext dslContext = databaseManager.getDsl(); - - - for (LootRecord lootRecord : lootRecords) - { - addLootRecord(dslContext, lootRecord); - } - } - catch (FileNotFoundException e) - { - e.printStackTrace(); - } - } - - private void addLootRecord(DSLContext dslContext, LootRecord lootRecord) - { - String username = lootRecord.getUsername(); - userUuid(username); - - UUID eventUuid = UUID.randomUUID(); - dslContext - .insertInto( - LOOTTRACKEREVENTS, - LOOTTRACKEREVENTS.UNIQUEID, - LOOTTRACKEREVENTS.EVENTID, - LOOTTRACKEREVENTS.TYPE, - LOOTTRACKEREVENTS.TIME - ) - .values( - eventUuid, - lootRecord.getEventId(), - lootRecord.getType().toString(), - Timestamp.from(lootRecord.getTime()) - ) - .execute(); - - for (GameItem item : lootRecord.getDrops()) - { - UUID dropUuid = UUID.randomUUID(); - dslContext. - insertInto( - LOOTTRACKERLOOT, - LOOTTRACKERLOOT.UNIQUEID, - LOOTTRACKERLOOT.ITEMID, - LOOTTRACKERLOOT.QUANTITY - ) - .values( - dropUuid, - item.getId(), - item.getQty() - ) - .execute(); - - dslContext - .insertInto( - LOOTTRACKERLINK, - LOOTTRACKERLINK.LINKUNIQUEID, - LOOTTRACKERLINK.EVENTUNIQUEID, - LOOTTRACKERLINK.DROPUNIQUEID, - LOOTTRACKERLINK.USERUNIQUEID - ) - .values( - UUID.randomUUID(), - eventUuid, - dropUuid, - userUuidMap.get(username) - ) - .execute(); - } - } - - private void userUuid(String name) - { - if (userUuidMap.get(name) == null) - { - DSLContext dslContext = databaseManager.getDsl(); - - dslContext - .insertInto( - USER, - USER.UNIQUEID, - USER.USERNAME - ) - .values( - UUID.randomUUID(), - name - ) - .onConflict(USER.USERNAME) - .doNothing() - .execute(); - - Record1 user = dslContext - .select(USER.UNIQUEID) - .from(USER) - .where(USER.USERNAME.eq(name)) - .fetchOne(); - - userUuidMap.put(name, user.get(USER.UNIQUEID)); - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPriceType.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPriceType.java deleted file mode 100644 index c83c8c0c07..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPriceType.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.loottracker; - -public enum LootTrackerPriceType -{ - GRAND_EXCHANGE, - HIGH_ALCHEMY -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerRecord.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerRecord.java deleted file mode 100644 index cadec0680f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerRecord.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2018, Psikoi - * 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.loottracker; - -import com.google.gson.annotations.SerializedName; -import java.time.Instant; -import lombok.Value; - -@Value -class LootTrackerRecord -{ - private final String title; - private String localUsername; - private final String subTitle; - @SerializedName("item_records") - private final LootTrackerItem[] items; - private final Instant timestamp; - - /** - * Checks if this record matches specified id - * - * @param id other record id - * @return true if match is made - */ - boolean matches(final String id) - { - if (id == null) - { - return true; - } - - return title.equals(id); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/Pet.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/Pet.java deleted file mode 100644 index 2cd3809b1c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/Pet.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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.loottracker; - -import java.util.HashMap; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ItemID; - -@Getter(AccessLevel.PACKAGE) -public enum Pet -{ - // GWD Pets - PET_GENERAL_GRAARDOR(ItemID.PET_GENERAL_GRAARDOR, "General graador"), - PET_KREEARRA(ItemID.PET_KREEARRA, "Kree'arra"), - PET_KRIL_TSUTSAROTH(ItemID.PET_KRIL_TSUTSAROTH, "K'ril tsutsaroth"), - PET_ZILYANA(ItemID.PET_ZILYANA, "Commander zilyana"), - // Wildy Pets - CALLISTO_CUB(ItemID.CALLISTO_CUB, "Callisto"), - PET_CHAOS_ELEMENTAL(ItemID.PET_CHAOS_ELEMENTAL, "Chaos Elemental", "Chaos Fanatic"), - SCORPIAS_OFFSPRING(ItemID.SCORPIAS_OFFSPRING, "Scorpia"), - VENENATIS_SPIDERLING(ItemID.VENENATIS_SPIDERLING, "Venenatis"), - VETION_JR(ItemID.VETION_JR, "Vet'ion"), - // KBD isn't really in wildy but meh - PRINCE_BLACK_DRAGON(ItemID.PRINCE_BLACK_DRAGON, "King Black Dragon"), - // Slayer Pets - ABYSSAL_ORPHAN(ItemID.ABYSSAL_ORPHAN, "Abyssal Sire"), - HELLPUPPY(ItemID.HELLPUPPY, "Cerberus"), - NOON(ItemID.NOON, "Noon", "Dusk"), - PET_KRAKEN(ItemID.PET_KRAKEN, "Kraken"), - PET_SMOKE_DEVIL(ItemID.PET_SMOKE_DEVIL, "Thermonuclear Smoke Devil"), - SKOTOS(ItemID.SKOTOS, "Skotizo"), - // Other Bosses - BABY_MOLE(ItemID.BABY_MOLE, "Giant Mole"), - KALPHITE_PRINCESS(ItemID.KALPHITE_PRINCESS, "Kalphite Queen"), - OLMLET(ItemID.OLMLET, "Chambers of Xeric"), - LIL_ZIK(ItemID.LIL_ZIK, "Theatre of Blood"), - PET_DARK_CORE(ItemID.PET_DARK_CORE, "Corporeal Beast"), - PET_SNAKELING(ItemID.PET_SNAKELING, "Zulrah"), - PET_DAGANNOTH_REX(ItemID.PET_DAGANNOTH_REX, "Dagannoth Rex"), - PET_DAGANNOTH_PRIME(ItemID.PET_DAGANNOTH_PRIME, "Dagannoth Prime"), - PET_DAGANNOTH_SUPREME(ItemID.PET_DAGANNOTH_SUPREME, "Dagannoth Supreme"), - VORKI(ItemID.VORKI, "Vorkath"), - BLOODHOUND(ItemID.BLOODHOUND, "Clue Scroll (Master)"), - HERBI(ItemID.HERBI, "Herbiboar"), - IKKLE_HYDRA(ItemID.IKKLE_HYDRA, "Alchemical Hydra"), - PHOENIX(ItemID.PHOENIX, "Wintertodt"), - YOUNGLLEF(ItemID.YOUNGLLEF, "Gauntlet"), - SRARACHA(ItemID.SRARACHA, "Sraracha"); - - private final int petID; - private final String[] bossNames; - private static final Map byBossName = buildBossMap(); - - Pet(int id, String... bossNames) - { - this.petID = id; - this.bossNames = bossNames; - } - - public static Pet getByBossName(String name) - { - return byBossName.get(name.toUpperCase()); - } - - private static Map buildBossMap() - { - Map byName = new HashMap<>(); - for (Pet pet : values()) - { - String[] droppingBosses = pet.getBossNames(); - for (String bossName : droppingBosses) - { - byName.put(bossName.toUpperCase(), pet); - } - } - return byName; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/localstorage/LTItemEntry.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/localstorage/LTItemEntry.java deleted file mode 100644 index 8fac07f376..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/localstorage/LTItemEntry.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.loottracker.localstorage; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class LTItemEntry -{ - private final String name; - private final int id; - private int quantity; - private long price; - - public long getTotal() - { - return this.quantity * this.price; - } - - public static Map consolidateItemEntires(final Collection drops) - { - // Store LootTrackerItemEntry by ItemID - final Map itemMap = new HashMap<>(); - for (final LTItemEntry e : drops) - { - final LTItemEntry oldEntry = itemMap.get(e.getId()); - if (oldEntry != null) - { - // Use the most recent price - oldEntry.setPrice(e.getPrice()); - oldEntry.setQuantity(oldEntry.getQuantity() + e.getQuantity()); - } - else - { - // Create a new instance for consolidated records - itemMap.put(e.getId(), new LTItemEntry(e.getName(), e.getId(), e.getQuantity(), e.getPrice())); - } - } - - return itemMap; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/localstorage/LTRecord.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/localstorage/LTRecord.java deleted file mode 100644 index da6518593b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/localstorage/LTRecord.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.loottracker.localstorage; - -import java.util.ArrayList; -import java.util.Collection; -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class LTRecord -{ - private final int id; - private final String name; - private final int level; - private final int killCount; - final Collection drops; - - public void addDropEntry(LTItemEntry itemEntry) - { - drops.add(itemEntry); - } - - public static Collection consolidateLTItemEntries(final Collection records) - { - final Collection recordEntries = new ArrayList<>(); - for (final LTRecord r : records) - { - recordEntries.addAll(r.getDrops()); - } - return recordEntries; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/localstorage/LootRecordWriter.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/localstorage/LootRecordWriter.java deleted file mode 100644 index e5b3faabd9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/localstorage/LootRecordWriter.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * 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.loottracker.localstorage; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import static net.runelite.client.RuneLite.RUNELITE_DIR; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.plugins.loottracker.localstorage.events.LTNameChange; -import net.runelite.client.plugins.loottracker.localstorage.events.LTRecordStored; -import net.runelite.http.api.RuneLiteAPI; - -@Slf4j -@Singleton -public class LootRecordWriter -{ - private static final String FILE_EXTENSION = ".log"; - private static final File LOOT_RECORD_DIR = new File(RUNELITE_DIR, "loots"); - - private final EventBus bus; - - // Data is stored in a folder with the players in-game username - private File playerFolder = LOOT_RECORD_DIR; - private String name; - - @Inject - public LootRecordWriter(EventBus bus) - { - this.bus = bus; - LOOT_RECORD_DIR.mkdir(); - } - - private static String npcNameToFileName(final String npcName) - { - return npcName.toLowerCase().trim() + FILE_EXTENSION; - } - - public void setPlayerUsername(final String username) - { - if (username.equalsIgnoreCase(name)) - { - return; - } - - playerFolder = new File(LOOT_RECORD_DIR, username); - playerFolder.mkdir(); - name = username; - bus.post(LTNameChange.class, new LTNameChange()); - } - - public Set getKnownFileNames() - { - final Set fileNames = new HashSet<>(); - - final File[] files = playerFolder.listFiles((dir, name) -> name.endsWith(FILE_EXTENSION)); - if (files != null) - { - for (final File f : files) - { - fileNames.add(f.getName().replace(FILE_EXTENSION, "")); - } - } - - return fileNames; - } - - public synchronized Collection loadLootTrackerRecords(String npcName) - { - final String fileName = npcNameToFileName(npcName); - final File file = new File(playerFolder, fileName); - final Collection data = new ArrayList<>(); - - StringBuilder sb = new StringBuilder(); - - try (final BufferedReader br = new BufferedReader(new FileReader(file))) - { - // read line by line - String line; - int totalBrackets = 0; - while ((line = br.readLine()) != null) - { - if (line.contains("{")) - { - totalBrackets++; - } - if (line.contains("}")) - { - totalBrackets--; - } - sb.append(line); - - if (totalBrackets == 0 && sb.length() > 0) - { - final LTRecord r = RuneLiteAPI.GSON.fromJson(sb.toString(), LTRecord.class); - data.add(r); - sb.setLength(0); - } - } - } - catch (FileNotFoundException e) - { - log.debug("File not found: {}", fileName); - } - catch (IOException e) - { - log.warn("IOException for file {}: {}", fileName, e.getMessage()); - } - - return data; - } - - public synchronized boolean addLootTrackerRecord(LTRecord rec) - { - // Grab file - final String fileName = npcNameToFileName(rec.getName()); - final File lootFile = new File(playerFolder, fileName); - - // Convert entry to JSON - final String dataAsString = RuneLiteAPI.GSON.toJson(rec); - - // Open File in append mode and write new data - try - { - final BufferedWriter file = new BufferedWriter(new FileWriter(String.valueOf(lootFile), true)); - file.append(dataAsString); - file.newLine(); - file.close(); - bus.post(LTRecordStored.class, new LTRecordStored(rec)); - return true; - } - catch (IOException ioe) - { - log.warn("Error writing loot data to file {}: {}", fileName, ioe.getMessage()); - return false; - } - } - - // Mostly used to adjust previous loot entries such as adding pet drops/abyssal sire drops - public synchronized boolean writeLootTrackerFile(String npcName, Collection loots) - { - final String fileName = npcNameToFileName(npcName); - final File lootFile = new File(playerFolder, fileName); - - try - { - final BufferedWriter file = new BufferedWriter(new FileWriter(String.valueOf(lootFile), false)); - for (final LTRecord rec : loots) - { - // Convert entry to JSON - final String dataAsString = RuneLiteAPI.GSON.toJson(rec); - file.append(dataAsString); - file.newLine(); - } - file.close(); - - return true; - } - catch (IOException ioe) - { - log.warn("Error rewriting loot data to file {}: {}", fileName, ioe.getMessage()); - return false; - } - } - - public synchronized boolean deleteLootTrackerRecords(String npcName) - { - final String fileName = npcNameToFileName(npcName); - final File lootFile = new File(playerFolder, fileName); - - if (lootFile.delete()) - { - log.debug("Deleted loot file: {}", fileName); - return true; - } - else - { - log.debug("Couldn't delete file: {}", fileName); - return false; - } - } - - public Collection loadAllLootTrackerRecords() - { - final List recs = new ArrayList<>(); - - for (final String n : getKnownFileNames()) - { - recs.addAll(loadLootTrackerRecords(n)); - } - - return recs; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/localstorage/events/LTNameChange.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/localstorage/events/LTNameChange.java deleted file mode 100644 index 04a7f348da..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/localstorage/events/LTNameChange.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.loottracker.localstorage.events; - -import net.runelite.api.events.Event; - -public class LTNameChange implements Event {} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/localstorage/events/LTRecordStored.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/localstorage/events/LTRecordStored.java deleted file mode 100644 index 098b497ad6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/localstorage/events/LTRecordStored.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.loottracker.localstorage.events; - -import lombok.Data; -import net.runelite.api.events.Event; -import net.runelite.client.plugins.loottracker.localstorage.LTRecord; - -@Data -public class LTRecordStored implements Event -{ - private final LTRecord record; -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/lowmemory/LowMemoryPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/lowmemory/LowMemoryPlugin.java deleted file mode 100644 index 63ee2ca8b2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/lowmemory/LowMemoryPlugin.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.lowmemory; - -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.events.GameStateChanged; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Low Detail", - description = "Turn off ground decorations and certain textures, reducing memory usage", - tags = {"memory", "usage", "ground", "decorations"}, - enabledByDefault = false, - type = PluginType.MISCELLANEOUS -) -public class LowMemoryPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private EventBus eventBus; - - @Override - protected void startUp() - { - this.eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged); - - if (client.getGameState() == GameState.LOGGED_IN) - { - clientThread.invoke(() -> client.changeMemoryMode(true)); - } - } - - @Override - protected void shutDown() - { - clientThread.invoke(() -> client.changeMemoryMode(false)); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - // When the client starts it initializes the texture size based on the memory mode setting. - // Don't set low memory before the login screen is ready to prevent loading the low detail textures, - // which breaks the gpu plugin due to it requiring the 128x128px textures - if (event.getGameState() == GameState.LOGIN_SCREEN) - { - client.changeMemoryMode(true); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/MaxHitPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/MaxHitPlugin.java deleted file mode 100644 index b8ba770460..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/MaxHitPlugin.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit; - -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.maxhit.calculators.MagicMaxHitCalculator; -import net.runelite.client.plugins.maxhit.calculators.MeleeMaxHitCalculator; -import net.runelite.client.plugins.maxhit.calculators.RangeMaxHitCalculator; - -@PluginDescriptor( - name = "Max Hit", - description = "Adds the max hit of the equipped weapon to the equipment and stats widget", - type = PluginType.UTILITY, - enabledByDefault = false -) -@Singleton -public class MaxHitPlugin extends Plugin -{ - - @Inject - private Client client; - - @Subscribe - private void onItemContainerChanged(final ItemContainerChanged event) - { - this.updateMaxHitWidget(); - } - - @Subscribe - private void onVarbitChanged(VarbitChanged event) - { - this.updateMaxHitWidget(); - } - - private void updateMaxHitWidget() - { - Widget equipmentStats = client.getWidget(WidgetInfo.EQUIPMENT_INVENTORY_ITEMS_CONTAINER); - - ItemContainer equipmentContainer = client.getItemContainer(InventoryID.EQUIPMENT); - Item[] equipedItems = new Item[14]; - - if (equipmentStats != null && !equipmentStats.isHidden()) - { - if (equipmentContainer != null) - { - equipedItems = equipmentContainer.getItems(); - } - - MeleeMaxHitCalculator meleeMaxHitCalculator = new MeleeMaxHitCalculator(this.client, equipedItems); - RangeMaxHitCalculator rangeMaxHitCalculator = new RangeMaxHitCalculator(this.client, equipedItems); - MagicMaxHitCalculator magicMaxHitCalculator = new MagicMaxHitCalculator(this.client, equipedItems); - - MaxHit maxHit = new MaxHit(meleeMaxHitCalculator.getMaxHit(), rangeMaxHitCalculator.getMaxHit(), magicMaxHitCalculator.getMaxHit()); - this.setWidgetMaxHit(maxHit); - } - } - - private void setWidgetMaxHit(MaxHit maxhit) - { - Widget equipYourCharacter = client.getWidget(WidgetInfo.EQUIP_YOUR_CHARACTER); - String maxHitText = "Melee Max Hit: " + maxhit.getMaxMeleeHit(); - maxHitText += "
Range Max Hit: " + maxhit.getMaxRangeHit(); - maxHitText += "
Magic Max Hit: " + maxhit.getMaxMagicHit(); - - - equipYourCharacter.setText(maxHitText); - } - - private static class MaxHit - { - private final double maxMeleeHit; - private final double maxRangeHit; - private final double maxMagicHit; - - MaxHit(double maxMeleeHit, double maxRangeHit, double maxMagicHit) - { - this.maxMeleeHit = maxMeleeHit; - this.maxRangeHit = maxRangeHit; - this.maxMagicHit = maxMagicHit; - } - - double getMaxMeleeHit() - { - return maxMeleeHit; - } - - double getMaxRangeHit() - { - return maxRangeHit; - } - - double getMaxMagicHit() - { - return maxMagicHit; - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/attackstyle/AttackStyle.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/attackstyle/AttackStyle.java deleted file mode 100644 index e9e9d9b18d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/attackstyle/AttackStyle.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.attackstyle; - -public enum AttackStyle -{ - ACCURATE(0), - AGGRESSIVE(3), - DEFENSIVE(0), - CONTROLLED(1), - ACCURATERANGING(3), - RANGING(0), - LONGRANGE(0), - CASTING(0), - DEFENSIVE_CASTING(0), - OTHER(0); - - private final int maxHitBonus; - - AttackStyle(int maxHitBonus) - { - this.maxHitBonus = maxHitBonus; - } - - public double getMaxHitBonus() - { - return this.maxHitBonus; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/attackstyle/WeaponType.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/attackstyle/WeaponType.java deleted file mode 100644 index 2858c6ee99..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/attackstyle/WeaponType.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.attackstyle; - -import java.util.HashMap; -import java.util.Map; -import static net.runelite.client.plugins.maxhit.attackstyle.AttackStyle.*; - -public enum WeaponType -{ - TYPE_0(ACCURATE, AGGRESSIVE, null, DEFENSIVE), - TYPE_1(ACCURATE, AGGRESSIVE, AGGRESSIVE, DEFENSIVE), - TYPE_2(ACCURATE, AGGRESSIVE, null, DEFENSIVE), - TYPE_3(ACCURATERANGING, RANGING, null, LONGRANGE), - TYPE_4(ACCURATE, AGGRESSIVE, CONTROLLED, DEFENSIVE), - TYPE_5(ACCURATERANGING, RANGING, null, LONGRANGE), - TYPE_6(AGGRESSIVE, RANGING, DEFENSIVE_CASTING, null), - TYPE_7(ACCURATERANGING, RANGING, null, LONGRANGE), - TYPE_8(OTHER, AGGRESSIVE, null, null), - TYPE_9(ACCURATE, AGGRESSIVE, CONTROLLED, DEFENSIVE), - TYPE_10(ACCURATE, AGGRESSIVE, AGGRESSIVE, DEFENSIVE), - TYPE_11(ACCURATE, AGGRESSIVE, AGGRESSIVE, DEFENSIVE), - TYPE_12(CONTROLLED, AGGRESSIVE, null, DEFENSIVE), - TYPE_13(ACCURATE, AGGRESSIVE, null, DEFENSIVE), - TYPE_14(ACCURATE, AGGRESSIVE, AGGRESSIVE, DEFENSIVE), - TYPE_15(CONTROLLED, CONTROLLED, CONTROLLED, DEFENSIVE), - TYPE_16(ACCURATE, AGGRESSIVE, CONTROLLED, DEFENSIVE), - TYPE_17(ACCURATE, AGGRESSIVE, AGGRESSIVE, DEFENSIVE), - TYPE_18(ACCURATE, AGGRESSIVE, null, DEFENSIVE, CASTING, DEFENSIVE_CASTING), - TYPE_19(ACCURATERANGING, RANGING, null, LONGRANGE), - TYPE_20(ACCURATE, CONTROLLED, null, DEFENSIVE), - TYPE_21(ACCURATE, AGGRESSIVE, null, DEFENSIVE, CASTING, DEFENSIVE_CASTING), - TYPE_22(ACCURATE, AGGRESSIVE, AGGRESSIVE, DEFENSIVE), - TYPE_23(CASTING, CASTING, null, DEFENSIVE_CASTING), - TYPE_24(ACCURATE, AGGRESSIVE, CONTROLLED, DEFENSIVE), - TYPE_25(CONTROLLED, AGGRESSIVE, null, DEFENSIVE), - TYPE_26(AGGRESSIVE, AGGRESSIVE, null, AGGRESSIVE), - TYPE_27(ACCURATE, null, null, OTHER); - - private static final Map weaponTypes = new HashMap<>(); - - static - { - for (WeaponType weaponType : values()) - { - weaponTypes.put(weaponType.ordinal(), weaponType); - } - } - - private final AttackStyle[] attackStyles; - - WeaponType(AttackStyle... attackStyles) - { - this.attackStyles = attackStyles; - } - - public static WeaponType getWeaponType(int id) - { - return weaponTypes.get(id); - } - - public AttackStyle[] getAttackStyles() - { - return attackStyles; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/calculators/MagicMaxHitCalculator.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/calculators/MagicMaxHitCalculator.java deleted file mode 100644 index c4b04eb4c3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/calculators/MagicMaxHitCalculator.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.calculators; - -import net.runelite.api.Client; -import net.runelite.api.Item; -import net.runelite.api.Skill; -import net.runelite.api.Varbits; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.plugins.maxhit.config.EquipmentBonusConfig; -import net.runelite.client.plugins.maxhit.config.SpellBaseDamageConfig; - -public class MagicMaxHitCalculator extends MaxHitCalculator -{ - - public MagicMaxHitCalculator(Client client, Item[] equipedItems) - { - super(client, CombatMethod.MAGIC, equipedItems); - } - - @Override - protected String getSkillStrengthText(String equipmentText) - { - return equipmentText.replace("Magic damage: ", "").replace(".", "").replace("%", ""); - } - - @Override - Widget equipmentSkillPower() - { - return this.client.getWidget(WidgetInfo.EQUIPMENT_MAGIC_DAMAGE); - } - - @Override - public double getCurrentSkillPower() - { - return this.client.getBoostedSkillLevel(Skill.MAGIC); - } - - /* - * Damage formula based on: - * http://services.runescape.com/m=forum/forums.ws?317,318,712,65587452 - * Section 4. - * */ - @Override - public double calculate() - { - int spellBaseDamage = this.baseDamage; - - if (spellBaseDamage == 0) - { - int autoCastSpellId = client.getVar(Varbits.AUTO_CAST_SPELL); - if (autoCastSpellId == 0) - { - return 0.0; - } - - SpellBaseDamageConfig autoCastSpell = SpellBaseDamageConfig.findSpellById(autoCastSpellId); - if (autoCastSpell == null) - { - return 0.0; - } - spellBaseDamage = autoCastSpell.getBaseDamage(); - } - -// a.Find the base maximum damage a spell can deal. -// See CustomFormulaConfig for spells based on magic lvl - double maxHit = spellBaseDamage; - -// b. Increase the base damage (Chaos Gauntlets) - maxHit = this.applyEquipmentBonus(maxHit, EquipmentBonusConfig.BonusType.SPECIAL); - -// c. The following bonuses stack by adding up. (List of bonus items) - maxHit = this.applyEquipmentBonus(maxHit, EquipmentBonusConfig.BonusType.EQUIPMENT); - -// d. Round down to the nearest integer. - maxHit = Math.floor(maxHit); - -// e. On a slayer task, multiply by 1.15 (imbued) - maxHit = this.applyEquipmentBonus(maxHit, EquipmentBonusConfig.BonusType.SLAYER); - -// f. Round down to the nearest integer. - maxHit = Math.floor(maxHit); - -// g. If a fire spell is used, multiply by 1.5 (Tome of fire) - maxHit = this.applyEquipmentBonus(maxHit, EquipmentBonusConfig.BonusType.MAGIC_SPECIAL); - -// h. Round down to the nearest integer. - maxHit = Math.floor(maxHit); - -// i, j. Castle Wars will not be included - return maxHit; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/calculators/MaxHitCalculator.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/calculators/MaxHitCalculator.java deleted file mode 100644 index ce0e468770..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/calculators/MaxHitCalculator.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.calculators; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.BiFunction; -import net.runelite.api.Client; -import net.runelite.api.Item; -import net.runelite.api.VarPlayer; -import net.runelite.api.Varbits; -import net.runelite.api.widgets.Widget; -import net.runelite.client.plugins.maxhit.attackstyle.AttackStyle; -import net.runelite.client.plugins.maxhit.attackstyle.WeaponType; -import net.runelite.client.plugins.maxhit.config.CustomFormulaConfig; -import net.runelite.client.plugins.maxhit.config.EquipmentBonusConfig; -import net.runelite.client.plugins.maxhit.config.PrayerBonusConfig; -import net.runelite.client.plugins.maxhit.equipment.EquipmentHelper; -import net.runelite.client.plugins.maxhit.equipment.EquipmentItemset; - -public abstract class MaxHitCalculator -{ - - final Client client; - private final CombatMethod combatMethod; - private final Item[] equipedItems; - int baseDamage = 0; - - MaxHitCalculator(Client client, CombatMethod combatMethod, Item[] equipedItems) - { - this.client = client; - this.combatMethod = combatMethod; - this.equipedItems = equipedItems; - } - - protected abstract String getSkillStrengthText(String equipmentText); - - abstract Widget equipmentSkillPower(); - - public abstract double getCurrentSkillPower(); - - AttackStyle getAttackStyle() - { - int equippedWeaponTypeId = client.getVar(Varbits.EQUIPPED_WEAPON_TYPE); - int attackStyleId = client.getVar(VarPlayer.ATTACK_STYLE); - - AttackStyle[] attackStyles = WeaponType.getWeaponType(equippedWeaponTypeId).getAttackStyles(); - - if (attackStyleId < attackStyles.length) - { - AttackStyle attackStyle = attackStyles[attackStyleId]; - if (attackStyle != null) - { - return attackStyle; - } - } - - return AttackStyle.OTHER; - } - - double getPrayerBonus() - { - double bonus = 1; - for (PrayerBonusConfig prayerBonus : PrayerBonusConfig.values()) - { - boolean prayerActive = client.getVar(prayerBonus.getPrayerVarbit()) == 1; - boolean sameCombatMethod = prayerBonus.getCombatMethod() == this.combatMethod; - if (prayerActive && sameCombatMethod) - { - bonus += prayerBonus.getStrengthBonus(); - } - } - return bonus; - } - - double applyEquipmentBonus(double maxhit, EquipmentBonusConfig.BonusType bonusType) - { - double bonus = 1; - List addList = new ArrayList<>(); - - List equipmentBonuses = EquipmentBonusConfig.getBonusByType(bonusType); - - for (EquipmentBonusConfig equipmentBonus : equipmentBonuses) - { - EquipmentItemset itemSet = equipmentBonus.getItemset(); - boolean wearsSet = EquipmentHelper.wearsItemSet(this.equipedItems, itemSet); - if (wearsSet && equipmentBonus.meetsRequirements(this.client)) - { - if (equipmentBonus.getOperation() == EquipmentBonusConfig.Operation.MULTIPLY) - { - bonus += equipmentBonus.getBonus(this.combatMethod); - } - else if (equipmentBonus.getOperation() == EquipmentBonusConfig.Operation.ADD) - { - addList.add(equipmentBonus.getBonus(this.combatMethod)); - } - } - } - - maxhit *= bonus; - - maxhit = maxhit + addList.stream().reduce(0.0, Double::sum); - - return maxhit; - } - - public double getMaxHit() - { - BiFunction customFormula = this.getCustomFormula(); - if (customFormula != null) - { - return customFormula.apply(this.client, this); - } - - return this.calculate(); - } - - private BiFunction getCustomFormula() - { - for (CustomFormulaConfig customFormula : CustomFormulaConfig.values()) - { - if (this.combatMethod != customFormula.getRequiredCombatMethod()) - { - continue; - } - - boolean meetsRequirements = customFormula.getRequirements().stream().allMatch(requirement -> requirement.meetsRequirements(this.client)); - - if (meetsRequirements) - { - return customFormula.getCustomFormula(); - } - } - - return null; - } - - public abstract double calculate(); - - public void setBaseDamage(int baseDamage) - { - this.baseDamage = baseDamage; - } - - double getSkillStrength() - { - return Double.parseDouble(this.getSkillStrengthText(this.equipmentSkillPower().getText())); - } - - public enum CombatMethod - { - MELEE, - RANGE, - MAGIC - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/calculators/MeleeMaxHitCalculator.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/calculators/MeleeMaxHitCalculator.java deleted file mode 100644 index d3f6d78a0b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/calculators/MeleeMaxHitCalculator.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.calculators; - -import net.runelite.api.Client; -import net.runelite.api.Item; -import net.runelite.api.Skill; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.plugins.maxhit.attackstyle.AttackStyle; -import net.runelite.client.plugins.maxhit.config.EquipmentBonusConfig; - -public class MeleeMaxHitCalculator extends MaxHitCalculator -{ - - public MeleeMaxHitCalculator(Client client, Item[] equipedItems) - { - super(client, CombatMethod.MELEE, equipedItems); - } - - MeleeMaxHitCalculator(Client client, CombatMethod combatMethod, Item[] equipedItems) - { - super(client, combatMethod, equipedItems); - } - - @Override - protected String getSkillStrengthText(String equipmentText) - { - return equipmentText.replace("Melee strength: ", ""); - } - - @Override - public Widget equipmentSkillPower() - { - return this.client.getWidget(WidgetInfo.EQUIPMENT_MELEE_STRENGTH); - } - - @Override - public double getCurrentSkillPower() - { - return this.client.getBoostedSkillLevel(Skill.STRENGTH); - } - - private double getEffectiveLevel() - { -// a. Take the visible strength or ranged level from the skills interface. - double skillPower = this.getCurrentSkillPower(); - -// b. Multiply the level by the prayer adjustment - double effectiveLevel = skillPower * this.getPrayerBonus(); - -// c. Round down to the nearest integer. - effectiveLevel = Math.floor(effectiveLevel); - -// d. Add the stance bonus from the combat options interface. -// Melee: -// • Aggressive: +3 -// • Controlled: +1 -// Ranged: -// * Accurate: +3 - AttackStyle attackStyle = this.getAttackStyle(); - effectiveLevel += attackStyle.getMaxHitBonus(); - -// e. Add up +8. - effectiveLevel += 8; - -// f. Multiply by the void bonus: -// • Void melee: multiply by 1.10. Round down. -// • Void ranged: multiply by 1.10. Round down. -// • Elite void ranged: multiply by 1.125. Round down. - effectiveLevel = this.applyEquipmentBonus(effectiveLevel, EquipmentBonusConfig.BonusType.VOID_KNIGHT); - -// g. This is the effective (ranged) strength level. Let this equal 'A' in the formula in - return effectiveLevel; - } - - // 3.3 Take the melee or ranged strength bonus from the equipment stats interface and let this equal 'B' in the formula in 3.1. - private double getEquipmentBonus() - { - return this.getSkillStrength(); - } - - /* - * Damage formula based on: - * http://services.runescape.com/m=forum/forums.ws?317,318,712,65587452 - * Section 3.1 - * */ - @Override - public double calculate() - { - -// a. Max hit = 0.5 + A * (B+64) /640 (A is effective level, B is Equipment bonus) - double maxHit = 0.5 + this.getEffectiveLevel() * (this.getEquipmentBonus() + 64) / 640; - -// b. Round down the max hit to the nearest integer. - maxHit = Math.floor(maxHit); - -// 3.4 Special attacks (not actually taking weapon special attacks into account) -// a. Multiply by the bonus of one of the following items (slayer) - maxHit = this.applyEquipmentBonus(maxHit, EquipmentBonusConfig.BonusType.SLAYER); - -// b. Round down the max hit to the nearest integer. - maxHit = Math.floor(maxHit); - -// c. Multiply by the bonus of one of the following items - maxHit = this.applyEquipmentBonus(maxHit, EquipmentBonusConfig.BonusType.SPECIAL); - -// d. Round down to the nearest integer. - maxHit = Math.floor(maxHit); - - return maxHit; - } -} - - diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/calculators/RangeMaxHitCalculator.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/calculators/RangeMaxHitCalculator.java deleted file mode 100644 index 0b397e76d5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/calculators/RangeMaxHitCalculator.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.calculators; - -import net.runelite.api.Client; -import net.runelite.api.Item; -import net.runelite.api.Skill; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; - -public class RangeMaxHitCalculator extends MeleeMaxHitCalculator -{ - - public RangeMaxHitCalculator(Client client, Item[] equipedItems) - { - super(client, CombatMethod.RANGE, equipedItems); - } - - @Override - protected String getSkillStrengthText(String equipmentText) - { - return equipmentText.replace("Ranged strength: ", "").replace(".", "").replace("%", ""); - } - - @Override - public Widget equipmentSkillPower() - { - return this.client.getWidget(WidgetInfo.EQUIPMENT_RANGED_STRENGTH); - } - - @Override - public double getCurrentSkillPower() - { - return this.client.getBoostedSkillLevel(Skill.RANGED); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/config/CustomFormulaConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/config/CustomFormulaConfig.java deleted file mode 100644 index 3e51821336..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/config/CustomFormulaConfig.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.config; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.function.BiFunction; -import net.runelite.api.Client; -import net.runelite.api.EquipmentInventorySlot; -import net.runelite.api.ItemID; -import net.runelite.api.Skill; -import net.runelite.client.plugins.maxhit.calculators.MaxHitCalculator; -import net.runelite.client.plugins.maxhit.equipment.EquipmentItemset; -import net.runelite.client.plugins.maxhit.equipment.EquipmentSlotItem; -import net.runelite.client.plugins.maxhit.requirements.EquipmentItemRequirement; -import net.runelite.client.plugins.maxhit.requirements.EquipmentItemSetRequirement; -import net.runelite.client.plugins.maxhit.requirements.Requirement; -import net.runelite.client.plugins.maxhit.requirements.SpellRequirement; - -public enum CustomFormulaConfig -{ - - MAGIC_DART( - MaxHitCalculator.CombatMethod.MAGIC, - new ArrayList<>(Arrays.asList( - new EquipmentItemRequirement(new EquipmentSlotItem(EquipmentInventorySlot.WEAPON, new ArrayList<>(Arrays.asList( - ItemID.SLAYERS_STAFF, - ItemID.SLAYERS_STAFF_E - )))), - new SpellRequirement(SpellBaseDamageConfig.MAGIC_DART) - )), - (client, calculator) -> - { - int magicLevel = client.getBoostedSkillLevel(Skill.MAGIC); - return Math.floor((magicLevel / 10.0) + 10.0); - } - ), - - TRIDENT_OF_SEAS( - MaxHitCalculator.CombatMethod.MAGIC, - new ArrayList<>(Collections.singletonList( - new EquipmentItemRequirement(new EquipmentSlotItem(EquipmentInventorySlot.WEAPON, new ArrayList<>(Arrays.asList( - ItemID.TRIDENT_OF_THE_SEAS_FULL, - ItemID.TRIDENT_OF_THE_SEAS, - ItemID.TRIDENT_OF_THE_SEAS_E - )))) - )), - (client, calculator) -> - { - int magicLevel = client.getBoostedSkillLevel(Skill.MAGIC); - - int baseDamage = (int) Math.floor(magicLevel / 3.0) - 5; - calculator.setBaseDamage(baseDamage); - - return calculator.calculate(); - } - ), - - TRIDENT_OF_SWAMP( - MaxHitCalculator.CombatMethod.MAGIC, - new ArrayList<>(Collections.singletonList( - new EquipmentItemRequirement(new EquipmentSlotItem(EquipmentInventorySlot.WEAPON, new ArrayList<>(Arrays.asList( - ItemID.TRIDENT_OF_THE_SWAMP, - ItemID.TRIDENT_OF_THE_SWAMP_E - )))) - )), - (client, calculator) -> - { - int magicLevel = client.getBoostedSkillLevel(Skill.MAGIC); - - int baseDamage = (int) Math.floor(magicLevel / 3.0) - 2; - calculator.setBaseDamage(baseDamage); - - return calculator.calculate(); - } - ), - - SWAMP_LIZARD( - MaxHitCalculator.CombatMethod.MAGIC, - new ArrayList<>(Collections.singletonList( - new EquipmentItemRequirement(new EquipmentSlotItem(EquipmentInventorySlot.WEAPON, new ArrayList<>(Collections.singletonList( - ItemID.SWAMP_LIZARD - )))) - )), - (client, calculator) -> - { - int magicLevel = client.getBoostedSkillLevel(Skill.MAGIC); - return Math.floor(0.5 + magicLevel * (64.0 + 56.0) / 640.0); - } - ), - - ORANGE_SALAMANDER( - MaxHitCalculator.CombatMethod.MAGIC, - new ArrayList<>(Collections.singletonList( - new EquipmentItemRequirement(new EquipmentSlotItem(EquipmentInventorySlot.WEAPON, new ArrayList<>(Collections.singletonList( - ItemID.ORANGE_SALAMANDER - )))) - )), - (client, calculator) -> - { - int magicLevel = client.getBoostedSkillLevel(Skill.MAGIC); - return Math.floor(0.5 + magicLevel * (64.0 + 59.0) / 640.0); - } - ), - - RED_SALAMANDER( - MaxHitCalculator.CombatMethod.MAGIC, - new ArrayList<>(Collections.singletonList( - new EquipmentItemRequirement(new EquipmentSlotItem(EquipmentInventorySlot.WEAPON, new ArrayList<>(Collections.singletonList( - ItemID.RED_SALAMANDER - )))) - )), - (client, calculator) -> - { - int magicLevel = client.getBoostedSkillLevel(Skill.MAGIC); - return Math.floor(0.5 + magicLevel * (64.0 + 77.0) / 640.0); - } - ), - - BLACK_SALAMANDER( - MaxHitCalculator.CombatMethod.MAGIC, - new ArrayList<>(Collections.singletonList( - new EquipmentItemRequirement(new EquipmentSlotItem(EquipmentInventorySlot.WEAPON, new ArrayList<>(Collections.singletonList( - ItemID.BLACK_SALAMANDER - )))) - )), - (client, calculator) -> - { - int magicLevel = client.getBoostedSkillLevel(Skill.MAGIC); - return Math.floor(0.5 + magicLevel * (64.0 + 92.0) / 640.0); - } - ), - - DHAROK( - MaxHitCalculator.CombatMethod.MELEE, - new ArrayList<>(Collections.singletonList(new EquipmentItemSetRequirement(new EquipmentItemset(Arrays.asList( - new EquipmentSlotItem(EquipmentInventorySlot.HEAD, new ArrayList<>(Arrays.asList( - ItemID.DHAROKS_HELM, - ItemID.DHAROKS_HELM_100, - ItemID.DHAROKS_HELM_75, - ItemID.DHAROKS_HELM_50, - ItemID.DHAROKS_HELM_25, - ItemID.DHAROKS_HELM_0 - ))), - new EquipmentSlotItem(EquipmentInventorySlot.BODY, new ArrayList<>(Arrays.asList( - ItemID.DHAROKS_PLATEBODY, - ItemID.DHAROKS_PLATEBODY_100, - ItemID.DHAROKS_PLATEBODY_75, - ItemID.DHAROKS_PLATEBODY_50, - ItemID.DHAROKS_PLATEBODY_25, - ItemID.DHAROKS_PLATEBODY_0 - ))), - new EquipmentSlotItem(EquipmentInventorySlot.LEGS, new ArrayList<>(Arrays.asList( - ItemID.DHAROKS_PLATELEGS, - ItemID.DHAROKS_PLATELEGS_100, - ItemID.DHAROKS_PLATELEGS_75, - ItemID.DHAROKS_PLATELEGS_50, - ItemID.DHAROKS_PLATELEGS_25, - ItemID.DHAROKS_PLATELEGS_0 - ))), - new EquipmentSlotItem(EquipmentInventorySlot.WEAPON, new ArrayList<>(Arrays.asList( - ItemID.DHAROKS_GREATAXE, - ItemID.DHAROKS_GREATAXE_100, - ItemID.DHAROKS_GREATAXE_75, - ItemID.DHAROKS_GREATAXE_50, - ItemID.DHAROKS_GREATAXE_25, - ItemID.DHAROKS_GREATAXE_0 - ))) - ))))), - (client, calculator) -> - { - int currentHP = client.getBoostedSkillLevel(Skill.HITPOINTS); - int maxHP = client.getRealSkillLevel(Skill.HITPOINTS); - int lostHP = maxHP - currentHP; - - double initialMaxHit = calculator.calculate(); - - double multiplier = (1.0 + ((lostHP / 100.0) * (maxHP / 100.0))); - - return Math.floor(initialMaxHit * multiplier); - } - ); - - private final MaxHitCalculator.CombatMethod requiredCombatMethod; - private final List requirements; - private final BiFunction customFormula; - - CustomFormulaConfig(MaxHitCalculator.CombatMethod requiredCombatMethod, List requirements, BiFunction customFormula) - { - this.requiredCombatMethod = requiredCombatMethod; - this.requirements = requirements; - this.customFormula = customFormula; - } - - public MaxHitCalculator.CombatMethod getRequiredCombatMethod() - { - return requiredCombatMethod; - } - - public BiFunction getCustomFormula() - { - return customFormula; - } - - public List getRequirements() - { - return this.requirements; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/config/EquipmentBonusConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/config/EquipmentBonusConfig.java deleted file mode 100644 index 015566d5e0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/config/EquipmentBonusConfig.java +++ /dev/null @@ -1,424 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.config; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import net.runelite.api.Client; -import net.runelite.api.EquipmentInventorySlot; -import net.runelite.api.ItemID; -import net.runelite.client.plugins.maxhit.calculators.MaxHitCalculator; -import net.runelite.client.plugins.maxhit.equipment.EquipmentCombatBonus; -import net.runelite.client.plugins.maxhit.equipment.EquipmentItemset; -import net.runelite.client.plugins.maxhit.equipment.EquipmentSlotItem; -import net.runelite.client.plugins.maxhit.requirements.AutocastSpellRequirement; -import net.runelite.client.plugins.maxhit.requirements.Requirement; -import net.runelite.client.plugins.maxhit.requirements.SpellBookRequirement; - - -public enum EquipmentBonusConfig -{ - - /* - * Slayer bonus items - */ - BLACKMASK(BonusType.SLAYER, new EquipmentItemset(Collections.singletonList( - new EquipmentSlotItem(EquipmentInventorySlot.HEAD, new ArrayList<>(Arrays.asList( - ItemID.BLACK_MASK_10, - ItemID.BLACK_MASK_9, - ItemID.BLACK_MASK_8, - ItemID.BLACK_MASK_7, - ItemID.BLACK_MASK_6, - ItemID.BLACK_MASK_5, - ItemID.BLACK_MASK_4, - ItemID.BLACK_MASK_3, - ItemID.BLACK_MASK_2, - ItemID.BLACK_MASK_1, - ItemID.BLACK_MASK - ))) - )), new EquipmentCombatBonus(((7.0 / 6.0) - 1), 0, 0)), - - SLAYERHELM(BonusType.SLAYER, new EquipmentItemset(Collections.singletonList( - new EquipmentSlotItem(EquipmentInventorySlot.HEAD, new ArrayList<>(Arrays.asList( - ItemID.SLAYER_HELMET, - ItemID.BLACK_SLAYER_HELMET, - ItemID.GREEN_SLAYER_HELMET, - ItemID.RED_SLAYER_HELMET, - ItemID.PURPLE_SLAYER_HELMET, - ItemID.TURQUOISE_SLAYER_HELMET, - ItemID.HYDRA_SLAYER_HELMET - ))) - )), new EquipmentCombatBonus(((7.0 / 6.0) - 1), 0, 0)), - - BLACKMASKI(BonusType.SLAYER, new EquipmentItemset(Collections.singletonList( - new EquipmentSlotItem(EquipmentInventorySlot.HEAD, new ArrayList<>(Arrays.asList( - ItemID.BLACK_MASK_10_I, - ItemID.BLACK_MASK_9_I, - ItemID.BLACK_MASK_8_I, - ItemID.BLACK_MASK_7_I, - ItemID.BLACK_MASK_6_I, - ItemID.BLACK_MASK_5_I, - ItemID.BLACK_MASK_4_I, - ItemID.BLACK_MASK_3_I, - ItemID.BLACK_MASK_2_I, - ItemID.BLACK_MASK_1_I, - ItemID.BLACK_MASK_I - ))) - )), new EquipmentCombatBonus(((7.0 / 6.0) - 1), 0.15, 0.15)), - - SLAYERHELMI(BonusType.SLAYER, new EquipmentItemset(Collections.singletonList( - new EquipmentSlotItem(EquipmentInventorySlot.HEAD, new ArrayList<>(Arrays.asList( - ItemID.SLAYER_HELMET_I, - ItemID.BLACK_SLAYER_HELMET_I, - ItemID.GREEN_SLAYER_HELMET_I, - ItemID.RED_SLAYER_HELMET_I, - ItemID.PURPLE_SLAYER_HELMET_I, - ItemID.TURQUOISE_SLAYER_HELMET_I, - ItemID.HYDRA_SLAYER_HELMET_I - ))) - )), new EquipmentCombatBonus(((7.0 / 6.0) - 1), 0.15, 0.15)), - - /* - * Void bonus items - * */ - MELEEVOID(BonusType.VOID_KNIGHT, new EquipmentItemset(Arrays.asList( - new EquipmentSlotItem(EquipmentInventorySlot.HEAD, new ArrayList<>(Arrays.asList( - ItemID.VOID_MELEE_HELM, - ItemID.VOID_MELEE_HELM_11676 - ))), - new EquipmentSlotItem(EquipmentInventorySlot.BODY, new ArrayList<>(Arrays.asList( - ItemID.VOID_KNIGHT_TOP, - ItemID.VOID_KNIGHT_TOP_10611 - ))), - new EquipmentSlotItem(EquipmentInventorySlot.LEGS, new ArrayList<>(Collections.singletonList( - ItemID.VOID_KNIGHT_ROBE - ))), - new EquipmentSlotItem(EquipmentInventorySlot.GLOVES, new ArrayList<>(Collections.singletonList( - ItemID.VOID_KNIGHT_GLOVES - ))) - )), new EquipmentCombatBonus(0.1, 0, 0)), - - RANGERVOID(BonusType.VOID_KNIGHT, new EquipmentItemset(Arrays.asList( - new EquipmentSlotItem(EquipmentInventorySlot.HEAD, new ArrayList<>(Arrays.asList( - ItemID.VOID_RANGER_HELM, - ItemID.VOID_RANGER_HELM_11675 - ))), - new EquipmentSlotItem(EquipmentInventorySlot.BODY, new ArrayList<>(Arrays.asList( - ItemID.VOID_KNIGHT_TOP, - ItemID.VOID_KNIGHT_TOP_10611 - ))), - new EquipmentSlotItem(EquipmentInventorySlot.LEGS, new ArrayList<>(Collections.singletonList( - ItemID.VOID_KNIGHT_ROBE - ))), - new EquipmentSlotItem(EquipmentInventorySlot.GLOVES, new ArrayList<>(Collections.singletonList( - ItemID.VOID_KNIGHT_GLOVES - ))) - )), new EquipmentCombatBonus(0, 0.1, 0)), - - - ELITEMELEERVOID(BonusType.VOID_KNIGHT, new EquipmentItemset(Arrays.asList( - new EquipmentSlotItem(EquipmentInventorySlot.HEAD, new ArrayList<>(Arrays.asList( - ItemID.VOID_MELEE_HELM, - ItemID.VOID_MELEE_HELM_11676 - ))), - new EquipmentSlotItem(EquipmentInventorySlot.BODY, new ArrayList<>(Collections.singletonList( - ItemID.ELITE_VOID_TOP - ))), - new EquipmentSlotItem(EquipmentInventorySlot.LEGS, new ArrayList<>(Collections.singletonList( - ItemID.ELITE_VOID_ROBE - ))), - new EquipmentSlotItem(EquipmentInventorySlot.GLOVES, new ArrayList<>(Collections.singletonList( - ItemID.VOID_KNIGHT_GLOVES - ))) - )), new EquipmentCombatBonus(0.125, 0, 0)), - - - ELITERANGERVOID(BonusType.VOID_KNIGHT, new EquipmentItemset(Arrays.asList( - new EquipmentSlotItem(EquipmentInventorySlot.HEAD, new ArrayList<>(Arrays.asList( - ItemID.VOID_RANGER_HELM, - ItemID.VOID_RANGER_HELM_11675 - ))), - new EquipmentSlotItem(EquipmentInventorySlot.BODY, new ArrayList<>(Collections.singletonList( - ItemID.ELITE_VOID_TOP - ))), - new EquipmentSlotItem(EquipmentInventorySlot.LEGS, new ArrayList<>(Collections.singletonList( - ItemID.ELITE_VOID_ROBE - ))), - new EquipmentSlotItem(EquipmentInventorySlot.GLOVES, new ArrayList<>(Collections.singletonList( - ItemID.VOID_KNIGHT_GLOVES - ))) - )), new EquipmentCombatBonus(0, 0.125, 0)), - - ELITEMAGICVOID(BonusType.EQUIPMENT, new EquipmentItemset(Arrays.asList( - new EquipmentSlotItem(EquipmentInventorySlot.HEAD, new ArrayList<>(Arrays.asList( - ItemID.VOID_MAGE_HELM, - ItemID.VOID_MAGE_HELM_11674 - ))), - new EquipmentSlotItem(EquipmentInventorySlot.BODY, new ArrayList<>(Collections.singletonList( - ItemID.ELITE_VOID_TOP - ))), - new EquipmentSlotItem(EquipmentInventorySlot.LEGS, new ArrayList<>(Collections.singletonList( - ItemID.ELITE_VOID_ROBE - ))), - new EquipmentSlotItem(EquipmentInventorySlot.GLOVES, new ArrayList<>(Collections.singletonList( - ItemID.VOID_KNIGHT_GLOVES - ))) - )), new EquipmentCombatBonus(0, 0, 0.025)), - - /* - * Special Melee Equipment - * */ - OBISIDIAN(BonusType.SPECIAL, new EquipmentItemset(Arrays.asList( - new EquipmentSlotItem(EquipmentInventorySlot.HEAD, new ArrayList<>(Collections.singletonList( - ItemID.OBSIDIAN_HELMET - ))), - new EquipmentSlotItem(EquipmentInventorySlot.BODY, new ArrayList<>(Collections.singletonList( - ItemID.OBSIDIAN_PLATEBODY - ))), - new EquipmentSlotItem(EquipmentInventorySlot.LEGS, new ArrayList<>(Collections.singletonList( - ItemID.OBSIDIAN_PLATELEGS - ))), - new EquipmentSlotItem(EquipmentInventorySlot.WEAPON, new ArrayList<>(Arrays.asList( - ItemID.TOKTZXILAK, - ItemID.TOKTZXILEK, - ItemID.TZHAARKETEM, - ItemID.TZHAARKETOM, - ItemID.TOKTZXILAK_20554 - ))) - )), new EquipmentCombatBonus(0.1, 0, 0)), - - BERSERKERNECKLACE(BonusType.SPECIAL, new EquipmentItemset(Arrays.asList( - new EquipmentSlotItem(EquipmentInventorySlot.AMULET, new ArrayList<>(Collections.singletonList(ItemID.BERSERKER_NECKLACE))), - new EquipmentSlotItem(EquipmentInventorySlot.WEAPON, new ArrayList<>(Arrays.asList( - ItemID.TOKTZXILAK, - ItemID.TOKTZXILEK, - ItemID.TZHAARKETEM, - ItemID.TZHAARKETOM, - ItemID.TOKTZXILAK_20554 - ))) - )), new EquipmentCombatBonus(0.2, 0, 0)), - - - /* - * Magic Equipment - */ - ANCESTRAL_HAT(BonusType.EQUIPMENT, new EquipmentItemset(Collections.singletonList( - new EquipmentSlotItem(EquipmentInventorySlot.HEAD, new ArrayList<>(Collections.singletonList( - ItemID.ANCESTRAL_HAT - ))) - )), new EquipmentCombatBonus(0, 0, 0.02)), - - ANCESTRAL_ROBE_TOP(BonusType.EQUIPMENT, new EquipmentItemset(Collections.singletonList( - new EquipmentSlotItem(EquipmentInventorySlot.BODY, new ArrayList<>(Collections.singletonList( - ItemID.ANCESTRAL_ROBE_TOP - ))) - )), new EquipmentCombatBonus(0, 0, 0.02)), - - ANCESTRAL_ROBE_BOTTOM(BonusType.EQUIPMENT, new EquipmentItemset(Collections.singletonList( - new EquipmentSlotItem(EquipmentInventorySlot.LEGS, new ArrayList<>(Collections.singletonList( - ItemID.ANCESTRAL_ROBE_BOTTOM - ))) - )), new EquipmentCombatBonus(0, 0, 0.02)), - - IMBUED_GOD_CAPE(BonusType.EQUIPMENT, new EquipmentItemset(Collections.singletonList( - new EquipmentSlotItem(EquipmentInventorySlot.CAPE, new ArrayList<>(Arrays.asList( - ItemID.IMBUED_SARADOMIN_MAX_CAPE, - ItemID.IMBUED_SARADOMIN_CAPE, - ItemID.IMBUED_ZAMORAK_MAX_CAPE, - ItemID.IMBUED_ZAMORAK_CAPE, - ItemID.IMBUED_GUTHIX_MAX_CAPE, - ItemID.IMBUED_GUTHIX_CAPE - ))) - )), new EquipmentCombatBonus(0, 0, 0.02)), - - KODAI_WAND(BonusType.EQUIPMENT, new EquipmentItemset(Collections.singletonList( - new EquipmentSlotItem(EquipmentInventorySlot.WEAPON, new ArrayList<>(Collections.singletonList( - ItemID.KODAI_WAND - ))) - )), new EquipmentCombatBonus(0, 0, 0.15)), - - OCCULT_NECKLACE(BonusType.EQUIPMENT, new EquipmentItemset(Collections.singletonList( - new EquipmentSlotItem(EquipmentInventorySlot.AMULET, new ArrayList<>(Arrays.asList( - ItemID.OCCULT_NECKLACE, - ItemID.OCCULT_NECKLACE_OR - ))) - )), new EquipmentCombatBonus(0, 0, 0.10)), - - STAFF_OF_THE_DEAD(BonusType.EQUIPMENT, new EquipmentItemset(Collections.singletonList( - new EquipmentSlotItem(EquipmentInventorySlot.WEAPON, new ArrayList<>(Arrays.asList( - ItemID.STAFF_OF_THE_DEAD, - ItemID.TOXIC_STAFF_OF_THE_DEAD, - ItemID.STAFF_OF_LIGHT - ))) - )), new EquipmentCombatBonus(0, 0, 0.15)), - - TORMENTED_BRACELET(BonusType.EQUIPMENT, new EquipmentItemset(Collections.singletonList( - new EquipmentSlotItem(EquipmentInventorySlot.GLOVES, new ArrayList<>(Collections.singletonList( - ItemID.TORMENTED_BRACELET - ))) - )), new EquipmentCombatBonus(0, 0, 0.05)), - - SMOKE_STAFF(BonusType.EQUIPMENT, new EquipmentItemset(Collections.singletonList( - new EquipmentSlotItem(EquipmentInventorySlot.WEAPON, new ArrayList<>(Arrays.asList( - ItemID.SMOKE_BATTLESTAFF, - ItemID.MYSTIC_SMOKE_STAFF - ))) - )), new EquipmentCombatBonus(0, 0, 0.10), Collections.singletonList(new SpellBookRequirement(SpellBaseDamageConfig.SpellBook.NORMAL))), - - - /* - * Special magic bonusses - * */ - - CHAOS_GAUNTLETS(BonusType.SPECIAL, new EquipmentItemset(Collections.singletonList( - new EquipmentSlotItem(EquipmentInventorySlot.GLOVES, new ArrayList<>(Collections.singletonList( - ItemID.CHAOS_GAUNTLETS - ))))), - new EquipmentCombatBonus(0, 0, 3), - Collections.singletonList( - new AutocastSpellRequirement(new ArrayList<>(Arrays.asList( - SpellBaseDamageConfig.AIR_BOLT, - SpellBaseDamageConfig.WATER_BOLT, - SpellBaseDamageConfig.EARTH_BOLT, - SpellBaseDamageConfig.FIRE_BOLT - ))) - ), - Operation.ADD - ), - - TOME_OF_FIRE(BonusType.MAGIC_SPECIAL, new EquipmentItemset(Collections.singletonList( - new EquipmentSlotItem(EquipmentInventorySlot.SHIELD, new ArrayList<>(Collections.singletonList( - ItemID.TOME_OF_FIRE - ))))), - new EquipmentCombatBonus(0, 0, 0.5), - Collections.singletonList( - new AutocastSpellRequirement(new ArrayList<>(Arrays.asList( - SpellBaseDamageConfig.FIRE_BLAST, - SpellBaseDamageConfig.FIRE_BOLT, - SpellBaseDamageConfig.FIRE_STRIKE, - SpellBaseDamageConfig.FIRE_SURGE, - SpellBaseDamageConfig.FIRE_WAVE - ))) - ) - ); - - - private static final Map> bonusTypes = new HashMap<>(); - - static - { - for (EquipmentBonusConfig equipmentBonus : values()) - { - BonusType bonusType = equipmentBonus.bonusType; - if (!bonusTypes.containsKey(bonusType)) - { - bonusTypes.put(bonusType, new ArrayList<>()); - } - ArrayList list = bonusTypes.get(bonusType); - list.add(equipmentBonus); - bonusTypes.put(bonusType, list); - } - } - - private final EquipmentItemset itemset; - private BonusType bonusType; - private EquipmentCombatBonus equipmentCombatBonus; - private List requirements = new ArrayList<>(); - private Operation operation = Operation.MULTIPLY; - - EquipmentBonusConfig(BonusType bonusType, EquipmentItemset itemset, EquipmentCombatBonus equipmentCombatBonus) - { - this.bonusType = bonusType; - this.itemset = itemset; - this.equipmentCombatBonus = equipmentCombatBonus; - } - - EquipmentBonusConfig(BonusType bonusType, EquipmentItemset itemset, EquipmentCombatBonus equipmentCombatBonus, List requirements) - { - this.bonusType = bonusType; - this.itemset = itemset; - this.equipmentCombatBonus = equipmentCombatBonus; - this.requirements = requirements; - } - - EquipmentBonusConfig(BonusType bonusType, EquipmentItemset itemset, EquipmentCombatBonus equipmentCombatBonus, List requirements, Operation operation) - { - this.bonusType = bonusType; - this.itemset = itemset; - this.equipmentCombatBonus = equipmentCombatBonus; - this.requirements = requirements; - this.operation = operation; - } - - public static List getBonusByType(BonusType bonusType) - { - if (!bonusTypes.containsKey(bonusType)) - { - return new ArrayList<>(); - } - return bonusTypes.get(bonusType); - } - - public EquipmentItemset getItemset() - { - return itemset; - } - - public Operation getOperation() - { - return operation; - } - - public double getBonus(MaxHitCalculator.CombatMethod combatMethod) - { - return this.equipmentCombatBonus.getCombatBonus(combatMethod); - } - - public boolean meetsRequirements(Client client) - { - return requirements.stream().allMatch(requirement -> requirement.meetsRequirements(client)); - } - - public enum BonusType - { - EQUIPMENT, - SLAYER, - VOID_KNIGHT, - SPECIAL, - MAGIC_SPECIAL - } - - public enum Operation - { - ADD, - MULTIPLY - } - -} - diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/config/PrayerBonusConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/config/PrayerBonusConfig.java deleted file mode 100644 index fda776f170..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/config/PrayerBonusConfig.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.config; - -import net.runelite.api.Varbits; -import net.runelite.client.plugins.maxhit.calculators.MaxHitCalculator; - -public enum PrayerBonusConfig -{ - BURST_OF_STRENGTH(MaxHitCalculator.CombatMethod.MELEE, Varbits.PRAYER_BURST_OF_STRENGTH, 0.05), - SUPERHUMAN_STRENGTH(MaxHitCalculator.CombatMethod.MELEE, Varbits.PRAYER_SUPERHUMAN_STRENGTH, 0.1), - ULTIMATE_STRENGTH(MaxHitCalculator.CombatMethod.MELEE, Varbits.PRAYER_ULTIMATE_STRENGTH, 0.15), - CHIVALRY(MaxHitCalculator.CombatMethod.MELEE, Varbits.PRAYER_CHIVALRY, 0.18), - PIETY(MaxHitCalculator.CombatMethod.MELEE, Varbits.PRAYER_PIETY, 0.23), - - SHARP_EYE(MaxHitCalculator.CombatMethod.RANGE, Varbits.PRAYER_SHARP_EYE, 0.05), - HAWK_EYE(MaxHitCalculator.CombatMethod.RANGE, Varbits.PRAYER_HAWK_EYE, 0.1), - EAGLE_EYE(MaxHitCalculator.CombatMethod.RANGE, Varbits.PRAYER_EAGLE_EYE, 0.15), - RIGOUR(MaxHitCalculator.CombatMethod.RANGE, Varbits.PRAYER_RIGOUR, 0.23); - - private final MaxHitCalculator.CombatMethod combatMethod; - private final Varbits prayerVarbit; - private final double strengthBonus; - - PrayerBonusConfig(MaxHitCalculator.CombatMethod combatMethod, Varbits prayerVarbit, double strengthBonus) - { - this.combatMethod = combatMethod; - this.prayerVarbit = prayerVarbit; - this.strengthBonus = strengthBonus; - } - - public MaxHitCalculator.CombatMethod getCombatMethod() - { - return combatMethod; - } - - public Varbits getPrayerVarbit() - { - return prayerVarbit; - } - - public double getStrengthBonus() - { - return strengthBonus; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/config/SpellBaseDamageConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/config/SpellBaseDamageConfig.java deleted file mode 100644 index cc47af1562..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/config/SpellBaseDamageConfig.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.config; - -import java.util.Arrays; - -public enum SpellBaseDamageConfig -{ - - /* - * Normal Spellbook - * */ - AIR_STRIKE(SpellBook.NORMAL, 1, 2), - WATER_STRIKE(SpellBook.NORMAL, 2, 4), - EARTH_STRIKE(SpellBook.NORMAL, 3, 6), - FIRE_STRIKE(SpellBook.NORMAL, 4, 8), - - AIR_BOLT(SpellBook.NORMAL, 5, 9), - WATER_BOLT(SpellBook.NORMAL, 6, 10), - EARTH_BOLT(SpellBook.NORMAL, 7, 11), - FIRE_BOLT(SpellBook.NORMAL, 8, 12), - - WIND_BLAST(SpellBook.NORMAL, 9, 13), - WATER_BLAST(SpellBook.NORMAL, 10, 14), - EARTH_BLAST(SpellBook.NORMAL, 11, 15), - FIRE_BLAST(SpellBook.NORMAL, 12, 16), - - AIR_WAVE(SpellBook.NORMAL, 13, 17), - WATER_WAVE(SpellBook.NORMAL, 14, 18), - EARTH_WAVE(SpellBook.NORMAL, 15, 19), - FIRE_WAVE(SpellBook.NORMAL, 16, 20), - - AIR_SURGE(SpellBook.NORMAL, 48, 21), - WATER_SURGE(SpellBook.NORMAL, 49, 22), - EARTH_SURGE(SpellBook.NORMAL, 50, 23), - FIRE_SURGE(SpellBook.NORMAL, 51, 24), - - /* - * Ancient Spellbook - * */ - SMOKE_RUSH(SpellBook.ANCIENT, 31, 14), - SHADOW_RUSH(SpellBook.ANCIENT, 32, 15), - BLOOD_RUSH(SpellBook.ANCIENT, 33, 16), - ICE_RUSH(SpellBook.ANCIENT, 34, 17), - - SMOKE_BURST(SpellBook.ANCIENT, 35, 18), - SHADOW_BURST(SpellBook.ANCIENT, 36, 19), - BLOOD_BURST(SpellBook.ANCIENT, 37, 21), - ICE_BURST(SpellBook.ANCIENT, 38, 22), - - SMOKE_BLITZ(SpellBook.ANCIENT, 39, 23), - SHADOW_BLITZ(SpellBook.ANCIENT, 40, 24), - BLOOD_BLITZ(SpellBook.ANCIENT, 41, 25), - ICE_BLITZ(SpellBook.ANCIENT, 42, 26), - - SMOKE_BARRAGE(SpellBook.ANCIENT, 43, 27), - SHADOW_BARRAGE(SpellBook.ANCIENT, 44, 28), - BLOOD_BARRAGE(SpellBook.ANCIENT, 55, 29), - ICE_BARRAGE(SpellBook.ANCIENT, 46, 30), - - /* - * Other spells - * */ - CRUMBLE_UNDEAD(SpellBook.OTHER, 17, 15), - IBAN_BLAST(SpellBook.OTHER, 47, 25), - FLAMES_OF_ZAMAROK(SpellBook.OTHER, 20, 20), - CLAWS_OF_GUTHIX(SpellBook.OTHER, 19, 20), - SARADOMIN_STRIKE(SpellBook.OTHER, 52, 20), - - /* - * Custom Formula spells - * */ - MAGIC_DART(SpellBook.OTHER, 18, 0); - - private final SpellBook spellBook; - private final int spellID; - private final int baseDamage; - - SpellBaseDamageConfig(SpellBook spellBook, int spellID, int baseDamage) - { - this.spellBook = spellBook; - this.spellID = spellID; - this.baseDamage = baseDamage; - } - - public static SpellBaseDamageConfig findSpellById(int spellID) - { - return Arrays.stream(values()).filter(spell -> spell.getSpellID() == spellID).findFirst().orElse(null); - } - - public int getSpellID() - { - return spellID; - } - - public int getBaseDamage() - { - return baseDamage; - } - - public SpellBook getSpellBook() - { - return spellBook; - } - - public enum SpellBook - { - NORMAL, - ANCIENT, - OTHER - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/equipment/EquipmentCombatBonus.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/equipment/EquipmentCombatBonus.java deleted file mode 100644 index 33ca175d4d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/equipment/EquipmentCombatBonus.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.equipment; - -import net.runelite.client.plugins.maxhit.calculators.MaxHitCalculator; - -public class EquipmentCombatBonus -{ - - private final double meleeBonus; - private final double rangeBonus; - private final double magicBonus; - - public EquipmentCombatBonus(double meleeBonus, double rangeBonus, double magicBonus) - { - this.meleeBonus = meleeBonus; - this.rangeBonus = rangeBonus; - this.magicBonus = magicBonus; - } - - public double getCombatBonus(MaxHitCalculator.CombatMethod combatMethod) - { - switch (combatMethod) - { - default: - case MELEE: - return this.meleeBonus; - case RANGE: - return this.rangeBonus; - case MAGIC: - return this.magicBonus; - } - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/equipment/EquipmentHelper.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/equipment/EquipmentHelper.java deleted file mode 100644 index 3f7f4e8398..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/equipment/EquipmentHelper.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.equipment; - -import net.runelite.api.EquipmentInventorySlot; -import net.runelite.api.Item; - -public class EquipmentHelper -{ - - public static boolean wearsItemSet(Item[] equipedItems, EquipmentItemset itemSet) - { - return itemSet.getItems().stream().allMatch(item -> wearsItem(equipedItems, item)); - } - - private static boolean wearsItem(Item[] equipedItems, EquipmentInventorySlot slot, int itemId) - { - if (slot.getSlotIdx() >= equipedItems.length) - { - return false; - } - Item item = equipedItems[slot.getSlotIdx()]; - if (item == null) - { - return false; - } - return item.getId() == itemId; - } - - public static boolean wearsItem(Item[] equipedItems, EquipmentSlotItem equipmentSlotItem) - { - return equipmentSlotItem.getItems().stream().anyMatch(itemId -> - wearsItem(equipedItems, equipmentSlotItem.getEquipmentSlot(), itemId) - ); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/equipment/EquipmentItemset.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/equipment/EquipmentItemset.java deleted file mode 100644 index 12c295443f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/equipment/EquipmentItemset.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.equipment; - -import java.util.List; - -public class EquipmentItemset -{ - private final List items; - - public EquipmentItemset(List items) - { - this.items = items; - } - - public List getItems() - { - return items; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/equipment/EquipmentSlotItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/equipment/EquipmentSlotItem.java deleted file mode 100644 index 1bd3d6c861..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/equipment/EquipmentSlotItem.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.equipment; - -import java.util.List; -import net.runelite.api.EquipmentInventorySlot; - -public class EquipmentSlotItem -{ - private final EquipmentInventorySlot equipmentSlot; - private final List itemIds; - - public EquipmentSlotItem(EquipmentInventorySlot equipmentSlot, List itemIds) - { - this.equipmentSlot = equipmentSlot; - this.itemIds = itemIds; - } - - public List getItems() - { - return this.itemIds; - } - - EquipmentInventorySlot getEquipmentSlot() - { - return this.equipmentSlot; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/requirements/AutocastSpellRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/requirements/AutocastSpellRequirement.java deleted file mode 100644 index 5e933a3e61..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/requirements/AutocastSpellRequirement.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.requirements; - -import java.util.List; -import net.runelite.api.Client; -import net.runelite.api.Varbits; -import net.runelite.client.plugins.maxhit.config.SpellBaseDamageConfig; - -public class AutocastSpellRequirement implements Requirement -{ - - private final List autocastSpells; - - public AutocastSpellRequirement(List autocastSpells) - { - this.autocastSpells = autocastSpells; - } - - @Override - public boolean meetsRequirements(Client client) - { - int autoCastSpellId = client.getVar(Varbits.AUTO_CAST_SPELL); - - if (autoCastSpellId == 0) - { - - return false; - - } - - return this.autocastSpells.stream().anyMatch(spell -> spell.getSpellID() == autoCastSpellId); - - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/requirements/EquipmentItemRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/requirements/EquipmentItemRequirement.java deleted file mode 100644 index d0ed360f43..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/requirements/EquipmentItemRequirement.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.requirements; - -import net.runelite.api.Client; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.client.plugins.maxhit.equipment.EquipmentHelper; -import net.runelite.client.plugins.maxhit.equipment.EquipmentSlotItem; - -public class EquipmentItemRequirement implements Requirement -{ - private final EquipmentSlotItem item; - - public EquipmentItemRequirement(EquipmentSlotItem item) - { - this.item = item; - } - - @Override - public boolean meetsRequirements(Client client) - { - ItemContainer equipmentContainer = client.getItemContainer(InventoryID.EQUIPMENT); - if (equipmentContainer == null) - { - return false; - } - Item[] equipedItems = equipmentContainer.getItems(); - return EquipmentHelper.wearsItem(equipedItems, this.item); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/requirements/EquipmentItemSetRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/requirements/EquipmentItemSetRequirement.java deleted file mode 100644 index 31b322c02d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/requirements/EquipmentItemSetRequirement.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.requirements; - -import net.runelite.api.Client; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.client.plugins.maxhit.equipment.EquipmentHelper; -import net.runelite.client.plugins.maxhit.equipment.EquipmentItemset; - -public class EquipmentItemSetRequirement implements Requirement -{ - private final EquipmentItemset itemSet; - - public EquipmentItemSetRequirement(EquipmentItemset itemSet) - { - this.itemSet = itemSet; - } - - @Override - public boolean meetsRequirements(Client client) - { - ItemContainer equipmentContainer = client.getItemContainer(InventoryID.EQUIPMENT); - if (equipmentContainer == null) - { - return false; - } - Item[] equipedItems = equipmentContainer.getItems(); - - return EquipmentHelper.wearsItemSet(equipedItems, this.itemSet); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/requirements/Requirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/requirements/Requirement.java deleted file mode 100644 index 48e9cc677a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/requirements/Requirement.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.requirements; - -import net.runelite.api.Client; - -public interface Requirement -{ - boolean meetsRequirements(Client client); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/requirements/SpellBookRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/requirements/SpellBookRequirement.java deleted file mode 100644 index d59723577e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/requirements/SpellBookRequirement.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.requirements; - -import net.runelite.api.Client; -import net.runelite.api.Varbits; -import net.runelite.client.plugins.maxhit.config.SpellBaseDamageConfig; - -public class SpellBookRequirement implements Requirement -{ - private final SpellBaseDamageConfig.SpellBook spellBook; - - public SpellBookRequirement(SpellBaseDamageConfig.SpellBook spellBook) - { - this.spellBook = spellBook; - } - - @Override - public boolean meetsRequirements(Client client) - { - int autoCastSpellId = client.getVar(Varbits.AUTO_CAST_SPELL); - if (autoCastSpellId == 0) - { - return false; - } - - SpellBaseDamageConfig autoCastSpell = SpellBaseDamageConfig.findSpellById(autoCastSpellId); - return autoCastSpell.getSpellBook() == this.spellBook; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/requirements/SpellRequirement.java b/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/requirements/SpellRequirement.java deleted file mode 100644 index 4084044048..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/maxhit/requirements/SpellRequirement.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.requirements; - -import net.runelite.api.Client; -import net.runelite.api.Varbits; -import net.runelite.client.plugins.maxhit.config.SpellBaseDamageConfig; - -public class SpellRequirement implements Requirement -{ - private final SpellBaseDamageConfig spellBaseDamageConfig; - - public SpellRequirement(SpellBaseDamageConfig spellBaseDamageConfig) - { - this.spellBaseDamageConfig = spellBaseDamageConfig; - } - - @Override - public boolean meetsRequirements(Client client) - { - int autoCastSpellId = client.getVar(Varbits.AUTO_CAST_SPELL); - if (autoCastSpellId == 0) - { - return false; - } - - return autoCastSpellId == this.spellBaseDamageConfig.getSpellID(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/CustomSwapParse.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/CustomSwapParse.java deleted file mode 100644 index b44cd270b7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/CustomSwapParse.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2019, Owain van Brakel - * 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.menuentryswapper; - -import com.google.common.base.Splitter; -import java.util.Map; - -public class CustomSwapParse -{ - public static boolean parse(String value) - { - try - { - final StringBuilder sb = new StringBuilder(); - - for (String str : value.split("\n")) - { - if (!str.startsWith("//")) - { - sb.append(str).append("\n"); - } - } - - final Splitter NEWLINE_SPLITTER = Splitter - .on("\n") - .omitEmptyStrings() - .trimResults(); - - final Map tmp = NEWLINE_SPLITTER.withKeyValueSeparator(':').split(sb); - - for (String str : tmp.values()) - { - Integer.parseInt(str.trim()); - } - return true; - } - catch (Exception ex) - { - return false; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/GEItemCollectMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/GEItemCollectMode.java deleted file mode 100644 index e15277e320..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/GEItemCollectMode.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2019, Rami - * 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.menuentryswapper; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor -public enum GEItemCollectMode -{ - DEFAULT("Default"), - ITEMS("Collect-items"), - NOTES("Collect-notes"), - BANK("Bank"); - - private final String name; - - @Override - public String toString() - { - return name; - } -} 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 deleted file mode 100644 index eb69cd59c2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java +++ /dev/null @@ -1,2077 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * Copyright (c) 2019, alanbaumgartner - * Copyright (c) 2019, Kyle - * Copyright (c) 2019, Lucas - * 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.menuentryswapper; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigSection; -import net.runelite.client.config.Keybind; -import net.runelite.client.plugins.menuentryswapper.util.ArdougneCloakMode; -import net.runelite.client.plugins.menuentryswapper.util.BurningAmuletMode; -import net.runelite.client.plugins.menuentryswapper.util.CombatBraceletMode; -import net.runelite.client.plugins.menuentryswapper.util.ConstructionCapeMode; -import net.runelite.client.plugins.menuentryswapper.util.ConstructionMode; -import net.runelite.client.plugins.menuentryswapper.util.DigsitePendantMode; -import net.runelite.client.plugins.menuentryswapper.util.DuelingRingMode; -import net.runelite.client.plugins.menuentryswapper.util.FairyRingMode; -import net.runelite.client.plugins.menuentryswapper.util.FairyTreeMode; -import net.runelite.client.plugins.menuentryswapper.util.GamesNecklaceMode; -import net.runelite.client.plugins.menuentryswapper.util.GloryMode; -import net.runelite.client.plugins.menuentryswapper.util.HouseAdvertisementMode; -import net.runelite.client.plugins.menuentryswapper.util.HouseMode; -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.SwapGrimyHerbMode; -import net.runelite.client.plugins.menuentryswapper.util.XericsTalismanMode; - - -@ConfigGroup("menuentryswapper") -public interface MenuEntrySwapperConfig extends Config -{ - @ConfigSection( - name = "Banking", - description = "", - position = 0, - keyName = "bankingSection" - ) - default boolean bankingSection() - { - return false; - } - - @ConfigSection( - name = "Equipment Swapper", - description = "", - position = 1, - keyName = "equipmentSwapperSection" - ) - default boolean equipmentSwapperSection() - { - return false; - } - - @ConfigSection( - name = "Miscellaneous", - description = "", - position = 1, - keyName = "miscellaneousSection" - ) - default boolean miscellaneousSection() - { - return false; - } - - @ConfigSection( - name = "Shop / Stores", - description = "", - position = 1, - keyName = "shopStoresSection" - ) - default boolean shopStoresSection() - { - return false; - } - - @ConfigSection( - name = "Skilling", - description = "", - position = 1, - keyName = "skillingSection" - ) - default boolean skillingSection() - { - return false; - } - - @ConfigSection( - name = "Talk-To", - description = "", - position = 1, - keyName = "talkSection" - ) - default boolean talkSection() - { - return false; - } - - @ConfigSection( - name = "Teleportation", - description = "", - position = 1, - keyName = "teleportationSection" - ) - default boolean teleportationSection() - { - return false; - } - - @ConfigSection( - name = "Right Click Options", - description = "", - position = 1, - keyName = "rightClickOptionsSection" - ) - default boolean rightClickOptionsSection() - { - return false; - } - - @ConfigSection( - name = "Untradeables", - description = "", - position = 1, - keyName = "untradeablesSection" - ) - default boolean untradeablesSection() - { - return false; - } - - @ConfigSection( - name = "PvM", - description = "", - position = 1, - keyName = "pvmSection" - ) - default boolean pvmSection() - { - return false; - } - - @ConfigSection( - name = "Hotkey Swapping", - description = "", - position = 1, - keyName = "hotkeySwapping" - ) - default boolean hotkeySwapping() - { - return false; - } - - //------------------------------------------------------------// - // Banking - //------------------------------------------------------------// - - @ConfigItem( - keyName = "withdrawOne", - name = "Withdraw/Deposit One", - description = "", - position = 0, - section = "bankingSection" - ) - default boolean getWithdrawOne() - { - return false; - } - - @ConfigItem( - keyName = "withdrawOneItems", - name = "Items", - description = "", - position = 1, - section = "bankingSection", - hidden = true, - unhide = "withdrawOne" - ) - default String getWithdrawOneItems() - { - return ""; - } - - @ConfigItem( - keyName = "withdrawFive", - name = "Withdraw/Deposit Five", - description = "", - position = 2, - section = "bankingSection" - ) - default boolean getWithdrawFive() - { - return false; - } - - @ConfigItem( - keyName = "withdrawFiveItems", - name = "Items", - description = "", - position = 3, - section = "bankingSection", - hidden = true, - unhide = "withdrawFive" - ) - default String getWithdrawFiveItems() - { - return ""; - } - - @ConfigItem( - keyName = "withdrawTen", - name = "Withdraw/Deposit Ten", - description = "", - position = 4, - section = "bankingSection" - ) - default boolean getWithdrawTen() - { - return false; - } - - @ConfigItem( - keyName = "withdrawTenItems", - name = "Items", - description = "", - position = 5, - section = "bankingSection", - hidden = true, - unhide = "withdrawTen" - ) - default String getWithdrawTenItems() - { - return ""; - } - - @ConfigItem( - keyName = "withdrawX", - name = "Withdraw/Deposit X", - description = "", - position = 6, - section = "bankingSection" - ) - default boolean getWithdrawX() - { - return false; - } - - @ConfigItem( - keyName = "withdrawXItems", - name = "Items", - description = "", - position = 8, - section = "bankingSection", - hidden = true, - unhide = "withdrawX" - ) - default String getWithdrawXItems() - { - return ""; - } - - @ConfigItem( - keyName = "withdrawAll", - name = "Withdraw/Deposit All", - description = "", - position = 9, - section = "bankingSection" - ) - default boolean getWithdrawAll() - { - return false; - } - - @ConfigItem( - keyName = "withdrawAllItems", - name = "Items", - description = "", - position = 10, - section = "bankingSection", - hidden = true, - unhide = "withdrawAll" - ) - default String getWithdrawAllItems() - { - return ""; - } - - //------------------------------------------------------------// - // Equipment Swapper - //------------------------------------------------------------// - - @ConfigItem( - keyName = "swapMax", - name = "Max Cape", - description = "Enables swapping max cape options in worn interface.", - position = 0, - section = "equipmentSwapperSection" - ) - default boolean swapMax() - { - return false; - } - - @ConfigItem( - keyName = "maxMode", - name = "Mode", - description = "", - position = 1, - section = "equipmentSwapperSection", - hidden = true, - unhide = "swapMax" - ) - default MaxCapeMode maxMode() - { - return MaxCapeMode.CRAFTING_GUILD; - } - - @ConfigItem( - keyName = "swapArdougneCloak", - name = "Ardougne Cloak", - description = "Enables swapping of 'Teleport' and 'Wear'.", - position = 2, - section = "equipmentSwapperSection" - ) - default boolean getSwapArdougneCloak() - { - return false; - } - - @ConfigItem( - keyName = "ardougneCloakMode", - name = "Mode", - description = "", - position = 3, - section = "equipmentSwapperSection", - hidden = true, - unhide = "swapArdougneCloak" - ) - default ArdougneCloakMode ardougneCloakMode() - { - return ArdougneCloakMode.TELE_TO_MONASTERY; - } - - @ConfigItem( - keyName = "swapConstructionCape", - name = "Construction Cape", - description = "Enables swapping of 'Teleport' and 'Wear'.", - position = 4, - section = "equipmentSwapperSection" - ) - default boolean getSwapConstructionCape() - { - return true; - } - - @ConfigItem( - keyName = "constructionCapeMode", - name = "Mode", - description = "", - position = 5, - section = "equipmentSwapperSection", - hidden = true, - unhide = "swapConstructionCape" - ) - default ConstructionCapeMode constructionCapeMode() - { - return ConstructionCapeMode.TELE_TO_POH; - } - - @ConfigItem( - keyName = "swapCraftingCape", - name = "Crafting Cape", - description = "Enables swapping of 'Teleport' and 'Wear'.", - position = 6, - section = "equipmentSwapperSection" - ) - default boolean getSwapCraftingCape() - { - return true; - } - - @ConfigItem( - keyName = "swapMagicCape", - name = "Magic Cape", - description = "Enables swapping of 'Spellbook' and 'Wear'.", - position = 7, - section = "equipmentSwapperSection" - ) - default boolean getSwapMagicCape() - { - return true; - } - - @ConfigItem( - keyName = "swapExplorersRing", - name = "Explorer's Ring", - description = "Enables swapping of 'Spellbook' and 'Wear'.", - position = 8, - section = "equipmentSwapperSection" - ) - default boolean getSwapExplorersRing() - { - return true; - } - - @ConfigItem( - keyName = "swapAdmire", - name = "Admire", - description = "Swap 'Admire' with 'Teleport', 'Spellbook' and 'Perks' (max cape) for mounted skill capes.", - position = 9, - section = "equipmentSwapperSection" - ) - default boolean swapAdmire() - { - return true; - } - - @ConfigItem( - keyName = "swapQuestCape", - name = "Quest Cape", - description = "Enables swapping Quest cape options in worn interface.", - position = 10, - section = "equipmentSwapperSection" - ) - default boolean swapQuestCape() - { - return false; - } - - @ConfigItem( - keyName = "questCapeMode", - name = "Mode", - description = "", - position = 11, - section = "equipmentSwapperSection", - hidden = true, - unhide = "swapQuestCape" - ) - default QuestCapeMode questCapeMode() - { - return QuestCapeMode.TELEPORT; - } - - //------------------------------------------------------------// - // Miscellaneous - //------------------------------------------------------------// - - @ConfigItem( - keyName = "customSwaps", - name = "Custom Swaps", - description = "Add custom swaps here, 1 per line. Syntax: option,target:priority" + - "
Note that the higher your set the priority, the more it will overtake over swaps.", - position = 1, - section = "miscellaneousSection", - parse = true, - clazz = CustomSwapParse.class, - method = "parse" - ) - default String customSwaps() - { - return ""; - } - - @ConfigItem( - keyName = "prioEntry", - name = "Prioritize Entry", - description = "This section is mainly for prioritizing entries. For example" + - "
ignoring attack on snakelings at zulrah." + - "
Example Syntax: walk here, snakeling" + - "
Example Syntax: follow, friendsnamehere" + - "
It's important to note that these will not take precedent over other swaps.", - position = 2, - section = "miscellaneousSection", - parse = true, - clazz = PrioParse.class, - method = "parse" - ) - default String prioEntry() - { - return ""; - } - - @ConfigItem( - keyName = "getSwapOffer", - name = "Offer-All", - description = "Swap 'Offer', on trades with 'Offer-All'", - position = 3, - section = "miscellaneousSection" - ) - default boolean getSwapOffer() - { - return false; - } - - @ConfigItem( - keyName = "swapCoalBag", - name = "Coal Bag", - description = "Makes Empty the left click option when in a bank", - position = 3, - section = "miscellaneousSection" - ) - default boolean swapCoalBag() - { - return true; - } - - @ConfigItem( - keyName = "swapBirdhouseEmpty", - name = "Birdhouse", - description = "Swap 'Interact' with 'Empty' for birdhouses on Fossil Island.", - position = 4, - section = "miscellaneousSection" - ) - default boolean swapBirdhouseEmpty() - { - return true; - } - - @ConfigItem( - keyName = "swapBones", - name = "Bury", - description = "Swap 'Bury' with 'Use' on Bones.", - position = 5, - section = "miscellaneousSection" - ) - default boolean swapBones() - { - return false; - } - - @ConfigItem( - keyName = "swapChase", - name = "Chase", - description = "Allows to left click your cat to chase rats.", - position = 6, - section = "miscellaneousSection" - ) - default boolean swapChase() - { - return true; - } - - @ConfigItem( - keyName = "swapHarpoon", - name = "Harpoon", - description = "Swap 'Cage', 'Big Net' with 'Harpoon' on Fishing spots.", - position = 7, - section = "miscellaneousSection" - ) - default boolean swapHarpoon() - { - return false; - } - - @ConfigItem( - keyName = "swapOccult", - name = "Occult Altar", - description = "Swap 'Venerate' with 'Ancient', 'Lunar', or 'Arceuus' on an Altar of the Occult.", - position = 8, - section = "miscellaneousSection" - ) - default boolean swapOccult() - { - return false; - } - - @ConfigItem( - keyName = "occultalter", - name = "Mode", - description = "", - position = 9, - section = "miscellaneousSection", - hidden = true, - unhide = "swapOccult" - ) - default OccultAltarMode swapOccultMode() - { - return OccultAltarMode.VENERATE; - } - - @ConfigItem( - keyName = "swapHomePortal", - name = "Home", - description = "Swap 'Enter' with 'Home', 'Build' or 'Friend's house' on Portal.", - position = 10, - section = "miscellaneousSection" - ) - default boolean swapHomePortal() - { - return false; - } - - @ConfigItem( - keyName = "home", - name = "Mode", - description = "", - position = 11, - section = "miscellaneousSection", - hidden = true, - unhide = "swapHomePortal" - ) - default HouseMode swapHomePortalMode() - { - return HouseMode.HOME; - } - - @ConfigItem( - keyName = "swapHouseAd", - name = "House Ad", - description = "Swap your house advertisement entries.", - position = 12, - section = "miscellaneousSection" - ) - default boolean swapHouseAd() - { - return false; - } - - @ConfigItem( - keyName = "swapHouseAdMode", - name = "Mode", - description = "", - position = 13, - section = "miscellaneousSection", - hidden = true, - unhide = "swapHouseAd" - ) - default HouseAdvertisementMode swapHouseAdMode() - { - return HouseAdvertisementMode.VIEW; - } - - @ConfigItem( - keyName = "swapPrivate", - name = "Private", - description = "Swap 'Shared' with 'Private' on the Chambers of Xeric storage units.", - position = 15, - section = "miscellaneousSection" - ) - default boolean swapPrivate() - { - return false; - } - - @ConfigItem( - keyName = "swapPick", - name = "Pick", - description = "Swap 'Pick' with 'Pick-lots' of the Gourd tree in the Chambers of Xeric.", - position = 15, - section = "miscellaneousSection" - ) - default boolean swapPick() - { - return false; - } - - @ConfigItem( - keyName = "swapQuick", - name = "Quick Pass/Open/Start/Travel", - description = "Swap 'Pass' with 'Quick-Pass', 'Open' with 'Quick-Open', 'Ring' with 'Quick-Start' and 'Talk-to' with 'Quick-Travel'.", - position = 16, - section = "miscellaneousSection" - ) - default boolean swapQuick() - { - return true; - } - - @ConfigItem( - keyName = "swapBoxTrap", - name = "Reset", - description = "Swap 'Check' with 'Reset' on box traps.", - position = 17, - section = "miscellaneousSection" - ) - default boolean swapBoxTrap() - { - return true; - } - - @ConfigItem( - keyName = "rockCake", - name = "Rock Cake Guzzle", - description = "Enables Left Click 'Guzzle' on the Dwarven Rock Cake.", - position = 18, - section = "miscellaneousSection" - ) - default boolean rockCake() - { - return false; - } - - @ConfigItem( - keyName = "swapRogueschests", - name = "Rogues Chests", - description = "Swap Rogues Chests from 'Open' to 'Search for traps'.", - position = 19, - section = "miscellaneousSection" - ) - default boolean swapRogueschests() - { - return true; - } - - @ConfigItem( - keyName = "swapClimbUpDown", - name = "Climb", - description = "Swap 'Climb-Up'/'Climb-Down' depending on Shift or Control key.", - position = 20, - section = "miscellaneousSection" - ) - default boolean swapClimbUpDown() - { - return false; - } - - @ConfigItem( - keyName = "swapStun", - name = "Stun Hoop Snakes", - description = "Swap 'Attack' with 'Stun'.", - position = 21, - section = "miscellaneousSection" - ) - default boolean swapStun() - { - return true; - } - - @ConfigItem( - keyName = "swapSearch", - name = "Search", - description = "Swap 'Close', 'Shut' with 'Search' on chests, cupboards, etc.", - position = 22, - section = "miscellaneousSection" - ) - default boolean swapSearch() - { - return true; - } - - @ConfigItem( - keyName = "swapHardWoodGrove", - name = "Hardwood Grove", - description = "Swap 'Quick-Pay(100)' and 'Send-Parcel' at Hardwood Grove.", - position = 23, - section = "miscellaneousSection" - ) - default boolean swapHardWoodGrove() - { - return true; - } - - - @ConfigItem( - keyName = "removeObjects", - name = "Remove Objects", - description = "Removes interaction with the listed objects.", - position = 24, - section = "miscellaneousSection" - ) - default boolean getRemoveObjects() - { - return false; - } - - @ConfigItem( - keyName = "removedObjects", - name = "Objects", - description = "Objects listed here will have all interaction be removed.", - position = 25, - section = "miscellaneousSection", - hidden = true, - unhide = "removeObjects" - ) - default String getRemovedObjects() - { - return ""; - } - - @ConfigItem( - keyName = "swapImps", - name = "Impling Jars", - description = "Don't open implings if bank has a clue.", - position = 26, - section = "miscellaneousSection" - ) - default boolean swapImps() - { - return false; - } - - //------------------------------------------------------------// - // Shop / Stores - //------------------------------------------------------------// - - @ConfigItem( - keyName = "swapBuyOne", - name = "Buy One", - description = "", - position = 0, - section = "shopStoresSection" - ) - default boolean getSwapBuyOne() - { - return false; - } - - @ConfigItem( - keyName = "buyOneItems", - name = "Items", - description = "", - section = "shopStoresSection", - position = 1, - hidden = true, - unhide = "swapBuyOne" - ) - default String getBuyOneItems() - { - return ""; - } - - @ConfigItem( - keyName = "swapBuyFive", - name = "Buy Five", - description = "", - position = 2, - section = "shopStoresSection" - ) - default boolean getSwapBuyFive() - { - return false; - } - - @ConfigItem( - keyName = "buyFiveItems", - name = "Items", - description = "", - position = 3, - section = "shopStoresSection", - hidden = true, - unhide = "swapBuyFive" - ) - default String getBuyFiveItems() - { - return ""; - } - - @ConfigItem( - keyName = "swapBuyTen", - name = "Buy Ten", - description = "", - position = 4, - section = "shopStoresSection" - ) - default boolean getSwapBuyTen() - { - return false; - } - - @ConfigItem( - keyName = "buyTenItems", - name = "Items", - description = "", - position = 5, - section = "shopStoresSection", - hidden = true, - unhide = "swapBuyTen" - ) - default String getBuyTenItems() - { - return ""; - } - - @ConfigItem( - keyName = "swapBuyFifty", - name = "Buy Fifty", - description = "", - position = 6, - section = "shopStoresSection" - ) - default boolean getSwapBuyFifty() - { - return false; - } - - @ConfigItem( - keyName = "buyFiftyItems", - name = "Items", - description = "", - position = 7, - section = "shopStoresSection", - hidden = true, - unhide = "swapBuyFifty" - ) - default String getBuyFiftyItems() - { - return ""; - } - - @ConfigItem( - keyName = "swapSellOne", - name = "Sell One", - description = "", - position = 8, - section = "shopStoresSection" - ) - default boolean getSwapSellOne() - { - return false; - } - - @ConfigItem( - keyName = "sellOneItems", - name = "Items", - description = "", - position = 9, - section = "shopStoresSection", - hidden = true, - unhide = "swapSellOne" - ) - default String getSellOneItems() - { - return ""; - } - - @ConfigItem( - keyName = "swapSellFive", - name = "Sell Five", - description = "", - position = 10, - section = "shopStoresSection" - ) - default boolean getSwapSellFive() - { - return false; - } - - @ConfigItem( - keyName = "sellFiveItems", - name = "Items", - description = "", - position = 11, - section = "shopStoresSection", - hidden = true, - unhide = "swapSellFive" - ) - default String getSellFiveItems() - { - return ""; - } - - @ConfigItem( - keyName = "swapSellTen", - name = "Sell Ten", - description = "", - position = 12, - section = "shopStoresSection" - ) - default boolean getSwapSellTen() - { - return false; - } - - @ConfigItem( - keyName = "sellTenItems", - name = "Items", - description = "", - position = 13, - section = "shopStoresSection", - hidden = true, - unhide = "swapSellTen" - ) - default String getSellTenItems() - { - return ""; - } - - @ConfigItem( - keyName = "swapSellFifty", - name = "Sell Fifty", - description = "", - position = 14, - section = "shopStoresSection" - ) - default boolean getSwapSellFifty() - { - return false; - } - - @ConfigItem( - keyName = "sellFiftyItems", - name = "Items", - description = "", - position = 15, - section = "shopStoresSection", - hidden = true, - unhide = "swapSellFifty" - ) - default String getSellFiftyItems() - { - return ""; - } - - //------------------------------------------------------------// - // Skilling - //------------------------------------------------------------// - - @ConfigItem( - keyName = "getEasyConstruction", - name = "Easy Construction", - description = "Makes 'Remove'/'Build' the default option for listed items.", - position = 0, - section = "skillingSection" - ) - default boolean getEasyConstruction() - { - return true; - } - - @ConfigItem( - keyName = "getConstructionMode", - name = "EZ Construction Type", - description = "", - position = 1, - section = "skillingSection", - hidden = true, - unhide = "getEasyConstruction" - ) - default ConstructionMode getConstructionMode() - { - return ConstructionMode.LARDER; - } - - @ConfigItem( - keyName = "swapTanning", - name = "Tanning", - description = "Enables swapping of 'Tan-1' and 'Tan-all' options.", - position = 2, - section = "skillingSection" - ) - default boolean getSwapTanning() - { - return false; - } - - @ConfigItem( - keyName = "swapSawmill", - name = "Sawmill Operator", - description = "Makes 'Buy-plank' the default option on the Sawmill Operator.", - position = 3, - section = "skillingSection" - ) - default boolean getSwapSawmill() - { - return false; - } - - @ConfigItem( - keyName = "swapSawmillPlanks", - name = "Buy Planks", - description = "Makes 'Buy All' the default option when buying planks.", - position = 4, - section = "skillingSection" - ) - default boolean getSwapSawmillPlanks() - { - return false; - } - - @ConfigItem( - keyName = "swapPuroPuro", - name = "Puro-Puro Wheat", - description = "", - position = 5, - section = "skillingSection" - ) - default boolean getSwapPuro() - { - return false; - } - - @ConfigItem( - keyName = "swapGrimyHerb", - name = "Grimy Herbs", - description = "", - position = 6, - section = "skillingSection" - ) - default boolean getSwapGrimyHerb() - { - return false; - } - - @ConfigItem( - keyName = "swapGrimyHerbMode", - name = "Mode", - description = "", - position = 7, - section = "skillingSection", - hidden = true, - unhide = "swapGrimyHerb" - ) - default SwapGrimyHerbMode swapGrimyHerbMode() - { - return SwapGrimyHerbMode.DYNAMIC; - } - - //------------------------------------------------------------// - // Talk-To - //------------------------------------------------------------// - - @ConfigItem( - keyName = "swapAssignment", - name = "Assignment", - description = "Swap 'Talk-to' with 'Assignment' for Slayer Masters. This will take priority over swapping Trade.", - position = 0, - section = "talkSection" - ) - default boolean swapAssignment() - { - return true; - } - - @ConfigItem( - keyName = "swapBankExchange", - name = "Bank/Exchange", - description = "Swap Talk-to with Bank or Exchange on NPC
Example: Banker, Grand Exchange Clerk, Tool Leprechaun, Void Knight", - position = 1, - section = "talkSection" - ) - default boolean swapBankExchange() - { - return true; - } - - @ConfigItem( - keyName = "swapContract", - name = "Contract", - description = "Swap 'Talk-to' with 'Contract' on Guildmaster Jane.", - position = 2, - section = "talkSection" - ) - default boolean swapContract() - { - return true; - } - - - @ConfigItem( - keyName = "swapInteract", - name = "Interact", - description = "Swap options for generic interactions on NPCs
Example: Decant for Bob Barter, Repairs for Dark Mage, Claim Slime for Robin, Claim Dynamite", - position = 3, - section = "talkSection" - ) - default boolean swapInteract() - { - return false; - } - - @ConfigItem( - keyName = "swapPickpocket", - name = "Pickpocket", - description = "Swap Talk-to with Pickpocket on NPC
Example: Man, Woman", - position = 4, - section = "talkSection" - ) - default boolean swapPickpocket() - { - return true; - } - - @ConfigItem( - keyName = "swapPay", - name = "Pay", - description = "Swap 'Talk-to' with 'Pay' on various NPCs.
Example: Elstan, Heskel, Fayeth.", - position = 5, - section = "talkSection" - ) - default boolean swapPay() - { - return true; - } - - @ConfigItem( - keyName = "swapAbyssTeleport", - name = "Teleport to Abyss", - description = "Swap 'Talk-to' with 'Teleport' for the Mage of Zamorak.", - position = 6, - section = "talkSection" - ) - default boolean swapAbyssTeleport() - { - return true; - } - - @ConfigItem( - keyName = "swapTrade", - name = "Trade", - description = "Swap 'Talk-to' with 'Trade' on various NPCs.
Example: Shop keeper, Shop assistant.", - position = 7, - section = "talkSection" - ) - default boolean swapTrade() - { - return true; - } - - @ConfigItem( - keyName = "swapTravel", - name = "Travel", - description = "Swap 'Talk-to' with 'Travel', 'Take-boat', 'Pay-fare', 'Charter' on various NPCs.
Example: Squire, Monk of Entrana, Customs officer, Trader Crewmember.", - position = 8, - section = "talkSection" - ) - default boolean swapTravel() - { - return true; - } - - @ConfigItem( - keyName = "swapMinigame", - name = "Minigames", - description = "Swap Talk-to with Start-Minigame, Story, Dream on NPC
Example: Guardian mummy, Juna, Dominic Onion", - position = 9, - section = "talkSection" - ) - default boolean swapMinigame() - { - return true; - } - - @ConfigItem( - keyName = "swapPlank", - name = "Buy Planks", - description = "Swap 'Talk-to' with 'Buy-planks' at the Lumber Yard.", - position = 10, - section = "talkSection" - ) - default boolean swapPlank() - { - return true; - } - - @ConfigItem( - keyName = "swapMetamorphosis", - name = "Metamorphosis", - description = "Swap 'Talk-to' with 'Metamorphosis' for Baby Chinchompa pet.", - position = 11, - section = "talkSection" - ) - default boolean swapMetamorphosis() - { - return false; - } - - @ConfigItem( - keyName = "swapEnchant", - name = "Enchant", - description = "Swap Talk-to with Enchant for Eluned", - position = 12, - section = "talkSection" - ) - default boolean swapEnchant() - { - return true; - } - - //------------------------------------------------------------// - // Teleportation - //------------------------------------------------------------// - - @ConfigItem( - keyName = "swapFairyRing", - name = "Fairy Ring", - description = "Swap 'Zanaris' with 'Last-destination' or 'Configure' on Fairy rings.", - position = 0, - section = "teleportationSection" - ) - default boolean swapFairyRing() - { - return false; - } - - @ConfigItem( - keyName = "fairyring", - name = "Mode", - description = "", - position = 1, - section = "teleportationSection", - hidden = true, - unhide = "swapFairyRing" - ) - default FairyRingMode swapFairyRingMode() - { - return FairyRingMode.LAST_DESTINATION; - } - - @ConfigItem( - keyName = "swapFairyTree", - name = "Fairy Tree", - description = "Swap options on PoH Fairy Tree", - position = 2, - section = "teleportationSection" - ) - default boolean swapFairyTree() - { - return false; - } - - @ConfigItem( - keyName = "fairyTree", - name = "Mode", - description = "", - position = 3, - section = "teleportationSection", - hidden = true, - unhide = "swapFairyTree" - ) - default FairyTreeMode swapFairyTreeMode() - { - return FairyTreeMode.RING_LAST_DESTINATION; - } - - @ConfigItem( - keyName = "swapObelisk", - name = "Obelisk", - description = "Swap the options on wilderness obelisks between 'Activate', 'Set destination' or 'Teleport to destination'.", - position = 4, - section = "teleportationSection" - ) - default boolean swapObelisk() - { - return false; - } - - @ConfigItem( - keyName = "obelisk", - name = "Mode", - description = "", - position = 5, - section = "teleportationSection", - hidden = true, - unhide = "swapObelisk" - ) - default ObeliskMode swapObeliskMode() - { - return ObeliskMode.ACTIVATE; - } - - @ConfigItem( - keyName = "swapTeleportItem", - name = "Teleport Items", - description = "Swap 'Wear' or 'Wield' with 'Rub' or 'Teleport' on teleport items.
Example: Amulet of glory, Explorer's ring, Chronicle.", - position = 6, - section = "teleportationSection" - ) - default boolean swapTeleportItem() - { - return false; - } - - @ConfigItem( - keyName = "swapWildernessLever", - name = "Wilderness Lever", - description = "Swap the wilderness lever left click to be Edgeville/Ardougne.", - position = 7, - section = "teleportationSection" - ) - default boolean swapWildernessLever() - { - return true; - } - - @ConfigItem( - keyName = "swapNexus", - name = "Portal Nexus", - description = "Makes the teleport menu have priority over the left click destination on the portal nexus.", - position = 8, - section = "teleportationSection" - ) - default boolean swapNexus() - { - return true; - } - - @ConfigItem( - keyName = "swapGamesNecklace", - name = "Games Necklace", - description = "Swap the left click 'remove' option with the desired teleport location on a worn Games Necklace.", - position = 9, - section = "teleportationSection" - ) - default boolean getGamesNecklace() - { - return false; - } - - @ConfigItem( - keyName = "gamesNecklaceMode", - name = "Mode", - description = "", - position = 10, - section = "teleportationSection", - hidden = true, - unhide = "swapGamesNecklace" - ) - default GamesNecklaceMode getGamesNecklaceMode() - { - return GamesNecklaceMode.BURTHORPE; - } - - @ConfigItem( - keyName = "swapDuelingRing", - name = "Dueling Ring", - description = "Swap the left click 'remove' option with the desired teleport location on a worn Ring of Dueling.", - position = 11, - section = "teleportationSection" - ) - default boolean getDuelingRing() - { - return false; - } - - @ConfigItem( - keyName = "duelingRingMode", - name = "Mode", - description = "", - position = 12, - section = "teleportationSection", - hidden = true, - unhide = "swapDuelingRing" - ) - default DuelingRingMode getDuelingRingMode() - { - return DuelingRingMode.DUEL_ARENA; - } - - @ConfigItem( - keyName = "swapGlory", - name = "Glory", - description = "Swap the left click 'remove' option with the desired teleport location on a worn Amulet of Glory / Amulet of Eternal Glory.", - position = 13, - section = "teleportationSection" - ) - default boolean getGlory() - { - return false; - } - - @ConfigItem( - keyName = "gloryMode", - name = "Mode", - description = "", - position = 14, - section = "teleportationSection", - hidden = true, - unhide = "swapGlory" - ) - default GloryMode getGloryMode() - { - return GloryMode.EDGEVILLE; - } - - @ConfigItem( - keyName = "swapSkill", - name = "Skills Necklace", - description = "Swap the left click 'remove' option with the desired teleport location on a worn Skills Necklace.", - position = 15, - section = "teleportationSection" - ) - default boolean getSkillsNecklace() - { - return false; - } - - @ConfigItem( - keyName = "skillsnecklacemode", - name = "Mode", - description = "", - position = 16, - section = "teleportationSection", - hidden = true, - unhide = "swapSkill" - ) - default SkillsNecklaceMode getSkillsNecklaceMode() - { - return SkillsNecklaceMode.FARMING_GUILD; - } - - @ConfigItem( - keyName = "swapPassage", - name = "Passage Necklace", - description = "Swap the left click 'remove' option with the desired teleport location on a worn Necklace of Passage.", - position = 17, - section = "teleportationSection" - ) - default boolean getNecklaceofPassage() - { - return false; - } - - @ConfigItem( - keyName = "necklaceofpassagemode", - name = "Mode", - description = "", - position = 18, - section = "teleportationSection", - hidden = true, - unhide = "swapPassage" - ) - default NecklaceOfPassageMode getNecklaceofPassageMode() - { - return NecklaceOfPassageMode.WIZARDS_TOWER; - } - - @ConfigItem( - keyName = "swapDigsite", - name = "Digsite Pendant", - description = "Swap the left click 'remove' option with the desired teleport location on a worn Digsite Pendant.", - position = 19, - section = "teleportationSection" - ) - default boolean getDigsitePendant() - { - return false; - } - - @ConfigItem( - keyName = "digsitependantmode", - name = "Mode", - description = "", - position = 20, - section = "teleportationSection", - hidden = true, - unhide = "swapDigsite" - ) - default DigsitePendantMode getDigsitePendantMode() - { - return DigsitePendantMode.FOSSIL_ISLAND; - } - - @ConfigItem( - keyName = "swapCombat", - name = "Combat Bracelet", - description = "Swap the left click 'remove' option with the desired teleport location on a worn Combat Bracelet.", - position = 21, - section = "teleportationSection" - ) - default boolean getCombatBracelet() - { - return false; - } - - @ConfigItem( - keyName = "combatbraceletmode", - name = "Mode", - description = "", - position = 22, - section = "teleportationSection", - hidden = true, - unhide = "swapCombat" - ) - default CombatBraceletMode getCombatBraceletMode() - { - return CombatBraceletMode.WARRIORS_GUILD; - } - - @ConfigItem( - keyName = "swapburning", - name = "Burning Amulet", - description = "Swap the left click 'remove' option with the desired teleport location on a worn Burning Amulet.", - position = 23, - section = "teleportationSection" - ) - default boolean getBurningAmulet() - { - return false; - } - - @ConfigItem( - keyName = "burningamuletmode", - name = "Mode", - description = "", - position = 24, - section = "teleportationSection", - hidden = true, - unhide = "swapburning" - ) - default BurningAmuletMode getBurningAmuletMode() - { - return BurningAmuletMode.BANDIT_CAMP; - } - - @ConfigItem( - keyName = "swapxeric", - name = "Xeric's Talisman", - description = "Swap the left click 'remove' option with the desired teleport location on a worn Xeric's Talisman.", - position = 25, - section = "teleportationSection" - ) - default boolean getXericsTalisman() - { - return false; - } - - @ConfigItem( - keyName = "xericstalismanmode", - name = "Mode", - description = "", - position = 26, - section = "teleportationSection", - hidden = true, - unhide = "swapxeric" - ) - default XericsTalismanMode getXericsTalismanMode() - { - return XericsTalismanMode.XERICS_LOOKOUT; - } - - @ConfigItem( - keyName = "swapwealth", - name = "Ring of Wealth", - description = "Swap the left click 'remove' option with the desired teleport location on a worn Ring of Wealth.", - position = 27, - section = "teleportationSection" - ) - default boolean getRingofWealth() - { - return false; - } - - @ConfigItem( - keyName = "ringofwealthmode", - name = "Mode", - description = "", - position = 28, - section = "teleportationSection", - hidden = true, - unhide = "swapwealth" - ) - default RingOfWealthMode getRingofWealthMode() - { - return RingOfWealthMode.GRAND_EXCHANGE; - } - - @ConfigItem( - keyName = "swapslayer", - name = "Slayer Ring", - description = "", - position = 29, - section = "teleportationSection" - ) - default boolean getSlayerRing() - { - return false; - } - - @ConfigItem( - keyName = "slayerringmode", - name = "Mode", - description = "", - position = 30, - section = "teleportationSection", - hidden = true, - unhide = "swapslayer" - ) - default SlayerRingMode getSlayerRingMode() - { - return SlayerRingMode.CHECK; - } - - @ConfigItem( - keyName = "swapJewelleryBox", - name = "Jewellery Box", - description = "Swap Teleport Menu with previous destination on Jewellery Box", - position = 31, - section = "teleportationSection" - ) - default boolean swapJewelleryBox() - { - return false; - } - - //------------------------------------------------------------// - // Right Click Options - //------------------------------------------------------------// - - @ConfigItem( - keyName = "hideExamine", - name = "Examine", - description = "Hides the 'Examine' option from the right click menu.", - position = 0, - section = "rightClickOptionsSection" - ) - default boolean hideExamine() - { - return false; - } - - @ConfigItem( - keyName = "hideTradeWith", - name = "Trade With", - description = "Hides the 'Trade with' option from the right click menu.", - position = 1, - section = "rightClickOptionsSection" - ) - default boolean hideTradeWith() - { - return false; - } - - @ConfigItem( - keyName = "hideReport", - name = "Report", - description = "Hides the 'Report' option from the right click menu.", - position = 2, - section = "rightClickOptionsSection" - ) - default boolean hideReport() - { - return false; - } - - @ConfigItem( - keyName = "hideLookup", - name = "Lookup", - description = "Hides the 'Lookup' option from the right click menu.", - position = 3, - section = "rightClickOptionsSection" - ) - default boolean hideLookup() - { - return false; - } - - @ConfigItem( - keyName = "hideNet", - name = "Net", - description = "Hides the 'Net' option from the right click menu.", - position = 4, - section = "rightClickOptionsSection" - ) - default boolean hideNet() - { - return false; - } - - @ConfigItem( - keyName = "hideBait", - name = "Bait", - description = "Hides the 'Bait' option from the right click menu.", - position = 5, - section = "rightClickOptionsSection" - ) - default boolean hideBait() - { - return false; - } - - //------------------------------------------------------------// - // Untradeables - //------------------------------------------------------------// - - @ConfigItem( - keyName = "hideDestroyRunepouch", - name = "Destroy on Rune Pouch", - description = "Hides the 'Destroy' option when right clicking a Rune pouch.", - position = 0, - section = "untradeablesSection" - ) - default boolean hideDestroyRunepouch() - { - return false; - } - - @ConfigItem( - keyName = "hideDestroyCoalbag", - name = "Destroy on Coal bag", - description = "Hides the 'Destroy' option when right clicking a Coal bag.", - position = 1, - section = "untradeablesSection" - ) - default boolean hideDestroyCoalbag() - { - return false; - } - - @ConfigItem( - keyName = "hideDestroyHerbsack", - name = "Destroy on Herb sack", - description = "Hides the 'Destroy' option when right clicking a Herb sack.", - position = 2, - section = "untradeablesSection" - ) - default boolean hideDestroyHerbsack() - { - return false; - } - - @ConfigItem( - keyName = "hideDestroyBoltpouch", - name = "Destroy on Bolt pouch", - description = "Hides the 'Destroy' option when right clicking a Bolt pouch.", - position = 3, - section = "untradeablesSection" - ) - default boolean hideDestroyBoltpouch() - { - return false; - } - - @ConfigItem( - keyName = "hideDestroyGembag", - name = "Destroy on Gem bag", - description = "Hides the 'Destroy' option when right clicking a Gem bag.", - position = 4, - section = "untradeablesSection" - ) - default boolean hideDestroyGembag() - { - return false; - } - - @ConfigItem( - keyName = "hideDestroyLootingBag", - name = "Destroy on Looting bag", - description = "Hides the 'Destroy' option when right clicking a Looting bag.", - position = 5, - section = "untradeablesSection" - ) - default boolean hideDestroyLootingBag() - { - return false; - } - - @ConfigItem( - keyName = "hideDropRunecraftingPouch", - name = "Drop on RC pouches", - description = "Hides the 'Drop' option when right clicking a Small, Medium, Large, or Giant pouch.", - position = 6, - section = "untradeablesSection" - ) - default boolean hideDropRunecraftingPouch() - { - return false; - } - - //------------------------------------------------------------// - // PVM - //------------------------------------------------------------// - - @ConfigItem( - keyName = "hideCastToB", - name = "Hide cast in ToB", - description = "Hides the cast option for clanmates and friends in ToB", - position = 0, - section = "pvmSection" - ) - - default boolean hideCastToB() - { - return true; - } - - @ConfigItem( - keyName = "hideCastIgnoredToB", - name = "Ignored spells", - description = "Spells that should not be hidden from being cast, separated by a comma", - position = 1, - section = "pvmSection", - hidden = true, - unhide = "hideCastToB" - ) - default String hideCastIgnoredToB() - { - return "cure other, energy transfer, heal other, vengeance other"; - } - - @ConfigItem( - keyName = "hideCastCoX", - name = "Hide cast in CoX", - description = "Hides the cast option for clanmates and friends in CoX", - position = 2, - section = "pvmSection" - ) - - default boolean hideCastCoX() - { - return true; - } - - @ConfigItem( - keyName = "hideCastIgnoredCoX", - name = "Ignored spells", - description = "Spells that should not be hidden from being cast, separated by a comma", - position = 3, - section = "pvmSection", - hidden = true, - unhide = "hideCastCoX" - ) - default String hideCastIgnoredCoX() - { - return "cure other, energy transfer, heal other, vengeance other"; - } - - //------------------------------------------------------------// - // HotKey menu swaps - //------------------------------------------------------------// - - @ConfigItem( - keyName = "hotkeyMod", - name = "Hotkey for Swaps", - description = "Set this hotkey to do custom swaps on hotkeys.", - position = 0, - section = "hotkeySwapping" - ) - default Keybind hotkeyMod() - { - return Keybind.SHIFT; - } - - @ConfigItem( - keyName = "shiftCustomSwaps", - name = "Hotkey Swaps", - description = "Add custom swaps here that will only be activated when you press your hotkey." + - "
1 per line. Syntax: option,target:priority" + - "
Note that the higher your set the priority, the more it will overtake over swaps.", - position = 1, - section = "hotkeySwapping", - parse = true, - clazz = CustomSwapParse.class, - method = "parse" - ) - default String shiftCustomSwaps() - { - return ""; - } - - @ConfigItem( - keyName = "swapNpcContact", - name = "NPC Contact", - description = "Enables Hotkey Left Click NPC Contact With Last Contacted NPC.", - position = 2, - section = "hotkeySwapping" - ) - default boolean swapNpcContact() - { - return false; - } - - @ConfigItem( - keyName = "bankWieldItem", - name = "Bank - Left Click 'Wield'", - description = "Enables Hotkey Left Click 'Wield' In The Bank Screen.", - position = 3, - section = "hotkeySwapping" - ) - default boolean bankWieldItem() - { - return false; - } - - @ConfigItem( - keyName = "bankWearItem", - name = "Bank - Left Click 'Wear'", - description = "Enables Hotkey Left Click 'Wear' In The Bank Screen.", - position = 4, - section = "hotkeySwapping" - ) - default boolean bankWearItem() - { - return false; - } - - @ConfigItem( - keyName = "bankEatItem", - name = "Bank - Left Click 'Eat'", - description = "Enables Left Click 'Eat' In The Bank Screen.", - position = 5, - section = "hotkeySwapping" - ) - default boolean bankEatItem() - { - return false; - } - - @ConfigItem( - keyName = "bankDrinkItem", - name = "Bank - Left Click 'Drink'", - description = "Enables Left Click 'Drink' In The Bank Screen.", - position = 6, - section = "hotkeySwapping" - ) - default boolean bankDrinkItem() - { - return false; - } - - @ConfigItem( - keyName = "bankEquipItem", - name = "Bank - Left Click 'Equip'", - description = "Enables Left Click 'Equip' In The Bank Screen.", - position = 7, - section = "hotkeySwapping" - ) - default boolean bankEquipItem() - { - return false; - } - - @ConfigItem( - keyName = "bankInvigorateItem", - name = "Bank - Left Click 'Invigorate'", - description = "Enables Left Click 'Invigorate' In The Bank Screen.", - position = 8, - section = "hotkeySwapping" - ) - default boolean bankInvigorateItem() - { - return false; - } - - @ConfigItem( - keyName = "hotKeyWalk", - name = "Hotkey to Walk", - description = "For when you want Walk here as a priority", - position = 9, - section = "hotkeySwapping" - ) - default boolean hotKeyWalk() - { - return false; - } - - @ConfigItem( - keyName = "hotKeyLoot", - name = "Hotkey to Loot", - description = "For when people stand on your loot", - position = 10, - section = "hotkeySwapping" - ) - default boolean hotKeyLoot() - { - return false; - } -} 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 deleted file mode 100644 index 5a15504b65..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java +++ /dev/null @@ -1,2134 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * Copyright (c) 2018, Kamiel - * Copyright (c) 2019, alanbaumgartner - * Copyright (c) 2019, Kyle - * Copyright (c) 2019, Lucas - * 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.menuentryswapper; - -import com.google.common.base.Splitter; -import com.google.common.base.Strings; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Sets; -import com.google.inject.Provides; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Setter; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.MenuEntry; -import net.runelite.api.MenuOpcode; -import static net.runelite.api.MenuOpcode.MENU_ACTION_DEPRIORITIZE_OFFSET; -import static net.runelite.api.MenuOpcode.WALK; -import net.runelite.api.NPC; -import net.runelite.api.Player; -import net.runelite.api.Varbits; -import static net.runelite.api.Varbits.BUILDING_MODE; -import static net.runelite.api.Varbits.WITHDRAW_X_AMOUNT; -import net.runelite.api.WorldType; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.ClientTick; -import net.runelite.api.events.FocusChanged; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.MenuOpened; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.util.Text; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.config.Keybind; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.input.KeyManager; -import net.runelite.client.menus.AbstractComparableEntry; -import static net.runelite.client.menus.ComparableEntries.newBankComparableEntry; -import static net.runelite.client.menus.ComparableEntries.newBaseComparableEntry; -import net.runelite.client.menus.MenuManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDependency; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginManager; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.menuentryswapper.comparables.BankComparableEntry; -import net.runelite.client.plugins.menuentryswapper.comparables.EquipmentComparableEntry; -import net.runelite.client.plugins.menuentryswapper.comparables.GrimyHerbComparableEntry; -import net.runelite.client.plugins.menuentryswapper.comparables.InventoryComparableEntry; -import net.runelite.client.plugins.menuentryswapper.comparables.ShopComparableEntry; -import net.runelite.client.plugins.menuentryswapper.comparables.WithdrawComparableEntry; -import net.runelite.client.plugins.menuentryswapper.util.ArdougneCloakMode; -import net.runelite.client.plugins.menuentryswapper.util.BurningAmuletMode; -import net.runelite.client.plugins.menuentryswapper.util.CombatBraceletMode; -import net.runelite.client.plugins.menuentryswapper.util.ConstructionCapeMode; -import net.runelite.client.plugins.menuentryswapper.util.ConstructionMode; -import net.runelite.client.plugins.menuentryswapper.util.DigsitePendantMode; -import net.runelite.client.plugins.menuentryswapper.util.DuelingRingMode; -import net.runelite.client.plugins.menuentryswapper.util.FairyRingMode; -import net.runelite.client.plugins.menuentryswapper.util.FairyTreeMode; -import net.runelite.client.plugins.menuentryswapper.util.GamesNecklaceMode; -import net.runelite.client.plugins.menuentryswapper.util.GloryMode; -import net.runelite.client.plugins.menuentryswapper.util.HouseAdvertisementMode; -import net.runelite.client.plugins.menuentryswapper.util.HouseMode; -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.SwapGrimyHerbMode; -import net.runelite.client.plugins.menuentryswapper.util.XericsTalismanMode; -import net.runelite.client.plugins.pvptools.PvpToolsConfig; -import net.runelite.client.plugins.pvptools.PvpToolsPlugin; -import net.runelite.client.util.HotkeyListener; -import static net.runelite.client.util.MenuUtil.swap; - -@PluginDescriptor( - name = "Menu Entry Swapper", - description = "Change the default option that is displayed when hovering over objects", - tags = {"npcs", "inventory", "items", "objects"}, - type = PluginType.UTILITY, - enabledByDefault = false -) -@Singleton -@PluginDependency(PvpToolsPlugin.class) -public class MenuEntrySwapperPlugin extends Plugin -{ - private static final Object HOTKEY = new Object(); - private static final Object CONTROL = new Object(); - private static final Object HOTKEY_CHECK = new Object(); - private static final Object CONTROL_CHECK = new Object(); - private static final int PURO_PURO_REGION_ID = 10307; - private static final Set NPC_MENU_TYPES = ImmutableSet.of( - MenuOpcode.NPC_FIRST_OPTION, MenuOpcode.NPC_SECOND_OPTION, MenuOpcode.NPC_THIRD_OPTION, - MenuOpcode.NPC_FOURTH_OPTION, MenuOpcode.NPC_FIFTH_OPTION, MenuOpcode.EXAMINE_NPC - ); - private static final List jewelleryBox = Arrays.asList( - "duel arena", "castle wars", "clan wars", "burthorpe", "barbarian outpost", "corporeal beast", - "tears of guthix", "wintertodt camp", "warriors' guild", "champions' guild", "monastery", "ranging guild", - "fishing guild", "mining guild", "crafting guild", "cooking guild", "woodcutting guild", "farming guild", - "miscellania", "grand exchange", "falador park", "dondakan's rock", "edgeville", "karamja", - "draynor village", "al kharid" - ); - private static final List npcContact = Arrays.asList( - "honest jimmy", "bert the sandman", "advisor ghrim", "dark mage", "lanthus", "turael", - "mazchna", "vannaka", "chaeldar", "nieve", "steve", "duradel", "krystilia", "konar", - "murphy", "cyrisus", "smoggy", "ginea", "watson", "barbarian guard", "random" - ); - - private static final AbstractComparableEntry WALK = new AbstractComparableEntry() - { - private final int hash = "WALK".hashCode() * 79 + getPriority(); - - @Override - public int hashCode() - { - return hash; - } - - @Override - public boolean equals(Object entry) - { - return entry.getClass() == this.getClass() && entry.hashCode() == this.hashCode(); - } - - @Override - public int getPriority() - { - return 99; - } - - @Override - public boolean matches(MenuEntry entry) - { - return - entry.getOpcode() == MenuOpcode.WALK.getId() || - entry.getOpcode() == MenuOpcode.WALK.getId() + MenuOpcode.MENU_ACTION_DEPRIORITIZE_OFFSET; - } - }; - - private static final AbstractComparableEntry TAKE = new AbstractComparableEntry() - { - private final int hash = "TAKE".hashCode() * 79 + getPriority(); - - @Override - public int hashCode() - { - return hash; - } - - @Override - public boolean equals(Object entry) - { - return entry.getClass() == this.getClass() && entry.hashCode() == this.hashCode(); - } - - @Override - public int getPriority() - { - return 100; - } - - @Override - public boolean matches(MenuEntry entry) - { - int opcode = entry.getOpcode(); - if (opcode > MenuOpcode.MENU_ACTION_DEPRIORITIZE_OFFSET) - { - opcode -= MenuOpcode.MENU_ACTION_DEPRIORITIZE_OFFSET; - } - - return - opcode >= MenuOpcode.GROUND_ITEM_FIRST_OPTION.getId() && - opcode <= MenuOpcode.GROUND_ITEM_FIFTH_OPTION.getId(); - } - }; - - private static final Splitter NEWLINE_SPLITTER = Splitter - .on("\n") - .omitEmptyStrings() - .trimResults(); - private final Map customSwaps = new HashMap<>(); - private final Map customShiftSwaps = new HashMap<>(); - private final Map dePrioSwaps = new HashMap<>(); - // 1, 5, 10, 50 - private final AbstractComparableEntry[][] buyEntries = new AbstractComparableEntry[4][]; - private final AbstractComparableEntry[][] sellEntries = new AbstractComparableEntry[4][]; - // 1, 5, 10, X, All - private final AbstractComparableEntry[][] withdrawEntries = new AbstractComparableEntry[5][]; - @Inject - private Client client; - @Inject - private ClientThread clientThread; - @Inject - private MenuEntrySwapperConfig config; - @Inject - private PluginManager pluginManager; - @Inject - private MenuManager menuManager; - @Inject - private KeyManager keyManager; - @Inject - private EventBus eventBus; - @Inject - private PvpToolsPlugin pvpTools; - @Inject - private PvpToolsConfig pvpToolsConfig; - private boolean buildingMode; - private boolean inTobRaid = false; - private boolean inCoxRaid = false; - @Setter(AccessLevel.PRIVATE) - private boolean hotkeyActive; - @Setter(AccessLevel.PRIVATE) - private boolean controlActive; - private String[] removedObjects; - - private List bankItemNames = new ArrayList<>(); - private BurningAmuletMode getBurningAmuletMode; - private CombatBraceletMode getCombatBraceletMode; - private ArdougneCloakMode ardougneCloakMode; - private ConstructionCapeMode constructionCapeMode; - private ConstructionMode getConstructionMode; - private DigsitePendantMode getDigsitePendantMode; - private DuelingRingMode getDuelingRingMode; - private FairyRingMode swapFairyRingMode; - private FairyTreeMode swapFairyTreeMode; - private GamesNecklaceMode getGamesNecklaceMode; - private GloryMode getGloryMode; - private HouseAdvertisementMode swapHouseAdMode; - private HouseMode swapHomePortalMode; - private Keybind hotkeyMod; - private MaxCapeMode maxMode; - private NecklaceOfPassageMode getNecklaceofPassageMode; - private ObeliskMode swapObeliskMode; - private OccultAltarMode swapOccultMode; - private QuestCapeMode questCapeMode; - private RingOfWealthMode getRingofWealthMode; - private SwapGrimyHerbMode swapGrimyHerbMode; - private Set hideCastIgnoredCoX; - private Set hideCastIgnoredToB; - private SkillsNecklaceMode getSkillsNecklaceMode; - private SlayerRingMode getSlayerRingMode; - private String configCustomShiftSwaps; - private String configCustomSwaps; - private XericsTalismanMode getXericsTalismanMode; - private boolean getBurningAmulet; - private boolean getCombatBracelet; - private boolean getDigsitePendant; - private boolean getDuelingRing; - private boolean getEasyConstruction; - private boolean getGamesNecklace; - private boolean getGlory; - private boolean getNecklaceofPassage; - private boolean getRingofWealth; - private boolean getSkillsNecklace; - private boolean getSlayerRing; - private boolean getSwapArdougneCloak; - private boolean getSwapConstructionCape; - private boolean getSwapCraftingCape; - private boolean getSwapExplorersRing; - private boolean getSwapMagicCape; - private boolean getSwapPuro; - private boolean getSwapGrimyHerb; - private boolean getSwapSawmill; - private boolean getSwapSawmillPlanks; - private boolean getSwapTanning; - private boolean getXericsTalisman; - private boolean hideBait; - private boolean hideCastCoX; - private boolean hideCastToB; - private boolean hideDestroyBoltpouch; - private boolean hideDestroyCoalbag; - private boolean hideDestroyGembag; - private boolean hideDestroyHerbsack; - private boolean hideDestroyLootingBag; - private boolean hideDestroyRunepouch; - private boolean hideDropRunecraftingPouch; - private boolean hideExamine; - private boolean hideLookup; - private boolean hideNet; - private boolean hideReport; - private boolean hideTradeWith; - private boolean rockCake; - private boolean swapAbyssTeleport; - private boolean swapAdmire; - private boolean swapAssignment; - private boolean swapBankExchange; - private boolean swapBirdhouseEmpty; - private boolean swapBones; - private boolean swapBoxTrap; - private boolean swapChase; - private boolean swapClimbUpDown; - private boolean bankWieldItem; - private boolean bankWearItem; - private boolean bankEatItem; - private boolean bankDrinkItem; - private boolean bankEquipItem; - private boolean bankInvigorateItem; - private boolean swapNpcContact; - private boolean swapCoalBag; - private boolean swapContract; - private boolean swapEnchant; - private boolean swapHardWoodGrove; - private boolean swapHarpoon; - private boolean swapHouseAd; - private boolean swapImps; - private boolean swapInteract; - private boolean swapMax; - private boolean swapMetamorphosis; - private boolean swapMinigame; - private boolean swapNexus; - private boolean swapPay; - private boolean swapPick; - private boolean swapPickpocket; - private boolean swapPlank; - private boolean swapPrivate; - private boolean swapQuestCape; - private boolean swapQuick; - private boolean swapRogueschests; - private boolean swapSearch; - private boolean swapStun; - private boolean swapTeleportItem; - private boolean swapTrade; - private boolean swapTravel; - private boolean swapWildernessLever; - private boolean swapJewelleryBox; - private boolean getSwapOffer; - private boolean hotKeyLoot; - private boolean hotKeyWalk; - private final HotkeyListener hotkey = new HotkeyListener(() -> this.hotkeyMod) - { - @Override - public void hotkeyPressed() - { - startHotkey(); - setHotkeyActive(true); - } - - @Override - public void hotkeyReleased() - { - stopHotkey(); - setHotkeyActive(false); - } - }; - private final HotkeyListener ctrlHotkey = new HotkeyListener(() -> Keybind.CTRL) - { - @Override - public void hotkeyPressed() - { - startControl(); - setControlActive(true); - } - - @Override - public void hotkeyReleased() - { - stopControl(); - setControlActive(false); - } - }; - - - @Provides - MenuEntrySwapperConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(MenuEntrySwapperConfig.class); - } - - @Override - public void startUp() - { - - updateConfig(); - - addSwaps(); - loadConstructionItems(); - loadCustomSwaps(config.customSwaps(), customSwaps); - - updateBuySellEntries(); - addBuySellEntries(); - - updateWithdrawEntries(); - addWithdrawEntries(); - - updateRemovedObjects(); - - if (client.getGameState() == GameState.LOGGED_IN) - { - keyManager.registerKeyListener(ctrlHotkey); - keyManager.registerKeyListener(hotkey); - setCastOptions(true); - } - } - - @Override - public void shutDown() - { - loadCustomSwaps("", customSwaps); // Removes all custom swaps - removeSwaps(); - removeBuySellEntries(); - removeWithdrawEntries(); - - removedObjects = null; - - keyManager.unregisterKeyListener(ctrlHotkey); - keyManager.unregisterKeyListener(hotkey); - if (client.getGameState() == GameState.LOGGED_IN) - { - resetCastOptions(); - } - } - - @Subscribe - private void onFocusChanged(FocusChanged event) - { - if (!event.isFocused()) - { - stopControl(); - stopHotkey(); - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!"menuentryswapper".equals(event.getGroup())) - { - return; - } - - removeSwaps(); - updateConfig(); - addSwaps(); - loadConstructionItems(); - - switch (event.getKey()) - { - case "customSwaps": - loadCustomSwaps(this.configCustomSwaps, customSwaps); - return; - case "hideCastToB": - case "hideCastIgnoredToB": - if (this.hideCastToB) - { - setCastOptions(true); - } - else - { - resetCastOptions(); - } - return; - case "hideCastCoX": - case "hideCastIgnoredCoX": - if (this.hideCastCoX) - { - setCastOptions(true); - } - else - { - resetCastOptions(); - } - return; - case "removeObjects": - case "removedObjects": - updateRemovedObjects(); - return; - } - - if (event.getKey().startsWith("swapSell") || event.getKey().startsWith("swapBuy") || - (event.getKey().startsWith("sell") || event.getKey().startsWith("buy")) && event.getKey().endsWith("Items")) - { - removeBuySellEntries(); - updateBuySellEntries(); - addBuySellEntries(); - } - else if (event.getKey().startsWith("withdraw") || event.getKey().startsWith("deposit")) - { - removeWithdrawEntries(); - updateWithdrawEntries(); - addWithdrawEntries(); - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() != GameState.LOGGED_IN) - { - keyManager.unregisterKeyListener(ctrlHotkey); - keyManager.unregisterKeyListener(hotkey); - return; - } - - loadConstructionItems(); - keyManager.registerKeyListener(ctrlHotkey); - keyManager.registerKeyListener(hotkey); - } - - @Subscribe - private void onVarbitChanged(VarbitChanged event) - { - buildingMode = client.getVar(BUILDING_MODE) == 1; - WithdrawComparableEntry.setX(client.getVar(WITHDRAW_X_AMOUNT)); - - setCastOptions(false); - } - - @Subscribe - private void onMenuOpened(MenuOpened event) - { - Player localPlayer = client.getLocalPlayer(); - - if (localPlayer == null) - { - return; - } - - List menu_entries = new ArrayList<>(); - - for (MenuEntry entry : event.getMenuEntries()) - { - String option = Text.removeTags(entry.getOption()).toLowerCase(); - - if (option.contains("trade with") && this.hideTradeWith) - { - continue; - } - - if (option.contains("lookup") && this.hideLookup) - { - continue; - } - - if (option.contains("report") && this.hideReport) - { - continue; - } - - if (option.contains("examine") && this.hideExamine) - { - continue; - } - - if (option.contains("net") && this.hideNet) - { - continue; - } - - if (option.contains("bait") && this.hideBait) - { - continue; - } - - if (option.contains("destroy")) - { - if (this.hideDestroyRunepouch && entry.getTarget().contains("Rune pouch")) - { - continue; - } - if (this.hideDestroyCoalbag && entry.getTarget().contains("Coal bag")) - { - continue; - } - if (this.hideDestroyHerbsack && entry.getTarget().contains("Herb sack")) - { - continue; - } - if (this.hideDestroyBoltpouch && entry.getTarget().contains("Bolt pouch")) - { - continue; - } - if (this.hideDestroyLootingBag && entry.getTarget().contains("Looting bag")) - { - continue; - } - if (this.hideDestroyGembag && entry.getTarget().contains("Gem bag")) - { - continue; - } - } - - if (option.contains("drop")) - { - if (this.hideDropRunecraftingPouch && ( - entry.getTarget().contains("Small pouch") - || entry.getTarget().contains("Medium pouch") - || entry.getTarget().contains("Large pouch") - || entry.getTarget().contains("Giant pouch"))) - { - continue; - } - } - - menu_entries.add(entry); - } - - event.setMenuEntries(menu_entries.toArray(new MenuEntry[0])); - event.setModified(); - } - - @Subscribe - public void onMenuEntryAdded(MenuEntryAdded event) - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - final int eventId = event.getIdentifier(); - final String option = event.getOption().toLowerCase(); - final String target = Text.standardize(event.getTarget(), true); - final NPC hintArrowNpc = client.getHintArrowNpc(); - - if (removedObjects != null) - { - final boolean hasArrow = target.contains("->"); - final int targetLength = target.length(); - - for (final String object : removedObjects) - { - if (target.equals(object) - || hasArrow && target.endsWith(object)) - { - client.setMenuOptionCount(client.getMenuOptionCount() - 1); - return; - } - } - } - - if (this.getSwapPuro && isPuroPuro()) - { - if (event.getOpcode() == WALK.getId()) - { - MenuEntry[] menuEntries = client.getMenuEntries(); - MenuEntry menuEntry = menuEntries[menuEntries.length - 1]; - menuEntry.setOpcode(MenuOpcode.WALK.getId() + MENU_ACTION_DEPRIORITIZE_OFFSET); - client.setMenuEntries(menuEntries); - } - else if (option.equalsIgnoreCase("examine")) - { - swap(client, "push-through", option, target); - } - else if (option.equalsIgnoreCase("use")) - { - swap(client, "escape", option, target); - } - } - - if (hintArrowNpc != null - && hintArrowNpc.getIndex() == eventId - && NPC_MENU_TYPES.contains(MenuOpcode.of(event.getOpcode()))) - { - return; - } - - if (this.swapImps && target.contains("impling")) - { - - if (client.getItemContainer(InventoryID.BANK) != null) - { - bankItemNames = new ArrayList<>(); - for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.BANK)).getItems()) - { - bankItemNames.add(client.getItemDefinition((i.getId())).getName()); - } - } - List invItemNames = new ArrayList<>(); - switch (target) - { - case "gourmet impling jar": - if (client.getItemContainer(InventoryID.INVENTORY) != null) - { - for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) - { - invItemNames.add(client.getItemDefinition((i.getId())).getName()); - } - if ((invItemNames.contains("Clue scroll (easy)") || bankItemNames.contains("Clue scroll (easy)"))) - { - menuManager.addSwap("loot", target, "use"); - } - else - { - menuManager.removeSwap("loot", target, "use"); - } - } - break; - case "young impling jar": - if (client.getItemContainer(InventoryID.INVENTORY) != null) - { - for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) - { - invItemNames.add(client.getItemDefinition((i.getId())).getName()); - } - if (invItemNames.contains("Clue scroll (easy)") || bankItemNames.contains("Clue scroll (easy)") || invItemNames.contains("Clue scroll (beginner)") || bankItemNames.contains("Clue scroll (beginner)")) - { - menuManager.addSwap("loot", target, "use"); - } - else - { - menuManager.removeSwap("loot", target, "use"); - } - } - break; - case "eclectic impling jar": - if (client.getItemContainer(InventoryID.INVENTORY) != null) - { - for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) - { - invItemNames.add(client.getItemDefinition((i.getId())).getName()); - } - if ((invItemNames.contains("Clue scroll (medium)") || bankItemNames.contains("Clue scroll (medium)"))) - { - menuManager.addSwap("loot", target, "use"); - } - else - { - menuManager.removeSwap("loot", target, "use"); - } - } - break; - case "magpie impling jar": - case "nature impling jar": - case "ninja impling jar": - if (client.getItemContainer(InventoryID.INVENTORY) != null) - { - for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) - { - invItemNames.add(client.getItemDefinition((i.getId())).getName()); - } - if ((invItemNames.contains("Clue scroll (hard)") || bankItemNames.contains("Clue scroll (hard)"))) - { - menuManager.addSwap("loot", target, "use"); - } - else - { - menuManager.removeSwap("loot", target, "use"); - } - } - break; - case "crystal impling jar": - case "dragon impling jar": - if (client.getItemContainer(InventoryID.INVENTORY) != null) - { - for (Item i : Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()) - { - invItemNames.add(client.getItemDefinition((i.getId())).getName()); - } - if ((invItemNames.contains("Clue scroll (elite)") || bankItemNames.contains("Clue scroll (elite)"))) - { - menuManager.addSwap("loot", target, "use"); - } - else - { - menuManager.removeSwap("loot", target, "use"); - } - } - break; - } - } - } - - private void loadCustomSwaps(String config, Map map) - { - final Map tmp = new HashMap<>(); - - if (!Strings.isNullOrEmpty(config)) - { - final StringBuilder sb = new StringBuilder(); - - for (String str : config.split("\n")) - { - if (!str.startsWith("//")) - { - sb.append(str).append("\n"); - } - } - - final Map split = NEWLINE_SPLITTER.withKeyValueSeparator(':').split(sb); - - for (Map.Entry entry : split.entrySet()) - { - final String prio = entry.getKey(); - int priority; - try - { - priority = Integer.parseInt(entry.getValue().trim()); - } - catch (NumberFormatException e) - { - priority = 0; - } - final String[] splitFrom = Text.standardize(prio).split(","); - final String optionFrom = splitFrom[0].trim(); - final String targetFrom; - if (splitFrom.length == 1) - { - targetFrom = ""; - } - else - { - targetFrom = splitFrom[1].trim(); - } - - final AbstractComparableEntry prioEntry = newBaseComparableEntry(optionFrom, targetFrom); - - tmp.put(prioEntry, priority); - } - } - - for (Map.Entry e : map.entrySet()) - { - final AbstractComparableEntry key = e.getKey(); - menuManager.removePriorityEntry(key); - } - - map.clear(); - map.putAll(tmp); - - for (Map.Entry entry : map.entrySet()) - { - AbstractComparableEntry a1 = entry.getKey(); - int a2 = entry.getValue(); - menuManager.addPriorityEntry(a1).setPriority(a2); - } - } - - private void addSwaps() - { - final List tmp = NEWLINE_SPLITTER.splitToList(config.prioEntry()); - - for (String str : tmp) - { - String[] strings = str.split(","); - - if (strings.length <= 1) - { - continue; - } - - final AbstractComparableEntry a = newBaseComparableEntry("", strings[1], -1, -1, false, true); - final AbstractComparableEntry b = newBaseComparableEntry(strings[0], "", -1, -1, false, false); - dePrioSwaps.put(a, b); - menuManager.addSwap(a, b); - } - - if (this.getSwapTanning) - { - menuManager.addPriorityEntry("Tan All"); - } - - if (this.getSwapOffer) - { - menuManager.addPriorityEntry("Offer-All"); - } - - if (this.getSwapSawmill) - { - menuManager.addPriorityEntry("Buy-plank", "Sawmill operator"); - } - - if (this.getSwapSawmillPlanks) - { - //Not much we can do for this one, Buy all is the only thing, there is no target. - menuManager.addPriorityEntry("Buy All").setPriority(10); - } - - if (this.getSwapArdougneCloak) - { - menuManager.addPriorityEntry(this.ardougneCloakMode.toString()).setPriority(100); - menuManager.addPriorityEntry(this.ardougneCloakMode.toString2()).setPriority(100); - } - - if (this.getSwapCraftingCape) - { - menuManager.addPriorityEntry("Teleport", "Crafting cape"); - menuManager.addPriorityEntry("Teleport", "Crafting cape(t)"); - } - - if (this.getSwapConstructionCape) - { - menuManager.addPriorityEntry(this.constructionCapeMode.toString(), "Construct. cape").setPriority(100); - menuManager.addPriorityEntry(this.constructionCapeMode.toString(), "Construct. cape(t)").setPriority(100); - } - - if (this.getSwapMagicCape) - { - menuManager.addPriorityEntry("Spellbook", "Magic cape"); - menuManager.addPriorityEntry("Spellbook", "Magic cape(t)"); - } - - if (this.getSwapExplorersRing) - { - menuManager.addPriorityEntry("Teleport", "Explorer's ring 2"); - menuManager.addPriorityEntry("Teleport", "Explorer's ring 3"); - menuManager.addPriorityEntry("Teleport", "Explorer's ring 4"); - } - - if (this.swapPickpocket) - { - menuManager.addPriorityEntry("Pickpocket").setPriority(1); - } - - if (this.swapHardWoodGrove) - { - menuManager.addPriorityEntry("Send-parcel", "Rionasta"); - } - - if (this.swapBankExchange) - { - menuManager.addPriorityEntry(new BankComparableEntry("collect", "", false)); - menuManager.addPriorityEntry("Bank"); - menuManager.addPriorityEntry("Exchange"); - } - - if (this.swapContract) - { - menuManager.addPriorityEntry("Contract").setPriority(10); - } - - if (this.swapInteract) - { - menuManager.addPriorityEntry("Repairs").setPriority(10); - menuManager.addPriorityEntry("Claim-slime").setPriority(10); - menuManager.addPriorityEntry("Decant").setPriority(10); - menuManager.addPriorityEntry("Claim").setPriority(10); - menuManager.addPriorityEntry("Heal").setPriority(10); - menuManager.addPriorityEntry("Help").setPriority(10); - } - - if (this.swapAssignment) - { - menuManager.addPriorityEntry("Assignment").setPriority(100); - } - - if (this.swapPlank) - { - menuManager.addPriorityEntry("Buy-plank").setPriority(10); - } - - if (this.swapTrade) - { - menuManager.addPriorityEntry("Trade").setPriority(1); - menuManager.addPriorityEntry("Trade-with").setPriority(1); - menuManager.addPriorityEntry("Shop").setPriority(1); - } - - if (this.swapMinigame) - { - menuManager.addPriorityEntry("Story"); - menuManager.addPriorityEntry("Escort"); - menuManager.addPriorityEntry("Dream"); - menuManager.addPriorityEntry("Start-minigame"); - } - - if (this.swapTravel) - { - menuManager.addPriorityEntry("Travel"); - menuManager.addPriorityEntry("Pay-fare"); - menuManager.addPriorityEntry("Charter"); - menuManager.addPriorityEntry("Take-boat"); - menuManager.addPriorityEntry("Fly"); - menuManager.addPriorityEntry("Jatizso"); - menuManager.addPriorityEntry("Neitiznot"); - menuManager.addPriorityEntry("Rellekka"); - menuManager.addPriorityEntry("Follow", "Elkoy").setPriority(10); - menuManager.addPriorityEntry("Transport"); - } - - if (this.swapAbyssTeleport) - { - menuManager.addPriorityEntry("Teleport", "Mage of zamorak").setPriority(10); - } - - if (this.swapPay) - { - menuManager.addPriorityEntry("Pay"); - menuManager.addPriorityEntry("Pay (", false); - } - - if (this.swapQuick) - { - menuManager.addPriorityEntry("Quick-travel"); - } - - if (this.swapEnchant) - { - menuManager.addPriorityEntry("Enchant"); - } - - if (this.swapWildernessLever) - { - menuManager.addPriorityEntry("Edgeville", "Lever"); - } - - if (this.swapMetamorphosis) - { - menuManager.addPriorityEntry("Metamorphosis", "Baby chinchompa"); - } - - if (this.swapStun) - { - menuManager.addPriorityEntry("Stun", "Hoop snake"); - } - - if (this.swapTravel) - { - menuManager.addPriorityEntry("Pay-toll(2-ecto)", "Energy barrier"); - menuManager.addPriorityEntry("Pay-toll(10gp)", "Gate"); - menuManager.addPriorityEntry("Travel", "Trapdoor"); - } - - if (this.swapHarpoon) - { - menuManager.addPriorityEntry("Harpoon"); - } - - if (this.swapBoxTrap) - { - menuManager.addPriorityEntry("Reset", "Shaking box"); - menuManager.addPriorityEntry("Lay", "Box trap"); - menuManager.addPriorityEntry("Activate", "Box trap"); - } - - if (this.swapChase) - { - menuManager.addPriorityEntry("Chase"); - } - - if (this.swapBirdhouseEmpty) - { - menuManager.addPriorityEntry("Empty", "Birdhouse"); - menuManager.addPriorityEntry("Empty", "Oak Birdhouse"); - menuManager.addPriorityEntry("Empty", "Willow Birdhouse"); - menuManager.addPriorityEntry("Empty", "Teak Birdhouse"); - menuManager.addPriorityEntry("Empty", "Maple Birdhouse"); - menuManager.addPriorityEntry("Empty", "Mahogany Birdhouse"); - menuManager.addPriorityEntry("Empty", "Yew Birdhouse"); - menuManager.addPriorityEntry("Empty", "Magic Birdhouse"); - menuManager.addPriorityEntry("Empty", "Redwood Birdhouse"); - } - - if (this.swapQuick) - { - menuManager.addPriorityEntry("Quick-enter"); - menuManager.addPriorityEntry("Quick-start"); - menuManager.addPriorityEntry("Quick-pass"); - menuManager.addPriorityEntry("Quick-open"); - menuManager.addPriorityEntry("Quick-leave"); - } - - if (this.swapAdmire) - { - menuManager.addPriorityEntry("Teleport", "Mounted Strength Cape").setPriority(10); - menuManager.addPriorityEntry("Teleport", "Mounted Strength Cape (t)").setPriority(10); - menuManager.addPriorityEntry("Teleport", "Mounted Construction Cape").setPriority(10); - menuManager.addPriorityEntry("Teleport", "Mounted Construction Cape (t)").setPriority(10); - menuManager.addPriorityEntry("Teleport", "Mounted Crafting Cape").setPriority(10); - menuManager.addPriorityEntry("Teleport", "Mounted Crafting Cape (t)").setPriority(10); - menuManager.addPriorityEntry("Teleport", "Mounted Hunter Cape").setPriority(10); - menuManager.addPriorityEntry("Teleport", "Mounted Hunter Cape (t)").setPriority(10); - menuManager.addPriorityEntry("Teleport", "Mounted Fishing Cape").setPriority(10); - menuManager.addPriorityEntry("Teleport", "Mounted Fishing Cape (t)").setPriority(10); - menuManager.addPriorityEntry("Spellbook", "Mounted Magic Cape"); - menuManager.addPriorityEntry("Spellbook", "Mounted Magic Cape (t)"); - menuManager.addPriorityEntry("Perks", "Mounted Max Cape"); - } - - if (this.swapPrivate) - { - menuManager.addPriorityEntry("Private"); - } - - if (this.swapPick) - { - menuManager.addPriorityEntry("Pick-lots"); - } - - if (this.swapSearch) - { - menuManager.addPriorityEntry("Search").setPriority(1); - } - - if (this.swapRogueschests) - { - menuManager.addPriorityEntry("Search for traps"); - } - - if (this.rockCake) - { - menuManager.addPriorityEntry("Guzzle", "Dwarven rock cake"); - } - - if (this.swapTeleportItem) - { - menuManager.addPriorityEntry(new InventoryComparableEntry("Rub", "", false)).setPriority(1); - menuManager.addPriorityEntry(new InventoryComparableEntry("Teleport", "", false)).setPriority(1); - } - - if (this.swapCoalBag) - { - menuManager.addPriorityEntry("Fill", "Coal bag"); - menuManager.addPriorityEntry(newBankComparableEntry("Empty", "Coal bag")); - } - - if (this.swapBones) - { - menuManager.addSwap("Bury", "bone", "Use"); - } - - if (this.swapNexus) - { - menuManager.addPriorityEntry("Teleport menu", "Portal nexus"); - } - - switch (this.swapFairyRingMode) - { - case OFF: - case ZANARIS: - menuManager.removeSwaps("Fairy ring"); - menuManager.removeSwaps("Tree"); - break; - case CONFIGURE: - menuManager.addPriorityEntry("Configure", "Fairy ring"); - break; - case LAST_DESTINATION: - menuManager.addPriorityEntry("Last-destination", false); - break; - } - - switch (this.swapFairyTreeMode) - { - case OFF: - break; - case TREE: - menuManager.addPriorityEntry("Tree", "Spiritual Fairy Tree"); - break; - case RING_ZANARIS: - menuManager.addPriorityEntry("Ring-Zanaris", "Spiritual Fairy Tree"); - break; - case RING_CONFIGURE: - menuManager.addPriorityEntry("Ring-configure", "Spiritual Fairy Tree"); - break; - case RING_LAST_DESTINATION: - menuManager.addPriorityEntry("Ring-last-destination", false); - break; - } - - switch (this.swapOccultMode) - { - case LUNAR: - menuManager.addPriorityEntry("Lunar", "Altar of the Occult"); - break; - case ANCIENT: - menuManager.addPriorityEntry("Ancient", "Altar of the Occult"); - break; - case ARCEUUS: - menuManager.addPriorityEntry("Arceuus", "Altar of the Occult"); - break; - } - - switch (this.swapObeliskMode) - { - case SET_DESTINATION: - menuManager.addPriorityEntry("Set destination", "Obelisk"); - break; - case TELEPORT_TO_DESTINATION: - menuManager.addPriorityEntry("Teleport to destination", "Obelisk"); - break; - } - - switch (this.swapHomePortalMode) - { - case HOME: - menuManager.addPriorityEntry("Home"); - break; - case BUILD_MODE: - menuManager.addPriorityEntry("Build mode"); - break; - case FRIENDS_HOUSE: - menuManager.addPriorityEntry("Friend's house"); - break; - } - - if (this.swapHardWoodGrove) - { - menuManager.addPriorityEntry("Quick-pay(100)", "Hardwood grove doors"); - } - - if (this.getBurningAmulet) - { - menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getBurningAmuletMode.toString(), "burning amulet")); - } - - if (this.getCombatBracelet) - { - menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getCombatBraceletMode.toString(), "combat bracelet")); - } - - if (this.getGamesNecklace) - { - menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getGamesNecklaceMode.toString(), "games necklace")); - } - - if (this.getDuelingRing) - { - menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getDuelingRingMode.toString(), "ring of dueling")); - } - - if (this.getGlory) - { - menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getGloryMode.toString(), "glory")); - } - - if (this.getSkillsNecklace) - { - menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getSkillsNecklaceMode.toString(), "skills necklace")); - } - - if (this.getNecklaceofPassage) - { - menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getNecklaceofPassageMode.toString(), "necklace of passage")); - } - - if (this.getDigsitePendant) - { - menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getDigsitePendantMode.toString(), "digsite pendant")); - } - - if (this.getSlayerRing) - { - menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getSlayerRingMode.toString(), "slayer ring")); - } - - if (this.getXericsTalisman) - { - menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getXericsTalismanMode.toString(), "talisman")); - } - - if (this.getRingofWealth) - { - menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getRingofWealthMode.toString(), "ring of wealth")); - } - - if (this.swapMax) - { - menuManager.addPriorityEntry(this.maxMode.toString(), "max cape"); - } - - if (this.swapQuestCape) - { - menuManager.addPriorityEntry(this.questCapeMode.toString(), "quest point cape"); - } - - if (this.swapHouseAd) - { - menuManager.addPriorityEntry(this.swapHouseAdMode.getEntry()); - } - - if (this.getSwapGrimyHerb) - { - menuManager.addPriorityEntry(new GrimyHerbComparableEntry(this.swapGrimyHerbMode, client)); - } - - if (this.swapJewelleryBox) - { - for (String jewellerybox : jewelleryBox) - { - menuManager.addPriorityEntry(jewellerybox, "basic jewellery box"); - menuManager.addPriorityEntry(jewellerybox, "fancy jewellery box"); - menuManager.addPriorityEntry(jewellerybox, "ornate jewellery box"); - } - } - } - - private void removeSwaps() - { - final Iterator> dePrioIter = dePrioSwaps.entrySet().iterator(); - dePrioIter.forEachRemaining((e) -> - { - menuManager.removeSwap(e.getKey(), e.getValue()); - dePrioIter.remove(); - }); - - menuManager.removePriorityEntry("Activate", "Box trap"); - menuManager.removePriorityEntry("Assignment"); - menuManager.removePriorityEntry("Bank"); - menuManager.removePriorityEntry("Buy All"); - menuManager.removePriorityEntry("Buy-plank"); - menuManager.removePriorityEntry("Buy-plank", "Sawmill operator"); - menuManager.removePriorityEntry("Charter"); - menuManager.removePriorityEntry("Chase"); - menuManager.removePriorityEntry("Claim"); - menuManager.removePriorityEntry("Claim-slime"); - menuManager.removePriorityEntry("Contract"); - menuManager.removePriorityEntry("Decant"); - menuManager.removePriorityEntry("Dream"); - menuManager.removePriorityEntry("Edgeville", "Lever"); - menuManager.removePriorityEntry("Empty", "Birdhouse"); - menuManager.removePriorityEntry("Empty", "Magic Birdhouse"); - menuManager.removePriorityEntry("Empty", "Mahogany Birdhouse"); - menuManager.removePriorityEntry("Empty", "Maple Birdhouse"); - menuManager.removePriorityEntry("Empty", "Oak Birdhouse"); - menuManager.removePriorityEntry("Empty", "Redwood Birdhouse"); - menuManager.removePriorityEntry("Empty", "Teak Birdhouse"); - menuManager.removePriorityEntry("Empty", "Willow Birdhouse"); - menuManager.removePriorityEntry("Empty", "Yew Birdhouse"); - menuManager.removePriorityEntry("Enchant"); - menuManager.removePriorityEntry("Escort"); - menuManager.removePriorityEntry("Exchange"); - menuManager.removePriorityEntry("Fill", "Coal bag"); - menuManager.removePriorityEntry("Fly"); - menuManager.removePriorityEntry("Follow", "Elkoy"); - menuManager.removePriorityEntry("Guzzle", "Dwarven rock cake"); - menuManager.removePriorityEntry("Harpoon"); - menuManager.removePriorityEntry("Heal"); - menuManager.removePriorityEntry("Help"); - menuManager.removePriorityEntry("Jatizso"); - menuManager.removePriorityEntry("Kandarin Monastery"); - menuManager.removePriorityEntry("Lay", "Box trap"); - menuManager.removePriorityEntry("Metamorphosis", "Baby chinchompa"); - menuManager.removePriorityEntry("Monastery Teleport"); - menuManager.removePriorityEntry("Neitiznot"); - menuManager.removePriorityEntry("Pay (", false); - menuManager.removePriorityEntry("Pay"); - menuManager.removePriorityEntry("Pay-fare"); - menuManager.removePriorityEntry("Pay-toll(10gp)", "Gate"); - menuManager.removePriorityEntry("Pay-toll(2-ecto)", "Energy barrier"); - menuManager.removePriorityEntry("Perks", "Mounted Max Cape"); - menuManager.removePriorityEntry("Pick-lots"); - menuManager.removePriorityEntry("Pickpocket"); - menuManager.removePriorityEntry("Private"); - menuManager.removePriorityEntry("Quick-enter"); - menuManager.removePriorityEntry("Quick-leave"); - menuManager.removePriorityEntry("Quick-open"); - menuManager.removePriorityEntry("Quick-pass"); - menuManager.removePriorityEntry("Quick-pay", "Hardwood grove doors"); - menuManager.removePriorityEntry("Quick-start"); - menuManager.removePriorityEntry("Quick-travel"); - menuManager.removePriorityEntry("Rellekka"); - menuManager.removePriorityEntry("Repairs"); - menuManager.removePriorityEntry("Reset", "Shaking box"); - menuManager.removePriorityEntry("Search for traps"); - menuManager.removePriorityEntry("Search"); - menuManager.removePriorityEntry("Send-parcel", "Rionasta"); - menuManager.removePriorityEntry("Shop"); - menuManager.removePriorityEntry("Spellbook", "Magic cape"); - menuManager.removePriorityEntry("Spellbook", "Magic cape(t)"); - menuManager.removePriorityEntry("Spellbook", "Mounted Magic Cape"); - menuManager.removePriorityEntry("Start-minigame"); - menuManager.removePriorityEntry("Story"); - menuManager.removePriorityEntry("Stun", "Hoop snake"); - menuManager.removePriorityEntry("Take-boat"); - menuManager.removePriorityEntry("Tan All"); - menuManager.removePriorityEntry("Offer-All"); - menuManager.removePriorityEntry("Teleport menu", "Portal nexus"); - menuManager.removePriorityEntry("Teleport", "Crafting cape"); - menuManager.removePriorityEntry("Teleport", "Crafting cape(t)"); - menuManager.removePriorityEntry("Teleport", "Explorer's ring 2"); - menuManager.removePriorityEntry("Teleport", "Explorer's ring 3"); - menuManager.removePriorityEntry("Teleport", "Explorer's ring 4"); - menuManager.removePriorityEntry("Teleport", "Mage of zamorak"); - menuManager.removePriorityEntry("Teleport", "Mounted Strength Cape"); - menuManager.removePriorityEntry("Teleport", "Mounted Strength Cape (t)"); - menuManager.removePriorityEntry("Teleport", "Mounted Construction Cape"); - menuManager.removePriorityEntry("Teleport", "Mounted Construction Cape (t)"); - menuManager.removePriorityEntry("Teleport", "Mounted Crafting Cape"); - menuManager.removePriorityEntry("Teleport", "Mounted Crafting Cape (t)"); - menuManager.removePriorityEntry("Teleport", "Mounted Hunter Cape"); - menuManager.removePriorityEntry("Teleport", "Mounted Hunter Cape (t)"); - menuManager.removePriorityEntry("Teleport", "Mounted Fishing Cape"); - menuManager.removePriorityEntry("Teleport", "Mounted Fishing Cape (t)"); - menuManager.removePriorityEntry("Spellbook", "Mounted Magic Cape"); - menuManager.removePriorityEntry("Spellbook", "Mounted Magic Cape (t)"); - menuManager.removePriorityEntry("Trade"); - menuManager.removePriorityEntry("Trade-with"); - menuManager.removePriorityEntry("Transport"); - menuManager.removePriorityEntry("Travel"); - menuManager.removePriorityEntry("Travel", "Trapdoor"); - menuManager.removePriorityEntry(new BankComparableEntry("collect", "", false)); - menuManager.removePriorityEntry(new EquipmentComparableEntry(this.getBurningAmuletMode.toString(), "burning amulet")); - menuManager.removePriorityEntry(new EquipmentComparableEntry(this.getCombatBraceletMode.toString(), "combat bracelet")); - menuManager.removePriorityEntry(new EquipmentComparableEntry(this.getDigsitePendantMode.toString(), "digsite pendant")); - menuManager.removePriorityEntry(new EquipmentComparableEntry(this.getDuelingRingMode.toString(), "ring of dueling")); - menuManager.removePriorityEntry(new EquipmentComparableEntry(this.getGamesNecklaceMode.toString(), "games necklace")); - menuManager.removePriorityEntry(new EquipmentComparableEntry(this.getGloryMode.toString(), "glory")); - menuManager.removePriorityEntry(new EquipmentComparableEntry(this.getNecklaceofPassageMode.toString(), "necklace of passage")); - menuManager.removePriorityEntry(new EquipmentComparableEntry(this.getRingofWealthMode.toString(), "ring of wealth")); - menuManager.removePriorityEntry(new EquipmentComparableEntry(this.getSkillsNecklaceMode.toString(), "skills necklace")); - menuManager.removePriorityEntry(new EquipmentComparableEntry(this.getSlayerRingMode.toString(), "slayer ring")); - menuManager.removePriorityEntry(new EquipmentComparableEntry(this.getXericsTalismanMode.toString(), "talisman")); - menuManager.removePriorityEntry(new InventoryComparableEntry("Rub", "", false)); - menuManager.removePriorityEntry(new InventoryComparableEntry("Teleport", "", false)); - menuManager.removePriorityEntry(new GrimyHerbComparableEntry(this.swapGrimyHerbMode, client)); - menuManager.removePriorityEntry(newBankComparableEntry("Empty", "Coal bag")); - menuManager.removePriorityEntry(this.constructionCapeMode.toString(), "Construct. cape"); - menuManager.removePriorityEntry(this.constructionCapeMode.toString(), "Construct. cape(t)"); - menuManager.removePriorityEntry(this.getConstructionMode.getBuild()); - menuManager.removePriorityEntry(this.getConstructionMode.getRemove()); - menuManager.removePriorityEntry(this.maxMode.toString(), "max cape"); - menuManager.removePriorityEntry(this.questCapeMode.toString(), "quest point cape"); - menuManager.removePriorityEntry(this.swapHouseAdMode.getEntry()); - menuManager.removeSwap("Bury", "bone", "Use"); - for (String jewellerybox : jewelleryBox) - { - menuManager.removePriorityEntry(jewellerybox, "basic jewellery box"); - menuManager.removePriorityEntry(jewellerybox, "fancy jewellery box"); - menuManager.removePriorityEntry(jewellerybox, "ornate jewellery box"); - } - - switch (this.swapFairyRingMode) - { - case OFF: - case ZANARIS: - menuManager.removeSwaps("Fairy ring"); - menuManager.removeSwaps("Tree"); - break; - case CONFIGURE: - menuManager.removePriorityEntry("Configure", "Fairy ring"); - break; - case LAST_DESTINATION: - menuManager.removePriorityEntry("Last-destination", false); - break; - } - - switch (this.swapFairyTreeMode) - { - case OFF: - case TREE: - menuManager.removePriorityEntry("Tree", "Spiritual Fairy Tree"); - break; - case RING_ZANARIS: - menuManager.removePriorityEntry("Ring-Zanaris", "Spiritual Fairy Tree"); - break; - case RING_CONFIGURE: - menuManager.removePriorityEntry("Ring-configure", "Spiritual Fairy Tree"); - break; - case RING_LAST_DESTINATION: - menuManager.removePriorityEntry("Ring-last-destination", false); - break; - } - - switch (this.swapOccultMode) - { - case LUNAR: - menuManager.removePriorityEntry("Lunar", "Altar of the Occult"); - break; - case ANCIENT: - menuManager.removePriorityEntry("Ancient", "Altar of the Occult"); - break; - case ARCEUUS: - menuManager.removePriorityEntry("Arceuus", "Altar of the Occult"); - break; - } - - switch (this.swapObeliskMode) - { - case SET_DESTINATION: - menuManager.removePriorityEntry("Set destination", "Obelisk"); - break; - case TELEPORT_TO_DESTINATION: - menuManager.removePriorityEntry("Teleport to destination", "Obelisk"); - break; - } - - switch (this.swapHomePortalMode) - { - case HOME: - menuManager.removePriorityEntry("Home"); - break; - case BUILD_MODE: - menuManager.removePriorityEntry("Build mode"); - break; - case FRIENDS_HOUSE: - menuManager.removePriorityEntry("Friend's house"); - break; - } - - } - - private boolean isPuroPuro() - { - Player player = client.getLocalPlayer(); - - if (player == null) - { - return false; - } - else - { - WorldPoint location = player.getWorldLocation(); - return location.getRegionID() == PURO_PURO_REGION_ID; - } - } - - private void loadConstructionItems() - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - if (!buildingMode) - { - menuManager.removePriorityEntry(this.getConstructionMode.getBuild()); - menuManager.removePriorityEntry(this.getConstructionMode.getRemove()); - return; - } - - if (this.getEasyConstruction) - { - menuManager.addPriorityEntry(this.getConstructionMode.getBuild()).setPriority(100); - menuManager.addPriorityEntry(this.getConstructionMode.getRemove()).setPriority(100); - } - } - - private void startHotkey() - { - eventBus.subscribe(ClientTick.class, HOTKEY, this::addHotkey); - eventBus.subscribe(ClientTick.class, HOTKEY_CHECK, this::hotkeyCheck); - } - - private void addHotkey(ClientTick event) - { - loadCustomSwaps(this.configCustomShiftSwaps, customShiftSwaps); - - if (this.bankWieldItem) - { - menuManager.addPriorityEntry(new BankComparableEntry("wield", "", false)); - } - if (this.bankWearItem) - { - menuManager.addPriorityEntry(new BankComparableEntry("wear", "", false)); - } - if (this.bankEatItem) - { - menuManager.addPriorityEntry(new BankComparableEntry("eat", "", false)); - } - if (this.bankDrinkItem) - { - menuManager.addPriorityEntry(new BankComparableEntry("drink", "", false)); - } - if (this.bankEquipItem) - { - menuManager.addPriorityEntry(new BankComparableEntry("equip", "", false)); - } - if (this.bankInvigorateItem) - { - menuManager.addPriorityEntry(new BankComparableEntry("invigorate", "", false)); - } - if (this.swapClimbUpDown) - { - menuManager.addPriorityEntry("climb-up").setPriority(100); - } - if (this.hotKeyLoot) - { - menuManager.addPriorityEntry(TAKE); - } - if (this.hotKeyWalk) - { - menuManager.addPriorityEntry(WALK); - } - if (this.swapNpcContact) - { - for (String npccontact : npcContact) - { - menuManager.addPriorityEntry(npccontact, "npc contact"); - } - } - - eventBus.unregister(HOTKEY); - } - - private void stopHotkey() - { - eventBus.subscribe(ClientTick.class, HOTKEY, this::removeHotkey); - } - - private void removeHotkey(ClientTick event) - { - menuManager.removePriorityEntry(new BankComparableEntry("wield", "", false)); - menuManager.removePriorityEntry(new BankComparableEntry("wear", "", false)); - menuManager.removePriorityEntry(new BankComparableEntry("eat", "", false)); - menuManager.removePriorityEntry(new BankComparableEntry("drink", "", false)); - menuManager.removePriorityEntry(new BankComparableEntry("equip", "", false)); - menuManager.removePriorityEntry(new BankComparableEntry("invigorate", "", false)); - menuManager.removePriorityEntry("climb-up"); - menuManager.removePriorityEntry(TAKE); - menuManager.removePriorityEntry(WALK); - - for (String npccontact : npcContact) - { - menuManager.removePriorityEntry(npccontact, "npc contact"); - } - - loadCustomSwaps("", customShiftSwaps); - eventBus.unregister(HOTKEY); - } - - private void hotkeyCheck(ClientTick event) - { - if (hotkeyActive) - { - int i = 0; - for (boolean bol : client.getPressedKeys()) - { - if (bol) - { - i++; - } - } - if (i == 0) - { - stopHotkey(); - setHotkeyActive(false); - eventBus.unregister(HOTKEY_CHECK); - } - } - } - - private void startControl() - { - if (!this.swapClimbUpDown) - { - return; - } - - eventBus.subscribe(ClientTick.class, CONTROL, this::addControl); - eventBus.subscribe(ClientTick.class, CONTROL_CHECK, this::controlCheck); - } - - private void addControl(ClientTick event) - { - menuManager.addPriorityEntry("climb-down").setPriority(100); - eventBus.unregister(CONTROL); - } - - private void stopControl() - { - eventBus.subscribe(ClientTick.class, CONTROL, this::removeControl); - } - - private void removeControl(ClientTick event) - { - menuManager.removePriorityEntry("climb-down"); - eventBus.unregister(CONTROL); - } - - private void controlCheck(ClientTick event) - { - if (controlActive) - { - int i = 0; - for (boolean bol : client.getPressedKeys()) - { - if (bol) - { - i++; - } - } - if (i == 0) - { - stopControl(); - setControlActive(false); - eventBus.unregister(CONTROL_CHECK); - } - } - } - - private void setCastOptions(boolean force) - { - clientThread.invoke(() -> - { - boolean tmpInCoxRaid = client.getVar(Varbits.IN_RAID) == 1; - if (tmpInCoxRaid != inCoxRaid || force) - { - if (tmpInCoxRaid && this.hideCastCoX) - { - client.setHideFriendCastOptions(true); - client.setHideClanmateCastOptions(true); - client.setUnhiddenCasts(this.hideCastIgnoredCoX); - } - - inCoxRaid = tmpInCoxRaid; - } - - boolean tmpInTobRaid = client.getVar(Varbits.THEATRE_OF_BLOOD) == 2; - if (tmpInTobRaid != inTobRaid || force) - { - if (tmpInTobRaid && this.hideCastToB) - { - client.setHideFriendCastOptions(true); - client.setHideClanmateCastOptions(true); - client.setUnhiddenCasts(this.hideCastIgnoredToB); - } - - inTobRaid = tmpInTobRaid; - } - - if (!inCoxRaid && !inTobRaid) - { - resetCastOptions(); - } - }); - } - - private void resetCastOptions() - { - clientThread.invoke(() -> - { - if (client.getVar(Varbits.IN_WILDERNESS) == 1 || WorldType.isAllPvpWorld(client.getWorldType()) && pluginManager.isPluginEnabled(pvpTools) && pvpToolsConfig.hideCast()) - { - pvpTools.setCastOptions(); - } - else - { - client.setHideFriendCastOptions(false); - client.setHideClanmateCastOptions(false); - } - }); - } - - private void updateConfig() - { - this.configCustomShiftSwaps = config.shiftCustomSwaps(); - this.configCustomSwaps = config.customSwaps(); - this.ardougneCloakMode = config.ardougneCloakMode(); - this.constructionCapeMode = config.constructionCapeMode(); - this.getBurningAmulet = config.getBurningAmulet(); - this.getBurningAmuletMode = config.getBurningAmuletMode(); - this.getCombatBracelet = config.getCombatBracelet(); - this.getCombatBraceletMode = config.getCombatBraceletMode(); - this.getConstructionMode = config.getConstructionMode(); - this.getDigsitePendant = config.getDigsitePendant(); - this.getDigsitePendantMode = config.getDigsitePendantMode(); - this.getDuelingRing = config.getDuelingRing(); - this.getDuelingRingMode = config.getDuelingRingMode(); - this.getEasyConstruction = config.getEasyConstruction(); - this.getGamesNecklace = config.getGamesNecklace(); - this.getGamesNecklaceMode = config.getGamesNecklaceMode(); - this.getGlory = config.getGlory(); - this.getGloryMode = config.getGloryMode(); - this.getNecklaceofPassage = config.getNecklaceofPassage(); - this.getNecklaceofPassageMode = config.getNecklaceofPassageMode(); - this.getRingofWealth = config.getRingofWealth(); - this.getRingofWealthMode = config.getRingofWealthMode(); - this.swapGrimyHerbMode = config.swapGrimyHerbMode(); - this.getSkillsNecklace = config.getSkillsNecklace(); - this.getSkillsNecklaceMode = config.getSkillsNecklaceMode(); - this.getSlayerRing = config.getSlayerRing(); - this.getSlayerRingMode = config.getSlayerRingMode(); - this.getSwapArdougneCloak = config.getSwapArdougneCloak(); - this.getSwapConstructionCape = config.getSwapConstructionCape(); - this.getSwapCraftingCape = config.getSwapCraftingCape(); - this.getSwapExplorersRing = config.getSwapExplorersRing(); - this.getSwapMagicCape = config.getSwapMagicCape(); - this.getSwapPuro = config.getSwapPuro(); - this.getSwapGrimyHerb = config.getSwapGrimyHerb(); - this.getSwapSawmill = config.getSwapSawmill(); - this.getSwapSawmillPlanks = config.getSwapSawmillPlanks(); - this.getSwapTanning = config.getSwapTanning(); - this.getXericsTalisman = config.getXericsTalisman(); - this.getXericsTalismanMode = config.getXericsTalismanMode(); - this.hideBait = config.hideBait(); - this.hideCastCoX = config.hideCastCoX(); - this.hideCastIgnoredCoX = Sets.newHashSet(Text.fromCSV(config.hideCastIgnoredCoX().toLowerCase())); - this.hideCastIgnoredToB = Sets.newHashSet(Text.fromCSV(config.hideCastIgnoredToB().toLowerCase())); - this.hideCastToB = config.hideCastToB(); - this.hideDestroyBoltpouch = config.hideDestroyBoltpouch(); - this.hideDestroyCoalbag = config.hideDestroyCoalbag(); - this.hideDestroyGembag = config.hideDestroyGembag(); - this.hideDestroyHerbsack = config.hideDestroyHerbsack(); - this.hideDestroyLootingBag = config.hideDestroyLootingBag(); - this.hideDestroyRunepouch = config.hideDestroyRunepouch(); - this.hideDropRunecraftingPouch = config.hideDropRunecraftingPouch(); - this.hideExamine = config.hideExamine(); - this.hideLookup = config.hideLookup(); - this.hideNet = config.hideNet(); - this.hideReport = config.hideReport(); - this.hideTradeWith = config.hideTradeWith(); - this.hotkeyMod = config.hotkeyMod(); - this.maxMode = config.maxMode(); - this.questCapeMode = config.questCapeMode(); - this.rockCake = config.rockCake(); - this.swapAbyssTeleport = config.swapAbyssTeleport(); - this.swapAdmire = config.swapAdmire(); - this.swapAssignment = config.swapAssignment(); - this.swapBankExchange = config.swapBankExchange(); - this.swapBirdhouseEmpty = config.swapBirdhouseEmpty(); - this.swapBones = config.swapBones(); - this.swapBoxTrap = config.swapBoxTrap(); - this.swapChase = config.swapChase(); - this.swapClimbUpDown = config.swapClimbUpDown(); - this.swapCoalBag = config.swapCoalBag(); - this.swapContract = config.swapContract(); - this.swapEnchant = config.swapEnchant(); - this.swapFairyRingMode = config.swapFairyRingMode(); - this.swapFairyTreeMode = config.swapFairyTreeMode(); - this.swapHardWoodGrove = config.swapHardWoodGrove(); - this.swapHarpoon = config.swapHarpoon(); - this.swapHomePortalMode = config.swapHomePortalMode(); - this.swapImps = config.swapImps(); - this.swapInteract = config.swapInteract(); - this.swapMax = config.swapMax(); - this.swapMetamorphosis = config.swapMetamorphosis(); - this.swapMinigame = config.swapMinigame(); - this.swapNexus = config.swapNexus(); - this.swapObeliskMode = config.swapObeliskMode(); - this.swapOccultMode = config.swapOccultMode(); - this.swapPay = config.swapPay(); - this.swapPick = config.swapPick(); - this.swapPickpocket = config.swapPickpocket(); - this.swapPlank = config.swapPlank(); - this.swapPrivate = config.swapPrivate(); - this.swapQuestCape = config.swapQuestCape(); - this.swapQuick = config.swapQuick(); - this.swapRogueschests = config.swapRogueschests(); - this.swapSearch = config.swapSearch(); - this.swapStun = config.swapStun(); - this.swapTeleportItem = config.swapTeleportItem(); - this.swapTrade = config.swapTrade(); - this.swapTravel = config.swapTravel(); - this.swapWildernessLever = config.swapWildernessLever(); - this.swapHouseAd = config.swapHouseAd(); - this.swapHouseAdMode = config.swapHouseAdMode(); - this.swapJewelleryBox = config.swapJewelleryBox(); - this.bankWieldItem = config.bankWieldItem(); - this.bankWearItem = config.bankWearItem(); - this.bankEatItem = config.bankEatItem(); - this.bankDrinkItem = config.bankDrinkItem(); - this.bankEquipItem = config.bankEquipItem(); - this.bankInvigorateItem = config.bankInvigorateItem(); - this.swapNpcContact = config.swapNpcContact(); - this.getSwapOffer = config.getSwapOffer(); - this.hotKeyWalk = config.hotKeyWalk(); - this.hotKeyLoot = config.hotKeyLoot(); - } - - private void addBuySellEntries() - { - for (int i = 0; i < 4; i++) - { - if (buyEntries[i] != null) - { - for (AbstractComparableEntry entry : buyEntries[i]) - { - menuManager.addPriorityEntry(entry); - } - } - if (sellEntries[i] != null) - { - for (AbstractComparableEntry entry : sellEntries[i]) - { - menuManager.addPriorityEntry(entry); - } - } - } - } - - private void removeBuySellEntries() - { - for (int i = 0; i < 4; i++) - { - if (buyEntries[i] != null) - { - for (AbstractComparableEntry entry : buyEntries[i]) - { - menuManager.removePriorityEntry(entry); - } - } - if (sellEntries[i] != null) - { - for (AbstractComparableEntry entry : sellEntries[i]) - { - menuManager.removePriorityEntry(entry); - } - } - } - } - - /** - * Fills the buy/sell entry arrays - */ - private void updateBuySellEntries() - { - List tmp; - - if (config.getSwapBuyOne()) - { - tmp = Text.fromCSV(config.getBuyOneItems()); - buyEntries[0] = new AbstractComparableEntry[tmp.size()]; - - ShopComparableEntry.populateArray(buyEntries[0], tmp, true, 1); - } - else - { - buyEntries[0] = null; - } - - if (config.getSwapBuyFive()) - { - tmp = Text.fromCSV(config.getBuyFiveItems()); - buyEntries[1] = new AbstractComparableEntry[tmp.size()]; - - ShopComparableEntry.populateArray(buyEntries[1], tmp, true, 5); - } - else - { - buyEntries[1] = null; - } - - if (config.getSwapBuyTen()) - { - tmp = Text.fromCSV(config.getBuyTenItems()); - buyEntries[2] = new AbstractComparableEntry[tmp.size()]; - - ShopComparableEntry.populateArray(buyEntries[2], tmp, true, 10); - } - else - { - buyEntries[2] = null; - } - - if (config.getSwapBuyFifty()) - { - tmp = Text.fromCSV(config.getBuyFiftyItems()); - buyEntries[3] = new AbstractComparableEntry[tmp.size()]; - - ShopComparableEntry.populateArray(buyEntries[3], tmp, true, 50); - } - else - { - buyEntries[3] = null; - } - - if (config.getSwapSellOne()) - { - tmp = Text.fromCSV(config.getSellOneItems()); - sellEntries[0] = new AbstractComparableEntry[tmp.size()]; - - ShopComparableEntry.populateArray(sellEntries[0], tmp, false, 1); - } - else - { - sellEntries[0] = null; - } - - if (config.getSwapSellFive()) - { - tmp = Text.fromCSV(config.getSellFiveItems()); - sellEntries[1] = new AbstractComparableEntry[tmp.size()]; - - ShopComparableEntry.populateArray(sellEntries[1], tmp, false, 5); - } - else - { - sellEntries[1] = null; - } - - if (config.getSwapSellTen()) - { - tmp = Text.fromCSV(config.getSellTenItems()); - sellEntries[2] = new AbstractComparableEntry[tmp.size()]; - - ShopComparableEntry.populateArray(sellEntries[2], tmp, false, 10); - } - else - { - sellEntries[2] = null; - } - - if (config.getSwapSellFifty()) - { - tmp = Text.fromCSV(config.getSellFiftyItems()); - sellEntries[3] = new AbstractComparableEntry[tmp.size()]; - - ShopComparableEntry.populateArray(sellEntries[3], tmp, false, 50); - } - else - { - sellEntries[3] = null; - } - } - - private void addWithdrawEntries() - { - for (int i = 0; i < 5; i++) - { - if (withdrawEntries[i] != null) - { - for (AbstractComparableEntry entry : withdrawEntries[i]) - { - menuManager.addPriorityEntry(entry); - } - } - } - } - - private void removeWithdrawEntries() - { - for (int i = 0; i < 5; i++) - { - if (withdrawEntries[i] != null) - { - for (AbstractComparableEntry entry : withdrawEntries[i]) - { - menuManager.removePriorityEntry(entry); - } - } - } - } - - private void updateWithdrawEntries() - { - List tmp; - - if (config.getWithdrawOne()) - { - tmp = Text.fromCSV(config.getWithdrawOneItems()); - withdrawEntries[0] = new AbstractComparableEntry[tmp.size()]; - - WithdrawComparableEntry.populateArray(withdrawEntries[0], tmp, WithdrawComparableEntry.Amount.ONE); - } - else - { - withdrawEntries[0] = null; - } - - if (config.getWithdrawFive()) - { - tmp = Text.fromCSV(config.getWithdrawFiveItems()); - withdrawEntries[1] = new AbstractComparableEntry[tmp.size()]; - - WithdrawComparableEntry.populateArray(withdrawEntries[1], tmp, WithdrawComparableEntry.Amount.FIVE); - } - else - { - withdrawEntries[1] = null; - } - - if (config.getWithdrawTen()) - { - tmp = Text.fromCSV(config.getWithdrawTenItems()); - withdrawEntries[2] = new AbstractComparableEntry[tmp.size()]; - - WithdrawComparableEntry.populateArray(withdrawEntries[2], tmp, WithdrawComparableEntry.Amount.TEN); - } - else - { - withdrawEntries[2] = null; - } - - if (config.getWithdrawX()) - { - tmp = Text.fromCSV(config.getWithdrawXItems()); - withdrawEntries[3] = new AbstractComparableEntry[tmp.size()]; - - WithdrawComparableEntry.populateArray(withdrawEntries[3], tmp, WithdrawComparableEntry.Amount.X); - } - else - { - withdrawEntries[3] = null; - } - - if (config.getWithdrawAll()) - { - tmp = Text.fromCSV(config.getWithdrawAllItems()); - withdrawEntries[4] = new AbstractComparableEntry[tmp.size()]; - - WithdrawComparableEntry.populateArray(withdrawEntries[4], tmp, WithdrawComparableEntry.Amount.ALL); - } - else - { - withdrawEntries[4] = null; - } - } - - private void updateRemovedObjects() - { - if (config.getRemoveObjects()) - { - removedObjects = Text.fromCSV( - Text.removeTags(config.getRemovedObjects().toLowerCase()) - ).toArray(new String[0]); - } - else - { - removedObjects = null; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/PrioParse.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/PrioParse.java deleted file mode 100644 index 7e84f55e21..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/PrioParse.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2019, Owain van Brakel - * 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.menuentryswapper; - -import com.google.common.base.Splitter; -import java.util.List; -import javax.inject.Singleton; - -@Singleton -public class PrioParse -{ - public static boolean parse(String value) - { - if (value.equals("")) - { - return true; - } - - try - { - final StringBuilder sb = new StringBuilder(); - - for (String str : value.split("\n")) - { - if (!str.startsWith("//")) - { - sb.append(str).append("\n"); - } - } - - final Splitter NEWLINE_SPLITTER = Splitter - .on("\n") - .omitEmptyStrings() - .trimResults(); - - final List tmp = NEWLINE_SPLITTER.splitToList(sb); - - for (String s : tmp) - { - final String[] strings = s.split(","); - - if (strings.length <= 1) - { - return false; - } - } - - return tmp.size() > 0; - } - catch (Exception ex) - { - return false; - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/comparables/BankComparableEntry.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/comparables/BankComparableEntry.java deleted file mode 100644 index f7d812a79d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/comparables/BankComparableEntry.java +++ /dev/null @@ -1,50 +0,0 @@ -package net.runelite.client.plugins.menuentryswapper.comparables; - -import lombok.EqualsAndHashCode; -import net.runelite.api.MenuEntry; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.menus.AbstractComparableEntry; -import org.apache.commons.lang3.StringUtils; - -@EqualsAndHashCode(callSuper = true) -public class BankComparableEntry extends AbstractComparableEntry -{ - public BankComparableEntry(String option, String itemName, boolean strictTarget) - { - this.setOption(option); - this.setTarget(Text.standardize(itemName)); - this.setStrictTarget(strictTarget); - } - - public boolean matches(MenuEntry entry) - { - if (isNotBankWidget(entry.getParam1())) - { - return false; - } - - if (isStrictTarget() && !Text.standardize(entry.getTarget()).equals(this.getTarget())) - { - return false; - } - - return StringUtils.containsIgnoreCase(entry.getOption(), this.getOption()) && Text.standardize(entry.getTarget()).contains(this.getTarget()); - } - - @Override - public int getPriority() - { - return 100; - } - - static boolean isNotBankWidget(int widgetID) - { - final int groupId = WidgetInfo.TO_GROUP(widgetID); - - return groupId != WidgetID.BANK_GROUP_ID - && groupId != WidgetID.BANK_INVENTORY_GROUP_ID - && groupId != WidgetID.GRAND_EXCHANGE_GROUP_ID; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/comparables/EquipmentComparableEntry.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/comparables/EquipmentComparableEntry.java deleted file mode 100644 index a6fd25d695..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/comparables/EquipmentComparableEntry.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.runelite.client.plugins.menuentryswapper.comparables; - -import lombok.EqualsAndHashCode; -import net.runelite.api.MenuEntry; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.menus.AbstractComparableEntry; -import org.apache.commons.lang3.StringUtils; - -@EqualsAndHashCode(callSuper = true) -public class EquipmentComparableEntry extends AbstractComparableEntry -{ - public EquipmentComparableEntry(String option, String itemName) - { - this.setOption(option); - this.setTarget(Text.standardize(itemName)); - } - - public boolean matches(MenuEntry entry) - { - final int groupId = WidgetInfo.TO_GROUP(entry.getParam1()); - - if (groupId != WidgetID.EQUIPMENT_GROUP_ID) - { - return false; - } - - return StringUtils.equalsIgnoreCase(entry.getOption(), this.getOption()) - && Text.standardize(entry.getTarget()).contains(this.getTarget()); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/comparables/GrimyHerbComparableEntry.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/comparables/GrimyHerbComparableEntry.java deleted file mode 100644 index 970a00c557..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/comparables/GrimyHerbComparableEntry.java +++ /dev/null @@ -1,71 +0,0 @@ -package net.runelite.client.plugins.menuentryswapper.comparables; - -import net.runelite.api.Client; -import net.runelite.api.MenuEntry; -import net.runelite.api.Skill; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.menus.AbstractComparableEntry; -import net.runelite.client.plugins.menuentryswapper.util.GrimyHerbLookup; -import net.runelite.client.plugins.menuentryswapper.util.HerbNotFoundException; -import net.runelite.client.plugins.menuentryswapper.util.SwapGrimyHerbMode; -import org.apache.commons.lang3.StringUtils; - -public class GrimyHerbComparableEntry extends AbstractComparableEntry -{ - private final SwapGrimyHerbMode mode; - - private final GrimyHerbLookup lookup = new GrimyHerbLookup(); - private final Client client; - - public GrimyHerbComparableEntry(SwapGrimyHerbMode mode, Client client) - { - this.mode = mode; - this.client = client; - } - - @Override - public int getPriority() - { - return 100; - } - - @Override - public boolean equals(Object other) - { - return other instanceof GrimyHerbComparableEntry && ((GrimyHerbComparableEntry) other).mode == mode && super.equals(other); - } - - public boolean matches(MenuEntry entry) - { - final int groupId = WidgetInfo.TO_GROUP(entry.getParam1()); - - if (groupId != WidgetID.INVENTORY_GROUP_ID) - { - return false; - } - - int cleanLevel; - try - { - cleanLevel = lookup.getCleanLevel(entry.getIdentifier()); - } - catch (HerbNotFoundException e) - { - return false; - } - - if (this.mode == SwapGrimyHerbMode.USE) - { - return StringUtils.equalsIgnoreCase(entry.getOption(), "use"); - } - - String swapOption = "use"; - if (client.getBoostedSkillLevel(Skill.HERBLORE) >= cleanLevel) - { - swapOption = "clean"; - } - - return StringUtils.equalsIgnoreCase(entry.getOption(), swapOption); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/comparables/InventoryComparableEntry.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/comparables/InventoryComparableEntry.java deleted file mode 100644 index 980dbe46f0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/comparables/InventoryComparableEntry.java +++ /dev/null @@ -1,37 +0,0 @@ -package net.runelite.client.plugins.menuentryswapper.comparables; - -import lombok.EqualsAndHashCode; -import net.runelite.api.MenuEntry; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.menus.AbstractComparableEntry; -import org.apache.commons.lang3.StringUtils; - -@EqualsAndHashCode(callSuper = true) -public class InventoryComparableEntry extends AbstractComparableEntry -{ - public InventoryComparableEntry(String option, String itemName, boolean strictTarget) - { - this.setOption(option); - this.setTarget(Text.standardize(itemName)); - this.setStrictTarget(strictTarget); - } - - public boolean matches(MenuEntry entry) - { - final int groupId = WidgetInfo.TO_GROUP(entry.getParam1()); - - if (groupId != WidgetID.INVENTORY_GROUP_ID) - { - return false; - } - - if (isStrictTarget() && Text.standardize(entry.getTarget()).equals(this.getTarget())) - { - return false; - } - - return StringUtils.containsIgnoreCase(entry.getOption(), this.getOption()) && Text.standardize(entry.getTarget()).contains(this.getTarget()); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/comparables/ShopComparableEntry.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/comparables/ShopComparableEntry.java deleted file mode 100644 index 827681559c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/comparables/ShopComparableEntry.java +++ /dev/null @@ -1,46 +0,0 @@ -package net.runelite.client.plugins.menuentryswapper.comparables; - -import java.util.List; -import net.runelite.api.MenuEntry; -import net.runelite.api.util.Text; -import net.runelite.client.menus.AbstractComparableEntry; - -public class ShopComparableEntry extends AbstractComparableEntry -{ - private ShopComparableEntry(final boolean buy, final int amount, final String item) - { - assert amount == 1 || amount == 5 || amount == 10 || amount == 50 : "Only 1, 5, 10, or 50 are valid amounts"; - - this.setOption((buy ? "buy " : "sell ") + amount); - this.setTarget(Text.standardize(item)); - } - - @Override - public boolean matches(final MenuEntry entry) - { - return Text.standardize(entry.getOption()).equals(this.getOption()) && Text.standardize(entry.getTarget()).equals(this.getTarget()); - } - - @Override - public int getPriority() - { - return 100; - } - - @Override - public boolean equals(Object other) - { - return other instanceof ShopComparableEntry && super.equals(other); - } - - /** - * Fills the array with ShopComparableEntries, getting the items from the fed list - */ - public static void populateArray(final AbstractComparableEntry[] array, final List items, final boolean buy, final int amount) - { - for (int i = 0; i < array.length; i++) - { - array[i] = new ShopComparableEntry(buy, amount, items.get(i)); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/comparables/WithdrawComparableEntry.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/comparables/WithdrawComparableEntry.java deleted file mode 100644 index 586cd2d59b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/comparables/WithdrawComparableEntry.java +++ /dev/null @@ -1,83 +0,0 @@ -package net.runelite.client.plugins.menuentryswapper.comparables; - -import java.util.List; -import lombok.AllArgsConstructor; -import lombok.EqualsAndHashCode; -import net.runelite.api.MenuEntry; -import net.runelite.api.util.Text; -import net.runelite.client.menus.AbstractComparableEntry; - -@EqualsAndHashCode(callSuper = true) -public class WithdrawComparableEntry extends AbstractComparableEntry -{ - private static String x; - - private final Amount amount; - - private WithdrawComparableEntry(Amount amount, String item) - { - this.amount = amount; - this.setTarget(Text.standardize(item)); - } - - @Override - public boolean matches(MenuEntry entry) - { - if (BankComparableEntry.isNotBankWidget(entry.getParam1())) - { - return false; - } - - final String option = entry.getOption(); - - if (!option.startsWith("Withdraw") && !option.startsWith("Deposit")) - { - return false; - } - - if (amount == Amount.X) - { - if (!option.endsWith(x)) - { - return false; - } - } - else if (!option.endsWith(amount.suffix)) - { - return false; - } - - return Text.standardize(entry.getTarget()).contains(this.getTarget()); - } - - @Override - public int getPriority() - { - return 10; - } - - public static void setX(int amount) - { - x = String.valueOf(amount); - } - - public static void populateArray(AbstractComparableEntry[] array, List items, Amount amount) - { - for (int i = 0; i < array.length; i++) - { - array[i] = new WithdrawComparableEntry(amount, items.get(i)); - } - } - - @AllArgsConstructor - public enum Amount - { - ONE("1"), - FIVE("5"), - TEN("10"), - X(null), - ALL("All"); - - private String suffix; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/ArdougneCloakMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/ArdougneCloakMode.java deleted file mode 100644 index 02812ca8f4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/ArdougneCloakMode.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.runelite.client.plugins.menuentryswapper.util; - -public enum ArdougneCloakMode -{ - TELE_TO_MONASTERY("Monastery Teleport", "Kandarin Monastery"), - TELE_TO_FARM("Farm Teleport", "Ardougne Farm"); - - private final String name, name2; - - ArdougneCloakMode(String name, String name2) - { - this.name = name; - this.name2 = name2; - } - - @Override - public String toString() - { - return name; - } - - public String toString2() - { - return name2; - } -} - diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/BurningAmuletMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/BurningAmuletMode.java deleted file mode 100644 index 94f1c20038..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/BurningAmuletMode.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2018, Kyle - * 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.menuentryswapper.util; - -public enum BurningAmuletMode -{ - CHAOS_TEMPLE("Chaos Temple"), - BANDIT_CAMP("Bandit Camp"), - LAVA_MAZE("Lava Maze"); - - private final String name; - - BurningAmuletMode(String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/CombatBraceletMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/CombatBraceletMode.java deleted file mode 100644 index fff1333f2b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/CombatBraceletMode.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2018, Kyle - * 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.menuentryswapper.util; - -public enum CombatBraceletMode -{ - WARRIORS_GUILD("Warriors' Guild"), - CHAMPIONS_GUILD("Champions' Guild"), - EDGEVILLE_MONASTERY("Edgeville Monstery"), - RANGING_GUILD("Ranging Guild"); - - private final String name; - - CombatBraceletMode(String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/ConstructionCapeMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/ConstructionCapeMode.java deleted file mode 100644 index 41966d61d6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/ConstructionCapeMode.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.runelite.client.plugins.menuentryswapper.util; - -public enum ConstructionCapeMode -{ - TELE_TO_POH("Tele to POH"), - TELEPORT("Teleport"); - - private final String name; - - ConstructionCapeMode(String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/ConstructionMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/ConstructionMode.java deleted file mode 100644 index c168f12ab6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/ConstructionMode.java +++ /dev/null @@ -1,40 +0,0 @@ -package net.runelite.client.plugins.menuentryswapper.util; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.client.menus.BaseComparableEntry; -import static net.runelite.client.menus.ComparableEntries.newBaseComparableEntry; - -@Getter -@AllArgsConstructor -public enum ConstructionMode -{ - BENCH("Benches", - newBaseComparableEntry("Remove", "bench", -1, -1, true, false), - newBaseComparableEntry("Build", "Seating space", -1, -1, true, true)), - CHAIR("Chairs", - newBaseComparableEntry("Remove", "chair", -1, -1, true, false), - newBaseComparableEntry("Build", "Chair space", -1, -1, true, true)), - DUNGEON("Dungeon Doors", - newBaseComparableEntry("Remove", "door", -1, -1, true, false), - newBaseComparableEntry("Build", "Door space", -1, -1, true, true)), - LARDER("Larders", - newBaseComparableEntry("Remove", "larder", -1, -1, true, false), - newBaseComparableEntry("Build", "Larder space", -1, -1, true, true)), - MYTH_CAPE("Myth Cape", - newBaseComparableEntry("Remove", "cape", -1, -1, true, false), - newBaseComparableEntry("Build", "Guild trophy space", -1, -1, true, true)), - TABLE("Tables", - newBaseComparableEntry("Remove", "table", -1, -1, true, false), - newBaseComparableEntry("Build", "Table space", -1, -1, true, true)); - - private final String name; - private final BaseComparableEntry build; - private final BaseComparableEntry remove; - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/DigsitePendantMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/DigsitePendantMode.java deleted file mode 100644 index fb13479294..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/DigsitePendantMode.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2018, Kyle - * 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.menuentryswapper.util; - -public enum DigsitePendantMode -{ - DIGSITE("Digsite"), - FOSSIL_ISLAND("Fossil Island"), - LITHKREN("Lithkren Dungeon"); - - private final String name; - - DigsitePendantMode(String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/DuelingRingMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/DuelingRingMode.java deleted file mode 100644 index 6c4ebac7b6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/DuelingRingMode.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2019, Alan Baumgartner - * 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.menuentryswapper.util; - -public enum DuelingRingMode -{ - DUEL_ARENA("Duel Arena"), - CASTLE_WARS("Castle Wars"), - CLAN_WARS("Clan Wars"); - - private final String name; - - DuelingRingMode(String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/FairyRingMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/FairyRingMode.java deleted file mode 100644 index 13bab1fca1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/FairyRingMode.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2018, Ethan - * 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.menuentryswapper.util; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor -public enum FairyRingMode -{ - ZANARIS("Zanaris"), - LAST_DESTINATION("Last-Destination"), - CONFIGURE("Configure"), - OFF("Off"); - - private final String name; - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/FairyTreeMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/FairyTreeMode.java deleted file mode 100644 index 2f197fdfe3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/FairyTreeMode.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2018, Ethan - * 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.menuentryswapper.util; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor -public enum FairyTreeMode -{ - TREE("Tree"), - RING_ZANARIS("Zanaris"), - RING_CONFIGURE("Configure"), - RING_LAST_DESTINATION("Last-destination"), - OFF("Off"); - - private final String name; - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/GamesNecklaceMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/GamesNecklaceMode.java deleted file mode 100644 index 3d3bfb1e28..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/GamesNecklaceMode.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2019, Alan Baumgartner - * 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.menuentryswapper.util; - -public enum GamesNecklaceMode -{ - BURTHORPE("Burthorpe"), - BARBARIAN_OUTPOST("Barbarian Outpost"), - CORPOREAL_BEAST("Corporeal Beast"), - TEARS_OF_GUTHIX("Tears of Guthix"), - WINTER("Wintertodt Camp"); - - private final String name; - - GamesNecklaceMode(String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/GloryMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/GloryMode.java deleted file mode 100644 index 27a65bd379..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/GloryMode.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2019, Alan Baumgartner - * 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.menuentryswapper.util; - -public enum GloryMode -{ - EDGEVILLE("Edgeville"), - KARAMJA("Karamja"), - DRAYNOR_VILLAGE("Draynor Village"), - AL_KHARID("Al Kharid"); - - private final String name; - - GloryMode(String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/GrimyHerbLookup.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/GrimyHerbLookup.java deleted file mode 100644 index f7cf38599f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/GrimyHerbLookup.java +++ /dev/null @@ -1,57 +0,0 @@ -package net.runelite.client.plugins.menuentryswapper.util; - -import com.google.gson.Gson; -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -public class GrimyHerbLookup -{ - private static final Map mapping; - - static - { - final InputStream herbFile = GrimyHerbLookup.class.getResourceAsStream("/herbs.json"); - Gson gson = new Gson(); - mapping = gson.fromJson(new InputStreamReader(herbFile), new TypeToken>() {}.getType()); - } - - public int getCleanLevel(int itemId) - { - HerbInfo info = mapping.get(String.valueOf(itemId)); - if (info == null) - { - throw new HerbNotFoundException(); - } - - return info.level; - } - - public int getCleanedItemId(int itemId) - { - HerbInfo info = mapping.get(String.valueOf(itemId)); - if (info == null) - { - throw new HerbNotFoundException(); - } - - return info.cleanedId; - } - - public List getGrimyHerbIds() - { - return mapping.keySet().stream().mapToInt(Integer::valueOf).boxed().collect(Collectors.toList()); - } - - private static class HerbInfo - { - @SerializedName("cleaned") - private int cleanedId; - private int level; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/HerbNotFoundException.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/HerbNotFoundException.java deleted file mode 100644 index eb2d0da3a4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/HerbNotFoundException.java +++ /dev/null @@ -1,3 +0,0 @@ -package net.runelite.client.plugins.menuentryswapper.util; - -public class HerbNotFoundException extends RuntimeException {} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/HouseAdvertisementMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/HouseAdvertisementMode.java deleted file mode 100644 index 1baa1e3b8f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/HouseAdvertisementMode.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.menuentryswapper.util; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.client.menus.AbstractComparableEntry; -import static net.runelite.client.menus.ComparableEntries.newBaseComparableEntry; - -@Getter -@RequiredArgsConstructor -public enum HouseAdvertisementMode -{ - VIEW("View", newBaseComparableEntry("View", "House Advertisement")), - ADD_HOUSE("Add-House", newBaseComparableEntry("Add-House", "House Advertisement")), - VISIT_LAST("Visit-Last", newBaseComparableEntry("Visit-Last", "House Advertisement")); - - private final String name; - private final AbstractComparableEntry entry; - - @Override - public String toString() - { - return name; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/HouseMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/HouseMode.java deleted file mode 100644 index ef5ae6e320..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/HouseMode.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2018, Snakk - * 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.menuentryswapper.util; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor -public enum HouseMode -{ - ENTER("Enter"), - HOME("Home"), - BUILD_MODE("Build mode"), - FRIENDS_HOUSE("Friend's House"); - - private final String name; - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/MaxCapeMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/MaxCapeMode.java deleted file mode 100644 index 459f96a27f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/MaxCapeMode.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.runelite.client.plugins.menuentryswapper.util; - -public enum MaxCapeMode -{ - WARRIORS_GUILD("Warriors' Guild"), - FISHING_TELEPORT("Fishing Teleport"), - CRAFTING_GUILD("Crafting Guild"), - TELE_TO_POH("Tele to POH"), - POH_PORTALS("POH Portals"), - OTHER_TELEPORTS("Other Teleports"), - SPELLBOOK("Spellbook"), - FEATURES("Features"); - - private final String name; - - MaxCapeMode(String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/NecklaceOfPassageMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/NecklaceOfPassageMode.java deleted file mode 100644 index 4a13454930..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/NecklaceOfPassageMode.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2018, Kyle - * 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.menuentryswapper.util; - -public enum NecklaceOfPassageMode -{ - WIZARDS_TOWER("Wizards' Tower"), - THE_OUTPOST("The Outpost"), - EAGLES_EYRIE("Eagles' Eyrie"); - - private final String name; - - NecklaceOfPassageMode(String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/ObeliskMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/ObeliskMode.java deleted file mode 100644 index e233a879ff..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/ObeliskMode.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2018, Snakk - * 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.menuentryswapper.util; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor -public enum ObeliskMode -{ - ACTIVATE("Activate"), - SET_DESTINATION("Set destination"), - TELEPORT_TO_DESTINATION("Teleport to destination"); - - private final String name; - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/OccultAltarMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/OccultAltarMode.java deleted file mode 100644 index 54778032de..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/OccultAltarMode.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2019, Spedwards - * 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.menuentryswapper.util; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor -public enum OccultAltarMode -{ - ANCIENT("Ancient"), - LUNAR("Lunar"), - ARCEUUS("Arceuus"), - VENERATE("Venerate"); - - private final String name; - - @Override - public String toString() - { - return name; - } -} 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 deleted file mode 100644 index c7974f0c72..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/QuestCapeMode.java +++ /dev/null @@ -1,20 +0,0 @@ -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; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/RingOfWealthMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/RingOfWealthMode.java deleted file mode 100644 index 32543603f5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/RingOfWealthMode.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2018, Kyle - * 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.menuentryswapper.util; - -public enum RingOfWealthMode -{ - MISCELLANIA("Miscellania"), - GRAND_EXCHANGE("Grand Exchange"), - FALADOR("Falador"), - DONDAKAN("Dondakan"); - - private final String name; - - RingOfWealthMode(String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/SkillsNecklaceMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/SkillsNecklaceMode.java deleted file mode 100644 index acb72e760b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/SkillsNecklaceMode.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2018, Kyle - * 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.menuentryswapper.util; - -public enum SkillsNecklaceMode -{ - FISHING_GUILD("Fishing Guild"), - MINING_GUILD("Mining Guild"), - CRAFTING_GUILD("Crafting Guild"), - COOKING_GUILD("Cooking Guild"), - WOODCUTTING_GUILD("Woodcutting Guild"), - FARMING_GUILD("Farming Guild"); - - private final String name; - - SkillsNecklaceMode(String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/SlayerRingMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/SlayerRingMode.java deleted file mode 100644 index d59e5f48f7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/SlayerRingMode.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2018, Kyle - * 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.menuentryswapper.util; - -public enum SlayerRingMode -{ - CHECK("Check"), - TELEPORT("Teleport"), - MASTER("Master"), - PARTNER("Partner"), - LOG("Log"); - - private final String name; - - SlayerRingMode(String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/SwapGrimyHerbMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/SwapGrimyHerbMode.java deleted file mode 100644 index 497079cb92..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/SwapGrimyHerbMode.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.runelite.client.plugins.menuentryswapper.util; - -public enum SwapGrimyHerbMode -{ - USE("Use"), - DYNAMIC("By level"); - - private final String name; - - SwapGrimyHerbMode(String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/XericsTalismanMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/XericsTalismanMode.java deleted file mode 100644 index 9b0fd87290..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/XericsTalismanMode.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2018, Kyle - * 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.menuentryswapper.util; - -public enum XericsTalismanMode -{ - XERICS_LOOKOUT("Xeric's Look-out"), - XERICS_GLADE("Xeric's Glade"), - XERICS_INFERNO("Xeric's Inferno"), - XERICS_HEART("Xeric's Heart"), - XERICS_HONOUR("Xeric's Honour"); - - private final String name; - - XericsTalismanMode(String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/metronome/MetronomePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/metronome/MetronomePlugin.java deleted file mode 100644 index ca98b13184..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/metronome/MetronomePlugin.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 2018, SomeoneWithAnInternetConnection - * Copyright (c) 2018, oplosthee - * 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.metronome; - -import com.google.inject.Provides; -import java.io.File; -import java.io.IOException; -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.sound.sampled.AudioInputStream; -import javax.sound.sampled.AudioSystem; -import javax.sound.sampled.Clip; -import javax.sound.sampled.FloatControl; -import javax.sound.sampled.LineUnavailableException; -import javax.sound.sampled.UnsupportedAudioFileException; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.SoundEffectID; -import net.runelite.api.SoundEffectVolume; -import net.runelite.api.events.GameTick; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Metronome", - description = "Play sounds in a customisable pattern", - tags = {"skilling", "tick", "timers"}, - enabledByDefault = false, - type = PluginType.MISCELLANEOUS -) -@Slf4j -@Singleton -public class MetronomePlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private MetronomePluginConfiguration config; - - private int tickCounter = 0; - private int tockCounter = 0; - private Clip tickClip; - private Clip tockClip; - - private int tickCount; - private boolean enableTock; - private int tockNumber; - private int tickOffset; - private String tickPath; - private String tockPath; - private int volume; - - @Provides - MetronomePluginConfiguration provideConfig(ConfigManager configManager) - { - return configManager.getConfig(MetronomePluginConfiguration.class); - } - - private Clip GetAudioClip(String path) - { - File audioFile = new File(path); - if (!audioFile.exists()) - { - return null; - } - - try (AudioInputStream audioStream = AudioSystem.getAudioInputStream(audioFile)) - { - Clip audioClip = AudioSystem.getClip(); - audioClip.open(audioStream); - FloatControl gainControl = (FloatControl) audioClip.getControl(FloatControl.Type.MASTER_GAIN); - float gainValue = (((float) this.volume) * 40f / 100f) - 35f; - gainControl.setValue(gainValue); - - return audioClip; - } - catch (IOException | LineUnavailableException | UnsupportedAudioFileException e) - { - log.warn("Error opening audiostream from " + audioFile, e); - return null; - } - } - - @Override - protected void startUp() - { - updateConfig(); - - tickClip = GetAudioClip(this.tickPath); - tockClip = GetAudioClip(this.tockPath); - } - - @Override - protected void shutDown() - { - if (tickClip != null) - { - tickClip.close(); - } - if (tockClip != null) - { - tockClip.close(); - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("metronome")) - { - return; - } - - updateConfig(); - - if (event.getKey().equals("volume")) - { - float gainValue = (((float) this.volume) * 40f / 100f) - 35f; - FloatControl gainControlTick = (FloatControl) tickClip.getControl(FloatControl.Type.MASTER_GAIN); - gainControlTick.setValue(gainValue); - - FloatControl gainControlTock = (FloatControl) tockClip.getControl(FloatControl.Type.MASTER_GAIN); - gainControlTock.setValue(gainValue); - } - if (event.getKey().equals("tickSoundFilePath")) - { - if (tickClip != null) - { - tickClip.close(); - } - tickClip = GetAudioClip(this.tickPath); - } - if (event.getKey().equals("tockSoundFilePath")) - { - if (tockClip != null) - { - tockClip.close(); - } - tockClip = GetAudioClip(this.tockPath); - } - } - - @Subscribe - private void onGameTick(GameTick tick) - { - if (this.tickCount == 0) - { - return; - } - - if ((++tickCounter + this.tickOffset) % this.tickCount == 0) - { - if ((this.enableTock && this.tockNumber > 0) && ++tockCounter % this.tockNumber == 0) - { - if (tockClip == null) - { - client.playSoundEffect(SoundEffectID.GE_DECREMENT_PLOP, SoundEffectVolume.MEDIUM_HIGH); - } - else - { - if (tockClip.isRunning()) - { - tockClip.stop(); - } - tockClip.setFramePosition(0); - tockClip.start(); - } - } - else - { - if (tickClip == null) - { - client.playSoundEffect(SoundEffectID.GE_DECREMENT_PLOP, SoundEffectVolume.MEDIUM_HIGH); - } - else - { - if (tickClip.isRunning()) - { - tickClip.stop(); - } - tickClip.setFramePosition(0); - tickClip.start(); - } - } - } - } - - private void updateConfig() - { - this.tickCount = config.tickCount(); - this.enableTock = config.enableTock(); - this.tockNumber = config.tockNumber(); - this.tickOffset = config.tickOffset(); - this.tickPath = config.tickPath(); - this.tockPath = config.tockPath(); - this.volume = config.volume(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/metronome/MetronomePluginConfiguration.java b/runelite-client/src/main/java/net/runelite/client/plugins/metronome/MetronomePluginConfiguration.java deleted file mode 100644 index 27cca4ccec..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/metronome/MetronomePluginConfiguration.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2018, SomeoneWithAnInternetConnection - * Copyright (c) 2018, oplosthee - * 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.metronome; - -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("metronome") -public interface MetronomePluginConfiguration extends Config -{ - @ConfigItem( - keyName = "tickCount", - name = "Tick count", - description = "Configures the number of game ticks between metronome sounds" - ) - default int tickCount() - { - return 1; - } - - @ConfigItem( - keyName = "enableTock", - name = "Enable tock (alternating) sound", - description = "Toggles whether to play \"tock\" sounds" - ) - default boolean enableTock() - { - return false; - } - - @ConfigItem( - keyName = "tockNumber", - name = "Tock every nth \"tick\"", - description = "Configures how many \"ticks\" between each \"tock\"" - ) - default int tockNumber() - { - return 2; - } - - @ConfigItem( - keyName = "tickOffset", - name = "Offset", - description = "Amount of ticks to offset the metronome (only useful for \"tocks\")" - ) - default int tickOffset() - { - return 0; - } - - @ConfigItem( - keyName = "tickSoundFilePath", - name = "Tick .wav file path", - description = "The path to the file to be used for \"tick\" sounds (short .wav only)" - ) - default String tickPath() - { - return ""; - } - - @ConfigItem( - keyName = "tockSoundFilePath", - name = "Tock .wav file path", - description = "The path to the file to be used for \"tock\" sounds (short .wav only)" - ) - default String tockPath() - { - return ""; - } - - @Range( - min = 0, - max = 100 - ) - @ConfigItem( - keyName = "volume", - name = "Volume modification", - description = "Configures tick/tock volume; only effects custom sounds." - ) - default int volume() - { - return 35; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/minimap/MinimapConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/minimap/MinimapConfig.java deleted file mode 100644 index 36e82fb2e2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/minimap/MinimapConfig.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2018, Dreyri - * 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.minimap; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("minimap") -public interface MinimapConfig extends Config -{ - @ConfigItem( - keyName = "hdMinimapEnabled", - name = "HD minimap", - description = "Configures whether to show the minimap in higher detail (relog to see changes)", - position = 1 - ) - default boolean hdMinimapEnabled() - { - return false; - } - - @ConfigItem( - keyName = "item", - name = "Item color", - description = "Set the minimap color items are drawn in" - ) - default Color itemColor() //mapdot 0 - { - return new Color(255, 0, 0); - } - - @ConfigItem( - keyName = "npc", - name = "NPC color", - description = "Set the minimap color NPCs are drawn in" - ) - default Color npcColor() //mapdot 1 - { - return new Color(255, 255, 0); - } - - @ConfigItem( - keyName = "player", - name = "Player color", - description = "Set the minimap Color players are drawn in" - ) - default Color playerColor() //mapdot 2 - { - return new Color(255, 255, 255); - } - - @ConfigItem( - keyName = "friend", - name = "Friends color", - description = "Set the minimap color your friends are drawn in" - ) - default Color friendColor() //mapdot 3 - { - return new Color(0, 255, 0); - } - - @ConfigItem( - keyName = "team", - name = "Team color", - description = "Set the minimap color your team is drawn in" - ) - default Color teamColor() //mapdot 4 - { - return new Color(19, 110, 247); - } - - @ConfigItem( - keyName = "clan", - name = "Clan color", - description = "Set the minimap color your clan is drawn in" - ) - default Color clanColor() //mapdot 5 - { - return new Color(170, 0, 190); - } - - @ConfigItem( - keyName = "hideMinimap", - name = "Hide minimap", - description = "Do not show the minimap on screen (Resizable only)" - ) - default boolean hideMinimap() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/minimap/MinimapDot.java b/runelite-client/src/main/java/net/runelite/client/plugins/minimap/MinimapDot.java deleted file mode 100644 index 6de0afb579..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/minimap/MinimapDot.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2018, Dreyri - * 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.minimap; - -import java.awt.Color; -import net.runelite.api.Client; -import net.runelite.api.Sprite; - -class MinimapDot -{ - private static final int MAP_DOT_WIDTH = 4; - private static final int MAP_DOT_HEIGHT = 5; - - private static int[] createPixels(Color color) - { - int rgb = color.getRGB(); - - int[] pixels = new int[MAP_DOT_HEIGHT * MAP_DOT_WIDTH]; - - pixels[0] = 0; - pixels[1] = rgb; - pixels[2] = rgb; - pixels[3] = 0; - - pixels[4] = rgb; - pixels[5] = rgb; - pixels[6] = rgb; - pixels[7] = rgb; - - pixels[8] = rgb; - pixels[9] = rgb; - pixels[10] = rgb; - pixels[11] = rgb; - - pixels[12] = 1; - pixels[13] = rgb; - pixels[14] = rgb; - pixels[15] = 1; - - pixels[16] = 0; - pixels[17] = 1; - pixels[18] = 1; - pixels[19] = 0; - - return pixels; - } - - public static Sprite create(Client client, Color color) - { - int[] pixels = createPixels(color); - - return client.createSprite(pixels, MAP_DOT_WIDTH, MAP_DOT_HEIGHT); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/minimap/MinimapPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/minimap/MinimapPlugin.java deleted file mode 100644 index 90fc7df40c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/minimap/MinimapPlugin.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (c) 2018, Dreyri - * 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.minimap; - -import com.google.inject.Provides; -import java.awt.Color; -import java.util.Arrays; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.Sprite; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.WidgetHiddenChanged; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Minimap", - description = "Customize the color of minimap dots", - tags = {"items", "npcs", "players", "hd"}, - type = PluginType.UTILITY -) -public class MinimapPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private MinimapConfig config; - - private Sprite[] originalDotSprites; - private Color[] colors; - - @Provides - private MinimapConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(MinimapConfig.class); - } - - @Override - protected void startUp() - { - updateMinimapWidgetVisibility(config.hideMinimap()); - storeOriginalDots(); - replaceMapDots(); - - client.setHdMinimapEnabled(config.hdMinimapEnabled()); - } - - @Override - protected void shutDown() - { - updateMinimapWidgetVisibility(false); - restoreOriginalDots(); - - client.setHdMinimapEnabled(false); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGIN_SCREEN && originalDotSprites == null) - { - storeOriginalDots(); - replaceMapDots(); - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("minimap")) - { - return; - } - - if (event.getKey().equals("hdMinimapEnabled")) - { - client.setHdMinimapEnabled(config.hdMinimapEnabled()); - return; - } - - if (event.getKey().equals("hideMinimap")) - { - updateMinimapWidgetVisibility(config.hideMinimap()); - return; - } - - if (event.getKey().endsWith("Color")) - { - colors = null; - } - - replaceMapDots(); - } - - @Subscribe - private void onWidgetHiddenChanged(WidgetHiddenChanged event) - { - updateMinimapWidgetVisibility(config.hideMinimap()); - } - - private void updateMinimapWidgetVisibility(boolean enable) - { - final Widget resizableStonesWidget = client.getWidget(WidgetInfo.RESIZABLE_MINIMAP_STONES_WIDGET); - - if (resizableStonesWidget != null) - { - resizableStonesWidget.setHidden(enable); - } - - final Widget resizableNormalWidget = client.getWidget(WidgetInfo.RESIZABLE_MINIMAP_WIDGET); - - if (resizableNormalWidget != null && !resizableNormalWidget.isSelfHidden()) - { - for (Widget widget : resizableNormalWidget.getStaticChildren()) - { - if (widget.getId() != WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_LOGOUT_BUTTON.getId() && - widget.getId() != WidgetInfo.RESIZABLE_MINIMAP_LOGOUT_BUTTON.getId()) - { - widget.setHidden(enable); - } - } - } - } - - private void replaceMapDots() - { - Sprite[] mapDots = client.getMapDots(); - - if (mapDots == null) - { - return; - } - - Color[] minimapDotColors = getColors(); - for (int i = 0; i < mapDots.length && i < minimapDotColors.length; ++i) - { - mapDots[i] = MinimapDot.create(this.client, minimapDotColors[i]); - } - } - - private Color[] getColors() - { - if (colors == null) - { - colors = new Color[] - { - config.itemColor(), - config.npcColor(), - config.playerColor(), - config.friendColor(), - config.teamColor(), - config.clanColor() - }; - } - return colors; - } - - private void storeOriginalDots() - { - Sprite[] originalDots = client.getMapDots(); - - if (originalDots == null) - { - return; - } - - originalDotSprites = Arrays.copyOf(originalDots, originalDots.length); - } - - private void restoreOriginalDots() - { - Sprite[] mapDots = client.getMapDots(); - - if (originalDotSprites == null || mapDots == null) - { - return; - } - - System.arraycopy(originalDotSprites, 0, mapDots, 0, mapDots.length); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningCoalBagOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningCoalBagOverlay.java deleted file mode 100644 index cdcf2ad670..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningCoalBagOverlay.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2019 Jarred Vardy - * 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.mining; - -import java.awt.Color; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.ItemID; -import net.runelite.api.Point; -import net.runelite.api.widgets.WidgetItem; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.overlay.WidgetItemOverlay; - -@Singleton -public class MiningCoalBagOverlay extends WidgetItemOverlay -{ - private final MiningPlugin plugin; - - @Inject - MiningCoalBagOverlay(final MiningPlugin plugin) - { - showOnInventory(); - this.plugin = plugin; - } - - @Override - public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget) - { - if (!plugin.isShowCoalBagOverlay() || (itemId != ItemID.COAL_BAG && itemId != ItemID.COAL_BAG_12019)) - { - return; - } - - graphics.setFont(FontManager.getRunescapeSmallFont()); - graphics.setColor(Color.WHITE); - Point location = itemWidget.getCanvasLocation(); - - graphics.drawString(plugin.getAmountOfCoalInCoalBag() + "", location.getX(), location.getY() + 14); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningConfig.java deleted file mode 100644 index 33d71e2db6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningConfig.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright 2019 Jarred Vardy - * 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.mining; - -import java.awt.Color; -import net.runelite.client.config.Alpha; -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("mining") -public interface MiningConfig extends Config -{ - @ConfigItem( - keyName = "showCoalBagOverlay", - name = "Show coal bag overlay", - description = "Overlays how much coal is inside of your coal bag" - ) - default boolean showCoalBagOverlay() - { - return true; - } - - @ConfigItem( - keyName = "amountOfCoalInCoalBag", - name = "", - description = "To store coal amount between sessions", - hidden = true - ) - default int amountOfCoalInCoalBag() - { - return 0; - } - - @ConfigItem( - keyName = "amountOfCoalInCoalBag", - name = "", - description = "Overload to set coal amount", - hidden = true - ) - void amountOfCoalInCoalBag(int amount); - - @Alpha - @ConfigItem( - keyName = "progressPieColor", - name = "Main progress pie color", - description = "Configures the color of the main progress pie" - ) - default Color progressPieColor() - { - return Color.YELLOW; - } - - @Alpha - @ConfigItem( - keyName = "progressPieColorMotherlode", - name = "Motherlode random respawn threshold progress pie color", - description = "Configures the color of the progress pie after Motherlode respawn threshold" - ) - default Color progressPieColorMotherlode() - { - return Color.GREEN; - } - - @ConfigItem( - keyName = "progressPieInverted", - name = "Invert progress pie", - description = "Configures whether the progress pie goes from empty to full or the other way around" - ) - default boolean progressPieInverted() - { - return false; - } - - @Range( - min = 1, - max = 50 - ) - @ConfigItem( - keyName = "progressPieDiameter", - name = "Progress pie diameter", - description = "Configures how big the progress pie is" - ) - default int progressPieDiameter() - { - return 30; - } -} 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 deleted file mode 100644 index ab800ee722..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningOverlay.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * 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.mining; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.time.Instant; -import java.util.Iterator; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -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.components.ProgressPieComponent; - -@Singleton -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 = 166; - 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 static final int MOTHERLODE_UPPER_FLOOR_HEIGHT = -500; - - private final Client client; - private final MiningPlugin plugin; - private final MiningConfig config; - - @Inject - private MiningOverlay(final Client client, final MiningPlugin plugin, final MiningConfig config) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.plugin = plugin; - this.client = client; - this.config = config; - } - - @Override - public Dimension render(Graphics2D graphics) - { - List respawns = plugin.getRespawns(); - if (respawns.isEmpty()) - { - return null; - } - - Instant now = Instant.now(); - for (Iterator it = respawns.iterator(); it.hasNext(); ) - { - Color pieFillColor = config.progressPieColor(); - Color pieBorderColor; - RockRespawn rockRespawn = it.next(); - float percent = (now.toEpochMilli() - rockRespawn.getStartTime().toEpochMilli()) / (float) rockRespawn.getRespawnTime(); - WorldPoint worldPoint = rockRespawn.getWorldPoint(); - LocalPoint loc = LocalPoint.fromWorld(client, worldPoint); - if (loc == null || percent > 1.0f) - { - it.remove(); - continue; - } - - Point point = Perspective.localToCanvas(client, loc, client.getPlane(), rockRespawn.getZOffset()); - if (point == null) - { - it.remove(); - continue; - } - - Rock rock = rockRespawn.getRock(); - - // Only draw timer for veins on the same level in motherlode mine - LocalPoint localLocation = client.getLocalPlayer().getLocalLocation(); - if (rock == Rock.ORE_VEIN && isUpstairsMotherlode(localLocation) != isUpstairsMotherlode(loc)) - { - continue; - } - - // Recolour pie on motherlode veins during the portion of the timer where they may respawn - if (rock == Rock.ORE_VEIN && percent > ORE_VEIN_RANDOM_PERCENT_THRESHOLD) - { - pieFillColor = config.progressPieColorMotherlode(); - } - - if (config.progressPieInverted()) - { - percent = 1.0f - percent; - } - - pieBorderColor = pieFillColor.darker(); - - ProgressPieComponent ppc = new ProgressPieComponent(); - ppc.setDiameter(config.progressPieDiameter()); - ppc.setBorderColor(pieBorderColor); - ppc.setFill(pieFillColor); - ppc.setPosition(point); - ppc.setProgress(percent); - ppc.render(graphics); - } - return null; - } - - /** - * Checks if the given point is "upstairs" in the mlm. - * The upper floor is actually on z=0. - *

- * This method assumes that the given point is already in the mlm - * and is not meaningful when outside the mlm. - * - * @param localPoint the LocalPoint to be tested - * @return true if localPoint is at same height as mlm upper floor - */ - private boolean isUpstairsMotherlode(LocalPoint localPoint) - { - return Perspective.getTileHeight(client, localPoint, 0) < MOTHERLODE_UPPER_FLOOR_HEIGHT; - } -} 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 deleted file mode 100644 index 0a2b6727a7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningPlugin.java +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Copyright (c) 2019, Adam - * Copyright (c) 2018, Anthony - * Copyright (c) 2019, Jarred Vardy - * 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.mining; - -import com.google.inject.Provides; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.GameState; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemID; -import net.runelite.api.MenuOpcode; -import static net.runelite.api.ObjectID.DEPLETED_VEIN_26665; -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.ChatMessage; -import net.runelite.api.events.GameObjectDespawned; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.WallObjectSpawned; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "Mining", - description = "Show ore respawn timers and coal bag overlay", - tags = {"overlay", "skilling", "timers", "coal", "coalbag", "coal bag"}, - enabledByDefault = false, - type = PluginType.SKILLING -) -@Singleton -public class MiningPlugin extends Plugin -{ - private static final int MINING_GUILD_REGION = 12183; - private static final int ROCK_DISTANCE = 14; - - private static final Pattern COAL_BAG_EMPTY_MESSAGE = Pattern.compile("^The coal bag is (now )?empty\\.$"); - private static final Pattern COAL_BAG_ONE_MESSAGE = Pattern.compile("^The coal bag contains one piece of coal\\.$"); - private static final Pattern COAL_BAG_AMOUNT_MESSAGE = Pattern.compile("^The coal bag contains (\\d+) pieces of coal\\.$"); - - private static final int MAX_INVENTORY_SPACE = 28; - private static final int FULL_COAL_BAG_AMOUNT = 27; - - private static final String FILL_OPTION = "fill"; - private static final String EMPTY_OPTION = "empty"; - - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private MiningOverlay miningOverlay; - - @Inject - private MiningCoalBagOverlay coalBagOverlay; - - @Inject - private MiningConfig config; - - @Getter(AccessLevel.PACKAGE) - private final List respawns = new ArrayList<>(); - private boolean recentlyLoggedIn; - - @Getter(AccessLevel.PACKAGE) - private boolean showCoalBagOverlay; - @Getter(AccessLevel.PACKAGE) - private int amountOfCoalInCoalBag; - - @Override - protected void startUp() - { - - this.showCoalBagOverlay = config.showCoalBagOverlay(); - this.amountOfCoalInCoalBag = config.amountOfCoalInCoalBag(); - - overlayManager.add(miningOverlay); - overlayManager.add(coalBagOverlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(miningOverlay); - overlayManager.remove(coalBagOverlay); - respawns.clear(); - } - - @Provides - MiningConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(MiningConfig.class); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - switch (event.getGameState()) - { - case LOADING: - case HOPPING: - respawns.clear(); - break; - case LOGGED_IN: - // After login rocks that are depleted will be changed, - // so wait for the next game tick before watching for - // rocks to deplete - recentlyLoggedIn = true; - break; - } - } - - @Subscribe - private void onGameTick(GameTick gameTick) - { - recentlyLoggedIn = false; - } - - @Subscribe - private void onGameObjectDespawned(GameObjectDespawned event) - { - if (client.getGameState() != GameState.LOGGED_IN || recentlyLoggedIn) - { - return; - } - - final GameObject object = event.getGameObject(); - final int region = client.getLocalPlayer().getWorldLocation().getRegionID(); - - Rock rock = Rock.getRock(object.getId()); - if (rock != null) - { - RockRespawn rockRespawn = new RockRespawn(rock, object.getWorldLocation(), Instant.now(), (int) rock.getRespawnTime(region).toMillis(), rock.getZOffset()); - respawns.add(rockRespawn); - } - } - - @Subscribe - private void onWallObjectSpawned(WallObjectSpawned event) - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - final WallObject object = event.getWallObject(); - final int region = client.getLocalPlayer().getWorldLocation().getRegionID(); - - switch (object.getId()) - { - case EMPTY_WALL: - { - Rock rock = Rock.AMETHYST; - RockRespawn rockRespawn = new RockRespawn(rock, object.getWorldLocation(), Instant.now(), (int) rock.getRespawnTime(region).toMillis(), rock.getZOffset()); - respawns.add(rockRespawn); - break; - } - case DEPLETED_VEIN_26665: // Depleted motherlode vein - case DEPLETED_VEIN_26666: // Depleted motherlode vein - case DEPLETED_VEIN_26667: // Depleted motherlode vein - case DEPLETED_VEIN_26668: // Depleted motherlode vein - { - Rock rock = Rock.ORE_VEIN; - RockRespawn rockRespawn = new RockRespawn(rock, object.getWorldLocation(), Instant.now(), (int) rock.getRespawnTime(region).toMillis(), rock.getZOffset()); - 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; - } - } - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked event) - { - //TODO: should work hopefully - if (event.getMenuOpcode() != MenuOpcode.RUNELITE || event.getParam1() != WidgetInfo.INVENTORY.getId()) - { - return; - } - - ItemContainer inventoryItemContainer = client.getItemContainer(InventoryID.INVENTORY); - Item[] inventoryItems = new Item[0]; - if (inventoryItemContainer != null) - { - inventoryItems = inventoryItemContainer.getItems(); - } - - switch (event.getOption().toLowerCase()) - { - case FILL_OPTION: - int coalInInventoryCount = (int) Arrays.stream(inventoryItems).filter(i -> i.getId() == ItemID.COAL).count(); - updateAmountOfCoalInBag(coalInInventoryCount); - break; - - case EMPTY_OPTION: - int emptyInventorySpaceCount = (int) Arrays.stream(inventoryItems).filter(i -> i.getId() != -1).count(); - int difference = MAX_INVENTORY_SPACE - emptyInventorySpaceCount; - updateAmountOfCoalInBag(-difference); - break; - } - } - - @Subscribe - private void onChatMessage(ChatMessage event) - { - if (event.getType() != ChatMessageType.GAMEMESSAGE) - { - return; - } - - String chatMsg = event.getMessage(); - if (COAL_BAG_EMPTY_MESSAGE.matcher(chatMsg).find()) - { - updateAmountOfCoalInBag(0); - } - else if (COAL_BAG_ONE_MESSAGE.matcher(chatMsg).find()) - { - updateAmountOfCoalInBag(1); - } - else - { - Matcher matcher = COAL_BAG_AMOUNT_MESSAGE.matcher(chatMsg); - if (matcher.find()) - { - updateAmountOfCoalInBag(Integer.parseInt(matcher.group(1)) - this.amountOfCoalInCoalBag); - } - } - } - - /** - * Update the player's count of coal in their Coal Bag - * - * @param delta How much to add/subtract from the amount. - * Supply a negative number to subtract, or positive number to add. - */ - private void updateAmountOfCoalInBag(int delta) - { - // check for upper/lower bounds of amount of coal in a bag - // 0 <= X <= 27 - int coalbagAmount = Math.max(0, Math.min(FULL_COAL_BAG_AMOUNT, this.amountOfCoalInCoalBag + delta)); - config.amountOfCoalInCoalBag(coalbagAmount); - this.amountOfCoalInCoalBag = coalbagAmount; - } - - private boolean inMiningGuild() - { - return client.getLocalPlayer().getWorldLocation().getRegionID() == MINING_GUILD_REGION; - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("mining")) - { - return; - } - - this.showCoalBagOverlay = config.showCoalBagOverlay(); - this.amountOfCoalInCoalBag = config.amountOfCoalInCoalBag(); - } -} 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 deleted file mode 100644 index 582d7fd14a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mining/Rock.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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.mining; - -import com.google.common.collect.ImmutableMap; -import java.time.Duration; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import static net.runelite.api.ObjectID.*; - -enum Rock -{ - TIN(Duration.ofMillis(2400), 0, ROCKS_11360, ROCKS_11361), - COPPER(Duration.ofMillis(2400), 0, ROCKS_10943, ROCKS_11161), - IRON(Duration.ofMillis(5400), 0, ROCKS_11364, ROCKS_11365, ROCKS_36203) - { - @Override - Duration getRespawnTime(int region) - { - return region == MINING_GUILD ? Duration.ofMillis(2400) : super.respawnTime; - } - }, - COAL(Duration.ofMillis(29400), 0, ROCKS_11366, ROCKS_11367, ROCKS_36204) - { - @Override - Duration getRespawnTime(int region) - { - switch (region) - { - case MINING_GUILD: - return Duration.ofMillis(14400); - case MISCELLANIA: - return Duration.ofMillis(6600); - default: - return super.respawnTime; - } - } - }, - SILVER(Duration.ofMinutes(1), 0, ROCKS_11368, ROCKS_11369, ROCKS_36205), - SANDSTONE(Duration.ofMillis(5400), 0, ROCKS_11386), - GOLD(Duration.ofMinutes(1), 0, ROCKS_11370, ROCKS_11371, ROCKS_36206), - GRANITE(Duration.ofMillis(5400), 0, ROCKS_11387), - MITHRIL(Duration.ofMinutes(2), 0, ROCKS_11372, ROCKS_11373, ROCKS_36207) - { - @Override - Duration getRespawnTime(int region) - { - return region == MINING_GUILD ? Duration.ofMinutes(1) : super.respawnTime; - } - }, - ADAMANTITE(Duration.ofMinutes(4), 0, ROCKS_11374, ROCKS_11375, ROCKS_36208) - { - @Override - Duration getRespawnTime(int region) - { - return region == MINING_GUILD || region == WILDERNESS_RESOURCE_AREA ? Duration.ofMinutes(2) : super.respawnTime; - } - }, - RUNITE(Duration.ofMinutes(12), 0, ROCKS_11376, ROCKS_11377, ROCKS_36209) - { - @Override - Duration getRespawnTime(int region) - { - return region == MINING_GUILD ? Duration.ofMinutes(6) : super.respawnTime; - } - }, - ORE_VEIN(Duration.ofSeconds(MiningOverlay.ORE_VEIN_MAX_RESPAWN_TIME), 150), - AMETHYST(Duration.ofSeconds(75), 120), - ASH_VEIN(Duration.ofSeconds(30), 0, ASH_PILE), - GEM_ROCK(Duration.ofMinutes(1), 0, ROCKS_11380, ROCKS_11381); - - private static final int WILDERNESS_RESOURCE_AREA = 12605; - private static final int MISCELLANIA = 10044; - private static final int MINING_GUILD = 12183; - private static final Map ROCKS; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - for (Rock rock : values()) - { - for (int id : rock.ids) - { - builder.put(id, rock); - } - } - ROCKS = builder.build(); - } - - private final Duration respawnTime; - @Getter(AccessLevel.PACKAGE) - private final int zOffset; - private final int[] ids; - - Rock(Duration respawnTime, int zOffset, int... ids) - { - this.respawnTime = respawnTime; - this.zOffset = zOffset; - this.ids = ids; - } - - Duration getRespawnTime(int region) - { - return respawnTime; - } - - static Rock getRock(int id) - { - return ROCKS.get(id); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mining/RockRespawn.java b/runelite-client/src/main/java/net/runelite/client/plugins/mining/RockRespawn.java deleted file mode 100644 index 6b00652af4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mining/RockRespawn.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.mining; - -import java.time.Instant; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.coords.WorldPoint; - -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -class RockRespawn -{ - private final Rock rock; - private final WorldPoint worldPoint; - private final Instant startTime; - private final int respawnTime; - private final int zOffset; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodeConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodeConfig.java deleted file mode 100644 index 3263a9c033..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodeConfig.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * Copyright (c) 2018, Lars - * 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.motherlode; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("motherlode") -public interface MotherlodeConfig extends Config -{ - @ConfigItem( - keyName = "showVeins", - name = "Show pay-dirt mining spots", - description = "Configures whether or not the pay-dirt mining spots are displayed." - ) - default boolean showVeins() - { - return true; - } - - @ConfigItem( - keyName = "showRocks", - name = "Show rocks obstacles", - description = "Configures whether or not the fallen rocks obstacles are displayed." - ) - default boolean showRockFalls() - { - return true; - } - - @ConfigItem( - keyName = "statTimeout", - name = "Reset stats (minutes)", - description = "Configures the time until statistics are reset" - ) - default int statTimeout() - { - return 5; - } - - @ConfigItem( - keyName = "showSack", - name = "Show pay-dirt sack", - description = "Configures whether the pay-dirt sack is displayed or not." - ) - default boolean showSack() - { - return true; - } - - @ConfigItem( - keyName = "showMiningStats", - name = "Show mining session stats", - description = "Configures whether to display mining session stats" - ) - default boolean showMiningStats() - { - return true; - } - - @ConfigItem( - keyName = "showDepositsLeft", - name = "Show deposits left", - description = "Displays deposits left before sack is full" - ) - default boolean showDepositsLeft() - { - return true; - } - - @ConfigItem( - keyName = "showMiningState", - name = "Show current mining state", - description = "Shows current mining state. 'You are currently mining' / 'You are currently NOT mining'" - ) - default boolean showMiningState() - { - return true; - } - - @ConfigItem( - keyName = "showGemsFound", - name = "Show gems found", - description = "Shows gems found during current mining session" - ) - default boolean showGemsFound() - { - return true; - } - - @ConfigItem( - keyName = "showOresFound", - name = "Show ores found", - description = "Shows the ores found during current mining session" - ) - default boolean showOresFound() - { - return true; - } - - @ConfigItem( - keyName = "notifyOnIdle", - name = "Idle notification", - description = "Sends a notification when the player stops mining" - ) - default boolean notifyOnIdle() - { - return false; - } - - @ConfigItem( - keyName = "showTargetVein", - name = "Show vein currently being mined", - description = "Highlights the vein currently being mined" - ) - default boolean showTargetVein() - { - return false; - } - - @ConfigItem( - keyName = "payDirtMsg", - name = "Pay-dirt!", - description = "Send a public message saying \"Pay-dirt!\" every time a dwarf says \"Pay-dirt!\"", - position = 99 - ) - default boolean payDirtMsg() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodeGemOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodeGemOverlay.java deleted file mode 100644 index 86c3e06888..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodeGemOverlay.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2018, Lars - * 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.motherlode; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.time.Duration; -import java.time.Instant; -import javax.inject.Inject; -import javax.inject.Singleton; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -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.TableAlignment; -import net.runelite.client.ui.overlay.components.table.TableComponent; - -@Singleton -public class MotherlodeGemOverlay extends Overlay -{ - private final MotherlodePlugin plugin; - private final MotherlodeSession motherlodeSession; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - MotherlodeGemOverlay(final MotherlodePlugin plugin, final MotherlodeSession motherlodeSession) - { - super(plugin); - setPosition(OverlayPosition.TOP_LEFT); - this.plugin = plugin; - this.motherlodeSession = motherlodeSession; - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Gem overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - MotherlodeSession session = motherlodeSession; - - if (session.getLastGemFound() == null || !plugin.isInMlm() || !plugin.isShowGemsFound()) - { - return null; - } - - Duration statTimeout = Duration.ofMinutes(plugin.getStatTimeout()); - Duration sinceCut = Duration.between(session.getLastGemFound(), Instant.now()); - - if (sinceCut.compareTo(statTimeout) >= 0) - { - return null; - } - - int diamondsFound = session.getDiamondsFound(); - int rubiesFound = session.getRubiesFound(); - int emeraldsFound = session.getEmeraldsFound(); - int sapphiresFound = session.getSapphiresFound(); - - panelComponent.getChildren().clear(); - panelComponent.getChildren().add(TitleComponent.builder().text("Gems found").build()); - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - if (diamondsFound > 0) - { - tableComponent.addRow("Diamonds:", Integer.toString(diamondsFound)); - } - - if (rubiesFound > 0) - { - tableComponent.addRow("Rubies:", Integer.toString(rubiesFound)); - } - - if (emeraldsFound > 0) - { - tableComponent.addRow("Emeralds:", Integer.toString(emeraldsFound)); - } - - if (sapphiresFound > 0) - { - tableComponent.addRow("Sapphires:", Integer.toString(sapphiresFound)); - } - - panelComponent.getChildren().add(tableComponent); - - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodeOreOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodeOreOverlay.java deleted file mode 100644 index 2b28c7618c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodeOreOverlay.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2019, Sir Girion - * 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.motherlode; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -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; - -@Singleton -public class MotherlodeOreOverlay extends Overlay -{ - private final MotherlodePlugin plugin; - private final MotherlodeSession motherlodeSession; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - MotherlodeOreOverlay(final MotherlodePlugin plugin, final MotherlodeSession motherlodeSession) - { - setPosition(OverlayPosition.TOP_LEFT); - this.plugin = plugin; - this.motherlodeSession = motherlodeSession; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isInMlm() || !plugin.isShowOresFound()) - { - return null; - } - - MotherlodeSession session = motherlodeSession; - - int nuggetsFound = session.getNuggetsFound(); - int coalFound = session.getCoalFound(); - int goldFound = session.getGoldFound(); - int mithrilFound = session.getMithrilFound(); - int adamantiteFound = session.getAdamantiteFound(); - int runiteFound = session.getRuniteFound(); - - // If no ores have even been collected, don't bother showing anything - if (nuggetsFound == 0 && coalFound == 0 && goldFound == 0 && mithrilFound == 0 - && adamantiteFound == 0 && runiteFound == 0) - { - return null; - } - - panelComponent.getChildren().clear(); - panelComponent.getChildren().add(TitleComponent.builder().text("Ores found").build()); - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - if (nuggetsFound > 0) - { - tableComponent.addRow("Nuggets:", Integer.toString(nuggetsFound)); - } - - if (coalFound > 0) - { - tableComponent.addRow("Coal:", Integer.toString(coalFound)); - } - - if (goldFound > 0) - { - tableComponent.addRow("Gold:", Integer.toString(goldFound)); - } - - if (mithrilFound > 0) - { - tableComponent.addRow("Mithril:", Integer.toString(mithrilFound)); - } - - if (adamantiteFound > 0) - { - tableComponent.addRow("Adamantite:", Integer.toString(adamantiteFound)); - } - - if (runiteFound > 0) - { - tableComponent.addRow("Runite:", Integer.toString(runiteFound)); - } - - 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/motherlode/MotherlodeOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodeOverlay.java deleted file mode 100644 index 9324e2cf4e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodeOverlay.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.motherlode; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.time.Duration; -import java.time.Instant; -import javax.inject.Inject; -import javax.inject.Singleton; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY; -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.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; - -@Singleton -class MotherlodeOverlay extends Overlay -{ - private final MotherlodePlugin plugin; - private final MotherlodeSession motherlodeSession; - private final PanelComponent panelComponent = new PanelComponent(); - - static final String MINING_RESET = "Reset"; - - @Inject - MotherlodeOverlay(final MotherlodePlugin plugin, final MotherlodeSession motherlodeSession) - { - super(plugin); - setPosition(OverlayPosition.TOP_LEFT); - this.plugin = plugin; - this.motherlodeSession = motherlodeSession; - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY, MINING_RESET, "Motherlode mine overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isInMlm() || !plugin.isShowMiningStats()) - { - return null; - } - - MotherlodeSession session = motherlodeSession; - - if (session.getLastPayDirtMined() == null) - { - return null; - } - - Duration statTimeout = Duration.ofMinutes(plugin.getStatTimeout()); - Duration sinceCut = Duration.between(session.getLastPayDirtMined(), Instant.now()); - - if (sinceCut.compareTo(statTimeout) >= 0) - { - return null; - } - - panelComponent.getChildren().clear(); - - if (plugin.isShowMiningState()) - { - if (plugin.isMining()) - { - panelComponent.getChildren().add(TitleComponent.builder() - .text("Mining") - .color(Color.GREEN) - .build()); - } - else - { - panelComponent.getChildren().add(TitleComponent.builder() - .text("NOT mining") - .color(Color.RED) - .build()); - } - } - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - tableComponent.addRow("Pay-dirt mined:", Integer.toString(session.getTotalMined())); - tableComponent.addRow("Pay-dirt/hr:", session.getRecentMined() > 2 ? Integer.toString(session.getPerHour()) : ""); - - panelComponent.getChildren().add(tableComponent); - - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodePlugin.java deleted file mode 100644 index 03612a1797..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodePlugin.java +++ /dev/null @@ -1,794 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * Copyright (c) 2018, Adam - * Copyright (c) 2018, Lars - * 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.motherlode; - -import com.google.common.base.Strings; -import com.google.common.collect.HashMultiset; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Multiset; -import com.google.common.collect.Multisets; -import com.google.inject.Provides; -import java.time.Duration; -import java.time.Instant; -import java.time.temporal.ChronoUnit; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.AnimationID; -import static net.runelite.api.AnimationID.*; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.GameState; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemID; -import net.runelite.api.MenuOpcode; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import static net.runelite.api.ObjectID.*; -import net.runelite.api.Perspective; -import net.runelite.api.Player; -import net.runelite.api.ScriptID; -import net.runelite.api.Varbits; -import net.runelite.api.WallObject; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.AnimationChanged; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameObjectChanged; -import net.runelite.api.events.GameObjectDespawned; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.OverheadTextChanged; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.events.WallObjectChanged; -import net.runelite.api.events.WallObjectDespawned; -import net.runelite.api.events.WallObjectSpawned; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.Notifier; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.events.OverlayMenuClicked; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.task.Schedule; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.ui.overlay.OverlayMenuEntry; - -@PluginDescriptor( - name = "Motherlode Mine", - description = "Show helpful information inside the Motherload Mine", - tags = {"pay", "dirt", "mining", "mlm", "skilling", "overlay"}, - enabledByDefault = false, - type = PluginType.SKILLING -) -@Singleton -public class MotherlodePlugin extends Plugin -{ - private static final Set MOTHERLODE_MAP_REGIONS = ImmutableSet.of(14679, 14680, 14681, 14935, 14936, 14937, 15191, 15192, 15193); - private static final Set MINE_SPOTS = ImmutableSet.of(ORE_VEIN_26661, ORE_VEIN_26662, ORE_VEIN_26663, ORE_VEIN_26664); - private static final Set DEPLETED_SPOTS = ImmutableSet.of(DEPLETED_VEIN_26665, DEPLETED_VEIN_26666, DEPLETED_VEIN_26667, DEPLETED_VEIN_26668); - private static final Set MLM_ORE_TYPES = ImmutableSet.of(ItemID.RUNITE_ORE, ItemID.ADAMANTITE_ORE, - ItemID.MITHRIL_ORE, ItemID.GOLD_ORE, ItemID.COAL, ItemID.GOLDEN_NUGGET); - private static final Set ROCK_OBSTACLES = ImmutableSet.of(ROCKFALL, ROCKFALL_26680); - - private static final int MAX_INVENTORY_SIZE = 28; - - private static final int SACK_LARGE_SIZE = 162; - private static final int SACK_SIZE = 81; - - private static final int UPPER_FLOOR_HEIGHT = -500; - - // The motherlode mining animation has gaps in it during which the animation switches to IDLE - // so a minimum threshold is required before the idle animation will be registered as not mining - private static final Duration ANIMATION_IDLE_DELAY = Duration.ofMillis(1800); - - @Inject - private OverlayManager overlayManager; - - @Inject - private MotherlodeOverlay overlay; - - @Inject - private MotherlodeRocksOverlay rocksOverlay; - - @Inject - private MotherlodeSackOverlay motherlodeSackOverlay; - - @Inject - private MotherlodeGemOverlay motherlodeGemOverlay; - - @Inject - private MotherlodeOreOverlay motherlodeOreOverlay; - - @Inject - private MotherlodeConfig config; - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private Notifier notifier; - - @Getter(AccessLevel.PACKAGE) - private boolean inMlm; - - @Getter(AccessLevel.PACKAGE) - private int curSackSize; - @Getter(AccessLevel.PACKAGE) - private int maxSackSize; - @Getter(AccessLevel.PACKAGE) - private Integer depositsLeft; - - @Inject - private MotherlodeSession session; - private boolean shouldUpdateOres; - private Multiset inventorySnapshot; - - @Getter(AccessLevel.PACKAGE) - private final Set veins = new HashSet<>(); - @Getter(AccessLevel.PACKAGE) - private final Set rocks = new HashSet<>(); - - @Getter(AccessLevel.PACKAGE) - private boolean isMining; - @Getter(AccessLevel.PACKAGE) - private WorldPoint targetVeinLocation = null; - private boolean playerHasReachedTargetVein; - private int lastAnimation = AnimationID.IDLE; - private Instant lastAnimating; - - @Getter(AccessLevel.PACKAGE) - private boolean showVeins; - @Getter(AccessLevel.PACKAGE) - private boolean showRockFalls; - @Getter(AccessLevel.PACKAGE) - private int statTimeout; - @Getter(AccessLevel.PACKAGE) - private boolean showSack; - @Getter(AccessLevel.PACKAGE) - private boolean showMiningStats; - @Getter(AccessLevel.PACKAGE) - private boolean showDepositsLeft; - @Getter(AccessLevel.PACKAGE) - private boolean showMiningState; - @Getter(AccessLevel.PACKAGE) - private boolean showGemsFound; - @Getter(AccessLevel.PACKAGE) - private boolean showOresFound; - private boolean notifyOnIdle; - @Getter(AccessLevel.PACKAGE) - private boolean showTargetVein; - private boolean payDirtMsg; - - @Provides - MotherlodeConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(MotherlodeConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - overlayManager.add(rocksOverlay); - overlayManager.add(motherlodeGemOverlay); - overlayManager.add(motherlodeOreOverlay); - overlayManager.add(motherlodeSackOverlay); - - inMlm = checkInMlm(); - - if (inMlm) - { - clientThread.invokeLater(this::refreshSackValues); - } - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - overlayManager.remove(rocksOverlay); - overlayManager.remove(motherlodeGemOverlay); - overlayManager.remove(motherlodeOreOverlay); - overlayManager.remove(motherlodeSackOverlay); - veins.clear(); - rocks.clear(); - - Widget sack = client.getWidget(WidgetInfo.MOTHERLODE_MINE); - - clientThread.invokeLater(() -> - { - if (sack != null && sack.isHidden()) - { - sack.setHidden(false); - } - }); - } - - @Subscribe - private void onOverlayMenuClicked(OverlayMenuClicked overlayMenuClicked) - { - OverlayMenuEntry overlayMenuEntry = overlayMenuClicked.getEntry(); - if (overlayMenuEntry.getMenuOpcode() == MenuOpcode.RUNELITE_OVERLAY - && overlayMenuClicked.getEntry().getOption().equals(MotherlodeOverlay.MINING_RESET) - && overlayMenuClicked.getOverlay() == overlay) - { - session.resetRecent(); - } - } - - @Subscribe - void onVarbitChanged(VarbitChanged event) - { - if (inMlm) - { - int lastSackValue = curSackSize; - refreshSackValues(); - shouldUpdateOres = curSackSize < lastSackValue; - if (shouldUpdateOres) - { - // Take a snapshot of the inventory before the new ore is added. - ItemContainer itemContainer = client.getItemContainer(InventoryID.INVENTORY); - if (itemContainer != null) - { - inventorySnapshot = HashMultiset.create(); - Arrays.stream(itemContainer.getItems()) - .filter(item -> MLM_ORE_TYPES.contains(item.getId())) - .forEach(item -> inventorySnapshot.add(item.getId(), item.getQuantity())); - } - } - } - } - - @Subscribe - private void onChatMessage(ChatMessage event) - { - if (!inMlm || event.getType() != ChatMessageType.SPAM) - { - return; - } - - String chatMessage = event.getMessage(); - - switch (chatMessage) - { - case "You manage to mine some pay-dirt.": - session.incrementPayDirtMined(); - break; - - case "You just found a Diamond!": - session.incrementGemFound(ItemID.UNCUT_DIAMOND); - break; - - case "You just found a Ruby!": - session.incrementGemFound(ItemID.UNCUT_RUBY); - break; - - case "You just found an Emerald!": - session.incrementGemFound(ItemID.UNCUT_EMERALD); - break; - - case "You just found a Sapphire!": - session.incrementGemFound(ItemID.UNCUT_SAPPHIRE); - break; - } - } - - @Schedule( - period = 1, - unit = ChronoUnit.SECONDS - ) - void checkMining() - { - if (!inMlm) - { - return; - } - - - depositsLeft = calculateDepositsLeft(); - - Instant lastPayDirtMined = session.getLastPayDirtMined(); - if (lastPayDirtMined == null) - { - return; - } - - // reset recentPayDirtMined if you haven't mined anything recently - Duration statTimeout = Duration.ofMinutes(this.statTimeout); - Duration sinceMined = Duration.between(lastPayDirtMined, Instant.now()); - - if (sinceMined.compareTo(statTimeout) >= 0) - { - session.resetRecent(); - } - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked menu) - { - if (!inMlm) - { - return; - } - - if (MINE_SPOTS.contains(menu.getIdentifier()) && menu.getMenuOpcode() == MenuOpcode.GAME_OBJECT_FIRST_OPTION) - { - resetIdleChecks(); - int veinX = menu.getParam0(); - int veinY = menu.getParam1(); - targetVeinLocation = WorldPoint.fromScene(client, veinX, veinY, client.getPlane()); - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - if (!inMlm) - { - return; - } - - checkDistanceToTargetVein(); - checkAnimationIdle(); - } - - private void checkDistanceToTargetVein() - { - if (targetVeinLocation == null) - { - return; - } - - float distanceFromTargetVein = client.getLocalPlayer().getWorldLocation().distanceToHypotenuse(targetVeinLocation); - // Player must reach the target vein first before we begin checking for the player moving away from it - if (!playerHasReachedTargetVein && distanceFromTargetVein == 1) - { - isMining = true; - playerHasReachedTargetVein = true; - } - else if (playerHasReachedTargetVein && distanceFromTargetVein > 1) - { - isMining = false; - resetIdleChecks(); - } - } - - @Subscribe - private void onAnimationChanged(AnimationChanged event) - { - if (!inMlm) - { - return; - } - - Player localPlayer = client.getLocalPlayer(); - if (localPlayer != event.getActor()) - { - return; - } - - int animation = localPlayer.getAnimation(); - - switch (animation) - { - case MINING_MOTHERLODE_BRONZE: - case MINING_MOTHERLODE_IRON: - case MINING_MOTHERLODE_STEEL: - case MINING_MOTHERLODE_BLACK: - case MINING_MOTHERLODE_MITHRIL: - case MINING_MOTHERLODE_ADAMANT: - case MINING_MOTHERLODE_RUNE: - case MINING_MOTHERLODE_DRAGON: - case MINING_MOTHERLODE_DRAGON_UPGRADED: - case MINING_MOTHERLODE_DRAGON_OR: - case MINING_MOTHERLODE_CRYSTAL: - case MINING_MOTHERLODE_INFERNAL: - case MINING_MOTHERLODE_3A: - lastAnimation = animation; - lastAnimating = Instant.now(); - break; - case IDLE: - lastAnimating = Instant.now(); - break; - default: - // On unknown animation simply assume the animation is invalid - lastAnimation = IDLE; - lastAnimating = null; - } - } - - private void checkAnimationIdle() - { - if (lastAnimation == IDLE) - { - return; - } - - final int animation = client.getLocalPlayer().getAnimation(); - - if (animation == IDLE) - { - if (lastAnimating != null && Instant.now().compareTo(lastAnimating.plus(ANIMATION_IDLE_DELAY)) >= 0) - { - lastAnimation = IDLE; - lastAnimating = null; - isMining = false; - resetIdleChecks(); - sendIdleNotification(); - } - } - else - { - lastAnimating = Instant.now(); - } - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded event) - { - if (!inMlm || targetVeinLocation == null) - { - return; - } - - int widgetID = event.getGroupId(); - - if (widgetID == WidgetID.MOTHERLODE_MINE_FULL_INVENTORY_GROUP_ID || widgetID == WidgetID.LEVEL_UP_GROUP_ID) - { - isMining = false; - resetIdleChecks(); - sendIdleNotification(); - } - } - - private void resetIdleChecks() - { - isMining = false; - lastAnimation = IDLE; - lastAnimating = null; - playerHasReachedTargetVein = false; - targetVeinLocation = null; - } - - private void sendIdleNotification() - { - if (!this.notifyOnIdle) - { - return; - } - - notifier.notify(client.getLocalPlayer().getName() + " has stopped mining!"); - } - - @Subscribe - private void onWallObjectSpawned(WallObjectSpawned event) - { - if (!inMlm) - { - return; - } - - WallObject wallObject = event.getWallObject(); - int wallObjectId = wallObject.getId(); - if (MINE_SPOTS.contains(wallObjectId)) - { - veins.add(wallObject); - } - else if (DEPLETED_SPOTS.contains(wallObjectId) && wallObject.getWorldLocation().equals(targetVeinLocation)) - { - isMining = false; - resetIdleChecks(); - sendIdleNotification(); - } - } - - @Subscribe - private void onWallObjectChanged(WallObjectChanged event) - { - if (!inMlm) - { - return; - } - - WallObject previous = event.getPrevious(); - WallObject wallObject = event.getWallObject(); - - veins.remove(previous); - if (MINE_SPOTS.contains(wallObject.getId())) - { - veins.add(wallObject); - } - } - - @Subscribe - private void onWallObjectDespawned(WallObjectDespawned event) - { - if (!inMlm) - { - return; - } - - WallObject wallObject = event.getWallObject(); - veins.remove(wallObject); - } - - @Subscribe - private void onGameObjectSpawned(GameObjectSpawned event) - { - if (!inMlm) - { - return; - } - - GameObject gameObject = event.getGameObject(); - if (ROCK_OBSTACLES.contains(gameObject.getId())) - { - rocks.add(gameObject); - } - } - - @Subscribe - private void onGameObjectChanged(GameObjectChanged event) - { - if (!inMlm) - { - return; - } - - GameObject previous = event.getPrevious(); - GameObject gameObject = event.getGameObject(); - - rocks.remove(previous); - if (ROCK_OBSTACLES.contains(gameObject.getId())) - { - rocks.add(gameObject); - } - - } - - @Subscribe - private void onGameObjectDespawned(GameObjectDespawned event) - { - if (!inMlm) - { - return; - } - - GameObject gameObject = event.getGameObject(); - rocks.remove(gameObject); - } - - @Subscribe - void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOADING) - { - // on region changes the tiles get set to null - veins.clear(); - rocks.clear(); - - inMlm = checkInMlm(); - } - else if (event.getGameState() == GameState.LOGIN_SCREEN) - { - // Prevent code from running while logged out. - inMlm = false; - } - } - - @Subscribe - void onItemContainerChanged(ItemContainerChanged event) - { - final ItemContainer container = event.getItemContainer(); - - if (!inMlm || !shouldUpdateOres || inventorySnapshot == null || container != client.getItemContainer(InventoryID.INVENTORY)) - { - return; - } - - // Build set of current inventory - Multiset current = HashMultiset.create(); - Arrays.stream(container.getItems()) - .filter(item -> MLM_ORE_TYPES.contains(item.getId())) - .forEach(item -> current.add(item.getId(), item.getQuantity())); - - // Take the difference - Multiset delta = Multisets.difference(current, inventorySnapshot); - - // Update the session - delta.forEachEntry(session::updateOreFound); - inventorySnapshot = null; - shouldUpdateOres = false; - } - - private Integer calculateDepositsLeft() - { - if (maxSackSize == 0) // check if maxSackSize has been initialized - { - refreshSackValues(); - } - - double depositsLeft = 0; - int nonPayDirtItems = 0; - - ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); - if (inventory == null) - { - return null; - } - - Item[] result = inventory.getItems(); - assert result != null; - - for (Item item : result) - { - // Assume that MLM ores are being banked and exclude them from the check, - // so the user doesn't see the Overlay switch between deposits left and N/A. - // - // Count other items at nonPayDirtItems so depositsLeft is calculated accordingly. - if (item.getId() != ItemID.PAYDIRT && item.getId() != -1 && !MLM_ORE_TYPES.contains(item.getId())) - { - nonPayDirtItems += 1; - } - } - - double inventorySpace = MAX_INVENTORY_SIZE - nonPayDirtItems; - double sackSizeRemaining = maxSackSize - curSackSize; - - if (inventorySpace > 0 && sackSizeRemaining > 0) - { - depositsLeft = Math.ceil(sackSizeRemaining / inventorySpace); - } - else if (inventorySpace == 0) - { - return null; - } - - return (int) depositsLeft; - } - - private boolean checkInMlm() - { - GameState gameState = client.getGameState(); - if (gameState != GameState.LOGGED_IN - && gameState != GameState.LOADING) - { - return false; - } - - int[] currentMapRegions = client.getMapRegions(); - - // Verify that all regions exist in MOTHERLODE_MAP_REGIONS - for (int region : currentMapRegions) - { - if (!MOTHERLODE_MAP_REGIONS.contains(region)) - { - return false; - } - } - - return true; - } - - private void refreshSackValues() - { - curSackSize = client.getVar(Varbits.SACK_NUMBER); - boolean sackUpgraded = client.getVar(Varbits.SACK_UPGRADED) == 1; - maxSackSize = sackUpgraded ? SACK_LARGE_SIZE : SACK_SIZE; - } - - /** - * Checks if the given point is "upstairs" in the mlm. - * The upper floor is actually on z=0. - */ - boolean isUpstairs(LocalPoint localPoint) - { - return Perspective.getTileHeight(client, localPoint, 0) < UPPER_FLOOR_HEIGHT; - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("motherlode")) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.showVeins = config.showVeins(); - this.showRockFalls = config.showRockFalls(); - this.statTimeout = config.statTimeout(); - this.showSack = config.showSack(); - this.showMiningStats = config.showMiningStats(); - this.showDepositsLeft = config.showDepositsLeft(); - this.showMiningState = config.showMiningState(); - this.showGemsFound = config.showGemsFound(); - this.showOresFound = config.showOresFound(); - this.notifyOnIdle = config.notifyOnIdle(); - this.showTargetVein = config.showTargetVein(); - this.payDirtMsg = config.payDirtMsg(); - } - - @Subscribe - private void onOverheadTextChanged(OverheadTextChanged event) - { - if (!payDirtMsg || Strings.isNullOrEmpty(event.getOverheadText()) || !(event.getActor() instanceof NPC)) - { - return; - } - - switch (((NPC) event.getActor()).getId()) - { - case NpcID.MINER_5606: - case NpcID.MINER_5813: - case NpcID.MINER_5814: - case NpcID.MINER_6565: - case NpcID.MINER_6567: - case NpcID.MINER_6568: - case NpcID.MINER_6569: - case NpcID.MINER_6570: - case NpcID.MINER_6571: - case NpcID.MINER_6572: - case NpcID.MINER_6645: - break; - default: - return; - } - - if ("pay-dirt!".equals(Text.standardize(event.getOverheadText()))) - { - client.runScript(ScriptID.PUBLICMSG, "Pay-dirt!"); - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodeRocksOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodeRocksOverlay.java deleted file mode 100644 index 6b672967dc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodeRocksOverlay.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * Copyright (c) 2018, Adam - * Copyright (c) 2018, Lars - * 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.motherlode; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.Perspective; -import net.runelite.api.Player; -import net.runelite.api.Point; -import net.runelite.api.Skill; -import net.runelite.api.WallObject; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.game.SkillIconManager; -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.ImageUtil; - -@Singleton -class MotherlodeRocksOverlay extends Overlay -{ - private static final int MAX_DISTANCE = 2350; - - private final Client client; - private final MotherlodePlugin plugin; - - private final BufferedImage miningIcon; - private final BufferedImage targetMiningIcon; - private static final Color miningIconOldColor = new Color(117, 123, 124); - private static final Color miningIconNewColor = new Color(0, 150, 0); - - @Inject - MotherlodeRocksOverlay(final Client client, final MotherlodePlugin plugin, final SkillIconManager iconManager) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.client = client; - this.plugin = plugin; - - miningIcon = iconManager.getSkillImage(Skill.MINING); - targetMiningIcon = ImageUtil.recolorImage(miningIcon, miningIconNewColor, Color -> Color.getRGB() == miningIconOldColor.getRGB()); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if ((!plugin.isShowVeins() && !plugin.isShowRockFalls()) || !plugin.isInMlm()) - { - return null; - } - - Player local = client.getLocalPlayer(); - - renderTiles(graphics, local); - - return null; - } - - private void renderTiles(Graphics2D graphics, Player local) - { - LocalPoint localLocation = local.getLocalLocation(); - if (plugin.isShowVeins()) - { - for (WallObject vein : plugin.getVeins()) - { - LocalPoint location = vein.getLocalLocation(); - if (localLocation.distanceTo(location) <= MAX_DISTANCE && plugin.isUpstairs(localLocation) == plugin.isUpstairs(vein.getLocalLocation())) - { - if (WorldPoint.fromLocal(client, location).equals(plugin.getTargetVeinLocation()) - && plugin.isMining() - && plugin.isShowTargetVein()) - { - renderVein(graphics, vein, true); - } - else - { - renderVein(graphics, vein, false); - } - } - } - } - - if (plugin.isShowRockFalls()) - { - for (GameObject rock : plugin.getRocks()) - { - LocalPoint location = rock.getLocalLocation(); - if (localLocation.distanceTo(location) <= MAX_DISTANCE) - { - plugin.checkMining(); - renderRock(graphics, rock); - } - } - } - } - - private void renderVein(Graphics2D graphics, WallObject vein, Boolean shouldRecolor) - { - Point canvasLoc = Perspective.getCanvasImageLocation(client, vein.getLocalLocation(), miningIcon, 150); - - if (canvasLoc != null && !shouldRecolor) - { - graphics.drawImage(miningIcon, canvasLoc.getX(), canvasLoc.getY(), null); - } - else if (canvasLoc != null) - { - graphics.drawImage(targetMiningIcon, canvasLoc.getX(), canvasLoc.getY(), null); - } - } - - private void renderRock(Graphics2D graphics, GameObject rock) - { - Polygon poly = Perspective.getCanvasTilePoly(client, rock.getLocalLocation()); - - if (poly != null) - { - OverlayUtil.renderPolygon(graphics, poly, Color.red); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodeSackOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodeSackOverlay.java deleted file mode 100644 index 9d485e5f4b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodeSackOverlay.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * Copyright (c) 2018, Adam - * Copyright (c) 2018, Lars - * 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.motherlode; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.Varbits; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -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.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; -import net.runelite.client.util.ColorUtil; - -@Singleton -class MotherlodeSackOverlay extends Overlay -{ - private static final Color DANGER = new Color(150, 0, 0, 150); - private final Client client; - private final MotherlodePlugin plugin; - - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - MotherlodeSackOverlay(final Client client, final MotherlodePlugin plugin) - { - super(plugin); - setPosition(OverlayPosition.TOP_LEFT); - this.client = client; - this.plugin = plugin; - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Sack overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isInMlm()) - { - return null; - } - - Widget sack = client.getWidget(WidgetInfo.MOTHERLODE_MINE); - - panelComponent.getChildren().clear(); - panelComponent.setBackgroundColor(ComponentConstants.STANDARD_BACKGROUND_COLOR); - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - if (sack != null) - { - sack.setHidden(true); - - if (plugin.isShowSack()) - { - if (plugin.getCurSackSize() >= plugin.getMaxSackSize()) - { - panelComponent.setBackgroundColor(DANGER); - } - - tableComponent.addRow("Pay-dirt in sack:", String.valueOf(client.getVar(Varbits.SACK_NUMBER))); - } - - if (plugin.isShowDepositsLeft()) - { - final Integer depositsLeft = plugin.getDepositsLeft(); - Color color = Color.WHITE; - - if (depositsLeft != null) - { - if (depositsLeft == 0) - { - panelComponent.setBackgroundColor(DANGER); - } - else if (depositsLeft == 1) - { - color = Color.RED; - } - } - - tableComponent.addRow(ColorUtil.prependColorTag("Deposits left:", color), ColorUtil.prependColorTag(depositsLeft == null ? "N/A" : String.valueOf(depositsLeft), color)); - } - } - - panelComponent.getChildren().add(tableComponent); - - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodeSession.java b/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodeSession.java deleted file mode 100644 index 6a9c97d4b4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/motherlode/MotherlodeSession.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.motherlode; - -import java.time.Duration; -import java.time.Instant; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ItemID; - -@Slf4j -@Singleton -public class MotherlodeSession -{ - private static final Duration HOUR = Duration.ofHours(1); - - private int perHour; - - private Instant lastPayDirtMined; - private int totalMined; - - private Instant recentPayDirtMined; - private int recentMined; - - @Getter(AccessLevel.PACKAGE) - private Instant lastGemFound; - - @Getter(AccessLevel.PACKAGE) - private int diamondsFound; - - @Getter(AccessLevel.PACKAGE) - private int rubiesFound; - - @Getter(AccessLevel.PACKAGE) - private int emeraldsFound; - - @Getter(AccessLevel.PACKAGE) - private int sapphiresFound; - - @Getter(AccessLevel.PACKAGE) - private int nuggetsFound; - - @Getter(AccessLevel.PACKAGE) - private int coalFound; - - @Getter(AccessLevel.PACKAGE) - private int goldFound; - - @Getter(AccessLevel.PACKAGE) - private int mithrilFound; - - @Getter(AccessLevel.PACKAGE) - private int adamantiteFound; - - @Getter(AccessLevel.PACKAGE) - private int runiteFound; - - void incrementGemFound(int gemID) - { - lastGemFound = Instant.now(); - - switch (gemID) - { - case ItemID.UNCUT_DIAMOND: - diamondsFound++; - break; - - case ItemID.UNCUT_RUBY: - rubiesFound++; - break; - - case ItemID.UNCUT_EMERALD: - emeraldsFound++; - break; - - case ItemID.UNCUT_SAPPHIRE: - sapphiresFound++; - break; - - default: - log.debug("Invalid gem type specified. The gem count will not be incremented."); - } - } - - void updateOreFound(int item, int count) - { - switch (item) - { - case ItemID.GOLDEN_NUGGET: - nuggetsFound += count; - break; - case ItemID.COAL: - coalFound += count; - break; - case ItemID.GOLD_ORE: - goldFound += count; - break; - case ItemID.MITHRIL_ORE: - mithrilFound += count; - break; - case ItemID.ADAMANTITE_ORE: - adamantiteFound += count; - break; - case ItemID.RUNITE_ORE: - runiteFound += count; - break; - default: - log.debug("Invalid ore specified. The ore count will not be updated."); - } - } - - void incrementPayDirtMined() - { - Instant now = Instant.now(); - - lastPayDirtMined = now; - ++totalMined; - - if (recentMined == 0) - { - recentPayDirtMined = now; - } - ++recentMined; - - Duration timeSinceStart = Duration.between(recentPayDirtMined, now); - if (!timeSinceStart.isZero()) - { - perHour = (int) ((double) recentMined * (double) HOUR.toMillis() / (double) timeSinceStart.toMillis()); - } - } - - void resetRecent() - { - recentPayDirtMined = null; - recentMined = 0; - } - - int getPerHour() - { - return perHour; - } - - Instant getLastPayDirtMined() - { - return lastPayDirtMined; - } - - int getTotalMined() - { - return totalMined; - } - - int getRecentMined() - { - return recentMined; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mousehighlight/MouseHighlightConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/mousehighlight/MouseHighlightConfig.java deleted file mode 100644 index 35369bc140..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mousehighlight/MouseHighlightConfig.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2018, Morgan Lewis - * 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.mousehighlight; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("mousehighlight") -public interface MouseHighlightConfig extends Config -{ - @ConfigItem( - position = 0, - keyName = "mainTooltip", - name = "Main Tooltips", - description = "Whether or not tooltips are shown on things other than interfaces or the chatbox" - ) - default boolean mainTooltip() - { - return true; - } - - @ConfigItem( - position = 1, - keyName = "uiTooltip", - name = "Interface Tooltips", - description = "Whether or not tooltips are shown on interfaces" - ) - default boolean uiTooltip() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "chatboxTooltip", - name = "Chatbox Tooltips", - description = "Whether or not tooltips are shown over the chatbox" - ) - default boolean chatboxTooltip() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "hideSpells", - name = "Spellbook", - description = "Hides vanilla client tooltips in the spellbook" - ) - default boolean shouldHideSpells() - { - return false; - } - - @ConfigItem( - position = 4, - keyName = "hideCombat", - name = "Combat", - description = "Hides vanilla client tooltips in the combat menu" - ) - default boolean shouldHideCombat() - { - return false; - } - - @ConfigItem( - position = 5, - keyName = "rightclickoptionTooltip", - name = "Right Click Option Tooltips", - description = "Whether or not tooltips are shown for options that right-click only." - ) - default boolean isRightClickTooltipEnabled() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mousehighlight/MouseHighlightOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/mousehighlight/MouseHighlightOverlay.java deleted file mode 100644 index e934605fa9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mousehighlight/MouseHighlightOverlay.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * 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.mousehighlight; - -import com.google.common.base.Strings; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.MenuEntry; -import net.runelite.api.MenuOpcode; -import net.runelite.api.VarClientInt; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.tooltip.Tooltip; -import net.runelite.client.ui.overlay.tooltip.TooltipManager; - -@Singleton -class MouseHighlightOverlay extends Overlay -{ - private final TooltipManager tooltipManager; - private final Client client; - private final MouseHighlightPlugin plugin; - - @Inject - MouseHighlightOverlay(final Client client, final TooltipManager tooltipManager, final MouseHighlightPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - this.client = client; - this.tooltipManager = tooltipManager; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (client.isMenuOpen()) - { - return null; - } - - MenuEntry[] menuEntries = client.getMenuEntries(); - int last = menuEntries.length - 1; - - if (last < 0) - { - return null; - } - - MenuEntry menuEntry = menuEntries[last]; - String target = menuEntry.getTarget(); - String option = menuEntry.getOption(); - int type = menuEntry.getOpcode(); - - if (shouldNotRenderMenuAction(type)) - { - return null; - } - - if (Strings.isNullOrEmpty(option)) - { - return null; - } - - // Trivial options that don't need to be highlighted, add more as they appear. - switch (option) - { - case "Walk here": - case "Cancel": - case "Continue": - return null; - case "Move": - // Hide overlay on sliding puzzle boxes - if (target.contains("Sliding piece")) - { - return null; - } - } - - final int widgetId = menuEntry.getParam1(); - final int groupId = WidgetInfo.TO_GROUP(widgetId); - final int childId = WidgetInfo.TO_CHILD(widgetId); - final Widget widget = client.getWidget(groupId, childId); - - if (!plugin.isUiTooltip() && widget != null) - { - return null; - } - - if (!plugin.isChatboxTooltip() && groupId == WidgetInfo.CHATBOX.getGroupId()) - { - return null; - } - - if (widget != null) - { - // If this varc is set, some CS is showing tooltip - int tooltipTimeout = client.getVar(VarClientInt.TOOLTIP_TIMEOUT); - if (tooltipTimeout > client.getGameCycle()) - { - return null; - } - } - - if (widget == null && !plugin.isMainTooltip()) - { - return null; - } - - // If this varc is set, a tooltip is already being displayed - int tooltipDisplayed = client.getVar(VarClientInt.TOOLTIP_VISIBLE); - if (tooltipDisplayed == 1) - { - return null; - } - - tooltipManager.addFront(new Tooltip(option + (Strings.isNullOrEmpty(target) ? "" : " " + target))); - return null; - } - - private boolean shouldNotRenderMenuAction(int type) - { - return type == MenuOpcode.RUNELITE_OVERLAY.getId() - || type == MenuOpcode.CC_OP_LOW_PRIORITY.getId() - || (!plugin.isRightClickTooltipEnabled() && isMenuActionRightClickOnly(type)); - } - - private boolean isMenuActionRightClickOnly(int type) - { - return type == MenuOpcode.CC_OP_LOW_PRIORITY.getId(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mousehighlight/MouseHighlightPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/mousehighlight/MouseHighlightPlugin.java deleted file mode 100644 index 2b91d50bb2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mousehighlight/MouseHighlightPlugin.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * 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.mousehighlight; - -import com.google.inject.Provides; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.widgets.Widget; -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.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "Mouse Tooltips", - description = "Render default actions as a tooltip", - tags = {"actions", "overlay", "tooltip", "hide"}, - type = PluginType.UTILITY -) -@Singleton -public class MouseHighlightPlugin extends Plugin -{ - @Inject - MouseHighlightConfig config; - - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private MouseHighlightOverlay overlay; - - @Getter(AccessLevel.PACKAGE) - private boolean mainTooltip; - @Getter(AccessLevel.PACKAGE) - private boolean uiTooltip; - @Getter(AccessLevel.PACKAGE) - private boolean chatboxTooltip; - private boolean shouldHideSpells; - private boolean shouldHideCombat; - @Getter(AccessLevel.PACKAGE) - private boolean isRightClickTooltipEnabled; - - @Provides - MouseHighlightConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(MouseHighlightConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - adjustTips(); - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - resetTips(); - overlayManager.remove(overlay); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGGED_IN) - { - adjustTips(); - } - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded event) - { - if (event.getGroupId() == WidgetID.SPELLBOOK_GROUP_ID || event.getGroupId() == WidgetID.COMBAT_GROUP_ID) - { - adjustTips(); - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - adjustTips(); - } - - private void adjustTips() - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - try - { - setTipHidden(WidgetInfo.SPELL_TOOLTIP, this.shouldHideSpells); - setTipHidden(WidgetInfo.COMBAT_TOOLTIP, this.shouldHideCombat); - } - catch (Exception e) - { - //swallow - } - } - - private void resetTips() - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - try - { - setTipHidden(WidgetInfo.SPELL_TOOLTIP, false); - setTipHidden(WidgetInfo.COMBAT_TOOLTIP, false); - } - catch (Exception e) - { - //swallow - } - } - - private void setTipHidden(WidgetInfo widgetInfo, boolean hidden) - { - Widget widget = client.getWidget(widgetInfo); - - if (widget == null) - { - return; - } - - widget.setHidden(hidden); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("motherlode")) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.mainTooltip = config.mainTooltip(); - this.uiTooltip = config.uiTooltip(); - this.chatboxTooltip = config.chatboxTooltip(); - this.shouldHideSpells = config.shouldHideSpells(); - this.shouldHideCombat = config.shouldHideCombat(); - this.isRightClickTooltipEnabled = config.isRightClickTooltipEnabled(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mta/MTAConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/mta/MTAConfig.java deleted file mode 100644 index 25940d2ef5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mta/MTAConfig.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2018, Jasper Ketelaar - * 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.mta; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("mta") -public interface MTAConfig extends Config -{ - @ConfigItem( - keyName = "alchemy", - name = "Enable alchemy room", - description = "Configures whether or not the alchemy room overlay is enabled.", - position = 0 - ) - default boolean alchemy() - { - return true; - } - - @ConfigItem( - keyName = "graveyard", - name = "Enable graveyard room", - description = "Configures whether or not the graveyard room overlay is enabled.", - position = 1 - ) - default boolean graveyard() - { - return true; - } - - @ConfigItem( - keyName = "telekinetic", - name = "Enable telekinetic room", - description = "Configures whether or not the telekinetic room overlay is enabled.", - position = 2 - ) - default boolean telekinetic() - { - return true; - } - - @ConfigItem( - keyName = "enchantment", - name = "Enable enchantment room", - description = "Configures whether or not the enchantment room overlay is enabled.", - position = 3 - ) - default boolean enchantment() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mta/MTAInventoryOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/mta/MTAInventoryOverlay.java deleted file mode 100644 index 700e48108a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mta/MTAInventoryOverlay.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2018, Jasper Ketelaar - * 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.mta; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayPosition; - -@Singleton -public class MTAInventoryOverlay extends Overlay -{ - private final MTAPlugin plugin; - - @Inject - public MTAInventoryOverlay(final MTAPlugin plugin) - { - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - } - - @Override - public Dimension render(Graphics2D graphics) - { - for (MTARoom room : plugin.getRooms()) - { - if (room.inside()) - { - graphics.setFont(FontManager.getRunescapeBoldFont()); - room.over(graphics); - } - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mta/MTAPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/mta/MTAPlugin.java deleted file mode 100644 index 8487fed645..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mta/MTAPlugin.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2018, Jasper Ketelaar - * 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.mta; - -import com.google.inject.Provides; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.mta.alchemy.AlchemyRoom; -import net.runelite.client.plugins.mta.enchantment.EnchantmentRoom; -import net.runelite.client.plugins.mta.graveyard.GraveyardRoom; -import net.runelite.client.plugins.mta.telekinetic.TelekineticRoom; -import net.runelite.client.ui.overlay.OverlayManager; - -@PluginDescriptor( - name = "Mage Training Arena", - description = "Show helpful information for the Mage Training Arena minigame", - tags = {"mta", "magic", "minigame", "overlay"}, - type = PluginType.MINIGAME -) -@Singleton -public class MTAPlugin extends Plugin -{ - @Inject - private OverlayManager overlayManager; - - @Inject - private AlchemyRoom alchemyRoom; - - @Inject - private GraveyardRoom graveyardRoom; - - @Inject - private TelekineticRoom telekineticRoom; - - @Inject - private EnchantmentRoom enchantmentRoom; - - @Inject - private EventBus eventBus; - - @Inject - private MTASceneOverlay sceneOverlay; - - @Inject - private MTAInventoryOverlay inventoryOverlay; - - @Getter(AccessLevel.PROTECTED) - private MTARoom[] rooms; - - @Provides - public MTAConfig getConfig(ConfigManager manager) - { - return manager.getConfig(MTAConfig.class); - } - - @Override - public void startUp() - { - overlayManager.add(sceneOverlay); - overlayManager.add(inventoryOverlay); - - this.rooms = new MTARoom[]{alchemyRoom, graveyardRoom, telekineticRoom, enchantmentRoom}; - } - - @Override - public void shutDown() - { - overlayManager.remove(sceneOverlay); - overlayManager.remove(inventoryOverlay); - - for (MTARoom room : rooms) - { - eventBus.unregister(room); - } - - telekineticRoom.resetRoom(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mta/MTARoom.java b/runelite-client/src/main/java/net/runelite/client/plugins/mta/MTARoom.java deleted file mode 100644 index 6df7c96c37..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mta/MTARoom.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018, Jasper Ketelaar - * 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.mta; - -import java.awt.Graphics2D; -import javax.inject.Inject; -import lombok.AccessLevel; -import lombok.Getter; - -public abstract class MTARoom -{ - @Getter(AccessLevel.PROTECTED) - protected final MTAConfig config; - - @Inject - protected MTARoom(final MTAConfig config) - { - this.config = config; - } - - public abstract boolean inside(); - - public void under(Graphics2D graphics2D) - { - } - - public void over(Graphics2D graphics2D) - { - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mta/MTASceneOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/mta/MTASceneOverlay.java deleted file mode 100644 index 5c794ee741..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mta/MTASceneOverlay.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2018, Jasper Ketelaar - * 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.mta; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayPosition; - -@Singleton -public class MTASceneOverlay extends Overlay -{ - private final MTAPlugin plugin; - - @Inject - public MTASceneOverlay(final MTAPlugin plugin) - { - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D graphics) - { - for (MTARoom room : plugin.getRooms()) - { - if (room.inside()) - { - graphics.setFont(FontManager.getRunescapeBoldFont()); - room.under(graphics); - } - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mta/alchemy/AlchemyItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/mta/alchemy/AlchemyItem.java deleted file mode 100644 index 4d4da7c1cb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mta/alchemy/AlchemyItem.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2018, Jasper Ketelaar - * 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.mta.alchemy; - -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ItemID; - -public enum AlchemyItem -{ - LEATHER_BOOTS("Leather Boots", ItemID.LEATHER_BOOTS_6893), - ADAMANT_KITESHIELD("Adamant Kiteshield", ItemID.ADAMANT_KITESHIELD_6894), - ADAMANT_MED_HELM("Helm", ItemID.ADAMANT_MED_HELM_6895), - EMERALD("Emerald", ItemID.EMERALD_6896), - RUNE_LONGSWORD("Rune Longsword", ItemID.RUNE_LONGSWORD_6897), - EMPTY("", -1), - POSSIBLY_EMPTY("", ItemID.CAKE_OF_GUIDANCE), - UNKNOWN("Unknown", ItemID.CAKE_OF_GUIDANCE); - - @Getter(AccessLevel.PACKAGE) - private final int id; - @Getter(AccessLevel.PACKAGE) - private final String name; - - AlchemyItem(final String name, final int id) - { - this.id = id; - this.name = name; - } - - public static AlchemyItem find(String item) - { - for (AlchemyItem alchemyItem : values()) - { - if (item.toLowerCase().contains(alchemyItem.name.toLowerCase())) - { - return alchemyItem; - } - } - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mta/alchemy/AlchemyRoom.java b/runelite-client/src/main/java/net/runelite/client/plugins/mta/alchemy/AlchemyRoom.java deleted file mode 100644 index b819c76fc5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mta/alchemy/AlchemyRoom.java +++ /dev/null @@ -1,478 +0,0 @@ -/* - * Copyright (c) 2018, Jasper Ketelaar - * Copyright (c) 2018, 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.mta.alchemy; - -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.image.BufferedImage; -import java.util.Arrays; -import java.util.Objects; -import javax.inject.Inject; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.GameState; -import static net.runelite.api.ObjectID.*; -import net.runelite.api.Perspective; -import net.runelite.api.Player; -import net.runelite.api.Point; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.api.widgets.WidgetItem; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.mta.MTAConfig; -import net.runelite.client.plugins.mta.MTAPlugin; -import net.runelite.client.plugins.mta.MTARoom; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; - -@Slf4j -public class AlchemyRoom extends MTARoom -{ - private static final int MTA_ALCH_REGION = 13462; - - private static final int IMAGE_Z_OFFSET = 150; - private static final int NUM_CUPBOARDS = 8; - private static final int INFO_ITEM_START = 8; - private static final int INFO_POINT_START = 13; - private static final int INFO_LENGTH = 5; - private static final int BEST_POINTS = 30; - - private static final String YOU_FOUND = "You found:"; - private static final String EMPTY = "The cupboard is empty."; - - private final Cupboard[] cupboards = new Cupboard[NUM_CUPBOARDS]; - - private final MTAPlugin plugin; - private final Client client; - private final ItemManager itemManager; - private final InfoBoxManager infoBoxManager; - private final EventBus eventBus; - - private AlchemyItem best; - private Cupboard suggestion; - - private boolean alchemy; - - @Inject - private AlchemyRoom(final Client client, final MTAConfig config, final MTAPlugin plugin, final ItemManager itemManager, final InfoBoxManager infoBoxManager, final EventBus eventBus) - { - super(config); - this.client = client; - this.plugin = plugin; - this.itemManager = itemManager; - this.infoBoxManager = infoBoxManager; - this.eventBus = eventBus; - - this.alchemy = config.alchemy(); - - addSubscriptions(); - } - - private void addSubscriptions() - { - eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged); - eventBus.subscribe(GameTick.class, this, this::onGameTick); - eventBus.subscribe(GameObjectSpawned.class, this, this::onGameObjectSpawned); - eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged); - eventBus.subscribe(ChatMessage.class, this, this::onChatMessage); - } - - private void onGameTick(GameTick event) - { - if (!inside() || !this.alchemy) - { - return; - } - - AlchemyItem bestItem = getBest(); - if (best == null || !best.equals(bestItem)) - { - if (best != null) - { - infoBoxManager.removeIf(e -> e instanceof AlchemyRoomTimer); - infoBoxManager.addInfoBox(new AlchemyRoomTimer(plugin)); - } - - log.debug("Item change to {}!", best); - - best = bestItem; - // Reset items to unknown - Arrays.stream(cupboards) - .filter(Objects::nonNull) - .forEach(e -> e.alchemyItem = AlchemyItem.UNKNOWN); - } - - Cupboard newSuggestion = getSuggestion(); - if (suggestion == null || newSuggestion == null || suggestion.alchemyItem != newSuggestion.alchemyItem) - { - suggestion = newSuggestion; - } - } - - private void onGameObjectSpawned(GameObjectSpawned event) - { - if (!inside()) - { - return; - } - - GameObject spawn = event.getGameObject(); - int cupboardId; - - switch (spawn.getId()) - { - // Closed and opened versions of each - case CUPBOARD_23678: - case CUPBOARD_23679: - cupboardId = 0; - break; - - case CUPBOARD_23680: - case CUPBOARD_23681: - cupboardId = 1; - break; - - case CUPBOARD_23682: - case CUPBOARD_23683: - cupboardId = 2; - break; - - case CUPBOARD_23684: - case CUPBOARD_23685: - cupboardId = 3; - break; - - case CUPBOARD_23686: - case CUPBOARD_23687: - cupboardId = 4; - break; - - case CUPBOARD_23688: - case CUPBOARD_23689: - cupboardId = 5; - break; - - case CUPBOARD_23690: - case CUPBOARD_23691: - cupboardId = 6; - break; - - case CUPBOARD_23692: - case CUPBOARD_23693: - cupboardId = 7; - break; - - default: - return; - - } - Cupboard cupboard = cupboards[cupboardId]; - if (cupboard != null) - { - cupboard.gameObject = spawn; - } - else - { - cupboard = new Cupboard(); - cupboard.gameObject = spawn; - cupboard.alchemyItem = AlchemyItem.UNKNOWN; - cupboards[cupboardId] = cupboard; - } - } - - private void onGameStateChanged(GameStateChanged gameStateChanged) - { - if (gameStateChanged.getGameState() == GameState.LOGGED_IN) - { - if (!inside()) - { - reset(); - } - } - } - - private void onChatMessage(ChatMessage wrapper) - { - if (!inside() || !config.alchemy()) - { - return; - } - - String message = wrapper.getMessage(); - - if (wrapper.getType() == ChatMessageType.GAMEMESSAGE && message.contains(YOU_FOUND)) - { - String item = message.replace(YOU_FOUND, "").trim(); - AlchemyItem alchemyItem = AlchemyItem.find(item); - Cupboard clicked = getClicked(); - if (clicked.alchemyItem != alchemyItem && alchemyItem != null) - { - fill(clicked, alchemyItem); - } - } - else if (message.equals(EMPTY)) - { - Cupboard clicked = getClicked(); - - int idx = Arrays.asList(cupboards).indexOf(clicked); - for (int i = -2; i <= 2; ++i) - { - int j = (idx + i) % 8; - if (j < 0) - { - j = 8 + j; - } - - Cupboard cupboard = cupboards[j]; - if (cupboard != null && cupboard.alchemyItem == AlchemyItem.UNKNOWN) - { - cupboard.alchemyItem = AlchemyItem.POSSIBLY_EMPTY; - } - } - - clicked.alchemyItem = AlchemyItem.EMPTY; - } - } - - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("mta") || !event.getKey().equals("alchemy")) - { - return; - } - - this.alchemy = config.alchemy(); - } - - - private void reset() - { - Arrays.fill(cupboards, null); - } - - @Override - public boolean inside() - { - Player player = client.getLocalPlayer(); - return player != null && player.getWorldLocation().getRegionID() == MTA_ALCH_REGION - && player.getWorldLocation().getPlane() == 2; - } - - @Override - public void under(Graphics2D graphics) - { - if (!getConfig().alchemy() || best == null || !inside()) - { - return; - } - - boolean found = false; - - for (Cupboard cupboard : cupboards) - { - if (cupboard == null) - { - continue; - } - - GameObject object = cupboard.gameObject; - AlchemyItem alchemyItem = cupboard.alchemyItem; - - if (alchemyItem == AlchemyItem.EMPTY) - { - continue; - } - - if (alchemyItem.equals(best)) - { - client.setHintArrow(object.getWorldLocation()); - found = true; - } - - BufferedImage image = itemManager.getImage(alchemyItem.getId()); - Point canvasLoc = Perspective.getCanvasImageLocation(client, object.getLocalLocation(), image, IMAGE_Z_OFFSET); - - if (canvasLoc != null) - { - graphics.drawImage(image, canvasLoc.getX(), canvasLoc.getY(), null); - } - } - - if (!found && suggestion != null) - { - client.setHintArrow(suggestion.gameObject.getWorldLocation()); - } - - } - - @Override - public void over(Graphics2D graphics) - { - if (!inside() || !config.alchemy() || best == null) - { - return; - } - - Widget inventory = client.getWidget(WidgetInfo.INVENTORY); - if (inventory.isHidden()) - { - return; - } - - for (WidgetItem item : inventory.getWidgetItems()) - { - if (item.getId() != best.getId()) - { - continue; - } - - drawItem(graphics, item); - } - } - - private AlchemyItem getBest() - { - for (int i = 0; i < INFO_LENGTH; i++) - { - Widget textWidget = client.getWidget(WidgetID.MTA_ALCHEMY_GROUP_ID, INFO_ITEM_START + i); - if (textWidget == null) - { - return null; - } - - String item = textWidget.getText(); - Widget pointsWidget = client.getWidget(WidgetID.MTA_ALCHEMY_GROUP_ID, INFO_POINT_START + i); - int points = Integer.parseInt(pointsWidget.getText()); - - if (points == BEST_POINTS) - { - return AlchemyItem.find(item); - } - } - - return null; - } - - private Cupboard getClicked() - { - Cupboard nearest = null; - double distance = Double.MAX_VALUE; - - WorldPoint mine = client.getLocalPlayer().getWorldLocation(); - - for (Cupboard cupboard : cupboards) - { - if (cupboard == null) - { - continue; - } - - double objectDistance = cupboard.gameObject.getWorldLocation().distanceTo(mine); - - if (nearest == null || objectDistance < distance) - { - nearest = cupboard; - distance = objectDistance; - } - } - - return nearest; - } - - private void fill(Cupboard cupboard, AlchemyItem alchemyItem) - { - int idx = Arrays.asList(cupboards).indexOf(cupboard); - assert idx != -1; - - int itemIdx = alchemyItem.ordinal(); - - log.debug("Filling cupboard {} with {}", idx, alchemyItem); - - for (int i = 0; i < NUM_CUPBOARDS; ++i) - { - int cupIdx = (idx + i) % NUM_CUPBOARDS; - int itemIndex = (itemIdx + i) % NUM_CUPBOARDS; - cupboards[cupIdx].alchemyItem = itemIndex <= 4 ? AlchemyItem.values()[itemIndex] : AlchemyItem.EMPTY; - } - } - - private Cupboard getSuggestion() - { - // check if a cupboard has the best item in it - if (best != null) - { - for (Cupboard cupboard : cupboards) - { - if (cupboard != null && cupboard.alchemyItem == best) - { - return cupboard; - } - } - } - - // otherwise find the closest cupboard which can not be empty - Cupboard nearest = null; - int distance = -1; - - WorldPoint mine = client.getLocalPlayer().getWorldLocation(); - - for (Cupboard cupboard : cupboards) - { - if (cupboard == null || cupboard.alchemyItem == AlchemyItem.EMPTY || cupboard.alchemyItem == AlchemyItem.POSSIBLY_EMPTY) - { - continue; - } - - int objectDistance = cupboard.gameObject.getWorldLocation().distanceTo(mine); - - if (nearest == null || objectDistance < distance) - { - nearest = cupboard; - distance = objectDistance; - } - } - - return nearest; - } - - private void drawItem(Graphics2D graphics, WidgetItem item) - { - Rectangle bounds = item.getCanvasBounds(); - graphics.setColor(Color.GREEN); - graphics.draw(bounds); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mta/alchemy/AlchemyRoomTimer.java b/runelite-client/src/main/java/net/runelite/client/plugins/mta/alchemy/AlchemyRoomTimer.java deleted file mode 100644 index d5b23a07e9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mta/alchemy/AlchemyRoomTimer.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2018, Jasper Ketelaar - * 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.mta.alchemy; - -import java.awt.image.BufferedImage; -import java.time.temporal.ChronoUnit; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.ui.overlay.infobox.Timer; -import net.runelite.client.util.ImageUtil; - -class AlchemyRoomTimer extends Timer -{ - private static final int RESET_PERIOD = 42; - private static BufferedImage image; - - AlchemyRoomTimer(final Plugin plugin) - { - super(RESET_PERIOD, ChronoUnit.SECONDS, getResetImage(), plugin); - this.setTooltip("Time until items swap"); - } - - private static BufferedImage getResetImage() - { - if (image != null) - { - return image; - } - - image = ImageUtil.getResourceStreamFromClass(AlchemyRoomTimer.class, "/util/reset.png"); - - return image; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mta/alchemy/Cupboard.java b/runelite-client/src/main/java/net/runelite/client/plugins/mta/alchemy/Cupboard.java deleted file mode 100644 index 3467e3a188..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mta/alchemy/Cupboard.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2018, 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.mta.alchemy; - -import net.runelite.api.GameObject; - -class Cupboard -{ - GameObject gameObject; - AlchemyItem alchemyItem; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mta/enchantment/EnchantmentRoom.java b/runelite-client/src/main/java/net/runelite/client/plugins/mta/enchantment/EnchantmentRoom.java deleted file mode 100644 index edfe860cdd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mta/enchantment/EnchantmentRoom.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2018, Jasper Ketelaar - * 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.mta.enchantment; - -import java.util.ArrayList; -import java.util.List; -import javax.inject.Inject; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.ItemID; -import net.runelite.api.Player; -import net.runelite.api.Tile; -import net.runelite.api.TileItem; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.ItemDespawned; -import net.runelite.api.events.ItemSpawned; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.mta.MTAConfig; -import net.runelite.client.plugins.mta.MTARoom; - -@Slf4j -public class EnchantmentRoom extends MTARoom -{ - private static final int MTA_ENCHANT_REGION = 13462; - - private final Client client; - private final EventBus eventBus; - private final List dragonstones = new ArrayList<>(); - - private boolean enchantment; - - @Inject - private EnchantmentRoom(final MTAConfig config, final Client client, final EventBus eventBus) - { - super(config); - this.client = client; - this.eventBus = eventBus; - - this.enchantment = config.enchantment(); - - addSubscriptions(); - } - - private void addSubscriptions() - { - eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged); - eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged); - eventBus.subscribe(GameTick.class, this, this::onGameTick); - eventBus.subscribe(ItemSpawned.class, this, this::onItemSpawned); - eventBus.subscribe(ItemDespawned.class, this, this::onItemDespawned); - } - - private void onGameStateChanged(GameStateChanged gameStateChanged) - { - if (gameStateChanged.getGameState() == GameState.LOADING) - { - dragonstones.clear(); - } - } - - private void onGameTick(GameTick event) - { - if (!inside() || !this.enchantment) - { - return; - } - - WorldPoint nearest = findNearestStone(); - if (nearest != null) - { - client.setHintArrow(nearest); - } - else - { - client.clearHintArrow(); - } - } - - private WorldPoint findNearestStone() - { - WorldPoint nearest = null; - double dist = Double.MAX_VALUE; - WorldPoint local = client.getLocalPlayer().getWorldLocation(); - for (WorldPoint worldPoint : dragonstones) - { - double currDist = local.distanceTo(worldPoint); - if (nearest == null || currDist < dist) - { - dist = currDist; - nearest = worldPoint; - } - } - return nearest; - } - - private void onItemSpawned(ItemSpawned itemSpawned) - { - final TileItem item = itemSpawned.getItem(); - final Tile tile = itemSpawned.getTile(); - - if (item.getId() == ItemID.DRAGONSTONE_6903) - { - WorldPoint location = tile.getWorldLocation(); - log.debug("Adding dragonstone at {}", location); - dragonstones.add(location); - } - } - - private void onItemDespawned(ItemDespawned itemDespawned) - { - final TileItem item = itemDespawned.getItem(); - final Tile tile = itemDespawned.getTile(); - - if (item.getId() == ItemID.DRAGONSTONE_6903) - { - WorldPoint location = tile.getWorldLocation(); - log.debug("Removed dragonstone at {}", location); - dragonstones.remove(location); - } - } - - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("mta") || !event.getKey().equals("enchantment")) - { - return; - } - - this.enchantment = config.enchantment(); - } - - @Override - public boolean inside() - { - Player player = client.getLocalPlayer(); - return player != null && player.getWorldLocation().getRegionID() == MTA_ENCHANT_REGION - && player.getWorldLocation().getPlane() == 0; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mta/graveyard/GraveyardCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/mta/graveyard/GraveyardCounter.java deleted file mode 100644 index c3be2bc51f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mta/graveyard/GraveyardCounter.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2018, Jasper Ketelaar - * 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.mta.graveyard; - -import java.awt.Color; -import java.awt.image.BufferedImage; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.ui.overlay.infobox.Counter; - -class GraveyardCounter extends Counter -{ - GraveyardCounter(final BufferedImage image, final Plugin plugin) - { - super(image, plugin, 0); - } - - @Override - public Color getTextColor() - { - int count = getCount(); - if (count >= GraveyardRoom.MIN_SCORE) - { - return Color.GREEN; - } - else if (count == 0) - { - return Color.RED; - } - else - { - return Color.ORANGE; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mta/graveyard/GraveyardRoom.java b/runelite-client/src/main/java/net/runelite/client/plugins/mta/graveyard/GraveyardRoom.java deleted file mode 100644 index d2051f5159..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mta/graveyard/GraveyardRoom.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2018, Jasper Ketelaar - * 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.mta.graveyard; - -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import static net.runelite.api.ItemID.ANIMALS_BONES; -import static net.runelite.api.ItemID.ANIMALS_BONES_6905; -import static net.runelite.api.ItemID.ANIMALS_BONES_6906; -import static net.runelite.api.ItemID.ANIMALS_BONES_6907; -import net.runelite.api.Player; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.mta.MTAConfig; -import net.runelite.client.plugins.mta.MTAPlugin; -import net.runelite.client.plugins.mta.MTARoom; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; - -public class GraveyardRoom extends MTARoom -{ - static final int MIN_SCORE = 16; - private static final int MTA_GRAVEYARD_REGION = 13462; - private final Client client; - private final MTAPlugin plugin; - private final ItemManager itemManager; - private final InfoBoxManager infoBoxManager; - private final EventBus eventBus; - - private GraveyardCounter counter; - - private boolean graveyard; - - @Inject - private GraveyardRoom(final MTAConfig config, final Client client, final MTAPlugin plugin, final ItemManager itemManager, final InfoBoxManager infoBoxManager, final EventBus eventBus) - { - super(config); - this.client = client; - this.plugin = plugin; - this.itemManager = itemManager; - this.infoBoxManager = infoBoxManager; - this.eventBus = eventBus; - - this.graveyard = config.graveyard(); - - addSubscriptions(); - } - - private void addSubscriptions() - { - eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged); - eventBus.subscribe(GameTick.class, this, this::onGameTick); - eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged); - } - - @Override - public boolean inside() - { - Player player = client.getLocalPlayer(); - return player != null && player.getWorldLocation().getRegionID() == MTA_GRAVEYARD_REGION - && player.getWorldLocation().getPlane() == 1; - } - - private void onGameTick(GameTick tick) - { - if ((!inside() || !this.graveyard) && this.counter != null) - { - infoBoxManager.removeIf(e -> e instanceof GraveyardCounter); - this.counter = null; - } - } - - private void onItemContainerChanged(ItemContainerChanged event) - { - if (!inside()) - { - return; - } - - ItemContainer container = event.getItemContainer(); - - if (container == client.getItemContainer(InventoryID.INVENTORY)) - { - int score = score(container.getItems()); - - if (counter == null) - { - BufferedImage image = itemManager.getImage(ANIMALS_BONES); - counter = new GraveyardCounter(image, plugin); - infoBoxManager.addInfoBox(counter); - } - counter.setCount(score); - } - } - - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("mta") || !event.getKey().equals("graveyard")) - { - return; - } - - this.graveyard = config.graveyard(); - } - - private int score(Item[] items) - { - int score = 0; - - if (items == null) - { - return score; - } - - for (Item item : items) - { - score += getPoints(item.getId()); - } - - return score; - } - - private int getPoints(int id) - { - switch (id) - { - case ANIMALS_BONES: - return 1; - case ANIMALS_BONES_6905: - return 2; - case ANIMALS_BONES_6906: - return 3; - case ANIMALS_BONES_6907: - return 4; - default: - return 0; - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mta/telekinetic/Maze.java b/runelite-client/src/main/java/net/runelite/client/plugins/mta/telekinetic/Maze.java deleted file mode 100644 index 77871deb92..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mta/telekinetic/Maze.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2018, Jasper Ketelaar - * 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.mta.telekinetic; - -import net.runelite.api.coords.LocalPoint; - -public enum Maze -{ - MAZE_1(100, new LocalPoint(6848, 3904)), - MAZE_2(124, new LocalPoint(4928, 6848)), - MAZE_3(129, new LocalPoint(7104, 5312)), - MAZE_4(53, new LocalPoint(6208, 4928)), - MAZE_5(108, new LocalPoint(5056, 5184)), - MAZE_6(121, new LocalPoint(3648, 5440)), - MAZE_7(71, new LocalPoint(6080, 5696)), - MAZE_8(98, new LocalPoint(5952, 7360)), - MAZE_9(87, new LocalPoint(5184, 6208)), - MAZE_10(91, new LocalPoint(5440, 9024)); - - private final int walls; - private final LocalPoint start; - - Maze(final int walls, final LocalPoint start) - { - this.walls = walls; - this.start = start; - } - - public static Maze fromWalls(int walls) - { - for (Maze maze : values()) - { - if (maze.getWalls() == walls) - { - return maze; - } - } - - return null; - } - - public int getWalls() - { - return walls; - } - - public LocalPoint getStart() - { - return start; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mta/telekinetic/TelekineticRoom.java b/runelite-client/src/main/java/net/runelite/client/plugins/mta/telekinetic/TelekineticRoom.java deleted file mode 100644 index 602a94af93..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mta/telekinetic/TelekineticRoom.java +++ /dev/null @@ -1,534 +0,0 @@ -/* - * Copyright (c) 2018, Jasper Ketelaar - * 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.mta.telekinetic; - -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Queue; -import java.util.Set; -import java.util.Stack; -import javax.inject.Inject; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.GroundObject; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.NullObjectID; -import net.runelite.api.Perspective; -import net.runelite.api.WallObject; -import net.runelite.api.coords.Angle; -import net.runelite.api.coords.Direction; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldArea; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.GroundObjectSpawned; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.events.WallObjectSpawned; -import net.runelite.api.widgets.WidgetID; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.plugins.mta.MTAConfig; -import net.runelite.client.plugins.mta.MTARoom; - -@Slf4j -public class TelekineticRoom extends MTARoom -{ - private static final int MAZE_GUARDIAN_MOVING = 6778; - private static final int TELEKINETIC_WALL = NullObjectID.NULL_10755; - private static final int TELEKINETIC_FINISH = NullObjectID.NULL_23672; - - private final Client client; - - private final List telekineticWalls = new ArrayList<>(); - - private Stack moves = new Stack<>(); - private LocalPoint destination; - private WorldPoint location; - private WorldPoint finishLocation; - private Rectangle bounds; - private NPC guardian; - private Maze maze; - private final EventBus eventBus; - - @Inject - private TelekineticRoom(MTAConfig config, Client client, EventBus eventBus) - { - super(config); - this.client = client; - this.eventBus = eventBus; - - addSubscriptions(); - } - - private static int manhattan(WorldPoint point1, WorldPoint point2) - { - return Math.abs(point1.getX() - point2.getX()) + Math.abs(point2.getY() - point1.getY()); - } - - private void addSubscriptions() - { - eventBus.subscribe(GameTick.class, this, this::onGameTick); - eventBus.subscribe(WallObjectSpawned.class, this, this::onWallObjectSpawned); - eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged); - eventBus.subscribe(GroundObjectSpawned.class, this, this::onGroundObjectSpawned); - eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned); - eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned); - } - - public void resetRoom() - { - finishLocation = null; - telekineticWalls.clear(); - } - - private void onWallObjectSpawned(WallObjectSpawned event) - { - final WallObject wall = event.getWallObject(); - if (wall.getId() != TELEKINETIC_WALL) - { - return; - } - - telekineticWalls.add(wall); - } - - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOADING) - { - // Game objects are nulled when loading new scenes, thus never trigger their respective - // ObjectDespawned events. - resetRoom(); - } - } - - private void onGroundObjectSpawned(GroundObjectSpawned event) - { - final GroundObject object = event.getGroundObject(); - if (object.getId() == TELEKINETIC_FINISH) - { - finishLocation = object.getWorldLocation(); - } - } - - private void onGameTick(GameTick event) - { - if (!config.telekinetic() - || !inside() - || client.getGameState() != GameState.LOGGED_IN) - { - maze = null; - moves.clear(); - return; - } - - if (maze == null || telekineticWalls.size() != maze.getWalls()) - { - bounds = getBounds(telekineticWalls.toArray(new WallObject[0])); - maze = Maze.fromWalls(telekineticWalls.size()); - client.clearHintArrow(); - } - else if (guardian != null) - { - WorldPoint current; - if (guardian.getId() == MAZE_GUARDIAN_MOVING) - { - destination = getGuardianDestination(); - current = WorldPoint.fromLocal(client, destination); - } - else - { - destination = null; - current = guardian.getWorldLocation(); - } - - //Prevent unnecessary updating when the guardian has not moved - if (current.equals(location)) - { - return; - } - - log.debug("Updating guarding location {} -> {}", location, current); - - location = current; - - if (location.equals(finishLocation)) - { - client.clearHintArrow(); - } - else - { - log.debug("Rebuilding moves due to guardian move"); - this.moves = build(); - } - - } - else - { - client.clearHintArrow(); - moves.clear(); - } - } - - private void onNpcSpawned(NpcSpawned event) - { - NPC npc = event.getNpc(); - - if (npc.getId() == NpcID.MAZE_GUARDIAN) - { - guardian = npc; - } - } - - private void onNpcDespawned(NpcDespawned event) - { - NPC npc = event.getNpc(); - - if (npc == guardian) - { - guardian = null; - } - } - - @Override - public boolean inside() - { - return client.getWidget(WidgetID.MTA_TELEKINETIC_GROUP_ID, 0) != null; - } - - @Override - public void under(Graphics2D graphics2D) - { - if (inside() && maze != null && guardian != null) - { - if (destination != null) - { - graphics2D.setColor(Color.ORANGE); - renderLocalPoint(graphics2D, destination); - } - if (!moves.isEmpty()) - { - if (moves.peek() == getPosition()) - { - graphics2D.setColor(Color.GREEN); - } - else - { - graphics2D.setColor(Color.RED); - } - - Polygon tile = Perspective.getCanvasTilePoly(client, guardian.getLocalLocation()); - if (tile != null) - { - graphics2D.drawPolygon(tile); - } - - WorldPoint optimal = optimal(); - - if (optimal != null) - { - client.setHintArrow(optimal); - renderWorldPoint(graphics2D, optimal); - } - } - } - } - - private WorldPoint optimal() - { - WorldPoint current = client.getLocalPlayer().getWorldLocation(); - - Direction next = moves.pop(); - WorldArea areaNext = getIndicatorLine(next); - WorldPoint nearestNext = nearest(areaNext, current); - - if (moves.isEmpty()) - { - moves.push(next); - - return nearestNext; - } - - Direction after = moves.peek(); - moves.push(next); - WorldArea areaAfter = getIndicatorLine(after); - WorldPoint nearestAfter = nearest(areaAfter, nearestNext); - - return nearest(areaNext, nearestAfter); - } - - private WorldPoint nearest(WorldArea area, WorldPoint worldPoint) - { - int dist = Integer.MAX_VALUE; - WorldPoint nearest = null; - - for (WorldPoint areaPoint : area.toWorldPointList()) - { - int currDist = manhattan(areaPoint, worldPoint); - if (nearest == null || dist > currDist) - { - nearest = areaPoint; - dist = currDist; - } - } - - return nearest; - } - - private void renderWorldPoint(Graphics2D graphics, WorldPoint worldPoint) - { - renderLocalPoint(graphics, LocalPoint.fromWorld(client, worldPoint)); - } - - private void renderLocalPoint(Graphics2D graphics, LocalPoint local) - { - if (local != null) - { - Polygon canvasTilePoly = Perspective.getCanvasTilePoly(client, local); - if (canvasTilePoly != null) - { - graphics.drawPolygon(canvasTilePoly); - } - } - } - - private Stack build() - { - if (guardian.getId() == MAZE_GUARDIAN_MOVING) - { - WorldPoint converted = WorldPoint.fromLocal(client, getGuardianDestination()); - return build(converted); - } - else - { - return build(guardian.getWorldLocation()); - } - } - - private LocalPoint getGuardianDestination() - { - Angle angle = new Angle(guardian.getOrientation()); - Direction facing = angle.getNearestDirection(); - return neighbour(guardian.getLocalLocation(), facing); - } - - private Stack build(WorldPoint start) - { - Queue visit = new LinkedList<>(); - Set closed = new HashSet<>(); - Map scores = new HashMap<>(); - Map edges = new HashMap<>(); - scores.put(start, 0); - visit.add(start); - - while (!visit.isEmpty()) - { - WorldPoint next = visit.poll(); - closed.add(next); - - LocalPoint localNext = LocalPoint.fromWorld(client, next); - LocalPoint[] neighbours = neighbours(localNext); - - for (LocalPoint neighbour : neighbours) - { - if (neighbour == null) - { - continue; - } - - WorldPoint nghbWorld = WorldPoint.fromLocal(client, neighbour); - - if (!nghbWorld.equals(next) - && !closed.contains(nghbWorld)) - { - int score = scores.get(next) + 1; - - if (!scores.containsKey(nghbWorld) || scores.get(nghbWorld) > score) - { - scores.put(nghbWorld, score); - edges.put(nghbWorld, next); - visit.add(nghbWorld); - } - } - } - } - - return build(edges, finishLocation); - } - - private Stack build(Map edges, WorldPoint finish) - { - Stack path = new Stack<>(); - WorldPoint current = finish; - - while (edges.containsKey(current)) - { - WorldPoint next = edges.get(current); - - if (next.getX() > current.getX()) - { - path.add(Direction.WEST); - } - else if (next.getX() < current.getX()) - { - path.add(Direction.EAST); - } - else if (next.getY() > current.getY()) - { - path.add(Direction.SOUTH); - } - else - { - path.add(Direction.NORTH); - } - - current = next; - } - - return path; - } - - private LocalPoint[] neighbours(LocalPoint point) - { - return new LocalPoint[] - { - neighbour(point, Direction.NORTH), neighbour(point, Direction.SOUTH), - neighbour(point, Direction.EAST), neighbour(point, Direction.WEST) - }; - } - - private LocalPoint neighbour(LocalPoint point, Direction direction) - { - WorldPoint worldPoint = WorldPoint.fromLocal(client, point); - WorldArea area = new WorldArea(worldPoint, 1, 1); - - int dx, dy; - - switch (direction) - { - case NORTH: - dx = 0; - dy = 1; - break; - case SOUTH: - dx = 0; - dy = -1; - break; - case EAST: - dx = 1; - dy = 0; - break; - case WEST: - dx = -1; - dy = 0; - break; - default: - throw new IllegalStateException(); - } - - while (area.canTravelInDirection(client, dx, dy)) - { - worldPoint = area.toWorldPoint() - .dx(dx) - .dy(dy); - area = new WorldArea(worldPoint, 1, 1); - } - - return LocalPoint.fromWorld(client, worldPoint); - } - - private Rectangle getBounds(WallObject[] walls) - { - int minX = Integer.MAX_VALUE; - int minY = Integer.MAX_VALUE; - - int maxX = Integer.MIN_VALUE; - int maxY = Integer.MIN_VALUE; - - for (WallObject wall : walls) - { - WorldPoint point = wall.getWorldLocation(); - minX = Math.min(minX, point.getX()); - minY = Math.min(minY, point.getY()); - - maxX = Math.max(maxX, point.getX()); - maxY = Math.max(maxY, point.getY()); - } - - return new Rectangle(minX, minY, maxX - minX, maxY - minY); - } - - private Direction getPosition() - { - WorldPoint mine = client.getLocalPlayer().getWorldLocation(); - - if (mine.getY() >= bounds.getMaxY() && mine.getX() < bounds.getMaxX() && mine.getX() > bounds.getX()) - { - return Direction.NORTH; - } - else if (mine.getY() <= bounds.getY() && mine.getX() < bounds.getMaxX() && mine.getX() > bounds.getX()) - { - return Direction.SOUTH; - } - else if (mine.getX() >= bounds.getMaxX() && mine.getY() < bounds.getMaxY() && mine.getY() > bounds.getY()) - { - return Direction.EAST; - } - else if (mine.getX() <= bounds.getX() && mine.getY() < bounds.getMaxY() && mine.getY() > bounds.getY()) - { - return Direction.WEST; - } - - return null; - } - - private WorldArea getIndicatorLine(Direction direction) - { - switch (direction) - { - case NORTH: - return new WorldArea(bounds.x + 1, (int) bounds.getMaxY(), bounds.width - 1, 1, 0); - case SOUTH: - return new WorldArea(bounds.x + 1, bounds.y, bounds.width - 1, 1, 0); - case WEST: - return new WorldArea(bounds.x, bounds.y + 1, 1, bounds.height - 1, 0); - case EAST: - return new WorldArea((int) bounds.getMaxX(), bounds.y + 1, 1, bounds.height - 1, 0); - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/MapLocations.java b/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/MapLocations.java deleted file mode 100644 index be4008b8eb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/MapLocations.java +++ /dev/null @@ -1,3503 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * Copyright (c) 2019, Enza-Denino - * 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.multiindicators; - -import java.awt.Polygon; -import java.awt.Rectangle; -import java.awt.Shape; -import java.awt.geom.Area; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import net.runelite.api.Constants; - -public class MapLocations -{ - @SuppressWarnings("unchecked") - private static final List[] MULTICOMBAT = new List[Constants.MAX_Z]; - @SuppressWarnings("unchecked") - private static final List[] NOT_MULTICOMBAT = new List[Constants.MAX_Z]; - @SuppressWarnings("unchecked") - private static final List[] ROUGH_WILDERNESS = new List[Constants.MAX_Z]; - @SuppressWarnings("unchecked") - private static final List[] WILDERNESS_LEVEL_LINES = new List[Constants.MAX_Z]; - @SuppressWarnings("unchecked") - private static final List[] DEADMAN_SAFE_ZONES = new List[Constants.MAX_Z]; - @SuppressWarnings("unchecked") - private static final List[] PVP_WORLD_SAFE_ZONES = new List[Constants.MAX_Z]; - - private static Area getArea(List shapes) - { - Area area = new Area(); - for (Shape shape : shapes) - { - area.add(new Area(shape)); - } - return area; - } - - private static Area getArea(List shapes, Rectangle view) - { - Area area = new Area(); - for (Shape shape : shapes) - { - if (shape.intersects(view)) - { - area.add(new Area(shape)); - } - } - return area; - } - - public static Area getMulticombat(int plane) - { - Area area = getArea(MULTICOMBAT[plane]); - area.subtract(getArea(NOT_MULTICOMBAT[plane])); - return area; - } - - public static Area getMulticombat(Rectangle view, int plane) - { - Area area = getArea(MULTICOMBAT[plane], view); - area.subtract(getArea(NOT_MULTICOMBAT[plane], view)); - return area; - } - - public static Area getRoughWilderness(int plane) - { - return getArea(ROUGH_WILDERNESS[plane]); - } - - public static Area getRoughWilderness(Rectangle view, int plane) - { - return getArea(ROUGH_WILDERNESS[plane], view); - } - - public static Area getWildernessLevelLines(int plane) - { - return getArea(WILDERNESS_LEVEL_LINES[plane]); - } - - public static Area getWildernessLevelLines(Rectangle view, int plane) - { - return getArea(WILDERNESS_LEVEL_LINES[plane], view); - } - - public static Area getDeadmanSafeZones(int plane) - { - return getArea(DEADMAN_SAFE_ZONES[plane]); - } - - public static Area getDeadmanSafeZones(Rectangle view, int plane) - { - return getArea(DEADMAN_SAFE_ZONES[plane], view); - } - - public static Area getPvpSafeZones(int plane) - { - return getArea(PVP_WORLD_SAFE_ZONES[plane]); - } - - public static Area getPvpSafeZones(Rectangle view, int plane) - { - return getArea(PVP_WORLD_SAFE_ZONES[plane], view); - } - - private static void initializeWithEmptyLists(List[] array) - { - Arrays.fill(array, new ArrayList<>()); - } - - static - { - initializeWithEmptyLists(MULTICOMBAT); - initializeWithEmptyLists(NOT_MULTICOMBAT); - initializeWithEmptyLists(ROUGH_WILDERNESS); - initializeWithEmptyLists(WILDERNESS_LEVEL_LINES); - initializeWithEmptyLists(DEADMAN_SAFE_ZONES); - initializeWithEmptyLists(PVP_WORLD_SAFE_ZONES); - - defineMulticombatAreas(); - defineDeadmanSafeZones(); - definePvpSafeZones(); - defineWilderness(); - defineWildernessLevelLines(); - } - - private static void defineMulticombatAreas() - { - // Main Wilderness - addPolygonOnPlane(MULTICOMBAT, 0, - 3200, 3968, - 3392, 3968, - 3392, 3840, - 3328, 3840, - 3328, 3520, - 3136, 3520, - 3136, 3648, - 3192, 3648, - 3192, 3752, - 3152, 3752, - 3152, 3840, - 3136, 3840, - 3136, 3872, - 3112, 3872, - 3112, 3880, - 3072, 3880, - 3072, 3896, - 3048, 3896, - 3048, 3872, - 3056, 3872, - 3056, 3864, - 3048, 3864, - 3048, 3856, - 3008, 3856, - 3008, 3904, - 3200, 3904); - - // South of wildy agility training arena - addPolygonOnPlane(MULTICOMBAT, 0, - 2984, 3928, - 3008, 3928, - 3008, 3912, - 2984, 3912); - - // Wildy zamorak temple - addPolygonOnPlane(MULTICOMBAT, 0, - 2944, 3832, - 2960, 3832, - 2960, 3816, - 2944, 3816); - - // Wildy bandit camp - addPolygonOnPlane(MULTICOMBAT, 0, - 3008, 3712, - 3072, 3712, - 3072, 3600, - 3008, 3600); - - // Chaos temple north of Falador - addPolygonOnPlane(MULTICOMBAT, 0, - 2928, 3520, - 2944, 3520, - 2944, 3512, - 2928, 3512); - - // Burthorpe - addPolygonOnPlane(MULTICOMBAT, 0, - 2880, 3544, - 2904, 3544, - 2904, 3520, - 2880, 3520); - - // White Wolf Mountain - addPolygonOnPlane(MULTICOMBAT, 0, - 2880, 3520, - 2816, 3520, - 2816, 3456, - 2880, 3456); - - // Death Plateu - addPolygonOnPlane(MULTICOMBAT, 0, - 2848, 3608, - 2880, 3608, - 2880, 3600, - 2848, 3600); - - // Trollheim/Godwars - addPolygonOnPlane(MULTICOMBAT, 0, - 2880, 3776, - 2912, 3776, - 2912, 3696, - 2920, 3696, - 2920, 3688, - 2896, 3688, - 2896, 3696, - 2880, 3696, - 2880, 3728, - 2888, 3728, - 2888, 3744, - 2880, 3744); - - // Northen Rellekka - addPolygonOnPlane(MULTICOMBAT, 0, - 2656, 3736, - 2704, 3736, - 2704, 3728, - 2712, 3728, - 2712, 3736, - 2736, 3736, - 2736, 3712, - 2656, 3712); - - // Northen Fremennik Isles - addPolygonOnPlane(MULTICOMBAT, 0, - 2304, 3904, - 2432, 3904, - 2432, 3840, - 2368, 3840, - 2368, 3816, - 2352, 3816, - 2352, 3824, - 2304, 3824); - - // Pirates Cove - addPolygonOnPlane(MULTICOMBAT, 0, - 2176, 3840, - 2240, 3840, - 2240, 3776, - 2176, 3776); - - // Lunar Isle - addPolygonOnPlane(MULTICOMBAT, 0, - 2048, 3968, - 2176, 3968, - 2176, 3840, - 2048, 3840); - - // Piscatoris Fishing Colony - addPolygonOnPlane(MULTICOMBAT, 0, - 2304, 3712, - 2368, 3712, - 2368, 3648, - 2304, 3648); - - // Ranging Guild - addPolygonOnPlane(MULTICOMBAT, 0, - 2656, 3448, - 2680, 3448, - 2680, 3440, - 2688, 3440, - 2688, 3416, - 2680, 3416, - 2680, 3408, - 2656, 3408, - 2656, 3416, - 2648, 3416, - 2648, 3440, - 2656, 3440); - - // Necromancer house, southeast of Ardy - addPolygonOnPlane(MULTICOMBAT, 0, - 2656, 3256, - 2680, 3256, - 2680, 3216, - 2664, 3216, - 2664, 3232, - 2656, 3232); - - // Battlefield noth of Tree Gnome Village - addPolygonOnPlane(MULTICOMBAT, 0, - 2504, 3248, - 2544, 3248, - 2544, 3232, - 2552, 3232, - 2552, 3208, - 2504, 3208); - - // Castle Wars - addPolygonOnPlane(MULTICOMBAT, 0, - 2368, 3136, - 2432, 3136, - 2432, 3072, - 2368, 3072); - - // Jiggig - addPolygonOnPlane(MULTICOMBAT, 0, - 2456, 3056, - 2496, 3056, - 2496, 3032, - 2456, 3032); - - // East feldip hills, near rantz - addPolygonOnPlane(MULTICOMBAT, 0, - 2648, 2976, - 2656, 2976, - 2656, 2952, - 2648, 2952); - - // Ape Atoll - addPolygonOnPlane(MULTICOMBAT, 0, - 2688, 2816, - 2816, 2816, - 2816, 2688, - 2688, 2688); - - // Pest Control - addPolygonOnPlane(MULTICOMBAT, 0, - 2624, 2624, - 2688, 2624, - 2688, 2560, - 2624, 2560); - - // Desert Bandit Camp - addPolygonOnPlane(MULTICOMBAT, 0, - 3152, 3000, - 3192, 3000, - 3192, 2960, - 3152, 2960); - - // Al Kharid - addPolygonOnPlane(MULTICOMBAT, 0, - 3264, 3200, - 3328, 3200, - 3328, 3136, - 3264, 3136); - - // Wizards Tower - addPolygonOnPlane(MULTICOMBAT, 0, - 3094, 3176, - 3126, 3176, - 3126, 3144, - 3094, 3144); - - // Draynor Village - addPolygonOnPlane(MULTICOMBAT, 0, - 3112, 3264, - 3136, 3264, - 3136, 3232, - 3104, 3232, - 3104, 3256, - 3112, 3256); - - // Falador - addPolygonOnPlane(MULTICOMBAT, 0, - 2944, 3456, - 3008, 3456, - 3008, 3328, - 3016, 3328, - 3016, 3304, - 2944, 3304); - - // Southwest fally castle isn't multicombat downstairs - addPolygonOnPlane(NOT_MULTICOMBAT, 0, - 2968, 3336, - 2968, 3328, - 2960, 3328, - 2960, 3336); - - // Barbarian Village - addPolygonOnPlane(MULTICOMBAT, 0, - 3072, 3456, - 3136, 3456, - 3136, 3392, - 3048, 3392, - 3048, 3408, - 3056, 3408, - 3056, 3440, - 3064, 3440, - 3064, 3448, - 3072, 3448); - - // Ammoniate crabs at northwest fossil island - addPolygonOnPlane(MULTICOMBAT, 0, - 3648, 3885, - 3663, 3885, - 3663, 3882, - 3664, 3882, - 3664, 3872, - 3663, 3872, - 3663, 3868, - 3648, 3868); - - // Ammoniate crabs at north fossil island - addPolygonOnPlane(MULTICOMBAT, 0, - 3680, 3904, - 3744, 3904, - 3744, 3856, - 3756, 3856, - 3756, 3852, - 3755, 3852, - 3755, 3851, - 3754, 3851, - 3754, 3850, - 3751, 3850, - 3751, 3849, - 3750, 3849, - 3750, 3848, - 3749, 3848, - 3749, 3847, - 3748, 3847, - 3748, 3846, - 3747, 3846, - 3747, 3845, - 3746, 3845, - 3746, 3844, - 3742, 3844, - 3742, 3845, - 3740, 3845, - 3740, 3844, - 3732, 3844, - 3732, 3843, - 3730, 3843, - 3730, 3842, - 3724, 3842, - 3724, 3843, - 3717, 3843, - 3717, 3842, - 3712, 3842, - 3712, 3846, - 3710, 3846, - 3710, 3847, - 3709, 3847, - 3709, 3848, - 3708, 3848, - 3708, 3859, - 3709, 3859, - 3709, 3860, - 3710, 3860, - 3710, 3861, - 3712, 3861, - 3712, 3866, - 3713, 3866, - 3713, 3870, - 3714, 3870, - 3714, 3873, - 3713, 3873, - 3713, 3876, - 3712, 3876, - 3712, 3881, - 3710, 3881, - 3710, 3888, - 3712, 3888, - 3712, 3890, - 3714, 3890, - 3714, 3891, - 3716, 3891, - 3716, 3892, - 3717, 3892, - 3717, 3893, - 3716, 3893, - 3716, 3894, - 3714, 3894, - 3714, 3895, - 3713, 3895, - 3713, 3896, - 3712, 3896, - 3712, 3897, - 3705, 3897, - 3705, 3898, - 3704, 3898, - 3704, 3899, - 3692, 3899, - 3692, 3898, - 3688, 3898, - 3688, 3897, - 3686, 3897, - 3686, 3896, - 3680, 3896); - - // Zeah, southwest of Wintertodt, snowy area with ice giants and wolves - addPolygonOnPlane(MULTICOMBAT, 0, - 1540, 3898, - 1543, 3898, - 1543, 3901, - 1546, 3901, - 1546, 3903, - 1547, 3903, - 1547, 3904, - 1550, 3904, - 1550, 3903, - 1553, 3903, - 1553, 3904, - 1559, 3904, - 1559, 3902, - 1564, 3902, - 1564, 3903, - 1565, 3903, - 1565, 3904, - 1568, 3904, - 1568, 3903, - 1569, 3903, - 1569, 3902, - 1570, 3902, - 1570, 3901, - 1573, 3901, - 1573, 3898, - 1577, 3898, - 1577, 3899, - 1578, 3899, - 1578, 3902, - 1579, 3902, - 1579, 3903, - 1584, 3903, - 1584, 3902, - 1586, 3902, - 1586, 3901, - 1590, 3901, - 1590, 3891, - 1588, 3891, - 1588, 3887, - 1572, 3887, - 1572, 3872, - 1567, 3872, - 1567, 3868, - 1563, 3868, - 1563, 3867, - 1558, 3867, - 1558, 3868, - 1557, 3868, - 1557, 3870, - 1549, 3870, - 1549, 3874, - 1545, 3874, - 1545, 3876, - 1543, 3876, - 1543, 3877, - 1542, 3877, - 1542, 3879, - 1541, 3879, - 1541, 3882, - 1539, 3882, - 1539, 3887, - 1540, 3887, - 1540, 3888, - 1539, 3888, - 1539, 3894, - 1540, 3894); - - // Zeah arceuus area - addPolygonOnPlane(MULTICOMBAT, 0, - 1664, 3776, - 1664, 3785, - 1667, 3785, - 1667, 3805, - 1671, 3805, - 1671, 3811, - 1675, 3811, - 1675, 3819, - 1690, 3819, - 1690, 3814, - 1695, 3814, - 1695, 3806, - 1719, 3806, - 1719, 3787, - 1725, 3787, - 1725, 3778, - 1711, 3778, - 1711, 3776); - - // Arceuus teletab-making house - addPolygonOnPlane(MULTICOMBAT, 0, - 1667, 3772, - 1679, 3772, - 1679, 3775, - 1691, 3775, - 1691, 3761, - 1679, 3761, - 1679, 3764, - 1667, 3764); - // Next house east - addPolygonOnPlane(MULTICOMBAT, 0, - 1696, 3775, - 1708, 3775, - 1708, 3763, - 1696, 3763); - // Next house east - addPolygonOnPlane(MULTICOMBAT, 0, - 1713, 3775, - 1727, 3775, - 1727, 3763, - 1724, 3763, - 1724, 3752, - 1716, 3752, - 1716, 3763, - 1713, 3763); - // Arceuus rune shop house - addPolygonOnPlane(MULTICOMBAT, 0, - 1716, 3750, - 1728, 3750, - 1728, 3736, - 1716, 3736); - // Arceuus general store house - addPolygonOnPlane(MULTICOMBAT, 0, - 1717, 3732, - 1725, 3732, - 1725, 3715, - 1715, 3715, - 1715, 3725, - 1717, 3725); - // Arceuus pub - addPolygonOnPlane(MULTICOMBAT, 0, - 1683, 3732, - 1691, 3732, - 1691, 3725, - 1697, 3725, - 1697, 3730, - 1703, 3730, - 1703, 3712, - 1683, 3712); - // Arceuus staff store - addPolygonOnPlane(MULTICOMBAT, 0, - 1664, 3732, - 1676, 3732, - 1676, 3720, - 1664, 3720); - // Next house to the west - addPolygonOnPlane(MULTICOMBAT, 0, - 1647, 3738, - 1655, 3738, - 1655, 3726, - 1658, 3726, - 1658, 3714, - 1644, 3714, - 1644, 3726, - 1647, 3726); - // Next house to the north - addPolygonOnPlane(MULTICOMBAT, 0, - 1647, 3762, - 1657, 3762, - 1657, 3752, - 1655, 3752, - 1655, 3745, - 1647, 3745); - - // Arceuus house magic trees - addPolygonOnPlane(MULTICOMBAT, 0, - 1682, 3755, - 1692, 3755, - 1692, 3745, - 1690, 3745, - 1690, 3738, - 1682, 3738); - // West of that ^ - addPolygonOnPlane(MULTICOMBAT, 0, - 1667, 3756, - 1675, 3756, - 1675, 3740, - 1665, 3740, - 1665, 3746, - 1667, 3746); - - // This one goes through western piscarilius, northen hosidius - // and southwestern arceuus - addPolygonOnPlane(MULTICOMBAT, 0, - 1728, 3808, - 1792, 3808, - 1792, 3764, - 1856, 3764, - 1856, 3712, - 1792, 3712, - 1792, 3648, - 1664, 3648, - 1664, 3706, - 1665, 3706, - 1665, 3705, - 1668, 3705, - 1668, 3706, - 1671, 3706, - 1671, 3705, - 1675, 3705, - 1675, 3704, - 1683, 3704, - 1683, 3701, - 1684, 3701, - 1684, 3700, - 1686, 3700, - 1686, 3702, - 1687, 3702, - 1687, 3700, - 1688, 3700, - 1688, 3701, - 1690, 3701, - 1690, 3703, - 1689, 3703, - 1689, 3704, - 1690, 3704, - 1690, 3705, - 1704, 3705, - 1704, 3707, - 1706, 3707, - 1706, 3712, - 1711, 3712, - 1711, 3711, - 1710, 3711, - 1710, 3710, - 1712, 3710, - 1712, 3707, - 1728, 3707); - - // Kourend castle - addPolygonOnPlane(MULTICOMBAT, 0, - 1614, 3691, - 1619, 3691, - 1619, 3690, - 1620, 3690, - 1620, 3689, - 1653, 3689, - 1653, 3690, - 1654, 3690, - 1654, 3691, - 1657, 3691, - 1657, 3690, - 1658, 3690, - 1658, 3689, - 1659, 3689, - 1659, 3686, - 1658, 3686, - 1658, 3685, - 1657, 3685, - 1657, 3662, - 1658, 3662, - 1658, 3661, - 1659, 3661, - 1659, 3658, - 1658, 3658, - 1658, 3657, - 1657, 3657, - 1657, 3656, - 1654, 3656, - 1654, 3657, - 1653, 3657, - 1653, 3658, - 1620, 3658, - 1620, 3657, - 1619, 3657, - 1619, 3656, - 1614, 3656, - 1614, 3657, - 1613, 3657, - 1613, 3661, - 1612, 3661, - 1612, 3662, - 1611, 3662, - 1611, 3663, - 1600, 3663, - 1600, 3662, - 1599, 3662, - 1599, 3661, - 1594, 3661, - 1594, 3662, - 1593, 3662, - 1593, 3685, - 1594, 3685, - 1594, 3686, - 1599, 3686, - 1599, 3685, - 1600, 3685, - 1600, 3684, - 1611, 3684, - 1611, 3685, - 1612, 3685, - 1612, 3686, - 1613, 3686, - 1613, 3690, - 1614, 3690); - - // Western hosidius area, including woodcutting guild and western sand crabs - addPolygonOnPlane(MULTICOMBAT, 0, - 1650, 3648, - 1664, 3648, - 1664, 3520, - 1689, 3520, - 1689, 3496, - 1707, 3496, - 1707, 3485, - 1708, 3485, - 1708, 3484, - 1710, 3484, - 1710, 3483, - 1713, 3483, - 1713, 3482, - 1720, 3482, - 1720, 3481, - 1721, 3481, - 1721, 3480, - 1722, 3480, - 1722, 3479, - 1723, 3479, - 1723, 3478, - 1724, 3478, - 1724, 3477, - 1726, 3477, - 1726, 3476, - 1728, 3476, - 1728, 3472, - 1708, 3472, - 1708, 3456, - 1600, 3456, - 1600, 3584, - 1608, 3584, - 1608, 3616, - 1650, 3616); - - // Hosidius sand crabs - addPolygonOnPlane(MULTICOMBAT, 0, - 1740, 3478, - 1741, 3478, - 1741, 3479, - 1745, 3479, - 1745, 3480, - 1751, 3480, - 1751, 3479, - 1752, 3479, - 1752, 3478, - 1753, 3478, - 1753, 3477, - 1755, 3477, - 1755, 3476, - 1757, 3476, - 1757, 3475, - 1758, 3475, - 1758, 3474, - 1759, 3474, - 1759, 3473, - 1779, 3473, - 1779, 3474, - 1781, 3474, - 1781, 3475, - 1786, 3475, - 1786, 3476, - 1800, 3476, - 1800, 3475, - 1805, 3475, - 1805, 3474, - 1807, 3474, - 1807, 3473, - 1808, 3473, - 1808, 3472, - 1810, 3472, - 1810, 3471, - 1833, 3471, - 1833, 3470, - 1834, 3470, - 1834, 3469, - 1852, 3469, - 1852, 3449, - 1792, 3449, - 1792, 3424, - 1800, 3424, - 1800, 3449, - 1800, 3400, - 1728, 3400, - 1728, 3462, - 1729, 3462, - 1729, 3466, - 1730, 3466, - 1730, 3469, - 1731, 3469, - 1731, 3470, - 1732, 3470, - 1732, 3471, - 1733, 3471, - 1733, 3473, - 1734, 3473, - 1734, 3474, - 1736, 3474, - 1736, 3475, - 1737, 3475, - 1737, 3476, - 1738, 3476, - 1738, 3477, - 1740, 3477); - - // Apparently there is a 1x1 single zone on the sand crab island - addPolygonOnPlane(NOT_MULTICOMBAT, 0, - 1777, 3416, - 1777, 3417, - 1778, 3417, - 1778, 3416); - - // Eastern hosidius area - addPolygonOnPlane(MULTICOMBAT, 0, - 1834, 3584, - 1888, 3584, - 1888, 3528, - 1856, 3528, - 1856, 3520, - 1834, 3520, - 1834, 3522, - 1833, 3522, - 1833, 3535, - 1834, 3535, - 1834, 3538, - 1835, 3538, - 1835, 3539, - 1836, 3539, - 1836, 3540, - 1837, 3540, - 1837, 3541, - 1838, 3541, - 1838, 3542, - 1840, 3542, - 1840, 3543, - 1841, 3543, - 1841, 3545, - 1842, 3545, - 1842, 3546, - 1844, 3546, - 1844, 3547, - 1845, 3547, - 1845, 3548, - 1851, 3548, - 1851, 3551, - 1853, 3551, - 1853, 3563, - 1851, 3563, - 1851, 3566, - 1847, 3566, - 1847, 3567, - 1845, 3567, - 1845, 3568, - 1844, 3568, - 1844, 3569, - 1843, 3569, - 1843, 3571, - 1842, 3571, - 1842, 3573, - 1841, 3573, - 1841, 3574, - 1840, 3574, - 1840, 3575, - 1839, 3575, - 1839, 3576, - 1838, 3576, - 1838, 3577, - 1837, 3577, - 1837, 3578, - 1836, 3578, - 1836, 3579, - 1835, 3579, - 1835, 3581, - 1834, 3581); - - // Eastern hosidius area also has a 1x1 multi area - addPolygonOnPlane(MULTICOMBAT, 0, - 1849, 3563, - 1849, 3564, - 1850, 3564, - 1850, 3563); - - // Hosidius cows/chickens/pigs - addPolygonOnPlane(MULTICOMBAT, 0, - 1792, 3513, - 1802, 3513, - 1802, 3520, - 1810, 3520, - 1810, 3513, - 1816, 3513, - 1816, 3512, - 1836, 3512, - 1836, 3494, - 1796, 3494, - 1796, 3495, - 1792, 3495); - - // Hosidius southeast of tithe farm - addPolygonOnPlane(MULTICOMBAT, 0, - 1777, 3597, - 1794, 3597, - 1794, 3561, - 1777, 3561, - 1777, 3591, - 1779, 3591, - 1779, 3592, - 1777, 3592); - - // West of shayzien house - addPolygonOnPlane(MULTICOMBAT, 0, - 1408, 3584, - 1408, 3582, - 1486, 3582, - 1486, 3568, - 1528, 3568, - 1528, 3520, - 1408, 3520, - 1408, 3464, - 1380, 3464, - 1380, 3486, - 1377, 3486, - 1377, 3488, - 1373, 3488, - 1373, 3492, - 1364, 3492, - 1364, 3512, - 1358, 3512, - 1358, 3520, - 1356, 3520, - 1356, 3532, - 1358, 3532, - 1358, 3540, - 1359, 3540, - 1359, 3542, - 1360, 3542, - 1360, 3557, - 1356, 3557, - 1356, 3560, - 1351, 3560, - 1351, 3570, - 1354, 3570, - 1354, 3581, - 1346, 3581, - 1346, 3584); - - // South of chambers of xeric - addPolygonOnPlane(MULTICOMBAT, 0, - 1261, 3489, - 1259, 3489, - 1259, 3488, - 1255, 3488, - 1255, 3487, - 1243, 3487, - 1243, 3490, - 1234, 3490, - 1234, 3480, - 1192, 3480, - 1192, 3568, - 1209, 3568, - 1209, 3548, - 1215, 3548, - 1215, 3544, - 1217, 3544, - 1217, 3536, - 1235, 3536, - 1235, 3532, - 1249, 3532, - 1249, 3525, - 1248, 3525, - 1248, 3517, - 1254, 3517, - 1254, 3513, - 1274, 3513, - 1274, 3510, - 1296, 3510, - 1296, 3511, - 1300, 3511, - 1300, 3501, - 1287, 3501, - 1287, 3490, - 1280, 3490, - 1280, 3489, - 1264, 3489, - 1264, 3490, - 1261, 3490); - - // Lizardman shamans - addPolygonOnPlane(MULTICOMBAT, 0, - 1416, 3728, - 1456, 3728, - 1456, 3688, - 1416, 3688); - - // Other lizardman area at shayzien (west side) - addPolygonOnPlane(MULTICOMBAT, 0, - 1472, 3712, - 1510, 3712, - 1510, 3702, - 1509, 3702, - 1509, 3701, - 1506, 3701, - 1506, 3696, - 1500, 3696, - 1500, 3680, - 1472, 3680); - - // Other lizardman area at shayzien (east side) - addPolygonOnPlane(MULTICOMBAT, 0, - 1538, 3704, - 1560, 3704, - 1560, 3672, - 1538, 3672); - - // Lovakengj house - addPolygonOnPlane(MULTICOMBAT, 0, - 1600, 3712, - 1472, 3712, - 1472, 3840, - 1547, 3840, - 1547, 3816, - 1556, 3816, - 1556, 3809, - 1562, 3809, - 1562, 3800, - 1568, 3800, - 1568, 3793, - 1571, 3793, - 1571, 3816, - 1571, 3776, - 1600, 3776); - - // Shayzien house - addPolygonOnPlane(MULTICOMBAT, 0, - 1475, 3587, - 1475, 3641, - 1534, 3641, - 1534, 3587); - - // Shayzien house bank is non-multi - addPolygonOnPlane(NOT_MULTICOMBAT, 0, - 1495, 3622, - 1515, 3622, - 1515, 3612, - 1495, 3612); - - // Shayzien house general store - addPolygonOnPlane(MULTICOMBAT, 0, - 1539, 3640, - 1551, 3640, - 1551, 3621, - 1539, 3621); - - // Kourend woodland barbarian area - addPolygonOnPlane(MULTICOMBAT, 0, - 1572, 3442, - 1591, 3442, - 1591, 3424, - 1572, 3424); - - // Catacombs - addPolygonTo(MULTICOMBAT, - 1600, 9984, - 1600, 10067, - 1628, 10067, - 1628, 10070, - 1639, 10070, - 1639, 10112, - 1730, 10112, - 1730, 9984); - - // Zeah dungeon with sand crabs - addPolygonTo(MULTICOMBAT, - 1632, 9792, - 1632, 9856, - 1728, 9856, - 1728, 9792); - - // Waterbirth island near the doors where people use rune throwing axes - addPolygonTo(MULTICOMBAT, - 2536, 10136, - 2536, 10152, - 2552, 10152, - 2552, 10136); - - // Waterbirth island dungeon, on the path to dks - addPolygonTo(MULTICOMBAT, - 1792, 4352, - 1792, 4416, - 1984, 4416, - 1984, 4352); - - // Dagannoths in lighthouse - addPolygonTo(MULTICOMBAT, - 2496, 10048, - 2560, 10048, - 2560, 9984, - 2496, 9984); - - // Dagannoth kings (DKs) including slayer only dks - addPolygonTo(MULTICOMBAT, - 2944, 4352, - 2944, 4480, - 2880, 4480, - 2880, 4352); - - // White wolf mountain dungeon at ice queen - addPolygonTo(MULTICOMBAT, - 2856, 9928, - 2856, 9968, - 2880, 9968, - 2880, 9928); - - // Kharazi jungle dungeon (in dragon slayer 2 quest) - addPolygonTo(MULTICOMBAT, - 2816, 9296, - 2880, 9296, - 2880, 9216, - 2816, 9216); - - // Tzhaar, fight pits and inferno area - addPolygonTo(MULTICOMBAT, - 2368, 5184, - 2560, 5184, - 2560, 5056, - 2368, 5056); - - // Smoke devils - addPolygonTo(MULTICOMBAT, - 2432, 9408, - 2344, 9408, - 2344, 9472, - 2432, 9472); - - // Kraken - addPolygonTo(MULTICOMBAT, - 2270, 10045, - 2291, 10045, - 2291, 10022, - 2270, 10022); - - // Giant mole - addPolygonTo(MULTICOMBAT, - 1728, 5240, - 1792, 5240, - 1792, 5120, - 1728, 5120); - - // Godwars dungeon - addPolygonTo(MULTICOMBAT, - 2816, 5376, - 2944, 5376, - 2944, 5248, - 2816, 5248); - - // Desert treasure shadow diamond area - addPolygonTo(MULTICOMBAT, - 2752, 5064, - 2728, 5064, - 2728, 5088, - 2720, 5088, - 2720, 5096, - 2712, 5096, - 2712, 5112, - 2736, 5112, - 2736, 5120, - 2752, 5120); - - // Kalphite slayer area - addPolygonTo(MULTICOMBAT, - 3264, 9544, - 3344, 9544, - 3344, 9472, - 3264, 9472); - - // Normal kalphite area including kalphite queen - addPolygonTo(MULTICOMBAT, - 3456, 9536, - 3520, 9536, - 3520, 9472, - 3456, 9472); - - // Tarns lair - addPolygonTo(MULTICOMBAT, - 3136, 4664, - 3200, 4664, - 3200, 4544, - 3136, 4544); - - // Haunted mine boss area - addPolygonTo(MULTICOMBAT, - 2752, 4416, - 2752, 4480, - 2816, 4480, - 2816, 4416); - - // Entrance to dorgesh kaan - addPolygonTo(MULTICOMBAT, - 3328, 9600, - 3312, 9600, - 3312, 9640, - 3304, 9640, - 3304, 9664, - 3328, 9664); - - // Hammerspikes hangout in dwarven mines - addPolygonTo(MULTICOMBAT, - 2960, 9824, - 2976, 9824, - 2976, 9800, - 2960, 9800); - - // Fremennik isles dungeon - addPolygonTo(MULTICOMBAT, - 2432, 10304, - 2432, 10240, - 2368, 10240, - 2368, 10304); - - // Varrock sewers - addPolygonTo(MULTICOMBAT, - 3152, 9920, - 3288, 9920, - 3288, 9856, - 3152, 9856); - - // Stronghold of security 1st floor - addPolygonTo(MULTICOMBAT, - 1856, 5248, - 1920, 5248, - 1920, 5184, - 1856, 5184); - - // Corp cave - addPolygonTo(MULTICOMBAT, - 2960, 4400, - 3000, 4400, - 3000, 4368, - 2960, 4368); - - // ZMI altar area - addPolygonTo(MULTICOMBAT, - 3008, 5632, - 3072, 5632, - 3072, 5568, - 3008, 5568); - - // Dragon slayer 2 zeah underground puzzle - addPolygonTo(MULTICOMBAT, - 1472, 9984, - 1536, 9984, - 1536, 9920, - 1472, 9920); - - // Wildy revenant caves - addPolygonTo(MULTICOMBAT, - 3136, 10062, - 3136, 10240, - 3236, 10240, - 3236, 10229, - 3264, 10229, - 3264, 10048, - 3208, 10048, - 3208, 10062); - - // King black dragon (Kbd) - addPolygonTo(MULTICOMBAT, - 2240, 4672, - 2240, 4736, - 2304, 4736, - 2304, 4672); - - // Scorpia - addPolygonTo(MULTICOMBAT, - 3248, 10352, - 3248, 10328, - 3216, 10328, - 3216, 10352); - - // Inside mage bank - addPolygonTo(MULTICOMBAT, - 2496, 4672, - 2496, 4736, - 2560, 4736, - 2560, 4672); - - // Wildy godwars dungeon - addPolygonTo(MULTICOMBAT, - 3072, 10112, - 3008, 10112, - 3008, 10176, - 3048, 10176, - 3048, 10152, - 3056, 10152, - 3056, 10144, - 3064, 10144, - 3064, 10136, - 3072, 10136); - - // Enchanted valley - addPolygonTo(MULTICOMBAT, - 3008, 4480, - 3008, 4544, - 3072, 4544, - 3072, 4480); - - // Zulrah - addPolygonTo(MULTICOMBAT, - 2256, 3080, - 2280, 3080, - 2280, 3064, - 2256, 3064); - - // Abyssal sire and abyss - addPolygonTo(MULTICOMBAT, - 3008, 4736, - 2944, 4736, - 2944, 4864, - 3136, 4864, - 3136, 4736, - 3072, 4736, - 3072, 4800, - 3008, 4800); - } - - private static void defineDeadmanSafeZones() - { - // Varrock - addPolygonOnPlane(DEADMAN_SAFE_ZONES, 0, - 3182, 3382, - 3182, 3399, - 3174, 3399, - 3174, 3448, - 3198, 3448, - 3198, 3449, - 3197, 3449, - 3197, 3450, - 3196, 3450, - 3196, 3451, - 3195, 3451, - 3195, 3452, - 3194, 3452, - 3194, 3453, - 3193, 3453, - 3193, 3454, - 3192, 3454, - 3192, 3455, - 3191, 3455, - 3191, 3456, - 3190, 3456, - 3190, 3457, - 3185, 3457, - 3185, 3463, - 3186, 3463, - 3186, 3464, - 3187, 3464, - 3187, 3467, - 3167, 3467, - 3167, 3468, - 3163, 3468, - 3163, 3467, - 3142, 3467, - 3142, 3468, - 3141, 3468, - 3141, 3469, - 3140, 3469, - 3140, 3470, - 3139, 3470, - 3139, 3471, - 3138, 3471, - 3138, 3484, - 3139, 3484, - 3139, 3485, - 3140, 3485, - 3140, 3486, - 3141, 3486, - 3141, 3491, - 3140, 3491, - 3140, 3492, - 3139, 3492, - 3139, 3493, - 3138, 3493, - 3138, 3515, - 3139, 3515, - 3139, 3516, - 3140, 3516, - 3140, 3517, - 3141, 3517, - 3141, 3518, - 3160, 3518, - 3160, 3517, - 3161, 3517, - 3161, 3516, - 3162, 3516, - 3162, 3515, - 3167, 3515, - 3167, 3516, - 3168, 3516, - 3168, 3517, - 3169, 3517, - 3169, 3518, - 3191, 3518, - 3191, 3517, - 3192, 3517, - 3192, 3516, - 3193, 3516, - 3193, 3515, - 3194, 3515, - 3194, 3514, - 3195, 3514, - 3195, 3513, - 3196, 3513, - 3196, 3512, - 3197, 3512, - 3197, 3511, - 3198, 3511, - 3198, 3510, - 3199, 3510, - 3199, 3509, - 3200, 3509, - 3200, 3508, - 3230, 3508, - 3230, 3507, - 3231, 3507, - 3231, 3506, - 3232, 3506, - 3232, 3505, - 3233, 3505, - 3233, 3504, - 3234, 3504, - 3234, 3503, - 3235, 3503, - 3235, 3502, - 3252, 3502, - 3252, 3496, - 3253, 3496, - 3253, 3495, - 3254, 3495, - 3254, 3494, - 3255, 3494, - 3255, 3493, - 3263, 3493, - 3263, 3472, - 3264, 3472, - 3264, 3471, - 3265, 3471, - 3265, 3470, - 3266, 3470, - 3266, 3469, - 3267, 3469, - 3267, 3468, - 3268, 3468, - 3268, 3467, - 3269, 3467, - 3269, 3466, - 3270, 3466, - 3270, 3465, - 3271, 3465, - 3271, 3437, - 3274, 3437, - 3274, 3424, - 3277, 3424, - 3277, 3420, - 3274, 3420, - 3274, 3411, - 3275, 3411, - 3275, 3410, - 3276, 3410, - 3276, 3409, - 3277, 3409, - 3277, 3408, - 3288, 3408, - 3288, 3391, - 3289, 3391, - 3289, 3385, - 3290, 3385, - 3290, 3378, - 3289, 3378, - 3289, 3377, - 3288, 3377, - 3288, 3376, - 3265, 3376, - 3265, 3380, - 3253, 3380, - 3253, 3382, - 3245, 3382, - 3245, 3380, - 3242, 3380, - 3242, 3382, - 3239, 3382, - 3239, 3381, - 3209, 3381, - 3209, 3382, - 3282, 3382); - - // Lumbridge - addPolygonOnPlane(DEADMAN_SAFE_ZONES, 0, - 3201, 3257, - 3213, 3257, - 3213, 3264, - 3233, 3264, - 3233, 3257, - 3235, 3257, - 3235, 3241, - 3237, 3241, - 3237, 3237, - 3239, 3237, - 3239, 3231, - 3243, 3231, - 3243, 3220, - 3253, 3220, - 3253, 3217, - 3256, 3217, - 3256, 3212, - 3259, 3212, - 3259, 3190, - 3247, 3190, - 3247, 3191, - 3238, 3191, - 3238, 3195, - 3230, 3195, - 3230, 3201, - 3228, 3201, - 3228, 3202, - 3227, 3202, - 3227, 3205, - 3228, 3205, - 3228, 3207, - 3225, 3207, - 3225, 3206, - 3224, 3206, - 3224, 3205, - 3223, 3205, - 3223, 3204, - 3222, 3204, - 3222, 3203, - 3215, 3203, - 3215, 3202, - 3214, 3202, - 3214, 3201, - 3203, 3201, - 3203, 3202, - 3202, 3202, - 3202, 3203, - 3201, 3203, - 3201, 3217, - 3199, 3217, - 3199, 3220, - 3201, 3220); - - // Falador - addPolygonOnPlane(DEADMAN_SAFE_ZONES, 0, - 2986, 3395, - 2986, 3394, - 2987, 3394, - 2987, 3393, - 2996, 3393, - 2996, 3394, - 3002, 3394, - 3002, 3395, - 3009, 3395, - 3009, 3394, - 3010, 3394, - 3010, 3393, - 3011, 3393, - 3011, 3392, - 3021, 3392, - 3021, 3391, - 3022, 3391, - 3022, 3390, - 3041, 3390, - 3041, 3389, - 3047, 3389, - 3047, 3390, - 3062, 3390, - 3062, 3389, - 3063, 3389, - 3063, 3388, - 3064, 3388, - 3064, 3387, - 3065, 3387, - 3065, 3386, - 3066, 3386, - 3066, 3368, - 3065, 3368, - 3065, 3367, - 3064, 3367, - 3064, 3366, - 3063, 3366, - 3063, 3365, - 3062, 3365, - 3062, 3364, - 3061, 3364, - 3061, 3363, - 3060, 3363, - 3060, 3331, - 3061, 3331, - 3061, 3328, - 3058, 3328, - 3058, 3329, - 3025, 3329, - 3025, 3328, - 3024, 3328, - 3024, 3327, - 3016, 3327, - 3016, 3326, - 3015, 3326, - 3015, 3325, - 3014, 3325, - 3014, 3324, - 3013, 3324, - 3013, 3323, - 3008, 3323, - 3008, 3324, - 3006, 3324, - 3006, 3323, - 3002, 3323, - 3002, 3322, - 3001, 3322, - 3001, 3321, - 3000, 3321, - 3000, 3320, - 2999, 3320, - 2999, 3319, - 2998, 3319, - 2998, 3318, - 2997, 3318, - 2997, 3317, - 2996, 3317, - 2996, 3316, - 2992, 3316, - 2992, 3315, - 2991, 3315, - 2991, 3314, - 2990, 3314, - 2990, 3313, - 2989, 3313, - 2989, 3312, - 2988, 3312, - 2988, 3311, - 2987, 3311, - 2987, 3310, - 2986, 3310, - 2986, 3309, - 2966, 3309, - 2966, 3310, - 2956, 3310, - 2956, 3311, - 2941, 3311, - 2941, 3312, - 2940, 3312, - 2940, 3320, - 2936, 3320, - 2936, 3354, - 2937, 3354, - 2937, 3357, - 2936, 3357, - 2936, 3389, - 2937, 3389, - 2937, 3390, - 2938, 3390, - 2938, 3391, - 2939, 3391, - 2939, 3392, - 2940, 3392, - 2940, 3393, - 2943, 3393, - 2943, 3394, - 2944, 3394, - 2944, 3395, - 2950, 3395, - 2950, 3394, - 2956, 3394, - 2956, 3395); - - // Port phasmatys - addPolygonOnPlane(DEADMAN_SAFE_ZONES, 0, - 3650, 3456, - 3650, 3472, - 3651, 3472, - 3651, 3473, - 3652, 3473, - 3652, 3474, - 3653, 3474, - 3653, 3507, - 3654, 3507, - 3654, 3508, - 3668, 3508, - 3668, 3509, - 3669, 3509, - 3669, 3510, - 3670, 3510, - 3670, 3511, - 3671, 3511, - 3671, 3512, - 3672, 3512, - 3672, 3513, - 3673, 3513, - 3673, 3514, - 3674, 3514, - 3674, 3515, - 3675, 3515, - 3675, 3516, - 3676, 3516, - 3676, 3517, - 3687, 3517, - 3687, 3494, - 3690, 3494, - 3690, 3493, - 3696, 3493, - 3696, 3482, - 3699, 3482, - 3699, 3481, - 3712, 3481, - 3712, 3456); - - // Sophanem - addPolygonOnPlane(DEADMAN_SAFE_ZONES, 0, - 3274, 2752, - 3274, 2784, - 3277, 2784, - 3277, 2786, - 3274, 2786, - 3274, 2789, - 3272, 2789, - 3272, 2810, - 3322, 2810, - 3322, 2752); - - // Ardy - addPolygonOnPlane(DEADMAN_SAFE_ZONES, 0, - 2560, 3256, - 2560, 3264, - 2559, 3264, - 2559, 3328, - 2560, 3328, - 2560, 3339, - 2561, 3339, - 2561, 3340, - 2562, 3340, - 2562, 3341, - 2563, 3341, - 2563, 3342, - 2616, 3342, - 2616, 3341, - 2617, 3341, - 2617, 3340, - 2669, 3340, - 2669, 3339, - 2670, 3339, - 2670, 3338, - 2671, 3338, - 2671, 3337, - 2672, 3337, - 2672, 3336, - 2673, 3336, - 2673, 3335, - 2674, 3335, - 2674, 3334, - 2683, 3334, - 2683, 3333, - 2684, 3333, - 2684, 3332, - 2685, 3332, - 2685, 3331, - 2686, 3331, - 2686, 3330, - 2687, 3330, - 2687, 3329, - 2688, 3329, - 2688, 3264, - 2638, 3264, - 2638, 3263, - 2625, 3263, - 2625, 3264, - 2611, 3264, - 2611, 3257, - 2602, 3257, - 2602, 3264, - 2587, 3264, - 2587, 3263, - 2586, 3263, - 2586, 3262, - 2584, 3262, - 2584, 3261, - 2583, 3261, - 2583, 3260, - 2582, 3260, - 2582, 3259, - 2581, 3259, - 2581, 3258, - 2572, 3258, - 2572, 3260, - 2571, 3260, - 2571, 3261, - 2566, 3261, - 2566, 3260, - 2565, 3260, - 2565, 3259, - 2564, 3259, - 2564, 3256); - - // Yanille - addPolygonOnPlane(DEADMAN_SAFE_ZONES, 0, - 2613, 3103, - 2614, 3103, - 2614, 3102, - 2615, 3102, - 2615, 3101, - 2616, 3101, - 2616, 3100, - 2617, 3100, - 2617, 3099, - 2618, 3099, - 2618, 3098, - 2619, 3098, - 2619, 3097, - 2620, 3097, - 2620, 3075, - 2590, 3075, - 2590, 3074, - 2589, 3074, - 2589, 3073, - 2584, 3073, - 2584, 3074, - 2583, 3074, - 2583, 3075, - 2543, 3075, - 2543, 3076, - 2542, 3076, - 2542, 3077, - 2539, 3077, - 2539, 3107, - 2542, 3107, - 2542, 3108, - 2543, 3108, - 2543, 3109, - 2608, 3109, - 2608, 3108, - 2609, 3108, - 2609, 3107, - 2610, 3107, - 2610, 3106, - 2611, 3106, - 2611, 3105, - 2612, 3105, - 2612, 3104, - 2613, 3104); - - // Gnome stronghold - addPolygonOnPlane(DEADMAN_SAFE_ZONES, 0, - 2495, 3439, - 2494, 3439, - 2494, 3432, - 2495, 3432, - 2495, 3431, - 2496, 3431, - 2496, 3430, - 2497, 3430, - 2497, 3429, - 2498, 3429, - 2498, 3417, - 2497, 3417, - 2497, 3416, - 2496, 3416, - 2496, 3412, - 2495, 3412, - 2495, 3408, - 2494, 3408, - 2494, 3404, - 2495, 3404, - 2495, 3403, - 2496, 3403, - 2496, 3402, - 2497, 3402, - 2497, 3401, - 2498, 3401, - 2498, 3400, - 2499, 3400, - 2499, 3399, - 2500, 3399, - 2500, 3398, - 2501, 3398, - 2501, 3397, - 2502, 3397, - 2502, 3396, - 2506, 3396, - 2506, 3391, - 2502, 3391, - 2502, 3390, - 2492, 3390, - 2492, 3391, - 2489, 3391, - 2489, 3390, - 2488, 3390, - 2488, 3389, - 2485, 3389, - 2485, 3390, - 2482, 3390, - 2482, 3389, - 2476, 3389, - 2476, 3390, - 2471, 3390, - 2471, 3391, - 2468, 3391, - 2468, 3390, - 2467, 3390, - 2467, 3389, - 2466, 3389, - 2466, 3385, - 2465, 3385, - 2465, 3384, - 2458, 3384, - 2458, 3385, - 2457, 3385, - 2457, 3389, - 2456, 3389, - 2456, 3390, - 2455, 3390, - 2455, 3391, - 2450, 3391, - 2450, 3390, - 2446, 3390, - 2446, 3391, - 2443, 3391, - 2443, 3390, - 2442, 3390, - 2442, 3389, - 2440, 3389, - 2440, 3388, - 2434, 3388, - 2434, 3389, - 2433, 3389, - 2433, 3390, - 2432, 3390, - 2432, 3391, - 2428, 3391, - 2428, 3392, - 2427, 3392, - 2427, 3393, - 2420, 3393, - 2420, 3394, - 2419, 3394, - 2419, 3395, - 2418, 3395, - 2418, 3396, - 2417, 3396, - 2417, 3397, - 2416, 3397, - 2416, 3399, - 2415, 3399, - 2415, 3400, - 2414, 3400, - 2414, 3408, - 2413, 3408, - 2413, 3409, - 2412, 3409, - 2412, 3410, - 2411, 3410, - 2411, 3411, - 2410, 3411, - 2410, 3412, - 2387, 3412, - 2387, 3407, - 2383, 3407, - 2383, 3408, - 2380, 3408, - 2380, 3409, - 2379, 3409, - 2379, 3410, - 2377, 3410, - 2377, 3411, - 2376, 3411, - 2376, 3413, - 2375, 3413, - 2375, 3417, - 2374, 3417, - 2374, 3418, - 2373, 3418, - 2373, 3419, - 2372, 3419, - 2372, 3420, - 2371, 3420, - 2371, 3421, - 2370, 3421, - 2370, 3422, - 2369, 3422, - 2369, 3433, - 2370, 3433, - 2370, 3434, - 2371, 3434, - 2371, 3444, - 2372, 3444, - 2372, 3445, - 2373, 3445, - 2373, 3446, - 2374, 3446, - 2374, 3447, - 2375, 3447, - 2375, 3459, - 2376, 3459, - 2376, 3460, - 2377, 3460, - 2377, 3461, - 2378, 3461, - 2378, 3462, - 2379, 3462, - 2379, 3463, - 2380, 3463, - 2380, 3464, - 2381, 3464, - 2381, 3476, - 2379, 3476, - 2379, 3477, - 2378, 3477, - 2378, 3478, - 2377, 3478, - 2377, 3485, - 2376, 3485, - 2376, 3486, - 2375, 3486, - 2375, 3499, - 2376, 3499, - 2376, 3500, - 2377, 3500, - 2377, 3507, - 2378, 3507, - 2378, 3508, - 2379, 3508, - 2379, 3509, - 2380, 3509, - 2380, 3521, - 2382, 3521, - 2382, 3522, - 2384, 3522, - 2384, 3523, - 2393, 3523, - 2393, 3524, - 2399, 3524, - 2399, 3525, - 2404, 3525, - 2404, 3524, - 2405, 3524, - 2405, 3523, - 2407, 3523, - 2407, 3522, - 2415, 3522, - 2415, 3521, - 2425, 3521, - 2425, 3522, - 2427, 3522, - 2427, 3523, - 2430, 3523, - 2430, 3522, - 2431, 3522, - 2431, 3521, - 2432, 3521, - 2432, 3520, - 2448, 3520, - 2448, 3517, - 2454, 3517, - 2454, 3516, - 2455, 3516, - 2455, 3515, - 2456, 3515, - 2456, 3514, - 2457, 3514, - 2457, 3513, - 2460, 3513, - 2460, 3512, - 2461, 3512, - 2461, 3511, - 2465, 3511, - 2465, 3510, - 2468, 3510, - 2468, 3511, - 2472, 3511, - 2472, 3512, - 2473, 3512, - 2473, 3513, - 2475, 3513, - 2475, 3514, - 2476, 3514, - 2476, 3515, - 2477, 3515, - 2477, 3516, - 2478, 3516, - 2478, 3517, - 2483, 3517, - 2483, 3516, - 2487, 3516, - 2487, 3515, - 2488, 3515, - 2488, 3512, - 2487, 3512, - 2487, 3509, - 2488, 3509, - 2488, 3508, - 2489, 3508, - 2489, 3507, - 2491, 3507, - 2491, 3506, - 2492, 3506, - 2492, 3505, - 2493, 3505, - 2493, 3499, - 2492, 3499, - 2492, 3498, - 2491, 3498, - 2491, 3497, - 2490, 3497, - 2490, 3495, - 2491, 3495, - 2491, 3494, - 2492, 3494, - 2492, 3493, - 2493, 3493, - 2493, 3485, - 2490, 3485, - 2490, 3484, - 2489, 3484, - 2489, 3483, - 2488, 3483, - 2488, 3482, - 2487, 3482, - 2487, 3481, - 2486, 3481, - 2486, 3474, - 2488, 3474, - 2488, 3471, - 2489, 3471, - 2489, 3470, - 2490, 3470, - 2490, 3460, - 2491, 3460, - 2491, 3456, - 2496, 3456, - 2496, 3440, - 2495, 3440); - - // Rellekka - addPolygonOnPlane(DEADMAN_SAFE_ZONES, 0, - 2620, 3682, - 2624, 3682, - 2624, 3683, - 2625, 3683, - 2625, 3687, - 2629, 3687, - 2629, 3686, - 2630, 3686, - 2630, 3685, - 2632, 3685, - 2632, 3686, - 2636, 3686, - 2636, 3692, - 2645, 3692, - 2645, 3695, - 2647, 3695, - 2647, 3696, - 2649, 3696, - 2649, 3702, - 2650, 3702, - 2650, 3703, - 2651, 3703, - 2651, 3704, - 2652, 3704, - 2652, 3711, - 2653, 3711, - 2653, 3712, - 2691, 3712, - 2691, 3709, - 2692, 3709, - 2692, 3707, - 2693, 3707, - 2693, 3703, - 2692, 3703, - 2692, 3701, - 2691, 3701, - 2691, 3699, - 2690, 3699, - 2690, 3695, - 2691, 3695, - 2691, 3693, - 2692, 3693, - 2692, 3691, - 2693, 3691, - 2693, 3685, - 2692, 3685, - 2692, 3683, - 2691, 3683, - 2691, 3681, - 2690, 3681, - 2690, 3680, - 2689, 3680, - 2689, 3672, - 2690, 3672, - 2690, 3671, - 2691, 3671, - 2691, 3666, - 2690, 3666, - 2690, 3664, - 2689, 3664, - 2689, 3660, - 2690, 3660, - 2690, 3658, - 2691, 3658, - 2691, 3656, - 2692, 3656, - 2692, 3654, - 2693, 3654, - 2693, 3651, - 2692, 3651, - 2692, 3649, - 2690, 3649, - 2690, 3648, - 2688, 3648, - 2688, 3647, - 2686, 3647, - 2686, 3646, - 2673, 3646, - 2673, 3645, - 2636, 3645, - 2636, 3647, - 2627, 3647, - 2627, 3648, - 2625, 3648, - 2625, 3649, - 2624, 3649, - 2624, 3650, - 2622, 3650, - 2622, 3651, - 2620, 3651, - 2620, 3652, - 2618, 3652, - 2618, 3653, - 2616, 3653, - 2616, 3654, - 2609, 3654, - 2609, 3655, - 2607, 3655, - 2607, 3656, - 2603, 3656, - 2603, 3657, - 2602, 3657, - 2602, 3658, - 2601, 3658, - 2601, 3663, - 2602, 3663, - 2602, 3664, - 2603, 3664, - 2603, 3665, - 2604, 3665, - 2604, 3666, - 2605, 3666, - 2605, 3667, - 2606, 3667, - 2606, 3671, - 2609, 3671, - 2609, 3672, - 2610, 3672, - 2610, 3673, - 2611, 3673, - 2611, 3675, - 2612, 3675, - 2612, 3676, - 2614, 3676, - 2614, 3677, - 2616, 3677, - 2616, 3679, - 2618, 3679, - 2618, 3681, - 2620, 3681); - - // Jatizo - addPolygonOnPlane(DEADMAN_SAFE_ZONES, 0, - 2407, 3797, - 2407, 3793, - 2399, 3793, - 2399, 3792, - 2391, 3792, - 2391, 3791, - 2386, 3791, - 2386, 3796, - 2388, 3796, - 2388, 3802, - 2386, 3802, - 2386, 3807, - 2388, 3807, - 2388, 3809, - 2402, 3809, - 2402, 3819, - 2406, 3819, - 2406, 3824, - 2408, 3824, - 2408, 3826, - 2413, 3826, - 2413, 3824, - 2419, 3824, - 2419, 3826, - 2424, 3826, - 2424, 3821, - 2423, 3821, - 2423, 3798, - 2422, 3798, - 2422, 3797); - - // Neitiznot - addPolygonOnPlane(DEADMAN_SAFE_ZONES, 0, - 2329, 3812, - 2333, 3812, - 2333, 3813, - 2334, 3813, - 2334, 3814, - 2335, 3814, - 2335, 3815, - 2338, 3815, - 2338, 3816, - 2339, 3816, - 2339, 3817, - 2368, 3817, - 2368, 3776, - 2352, 3776, - 2352, 3796, - 2344, 3796, - 2344, 3795, - 2331, 3795, - 2331, 3797, - 2330, 3797, - 2330, 3798, - 2329, 3798); - - // Pest control - addPolygonOnPlane(DEADMAN_SAFE_ZONES, 0, - 2624, 2688, - 2688, 2688, - 2688, 2624, - 2624, 2624); - - // Tutorial island - addPolygonOnPlane(DEADMAN_SAFE_ZONES, 0, - 3052, 3135, - 3156, 3135, - 3156, 3057, - 3052, 3057); - - // Camelot bank - addPolygonOnPlane(DEADMAN_SAFE_ZONES, 0, - 2724, 3487, - 2724, 3490, - 2721, 3490, - 2721, 3494, - 2719, 3494, - 2719, 3497, - 2721, 3497, - 2721, 3498, - 2731, 3498, - 2731, 3490, - 2728, 3490, - 2728, 3487); - - // Catherby bank - addPolygonOnPlane(DEADMAN_SAFE_ZONES, 0, - 2806, 3438, - 2806, 3446, - 2813, 3446, - 2813, 3438); - - // Kourend castle - addPolygonOnPlane(DEADMAN_SAFE_ZONES, 0, - 1627, 3658, - 1620, 3658, - 1620, 3657, - 1619, 3657, - 1619, 3656, - 1614, 3656, - 1614, 3657, - 1613, 3657, - 1613, 3661, - 1612, 3661, - 1612, 3662, - 1611, 3662, - 1611, 3663, - 1600, 3663, - 1600, 3662, - 1599, 3662, - 1599, 3661, - 1594, 3661, - 1594, 3662, - 1593, 3662, - 1593, 3685, - 1594, 3685, - 1594, 3686, - 1599, 3686, - 1599, 3685, - 1600, 3685, - 1600, 3684, - 1611, 3684, - 1611, 3685, - 1612, 3685, - 1612, 3686, - 1613, 3686, - 1613, 3690, - 1614, 3690, - 1614, 3691, - 1619, 3691, - 1619, 3690, - 1620, 3690, - 1620, 3689, - 1630, 3689, - 1630, 3686, - 1620, 3686, - 1620, 3685, - 1619, 3685, - 1619, 3683, - 1620, 3683, - 1620, 3682, - 1621, 3682, - 1621, 3681, - 1622, 3681, - 1622, 3680, - 1623, 3680, - 1623, 3679, - 1624, 3679, - 1624, 3668, - 1623, 3668, - 1623, 3667, - 1622, 3667, - 1622, 3666, - 1621, 3666, - 1621, 3665, - 1620, 3665, - 1620, 3664, - 1619, 3664, - 1619, 3662, - 1620, 3662, - 1620, 3661, - 1627, 3661); - } - - private static void definePvpSafeZones() - { - // Grand exchange - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 3159, 3473, - 3159, 3474, - 3157, 3474, - 3157, 3475, - 3155, 3475, - 3155, 3476, - 3153, 3476, - 3153, 3477, - 3152, 3477, - 3152, 3478, - 3151, 3478, - 3151, 3480, - 3150, 3480, - 3150, 3482, - 3149, 3482, - 3149, 3484, - 3148, 3484, - 3148, 3496, - 3149, 3496, - 3149, 3498, - 3150, 3498, - 3150, 3500, - 3151, 3500, - 3151, 3502, - 3152, 3502, - 3152, 3503, - 3153, 3503, - 3153, 3504, - 3155, 3504, - 3155, 3505, - 3157, 3505, - 3157, 3506, - 3159, 3506, - 3159, 3507, - 3171, 3507, - 3171, 3506, - 3173, 3506, - 3173, 3505, - 3175, 3505, - 3175, 3504, - 3177, 3504, - 3177, 3503, - 3178, 3503, - 3178, 3502, - 3179, 3502, - 3179, 3500, - 3180, 3500, - 3180, 3498, - 3181, 3498, - 3181, 3496, - 3182, 3496, - 3182, 3484, - 3181, 3484, - 3181, 3482, - 3180, 3482, - 3180, 3480, - 3179, 3480, - 3179, 3478, - 3178, 3478, - 3178, 3477, - 3177, 3477, - 3177, 3476, - 3175, 3476, - 3175, 3475, - 3173, 3475, - 3173, 3474, - 3171, 3474, - 3171, 3473); - - // Edgeville - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 3091, 3488, - 3091, 3493, - 3090, 3493, - 3090, 3498, - 3091, 3498, - 3091, 3500, - 3099, 3500, - 3099, 3488); - - // Fally west bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2943, 3368, - 2943, 3374, - 2948, 3374, - 2948, 3370, - 2950, 3370, - 2950, 3366, - 2949, 3366, - 2949, 3359, - 2945, 3359, - 2945, 3362, - 2946, 3362, - 2946, 3366, - 2945, 3366, - 2945, 3368); - - // Fally east bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 3009, 3353, - 3009, 3359, - 3019, 3359, - 3019, 3357, - 3022, 3357, - 3022, 3353); - - // Fally castle - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2964, 3354, - 2966, 3354, - 2966, 3352, - 2967, 3352, - 2967, 3349, - 2976, 3349, - 2976, 3348, - 2977, 3348, - 2977, 3347, - 2981, 3347, - 2981, 3343, - 2982, 3343, - 2982, 3339, - 2981, 3339, - 2981, 3337, - 2967, 3337, - 2967, 3330, - 2963, 3330, - 2963, 3331, - 2962, 3331, - 2962, 3332, - 2961, 3332, - 2961, 3334, - 2964, 3334, - 2964, 3335, - 2965, 3335, - 2965, 3343, - 2964, 3343, - 2964, 3344, - 2961, 3344, - 2961, 3350, - 2963, 3350, - 2963, 3352, - 2964, 3352); - - // Varrock east bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 3250, 3425, - 3258, 3425, - 3258, 3416, - 3250, 3416); - - // Varrock west bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 3180, 3433, - 3180, 3448, - 3191, 3448, - 3191, 3433); - - // Port phasmatys - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 3686, 3472, - 3700, 3472, - 3700, 3461, - 3686, 3461); - - // Yanille bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2609, 3088, - 2609, 3098, - 2617, 3098, - 2617, 3088); - - // Ardy east bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2649, 3280, - 2649, 3288, - 2659, 3288, - 2659, 3280); - - // Ardy west bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2612, 3330, - 2612, 3336, - 2615, 3336, - 2615, 3335, - 2619, 3335, - 2619, 3336, - 2622, 3336, - 2622, 3330); - - // Fishing guild bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2593, 3413, - 2588, 3413, - 2588, 3418, - 2583, 3418, - 2583, 3423, - 2590, 3423, - 2590, 3420, - 2593, 3420); - - // Gnome stronghold bank near slayer cave (2nd floor) - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 1, - 2444, 3431, - 2444, 3435, - 2448, 3435, - 2448, 3431, - 2447, 3431, - 2447, 3428, - 2449, 3428, - 2449, 3422, - 2447, 3422, - 2447, 3419, - 2448, 3419, - 2448, 3415, - 2444, 3415, - 2444, 3419, - 2445, 3419, - 2445, 3422, - 2443, 3422, - 2443, 3428, - 2445, 3428, - 2445, 3431); - - // Gnome stronghold bank in grand tree - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 1, - 2456, 3488, - 2452, 3488, - 2452, 3486, - 2450, 3486, - 2450, 3483, - 2451, 3483, - 2451, 3478, - 2448, 3478, - 2448, 3483, - 2449, 3483, - 2449, 3486, - 2447, 3486, - 2447, 3488, - 2443, 3488, - 2443, 3487, - 2438, 3487, - 2438, 3490, - 2443, 3490, - 2443, 3489, - 2447, 3489, - 2447, 3491, - 2449, 3491, - 2449, 3494, - 2448, 3494, - 2448, 3496, - 2451, 3496, - 2451, 3494, - 2450, 3494, - 2450, 3491, - 2452, 3491, - 2452, 3489, - 2456, 3489); - - // Al kharid bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 3265, 3161, - 3265, 3174, - 3273, 3174, - 3273, 3161); - - // Shantay pass bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 3308, 3119, - 3308, 3125, - 3310, 3125, - 3310, 3119); - - // Nardah bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 3431, 2891, - 3431, 2889, - 3427, 2889, - 3427, 2887, - 3424, 2887, - 3424, 2895, - 3431, 2895, - 3431, 2893, - 3432, 2893, - 3432, 2891); - - // Sophanem bank - addPolygonTo(PVP_WORLD_SAFE_ZONES, - 2807, 5158, - 2792, 5158, - 2792, 5175, - 2807, 5175); - - // Canifis bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 3509, 3474, - 3509, 3478, - 3508, 3478, - 3508, 3483, - 3509, 3483, - 3509, 3484, - 3517, 3484, - 3517, 3477, - 3516, 3477, - 3516, 3476, - 3513, 3476, - 3513, 3474); - - // Lumbridge castle outside - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 3216, 3209, - 3216, 3210, - 3217, 3210, - 3217, 3228, - 3216, 3228, - 3216, 3229, - 3227, 3229, - 3227, 3221, - 3230, 3221, - 3230, 3217, - 3227, 3217, - 3227, 3209); - - // Lumbridge bank upstairs - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 2, - 3211, 3223, - 3211, 3215, - 3207, 3215, - 3207, 3223); - - // Draynor bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 3098, 3240, - 3088, 3240, - 3088, 3247, - 3098, 3247); - - // Pest control bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2665, 2656, - 2670, 2656, - 2670, 2651, - 2665, 2651); - - // Shilo village bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2843, 2957, - 2846, 2957, - 2846, 2956, - 2849, 2956, - 2849, 2957, - 2850, 2957, - 2850, 2958, - 2855, 2958, - 2855, 2957, - 2856, 2957, - 2856, 2956, - 2858, 2956, - 2858, 2957, - 2862, 2957, - 2862, 2952, - 2858, 2952, - 2858, 2953, - 2856, 2953, - 2856, 2952, - 2855, 2952, - 2855, 2951, - 2850, 2951, - 2850, 2952, - 2849, 2952, - 2849, 2953, - 2847, 2953, - 2847, 2952, - 2843, 2952); - - // Legends guild bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 2, - 2731, 3374, - 2731, 3383, - 2734, 3383, - 2734, 3374); - - // Legends guild middle floor - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 1, - 2724, 3374, - 2724, 3383, - 2734, 3383, - 2734, 3382, - 2736, 3382, - 2736, 3375, - 2734, 3375, - 2734, 3374); - - // Warriors guild bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2843, 3537, - 2843, 3540, - 2841, 3540, - 2841, 3546, - 2849, 3546, - 2849, 3537, - 2847, 3537, - 2847, 3536, - 2846, 3536, - 2846, 3537); - - // Camelot bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2724, 3487, - 2724, 3490, - 2721, 3490, - 2721, 3494, - 2719, 3494, - 2719, 3497, - 2721, 3497, - 2721, 3498, - 2731, 3498, - 2731, 3490, - 2728, 3490, - 2728, 3487); - - // Camelot respawn point - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2761, 3483, - 2761, 3476, - 2755, 3476, - 2755, 3483); - - // Catherby bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2806, 3438, - 2806, 3446, - 2813, 3446, - 2813, 3438); - - // Barbarian outpost bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2536, 3572, - 2536, 3575, - 2538, 3575, - 2538, 3572); - - // Piscatoris bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2327, 3686, - 2327, 3694, - 2333, 3694, - 2333, 3686); - - // Lletya bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2350, 3161, - 2350, 3165, - 2351, 3165, - 2351, 3167, - 2357, 3167, - 2357, 3165, - 2356, 3165, - 2356, 3164, - 2355, 3164, - 2355, 3161); - - // Castle wars bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2446, 3087, - 2445, 3087, - 2445, 3085, - 2447, 3085, - 2447, 3081, - 2443, 3081, - 2443, 3082, - 2439, 3082, - 2439, 3081, - 2435, 3081, - 2435, 3099, - 2439, 3099, - 2439, 3098, - 2443, 3098, - 2443, 3099, - 2447, 3099, - 2447, 3095, - 2445, 3095, - 2445, 3093, - 2446, 3093); - - // Duel arena bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 3380, 3267, - 3380, 3273, - 3381, 3273, - 3381, 3274, - 3385, 3274, - 3385, 3267); - - // Clan wars bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 3375, 3165, - 3361, 3165, - 3361, 3173, - 3375, 3173); - - // Lumbridge cellar bank - addPolygonTo(PVP_WORLD_SAFE_ZONES, - 3218, 9622, - 3218, 9624, - 3220, 9624, - 3220, 9622); - - // Dorgesh kaan bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2709, 5348, - 2707, 5348, - 2707, 5345, - 2701, 5345, - 2701, 5347, - 2697, 5347, - 2697, 5353, - 2701, 5353, - 2701, 5355, - 2707, 5355, - 2707, 5350, - 2709, 5350); - - // Keldagrim bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2842, 10204, - 2834, 10204, - 2834, 10216, - 2842, 10216); - - // Tzhaar bank - addPolygonTo(PVP_WORLD_SAFE_ZONES, - 2438, 5176, - 2438, 5180, - 2441, 5180, - 2441, 5182, - 2449, 5182, - 2449, 5181, - 2450, 5181, - 2450, 5180, - 2452, 5180, - 2452, 5175, - 2441, 5175, - 2441, 5176); - - // Inferno bank - addPolygonTo(PVP_WORLD_SAFE_ZONES, - 2542, 5135, - 2542, 5139, - 2539, 5139, - 2539, 5140, - 2538, 5140, - 2538, 5141, - 2537, 5141, - 2537, 5144, - 2541, 5144, - 2541, 5145, - 2543, 5145, - 2543, 5144, - 2544, 5144, - 2544, 5142, - 2545, 5142, - 2545, 5135); - - // Port khazard bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2661, 3160, - 2661, 3163, - 2666, 3163, - 2666, 3160); - - // Corsair cove bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2569, 2863, - 2569, 2868, - 2572, 2868, - 2572, 2863); - - // Burgh de rott bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 3495, 3210, - 3495, 3214, - 3501, 3214, - 3501, 3210); - - // Edgeville respawn point - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 3092, 3468, - 3092, 3474, - 3098, 3474, - 3098, 3468); - - // Mage bank - addPolygonTo(PVP_WORLD_SAFE_ZONES, - 2529, 4711, - 2529, 4724, - 2548, 4724, - 2548, 4711); - - // Lunar bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2097, 3917, - 2097, 3922, - 2105, 3922, - 2105, 3917); - - // Jatizo bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2414, 3801, - 2414, 3804, - 2420, 3804, - 2420, 3801); - - // Neitiznot bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2334, 3805, - 2334, 3809, - 2340, 3809, - 2340, 3805); - - // Hosidius bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 1671, 3558, - 1671, 3577, - 1682, 3577, - 1682, 3558); - - // Woodcutting guild bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 1589, 3475, - 1589, 3481, - 1594, 3481, - 1594, 3475); - - // Lands end bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 1508, 3415, - 1508, 3424, - 1514, 3424, - 1514, 3415); - - // Chambers of xeric bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 1252, 3570, - 1252, 3574, - 1257, 3574, - 1257, 3570); - - // Arceuus bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 1621, 3736, - 1621, 3754, - 1627, 3754, - 1627, 3751, - 1633, 3751, - 1633, 3754, - 1639, 3754, - 1639, 3736); - - // Piscarilius bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 1794, 3784, - 1794, 3794, - 1812, 3794, - 1812, 3784); - - // Lovakengj bank southeast - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 1518, 3735, - 1518, 3744, - 1535, 3744, - 1535, 3735); - - // Lovakenj bank west - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 1433, 3820, - 1433, 3837, - 1442, 3837, - 1442, 3820); - - // Lovakenj sulphur mine bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 1452, 3855, - 1452, 3860, - 1455, 3860, - 1455, 3855); - - // Blast mine bank southeast - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 1500, 3856, - 1500, 3858, - 1503, 3858, - 1503, 3856); - - // Wintertodt bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 1638, 3942, - 1638, 3947, - 1642, 3947, - 1642, 3942); - - // Shayzien bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 1495, 3612, - 1495, 3622, - 1515, 3622, - 1515, 3612); - - // Hosidius grape farm bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 1804, 3571, - 1804, 3572, - 1808, 3572, - 1808, 3571); - - // Hosidius cooking bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 1652, 3605, - 1652, 3615, - 1661, 3615, - 1661, 3605); - - // Ecteria bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 2618, 3893, - 2618, 3897, - 2622, 3897, - 2622, 3893); - - // Mining guild expanded area - addPolygonTo(PVP_WORLD_SAFE_ZONES, - 3018, 9733, - 3021, 9733, - 3021, 9729, - 3022, 9729, - 3022, 9728, - 3023, 9728, - 3023, 9727, - 3025, 9727, - 3025, 9726, - 3026, 9726, - 3026, 9725, - 3030, 9725, - 3030, 9726, - 3032, 9726, - 3032, 9727, - 3035, 9727, - 3035, 9726, - 3038, 9726, - 3038, 9727, - 3041, 9727, - 3041, 9728, - 3042, 9728, - 3042, 9730, - 3045, 9730, - 3045, 9727, - 3047, 9727, - 3047, 9726, - 3048, 9726, - 3048, 9724, - 3052, 9724, - 3052, 9725, - 3053, 9725, - 3053, 9726, - 3055, 9726, - 3055, 9725, - 3056, 9725, - 3056, 9723, - 3057, 9723, - 3057, 9720, - 3056, 9720, - 3056, 9719, - 3054, 9719, - 3054, 9718, - 3052, 9718, - 3052, 9717, - 3050, 9717, - 3050, 9718, - 3045, 9718, - 3045, 9716, - 3044, 9716, - 3044, 9715, - 3041, 9715, - 3041, 9714, - 3039, 9714, - 3039, 9713, - 3037, 9713, - 3037, 9714, - 3036, 9714, - 3036, 9715, - 3034, 9715, - 3034, 9716, - 3029, 9716, - 3029, 9715, - 3028, 9715, - 3028, 9714, - 3026, 9714, - 3026, 9709, - 3027, 9709, - 3027, 9708, - 3028, 9708, - 3028, 9705, - 3029, 9705, - 3029, 9701, - 3028, 9701, - 3028, 9700, - 3027, 9700, - 3027, 9699, - 3023, 9699, - 3023, 9700, - 3019, 9700, - 3019, 9701, - 3018, 9701, - 3018, 9705, - 3019, 9705, - 3019, 9707, - 3020, 9707, - 3020, 9708, - 3021, 9708, - 3021, 9709, - 3022, 9709, - 3022, 9713, - 3021, 9713, - 3021, 9714, - 3019, 9714, - 3019, 9715, - 3018, 9715, - 3018, 9717, - 3015, 9717, - 3015, 9716, - 3013, 9716, - 3013, 9717, - 3012, 9717, - 3012, 9720, - 3013, 9720, - 3013, 9721, - 3015, 9721, - 3015, 9723, - 3016, 9723, - 3016, 9727, - 3017, 9727, - 3017, 9730, - 3018, 9730); - - // Motherlode mine bank - addPolygonTo(PVP_WORLD_SAFE_ZONES, - 3760, 5671, - 3760, 5668, - 3761, 5668, - 3761, 5665, - 3760, 5665, - 3760, 5663, - 3758, 5663, - 3758, 5671); - - // Mos le harmles bank - addPolygonOnPlane(PVP_WORLD_SAFE_ZONES, 0, - 3679, 2980, - 3679, 2985, - 3681, 2985, - 3681, 2984, - 3682, 2984, - 3682, 2985, - 3684, 2985, - 3684, 2980, - 3682, 2980, - 3682, 2981, - 3681, 2981, - 3681, 2980); - - // Zanaris bank - addPolygonTo(PVP_WORLD_SAFE_ZONES, - 2388, 4454, - 2380, 4454, - 2380, 4463, - 2388, 4463); - - // Wodcuting guild bank underground - addPolygonTo(PVP_WORLD_SAFE_ZONES, - 1550, 9872, - 1550, 9874, - 1553, 9874, - 1553, 9872); - } - - private static void defineWilderness() - { - // Above ground - addPolygonTo(ROUGH_WILDERNESS, - 2944, 3523, - 3392, 3523, - 3392, 3971, - 2944, 3971); - - // Underground - addPolygonTo(ROUGH_WILDERNESS, - 2944, 9918, - 2944, 10360, - 3264, 10360, - 3264, 9918); - } - - private static void defineWildernessLevelLines() - { - int wildyLeftX = 2944; - int wildyRightX = 3392; - int wildyBottomY = 3525; - - // define wilderness level lines at ground level - int accumulatedY = 0; - for (int level = 1; level <= 56; level++) - { - int levelTiles = level == 1 ? 3 : 8; - // only draw every 2 levels, otherwise lines on two adjacent levels will collide - // and it will not show up - if (level % 2 != 0) - { - addPolygonTo(WILDERNESS_LEVEL_LINES, - wildyLeftX, wildyBottomY + accumulatedY, - wildyRightX, wildyBottomY + accumulatedY, - wildyRightX, wildyBottomY + accumulatedY + levelTiles, - wildyLeftX, wildyBottomY + accumulatedY + levelTiles); - } - accumulatedY += levelTiles; - } - } - - - private static void addPolygonTo(List[] shapes, int... coords) - { - Polygon poly = new Polygon(); - for (int i = 0; i < coords.length; i += 2) - { - poly.addPoint(coords[i], coords[i + 1]); - } - for (List shape : shapes) - { - shape.add(poly); - } - } - - private static void addPolygonOnPlane(List[] shapes, int plane, int... coords) - { - Polygon poly = new Polygon(); - for (int i = 0; i < coords.length; i += 2) - { - poly.addPoint(coords[i], coords[i + 1]); - } - shapes[plane].add(poly); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/MultiIndicatorsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/MultiIndicatorsConfig.java deleted file mode 100644 index 6b695de731..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/MultiIndicatorsConfig.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * Copyright (c) 2019, Enza-Denino - * 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.multiindicators; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("multiindicators") -public interface MultiIndicatorsConfig extends Config -{ - @ConfigItem( - keyName = "multicombatZoneVisibility", - name = "Multicombat zones", - description = "Determine where multicombat zones should be shown", - position = 1 - ) - default ZoneVisibility multicombatZoneVisibility() - { - return ZoneVisibility.SHOW_IN_PVP; - } - - @ConfigItem( - keyName = "pvpSafeZones", - name = "PvP safe zones", - description = "Show safe zones in PvP worlds", - position = 2 - ) - default boolean showPvpSafeZones() - { - return true; - } - - @ConfigItem( - keyName = "deadmanSafeZones", - name = "Deadman safe zones", - description = "Show safe zones in Deadman worlds", - position = 3 - ) - default boolean showDeadmanSafeZones() - { - return true; - } - - @ConfigItem( - keyName = "wildernessLevelLines", - name = "Wilderness level lines", - description = "Show wilderness level lines", - position = 4 - ) - default boolean showWildernessLevelLines() - { - return false; - } - - @ConfigItem( - keyName = "showMinimapLines", - name = "Show on minimap", - description = "Show multicombat and safe zones on the minimap", - position = 5 - ) - default boolean showMinimapLines() - { - return true; - } - - @ConfigItem( - keyName = "multicombatColor", - name = "Multicombat zone color", - description = "Choose color to use for marking multicombat zones", - position = 6 - ) - default Color multicombatColor() - { - return Color.MAGENTA; - } - - @ConfigItem( - keyName = "safeZoneColor", - name = "Safe zone color", - description = "Choose color to use for marking safe zones in PvP/Deadman", - position = 7 - ) - default Color safeZoneColor() - { - return Color.GREEN; - } - - @ConfigItem( - keyName = "wildernessLevelLinesColor", - name = "Wilderness level lines color", - description = "Choose color to use for marking wilderness level lines", - position = 8 - ) - default Color wildernessLevelLinesColor() - { - return Color.WHITE; - } - - @ConfigItem( - keyName = "thinnerLines", - name = "Thin lines", - description = "Render multi lines, safe zone lines, and wildy level lines as 1 pixel wide instead of 2", - position = 9 - ) - default boolean thinnerLines() - { - return false; - } - -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/MultiIndicatorsMinimapOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/MultiIndicatorsMinimapOverlay.java deleted file mode 100644 index f503b1126d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/MultiIndicatorsMinimapOverlay.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * Copyright (c) 2019, Enza-Denino - * 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.multiindicators; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.geom.GeneralPath; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.geometry.Geometry; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -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; - -@Singleton -public class MultiIndicatorsMinimapOverlay extends Overlay -{ - private final static int MAX_LOCAL_DRAW_LENGTH = 20 * Perspective.LOCAL_TILE_SIZE; - - @Inject - private Client client; - - @Inject - private MultiIndicatorsPlugin plugin; - - @Inject - public MultiIndicatorsMinimapOverlay() - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ALWAYS_ON_TOP); - setPriority(OverlayPriority.LOW); - } - - private Color getTransparentColorVersion(Color c) - { - return new Color(c.getRed(), c.getGreen(), c.getBlue(), 192); - } - - private void renderPath(Graphics2D graphics, GeneralPath path, Color color) - { - if (client.getLocalPlayer() == null) - { - return; - } - - final LocalPoint playerLp = client.getLocalPlayer().getLocalLocation(); - final Rectangle viewArea = new Rectangle( - playerLp.getX() - MAX_LOCAL_DRAW_LENGTH, - playerLp.getY() - MAX_LOCAL_DRAW_LENGTH, - MAX_LOCAL_DRAW_LENGTH * 2, - MAX_LOCAL_DRAW_LENGTH * 2); - - graphics.setColor(color); - - path = Geometry.clipPath(path, viewArea); - path = Geometry.filterPath(path, (p1, p2) -> - Perspective.localToMinimap(client, new LocalPoint((int) p1[0], (int) p1[1])) != null && - Perspective.localToMinimap(client, new LocalPoint((int) p2[0], (int) p2[1])) != null); - path = Geometry.transformPath(path, coords -> - { - final Point point = Perspective.localToMinimap(client, new LocalPoint((int) coords[0], (int) coords[1])); - if (point != null) - { - coords[0] = point.getX(); - coords[1] = point.getY(); - } - }); - - graphics.draw(path); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isShowMinimapLines()) - { - return null; - } - - final Widget widget; - if (client.getWidget(WidgetInfo.FIXED_VIEWPORT_MINIMAP_DRAW_AREA) != null) - { - widget = client.getWidget(WidgetInfo.FIXED_VIEWPORT_MINIMAP_DRAW_AREA); - } - else - { - widget = client.getWidget(WidgetInfo.RESIZABLE_MINIMAP_STONES_DRAW_AREA); - } - - if (widget == null) - { - return null; - } - - final Rectangle minimapClip = widget.getBounds(); - - graphics.setClip(minimapClip); - - final GeneralPath multicombatPath = plugin.getMulticombatPathToDisplay()[client.getPlane()]; - final GeneralPath pvpPath = plugin.getPvpPathToDisplay()[client.getPlane()]; - final GeneralPath wildernessLevelLinesPath = plugin.getWildernessLevelLinesPathToDisplay()[client.getPlane()]; - - if (plugin.getMulticombatZoneVisibility() != ZoneVisibility.HIDE && multicombatPath != null) - { - renderPath(graphics, multicombatPath, getTransparentColorVersion(plugin.getMulticombatColor())); - } - if ((plugin.isShowPvpSafeZones() || plugin.isShowDeadmanSafeZones()) && pvpPath != null) - { - renderPath(graphics, pvpPath, getTransparentColorVersion(plugin.getSafeZoneColor())); - } - if (plugin.isShowWildernessLevelLines() && wildernessLevelLinesPath != null) - { - renderPath(graphics, wildernessLevelLinesPath, getTransparentColorVersion(plugin.getWildernessLevelLinesColor())); - } - - return null; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/MultiIndicatorsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/MultiIndicatorsOverlay.java deleted file mode 100644 index 5129025cac..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/MultiIndicatorsOverlay.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * Copyright (c) 2019, Enza-Denino - * 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.multiindicators; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.geom.GeneralPath; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.geometry.Geometry; -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; - -@Singleton -public class MultiIndicatorsOverlay extends Overlay -{ - private final static int MAX_LOCAL_DRAW_LENGTH = 20 * Perspective.LOCAL_TILE_SIZE; - - @Inject - private Client client; - - @Inject - private MultiIndicatorsPlugin plugin; - - @Inject - public MultiIndicatorsOverlay() - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - setPriority(OverlayPriority.LOW); - } - - private Color getTransparentColorVersion(Color c) - { - if (plugin.isThinnerLines()) //The thin lines are difficult to see with low opacity, but they are visible and less obtrusive with full opacity - { - return c; - } - else - { - return new Color(c.getRed(), c.getGreen(), c.getBlue(), 92); - } - } - - private void renderPath(Graphics2D graphics, GeneralPath path, Color color) - { - LocalPoint playerLp = client.getLocalPlayer().getLocalLocation(); - Rectangle viewArea = new Rectangle( - playerLp.getX() - MAX_LOCAL_DRAW_LENGTH, - playerLp.getY() - MAX_LOCAL_DRAW_LENGTH, - MAX_LOCAL_DRAW_LENGTH * 2, - MAX_LOCAL_DRAW_LENGTH * 2); - - graphics.setColor(color); - if (plugin.isThinnerLines()) - { - graphics.setStroke(new BasicStroke(1)); - } - else - { - graphics.setStroke(new BasicStroke(2)); - } - path = Geometry.clipPath(path, viewArea); - path = Geometry.filterPath(path, (p1, p2) -> - Perspective.localToCanvas(client, new LocalPoint((int) p1[0], (int) p1[1]), client.getPlane()) != null && - Perspective.localToCanvas(client, new LocalPoint((int) p2[0], (int) p2[1]), client.getPlane()) != null); - path = Geometry.transformPath(path, coords -> - { - Point point = Perspective.localToCanvas(client, new LocalPoint((int) coords[0], (int) coords[1]), client.getPlane()); - if (point != null) - { - coords[0] = point.getX(); - coords[1] = point.getY(); - } - }); - - graphics.draw(path); - } - - @Override - public Dimension render(Graphics2D graphics) - { - GeneralPath multicombatPath = plugin.getMulticombatPathToDisplay()[client.getPlane()]; - GeneralPath pvpPath = plugin.getPvpPathToDisplay()[client.getPlane()]; - GeneralPath wildernessLevelLinesPath = plugin.getWildernessLevelLinesPathToDisplay()[client.getPlane()]; - - if (plugin.getMulticombatZoneVisibility() != ZoneVisibility.HIDE && multicombatPath != null) - { - renderPath(graphics, multicombatPath, getTransparentColorVersion(plugin.getMulticombatColor())); - } - if ((plugin.isShowPvpSafeZones() || plugin.isShowDeadmanSafeZones()) && pvpPath != null) - { - renderPath(graphics, pvpPath, getTransparentColorVersion(plugin.getSafeZoneColor())); - } - if (plugin.isShowWildernessLevelLines() && wildernessLevelLinesPath != null) - { - renderPath(graphics, wildernessLevelLinesPath, getTransparentColorVersion(plugin.getWildernessLevelLinesColor())); - } - - return null; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/MultiIndicatorsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/MultiIndicatorsPlugin.java deleted file mode 100644 index 85dcbbada9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/MultiIndicatorsPlugin.java +++ /dev/null @@ -1,404 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * Copyright (c) 2019, Enza-Denino - * 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.multiindicators; - -import com.google.inject.Provides; -import java.awt.Color; -import java.awt.Rectangle; -import java.awt.geom.GeneralPath; -import java.util.Arrays; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.Constants; -import net.runelite.api.GameState; -import net.runelite.api.ObjectDefinition; -import net.runelite.api.Perspective; -import net.runelite.api.Tile; -import net.runelite.api.WallObject; -import net.runelite.api.WorldType; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldArea; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.geometry.Geometry; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "Multi-Lines", - description = "Show borders of multicombat and PvP safezones", - tags = {"multicombat", "lines", "pvp", "deadman", "safezones", "bogla"}, - type = PluginType.PVP, - enabledByDefault = false -) -@Singleton -public class MultiIndicatorsPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private MultiIndicatorsConfig config; - - @Inject - private MultiIndicatorsOverlay overlay; - - @Inject - private MultiIndicatorsMinimapOverlay minimapOverlay; - - @Inject - private OverlayManager overlayManager; - - @Getter(AccessLevel.PACKAGE) - private GeneralPath[] multicombatPathToDisplay; - - @Getter(AccessLevel.PACKAGE) - private GeneralPath[] pvpPathToDisplay; - - @Getter(AccessLevel.PACKAGE) - private GeneralPath[] wildernessLevelLinesPathToDisplay; - - @Getter(AccessLevel.PACKAGE) - private boolean inPvp; - - @Getter(AccessLevel.PACKAGE) - private boolean inDeadman; - - private int currentPlane; - - @Getter(AccessLevel.PACKAGE) - private ZoneVisibility multicombatZoneVisibility; - @Getter(AccessLevel.PACKAGE) - private boolean showPvpSafeZones; - @Getter(AccessLevel.PACKAGE) - private boolean showDeadmanSafeZones; - @Getter(AccessLevel.PACKAGE) - private boolean showWildernessLevelLines; - @Getter(AccessLevel.PACKAGE) - private boolean showMinimapLines; - @Getter(AccessLevel.PACKAGE) - private Color multicombatColor; - @Getter(AccessLevel.PACKAGE) - private Color safeZoneColor; - @Getter(AccessLevel.PACKAGE) - private Color wildernessLevelLinesColor; - @Getter(AccessLevel.PACKAGE) - private boolean thinnerLines; - - @Provides - MultiIndicatorsConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(MultiIndicatorsConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - overlayManager.add(minimapOverlay); - - initializePaths(); - - clientThread.invokeLater(() -> - { - if (client.getGameState() == GameState.LOGGED_IN) - { - findLinesInScene(); - } - }); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - overlayManager.remove(minimapOverlay); - - uninitializePaths(); - } - - private void initializePaths() - { - multicombatPathToDisplay = new GeneralPath[Constants.MAX_Z]; - pvpPathToDisplay = new GeneralPath[Constants.MAX_Z]; - wildernessLevelLinesPathToDisplay = new GeneralPath[Constants.MAX_Z]; - } - - private void uninitializePaths() - { - multicombatPathToDisplay = null; - pvpPathToDisplay = null; - wildernessLevelLinesPathToDisplay = null; - } - - // sometimes the lines get offset (seems to happen when there is a delay - // due to map reloading when walking/running "Loading - please wait") - // resetting the lines generation logic fixes this - - public void update() - { - if (client.getGameState() == GameState.LOGGED_IN) - { - clientThread.invokeLater(this::findLinesInScene); - } - - } - - private void transformWorldToLocal(float[] coords) - { - LocalPoint lp = LocalPoint.fromWorld(client, (int) coords[0], (int) coords[1]); - if (lp != null) - { - coords[0] = lp.getX() - Perspective.LOCAL_TILE_SIZE / 2; - coords[1] = lp.getY() - Perspective.LOCAL_TILE_SIZE / 2; - } - } - - private boolean isOpenableAt(WorldPoint wp) - { - int sceneX = wp.getX() - client.getBaseX(); - int sceneY = wp.getY() - client.getBaseY(); - - Tile tile = client.getScene().getTiles()[wp.getPlane()][sceneX][sceneY]; - if (tile == null) - { - return false; - } - - WallObject wallObject = tile.getWallObject(); - if (wallObject == null) - { - return false; - } - - ObjectDefinition objectComposition = client.getObjectDefinition(wallObject.getId()); - - if (objectComposition == null) - { - return false; - } - - String[] actions = objectComposition.getActions(); - if (actions == null) - { - return false; - } - - return Arrays.stream(actions).anyMatch(x -> x != null && x.toLowerCase().equals("open")); - } - - private boolean collisionFilter(float[] p1, float[] p2) - { - int x1 = (int) p1[0]; - int y1 = (int) p1[1]; - int x2 = (int) p2[0]; - int y2 = (int) p2[1]; - - if (x1 > x2) - { - int temp = x1; - x1 = x2; - x2 = temp; - } - if (y1 > y2) - { - int temp = y1; - y1 = y2; - y2 = temp; - } - int dx = x2 - x1; - int dy = y2 - y1; - WorldArea wa1 = new WorldArea(new WorldPoint( - x1, y1, currentPlane), 1, 1); - WorldArea wa2 = new WorldArea(new WorldPoint( - x1 - dy, y1 - dx, currentPlane), 1, 1); - - if (isOpenableAt(wa1.toWorldPoint()) || isOpenableAt(wa2.toWorldPoint())) - { - // When there's something with the open option (e.g. a door) on the tile, - // we assume it can be opened and walked through afterwards. Without this - // check, the line for that tile wouldn't render with collision detection - // because the collision check isn't done if collision data changes. - return true; - } - - boolean b1 = wa1.canTravelInDirection(client, -dy, -dx); - boolean b2 = wa2.canTravelInDirection(client, dy, dx); - return b1 && b2; - } - - private void findLinesInScene() - { - inDeadman = client.getWorldType().stream().anyMatch(x -> - x == WorldType.DEADMAN); - inPvp = client.getWorldType().stream().anyMatch(x -> - x == WorldType.PVP || x == WorldType.HIGH_RISK); - - Rectangle sceneRect = new Rectangle( - client.getBaseX() + 1, client.getBaseY() + 1, - Constants.SCENE_SIZE - 2, Constants.SCENE_SIZE - 2); - - // Generate lines for multicombat zones - if (this.multicombatZoneVisibility == ZoneVisibility.HIDE) - { - Arrays.fill(multicombatPathToDisplay, null); - } - else - { - for (int i = 0; i < multicombatPathToDisplay.length; i++) - { - currentPlane = i; - - GeneralPath lines = new GeneralPath(MapLocations.getMulticombat(sceneRect, i)); - lines = Geometry.clipPath(lines, sceneRect); - if (this.multicombatZoneVisibility == ZoneVisibility.SHOW_IN_PVP && - !isInDeadman() && !isInPvp()) - { - lines = Geometry.clipPath(lines, MapLocations.getRoughWilderness(i)); - } - lines = Geometry.splitIntoSegments(lines, 1); - if (useCollisionLogic()) - { - lines = Geometry.filterPath(lines, this::collisionFilter); - } - lines = Geometry.transformPath(lines, this::transformWorldToLocal); - multicombatPathToDisplay[i] = lines; - } - } - - // Generate safezone lines for deadman/pvp worlds - for (int i = 0; i < pvpPathToDisplay.length; i++) - { - currentPlane = i; - - GeneralPath safeZonePath = null; - if (this.showDeadmanSafeZones && isInDeadman()) - { - safeZonePath = new GeneralPath(MapLocations.getDeadmanSafeZones(sceneRect, i)); - } - else if (this.showPvpSafeZones && isInPvp()) - { - safeZonePath = new GeneralPath(MapLocations.getPvpSafeZones(sceneRect, i)); - } - if (safeZonePath != null) - { - safeZonePath = Geometry.clipPath(safeZonePath, sceneRect); - safeZonePath = Geometry.splitIntoSegments(safeZonePath, 1); - if (useCollisionLogic()) - { - safeZonePath = Geometry.filterPath(safeZonePath, this::collisionFilter); - } - safeZonePath = Geometry.transformPath(safeZonePath, this::transformWorldToLocal); - } - pvpPathToDisplay[i] = safeZonePath; - } - - // Generate wilderness level lines - for (int i = 0; i < wildernessLevelLinesPathToDisplay.length; i++) - { - currentPlane = i; - - GeneralPath wildernessLevelLinesPath = null; - if (this.showWildernessLevelLines) - { - wildernessLevelLinesPath = new GeneralPath(MapLocations.getWildernessLevelLines(sceneRect, i)); - } - if (wildernessLevelLinesPath != null) - { - wildernessLevelLinesPath = Geometry.clipPath(wildernessLevelLinesPath, sceneRect); - wildernessLevelLinesPath = Geometry.splitIntoSegments(wildernessLevelLinesPath, 1); - if (useCollisionLogic()) - { - wildernessLevelLinesPath = Geometry.filterPath(wildernessLevelLinesPath, this::collisionFilter); - } - wildernessLevelLinesPath = Geometry.transformPath(wildernessLevelLinesPath, this::transformWorldToLocal); - } - wildernessLevelLinesPathToDisplay[i] = wildernessLevelLinesPath; - } - } - - private boolean useCollisionLogic() - { - // currently prevents overlay lines from showing up if this is ever enabled right now - return false; - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("multiindicators")) - { - return; - } - - updateConfig(); - - if (event.getKey().equals("collisionDetection") || - event.getKey().equals("multicombatZoneVisibility") || - event.getKey().equals("deadmanSafeZones") || - event.getKey().equals("pvpSafeZones") || - event.getKey().equals("wildernessLevelLines")) - { - findLinesInScene(); - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGGED_IN) - { - findLinesInScene(); - } - } - - private void updateConfig() - { - this.multicombatZoneVisibility = config.multicombatZoneVisibility(); - this.showPvpSafeZones = config.showPvpSafeZones(); - this.showDeadmanSafeZones = config.showDeadmanSafeZones(); - this.showWildernessLevelLines = config.showWildernessLevelLines(); - this.showMinimapLines = config.showMinimapLines(); - this.multicombatColor = config.multicombatColor(); - this.safeZoneColor = config.safeZoneColor(); - this.wildernessLevelLinesColor = config.wildernessLevelLinesColor(); - this.thinnerLines = config.thinnerLines(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/ZoneVisibility.java b/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/ZoneVisibility.java deleted file mode 100644 index c3e9a8fcf4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/ZoneVisibility.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * 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.multiindicators; - -import lombok.RequiredArgsConstructor; - -@RequiredArgsConstructor -public enum ZoneVisibility -{ - HIDE("Hide"), - SHOW_IN_PVP("Show in PvP"), - SHOW_EVERYWHERE("Show everywhere"); - - private final String visibility; - - @Override - public String toString() - { - return visibility; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicConfig.java deleted file mode 100644 index 1839c1fca1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicConfig.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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.music; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("music") -public interface MusicConfig extends Config -{ - @ConfigItem( - keyName = "muteOwnAreaSounds", - name = "Mute player area sounds", - description = "Mute area sounds caused by yourself", - position = 0 - ) - default boolean muteOwnAreaSounds() - { - return false; - } - - @ConfigItem( - keyName = "muteOtherAreaSounds", - name = "Mute other players' area sounds", - description = "Mute area sounds caused by other players", - position = 1 - ) - default boolean muteOtherAreaSounds() - { - return false; - } - - @ConfigItem( - keyName = "muteOtherAreaNPCSounds", - name = "Mute NPCs' area sounds", - description = "Mute area sounds caused by NPCs", - position = 2 - ) - default boolean muteNpcAreaSounds() - { - return false; - } - - @ConfigItem( - keyName = "muteOtherAreaEnvironmentSounds", - name = "Mute environment area sounds", - description = "Mute area sounds caused by neither NPCs nor players", - position = 3 - ) - default boolean muteEnvironmentAreaSounds() - { - return false; - } - - @ConfigItem( - keyName = "musicVolume", - name = "", - description = "", - hidden = true - ) - default int getMusicVolume() - { - return 0; - } - - @ConfigItem( - keyName = "musicVolume", - name = "", - description = "", - hidden = true - ) - void setMusicVolume(int vol); - - @ConfigItem( - keyName = "soundEffectVolume", - name = "", - description = "", - hidden = true - ) - default int getSoundEffectVolume() - { - return 0; - } - - @ConfigItem( - keyName = "soundEffectVolume", - name = "", - description = "", - hidden = true - ) - void setSoundEffectVolume(int val); - - @ConfigItem( - keyName = "areaSoundEffectVolume", - name = "", - description = "", - hidden = true - ) - default int getAreaSoundEffectVolume() - { - return 0; - } - - @ConfigItem( - keyName = "areaSoundEffectVolume", - name = "", - description = "", - hidden = true - ) - void setAreaSoundEffectVolume(int vol); -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java deleted file mode 100644 index a7a2b2cef7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java +++ /dev/null @@ -1,594 +0,0 @@ -/* - * Copyright (c) 2019, Anthony Chen - * 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.music; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Provides; -import java.util.Arrays; -import java.util.Collection; -import java.util.Comparator; -import java.util.Set; -import java.util.function.BiConsumer; -import java.util.function.ToIntFunction; -import java.util.stream.Collectors; -import javax.inject.Inject; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; -import net.runelite.api.Actor; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.NPC; -import net.runelite.api.Player; -import net.runelite.api.ScriptID; -import net.runelite.api.SoundEffectID; -import net.runelite.api.SpriteID; -import net.runelite.api.VarClientInt; -import net.runelite.api.VarPlayer; -import net.runelite.api.events.AreaSoundEffectPlayed; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.api.events.VarClientIntChanged; -import net.runelite.api.events.VolumeChanged; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.widgets.JavaScriptCallback; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetConfig; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.api.widgets.WidgetPositionMode; -import net.runelite.api.widgets.WidgetType; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.chatbox.ChatboxPanelManager; -import net.runelite.client.game.chatbox.ChatboxTextInput; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Music", - description = "Adds search and filter for the music list, and additional volume control", - tags = {"sound", "volume"}, - type = PluginType.MISCELLANEOUS -) -public class MusicPlugin extends Plugin -{ - private static final Set SOURCELESS_PLAYER_SOUNDS = ImmutableSet.of( - SoundEffectID.TELEPORT_VWOOP - ); - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private MusicConfig musicConfig; - - @Inject - private ChatboxPanelManager chatboxPanelManager; - - private ChatboxTextInput searchInput; - - private Widget musicSearchButton; - private Widget musicFilterButton; - - private Collection tracks; - - private MusicState currentMusicFilter = MusicState.ALL; - - @Override - protected void startUp() - { - - clientThread.invoke(() -> - { - addMusicButtons(); - applyMusicVolumeConfig(); - updateMusicOptions(); - }); - } - - @Override - protected void shutDown() - { - Widget header = client.getWidget(WidgetInfo.MUSIC_WINDOW); - if (header != null) - { - header.deleteAllChildren(); - } - - tracks = null; - - clientThread.invoke(this::teardownMusicOptions); - } - - @Provides - MusicConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(MusicConfig.class); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged gameStateChanged) - { - if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN) - { - // Reset music filter on logout - currentMusicFilter = MusicState.ALL; - tracks = null; - } - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded widgetLoaded) - { - if (widgetLoaded.getGroupId() == WidgetID.MUSIC_GROUP_ID) - { - tracks = null; - // Reset filter state as the widget has been reloaded. - // It is too early here to call updateFilter() - currentMusicFilter = MusicState.ALL; - addMusicButtons(); - } - if (widgetLoaded.getGroupId() == WidgetID.OPTIONS_GROUP_ID) - { - updateMusicOptions(); - } - } - - private void addMusicButtons() - { - Widget header = client.getWidget(WidgetInfo.MUSIC_WINDOW); - - if (header == null) - { - return; - } - - header.deleteAllChildren(); - - //Creation of the search and toggle status buttons - musicSearchButton = header.createChild(-1, WidgetType.GRAPHIC); - musicSearchButton.setSpriteId(SpriteID.GE_SEARCH); - musicSearchButton.setOriginalWidth(18); - musicSearchButton.setOriginalHeight(17); - musicSearchButton.setXPositionMode(WidgetPositionMode.ABSOLUTE_RIGHT); - musicSearchButton.setOriginalX(5); - musicSearchButton.setOriginalY(32); - musicSearchButton.setHasListener(true); - musicSearchButton.setAction(1, "Open"); - musicSearchButton.setOnOpListener((JavaScriptCallback) e -> openSearch()); - musicSearchButton.setName("Search"); - musicSearchButton.revalidate(); - - musicFilterButton = header.createChild(-1, WidgetType.GRAPHIC); - musicFilterButton.setSpriteId(SpriteID.MINIMAP_ORB_PRAYER); - musicFilterButton.setOriginalWidth(15); - musicFilterButton.setOriginalHeight(15); - musicFilterButton.setXPositionMode(WidgetPositionMode.ABSOLUTE_RIGHT); - musicFilterButton.setOriginalX(25); - musicFilterButton.setOriginalY(34); - musicFilterButton.setHasListener(true); - musicFilterButton.setAction(1, "Toggle"); - musicFilterButton.setOnOpListener((JavaScriptCallback) e -> toggleStatus()); - musicFilterButton.setName("All"); - musicFilterButton.revalidate(); - } - - @Subscribe - private void onVarClientIntChanged(VarClientIntChanged varClientIntChanged) - { - if (isChatboxOpen() && !isOnMusicTab()) - { - chatboxPanelManager.close(); - } - } - - - @Subscribe - private void onVolumeChanged(VolumeChanged volumeChanged) - { - applyMusicVolumeConfig(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged configChanged) - { - if (configChanged.getGroup().equals("music")) - { - clientThread.invokeLater(this::applyMusicVolumeConfig); - } - } - - private void applyMusicVolumeConfig() - { - int musicVolume = musicConfig.getMusicVolume(); - if (musicVolume > 0) - { - client.setMusicVolume(musicVolume - 1); - } - - int soundEffectVolume = musicConfig.getSoundEffectVolume(); - if (soundEffectVolume > 0) - { - client.setSoundEffectVolume(soundEffectVolume - 1); - } - - int areaSoundEffectVolume = musicConfig.getAreaSoundEffectVolume(); - if (areaSoundEffectVolume > 0) - { - client.setAreaSoundEffectVolume(areaSoundEffectVolume - 1); - } - - updateMusicOptions(); - } - - private boolean isOnMusicTab() - { - return client.getVar(VarClientInt.INTERFACE_TAB) == 13; - } - - private boolean isChatboxOpen() - { - return searchInput != null && chatboxPanelManager.getCurrentInput() == searchInput; - } - - private String getChatboxInput() - { - return isChatboxOpen() ? searchInput.getValue() : ""; - } - - private void toggleStatus() - { - MusicState[] states = MusicState.values(); - currentMusicFilter = states[(currentMusicFilter.ordinal() + 1) % states.length]; - musicFilterButton.setSpriteId(currentMusicFilter.getSpriteID()); - musicFilterButton.setName(currentMusicFilter.getName()); - updateFilter(getChatboxInput()); - client.playSoundEffect(SoundEffectID.UI_BOOP); - } - - private void openSearch() - { - updateFilter(""); - client.playSoundEffect(SoundEffectID.UI_BOOP); - musicSearchButton.setAction(1, "Close"); - musicSearchButton.setOnOpListener((JavaScriptCallback) e -> closeSearch()); - searchInput = chatboxPanelManager.openTextInput("Search music list") - .onChanged(s -> clientThread.invokeLater(() -> updateFilter(s.trim()))) - .onClose(() -> - { - clientThread.invokeLater(() -> updateFilter("")); - musicSearchButton.setOnOpListener((JavaScriptCallback) e -> openSearch()); - musicSearchButton.setAction(1, "Open"); - }) - .build(); - } - - private void closeSearch() - { - updateFilter(""); - chatboxPanelManager.close(); - client.playSoundEffect(SoundEffectID.UI_BOOP); - } - - private void updateFilter(String input) - { - final Widget container = client.getWidget(WidgetInfo.MUSIC_WINDOW); - final Widget musicList = client.getWidget(WidgetInfo.MUSIC_TRACK_LIST); - - if (container == null || musicList == null) - { - return; - } - - String filter = input.toLowerCase(); - updateList(musicList, filter); - } - - private void updateList(Widget musicList, String filter) - { - if (tracks == null) - { - tracks = Arrays.stream(musicList.getDynamicChildren()) - .sorted(Comparator.comparing(Widget::getRelativeY)) - .collect(Collectors.toList()); - } - - tracks.forEach(w -> w.setHidden(true)); - - Collection relevantTracks = tracks.stream() - .filter(w -> w.getText().toLowerCase().contains(filter)) - .filter(w -> currentMusicFilter == MusicState.ALL || w.getTextColor() == currentMusicFilter.getColor()) - .collect(Collectors.toList()); - - // Original music track list has a little offset - int y = 3; - - for (Widget track : relevantTracks) - { - track.setHidden(false); - track.setOriginalY(y); - track.revalidate(); - - y += track.getHeight(); - } - - y += 3; - - int newHeight = 0; - - if (musicList.getScrollHeight() > 0) - { - newHeight = (musicList.getScrollY() * y) / musicList.getScrollHeight(); - } - - musicList.setScrollHeight(y); - musicList.revalidateScroll(); - - client.runScript( - ScriptID.UPDATE_SCROLLBAR, - WidgetInfo.MUSIC_TRACK_SCROLLBAR.getId(), - WidgetInfo.MUSIC_TRACK_LIST.getId(), - newHeight - ); - } - - @AllArgsConstructor - @Getter - private enum MusicState - { - NOT_FOUND(0xff0000, "Locked", SpriteID.MINIMAP_ORB_HITPOINTS), - FOUND(0xdc10d, "Unlocked", SpriteID.MINIMAP_ORB_HITPOINTS_POISON), - ALL(0, "All", SpriteID.MINIMAP_ORB_PRAYER); - - private final int color; - private final String name; - private final int spriteID; - } - - @RequiredArgsConstructor - @Getter - private enum MusicSlider - { - MUSIC(WidgetInfo.OPTIONS_MUSIC_SLIDER, VarPlayer.MUSIC_VOLUME, MusicConfig::getMusicVolume, MusicConfig::setMusicVolume, 255), - AREA(WidgetInfo.OPTIONS_AREA_SOUND_SLIDER, VarPlayer.AREA_EFFECT_VOLUME, MusicConfig::getAreaSoundEffectVolume, MusicConfig::setAreaSoundEffectVolume, 127), - EFFECT(WidgetInfo.OPTIONS_SOUND_EFFECT_SLIDER, VarPlayer.SOUND_EFFECT_VOLUME, MusicConfig::getSoundEffectVolume, MusicConfig::setSoundEffectVolume, 127); - - private final WidgetInfo widgetID; - private final VarPlayer var; - private final ToIntFunction getter; - private final BiConsumer setter; - private final int max; - - @Setter - private Widget handle; - - @Setter - private Widget track; - - private static int PADDING = 8; - - private int getX() - { - return getTrack().getRelativeX() + PADDING; - } - - private int getWidth() - { - return getTrack().getWidth() - (PADDING * 2) - handle.getWidth(); - } - } - - private void teardownMusicOptions() - { - for (MusicSlider slider : MusicSlider.values()) - { - Widget icon = client.getWidget(slider.getWidgetID()); - if (icon == null) - { - return; - } - - if (slider.getHandle() != null) - { - { - Widget handle = slider.getHandle(); - Widget parent = handle.getParent(); - if (parent == null) - { - continue; - } - else - { - Widget[] siblings = parent.getChildren(); - if (siblings == null || handle.getIndex() >= siblings.length || siblings[handle.getIndex()] != handle) - { - continue; - } - siblings[slider.getTrack().getIndex()] = null; - siblings[handle.getIndex()] = null; - } - } - - Object[] init = icon.getOnLoadListener(); - init[1] = slider.getWidgetID().getId(); - - // Readd the var transmit triggers and rerun options_allsounds - client.runScript(init); - slider.setHandle(null); - slider.setTrack(null); - } - } - } - - private void updateMusicOptions() - { - for (MusicSlider slider : MusicSlider.values()) - { - Widget icon = client.getWidget(slider.getWidgetID()); - if (icon == null) - { - return; - } - - Widget handle = slider.getHandle(); - if (handle != null) - { - Widget parent = handle.getParent(); - if (parent == null) - { - handle = null; - } - else - { - Widget[] siblings = parent.getChildren(); - if (siblings == null || handle.getIndex() >= siblings.length || siblings[handle.getIndex()] != handle) - { - handle = null; - } - } - } - if (handle == null) - { - Object[] init = icon.getOnLoadListener(); - icon.setVarTransmitTrigger((int[]) null); - - Widget track = icon.getParent().createChild(-1, WidgetType.TEXT); - slider.setTrack(track); - handle = icon.getParent().createChild(-1, WidgetType.GRAPHIC); - slider.setHandle(handle); - - { - // First widget of the track - int wid = (Integer) init[2]; - Widget w = client.getWidget(WidgetInfo.TO_GROUP(wid), WidgetInfo.TO_CHILD(wid)); - - track.setOriginalX(w.getRelativeX()); - track.setOriginalY(w.getRelativeY()); - } - { - // Last widget of the track - int wid = (Integer) init[6]; - Widget w = client.getWidget(WidgetInfo.TO_GROUP(wid), WidgetInfo.TO_CHILD(wid)); - - track.setOriginalWidth((w.getRelativeX() + w.getWidth()) - track.getOriginalX()); - } - - track.setOriginalHeight(16); - track.setNoClickThrough(true); - track.revalidate(); - - handle.setSpriteId(SpriteID.OPTIONS_ZOOM_SLIDER_THUMB); - handle.setOriginalWidth(16); - handle.setOriginalHeight(16); - handle.setClickMask(WidgetConfig.DRAG); - - JavaScriptCallback move = ev -> - { - int newVal = ((ev.getMouseX() - MusicSlider.PADDING - (slider.getHandle().getWidth() / 2)) * slider.getMax()) - / slider.getWidth(); - if (newVal < 0) - { - newVal = 0; - } - if (newVal > slider.getMax()) - { - newVal = slider.getMax(); - } - - // We store +1 so we can tell the difference between 0 and muted - slider.getSetter().accept(musicConfig, newVal + 1); - applyMusicVolumeConfig(); - }; - - track.setOnClickListener(move); - track.setOnHoldListener(move); - track.setOnReleaseListener(move); - track.setHasListener(true); - - client.runScript(ScriptID.OPTIONS_ALLSOUNDS, -1, init[2], init[3], init[4], init[5], init[6]); - } - - int value = slider.getGetter().applyAsInt(musicConfig) - 1; - if (value <= -1) - { - // Use the vanilla value - value = ((4 - client.getVar(slider.getVar())) * slider.getMax()) / 4; - } - - int newX = ((value * slider.getWidth()) / slider.getMax()) + slider.getX(); - slider.getHandle().setOriginalX(newX); - slider.getHandle().setOriginalY(slider.getTrack().getOriginalY()); - slider.getHandle().revalidate(); - } - } - - @Subscribe - private void onScriptCallbackEvent(ScriptCallbackEvent ev) - { - // We have to override this script because it gets invoked periodically from the server - if ("optionsAllSounds".equals(ev.getEventName())) - { - client.getIntStack()[client.getIntStackSize() - 1] = -1; - } - } - - @Subscribe - private void onAreaSoundEffectPlayed(AreaSoundEffectPlayed areaSoundEffectPlayed) - { - Actor source = areaSoundEffectPlayed.getSource(); - int soundId = areaSoundEffectPlayed.getSoundId(); - if (source == client.getLocalPlayer() - && musicConfig.muteOwnAreaSounds()) - { - areaSoundEffectPlayed.consume(); - } - else if (source != client.getLocalPlayer() - && (source instanceof Player || (source == null && SOURCELESS_PLAYER_SOUNDS.contains(soundId))) - && musicConfig.muteOtherAreaSounds()) - { - areaSoundEffectPlayed.consume(); - } - else if (source instanceof NPC - && musicConfig.muteNpcAreaSounds()) - { - areaSoundEffectPlayed.consume(); - } - else if (source == null - && !SOURCELESS_PLAYER_SOUNDS.contains(soundId) - && musicConfig.muteEnvironmentAreaSounds()) - { - areaSoundEffectPlayed.consume(); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/AbsorptionCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/AbsorptionCounter.java deleted file mode 100644 index e6491a6205..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/AbsorptionCounter.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2018, Nickolaj - * 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.nightmarezone; - -import java.awt.Color; -import java.awt.image.BufferedImage; -import lombok.AccessLevel; -import lombok.Setter; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.ui.overlay.infobox.Counter; - -@Setter(AccessLevel.PACKAGE) -public class AbsorptionCounter extends Counter -{ - private int threshold; - private Color aboveThresholdColor = Color.GREEN; - private Color belowThresholdColor = Color.RED; - - AbsorptionCounter(BufferedImage image, Plugin plugin, int absorption, int threshold) - { - super(image, plugin, absorption); - this.threshold = threshold; - } - - @Override - public Color getTextColor() - { - int absorption = getCount(); - if (absorption >= threshold) - { - return aboveThresholdColor; - } - else - { - return belowThresholdColor; - } - } - - @Override - public String getTooltip() - { - int absorption = getCount(); - return "Absorption: " + absorption; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZoneConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZoneConfig.java deleted file mode 100644 index 8b02d65f3c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZoneConfig.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2018, Nickolaj - * 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.nightmarezone; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("nightmareZone") -public interface NightmareZoneConfig extends Config -{ - @ConfigItem( - keyName = "moveoverlay", - name = "Override NMZ overlay", - description = "Overrides the overlay so it doesn't conflict with other RuneLite plugins", - position = 0 - ) - default boolean moveOverlay() - { - return true; - } - - @ConfigItem( - keyName = "showtotalpoints", - name = "Total points NMZ overlay", - description = "Shows total points to overlay", - position = 1 - ) - default boolean showtotalpoints() - { - return false; - } - - @ConfigItem( - keyName = "powersurgenotification", - name = "Power surge notification", - description = "Toggles notifications when a power surge power-up appears", - position = 2 - ) - default boolean powerSurgeNotification() - { - return false; - } - - @ConfigItem( - keyName = "recurrentdamagenotification", - name = "Recurrent damage notification", - description = "Toggles notifications when a recurrent damage power-up appears", - position = 3 - ) - default boolean recurrentDamageNotification() - { - return false; - } - - @ConfigItem( - keyName = "zappernotification", - name = "Zapper notification", - description = "Toggles notifications when a zapper power-up appears", - position = 4 - ) - default boolean zapperNotification() - { - return false; - } - - @ConfigItem( - keyName = "ultimateforcenotification", - name = "Ultimate Force notification", - description = "Toggles notifications when an ultimate force power-up appears", - position = 5 - ) - default boolean ultimateForceNotification() - { - return false; - } - - @ConfigItem( - keyName = "overloadnotification", - name = "Overload notification", - description = "Toggles notifications when your overload runs out", - position = 6 - ) - default boolean overloadNotification() - { - return true; - } - - @ConfigItem( - keyName = "absorptionnotification", - name = "Absorption notification", - description = "Toggles notifications when your absorption points gets below your threshold", - position = 7 - ) - default boolean absorptionNotification() - { - return true; - } - - @ConfigItem( - keyName = "absorptionthreshold", - name = "Absorption Threshold", - description = "The amount of absorption points to send a notification at", - position = 8 - ) - default int absorptionThreshold() - { - return 50; - } - - @ConfigItem( - keyName = "absorptioncoloroverthreshold", - name = "Color above threshold", - description = "Configures the color for the absorption widget when above the threshold", - position = 9 - ) - default Color absorptionColorAboveThreshold() - { - return Color.YELLOW; - } - - @ConfigItem( - keyName = "absorptioncolorbelowthreshold", - name = "Color below threshold", - description = "Configures the color for the absorption widget when below the threshold", - position = 10 - ) - default Color absorptionColorBelowThreshold() - { - return Color.RED; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZoneOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZoneOverlay.java deleted file mode 100644 index a59d36bdfa..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZoneOverlay.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2018, Nickolaj - * 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.nightmarezone; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.ItemID; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.VarPlayer; -import net.runelite.api.Varbits; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.game.ItemManager; -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; -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; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; -import net.runelite.client.util.QuantityFormatter; - -@Singleton -class NightmareZoneOverlay extends Overlay -{ - private final Client client; - private final NightmareZonePlugin plugin; - private final InfoBoxManager infoBoxManager; - private final ItemManager itemManager; - - private AbsorptionCounter absorptionCounter; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - NightmareZoneOverlay( - final Client client, - final NightmareZonePlugin plugin, - final InfoBoxManager infoBoxManager, - final ItemManager itemManager) - { - super(plugin); - setPosition(OverlayPosition.TOP_LEFT); - setPriority(OverlayPriority.LOW); - this.client = client; - this.plugin = plugin; - this.infoBoxManager = infoBoxManager; - this.itemManager = itemManager; - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "NMZ overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.isNotInNightmareZone() || !plugin.isMoveOverlay()) - { - if (absorptionCounter != null) - { - removeAbsorptionCounter(); - // Restore original widget - Widget nmzWidget = client.getWidget(WidgetInfo.NIGHTMARE_ZONE); - if (nmzWidget != null) - { - nmzWidget.setHidden(false); - } - } - return null; - } - - Widget nmzWidget = client.getWidget(WidgetInfo.NIGHTMARE_ZONE); - - if (nmzWidget != null) - { - nmzWidget.setHidden(true); - } - - renderAbsorptionCounter(); - - final int currentPoints = client.getVar(Varbits.NMZ_POINTS); - final int totalPoints = currentPoints + client.getVar(VarPlayer.NMZ_REWARD_POINTS); - - panelComponent.getChildren().clear(); - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - tableComponent.addRow("Points:", QuantityFormatter.formatNumber(currentPoints)); - tableComponent.addRow("Points/Hour:", QuantityFormatter.formatNumber(plugin.getPointsPerHour())); - - if (plugin.isShowtotalpoints()) - { - tableComponent.addRow("Total:", QuantityFormatter.formatNumber(totalPoints)); - } - - panelComponent.getChildren().add(tableComponent); - - return panelComponent.render(graphics); - } - - private void renderAbsorptionCounter() - { - int absorptionPoints = client.getVar(Varbits.NMZ_ABSORPTION); - if (absorptionPoints == 0) - { - if (absorptionCounter != null) - { - removeAbsorptionCounter(); - absorptionCounter = null; - } - } - else if (plugin.isMoveOverlay()) - { - if (absorptionCounter == null) - { - addAbsorptionCounter(absorptionPoints); - } - else - { - absorptionCounter.setCount(absorptionPoints); - } - } - } - - private void addAbsorptionCounter(int startValue) - { - absorptionCounter = new AbsorptionCounter(itemManager.getImage(ItemID.ABSORPTION_4), plugin, startValue, plugin.getAbsorptionThreshold()); - absorptionCounter.setAboveThresholdColor(plugin.getAbsorptionColorAboveThreshold()); - absorptionCounter.setBelowThresholdColor(plugin.getAbsorptionColorBelowThreshold()); - infoBoxManager.addInfoBox(absorptionCounter); - } - - public void removeAbsorptionCounter() - { - infoBoxManager.removeInfoBox(absorptionCounter); - absorptionCounter = null; - } - - public void updateConfig() - { - if (absorptionCounter != null) - { - absorptionCounter.setAboveThresholdColor(plugin.getAbsorptionColorAboveThreshold()); - absorptionCounter.setBelowThresholdColor(plugin.getAbsorptionColorBelowThreshold()); - absorptionCounter.setThreshold(plugin.getAbsorptionThreshold()); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZonePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZonePlugin.java deleted file mode 100644 index 4a2adde239..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZonePlugin.java +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright (c) 2018, Nickolaj - * 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.nightmarezone; - -import com.google.inject.Provides; -import java.awt.Color; -import java.time.Duration; -import java.time.Instant; -import java.util.Arrays; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.Varbits; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameTick; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.Notifier; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "Nightmare Zone", - description = "Show NMZ points/absorption and/or notify about expiring potions", - tags = {"combat", "nmz", "minigame", "notifications"}, - type = PluginType.MINIGAME -) -@Singleton -public class NightmareZonePlugin extends Plugin -{ - private static final int[] NMZ_MAP_REGION = {9033}; - private static final Duration HOUR = Duration.ofHours(1); - - @Inject - private Notifier notifier; - - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private NightmareZoneConfig config; - - @Inject - private NightmareZoneOverlay overlay; - - @Getter(AccessLevel.PACKAGE) - private int pointsPerHour; - - private Instant nmzSessionStartTime; - - // This starts as true since you need to get - // above the threshold before sending notifications - private boolean absorptionNotificationSend = true; - - @Getter(AccessLevel.PACKAGE) - private boolean moveOverlay; - @Getter(AccessLevel.PACKAGE) - private boolean showtotalpoints; - private boolean powerSurgeNotification; - private boolean recurrentDamageNotification; - private boolean zapperNotification; - private boolean ultimateForceNotification; - private boolean overloadNotification; - private boolean absorptionNotification; - @Getter(AccessLevel.PACKAGE) - private int absorptionThreshold; - @Getter(AccessLevel.PACKAGE) - private Color absorptionColorAboveThreshold; - @Getter(AccessLevel.PACKAGE) - private Color absorptionColorBelowThreshold; - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - overlay.removeAbsorptionCounter(); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - overlay.removeAbsorptionCounter(); - - Widget nmzWidget = client.getWidget(WidgetInfo.NIGHTMARE_ZONE); - - if (nmzWidget != null) - { - nmzWidget.setHidden(false); - } - - resetPointsPerHour(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("nightmareZone")) - { - return; - } - - updateConfig(); - overlay.updateConfig(); - } - - @Provides - NightmareZoneConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(NightmareZoneConfig.class); - } - - @Subscribe - private void onGameTick(GameTick event) - { - if (isNotInNightmareZone()) - { - if (!absorptionNotificationSend) - { - absorptionNotificationSend = true; - } - - if (nmzSessionStartTime != null) - { - resetPointsPerHour(); - } - - return; - } - - if (this.absorptionNotification) - { - checkAbsorption(); - } - - if (config.moveOverlay()) - { - pointsPerHour = calculatePointsPerHour(); - } - } - - @Subscribe - private void onChatMessage(ChatMessage event) - { - if (event.getType() != ChatMessageType.GAMEMESSAGE - || isNotInNightmareZone()) - { - return; - } - - String msg = Text.removeTags(event.getMessage()); //remove color - if (msg.contains("The effects of overload have worn off, and you feel normal again.")) - { - if (this.overloadNotification) - { - notifier.notify("Your overload has worn off"); - } - } - else if (msg.contains("A power-up has spawned:")) - { - if (msg.contains("Power surge")) - { - if (this.powerSurgeNotification) - { - notifier.notify(msg); - } - } - else if (msg.contains("Recurrent damage")) - { - if (this.recurrentDamageNotification) - { - notifier.notify(msg); - } - } - else if (msg.contains("Zapper")) - { - if (this.zapperNotification) - { - notifier.notify(msg); - } - } - else if (msg.contains("Ultimate force")) - { - if (this.ultimateForceNotification) - { - notifier.notify(msg); - } - } - } - } - - private void checkAbsorption() - { - int absorptionPoints = client.getVar(Varbits.NMZ_ABSORPTION); - - if (!absorptionNotificationSend) - { - if (absorptionPoints < this.absorptionThreshold) - { - notifier.notify("Absorption points below: " + this.absorptionThreshold); - absorptionNotificationSend = true; - } - } - else - { - if (absorptionPoints > this.absorptionThreshold) - { - absorptionNotificationSend = false; - } - } - } - - boolean isNotInNightmareZone() - { - return !Arrays.equals(client.getMapRegions(), NMZ_MAP_REGION); - } - - private int calculatePointsPerHour() - { - Instant now = Instant.now(); - final int currentPoints = client.getVar(Varbits.NMZ_POINTS); - - if (nmzSessionStartTime == null) - { - nmzSessionStartTime = now; - } - - Duration timeSinceStart = Duration.between(nmzSessionStartTime, now); - - if (!timeSinceStart.isZero()) - { - return (int) ((double) currentPoints * (double) HOUR.toMillis() / (double) timeSinceStart.toMillis()); - } - - return 0; - } - - private void resetPointsPerHour() - { - nmzSessionStartTime = null; - pointsPerHour = 0; - } - - private void updateConfig() - { - this.moveOverlay = config.moveOverlay(); - this.showtotalpoints = config.showtotalpoints(); - this.powerSurgeNotification = config.powerSurgeNotification(); - this.recurrentDamageNotification = config.recurrentDamageNotification(); - this.zapperNotification = config.zapperNotification(); - this.ultimateForceNotification = config.ultimateForceNotification(); - this.overloadNotification = config.overloadNotification(); - this.absorptionNotification = config.absorptionNotification(); - this.absorptionThreshold = config.absorptionThreshold(); - this.absorptionColorAboveThreshold = config.absorptionColorAboveThreshold(); - this.absorptionColorBelowThreshold = config.absorptionColorBelowThreshold(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/notes/DeleteOnlyPageException.java b/runelite-client/src/main/java/net/runelite/client/plugins/notes/DeleteOnlyPageException.java deleted file mode 100644 index 7fdf1aadc7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/notes/DeleteOnlyPageException.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.runelite.client.plugins.notes; - -class DeleteOnlyPageException extends RuntimeException -{ - DeleteOnlyPageException() - { - super("Cannot delete the only page"); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/notes/NoteTab.java b/runelite-client/src/main/java/net/runelite/client/plugins/notes/NoteTab.java deleted file mode 100644 index 5103cdffe7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/notes/NoteTab.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2019, whs - * 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.notes; - -import java.awt.BorderLayout; -import java.awt.event.ActionEvent; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import javax.swing.AbstractAction; -import javax.swing.JPanel; -import javax.swing.JTextArea; -import javax.swing.KeyStroke; -import javax.swing.border.EmptyBorder; -import javax.swing.text.BadLocationException; -import javax.swing.text.Document; -import javax.swing.undo.CannotUndoException; -import javax.swing.undo.UndoManager; -import lombok.extern.slf4j.Slf4j; -import net.runelite.client.ui.ColorScheme; - -@Slf4j -class NoteTab extends JPanel -{ - private final NotesManager manager; - private final JTextArea notesEditor = new JTextArea(); - private final UndoManager undoRedo = new UndoManager(); - - private final int index; - - NoteTab(NotesManager mManager, int mIndex) - { - manager = mManager; - index = mIndex; - - setLayout(new BorderLayout()); - setBackground(ColorScheme.DARKER_GRAY_COLOR); - - notesEditor.setTabSize(2); - notesEditor.setLineWrap(true); - notesEditor.setWrapStyleWord(true); - - notesEditor.setOpaque(false); - - notesEditor.setText(manager.getNotes().get(mIndex)); - - // setting the limit to a 500 as UndoManager registers every key press, - // which means that be default we would be able to undo only a sentence. - // note: the default limit is 100 - undoRedo.setLimit(500); - notesEditor.getDocument().addUndoableEditListener(e -> undoRedo.addEdit(e.getEdit())); - - notesEditor.getInputMap().put(KeyStroke.getKeyStroke("control Z"), "Undo"); - notesEditor.getInputMap().put(KeyStroke.getKeyStroke("control Y"), "Redo"); - - notesEditor.getActionMap().put("Undo", new AbstractAction("Undo") - { - @Override - public void actionPerformed(ActionEvent e) - { - try - { - if (undoRedo.canUndo()) - { - undoRedo.undo(); - } - } - catch (CannotUndoException ex) - { - log.warn("Notes Document Unable To Undo: " + ex); - } - } - }); - - notesEditor.getActionMap().put("Redo", new AbstractAction("Redo") - { - @Override - public void actionPerformed(ActionEvent e) - { - try - { - if (undoRedo.canRedo()) - { - undoRedo.redo(); - } - } - catch (CannotUndoException ex) - { - log.warn("Notes Document Unable To Redo: " + ex); - } - } - }); - - notesEditor.addFocusListener(new FocusListener() - { - @Override - public void focusGained(FocusEvent e) - { - - } - - @Override - public void focusLost(FocusEvent e) - { - notesChanged(notesEditor.getDocument()); - } - - private void notesChanged(Document doc) - { - try - { - // get document text and save to config whenever editor is changed - String data = doc.getText(0, doc.getLength()); - manager.updateNote(index, data); - } - catch (BadLocationException ex) - { - log.warn("Notes Document Bad Location: " + ex); - } - } - }); - add(notesEditor, BorderLayout.CENTER); - setBorder(new EmptyBorder(10, 10, 10, 10)); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/notes/NotesConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/notes/NotesConfig.java deleted file mode 100644 index 409e125ffc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/notes/NotesConfig.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018 Charlie Waters - * 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.notes; - -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("notes") -public interface NotesConfig extends Config -{ - String CONFIG_GROUP = "notes"; - String NOTES = "notes"; - - @ConfigItem( - keyName = "notesData", - name = "", - description = "", - hidden = true - ) - default String notesData() - { - return ""; - } - - @ConfigItem( - keyName = "notesData", - name = "", - description = "" - ) - void notesData(String str); - - @Range( - min = 1, - max = 5 - ) - @ConfigItem( - keyName = "maxNotes", - name = "Max Notes", - description = "Desired maximum amount of notes" - ) - default int maxNotes() - { - return 5; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/notes/NotesManager.java b/runelite-client/src/main/java/net/runelite/client/plugins/notes/NotesManager.java deleted file mode 100644 index 30f7fc14e6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/notes/NotesManager.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2019, whs - * 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.notes; - -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; -import java.util.ArrayList; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import joptsimple.internal.Strings; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.plugins.notes.events.PageAdded; -import net.runelite.client.plugins.notes.events.PageDeleted; - -@Singleton -@Slf4j -class NotesManager -{ - @Inject - private ConfigManager configManager; - - @Inject - private NotesConfig config; - - @Inject - private EventBus eventBus; - - @Getter(AccessLevel.PACKAGE) - private List notes = new ArrayList<>(); - - void loadNotes() - { - final String configJson = configManager.getConfiguration(NotesConfig.CONFIG_GROUP, NotesConfig.NOTES); - - notes = null; - if (!Strings.isNullOrEmpty(configJson)) - { - final Gson gson = new Gson(); - notes = gson.fromJson(configJson, new TypeToken>() {}.getType()); - } - - if (notes == null) - { - notes = new ArrayList<>(); - notes.add(""); - } - - // migrate from legacy single tab notes - if (!config.notesData().isEmpty()) - { - log.info("Adding tab for legacy note data"); - notes.add(0, config.notesData()); - - if (notes.size() == 2 && notes.get(1).equals("")) - { - // remove the default empty note page - notes.remove(1); - } - } - } - - void updateNote(int index, String data) - { - notes.set(index, data); - save(); - } - - private void save() - { - final Gson gson = new Gson(); - final String json = gson.toJson(notes); - configManager.setConfiguration(NotesConfig.CONFIG_GROUP, NotesConfig.NOTES, json); - - // Remove legacy notes - if (!config.notesData().isEmpty()) - { - log.info("Removing legacy note data"); - config.notesData(""); - } - } - - void addPage() - { - notes.add(""); - eventBus.post(PageAdded.class, new PageAdded(notes.size() - 1)); - save(); - } - - void deletePage(int index) - { - if (notes.size() <= 1) - { - throw new DeleteOnlyPageException(); - } - - notes.remove(index); - eventBus.post(PageDeleted.class, new PageDeleted(index)); - save(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/notes/NotesPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/notes/NotesPanel.java deleted file mode 100644 index e93e66c7cd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/notes/NotesPanel.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2018 Charlie Waters - * Copyright (c) 2018, Psikoi - * Copyright (c) 2019, whs - * 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.notes; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.swing.ImageIcon; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import static javax.swing.JOptionPane.ERROR_MESSAGE; -import static javax.swing.JOptionPane.YES_NO_OPTION; -import static javax.swing.JOptionPane.YES_OPTION; -import static javax.swing.JOptionPane.getRootFrame; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.SwingUtilities; -import javax.swing.border.EmptyBorder; -import lombok.extern.slf4j.Slf4j; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.notes.events.PageAdded; -import net.runelite.client.plugins.notes.events.PageDeleted; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.ui.components.materialtabs.MaterialTab; -import net.runelite.client.ui.components.materialtabs.MaterialTabGroup; -import net.runelite.client.util.ImageUtil; - -@Slf4j -@Singleton -class NotesPanel extends PluginPanel -{ - @Inject - private NotesManager notesManager; - - @Inject - private EventBus eventBus; - - private final JPanel display = new JPanel(); - private final MaterialTabGroup tabGroup = new MaterialTabGroup(display); - private final ImageIcon addIcon = new ImageIcon(ImageUtil.getResourceStreamFromClass(getClass(), "add_icon.png")); - private MaterialTab addTab; - private List tabs = new ArrayList<>(); - private NotesConfig config; - - void init(final NotesConfig mConfig) - { - config = mConfig; - - eventBus.subscribe(PageAdded.class, this, this::onPageAdded); - eventBus.subscribe(PageDeleted.class, this, this::onPageDeleted); - eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged); - - // this may or may not qualify as a hack - // but this lets the editor pane expand to fill the whole parent panel - getParent().setLayout(new BorderLayout()); - getParent().add(this, BorderLayout.CENTER); - - setLayout(new BorderLayout()); - setBackground(ColorScheme.DARK_GRAY_COLOR); - - tabGroup.setBorder(new EmptyBorder(0, 0, 10, 0)); - - buildAddTab(); - - add(tabGroup, BorderLayout.NORTH); - add(display, BorderLayout.CENTER); - } - - private void buildAddTab() - { - addTab = new MaterialTab(addIcon, tabGroup, new JPanel()); - addTab.setOnSelectEvent(() -> - { - notesManager.addPage(); - return false; - }); - } - - void rebuild() - { - tabs = new LinkedList<>(); - tabGroup.removeAll(); - - int totalNotes = notesManager.getNotes().size(); - - for (int i = 0; i < totalNotes; i++) - { - MaterialTab tab = buildTab(i); - tabs.add(tab); - tabGroup.addTab(tab); - } - - if (totalNotes < config.maxNotes()) - { - tabGroup.addTab(addTab); - } - - if (tabs.size() > 0) - { - // select the first tab - tabGroup.select(tabGroup.getTab(0)); - } - - revalidate(); - repaint(); - } - - private void onConfigChanged(ConfigChanged e) - { - if (!e.getGroup().equals(NotesConfig.CONFIG_GROUP)) - { - return; - } - - rebuild(); - } - - private void onPageAdded(PageAdded e) - { - MaterialTab tab = buildTab(e.getIndex()); - tabs.add(tab); - tabGroup.addTab(tab); - - // re-add add button to make it last - tabGroup.removeTab(addTab); - if (notesManager.getNotes().size() < config.maxNotes()) - { - tabGroup.addTab(addTab); - } - - revalidate(); - repaint(); - } - - private void onPageDeleted(PageDeleted e) - { - rebuild(); - } - - private MaterialTab buildTab(int index) - { - String name = String.valueOf(index + 1); - NoteTab noteTab = new NoteTab(notesManager, index); - - MaterialTab materialTab = new MaterialTab(name, tabGroup, noteTab); - materialTab.setPreferredSize(new Dimension(30, 27)); - materialTab.setName(name); - - final JMenuItem deleteMenuItem = new JMenuItem(); - deleteMenuItem.setText(String.format("Delete note %s", name)); - - deleteMenuItem.addActionListener(e -> - { - if (JOptionPane.showConfirmDialog(getRootFrame(), String.format("Delete note page %s?", name), "Notes", YES_NO_OPTION) != YES_OPTION) - { - return; - } - try - { - notesManager.deletePage(index); - } - catch (DeleteOnlyPageException err) - { - SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog(getRootFrame(), - "Cannot delete the last page", - "Notes", ERROR_MESSAGE)); - } - }); - - final JPopupMenu contextMenu = new JPopupMenu(); - contextMenu.setBorder(new EmptyBorder(5, 5, 5, 5)); - contextMenu.add(deleteMenuItem); - - materialTab.setComponentPopupMenu(contextMenu); - - return materialTab; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/notes/NotesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/notes/NotesPlugin.java deleted file mode 100644 index 4eb2b95b08..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/notes/NotesPlugin.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2018 Charlie Waters - * 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.notes; - -import com.google.inject.Provides; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.SessionOpen; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.util.ImageUtil; - -@PluginDescriptor( - name = "Notes", - description = "Enable the Notes panel", - tags = {"panel"}, - loadWhenOutdated = true, - type = PluginType.MISCELLANEOUS -) -@Singleton -public class NotesPlugin extends Plugin -{ - @Inject - private ClientToolbar clientToolbar; - - @Inject - private NotesConfig config; - - @Inject - private NotesManager notesManager; - - private NotesPanel panel; - private NavigationButton navButton; - - @Provides - NotesConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(NotesConfig.class); - } - - @Override - protected void startUp() - { - - panel = injector.getInstance(NotesPanel.class); - panel.init(config); - - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "notes_icon.png"); - - navButton = NavigationButton.builder() - .tooltip("Notes") - .icon(icon) - .priority(7) - .panel(panel) - .build(); - - clientToolbar.addNavigation(navButton); - - notesManager.loadNotes(); - panel.rebuild(); - } - - @Override - protected void shutDown() - { - clientToolbar.removeNavigation(navButton); - } - - @Subscribe - private void onSessionOpen(SessionOpen event) - { - notesManager.loadNotes(); - panel.rebuild(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/notes/events/PageAdded.java b/runelite-client/src/main/java/net/runelite/client/plugins/notes/events/PageAdded.java deleted file mode 100644 index dfeb339b74..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/notes/events/PageAdded.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.runelite.client.plugins.notes.events; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.events.Event; - -@AllArgsConstructor -public class PageAdded implements Event -{ - @Getter(AccessLevel.PUBLIC) - @Setter(AccessLevel.PUBLIC) - private int index; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/notes/events/PageDeleted.java b/runelite-client/src/main/java/net/runelite/client/plugins/notes/events/PageDeleted.java deleted file mode 100644 index bf2358920c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/notes/events/PageDeleted.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.runelite.client.plugins.notes.events; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.events.Event; - -@AllArgsConstructor -public class PageDeleted implements Event -{ - @Getter(AccessLevel.PUBLIC) - @Setter(AccessLevel.PUBLIC) - private int index; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/MemorizedNpc.java b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/MemorizedNpc.java deleted file mode 100644 index 4e0ba4d5d0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/MemorizedNpc.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * 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.npchighlight; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.NPC; -import net.runelite.api.NPCDefinition; -import net.runelite.api.coords.WorldPoint; - -@Getter(AccessLevel.PACKAGE) -class MemorizedNpc -{ - private int npcIndex; - private Set npcNames; - private int npcSize; - /** - * The time the npc died at, in game ticks, relative to the tick counter - */ - @Setter(AccessLevel.PACKAGE) - private int diedOnTick; - /** - * The time it takes for the npc to respawn, in game ticks - */ - @Setter(AccessLevel.PACKAGE) - private int respawnTime; - @Setter(AccessLevel.PACKAGE) - private List possibleRespawnLocations; - - MemorizedNpc(final NPC npc) - { - this.npcNames = new HashSet<>(); - this.npcNames.add(npc.getName()); - this.npcIndex = npc.getIndex(); - this.possibleRespawnLocations = new ArrayList<>(); - this.respawnTime = -1; - this.diedOnTick = -1; - - final NPCDefinition composition = npc.getTransformedDefinition(); - - if (composition != null) - { - this.npcSize = composition.getSize(); - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsConfig.java deleted file mode 100644 index b7841dc5f7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsConfig.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.npchighlight; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("npcindicators") -public interface NpcIndicatorsConfig extends Config -{ - @ConfigItem( - position = 0, - keyName = "highlightStyle", - name = "Highlight Style", - description = "Highlight setting" - ) - default RenderStyle renderStyle() - { - return RenderStyle.THIN_OUTLINE; - } - - @ConfigItem( - position = 1, - keyName = "npcToHighlight", - name = "NPCs to Highlight", - description = "List of NPC names to highlight" - ) - default String getNpcToHighlight() - { - return ""; - } - - @ConfigItem( - position = 2, - keyName = "npcColor", - name = "Highlight Color", - description = "Color of the NPC highlight" - ) - default Color getHighlightColor() - { - return Color.CYAN; - } - - @ConfigItem( - position = 2, - keyName = "interactingColor", - name = "Interacting Color", - description = "Color of the NPC highlight when targeting local player" - ) - default Color getInteractingColor() - { - return Color.RED; - } - - @ConfigItem( - position = 3, - keyName = "drawNames", - name = "Draw names above NPC", - description = "Configures whether or not NPC names should be drawn above the NPC" - ) - default boolean drawNames() - { - return false; - } - - @ConfigItem( - position = 4, - keyName = "drawInteracting", - name = "Draw target name above NPC", - description = "Configures whether the name of the NPC's target is drawn above it's head" - ) - default boolean drawInteracting() - { - return false; - } - - @ConfigItem( - position = 5, - keyName = "drawMinimapNames", - name = "Draw names on minimap", - description = "Configures whether or not NPC names should be drawn on the minimap" - ) - default boolean drawMinimapNames() - { - return false; - } - - @ConfigItem( - position = 6, - keyName = "highlightMenuNames", - name = "Highlight menu names", - description = "Highlight NPC names in right click menu" - ) - default boolean highlightMenuNames() - { - return false; - } - - @ConfigItem( - position = 7, - keyName = "showRespawnTimer", - name = "Show respawn timer", - description = "Show respawn timer of tagged NPCs") - default boolean showRespawnTimer() - { - return false; - } - - @ConfigItem( - position = 7, - keyName = "notifyOnRespawn", - name = "Notify on Respawn", - description = "Enable notification on respawn") - default boolean getNotifyOnRespawn() - { - return false; - } - - @ConfigItem( - position = 8, - keyName = "notifyOnRespawnDelay", - name = "Notification Delay", - description = "Notify when NPC is x ms from respawning") - default int getNotifyOnRespawnDelay() - { - return -1; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsInput.java b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsInput.java deleted file mode 100644 index 82cf727fb1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsInput.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.npchighlight; - -import java.awt.event.KeyEvent; -import javax.inject.Inject; -import net.runelite.client.input.KeyListener; - -class NpcIndicatorsInput implements KeyListener -{ - private static final int HOTKEY = KeyEvent.VK_SHIFT; - - @Inject - private NpcIndicatorsPlugin plugin; - - @Override - public void keyTyped(KeyEvent e) - { - - } - - @Override - public void keyPressed(KeyEvent e) - { - if (e.getKeyCode() == HOTKEY) - { - plugin.setHotKeyPressed(true); - } - } - - @Override - public void keyReleased(KeyEvent e) - { - if (e.getKeyCode() == HOTKEY) - { - plugin.setHotKeyPressed(false); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPlugin.java deleted file mode 100644 index 226997b2ff..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPlugin.java +++ /dev/null @@ -1,737 +0,0 @@ -/* - * Copyright (c) 2018, James Swindle - * Copyright (c) 2018, 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.npchighlight; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.collect.ImmutableSet; -import com.google.inject.Provides; -import java.awt.Color; -import java.text.DecimalFormat; -import java.text.NumberFormat; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Locale; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.GraphicID; -import net.runelite.api.GraphicsObject; -import net.runelite.api.MenuOpcode; -import static net.runelite.api.MenuOpcode.MENU_ACTION_DEPRIORITIZE_OFFSET; -import net.runelite.api.NPC; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.FocusChanged; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.GraphicsObjectCreated; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.NpcDefinitionChanged; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.client.Notifier; -import net.runelite.api.util.Text; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.input.KeyManager; -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.ColorUtil; -import net.runelite.client.util.WildcardMatcher; - -@PluginDescriptor( - name = "NPC Indicators", - description = "Highlight NPCs on-screen and/or on the minimap", - tags = {"highlight", "minimap", "npcs", "overlay", "respawn", "tags"}, - type = PluginType.UTILITY -) -@Slf4j -@Singleton -public class NpcIndicatorsPlugin extends Plugin -{ - private static final int MAX_ACTOR_VIEW_RANGE = 15; - - // Estimated time of a game tick in seconds - private static final double ESTIMATED_TICK_LENGTH = 0.6; - - private static final NumberFormat TIME_LEFT_FORMATTER = DecimalFormat.getInstance(Locale.getDefault()); - - static - { - ((DecimalFormat)TIME_LEFT_FORMATTER).applyPattern("#0.0"); - } - - // Option added to NPC menu - private static final String TAG = "Tag"; - private static final String UNTAG = "Un-tag"; - - private static final Set NPC_MENU_ACTIONS = ImmutableSet.of( - MenuOpcode.NPC_FIRST_OPTION, - MenuOpcode.NPC_SECOND_OPTION, - MenuOpcode.NPC_THIRD_OPTION, - MenuOpcode.NPC_FOURTH_OPTION, - MenuOpcode.NPC_FIFTH_OPTION - ); - - @Inject - private Client client; - - @Inject - private NpcIndicatorsConfig config; - - @Inject - private OverlayManager overlayManager; - - @Inject - private NpcSceneOverlay npcSceneOverlay; - - @Inject - private NpcMinimapOverlay npcMinimapOverlay; - - @Inject - private NpcIndicatorsInput inputListener; - - @Inject - private KeyManager keyManager; - - @Inject - private ClientThread clientThread; - - @Setter(AccessLevel.PACKAGE) - private boolean hotKeyPressed = false; - - @Inject - private Notifier notifier; - - /** - * NPCs to highlight - */ - @Getter(AccessLevel.PACKAGE) - private final Set highlightedNpcs = new HashSet<>(); - - /** - * NPCs to notify when close to spawning - */ - @Getter(AccessLevel.PACKAGE) - private final Set pendingNotificationNpcs = new HashSet<>(); - - /** - * Dead NPCs that should be displayed with a respawn indicator if the config is on. - */ - @Getter(AccessLevel.PACKAGE) - private final Map deadNpcsToDisplay = new HashMap<>(); - - /** - * The time when the last game tick event ran. - */ - @Getter(AccessLevel.PACKAGE) - private Instant lastTickUpdate; - - /** - * Tagged NPCs that have died at some point, which are memorized to - * remember when and where they will respawn - */ - private final Map memorizedNpcs = new HashMap<>(); - - /** - * Highlight strings from the configuration - */ - private List highlights = new ArrayList<>(); - - /** - * NPC ids marked with the Tag option - */ - private final Set npcTags = new HashSet<>(); - - /** - * Tagged NPCs that spawned this tick, which need to be verified that - * they actually spawned and didn't just walk into view range. - */ - private final List spawnedNpcsThisTick = new ArrayList<>(); - - /** - * Tagged NPCs that despawned this tick, which need to be verified that - * they actually spawned and didn't just walk into view range. - */ - private final List despawnedNpcsThisTick = new ArrayList<>(); - - /** - * World locations of graphics object which indicate that an - * NPC teleported that were played this tick. - */ - private final Set teleportGraphicsObjectSpawnedThisTick = new HashSet<>(); - - /** - * The players location on the last game tick. - */ - private WorldPoint lastPlayerLocation; - - /** - * When hopping worlds, NPCs can spawn without them actually respawning, - * so we would not want to mark it as a real spawn in those cases. - */ - private boolean skipNextSpawnCheck = false; - - @Getter(AccessLevel.PACKAGE) - private RenderStyle renderStyle; - @Setter(AccessLevel.PACKAGE) - private String getNpcToHighlight; - @Getter(AccessLevel.PACKAGE) - private Color getHighlightColor; - @Getter(AccessLevel.PACKAGE) - private Color getInteractingColor; - @Getter(AccessLevel.PACKAGE) - private boolean drawNames; - @Getter(AccessLevel.PACKAGE) - private boolean drawInteracting; - @Getter(AccessLevel.PACKAGE) - private boolean drawMinimapNames; - @Getter(AccessLevel.PACKAGE) - private boolean highlightMenuNames; - @Getter(AccessLevel.PACKAGE) - private boolean showRespawnTimer; - @Getter(AccessLevel.PACKAGE) - private boolean getNotifyOnRespawn; - @Getter(AccessLevel.PACKAGE) - private int getNotifyOnRespawnDelay; - - @Provides - NpcIndicatorsConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(NpcIndicatorsConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(npcSceneOverlay); - overlayManager.add(npcMinimapOverlay); - keyManager.registerKeyListener(inputListener); - highlights = getHighlights(); - clientThread.invoke(() -> - { - skipNextSpawnCheck = true; - rebuildAllNpcs(); - }); - } - - @Override - protected void shutDown() - { - overlayManager.remove(npcSceneOverlay); - overlayManager.remove(npcMinimapOverlay); - deadNpcsToDisplay.clear(); - pendingNotificationNpcs.clear(); - memorizedNpcs.clear(); - spawnedNpcsThisTick.clear(); - despawnedNpcsThisTick.clear(); - teleportGraphicsObjectSpawnedThisTick.clear(); - npcTags.clear(); - highlightedNpcs.clear(); - keyManager.unregisterKeyListener(inputListener); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGIN_SCREEN || - event.getGameState() == GameState.HOPPING) - { - highlightedNpcs.clear(); - deadNpcsToDisplay.clear(); - pendingNotificationNpcs.clear(); - memorizedNpcs.forEach((id, npc) -> npc.setDiedOnTick(-1)); - lastPlayerLocation = null; - skipNextSpawnCheck = true; - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged configChanged) - { - if (!configChanged.getGroup().equals("npcindicators")) - { - return; - } - - updateConfig(); - - highlights = getHighlights(); - rebuildAllNpcs(); - } - - @Subscribe - private void onFocusChanged(FocusChanged focusChanged) - { - if (!focusChanged.isFocused()) - { - hotKeyPressed = false; - } - } - - @Subscribe - private void onMenuEntryAdded(MenuEntryAdded event) - { - int type = event.getOpcode(); - - if (type >= MENU_ACTION_DEPRIORITIZE_OFFSET) - { - type -= MENU_ACTION_DEPRIORITIZE_OFFSET; - } - - if (this.highlightMenuNames && - NPC_MENU_ACTIONS.contains(MenuOpcode.of(type)) && - highlightedNpcs.stream().anyMatch(npc -> npc.getIndex() == event.getIdentifier())) - { - final String target = ColorUtil.prependColorTag(Text.removeTags(event.getTarget()), this.getHighlightColor); - event.setTarget(target); - event.setModified(); - } - else if (hotKeyPressed && type == MenuOpcode.EXAMINE_NPC.getId()) - { - // Add tag option - client.insertMenuItem( - highlightedNpcs.stream().anyMatch(npc -> npc.getIndex() == event.getIdentifier()) ? UNTAG : TAG, - event.getTarget(), - MenuOpcode.RUNELITE.getId(), - event.getIdentifier(), - event.getParam0(), - event.getParam1(), - false - ); - } - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked click) - { - if (click.getMenuOpcode() != MenuOpcode.RUNELITE || - !(click.getOption().equals(TAG) || click.getOption().equals(UNTAG))) - { - return; - } - - final int id = click.getIdentifier(); - final boolean removed = npcTags.remove(id); - final NPC[] cachedNPCs = client.getCachedNPCs(); - final NPC npc = cachedNPCs[id]; - - if (npc == null || npc.getName() == null) - { - return; - } - - if (removed) - { - MemorizedNpc mn = memorizedNpcs.get(npc.getIndex()); - if (mn != null && isNpcMemorizationUnnecessary(mn)) - { - memorizedNpcs.remove(npc.getIndex()); - rebuildAllNpcs(); - } - } - else - { - npcTags.add(id); - rebuildAllNpcs(); - } - - click.consume(); - } - - @Subscribe - private void onNpcSpawned(NpcSpawned npcSpawned) - { - NPC npc = npcSpawned.getNpc(); - highlightNpcIfMatch(npc); - - if (memorizedNpcs.containsKey(npc.getIndex())) - { - spawnedNpcsThisTick.add(npc); - } - } - - @Subscribe - private void onNpcDefinitionChanged(NpcDefinitionChanged event) - { - NPC npc = event.getNpc(); - highlightNpcIfMatch(npc); - - MemorizedNpc mn = memorizedNpcs.get(npc.getIndex()); - if (mn != null) - { - String npcName = npc.getName(); - if (npcName != null) - { - mn.getNpcNames().add(npcName); - } - } - } - - @Subscribe - private void onNpcDespawned(NpcDespawned npcDespawned) - { - final NPC npc = npcDespawned.getNpc(); - - if (memorizedNpcs.containsKey(npc.getIndex())) - { - despawnedNpcsThisTick.add(npc); - MemorizedNpc mn = memorizedNpcs.get(npc.getIndex()); - - if (!mn.getPossibleRespawnLocations().isEmpty()) - { - pendingNotificationNpcs.add(mn); - } - } - - highlightedNpcs.remove(npc); - } - - @Subscribe - private void onGraphicsObjectCreated(GraphicsObjectCreated event) - { - final GraphicsObject go = event.getGraphicsObject(); - - if (go.getId() == GraphicID.GREY_BUBBLE_TELEPORT) - { - teleportGraphicsObjectSpawnedThisTick.add(WorldPoint.fromLocal(client, go.getLocation())); - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - removeOldHighlightedRespawns(); - validateSpawnedNpcs(); - checkNotifyNpcs(); - lastTickUpdate = Instant.now(); - lastPlayerLocation = client.getLocalPlayer().getWorldLocation(); - } - - private static boolean isInViewRange(WorldPoint wp1, WorldPoint wp2) - { - int distance = wp1.distanceTo(wp2); - return distance < MAX_ACTOR_VIEW_RANGE; - } - - private static WorldPoint getWorldLocationBehind(NPC npc) - { - final int orientation = npc.getOrientation() / 256; - int dx = 0, dy = 0; - - switch (orientation) - { - case 0: // South - dy = -1; - break; - case 1: // Southwest - dx = -1; - dy = -1; - break; - case 2: // West - dx = -1; - break; - case 3: // Northwest - dx = -1; - dy = 1; - break; - case 4: // North - dy = 1; - break; - case 5: // Northeast - dx = 1; - dy = 1; - break; - case 6: // East - dx = 1; - break; - case 7: // Southeast - dx = 1; - dy = -1; - break; - } - - final WorldPoint currWP = npc.getWorldLocation(); - return new WorldPoint(currWP.getX() - dx, currWP.getY() - dy, currWP.getPlane()); - } - - private void highlightNpcIfMatch(final NPC npc) - { - if (npcTags.contains(npc.getIndex())) - { - memorizeNpc(npc); - highlightedNpcs.add(npc); - return; - } - - final String npcName = npc.getName(); - if (npcName != null) - { - for (String highlight : highlights) - { - if (WildcardMatcher.matches(highlight, npcName)) - { - memorizeNpc(npc); - highlightedNpcs.add(npc); - return; - } - } - } - - highlightedNpcs.remove(npc); - } - - public double getTimeLeftForNpc(MemorizedNpc npc) - { - final Instant now = Instant.now(); - final double baseTick = NpcIndicatorsPlugin.ESTIMATED_TICK_LENGTH * ( - npc.getDiedOnTick() + npc.getRespawnTime() - client.getTickCount() - ); - final double sinceLast = (now.toEpochMilli() - lastTickUpdate.toEpochMilli()) / 1000.0; - return Math.max(0.0, baseTick - sinceLast); - } - - private void memorizeNpc(NPC npc) - { - final int npcIndex = npc.getIndex(); - memorizedNpcs.putIfAbsent(npcIndex, new MemorizedNpc(npc)); - } - - private boolean isNpcMemorizationUnnecessary(final MemorizedNpc mn) - { - if (npcTags.contains(mn.getNpcIndex())) - { - return false; - } - - for (String npcName : mn.getNpcNames()) - { - for (String highlight : highlights) - { - if (WildcardMatcher.matches(highlight, npcName)) - { - return false; - } - } - } - - return true; - } - - private void removeOldHighlightedRespawns() - { - deadNpcsToDisplay.values().removeIf(x -> x.getDiedOnTick() + x.getRespawnTime() <= client.getTickCount() + 1); - } - - @VisibleForTesting - List getHighlights() - { - final String configNpcs = this.getNpcToHighlight.toLowerCase(); - - if (configNpcs.isEmpty()) - { - return Collections.emptyList(); - } - - return Text.fromCSV(configNpcs); - } - - private void rebuildAllNpcs() - { - highlightedNpcs.clear(); - - if (client.getGameState() != GameState.LOGGED_IN && - client.getGameState() != GameState.LOADING) - { - // NPCs are still in the client after logging out, - // but we don't want to highlight those. - return; - } - - Iterator> it = memorizedNpcs.entrySet().iterator(); - while (it.hasNext()) - { - MemorizedNpc mn = it.next().getValue(); - - if (isNpcMemorizationUnnecessary(mn)) - { - deadNpcsToDisplay.remove(mn.getNpcIndex()); - it.remove(); - } - } - - for (NPC npc : client.getNpcs()) - { - highlightNpcIfMatch(npc); - } - } - - public String formatTime(double time) - { - return TIME_LEFT_FORMATTER.format(time); - } - - private void checkNotifyNpcs() - { - if (!this.getNotifyOnRespawn) - { - return; - } - - final double notifyDelay = ((double)this.getNotifyOnRespawnDelay) / 1000; - final String notifyDelayStr = notifyDelay > 0 - ? " is less than " + formatTime(notifyDelay) + " seconds from respawn" - : " respawned."; - - for (MemorizedNpc npc : pendingNotificationNpcs) - { - if (getTimeLeftForNpc(npc) <= notifyDelay) - { - pendingNotificationNpcs.remove(npc); - notifier.notify(npc.getNpcNames() + notifyDelayStr); - } - } - } - - private void validateSpawnedNpcs() - { - if (skipNextSpawnCheck) - { - skipNextSpawnCheck = false; - } - else - { - - for (NPC npc : despawnedNpcsThisTick) - { - if (!teleportGraphicsObjectSpawnedThisTick.isEmpty() && teleportGraphicsObjectSpawnedThisTick.contains(npc.getWorldLocation())) - { - // NPC teleported away, so we don't want to add the respawn timer - continue; - } - - if (isInViewRange(client.getLocalPlayer().getWorldLocation(), npc.getWorldLocation())) - { - final MemorizedNpc mn = memorizedNpcs.get(npc.getIndex()); - - if (mn != null) - { - mn.setDiedOnTick(client.getTickCount() + 1); // This runs before tickCounter updates, so we add 1 - - if (!mn.getPossibleRespawnLocations().isEmpty()) - { - log.debug("Starting {} tick countdown for {}", mn.getRespawnTime(), mn.getNpcNames().iterator().next()); - deadNpcsToDisplay.put(mn.getNpcIndex(), mn); - } - } - } - } - - for (NPC npc : spawnedNpcsThisTick) - { - if (!teleportGraphicsObjectSpawnedThisTick.isEmpty() && - (teleportGraphicsObjectSpawnedThisTick.contains(npc.getWorldLocation()) || - teleportGraphicsObjectSpawnedThisTick.contains(getWorldLocationBehind(npc)))) - { - // NPC teleported here, so we don't want to update the respawn timer - continue; - } - - if (lastPlayerLocation != null && isInViewRange(lastPlayerLocation, npc.getWorldLocation())) - { - final MemorizedNpc mn = memorizedNpcs.get(npc.getIndex()); - - if (mn.getDiedOnTick() != -1) - { - final int respawnTime = client.getTickCount() + 1 - mn.getDiedOnTick(); - - // By killing a monster and leaving the area before seeing it again, an erroneously lengthy - // respawn time can be recorded. Thus, if the respawn time is already set and is greater than - // the observed time, assume that the lower observed respawn time is correct. - if (mn.getRespawnTime() == -1 || respawnTime < mn.getRespawnTime()) - { - mn.setRespawnTime(respawnTime); - } - - mn.setDiedOnTick(-1); - } - - final WorldPoint npcLocation = npc.getWorldLocation(); - - // An NPC can move in the same tick as it spawns, so we also have - // to consider whatever tile is behind the npc - final WorldPoint possibleOtherNpcLocation = getWorldLocationBehind(npc); - - mn.getPossibleRespawnLocations().removeIf(x -> - x.distanceTo(npcLocation) != 0 && x.distanceTo(possibleOtherNpcLocation) != 0); - - if (mn.getPossibleRespawnLocations().isEmpty()) - { - mn.getPossibleRespawnLocations().add(npcLocation); - mn.getPossibleRespawnLocations().add(possibleOtherNpcLocation); - } - } - } - } - - spawnedNpcsThisTick.clear(); - despawnedNpcsThisTick.clear(); - teleportGraphicsObjectSpawnedThisTick.clear(); - } - - private void updateConfig() - { - this.renderStyle = config.renderStyle(); - this.getNpcToHighlight = config.getNpcToHighlight(); - this.getHighlightColor = config.getHighlightColor(); - this.getInteractingColor = config.getInteractingColor(); - this.drawNames = config.drawNames(); - this.drawInteracting = config.drawInteracting(); - this.drawMinimapNames = config.drawMinimapNames(); - this.highlightMenuNames = config.highlightMenuNames(); - this.showRespawnTimer = config.showRespawnTimer(); - this.getNotifyOnRespawn = config.getNotifyOnRespawn(); - this.getNotifyOnRespawnDelay = config.getNotifyOnRespawnDelay(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcMinimapOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcMinimapOverlay.java deleted file mode 100644 index a729fe20cc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcMinimapOverlay.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2018, James Swindle - * Copyright (c) 2018, 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.npchighlight; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -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.OverlayUtil; - -@Singleton -public class NpcMinimapOverlay extends Overlay -{ - private final NpcIndicatorsPlugin plugin; - - @Inject - NpcMinimapOverlay(final NpcIndicatorsPlugin plugin) - { - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - } - - @Override - public Dimension render(Graphics2D graphics) - { - for (NPC npc : plugin.getHighlightedNpcs()) - { - renderNpcOverlay(graphics, npc, npc.getName(), plugin.getGetHighlightColor()); - } - - return null; - } - - private void renderNpcOverlay(Graphics2D graphics, NPC actor, String name, Color color) - { - final Point minimapLocation = actor.getMinimapLocation(); - - if (minimapLocation != null) - { - OverlayUtil.renderMinimapLocation(graphics, minimapLocation, color.darker()); - - if (plugin.isDrawMinimapNames()) - { - OverlayUtil.renderTextLocation(graphics, minimapLocation, name, color); - } - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java deleted file mode 100644 index e3cee750a1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcSceneOverlay.java +++ /dev/null @@ -1,313 +0,0 @@ -/* - * Copyright (c) 2018, James Swindle - * Copyright (c) 2018, 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.npchighlight; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.Shape; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.NPCDefinition; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldArea; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.util.Text; -import net.runelite.client.graphics.ModelOutlineRenderer; -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; - -@Singleton -public class NpcSceneOverlay extends Overlay -{ - private static final Color TRANSPARENT = new Color(0, 0, 0, 0); - - // Anything but white text is quite hard to see since it is drawn on - // a dark background - private static final Color TEXT_COLOR = Color.WHITE; - - - - private final Client client; - private final NpcIndicatorsPlugin plugin; - private final ModelOutlineRenderer modelOutliner; - - @Inject - NpcSceneOverlay(final Client client, final NpcIndicatorsPlugin plugin, final ModelOutlineRenderer modelOutliner) - { - this.client = client; - this.plugin = plugin; - this.modelOutliner = modelOutliner; - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.isShowRespawnTimer()) - { - plugin.getDeadNpcsToDisplay().forEach((id, npc) -> renderNpcRespawn(npc, graphics)); - } - - for (NPC npc : plugin.getHighlightedNpcs()) - { - renderNpcOverlay(graphics, npc, plugin.getGetHighlightColor()); - } - - return null; - } - - private void renderNpcRespawn(final MemorizedNpc npc, final Graphics2D graphics) - { - if (npc.getPossibleRespawnLocations().isEmpty()) - { - return; - } - - final WorldPoint respawnLocation = npc.getPossibleRespawnLocations().get(0); - final LocalPoint lp = LocalPoint.fromWorld(client, respawnLocation.getX(), respawnLocation.getY()); - - if (lp == null) - { - return; - } - - final Color color = plugin.getGetHighlightColor(); - - final LocalPoint centerLp = new LocalPoint( - lp.getX() + Perspective.LOCAL_TILE_SIZE * (npc.getNpcSize() - 1) / 2, - lp.getY() + Perspective.LOCAL_TILE_SIZE * (npc.getNpcSize() - 1) / 2); - - final Polygon poly = Perspective.getCanvasTileAreaPoly(client, centerLp, npc.getNpcSize()); - - if (poly != null) - { - OverlayUtil.renderPolygon(graphics, poly, color); - } - - - final String timeLeftStr = plugin.formatTime(plugin.getTimeLeftForNpc(npc)); - - final int textWidth = graphics.getFontMetrics().stringWidth(timeLeftStr); - final int textHeight = graphics.getFontMetrics().getAscent(); - - final Point canvasPoint = Perspective - .localToCanvas(client, centerLp, respawnLocation.getPlane()); - - if (canvasPoint != null) - { - final Point canvasCenterPoint = new Point( - canvasPoint.getX() - textWidth / 2, - canvasPoint.getY() + textHeight / 2); - - OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, timeLeftStr, TEXT_COLOR); - } - } - - private void renderNpcOverlay(Graphics2D graphics, NPC actor, Color color) - { - if (plugin.isDrawInteracting() && actor.getInteracting() != null - && actor.getInteracting() == client.getLocalPlayer()) - { - color = plugin.getGetInteractingColor(); - } - - switch (plugin.getRenderStyle()) - { - case SOUTH_WEST_TILE: - { - int size = 1; - NPCDefinition composition = actor.getTransformedDefinition(); - if (composition != null) - { - size = composition.getSize(); - } - - LocalPoint localPoint = actor.getLocalLocation(); - - int x = localPoint.getX() - ((size - 1) * Perspective.LOCAL_TILE_SIZE / 2); - int y = localPoint.getY() - ((size - 1) * Perspective.LOCAL_TILE_SIZE / 2); - - Polygon tilePoly = Perspective.getCanvasTilePoly(client, new LocalPoint(x, y)); - - renderPoly(graphics, color, tilePoly); - break; - } - case TILE: - { - int size = 1; - NPCDefinition composition = actor.getTransformedDefinition(); - if (composition != null) - { - size = composition.getSize(); - } - final LocalPoint lp = actor.getLocalLocation(); - final Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size); - renderPoly(graphics, color, tilePoly); - break; - } - case THIN_TILE: - { - int size = 1; - NPCDefinition composition = actor.getTransformedDefinition(); - if (composition != null) - { - size = composition.getSize(); - } - final LocalPoint lp = actor.getLocalLocation(); - final Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size); - renderPoly(graphics, color, tilePoly, 1); - break; - } - case HULL: - final Shape objectClickbox = actor.getConvexHull(); - graphics.setColor(color); - graphics.draw(objectClickbox); - break; - case THIN_OUTLINE: - modelOutliner.drawOutline(actor, 1, color); - break; - case OUTLINE: - modelOutliner.drawOutline(actor, 2, color); - break; - case THIN_GLOW: - modelOutliner.drawOutline(actor, 4, color, TRANSPARENT); - break; - case GLOW: - modelOutliner.drawOutline(actor, 8, color, TRANSPARENT); - break; - case TRUE_LOCATIONS: - { - int size = 1; - NPCDefinition composition = actor.getTransformedDefinition(); - - if (composition != null) - { - size = composition.getSize(); - } - - final WorldPoint wp = actor.getWorldLocation(); - final Color squareColor = color; - - getSquare(wp, size).forEach(square -> - drawTile(graphics, square, squareColor, 1, 255, 50)); - break; - } - } - - if (plugin.isDrawNames() && actor.getName() != null) - { - final String npcName = Text.removeTags(actor.getName()); - final Point textLocation = actor.getCanvasTextLocation(graphics, npcName, actor.getLogicalHeight() + 40); - - if (textLocation != null) - { - OverlayUtil.renderTextLocation(graphics, textLocation, npcName, color); - } - } - - if (plugin.isDrawInteracting() && actor.getInteracting() != null) - { - final int drawHeight = plugin.isDrawNames() ? 80 : 40; - final String targetName = Text.removeTags(actor.getInteracting().getName()); - final Point textLocation = actor.getCanvasTextLocation(graphics, targetName, actor.getLogicalHeight() + drawHeight); - - if (textLocation != null) - { - OverlayUtil.renderTextLocation(graphics, textLocation, targetName, color); - } - } - } - - 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); - } - } - - private void renderPoly(Graphics2D graphics, Color color, Polygon polygon, int width) - { - if (polygon != null) - { - graphics.setColor(color); - graphics.setStroke(new BasicStroke(width)); - graphics.draw(polygon); - graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20)); - graphics.fill(polygon); - } - } - - private List getSquare(WorldPoint npcLoc, int npcSize) - { - return new WorldArea(npcLoc.getX(), npcLoc.getY(), npcSize, npcSize, npcLoc.getPlane()).toWorldPointList(); - } - - private void drawTile(Graphics2D graphics, WorldPoint point, Color color, int strokeWidth, int outlineAlpha, int fillAlpha) - { - WorldPoint playerLocation = client.getLocalPlayer().getWorldLocation(); - - if (point.distanceTo(playerLocation) >= 32) - { - return; - } - - LocalPoint lp = LocalPoint.fromWorld(client, point); - - if (lp == null) - { - return; - } - - Polygon poly = Perspective.getCanvasTilePoly(client, lp); - - if (poly == null) - { - return; - } - - 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); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/RenderStyle.java b/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/RenderStyle.java deleted file mode 100644 index 1aab499c18..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/RenderStyle.java +++ /dev/null @@ -1,39 +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.npchighlight; - -public enum RenderStyle -{ - OFF, - TILE, - THIN_TILE, - HULL, - SOUTH_WEST_TILE, - THIN_OUTLINE, - OUTLINE, - THIN_GLOW, - GLOW, - TRUE_LOCATIONS -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/MemorizedNPC.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/MemorizedNPC.java deleted file mode 100644 index a95f30014a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/MemorizedNPC.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2019, GeChallengeM - * 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.npcstatus; - -import java.awt.Color; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.Actor; -import net.runelite.api.NPC; -import net.runelite.api.coords.WorldArea; - -@Getter(AccessLevel.PACKAGE) -class MemorizedNPC -{ - private NPC npc; - private int npcIndex; - private String npcName; - private int attackSpeed; - @Setter(AccessLevel.PACKAGE) - private int combatTimerEnd; - @Setter(AccessLevel.PACKAGE) - private int timeLeft; - @Setter(AccessLevel.PACKAGE) - private int flinchTimerEnd; - @Setter(AccessLevel.PACKAGE) - private Status status; - @Setter(AccessLevel.PACKAGE) - private WorldArea lastnpcarea; - @Setter(AccessLevel.PACKAGE) - private Actor lastinteracted; - - MemorizedNPC(final NPC npc, final int attackSpeed, final WorldArea worldArea) - { - this.npc = npc; - this.npcIndex = npc.getIndex(); - this.npcName = npc.getName(); - this.attackSpeed = attackSpeed; - this.combatTimerEnd = -1; - this.flinchTimerEnd = -1; - this.timeLeft = 0; - this.status = Status.OUT_OF_COMBAT; - this.lastnpcarea = worldArea; - this.lastinteracted = null; - } - - @Getter(AccessLevel.PACKAGE) - @AllArgsConstructor - enum Status - { - FLINCHING("Flinching", Color.GREEN), - IN_COMBAT_DELAY("In Combat Delay", Color.ORANGE), - IN_COMBAT("In Combat", Color.RED), - OUT_OF_COMBAT("Out of Combat", Color.BLUE); - - private String name; - private Color color; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusConfig.java deleted file mode 100644 index b1c8d45a35..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusConfig.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2019, GeChallengeM - * 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.npcstatus; - -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("npcstatus") -public interface NpcStatusConfig extends Config -{ - @Range( - min = 1 - ) - @ConfigItem( - keyName = "AttackRange", - name = "NPC attack range", - description = "The attack range of the NPC.", - position = 1 - ) - default int getRange() - { - return 1; - } - - @ConfigItem( - keyName = "CustomAttSpeedEnabled", - name = "Custom attack speed", - description = "Use this if the timer is wrong.", - position = 2 - ) - default boolean isCustomAttSpeed() - { - return false; - } - - @Range( - min = 1 - ) - @ConfigItem( - keyName = "CustomAttSpeed", - name = "Custom NPC att speed", - description = "The attack speed of the NPC (amount of ticks between their attacks).", - position = 3, - hidden = true, - unhide = "CustomAttSpeedEnabled" - ) - default int getCustomAttSpeed() - { - return 4; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusOverlay.java deleted file mode 100644 index f71dd7aa4b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusOverlay.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2018, GeChallengeM - * 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.npcstatus; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -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.OverlayUtil; - -@Singleton -public class NpcStatusOverlay extends Overlay -{ - private final Client client; - private final NpcStatusPlugin plugin; - - @Inject - NpcStatusOverlay(final Client client, final NpcStatusPlugin plugin) - { - this.client = client; - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D graphics) - { - for (MemorizedNPC npc : plugin.getMemorizedNPCs()) - { - if (npc.getNpc().getInteracting() == client.getLocalPlayer() || client.getLocalPlayer().getInteracting() == npc.getNpc()) - { - switch (npc.getStatus()) - { - case FLINCHING: - npc.setTimeLeft(Math.max(0, npc.getFlinchTimerEnd() - client.getTickCount())); - break; - case IN_COMBAT_DELAY: - npc.setTimeLeft(Math.max(0, npc.getCombatTimerEnd() - client.getTickCount() - 7)); - break; - case IN_COMBAT: - npc.setTimeLeft(Math.max(0, npc.getCombatTimerEnd() - client.getTickCount())); - break; - case OUT_OF_COMBAT: - default: - npc.setTimeLeft(0); - break; - } - - Point textLocation = npc.getNpc().getCanvasTextLocation(graphics, Integer.toString(npc.getTimeLeft()), npc.getNpc().getLogicalHeight() + 40); - - if (textLocation != null) - { - OverlayUtil.renderTextLocation(graphics, textLocation, Integer.toString(npc.getTimeLeft()), npc.getStatus().getColor()); - } - } - } - return null; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusPlugin.java deleted file mode 100644 index 92066fc671..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npcstatus/NpcStatusPlugin.java +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright (c) 2019, GeChallengeM - * 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.npcstatus; - -import com.google.inject.Provides; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.GraphicID; -import net.runelite.api.Hitsplat; -import net.runelite.api.NPC; -import net.runelite.api.coords.WorldArea; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.HitsplatApplied; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.events.SpotAnimationChanged; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@Slf4j -@PluginDescriptor( - name = "NPC Status Timer", - description = "Adds a timer on NPC's for their attacks and flinching.", - tags = {"flinch", "npc"}, - type = PluginType.PVM, - enabledByDefault = false -) -@Singleton -public class NpcStatusPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private NPCManager npcManager; - - @Inject - private NpcStatusConfig config; - - @Inject - private NpcStatusOverlay npcStatusOverlay; - - @Getter(AccessLevel.PACKAGE) - private final Set memorizedNPCs = new HashSet<>(); - - @Getter(AccessLevel.PACKAGE) - private boolean isCustomAttSpeed; - - private int getCustomAttSpeed; - - private int getRange; - - private WorldArea lastPlayerLocation; - - @Provides - NpcStatusConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(NpcStatusConfig.class); - } - - @Override - protected void startUp() - { - - this.getRange = config.getRange(); - overlayManager.add(npcStatusOverlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(npcStatusOverlay); - memorizedNPCs.clear(); - } - - @Subscribe - private void onNpcSpawned(NpcSpawned npcSpawned) - { - final NPC npc = npcSpawned.getNpc(); - final String npcName = npc.getName(); - - if (npcName == null || !Arrays.asList(npc.getDefinition().getActions()).contains("Attack")) - { - return; - } - int AttackSpeed = npcManager.getAttackSpeed(npc.getId()); - if (AttackSpeed == 0) - { - AttackSpeed = 4; - } - memorizedNPCs.add(new MemorizedNPC(npc, AttackSpeed, npc.getWorldArea())); - } - - @Subscribe - private void onNpcDespawned(NpcDespawned npcDespawned) - { - final NPC npc = npcDespawned.getNpc(); - memorizedNPCs.removeIf(c -> c.getNpc() == npc); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGIN_SCREEN || - event.getGameState() == GameState.HOPPING) - { - memorizedNPCs.clear(); - } - } - - @Subscribe - private void onHitsplatApplied(HitsplatApplied event) - { - if (event.getActor().getInteracting() != client.getLocalPlayer()) - { - return; - } - final Hitsplat hitsplat = event.getHitsplat(); - if ((hitsplat.getHitsplatType() == Hitsplat.HitsplatType.DAMAGE || hitsplat.getHitsplatType() == Hitsplat.HitsplatType.BLOCK) && event.getActor() instanceof NPC) - { - for (MemorizedNPC mn : memorizedNPCs) - { - if (mn.getNpcIndex() != ((NPC) event.getActor()).getIndex()) - { - continue; - } - if (mn.getStatus() == MemorizedNPC.Status.OUT_OF_COMBAT || (mn.getStatus() == MemorizedNPC.Status.IN_COMBAT && mn.getCombatTimerEnd() - client.getTickCount() < 1) || mn.getLastinteracted() == null) - { - mn.setStatus(MemorizedNPC.Status.FLINCHING); - mn.setCombatTimerEnd(-1); - if (isCustomAttSpeed()) - { - mn.setFlinchTimerEnd(client.getTickCount() + getCustomAttSpeed / 2 + 1); - } - else - { - mn.setFlinchTimerEnd(client.getTickCount() + mn.getAttackSpeed() / 2 + 1); - } - } - } - } - - } - - @Subscribe - private void onSpotAnimationChanged(SpotAnimationChanged event) - { - if ((event.getActor().getSpotAnimation() == GraphicID.SPLASH) && event.getActor() instanceof NPC) - { - for (MemorizedNPC mn : memorizedNPCs) - { - if (mn.getNpcIndex() != ((NPC) event.getActor()).getIndex()) - { - continue; - } - if (mn.getStatus() == MemorizedNPC.Status.OUT_OF_COMBAT || (mn.getStatus() == MemorizedNPC.Status.IN_COMBAT && mn.getCombatTimerEnd() - client.getTickCount() < 2) || event.getActor().getInteracting() == null) - { - mn.setStatus(MemorizedNPC.Status.FLINCHING); - mn.setCombatTimerEnd(-1); - if (isCustomAttSpeed()) - { - mn.setFlinchTimerEnd(client.getTickCount() + getCustomAttSpeed / 2 + 2); - } - else - { - mn.setFlinchTimerEnd(client.getTickCount() + mn.getAttackSpeed() / 2 + 2); - } - } - } - } - } - - private void checkStatus() - { - if (lastPlayerLocation == null) - { - return; - } - for (MemorizedNPC npc : memorizedNPCs) - { - final double CombatTime = npc.getCombatTimerEnd() - client.getTickCount(); - final double FlinchTime = npc.getFlinchTimerEnd() - client.getTickCount(); - if (npc.getNpc().getWorldArea() == null) - { - continue; - } - if (npc.getNpc().getInteracting() == client.getLocalPlayer()) - { - //Checks: will the NPC attack this tick? - if (((npc.getNpc().getWorldArea().canMelee(client, lastPlayerLocation) && this.getRange == 1) //Separate mechanics for meleerange-only NPC's because they have extra collisiondata checks (fences etc.) and can't attack diagonally - || (lastPlayerLocation.hasLineOfSightTo(client, npc.getNpc().getWorldArea()) && npc.getNpc().getWorldArea().distanceTo(lastPlayerLocation) <= this.getRange && this.getRange > 1)) - && ((npc.getStatus() != MemorizedNPC.Status.FLINCHING && CombatTime < 9) || (npc.getStatus() == MemorizedNPC.Status.FLINCHING && FlinchTime < 2)) - && npc.getNpc().getAnimation() != -1 //Failsafe, attacking NPC's always have an animation. - && !(npc.getLastnpcarea().distanceTo(lastPlayerLocation) == 0 && npc.getLastnpcarea() != npc.getNpc().getWorldArea())) //Weird mechanic: NPC's can't attack on the tick they do a random move - { - npc.setStatus(MemorizedNPC.Status.IN_COMBAT_DELAY); - npc.setLastnpcarea(npc.getNpc().getWorldArea()); - npc.setLastinteracted(npc.getNpc().getInteracting()); - if (isCustomAttSpeed()) - { - npc.setCombatTimerEnd(client.getTickCount() + getCustomAttSpeed + 8); - } - else - { - npc.setCombatTimerEnd(client.getTickCount() + npc.getAttackSpeed() + 8); - } - continue; - } - } - switch (npc.getStatus()) - { - case IN_COMBAT: - if (CombatTime < 2) - { - npc.setStatus(MemorizedNPC.Status.OUT_OF_COMBAT); - } - break; - case IN_COMBAT_DELAY: - if (CombatTime < 9) - { - npc.setStatus(MemorizedNPC.Status.IN_COMBAT); - } - break; - case FLINCHING: - if (FlinchTime < 2) - { - npc.setStatus(MemorizedNPC.Status.IN_COMBAT); - npc.setCombatTimerEnd(client.getTickCount() + 8); - } - } - npc.setLastnpcarea(npc.getNpc().getWorldArea()); - npc.setLastinteracted(npc.getNpc().getInteracting()); - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - checkStatus(); - lastPlayerLocation = client.getLocalPlayer().getWorldArea(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged configChanged) - { - if (!configChanged.getGroup().equals("npcstatus")) - { - return; - } - - this.getRange = config.getRange(); - this.isCustomAttSpeed = config.isCustomAttSpeed(); - this.getCustomAttSpeed = config.getCustomAttSpeed(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/AggressionTimer.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/AggressionTimer.java deleted file mode 100644 index 5a091eaabd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/AggressionTimer.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * 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.npcunaggroarea; - -import java.awt.Color; -import java.awt.image.BufferedImage; -import java.time.Duration; -import java.time.Instant; -import java.time.temporal.ChronoUnit; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.ui.overlay.infobox.Timer; - -class AggressionTimer extends Timer -{ - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private boolean visible; - - AggressionTimer(final Duration duration, final BufferedImage image, final Plugin plugin, final boolean visible) - { - super(duration.toMillis(), ChronoUnit.MILLIS, image, plugin); - setTooltip("Time until NPCs become unaggressive"); - this.visible = visible; - } - - @Override - public Color getTextColor() - { - Duration timeLeft = Duration.between(Instant.now(), getEndTime()); - - if (timeLeft.getSeconds() < 60) - { - return Color.RED.brighter(); - } - - return Color.WHITE; - } - - @Override - public boolean render() - { - return visible && super.render(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaConfig.java deleted file mode 100644 index 46593c4d32..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaConfig.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * 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.npcunaggroarea; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("npcUnaggroArea") -public interface NpcAggroAreaConfig extends Config -{ - String CONFIG_GROUP = "npcUnaggroArea"; - String CONFIG_CENTER1 = "center1"; - String CONFIG_CENTER2 = "center2"; - String CONFIG_LOCATION = "location"; - String CONFIG_DURATION = "duration"; - String CONFIG_NOT_WORKING_OVERLAY = "overlay"; - - @ConfigItem( - keyName = "npcUnaggroAlwaysActive", - name = "Always active", - description = "Always show this plugins overlays
Otherwise, they will only be shown when any NPC name matches the list", - position = 1 - ) - default boolean alwaysActive() - { - return false; - } - - @ConfigItem( - keyName = "npcUnaggroNames", - name = "NPC names", - description = "Enter names of NPCs where you wish to use this plugin", - position = 2 - ) - default String npcNamePatterns() - { - return ""; - } - - @ConfigItem( - keyName = "npcUnaggroShowTimer", - name = "Show timer", - description = "Display a timer until NPCs become unaggressive", - position = 3 - ) - default boolean showTimer() - { - return true; - } - - @ConfigItem( - keyName = "npcUnaggroShowAreaLines", - name = "Show area lines", - description = "Display lines, when walked past, the unaggressive timer resets", - position = 4 - ) - default boolean showAreaLines() - { - return false; - } - - @ConfigItem( - keyName = "npcUnaggroAreaColor", - name = "Area lines colour", - description = "Choose colour to use for marking NPC unaggressive area", - position = 5 - ) - default Color aggroAreaColor() - { - return Color.YELLOW; - } - - @ConfigItem( - keyName = "npcUnaggroShowNotWorkingOverlay", - name = "Show not working hint", - description = "Show hint if plugin is enabled in unsupported area", - position = 6 - ) - default boolean showNotWorkingOverlay() - { - return true; - } - - @ConfigItem( - keyName = "hideOverlayHint", - name = "Hide overlay hint", - description = "Hide overlay hint if plugin is enabled in unsupported area", - position = 6 - ) - default boolean hideOverlayHint() - { - return false; - } - - @ConfigItem( - keyName = "sendNotification", - name = "Send notification", - description = "Send a notification when the timer runs out", - position = 7 - ) - default boolean sendNotification() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaNotWorkingOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaNotWorkingOverlay.java deleted file mode 100644 index 533d4ae93b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaNotWorkingOverlay.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * 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.npcunaggroarea; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.awt.Dimension; -import java.awt.Graphics2D; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; - -@Singleton -class NpcAggroAreaNotWorkingOverlay extends Overlay -{ - private final NpcAggroAreaPlugin plugin; - private final PanelComponent panelComponent; - - @Inject - private NpcAggroAreaNotWorkingOverlay(final NpcAggroAreaPlugin plugin) - { - this.plugin = plugin; - - panelComponent = new PanelComponent(); - panelComponent.setPreferredSize(new Dimension(150, 0)); - panelComponent.getChildren().add(LineComponent.builder() - .left("Unaggressive NPC timers will start working when you teleport far away or enter a dungeon.") - .build()); - - setPriority(OverlayPriority.LOW); - setPosition(OverlayPosition.TOP_LEFT); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isActive() || plugin.getSafeCenters()[1] != null || plugin.isHideOverlayHint()) - { - return null; - } - - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaOverlay.java deleted file mode 100644 index 3fb8cf2bf4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaOverlay.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * 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.npcunaggroarea; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.geom.GeneralPath; -import java.time.Instant; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.geometry.Geometry; -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; - -@Singleton -class NpcAggroAreaOverlay extends Overlay -{ - private static final int MAX_LOCAL_DRAW_LENGTH = 20 * Perspective.LOCAL_TILE_SIZE; - - private final Client client; - private final NpcAggroAreaPlugin plugin; - - @Inject - private NpcAggroAreaOverlay(final Client client, final NpcAggroAreaPlugin plugin) - { - this.client = client; - this.plugin = plugin; - - setLayer(OverlayLayer.ABOVE_SCENE); - setPriority(OverlayPriority.LOW); - setPosition(OverlayPosition.DYNAMIC); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isActive() || plugin.getSafeCenters()[1] == null) - { - return null; - } - - GeneralPath lines = plugin.getLinesToDisplay()[client.getPlane()]; - if (lines == null) - { - return null; - } - - Color outlineColor = plugin.getAggroAreaColor(); - AggressionTimer timer = plugin.getCurrentTimer(); - if (timer == null || Instant.now().compareTo(timer.getEndTime()) < 0) - { - outlineColor = new Color( - outlineColor.getRed(), - outlineColor.getGreen(), - outlineColor.getBlue(), - 100); - } - else - { - plugin.doNotification(); - } - - renderPath(graphics, lines, outlineColor); - return null; - } - - private void renderPath(Graphics2D graphics, GeneralPath path, Color color) - { - LocalPoint playerLp = client.getLocalPlayer().getLocalLocation(); - Rectangle viewArea = new Rectangle( - playerLp.getX() - MAX_LOCAL_DRAW_LENGTH, - playerLp.getY() - MAX_LOCAL_DRAW_LENGTH, - MAX_LOCAL_DRAW_LENGTH * 2, - MAX_LOCAL_DRAW_LENGTH * 2); - - graphics.setColor(color); - graphics.setStroke(new BasicStroke(1)); - - path = Geometry.clipPath(path, viewArea); - path = Geometry.filterPath(path, (p1, p2) -> - Perspective.localToCanvas(client, new LocalPoint((int) p1[0], (int) p1[1]), client.getPlane()) != null && - Perspective.localToCanvas(client, new LocalPoint((int) p2[0], (int) p2[1]), client.getPlane()) != null); - path = Geometry.transformPath(path, coords -> - { - Point point = Perspective.localToCanvas(client, new LocalPoint((int) coords[0], (int) coords[1]), client.getPlane()); - if (point != null) - { - coords[0] = point.getX(); - coords[1] = point.getY(); - } - }); - - graphics.draw(path); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaPlugin.java deleted file mode 100644 index c05332585c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaPlugin.java +++ /dev/null @@ -1,550 +0,0 @@ -/* - * Copyright (c) 2018, Woox - * 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.npcunaggroarea; - -import com.google.common.base.Splitter; -import com.google.common.base.Strings; -import com.google.inject.Provides; -import java.awt.Color; -import java.awt.Polygon; -import java.awt.Rectangle; -import java.awt.geom.Area; -import java.awt.geom.GeneralPath; -import java.awt.image.BufferedImage; -import java.time.Duration; -import java.time.Instant; -import java.util.Arrays; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.Constants; -import net.runelite.api.ItemID; -import net.runelite.api.NPC; -import net.runelite.api.NPCDefinition; -import net.runelite.api.Perspective; -import net.runelite.api.Player; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldArea; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.geometry.Geometry; -import net.runelite.client.Notifier; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -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.ui.overlay.infobox.InfoBoxManager; -import net.runelite.client.util.WildcardMatcher; - -@PluginDescriptor( - name = "NPC Aggression Timer", - description = "Highlights the unaggressive area of NPCs nearby and timer until it becomes active", - tags = {"highlight", "lines", "unaggro", "aggro", "aggressive", "npcs", "area", "slayer"}, - enabledByDefault = false, - type = PluginType.UTILITY -) -@Singleton -public class NpcAggroAreaPlugin extends Plugin -{ - /* - How it works: The game remembers 2 tiles. When the player goes >10 steps - away from both tiles, the oldest one is moved to under the player and the - NPC aggression timer resets. - So to first figure out where the 2 tiles are, we wait until the player teleports - a long enough distance. At that point it's very likely that the player - moved out of the radius of both tiles, which resets one of them. The other - should reset shortly after as the player starts moving around. - */ - - private static final int SAFE_AREA_RADIUS = 10; - private static final int UNKNOWN_AREA_RADIUS = SAFE_AREA_RADIUS * 2; - private static final int AGGRESSIVE_TIME_SECONDS = 600; - private static final Splitter NAME_SPLITTER = Splitter.on(',').omitEmptyStrings().trimResults(); - private static final WorldArea WILDERNESS_ABOVE_GROUND = new WorldArea(2944, 3523, 448, 448, 0); - private static final WorldArea WILDERNESS_UNDERGROUND = new WorldArea(2944, 9918, 320, 442, 0); - - @Inject - private Client client; - - @Inject - private NpcAggroAreaConfig config; - - @Inject - private NpcAggroAreaOverlay overlay; - - @Inject - private NpcAggroAreaNotWorkingOverlay notWorkingOverlay; - - @Inject - private OverlayManager overlayManager; - - @Inject - private ItemManager itemManager; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private ConfigManager configManager; - - @Inject - private Notifier notifier; - - @Getter(AccessLevel.PACKAGE) - private final WorldPoint[] safeCenters = new WorldPoint[2]; - - @Getter(AccessLevel.PACKAGE) - private final GeneralPath[] linesToDisplay = new GeneralPath[Constants.MAX_Z]; - - @Getter(AccessLevel.PACKAGE) - private boolean active; - - @Getter(AccessLevel.PACKAGE) - private AggressionTimer currentTimer; - - private boolean alwaysActive; - private String configNpcNamePatterns; - private boolean showTimer; - private boolean showAreaLines; - @Getter(AccessLevel.PACKAGE) - private Color aggroAreaColor; - private boolean showNotWorkingOverlay; - @Getter(AccessLevel.PACKAGE) - private boolean hideOverlayHint; - @Getter(AccessLevel.PACKAGE) - private boolean sendNotification; - - private WorldPoint lastPlayerLocation; - private WorldPoint previousUnknownCenter; - private boolean loggingIn; - private List npcNamePatterns; - private boolean notWorkingOverlayShown = false; - private boolean hasSentNotification = false; - - @Provides - NpcAggroAreaConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(NpcAggroAreaConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - if (this.showNotWorkingOverlay) - { - overlayManager.add(notWorkingOverlay); - notWorkingOverlayShown = true; - } - - npcNamePatterns = NAME_SPLITTER.splitToList(this.configNpcNamePatterns); - recheckActive(); - } - - @Override - protected void shutDown() - { - removeTimer(); - overlayManager.remove(overlay); - if (notWorkingOverlayShown) - { - overlayManager.remove(notWorkingOverlay); - } - - Arrays.fill(safeCenters, null); - lastPlayerLocation = null; - currentTimer = null; - loggingIn = false; - npcNamePatterns = null; - active = false; - - Arrays.fill(linesToDisplay, null); - } - - private Area generateSafeArea() - { - final Area area = new Area(); - - for (WorldPoint wp : safeCenters) - { - if (wp == null) - { - continue; - } - - Polygon poly = new Polygon(); - poly.addPoint(wp.getX() - SAFE_AREA_RADIUS, wp.getY() - SAFE_AREA_RADIUS); - poly.addPoint(wp.getX() - SAFE_AREA_RADIUS, wp.getY() + SAFE_AREA_RADIUS + 1); - poly.addPoint(wp.getX() + SAFE_AREA_RADIUS + 1, wp.getY() + SAFE_AREA_RADIUS + 1); - poly.addPoint(wp.getX() + SAFE_AREA_RADIUS + 1, wp.getY() - SAFE_AREA_RADIUS); - area.add(new Area(poly)); - } - - return area; - } - - private void transformWorldToLocal(float[] coords) - { - final LocalPoint lp = LocalPoint.fromWorld(client, (int) coords[0], (int) coords[1]); - coords[0] = lp.getX() - Perspective.LOCAL_TILE_SIZE / 2f; - coords[1] = lp.getY() - Perspective.LOCAL_TILE_SIZE / 2f; - } - - private void reevaluateActive() - { - if (currentTimer != null) - { - currentTimer.setVisible(active && this.showTimer); - } - - calculateLinesToDisplay(); - } - - private void calculateLinesToDisplay() - { - if (!active || !this.showAreaLines) - { - Arrays.fill(linesToDisplay, null); - return; - } - - Rectangle sceneRect = new Rectangle( - client.getBaseX() + 1, client.getBaseY() + 1, - Constants.SCENE_SIZE - 2, Constants.SCENE_SIZE - 2); - - for (int i = 0; i < linesToDisplay.length; i++) - { - GeneralPath lines = new GeneralPath(generateSafeArea()); - lines = Geometry.clipPath(lines, sceneRect); - lines = Geometry.splitIntoSegments(lines, 1); - lines = Geometry.transformPath(lines, this::transformWorldToLocal); - linesToDisplay[i] = lines; - } - } - - private void removeTimer() - { - infoBoxManager.removeInfoBox(currentTimer); - currentTimer = null; - } - - private void createTimer(Duration duration) - { - removeTimer(); - BufferedImage image = itemManager.getImage(ItemID.ENSOULED_DEMON_HEAD); - currentTimer = new AggressionTimer(duration, image, this, active && this.showTimer); - infoBoxManager.addInfoBox(currentTimer); - hasSentNotification = false; - } - - private void resetTimer() - { - createTimer(Duration.ofSeconds(AGGRESSIVE_TIME_SECONDS)); - } - - private static boolean isInWilderness(WorldPoint location) - { - return WILDERNESS_ABOVE_GROUND.distanceTo2D(location) == 0 || WILDERNESS_UNDERGROUND.distanceTo2D(location) == 0; - } - - private boolean isNpcMatch(NPC npc) - { - NPCDefinition composition = npc.getTransformedDefinition(); - if (composition == null) - { - return false; - } - - if (Strings.isNullOrEmpty(composition.getName())) - { - return false; - } - - // Most NPCs stop aggroing when the player has more than double - // its combat level. - final Player localPlayer = client.getLocalPlayer(); - if (localPlayer == null) - { - return false; - } - - final int playerLvl = localPlayer.getCombatLevel(); - final int npcLvl = composition.getCombatLevel(); - final String npcName = composition.getName().toLowerCase(); - if (npcLvl > 0 && playerLvl > npcLvl * 2 && !isInWilderness(npc.getWorldLocation())) - { - return false; - } - - for (String pattern : npcNamePatterns) - { - if (WildcardMatcher.matches(pattern, npcName)) - { - return true; - } - } - - return false; - } - - private void checkAreaNpcs(final NPC... npcs) - { - for (NPC npc : npcs) - { - if (npc == null) - { - continue; - } - - if (isNpcMatch(npc)) - { - active = true; - break; - } - } - - reevaluateActive(); - } - - private void recheckActive() - { - active = this.alwaysActive; - checkAreaNpcs(client.getCachedNPCs()); - } - - @Subscribe - private void onNpcSpawned(NpcSpawned event) - { - if (this.alwaysActive) - { - return; - } - - checkAreaNpcs(event.getNpc()); - } - - @Subscribe - private void onGameTick(GameTick event) - { - WorldPoint newLocation = client.getLocalPlayer().getWorldLocation(); - if (lastPlayerLocation != null && safeCenters[1] == null && newLocation.distanceTo2D(lastPlayerLocation) > SAFE_AREA_RADIUS * 4) - { - safeCenters[0] = null; - safeCenters[1] = newLocation; - resetTimer(); - calculateLinesToDisplay(); - - // We don't know where the previous area was, so if the player e.g. - // entered a dungeon and then goes back out, he/she may enter the previous - // area which is unknown and would make the plugin inaccurate - previousUnknownCenter = lastPlayerLocation; - } - - if (safeCenters[0] == null && previousUnknownCenter != null && - previousUnknownCenter.distanceTo2D(newLocation) <= UNKNOWN_AREA_RADIUS) - { - // Player went back to their previous unknown area before the 2nd - // center point was found, which means we don't know where it is again. - safeCenters[1] = null; - removeTimer(); - calculateLinesToDisplay(); - } - - if (safeCenters[1] != null && Arrays.stream(safeCenters).noneMatch( - x -> x != null && x.distanceTo2D(newLocation) <= SAFE_AREA_RADIUS)) - { - safeCenters[0] = safeCenters[1]; - safeCenters[1] = newLocation; - resetTimer(); - calculateLinesToDisplay(); - previousUnknownCenter = null; - } - - lastPlayerLocation = newLocation; - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("npcUnaggroArea")) - { - return; - } - - updateConfig(); - - String key = event.getKey(); - switch (key) - { - case "npcUnaggroAlwaysActive": - recheckActive(); - break; - case "npcUnaggroShowTimer": - if (currentTimer != null) - { - currentTimer.setVisible(active && this.showTimer); - } - break; - case "npcUnaggroCollisionDetection": - case "npcUnaggroShowAreaLines": - calculateLinesToDisplay(); - break; - case "npcUnaggroNames": - npcNamePatterns = NAME_SPLITTER.splitToList(this.configNpcNamePatterns); - recheckActive(); - break; - case "sendNotification": - hasSentNotification = false; - break; - } - } - - private void loadConfig() - { - safeCenters[0] = configManager.getConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_CENTER1, WorldPoint.class); - safeCenters[1] = configManager.getConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_CENTER2, WorldPoint.class); - lastPlayerLocation = configManager.getConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_LOCATION, WorldPoint.class); - - Duration timeLeft = configManager.getConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_DURATION, Duration.class); - if (timeLeft != null && !timeLeft.isNegative()) - { - createTimer(timeLeft); - } - } - - private void resetConfig() - { - configManager.unsetConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_CENTER1); - configManager.unsetConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_CENTER2); - configManager.unsetConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_LOCATION); - configManager.unsetConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_DURATION); - configManager.unsetConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_NOT_WORKING_OVERLAY); - } - - private void saveConfig() - { - if (safeCenters[0] == null || safeCenters[1] == null || lastPlayerLocation == null || currentTimer == null) - { - resetConfig(); - } - else - { - configManager.setConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_CENTER1, safeCenters[0]); - configManager.setConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_CENTER2, safeCenters[1]); - configManager.setConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_LOCATION, lastPlayerLocation); - configManager.setConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_DURATION, Duration.between(Instant.now(), currentTimer.getEndTime())); - } - } - - private void onLogin() - { - loadConfig(); - resetConfig(); - - WorldPoint newLocation = client.getLocalPlayer().getWorldLocation(); - assert newLocation != null; - - // If the player isn't at the location he/she logged out at, - // the safe unaggro area probably changed, and should be disposed. - if (lastPlayerLocation == null || newLocation.distanceTo(lastPlayerLocation) != 0) - { - safeCenters[0] = null; - safeCenters[1] = null; - lastPlayerLocation = newLocation; - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - switch (event.getGameState()) - { - case LOGGED_IN: - if (loggingIn) - { - loggingIn = false; - onLogin(); - } - - recheckActive(); - break; - - case LOGGING_IN: - loggingIn = true; - break; - - case LOGIN_SCREEN: - if (lastPlayerLocation != null) - { - saveConfig(); - } - - safeCenters[0] = null; - safeCenters[1] = null; - lastPlayerLocation = null; - break; - } - } - - void doNotification() - { - if (!this.sendNotification) - { - return; - } - - if (hasSentNotification) - { - return; - } - - final Player local = client.getLocalPlayer(); - hasSentNotification = true; - notifier.notify("[" + local.getName() + "]'s aggression timer has run out!"); - } - - private void updateConfig() - { - this.alwaysActive = config.alwaysActive(); - this.configNpcNamePatterns = config.npcNamePatterns(); - this.showTimer = config.showTimer(); - this.showAreaLines = config.showAreaLines(); - this.aggroAreaColor = config.aggroAreaColor(); - this.showNotWorkingOverlay = config.showNotWorkingOverlay(); - this.hideOverlayHint = config.hideOverlayHint(); - this.sendNotification = config.sendNotification(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsConfig.java deleted file mode 100644 index 5e363d7895..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsConfig.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2019, Owain van Brakel - * Copyright (c) 2018, Tomas Slusny - * 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.objectindicators; - -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.ConfigTitleSection; -import net.runelite.client.config.Range; -import net.runelite.client.config.Title; - -@ConfigGroup("objectindicators") -public interface ObjectIndicatorsConfig extends Config -{ - @ConfigTitleSection( - keyName = "overlayTitle", - name = "Overlay Style", - description = "", - position = 0 - ) - default Title overlayTitle() - { - return new Title(); - } - - @ConfigItem( - position = 1, - keyName = "objectMarkerRenderStyle", - name = "Highlight Style", - description = "Highlight setting", - titleSection = "overlayTitle" - ) - default RenderStyle objectMarkerRenderStyle() - { - return RenderStyle.OUTLINE; - } - - - @ConfigItem( - position = 2, - keyName = "objectMarkerOutlineRenderStyle", - name = "Outline Style", - description = "Highlight outline setting", - titleSection = "overlayTitle", - hidden = true, - unhide = "objectMarkerRenderStyle", - unhideValue = "OUTLINE" - ) - default OutlineRenderStyle objectMarkerOutlineRenderStyle() - { - return OutlineRenderStyle.NORMAL_OUTLINE; - } - - @ConfigTitleSection( - keyName = "colorTitle", - name = "Colors", - description = "", - position = 3 - ) - default Title colorTitle() - { - return new Title(); - } - - @ConfigItem( - position = 4, - keyName = "markerColor", - name = "Marker color", - description = "Configures the outer color of object marker", - titleSection = "colorTitle" - ) - default Color objectMarkerColor() - { - return Color.YELLOW; - } - - @Range( - max = 100 - ) - @ConfigItem( - position = 5, - keyName = "objectMarkerAlpha", - name = "Alpha", - description = "Configures the opacity/alpha of object marker", - titleSection = "colorTitle" - ) - default int objectMarkerAlpha() - { - return 100; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsOverlay.java deleted file mode 100644 index 37650c4fd0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsOverlay.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2019, Owain van Brakel - * Copyright (c) 2018, Tomas Slusny - * 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.objectindicators; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Shape; -import static java.lang.Math.floor; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.DecorativeObject; -import net.runelite.api.GameObject; -import net.runelite.api.TileObject; -import net.runelite.api.WallObject; -import net.runelite.client.graphics.ModelOutlineRenderer; -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; - -@Singleton -class ObjectIndicatorsOverlay extends Overlay -{ - private static final Color TRANSPARENT = new Color(0, 0, 0, 0); - - private final Client client; - private final ObjectIndicatorsPlugin plugin; - private final ModelOutlineRenderer modelOutliner; - - @Inject - private ObjectIndicatorsOverlay(final Client client, final ObjectIndicatorsPlugin plugin, final ModelOutlineRenderer modelOutliner) - { - this.client = client; - this.plugin = plugin; - this.modelOutliner = modelOutliner; - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.LOW); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D graphics) - { - for (TileObject object : plugin.getObjects()) - { - if (object.getPlane() != client.getPlane()) - { - continue; - } - - Color color = plugin.getObjectMarkerColor(); - int opacity = (int) floor(plugin.getObjectMarkerAlpha() * 2.55); - Color objectColor = new Color(color.getRed(), color.getGreen(), color.getBlue(), opacity); - - switch (plugin.getObjectMarkerRenderStyle()) - { - case OUTLINE: - switch (plugin.getObjectMarkerOutlineRenderStyle()) - { - case THIN_OUTLINE: - modelOutliner.drawOutline(object, 1, objectColor); - break; - - case NORMAL_OUTLINE: - modelOutliner.drawOutline(object, 2, objectColor); - break; - - case THIN_GLOW: - modelOutliner.drawOutline(object, 4, objectColor, TRANSPARENT); - break; - - case GLOW: - modelOutliner.drawOutline(object, 8, objectColor, TRANSPARENT); - break; - } - break; - case HULL: - final Shape polygon; - Shape polygon2 = null; - - if (object instanceof GameObject) - { - polygon = ((GameObject) object).getConvexHull(); - } - else if (object instanceof WallObject) - { - polygon = ((WallObject) object).getConvexHull(); - polygon2 = ((WallObject) object).getConvexHull2(); - } - else if (object instanceof DecorativeObject) - { - polygon = ((DecorativeObject) object).getConvexHull(); - polygon2 = ((DecorativeObject) object).getConvexHull2(); - } - else - { - polygon = object.getCanvasTilePoly(); - } - - if (polygon != null) - { - OverlayUtil.renderPolygon(graphics, polygon, objectColor); - } - - if (polygon2 != null) - { - OverlayUtil.renderPolygon(graphics, polygon2, objectColor); - } - break; - case CLICKBOX: - Shape clickbox = object.getClickbox(); - if (clickbox != null) - { - OverlayUtil.renderHoverableArea(graphics, object.getClickbox(), client.getMouseCanvasPosition(), TRANSPARENT, objectColor, objectColor.darker()); - } - break; - } - } - - return null; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsPlugin.java deleted file mode 100644 index a53072b79f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsPlugin.java +++ /dev/null @@ -1,546 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * Copyright (c) 2018, 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.objectindicators; - -import com.google.common.base.Strings; -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; -import com.google.inject.Provides; -import java.awt.Color; -import java.awt.event.KeyEvent; -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.stream.Collectors; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.DecorativeObject; -import net.runelite.api.GameObject; -import net.runelite.api.GameState; -import net.runelite.api.GroundObject; -import net.runelite.api.MenuEntry; -import net.runelite.api.MenuOpcode; -import net.runelite.api.ObjectDefinition; -import net.runelite.api.Scene; -import net.runelite.api.Tile; -import net.runelite.api.TileObject; -import net.runelite.api.WallObject; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.DecorativeObjectDespawned; -import net.runelite.api.events.DecorativeObjectSpawned; -import net.runelite.api.events.FocusChanged; -import net.runelite.api.events.GameObjectDespawned; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GroundObjectDespawned; -import net.runelite.api.events.GroundObjectSpawned; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.WallObjectChanged; -import net.runelite.api.events.WallObjectDespawned; -import net.runelite.api.events.WallObjectSpawned; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.input.KeyListener; -import net.runelite.client.input.KeyManager; -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; - -@PluginDescriptor( - name = "Object Markers", - description = "Enable marking of objects using the Shift key", - tags = {"overlay", "objects", "mark", "marker"}, - enabledByDefault = false, - type = PluginType.UTILITY -) -@Singleton -@Slf4j -public class ObjectIndicatorsPlugin extends Plugin implements KeyListener -{ - private static final String CONFIG_GROUP = "objectindicators"; - private static final String MARK = "Mark object"; - private static final String UNMARK = "Unmark object"; - - private final Gson GSON = new Gson(); - @Getter(AccessLevel.PACKAGE) - private final List objects = new ArrayList<>(); - private final Map> points = new HashMap<>(); - private boolean hotKeyPressed; - - @Inject - private Client client; - - @Inject - private ConfigManager configManager; - - @Inject - private OverlayManager overlayManager; - - @Inject - private ObjectIndicatorsOverlay overlay; - - @Inject - private ObjectIndicatorsConfig config; - - @Inject - private KeyManager keyManager; - - @Getter(AccessLevel.PACKAGE) - private RenderStyle objectMarkerRenderStyle; - @Getter(AccessLevel.PACKAGE) - private OutlineRenderStyle objectMarkerOutlineRenderStyle; - @Getter(AccessLevel.PACKAGE) - private Color objectMarkerColor; - @Getter(AccessLevel.PACKAGE) - private int objectMarkerAlpha; - - @Provides - ObjectIndicatorsConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(ObjectIndicatorsConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - keyManager.registerKeyListener(this); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - keyManager.unregisterKeyListener(this); - points.clear(); - objects.clear(); - hotKeyPressed = false; - } - - @Override - public void keyTyped(KeyEvent e) - { - - } - - @Override - public void keyPressed(KeyEvent e) - { - if (e.getKeyCode() == KeyEvent.VK_SHIFT) - { - hotKeyPressed = true; - } - } - - @Override - public void keyReleased(KeyEvent e) - { - if (e.getKeyCode() == KeyEvent.VK_SHIFT) - { - hotKeyPressed = false; - } - } - - @Subscribe - private void onFocusChanged(final FocusChanged event) - { - if (!event.isFocused()) - { - hotKeyPressed = false; - } - } - - @Subscribe - private void onWallObjectSpawned(WallObjectSpawned event) - { - checkObjectPoints(event.getWallObject()); - } - - @Subscribe - private void onWallObjectChanged(WallObjectChanged event) - { - WallObject previous = event.getPrevious(); - WallObject wallObject = event.getWallObject(); - - objects.remove(previous); - checkObjectPoints(wallObject); - } - - @Subscribe - private void onWallObjectDespawned(WallObjectDespawned event) - { - objects.remove(event.getWallObject()); - } - - @Subscribe - private void onGameObjectSpawned(GameObjectSpawned event) - { - final GameObject eventObject = event.getGameObject(); - checkObjectPoints(eventObject); - } - - @Subscribe - private void onDecorativeObjectSpawned(DecorativeObjectSpawned event) - { - final DecorativeObject eventObject = event.getDecorativeObject(); - checkObjectPoints(eventObject); - } - - @Subscribe - private void onGameObjectDespawned(GameObjectDespawned event) - { - objects.remove(event.getGameObject()); - } - - @Subscribe - private void onDecorativeObjectDespawned(DecorativeObjectDespawned event) - { - objects.remove(event.getDecorativeObject()); - } - - @Subscribe - private void onGroundObjectSpawned(GroundObjectSpawned groundObjectSpawned) - { - final GroundObject groundObject = groundObjectSpawned.getGroundObject(); - checkObjectPoints(groundObject); - } - - @Subscribe - private void onGroundObjectDespawned(GroundObjectDespawned groundObjectDespawned) - { - GroundObject groundObject = groundObjectDespawned.getGroundObject(); - objects.remove(groundObject); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged gameStateChanged) - { - GameState gameState = gameStateChanged.getGameState(); - if (gameState == GameState.LOADING) - { - // Reload points with new map regions - - points.clear(); - for (int regionId : client.getMapRegions()) - { - // load points for region - final Set regionPoints = loadPoints(regionId); - if (regionPoints != null) - { - points.put(regionId, regionPoints); - } - } - } - - if (gameStateChanged.getGameState() != GameState.LOGGED_IN) - { - objects.clear(); - } - } - - @Subscribe - private void onMenuEntryAdded(MenuEntryAdded event) - { - if (!hotKeyPressed || event.getOpcode() != MenuOpcode.EXAMINE_OBJECT.getId()) - { - return; - } - - final Tile tile = client.getScene().getTiles()[client.getPlane()][event.getParam0()][event.getParam1()]; - - MenuEntry[] menuEntries = client.getMenuEntries(); - menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1); - MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry(); - - menuEntry.setOption(objects.contains(findTileObject(tile, event.getIdentifier())) ? UNMARK : MARK); - menuEntry.setTarget(event.getTarget()); - menuEntry.setParam0(event.getParam0()); - menuEntry.setParam1(event.getParam1()); - menuEntry.setIdentifier(event.getIdentifier()); - menuEntry.setOpcode(MenuOpcode.RUNELITE.getId()); - client.setMenuEntries(menuEntries); - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked event) - { - if (event.getMenuOpcode() != MenuOpcode.RUNELITE - || !(event.getOption().equals(MARK) || event.getOption().equals(UNMARK))) - { - return; - } - - Scene scene = client.getScene(); - Tile[][][] tiles = scene.getTiles(); - final int x = event.getParam0(); - final int y = event.getParam1(); - final int z = client.getPlane(); - final Tile tile = tiles[z][x][y]; - - TileObject object = findTileObject(tile, event.getIdentifier()); - if (object == null) - { - return; - } - - // object.getId() is always the base object id, getObjectComposition transforms it to - // the correct object we see - ObjectDefinition objectDefinition = getObjectDefinition(object.getId()); - String name = objectDefinition.getName(); - // Name is probably never "null" - however prevent adding it if it is, as it will - // become ambiguous as objects with no name are assigned name "null" - if (Strings.isNullOrEmpty(name) || name.equals("null")) - { - return; - } - - markObject(objectDefinition, name, object); - } - - private void checkObjectPoints(TileObject object) - { - final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, object.getLocalLocation()); - - if (worldPoint == null) - { - return; - } - - final Set objectPoints = points.get(worldPoint.getRegionID()); - - if (objectPoints == null) - { - return; - } - - for (ObjectPoint objectPoint : objectPoints) - { - if (worldPoint.getRegionX() == objectPoint.getRegionX() - && worldPoint.getRegionY() == objectPoint.getRegionY() - && worldPoint.getPlane() == objectPoint.getZ()) - { - // Transform object to get the name which matches against what we've stored - ObjectDefinition objectDefinition = getObjectDefinition(object.getId()); - if (objectDefinition != null && objectPoint.getName().equals(objectDefinition.getName())) - { - log.debug("Marking object {} due to matching {}", object, objectPoint); - objects.add(object); - break; - } - } - } - } - - private TileObject findTileObject(Tile tile, int id) - { - if (tile == null) - { - return null; - } - - final GameObject[] tileGameObjects = tile.getGameObjects(); - final DecorativeObject tileDecorativeObject = tile.getDecorativeObject(); - final WallObject tileWallObject = tile.getWallObject(); - final GroundObject groundObject = tile.getGroundObject(); - - if (objectIdEquals(tileWallObject, id)) - { - return tileWallObject; - } - - if (objectIdEquals(tileDecorativeObject, id)) - { - return tileDecorativeObject; - } - - if (objectIdEquals(groundObject, id)) - { - return groundObject; - } - - for (GameObject object : tileGameObjects) - { - if (objectIdEquals(object, id)) - { - return object; - } - } - - return null; - } - - private boolean objectIdEquals(TileObject tileObject, int id) - { - if (tileObject == null) - { - return false; - } - - if (tileObject.getId() == id) - { - return true; - } - - // Menu action EXAMINE_OBJECT sends the transformed object id, not the base id, unlike - // all of the GAME_OBJECT_OPTION actions, so check the id against the impostor ids - final ObjectDefinition comp = client.getObjectDefinition(tileObject.getId()); - - if (comp.getImpostorIds() != null) - { - for (int impostorId : comp.getImpostorIds()) - { - if (impostorId == id) - { - return true; - } - } - } - - return false; - } - - /** mark or unmark an object - * - * @param objectComposition transformed composition of object based on vars - * @param name name of objectComposition - * @param object tile object, for multilocs object.getId() is the base id - */ - private void markObject(ObjectDefinition objectComposition, String name, final TileObject object) - { - final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, object.getLocalLocation()); - if (worldPoint == null) - { - return; - } - final int regionId = worldPoint.getRegionID(); - final ObjectPoint point = new ObjectPoint( - object.getId(), - name, - regionId, - worldPoint.getRegionX(), - worldPoint.getRegionY(), - worldPoint.getPlane()); - - Set objectPoints = points.computeIfAbsent(regionId, k -> new HashSet<>()); - - if (objects.remove(object)) - { - // Find the object point that caused this object to be marked, there are two cases: - // 1) object is a multiloc, the name may have changed since marking - match from base id - // 2) not a multiloc, but an object has spawned with an identical name and a different - // id as what was originally marked - if (!objectPoints.removeIf(op -> ((op.getId() == -1 || op.getId() == object.getId()) || op.getName().equals(objectComposition.getName())) - && op.getRegionX() == worldPoint.getRegionX() - && op.getRegionY() == worldPoint.getRegionY() - && op.getZ() == worldPoint.getPlane())) - { - log.warn("unable to find object point for unmarked object {}", object.getId()); - } - - log.debug("Unmarking object: {}", point); - } - else - { - objectPoints.add(point); - objects.add(object); - log.debug("Marking object: {}", point); - } - - savePoints(regionId, objectPoints); - } - - private void savePoints(final int id, final Set points) - { - if (points.isEmpty()) - { - configManager.unsetConfiguration(CONFIG_GROUP, "region_" + id); - } - else - { - final String json = GSON.toJson(points); - configManager.setConfiguration(CONFIG_GROUP, "region_" + id, json); - } - } - - private Set loadPoints(final int id) - { - final String json = configManager.getConfiguration(CONFIG_GROUP, "region_" + id); - - if (Strings.isNullOrEmpty(json)) - { - return null; - } - - Set points = GSON.fromJson(json, new TypeToken>() - { - }.getType()); - // Prior to multiloc support the plugin would mark objects named "null", which breaks - // in most cases due to the specific object being identified being ambiguous, so remove - // them - return points.stream() - .filter(point -> !point.getName().equals("null")) - .collect(Collectors.toSet()); - } - - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("objectindicators")) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.objectMarkerRenderStyle = config.objectMarkerRenderStyle(); - this.objectMarkerOutlineRenderStyle = config.objectMarkerOutlineRenderStyle(); - this.objectMarkerColor = config.objectMarkerColor(); - this.objectMarkerAlpha = config.objectMarkerAlpha(); - } - - private ObjectDefinition getObjectDefinition(int id) - { - ObjectDefinition objectComposition = client.getObjectDefinition(id); - return objectComposition.getImpostorIds() == null ? objectComposition : objectComposition.getImpostor(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectPoint.java deleted file mode 100644 index ca8786faa3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectPoint.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.objectindicators; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -class ObjectPoint -{ - private int id = -1; - private String name; - private int regionId; - private int regionX; - private int regionY; - private int z; -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/OutlineRenderStyle.java b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/OutlineRenderStyle.java deleted file mode 100644 index 2ed550f2b1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/OutlineRenderStyle.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2019, Owain van Brakel - * 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.objectindicators; - -public enum OutlineRenderStyle -{ - THIN_OUTLINE, - NORMAL_OUTLINE, - THIN_GLOW, - GLOW -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/RenderStyle.java b/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/RenderStyle.java deleted file mode 100644 index 4ef9af24ca..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/RenderStyle.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2019, Owain van Brakel - * 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.objectindicators; - -public enum RenderStyle -{ - CLICKBOX, - HULL, - OUTLINE -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/HitpointsDisplayStyle.java b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/HitpointsDisplayStyle.java deleted file mode 100644 index db060a610b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/HitpointsDisplayStyle.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2019, Sean Dewar - * 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.opponentinfo; - -import lombok.RequiredArgsConstructor; - -@RequiredArgsConstructor -public enum HitpointsDisplayStyle -{ - HITPOINTS("Hitpoints"), - PERCENTAGE("Percentage"), - BOTH("Both"); - - private final String name; - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoConfig.java deleted file mode 100644 index af11a32c28..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoConfig.java +++ /dev/null @@ -1,113 +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.opponentinfo; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("opponentinfo") -public interface OpponentInfoConfig extends Config -{ - @ConfigItem( - keyName = "lookupOnInteraction", - name = "Lookup players on interaction", - description = "Display a combat stat comparison panel on player interaction. (follow, trade, challenge, attack, etc.)", - position = 0 - ) - default boolean lookupOnInteraction() - { - return false; - } - - @ConfigItem( - keyName = "hitpointsDisplayStyle", - name = "Hitpoints display style", - description = "Show opponent's hitpoints as a value (if known), percentage, or both", - position = 1 - ) - default HitpointsDisplayStyle hitpointsDisplayStyle() - { - return HitpointsDisplayStyle.HITPOINTS; - } - - @ConfigItem( - keyName = "showOpponentsOpponent", - name = "Show opponent's opponent", - description = "Toggle showing opponent's opponent if within a multi-combat area", - position = 2 - ) - default boolean showOpponentsOpponent() - { - return true; - } - - @ConfigItem( - keyName = "showAttackersMenu", - name = "Show attackers in menu", - description = "Marks attackers' names in menus with a *
", - position = 3, - warning = "NOTE: This'll also mark people who are following you/interacting with you in any other way. Don't blindly trust this in pvp!" - ) - default boolean showAttackersMenu() - { - return false; - } - - @ConfigItem( - keyName = "showAttackingMenu", - name = "Green main target", - description = "Display main target's name colored in menus (Players and NPCs)", - position = 4, - warning = "NOTE: This'll also show green when following/interacting in any other way. Don't blindly trust this in pvp!" - ) - default boolean showAttackingMenu() - { - return false; - } - - @ConfigItem( - keyName = "attackingColor", - name = "Target color", - description = "The color your target will be highlighted with", - position = 5 - ) - default Color attackingColor() - { - return Color.GREEN; - } - - @ConfigItem( - keyName = "showHitpointsMenu", - name = "Show NPC hp in menu", - description = "Show NPC hp in menu. Useful when barraging", - position = 6 - ) - default boolean showHitpointsMenu() - { - return false; - } -} 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 deleted file mode 100644 index fb9cc8f5ae..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoOverlay.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2016-2018, Adam - * 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.opponentinfo; - -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 javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Actor; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.Varbits; -import net.runelite.api.util.Text; -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; -import net.runelite.client.ui.overlay.components.ComponentConstants; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.ProgressBarComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -@Singleton -class OpponentInfoOverlay extends Overlay -{ - private static final Color HP_GREEN = new Color(0, 146, 54, 230); - private static final Color HP_RED = new Color(102, 15, 16, 230); - - private final Client client; - private final OpponentInfoPlugin opponentInfoPlugin; - - private final PanelComponent panelComponent = new PanelComponent(); - - private int lastMaxHealth; - private int lastRatio = 0; - private int lastHealthScale = 0; - private String opponentName; - private String opponentsOpponentName; - - @Inject - private OpponentInfoOverlay( - final Client client, - final OpponentInfoPlugin opponentInfoPlugin) - { - super(opponentInfoPlugin); - this.client = client; - this.opponentInfoPlugin = opponentInfoPlugin; - - setPosition(OverlayPosition.TOP_LEFT); - setPriority(OverlayPriority.HIGH); - - panelComponent.setBorder(new Rectangle(2, 2, 2, 2)); - panelComponent.setGap(new Point(0, 2)); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Opponent info overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - final Actor opponent = opponentInfoPlugin.getLastOpponent(); - - if (opponent == null) - { - opponentName = null; - return null; - } - - if (opponent.getName() != null && opponent.getHealth() > 0) - { - lastRatio = opponent.getHealthRatio(); - lastHealthScale = opponent.getHealth(); - opponentName = Text.removeTags(opponent.getName()); - - lastMaxHealth = opponentInfoPlugin.getMaxHp(opponent); - - final Actor opponentsOpponent = opponent.getInteracting(); - if (opponentsOpponent != null - && (opponentsOpponent != client.getLocalPlayer() || client.getVar(Varbits.MULTICOMBAT_AREA) == 1)) - { - opponentsOpponentName = Text.removeTags(opponentsOpponent.getName()); - } - else - { - opponentsOpponentName = null; - } - } - - if (opponentName == null) - { - return null; - } - - final FontMetrics fontMetrics = graphics.getFontMetrics(); - - panelComponent.getChildren().clear(); - - // Opponent name - int textWidth = Math.max(ComponentConstants.STANDARD_WIDTH, fontMetrics.stringWidth(opponentName)); - panelComponent.setPreferredSize(new Dimension(textWidth, 0)); - panelComponent.getChildren().add(TitleComponent.builder() - .text(opponentName) - .build()); - - // Health bar - if (lastRatio >= 0 && lastHealthScale > 0) - { - final ProgressBarComponent progressBarComponent = new ProgressBarComponent(); - progressBarComponent.setBackgroundColor(HP_RED); - progressBarComponent.setForegroundColor(HP_GREEN); - - final HitpointsDisplayStyle displayStyle = opponentInfoPlugin.getHitpointsDisplayStyle(); - - if ((displayStyle == HitpointsDisplayStyle.HITPOINTS || displayStyle == HitpointsDisplayStyle.BOTH) - && lastMaxHealth != -1) - { - int health = getExactHp(lastRatio, lastHealthScale, lastMaxHealth); - - // Show both the hitpoint and percentage values if enabled in the config - final ProgressBarComponent.LabelDisplayMode progressBarDisplayMode = displayStyle == HitpointsDisplayStyle.BOTH ? - ProgressBarComponent.LabelDisplayMode.BOTH : ProgressBarComponent.LabelDisplayMode.FULL; - - progressBarComponent.setLabelDisplayMode(progressBarDisplayMode); - progressBarComponent.setMaximum(lastMaxHealth); - progressBarComponent.setValue(health); - } - else - { - float floatRatio = (float) lastRatio / (float) lastHealthScale; - progressBarComponent.setValue(floatRatio * 100d); - } - - panelComponent.getChildren().add(progressBarComponent); - } - - // Opponents opponent - if (opponentsOpponentName != null && opponentInfoPlugin.isShowOpponentsOpponent()) - { - textWidth = Math.max(textWidth, fontMetrics.stringWidth(opponentsOpponentName)); - panelComponent.setPreferredSize(new Dimension(textWidth, 0)); - panelComponent.getChildren().add(TitleComponent.builder() - .text(opponentsOpponentName) - .build()); - } - - return panelComponent.render(graphics); - } - - static int getExactHp(int ratio, int health, int maxHp) - { - if (ratio < 0 || health <= 0 || maxHp == -1) - { - return -1; - } - - int exactHealth = 0; - - // This is the reverse of the calculation of healthRatio done by the server - // which is: healthRatio = 1 + (healthScale - 1) * health / maxHealth (if health > 0, 0 otherwise) - // It's able to recover the exact health if maxHealth <= healthScale. - if (ratio > 0) - { - int minHealth = 1; - int maxHealth; - if (health > 1) - { - if (ratio > 1) - { - // This doesn't apply if healthRatio = 1, because of the special case in the server calculation that - // health = 0 forces healthRatio = 0 instead of the expected healthRatio = 1 - minHealth = (maxHp * (ratio - 1) + health - 2) / (health - 1); - } - maxHealth = (maxHp * ratio - 1) / (health - 1); - if (maxHealth > maxHp) - { - maxHealth = maxHp; - } - } - else - { - // If healthScale is 1, healthRatio will always be 1 unless health = 0 - // so we know nothing about the upper limit except that it can't be higher than maxHealth - maxHealth = maxHp; - } - // Take the average of min and max possible healths - exactHealth = (minHealth + maxHealth + 1) / 2; - } - - return exactHealth; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoPlugin.java deleted file mode 100644 index 7472db0806..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoPlugin.java +++ /dev/null @@ -1,513 +0,0 @@ -/* - * Copyright (c) 2016-2018, Adam - * 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.opponentinfo; - -import com.google.inject.Provides; -import java.time.Duration; -import java.time.Instant; -import java.util.EnumSet; -import javax.inject.Inject; -import javax.inject.Singleton; -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.GameState; -import net.runelite.api.MenuEntry; -import net.runelite.api.MenuOpcode; -import net.runelite.api.NPC; -import net.runelite.api.Player; -import net.runelite.api.WorldType; -import net.runelite.api.events.BeforeRender; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.InteractingChanged; -import net.runelite.api.events.MenuOpened; -import net.runelite.api.util.Text; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.HiscoreManager; -import net.runelite.client.game.NPCManager; -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.ui.overlay.OverlayManager; -import net.runelite.client.util.ColorUtil; -import net.runelite.http.api.hiscore.HiscoreEndpoint; -import net.runelite.http.api.hiscore.HiscoreResult; - -@PluginDescriptor( - name = "Opponent Information", - description = "Show name and hitpoints information about the NPC you are fighting", - tags = {"combat", "health", "hitpoints", "npcs", "overlay"}, - type = PluginType.UTILITY -) -@Singleton -@Slf4j -public class OpponentInfoPlugin extends Plugin -{ - private static final Duration WAIT = Duration.ofSeconds(5); - private static final Object MENU = new Object(); - private static final int COLOR_TAG_LENGTH = 12; - - @Inject - private Client client; - - @Inject - private OpponentInfoConfig config; - - @Inject - private OverlayManager overlayManager; - - @Inject - private OpponentInfoOverlay opponentInfoOverlay; - - @Inject - private PlayerComparisonOverlay playerComparisonOverlay; - - @Inject - private EventBus eventBus; - - @Inject - private HiscoreManager hiscoreManager; - - @Inject - private MenuManager menuManager; - - @Inject - private NPCManager npcManager; - - @Getter(AccessLevel.PACKAGE) - private HiscoreEndpoint hiscoreEndpoint = HiscoreEndpoint.NORMAL; - - @Getter(AccessLevel.PACKAGE) - private Actor lastOpponent; - - private Instant lastTime; - - @Getter(AccessLevel.PACKAGE) - private boolean lookupOnInteraction; - @Getter(AccessLevel.PACKAGE) - private HitpointsDisplayStyle hitpointsDisplayStyle; - @Getter(AccessLevel.PACKAGE) - private boolean showOpponentsOpponent; - - private String attackingColTag; - private boolean showAttackers; - private boolean showAttacking; - private boolean showHitpoints; - - @Provides - OpponentInfoConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(OpponentInfoConfig.class); - } - - @Override - protected void startUp() - { - this.attackingColTag = ColorUtil.colorTag(config.attackingColor()); - this.showAttackers = config.showAttackersMenu(); - this.showAttacking = config.showAttackingMenu(); - this.showHitpoints = config.showHitpointsMenu(); - - updateConfig(); - updateMenuSubs(); - - overlayManager.add(opponentInfoOverlay); - overlayManager.add(playerComparisonOverlay); - } - - @Override - protected void shutDown() - { - eventBus.unregister(MENU); - - lastOpponent = null; - lastTime = null; - overlayManager.remove(opponentInfoOverlay); - overlayManager.remove(playerComparisonOverlay); - } - - private void updateMenuSubs() - { - if (showAttackers || showAttacking || showHitpoints) - { - eventBus.subscribe(BeforeRender.class, MENU, this::onBeforeRender); - eventBus.subscribe(MenuOpened.class, MENU, this::onMenuOpened); - } - else - { - eventBus.unregister(MENU); - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged gameStateChanged) - { - if (gameStateChanged.getGameState() != GameState.LOGGED_IN) - { - return; - } - - final EnumSet worldType = client.getWorldType(); - if (worldType.contains(WorldType.DEADMAN)) - { - hiscoreEndpoint = HiscoreEndpoint.DEADMAN; - } - else if (worldType.contains(WorldType.LEAGUE)) - { - hiscoreEndpoint = HiscoreEndpoint.LEAGUE; - } - else - { - hiscoreEndpoint = HiscoreEndpoint.NORMAL; - } - } - - @Subscribe - private void onInteractingChanged(InteractingChanged event) - { - if (event.getSource() != client.getLocalPlayer()) - { - return; - } - - Actor opponent = event.getTarget(); - - if (opponent == null) - { - lastTime = Instant.now(); - return; - } - - lastOpponent = opponent; - } - - @Subscribe - private void onGameTick(GameTick gameTick) - { - if (lastOpponent != null - && lastTime != null - && client.getLocalPlayer().getInteracting() == null - && Duration.between(lastTime, Instant.now()).compareTo(WAIT) > 0) - { - lastOpponent = null; - } - - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("opponentinfo")) - { - return; - } - - switch (event.getKey()) - { - case "showAttackersMenu": - this.showAttackers = config.showAttackersMenu(); - updateMenuSubs(); - break; - case "showAttackingMenu": - this.showAttacking = config.showAttackingMenu(); - updateMenuSubs(); - break; - case "showHitpointsMenu": - this.showHitpoints = config.showHitpointsMenu(); - updateMenuSubs(); - break; - case "attackingColor": - attackingColTag = ColorUtil.colorTag(config.attackingColor()); - break; - } - - updateConfig(); - } - - private void updateConfig() - { - this.lookupOnInteraction = config.lookupOnInteraction(); - this.hitpointsDisplayStyle = config.hitpointsDisplayStyle(); - this.showOpponentsOpponent = config.showOpponentsOpponent(); - } - - private void onBeforeRender(BeforeRender event) - { - if (client.getMenuOptionCount() <= 0) - { - return; - } - if (client.isMenuOpen()) - { - boolean changed = false; - final MenuEntry[] entries = client.getMenuEntries(); - for (final MenuEntry entry : entries) - { - changed |= fixup(entry); - } - - if (changed) - { - client.setMenuEntries(entries); - } - return; - } - - final MenuEntry entry = client.getLeftClickMenuEntry(); - if (modify(entry)) - { - client.setLeftClickMenuEntry(entry); - } - } - - private void onMenuOpened(MenuOpened event) - { - boolean changed = false; - for (MenuEntry entry : event.getMenuEntries()) - { - changed |= modify(entry); - } - - if (changed) - { - event.setModified(); - } - } - - private boolean modify(MenuEntry entry) - { - if (isNotAttackEntry(entry)) - { - return false; - } - - boolean changed = false; - - int index = entry.getIdentifier(); - Actor actor = getActorFromIndex(index); - - if (actor == null) - { - return false; - } - - if (actor instanceof Player) - { - index -= 32768; - } - - String target = entry.getTarget(); - - if (showAttacking && - client.getLocalPlayer().getRSInteracting() == index) - { - target = attackingColTag + target.substring(COLOR_TAG_LENGTH); - changed = true; - } - - if (showAttackers && - actor.getRSInteracting() - 32768 == client.getLocalPlayerIndex()) - { - target = '*' + target; - changed = true; - } - - if (showHitpoints && - actor.getHealth() > 0) - { - int lvlIndex = target.lastIndexOf("(level-"); - if (lvlIndex != -1) - { - String levelReplacement = getHpString(actor, true); - - target = target.substring(0, lvlIndex) + levelReplacement; - changed = true; - } - } - - if (changed) - { - entry.setTarget(target); - return true; - } - - return false; - } - - private boolean fixup(MenuEntry entry) - { - if (isNotAttackEntry(entry)) - { - return false; - } - - int index = entry.getIdentifier(); - - Actor actor = getActorFromIndex(index); - - if (actor == null) - { - return false; - } - - if (actor instanceof Player) - { - index -= 32768; - } - - String target = entry.getTarget(); - - boolean hasAggro = actor.getRSInteracting() - 32768 == client.getLocalPlayerIndex(); - boolean hadAggro = target.charAt(0) == '*'; - boolean isTarget = client.getLocalPlayer().getRSInteracting() == index; - boolean hasHp = showHitpoints && actor instanceof NPC && actor.getHealth() > 0; - - boolean aggroChanged = showAttackers && hasAggro != hadAggro; - boolean targetChanged = showAttacking && isTarget != target.startsWith(attackingColTag, aggroChanged ? 1 : 0); - boolean hpChanged = showHitpoints && hasHp == target.contains("(level-"); - - if (!aggroChanged && - !targetChanged && - !hasHp && - !hpChanged) - { - return false; - } - - if (targetChanged) - { - boolean player = actor instanceof Player; - final int start = hadAggro ? 1 + COLOR_TAG_LENGTH : COLOR_TAG_LENGTH; - target = - (hasAggro ? '*' : "") + - (isTarget ? attackingColTag : - player ? ColorUtil.colorStartTag(0xffffff) : ColorUtil.colorStartTag(0xffff00)) + - target.substring(start); - } - else if (aggroChanged) - { - if (hasAggro) - { - target = '*' + target; - } - else - { - target = target.substring(1); - } - } - - if (hpChanged || hasHp) - { - final int braceIdx; - - if (!hasHp) - { - braceIdx = target.lastIndexOf("("); - if (braceIdx != -1) - { - target = target.substring(0, braceIdx - 1) + "(level-" + actor.getCombatLevel() + ")"; - } - } - else if ((braceIdx = target.lastIndexOf('(')) != -1) - { - final String hpString = getHpString(actor, hpChanged); - - target = target.substring(0, braceIdx) + hpString; - } - } - - entry.setTarget(target); - return true; - } - - private boolean isNotAttackEntry(MenuEntry entry) - { - return entry.getOpcode() != MenuOpcode.NPC_SECOND_OPTION.getId() && - entry.getOpcode() != menuManager.getPlayerAttackOpcode() - || !entry.getOption().equals("Attack"); - } - - private String getHpString(Actor actor, boolean withColorTag) - { - int maxHp = getMaxHp(actor); - int health = actor.getHealth(); - int ratio = actor.getHealthRatio(); - - final String result; - if (maxHp != -1) - { - final int exactHealth = OpponentInfoOverlay.getExactHp(ratio, health, maxHp); - result = "(" + exactHealth + "/" + maxHp + ")"; - } - else - { - result = "(" + (100 * ratio) / health + "%)"; - } - - return withColorTag ? ColorUtil.colorStartTag(0xff0000) + result : result; - } - - int getMaxHp(Actor actor) - { - if (actor instanceof NPC) - { - return npcManager.getHealth(((NPC) actor).getId()); - } - else - { - final HiscoreResult hiscoreResult = hiscoreManager.lookupAsync(Text.removeTags(actor.getName()), getHiscoreEndpoint()); - if (hiscoreResult != null) - { - final int hp = hiscoreResult.getHitpoints().getLevel(); - if (hp > 0) - { - return hp; - } - } - - return -1; - } - } - - private Actor getActorFromIndex(int index) - { - if (index < 32768) - { - return client.getCachedNPCs()[index]; - } - else - { - return client.getCachedPlayers()[index - 32768]; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/PlayerComparisonOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/PlayerComparisonOverlay.java deleted file mode 100644 index c3689f89e6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/PlayerComparisonOverlay.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2018, Jordan Atwood - * Copyright (c) 2018, 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.opponentinfo; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Actor; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.Player; -import net.runelite.api.Skill; -import net.runelite.api.util.Text; -import net.runelite.client.game.HiscoreManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -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.TableAlignment; -import net.runelite.client.ui.overlay.components.table.TableComponent; -import net.runelite.client.util.ColorUtil; -import net.runelite.http.api.hiscore.HiscoreResult; -import net.runelite.http.api.hiscore.HiscoreSkill; - -@Singleton -class PlayerComparisonOverlay extends Overlay -{ - private static final Color HIGHER_STAT_TEXT_COLOR = Color.GREEN; - private static final Color LOWER_STAT_TEXT_COLOR = Color.RED; - private static final Color NEUTRAL_TEXT_COLOR = Color.WHITE; - private static final Color HIGHLIGHT_COLOR = new Color(255, 200, 0, 255); - - private static final Skill[] COMBAT_SKILLS = new Skill[]{ - Skill.ATTACK, - Skill.STRENGTH, - Skill.DEFENCE, - Skill.HITPOINTS, - Skill.RANGED, - Skill.MAGIC, - Skill.PRAYER - }; - - private static final HiscoreSkill[] HISCORE_COMBAT_SKILLS = new HiscoreSkill[]{ - HiscoreSkill.ATTACK, - HiscoreSkill.STRENGTH, - HiscoreSkill.DEFENCE, - HiscoreSkill.HITPOINTS, - HiscoreSkill.RANGED, - HiscoreSkill.MAGIC, - HiscoreSkill.PRAYER - }; - - private static final String SKILL_COLUMN_HEADER = "Skill"; - private static final String PLAYER_COLUMN_HEADER = "You"; - private static final String OPPONENT_COLUMN_HEADER = "Them"; - - private final Client client; - private final OpponentInfoPlugin opponentInfoPlugin; - private final HiscoreManager hiscoreManager; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - private PlayerComparisonOverlay(final Client client, final OpponentInfoPlugin opponentInfoPlugin, final HiscoreManager hiscoreManager) - { - super(opponentInfoPlugin); - this.client = client; - this.opponentInfoPlugin = opponentInfoPlugin; - this.hiscoreManager = hiscoreManager; - - setPosition(OverlayPosition.BOTTOM_LEFT); - setLayer(OverlayLayer.ABOVE_WIDGETS); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Opponent info overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!opponentInfoPlugin.isLookupOnInteraction()) - { - return null; - } - - final Actor opponent = opponentInfoPlugin.getLastOpponent(); - - if (opponent == null) - { - return null; - } - - // Don't try to look up NPC names - if (!(opponent instanceof Player)) - { - return null; - } - - final String opponentName = Text.removeTags(opponent.getName()); - final HiscoreResult hiscoreResult = hiscoreManager.lookupAsync(opponentName, opponentInfoPlugin.getHiscoreEndpoint()); - if (hiscoreResult == null) - { - return null; - } - - panelComponent.getChildren().clear(); - generateComparisonTable(panelComponent, hiscoreResult); - return panelComponent.render(graphics); - } - - private void generateComparisonTable(PanelComponent panelComponent, HiscoreResult opponentSkills) - { - final String opponentName = opponentSkills.getPlayer(); - - panelComponent.getChildren().add( - TitleComponent.builder() - .text(opponentName) - .color(HIGHLIGHT_COLOR) - .build()); - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.CENTER, TableAlignment.RIGHT); - tableComponent.addRow( - ColorUtil.prependColorTag(SKILL_COLUMN_HEADER, HIGHLIGHT_COLOR), - ColorUtil.prependColorTag(PLAYER_COLUMN_HEADER, HIGHLIGHT_COLOR), - ColorUtil.prependColorTag(OPPONENT_COLUMN_HEADER, HIGHLIGHT_COLOR)); - - for (int i = 0; i < COMBAT_SKILLS.length; ++i) - { - final HiscoreSkill hiscoreSkill = HISCORE_COMBAT_SKILLS[i]; - final Skill skill = COMBAT_SKILLS[i]; - - final net.runelite.http.api.hiscore.Skill opponentSkill = opponentSkills.getSkill(hiscoreSkill); - - if (opponentSkill == null || opponentSkill.getLevel() == -1) - { - continue; - } - - final int playerSkillLevel = client.getRealSkillLevel(skill); - final int opponentSkillLevel = opponentSkill.getLevel(); - - tableComponent.addRow( - hiscoreSkill.getName(), - ColorUtil.prependColorTag(Integer.toString(playerSkillLevel), comparisonStatColor(playerSkillLevel, opponentSkillLevel)), - ColorUtil.prependColorTag(Integer.toString(opponentSkillLevel), comparisonStatColor(opponentSkillLevel, playerSkillLevel))); - } - - panelComponent.getChildren().add(tableComponent); - } - - private static Color comparisonStatColor(int a, int b) - { - if (a > b) - { - return HIGHER_STAT_TEXT_COLOR; - } - if (a < b) - { - return LOWER_STAT_TEXT_COLOR; - } - return NEUTRAL_TEXT_COLOR; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyConfig.java deleted file mode 100644 index cf33302d21..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyConfig.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.party; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("party") -public interface PartyConfig extends Config -{ - @ConfigItem( - keyName = "stats", - name = "Stats", - description = "Enables party stats overlay showing HP, prayer and player name" - ) - default boolean stats() - { - return true; - } - - @ConfigItem( - keyName = "pings", - name = "Pings", - description = "Enables party pings (shift + left-click)" - ) - default boolean pings() - { - return true; - } - - @ConfigItem( - keyName = "sounds", - name = "Sound on ping", - description = "Enables sound notification on party ping" - ) - default boolean sounds() - { - return true; - } - - @ConfigItem( - keyName = "messages", - name = "Join messages", - description = "Enables join/leave game messages" - ) - default boolean messages() - { - return true; - } - - @ConfigItem( - keyName = "recolorNames", - name = "Recolor names", - description = "Recolor stats overlay names based on unique color hash" - ) - default boolean recolorNames() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPingOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPingOverlay.java deleted file mode 100644 index f7811806dd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPingOverlay.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2019, Tomas Slusny - * 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.party; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.util.Iterator; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import net.runelite.api.coords.LocalPoint; -import net.runelite.client.plugins.party.data.PartyTilePingData; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayUtil; - -@Singleton -class PartyPingOverlay extends Overlay -{ - private final Client client; - private final PartyPlugin plugin; - - @Inject - private PartyPingOverlay(final Client client, final PartyPlugin plugin) - { - this.client = client; - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.getPartyDataMap().isEmpty()) - { - return null; - } - - synchronized (plugin.getPendingTilePings()) - { - final Iterator iterator = plugin.getPendingTilePings().iterator(); - - while (iterator.hasNext()) - { - PartyTilePingData next = iterator.next(); - - if (next.getAlpha() <= 0) - { - iterator.remove(); - continue; - } - - renderPing(graphics, next); - next.setAlpha(next.getAlpha() - 5); - } - } - - return null; - } - - private void renderPing(final Graphics2D graphics, final PartyTilePingData ping) - { - final LocalPoint localPoint = LocalPoint.fromWorld(client, ping.getPoint()); - - if (localPoint == null) - { - return; - } - - final Polygon poly = Perspective.getCanvasTilePoly(client, localPoint); - - if (poly == null) - { - return; - } - - final Color color = new Color( - ping.getColor().getRed(), - ping.getColor().getGreen(), - ping.getColor().getBlue(), - ping.getAlpha()); - - OverlayUtil.renderPolygon(graphics, poly, color); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java deleted file mode 100644 index c75c28f3e5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java +++ /dev/null @@ -1,672 +0,0 @@ -/* - * Copyright (c) 2019, Tomas Slusny - * 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.party; - -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import com.google.inject.Binder; -import com.google.inject.Provides; -import java.awt.Color; -import java.awt.event.KeyEvent; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import javax.annotation.Nullable; -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.MenuEntry; -import net.runelite.api.MenuOpcode; -import net.runelite.api.Skill; -import net.runelite.api.SoundEffectID; -import net.runelite.api.Tile; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.CommandExecuted; -import net.runelite.api.events.FocusChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.MenuOptionClicked; -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.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.events.OverlayMenuClicked; -import net.runelite.client.events.PartyChanged; -import net.runelite.client.input.KeyListener; -import net.runelite.client.input.KeyManager; -import net.runelite.client.plugins.discord.DiscordUserInfo; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.party.data.PartyData; -import net.runelite.client.plugins.party.data.PartyTilePingData; -import net.runelite.client.plugins.party.messages.LocationUpdate; -import net.runelite.client.plugins.party.messages.SkillUpdate; -import net.runelite.client.plugins.party.messages.TilePing; -import net.runelite.client.task.Schedule; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; -import net.runelite.client.ui.overlay.worldmap.WorldMapPointManager; -import net.runelite.client.util.ColorUtil; -import net.runelite.client.ws.PartyMember; -import net.runelite.client.ws.PartyService; -import net.runelite.client.ws.WSClient; -import net.runelite.http.api.ws.WebsocketMessage; -import net.runelite.http.api.ws.messages.party.Join; -import net.runelite.http.api.ws.messages.party.PartyChatMessage; -import net.runelite.http.api.ws.messages.party.PartyMemberMessage; -import net.runelite.http.api.ws.messages.party.UserJoin; -import net.runelite.http.api.ws.messages.party.UserPart; -import net.runelite.http.api.ws.messages.party.UserSync; - -@PluginDescriptor( - name = "Party", - description = "Shows useful information about current party", - type = PluginType.MISCELLANEOUS -) -@Slf4j -@Singleton -public class PartyPlugin extends Plugin implements KeyListener -{ - @Getter(AccessLevel.PACKAGE) - private final Map partyDataMap = Collections.synchronizedMap(new HashMap<>()); - @Getter(AccessLevel.PACKAGE) - private final List pendingTilePings = Collections.synchronizedList(new ArrayList<>()); - - @Inject - @Named("developerMode") - boolean developerMode; - - @Inject - private Client client; - - @Inject - private PartyService party; - - @Inject - private WSClient ws; - - @Inject - private OverlayManager overlayManager; - - @Inject - private PartyStatsOverlay partyStatsOverlay; - - @Inject - private PartyPingOverlay partyPingOverlay; - - @Inject - private KeyManager keyManager; - - @Inject - private WSClient wsClient; - - @Inject - private WorldMapPointManager worldMapManager; - - @Inject - private PartyConfig config; - - @Inject - private ChatMessageManager chatMessageManager; - - @Inject - private EventBus eventBus; - - private int lastHp, lastPray; - private boolean hotkeyDown, doSync; - private boolean sendAlert; - - @Getter(AccessLevel.PACKAGE) - private boolean stats; - private boolean pings; - private boolean sounds; - private boolean messages; - @Getter(AccessLevel.PACKAGE) - private boolean recolorNames; - - @Override - public void configure(Binder binder) - { - binder.bind(PartyPluginService.class).to(PartyPluginServiceImpl.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(partyStatsOverlay); - overlayManager.add(partyPingOverlay); - wsClient.registerMessage(SkillUpdate.class); - wsClient.registerMessage(TilePing.class); - wsClient.registerMessage(LocationUpdate.class); - keyManager.registerKeyListener(this); - doSync = true; // Delay sync so eventbus can process correctly. - } - - @Override - protected void shutDown() - { - partyDataMap.clear(); - pendingTilePings.clear(); - worldMapManager.removeIf(PartyWorldMapPoint.class::isInstance); - overlayManager.remove(partyStatsOverlay); - overlayManager.remove(partyPingOverlay); - wsClient.unregisterMessage(SkillUpdate.class); - wsClient.unregisterMessage(TilePing.class); - wsClient.unregisterMessage(LocationUpdate.class); - keyManager.unregisterKeyListener(this); - hotkeyDown = false; - doSync = false; - sendAlert = false; - } - - @Provides - public PartyConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(PartyConfig.class); - } - - @Subscribe - private void onOverlayMenuClicked(OverlayMenuClicked event) - { - if (event.getEntry().getMenuOpcode() == MenuOpcode.RUNELITE_OVERLAY && - event.getEntry().getTarget().equals("Party") && - event.getEntry().getOption().equals("Leave")) - { - party.changeParty(null); - - if (!this.messages) - { - return; - } - - final String leaveMessage = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append("You have left the party.") - .build(); - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.FRIENDSCHATNOTIFICATION) - .runeLiteFormattedMessage(leaveMessage) - .build()); - } - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked event) - { - if (!hotkeyDown || client.isMenuOpen() || party.getMembers().isEmpty() || !this.pings) - { - return; - } - - Tile selectedSceneTile = client.getSelectedSceneTile(); - if (selectedSceneTile == null) - { - return; - } - - boolean isOnCanvas = false; - - for (MenuEntry menuEntry : client.getMenuEntries()) - { - if (menuEntry == null) - { - continue; - } - - if ("walk here".equalsIgnoreCase(menuEntry.getOption())) - { - isOnCanvas = true; - break; - } - } - - if (!isOnCanvas) - { - return; - } - - event.consume(); - final TilePing tilePing = new TilePing(selectedSceneTile.getWorldLocation()); - tilePing.setMemberId(party.getLocalMember().getMemberId()); - wsClient.send(tilePing); - } - - @Subscribe - private void onTilePing(TilePing event) - { - if (this.pings) - { - final PartyData partyData = getPartyData(event.getMemberId()); - final Color color = partyData != null ? partyData.getColor() : Color.RED; - pendingTilePings.add(new PartyTilePingData(event.getPoint(), color)); - } - - if (this.sounds) - { - WorldPoint point = event.getPoint(); - - if (point.getPlane() != client.getPlane() || !WorldPoint.isInScene(client, point.getX(), point.getY())) - { - return; - } - - client.playSoundEffect(SoundEffectID.SMITH_ANVIL_TINK); - } - } - - @Schedule( - period = 10, - unit = ChronoUnit.SECONDS - ) - public void shareLocation() - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - final PartyMember localMember = party.getLocalMember(); - - if (localMember == null) - { - return; - } - - final LocationUpdate locationUpdate = new LocationUpdate(client.getLocalPlayer().getWorldLocation()); - locationUpdate.setMemberId(localMember.getMemberId()); - wsClient.send(locationUpdate); - } - - @Subscribe - private void onGameTick(final GameTick event) - { - if (sendAlert && client.getGameState() == GameState.LOGGED_IN) - { - sendAlert = false; - sendInstructionMessage(); - } - - if (doSync && !party.getMembers().isEmpty()) - { - // Request sync - final UserSync userSync = new UserSync(); - userSync.setMemberId(party.getLocalMember().getMemberId()); - ws.send(userSync); - } - - doSync = false; - - final int currentHealth = client.getBoostedSkillLevel(Skill.HITPOINTS); - final int currentPrayer = client.getBoostedSkillLevel(Skill.PRAYER); - final int realHealth = client.getRealSkillLevel(Skill.HITPOINTS); - final int realPrayer = client.getRealSkillLevel(Skill.PRAYER); - final PartyMember localMember = party.getLocalMember(); - - if (localMember != null) - { - if (currentHealth != lastHp) - { - final SkillUpdate update = new SkillUpdate(Skill.HITPOINTS, currentHealth, realHealth); - update.setMemberId(localMember.getMemberId()); - ws.send(update); - } - - if (currentPrayer != lastPray) - { - final SkillUpdate update = new SkillUpdate(Skill.PRAYER, currentPrayer, realPrayer); - update.setMemberId(localMember.getMemberId()); - ws.send(update); - } - } - - lastHp = currentHealth; - lastPray = currentPrayer; - } - - @Subscribe - private void onSkillUpdate(final SkillUpdate event) - { - final PartyData partyData = getPartyData(event.getMemberId()); - - if (partyData == null) - { - return; - } - - if (event.getSkill() == Skill.HITPOINTS) - { - partyData.setHitpoints(event.getValue()); - partyData.setMaxHitpoints(event.getMax()); - } - else if (event.getSkill() == Skill.PRAYER) - { - partyData.setPrayer(event.getValue()); - partyData.setMaxPrayer(event.getMax()); - } - } - - @Subscribe - private void onLocationUpdate(final LocationUpdate event) - { - final PartyData partyData = getPartyData(event.getMemberId()); - - if (partyData == null) - { - return; - } - - partyData.getWorldMapPoint().setWorldPoint(event.getWorldPoint()); - } - - @Subscribe - private void onUserJoin(final UserJoin event) - { - final PartyData partyData = getPartyData(event.getMemberId()); - - if (partyData == null || !this.messages) - { - return; - } - - final String joinMessage = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append(partyData.getName()) - .append(" has joined the party!") - .build(); - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.FRIENDSCHATNOTIFICATION) - .runeLiteFormattedMessage(joinMessage) - .build()); - - final PartyMember localMember = party.getLocalMember(); - - if (localMember != null && partyData.getMemberId().equals(localMember.getMemberId())) - { - sendAlert = true; - } - } - - @Subscribe - private void onUserSync(final UserSync event) - { - final int currentHealth = client.getBoostedSkillLevel(Skill.HITPOINTS); - final int currentPrayer = client.getBoostedSkillLevel(Skill.PRAYER); - final int realHealth = client.getRealSkillLevel(Skill.HITPOINTS); - final int realPrayer = client.getRealSkillLevel(Skill.PRAYER); - final PartyMember localMember = party.getLocalMember(); - - if (localMember != null) - { - final SkillUpdate hpUpdate = new SkillUpdate(Skill.HITPOINTS, currentHealth, realHealth); - hpUpdate.setMemberId(localMember.getMemberId()); - ws.send(hpUpdate); - - final SkillUpdate prayUpdate = new SkillUpdate(Skill.PRAYER, currentPrayer, realPrayer); - prayUpdate.setMemberId(localMember.getMemberId()); - ws.send(prayUpdate); - } - } - - @Subscribe - private void onUserPart(final UserPart event) - { - final PartyData removed = partyDataMap.remove(event.getMemberId()); - - if (removed != null) - { - if (this.messages) - { - final String joinMessage = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append(removed.getName()) - .append(" has left the party!") - .build(); - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.FRIENDSCHATNOTIFICATION) - .runeLiteFormattedMessage(joinMessage) - .build()); - } - - worldMapManager.remove(removed.getWorldMapPoint()); - } - } - - @Subscribe - private void onPartyChanged(final PartyChanged event) - { - // Reset party - partyDataMap.clear(); - pendingTilePings.clear(); - worldMapManager.removeIf(PartyWorldMapPoint.class::isInstance); - } - - @Subscribe - private void onCommandExecuted(CommandExecuted commandExecuted) - { - if (!developerMode || !commandExecuted.getCommand().equals("partyinfo")) - { - return; - } - - chatMessageManager.queue(QueuedMessage.builder().type(ChatMessageType.GAMEMESSAGE).value("Party " + party.getPartyId()).build()); - chatMessageManager.queue(QueuedMessage.builder().type(ChatMessageType.GAMEMESSAGE).value("Local Party " + party.getLocalPartyId()).build()); - chatMessageManager.queue(QueuedMessage.builder().type(ChatMessageType.GAMEMESSAGE).value("Local ID " + party.getLocalMember().getMemberId()).build()); - for (PartyMember partyMember : party.getMembers()) - { - chatMessageManager.queue(QueuedMessage.builder().type(ChatMessageType.GAMEMESSAGE).value(" " + partyMember.getName() + " " + partyMember.getMemberId()).build()); - } - } - - @Subscribe - private void onPartyMemberMessage(PartyMemberMessage event) - { - JsonObject jobj = new Gson().fromJson(event.text, JsonObject.class); - if (jobj.get("type").getAsString().equals("SkillUpdate")) - { - Skill skillToUpdate = Skill.valueOf(jobj.get("skill").getAsString()); - SkillUpdate skillUpdateEvent = new SkillUpdate(skillToUpdate, jobj.get("value").getAsInt(), jobj.get("max").getAsInt()); - skillUpdateEvent.setMemberId(event.getMemberId()); - eventBus.post(SkillUpdate.class, skillUpdateEvent); - return; - } - - if (jobj.get("type").getAsString().equals("LocationUpdate")) - { - WorldPoint worldPoint = new WorldPoint(jobj.get("worldPoint").getAsJsonObject().get("x").getAsInt(), jobj.get("worldPoint").getAsJsonObject().get("y").getAsInt(), jobj.get("worldPoint").getAsJsonObject().get("plane").getAsInt()); - LocationUpdate locationUpdate = new LocationUpdate(worldPoint); - locationUpdate.setMemberId(event.getMemberId()); - eventBus.post(LocationUpdate.class, locationUpdate); - return; - } - - if (jobj.get("type").getAsString().equals("DiscordUserInfo")) - { - DiscordUserInfo info = new DiscordUserInfo(jobj.get("userId").getAsString(), jobj.get("avatarId").getAsString()); - info.setMemberId(event.getMemberId()); - eventBus.post(DiscordUserInfo.class, info); - } - } - - @Subscribe - private void onWebsocketMessage(WebsocketMessage event) - { - JsonObject jobj = new Gson().fromJson(event.text, JsonObject.class); - if (jobj.get("type").getAsString().equals("UserJoin")) - { - UserJoin joinEvent = new UserJoin(UUID.fromString(jobj.get("memberId").getAsString()), UUID.fromString(jobj.get("partyId").getAsString()), jobj.get("name").getAsString()); - eventBus.post(UserJoin.class, joinEvent); - return; - } - if (jobj.get("type").getAsString().equals("Join")) - { - Join joinEvent = new Join(UUID.fromString(jobj.get("partyId").getAsString()), jobj.get("name").getAsString()); - eventBus.post(Join.class, joinEvent); - return; - } - if (jobj.get("type").getAsString().equals("PartyChatMessage")) - { - PartyChatMessage partyChatMessageEvent = new PartyChatMessage(jobj.get("value").getAsString()); - eventBus.post(PartyChatMessage.class, partyChatMessageEvent); - return; - } - if (jobj.get("type").getAsString().equals("UserPart")) - { - UserPart userPartEvent = new UserPart(UUID.fromString(jobj.get("memberId").getAsString())); - eventBus.post(UserPart.class, userPartEvent); - return; - } - if (jobj.get("type").getAsString().equals("UserSync")) - { - UserSync userPartEvent = new UserSync(); - eventBus.post(UserSync.class, userPartEvent); - return; - } - if (jobj.get("type").getAsString().equals("TilePing")) - { - WorldPoint worldPoint = new WorldPoint(jobj.get("worldPoint").getAsJsonObject().get("x").getAsInt(), jobj.get("worldPoint").getAsJsonObject().get("y").getAsInt(), jobj.get("worldPoint").getAsJsonObject().get("plane").getAsInt()); - TilePing tilePing = new TilePing(worldPoint); - eventBus.post(TilePing.class, tilePing); - return; - } - - log.debug("Unhandled WS event: {}", event.text); - - } - - @Nullable - PartyData getPartyData(final UUID uuid) - { - final PartyMember memberById = party.getMemberById(uuid); - - if (memberById == null) - { - // This happens when you are not in party but you still receive message. - // Can happen if you just left party and you received message before message went through - // in ws service - return null; - } - - return partyDataMap.computeIfAbsent(uuid, (u) -> - { - final String name = memberById.getName(); - final WorldMapPoint worldMapPoint = new PartyWorldMapPoint(new WorldPoint(0, 0, 0), memberById); - worldMapPoint.setTooltip(name); - - // When first joining a party, other members can join before getting a join for self - PartyMember partyMember = party.getLocalMember(); - if (partyMember == null || !u.equals(partyMember.getMemberId())) - { - worldMapManager.add(worldMapPoint); - } - - return new PartyData(u, name, worldMapPoint, ColorUtil.fromObject(name)); - }); - } - - @Subscribe - private void onFocusChanged(FocusChanged event) - { - if (!event.isFocused()) - { - hotkeyDown = false; - } - } - - @Override - public void keyTyped(KeyEvent keyEvent) - { - - } - - @Override - public void keyPressed(KeyEvent keyEvent) - { - if (keyEvent.getKeyCode() == KeyEvent.VK_SHIFT) - { - hotkeyDown = true; - } - } - - @Override - public void keyReleased(KeyEvent keyEvent) - { - if (keyEvent.getKeyCode() == KeyEvent.VK_SHIFT) - { - hotkeyDown = false; - } - } - - private void sendInstructionMessage() - { - final String helpMessage = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append("To leave party hold SHIFT and right click party stats overlay.") - .build(); - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.FRIENDSCHATNOTIFICATION) - .runeLiteFormattedMessage(helpMessage) - .build()); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("party")) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.stats = config.stats(); - this.pings = config.pings(); - this.sounds = config.sounds(); - this.messages = config.messages(); - this.recolorNames = config.recolorNames(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPluginService.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPluginService.java deleted file mode 100644 index bc9b22b1eb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPluginService.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.party; - -import java.util.UUID; -import javax.annotation.Nullable; -import net.runelite.client.plugins.party.data.PartyData; - -interface PartyPluginService -{ - /** - * Get the party data for a party member - * - * @param memberId member id - * @return party data for member - */ - @Nullable - PartyData getPartyData(UUID memberId); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPluginServiceImpl.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPluginServiceImpl.java deleted file mode 100644 index 042a5e7919..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPluginServiceImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.party; - -import java.util.UUID; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.client.plugins.party.data.PartyData; - -@Singleton -public class PartyPluginServiceImpl implements PartyPluginService -{ - private final PartyPlugin plugin; - - @Inject - private PartyPluginServiceImpl(final PartyPlugin plugin) - { - - this.plugin = plugin; - } - - @Override - public PartyData getPartyData(UUID memberId) - { - return plugin.getPartyData(memberId); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyStatsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyStatsOverlay.java deleted file mode 100644 index 82e5095234..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyStatsOverlay.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2019, Tomas Slusny - * 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.party; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.Rectangle; -import java.util.Map; -import java.util.UUID; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.MenuOpcode; -import net.runelite.client.plugins.party.data.PartyData; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayMenuEntry; -import net.runelite.client.ui.overlay.components.ComponentConstants; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.ProgressBarComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; -import net.runelite.client.ws.PartyService; - -@Singleton -public class PartyStatsOverlay extends Overlay -{ - private static final Color HP_FG = new Color(0, 146, 54, 230); - private static final Color HP_BG = new Color(102, 15, 16, 230); - private static final Color PRAY_FG = new Color(0, 149, 151); - private static final Color PRAY_BG = Color.black; - - private final PartyPlugin plugin; - private final PartyService party; - private final PanelComponent body = new PanelComponent(); - - @Inject - private PartyStatsOverlay(final PartyPlugin plugin, final PartyService party) - { - super(plugin); - this.plugin = plugin; - this.party = party; - body.setBorder(new Rectangle()); - body.setGap(new Point(0, ComponentConstants.STANDARD_BORDER / 2)); - getMenuEntries().add(new OverlayMenuEntry(MenuOpcode.RUNELITE_OVERLAY, "Leave", "Party")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isStats()) - { - return null; - } - - final Map partyDataMap = plugin.getPartyDataMap(); - if (partyDataMap.isEmpty()) - { - return null; - } - - body.getChildren().clear(); - body.setBackgroundColor(null); - - boolean only1 = plugin.getPartyDataMap().size() == 1; - - synchronized (plugin.getPartyDataMap()) - { - partyDataMap.forEach((k, v) -> - { - if (party.getLocalMember() != null && party.getLocalMember().getMemberId().equals(k)) - { - if (only1) - { - body.getChildren().add(TitleComponent.builder() - .text("No other party members") - .color(Color.RED) - .build()); - } - - return; - } - - final PanelComponent panel = v.getPanel(); - panel.getChildren().clear(); - - final TitleComponent name = TitleComponent.builder() - .text(v.getName()) - .color(plugin.isRecolorNames() ? v.getColor() : Color.WHITE) - .build(); - - panel.getChildren().add(name); - - if (v.getMaxHitpoints() > 0) - { - final ProgressBarComponent hpBar = new ProgressBarComponent(); - hpBar.setBackgroundColor(HP_BG); - hpBar.setForegroundColor(HP_FG); - hpBar.setMaximum(v.getMaxHitpoints()); - hpBar.setValue(v.getHitpoints()); - hpBar.setLabelDisplayMode(ProgressBarComponent.LabelDisplayMode.FULL); - panel.getChildren().add(hpBar); - } - - if (v.getMaxPrayer() > 0) - { - final ProgressBarComponent prayBar = new ProgressBarComponent(); - prayBar.setBackgroundColor(PRAY_BG); - prayBar.setForegroundColor(PRAY_FG); - prayBar.setMaximum(v.getMaxPrayer()); - prayBar.setValue(v.getPrayer()); - prayBar.setLabelDisplayMode(ProgressBarComponent.LabelDisplayMode.FULL); - panel.getChildren().add(prayBar); - } - - body.getChildren().add(panel); - }); - } - - return body.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyWorldMapPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyWorldMapPoint.java deleted file mode 100644 index a81979c779..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyWorldMapPoint.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2019, Tomas Slusny - * 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.party; - -import java.awt.Graphics; -import java.awt.image.BufferedImage; -import net.runelite.api.Point; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; -import net.runelite.client.util.ImageUtil; -import net.runelite.client.ws.PartyMember; - -class PartyWorldMapPoint extends WorldMapPoint -{ - private static final BufferedImage ARROW = ImageUtil.getResourceStreamFromClass(PartyWorldMapPoint.class, "/util/clue_arrow.png"); - - private BufferedImage partyImage; - private final PartyMember member; - - PartyWorldMapPoint(final WorldPoint worldPoint, final PartyMember member) - { - super(worldPoint, null); - this.member = member; - this.setSnapToEdge(true); - this.setJumpOnClick(true); - this.setImagePoint(new Point( - ARROW.getWidth() / 2, - ARROW.getHeight())); - } - - @Override - public BufferedImage getImage() - { - if (partyImage == null && member != null && member.getAvatar() != null) - { - partyImage = new BufferedImage(ARROW.getWidth(), ARROW.getHeight(), BufferedImage.TYPE_INT_ARGB); - Graphics g = partyImage.getGraphics(); - g.drawImage(ARROW, 0, 0, null); - g.drawImage(ImageUtil.resizeImage(member.getAvatar(), 28, 28), 2, 2, null); - } - - return partyImage; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/data/PartyData.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/data/PartyData.java deleted file mode 100644 index efd483b173..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/data/PartyData.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2019, Tomas Slusny - * 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.party.data; - -import java.awt.Color; -import java.util.UUID; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; - -@Setter(AccessLevel.PUBLIC) -@Getter(AccessLevel.PUBLIC) -@RequiredArgsConstructor -public class PartyData -{ - private final UUID memberId; - private final String name; - private final WorldMapPoint worldMapPoint; - private final PanelComponent panel = new PanelComponent(); - private final Color color; - - private int hitpoints; - private int maxHitpoints; - private int prayer; - private int maxPrayer; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/data/PartyTilePingData.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/data/PartyTilePingData.java deleted file mode 100644 index 1629e4f660..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/data/PartyTilePingData.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2019, Tomas Slusny - * 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.party.data; - -import java.awt.Color; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; -import net.runelite.api.coords.WorldPoint; - -@RequiredArgsConstructor -@Getter(AccessLevel.PUBLIC) -@Setter(AccessLevel.PUBLIC) -public class PartyTilePingData -{ - private final WorldPoint point; - private final Color color; - private int alpha = 255; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/LocationUpdate.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/LocationUpdate.java deleted file mode 100644 index 1def4ffd2a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/LocationUpdate.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2019, Tomas Slusny - * 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.party.messages; - -import lombok.EqualsAndHashCode; -import lombok.Value; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.Event; -import net.runelite.http.api.ws.messages.party.PartyMemberMessage; - -@Value -@EqualsAndHashCode(callSuper = true) -public class LocationUpdate extends PartyMemberMessage implements Event -{ - private final WorldPoint worldPoint; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/SkillUpdate.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/SkillUpdate.java deleted file mode 100644 index 4c5fd33b47..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/SkillUpdate.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2019, Tomas Slusny - * 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.party.messages; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.Skill; -import net.runelite.api.events.Event; -import net.runelite.http.api.ws.messages.party.PartyMemberMessage; - -@AllArgsConstructor -@Getter(AccessLevel.PUBLIC) -public class SkillUpdate extends PartyMemberMessage implements Event -{ - private final Skill skill; - private final int value; - private final int max; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/TilePing.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/TilePing.java deleted file mode 100644 index 40b3f7db78..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/TilePing.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2019, Tomas Slusny - * 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.party.messages; - -import lombok.EqualsAndHashCode; -import lombok.Value; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.Event; -import net.runelite.http.api.ws.messages.party.PartyMemberMessage; - -@Value -@EqualsAndHashCode(callSuper = true) -public class TilePing extends PartyMemberMessage implements Event -{ - private final WorldPoint point; -} 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 deleted file mode 100644 index eecf8b95ea..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/Performance.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.http.api.ws.messages.party.PartyMemberMessage; - -@Getter(AccessLevel.PACKAGE) -class Performance extends PartyMemberMessage -{ - private static final double TICK_LENGTH = 0.6; - - @Setter(AccessLevel.PACKAGE) - String username; - - double damageDealt = 0; - double highestHitDealt = 0; - - double damageTaken = 0; - double highestHitTaken = 0; - - int lastActivityTick = -1; - @Setter(AccessLevel.PACKAGE) - 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; - } - - private 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 deleted file mode 100644 index 1c6aea301d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsConfig.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 deleted file mode 100644 index 445250b107..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsOverlay.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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 javax.inject.Singleton; -import net.runelite.api.MenuOpcode; -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; - -@Singleton -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(final PerformanceStatsPlugin tracker) - { - super(tracker); - setPosition(OverlayPosition.TOP_RIGHT); - setPriority(OverlayPriority.LOW); - this.tracker = tracker; - - getMenuEntries().add(new OverlayMenuEntry(MenuOpcode.RUNELITE_OVERLAY, "Pause", TARGET)); - getMenuEntries().add(new OverlayMenuEntry(MenuOpcode.RUNELITE_OVERLAY, "Reset", TARGET)); - getMenuEntries().add(new OverlayMenuEntry(MenuOpcode.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); - - 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); - } - - private String[] createRowElements(Performance performance) - { - return new String[] - { - performance.getUsername(), - (int) Math.round(performance.getDamageDealt()) + " | " + (int) Math.round(performance.getHighestHitDealt()), - (int) Math.round(performance.getDamageTaken()) + " | " + (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 deleted file mode 100644 index b8b8175057..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsPlugin.java +++ /dev/null @@ -1,456 +0,0 @@ -/* - * 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 java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -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.FakeXpDrop; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.HitsplatApplied; -import net.runelite.api.events.StatChanged; -import net.runelite.api.util.Text; -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.ConfigChanged; -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.plugins.PluginType; -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 net.runelite.http.api.ws.messages.party.UserPart; -import net.runelite.http.api.ws.messages.party.UserSync; - -@PluginDescriptor( - name = "Performance Stats", - description = "Displays your current performance stats", - tags = {"performance", "stats", "dps", "damage", "combat"}, - type = PluginType.UTILITY, - enabledByDefault = false -) -@Slf4j -@Singleton -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; - - @Inject - private PartyService partyService; - - @Inject - private WSClient wsClient; - - @Getter(AccessLevel.PACKAGE) - private boolean enabled = false; - @Getter(AccessLevel.PACKAGE) - private boolean paused = false; - @Getter(AccessLevel.PACKAGE) - 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; - - private int submitTimeout; - - // Party System - @Getter(AccessLevel.PACKAGE) - private final Map partyDataMap = Collections.synchronizedMap(new HashMap<>()); - - @Provides - PerformanceStatsConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(PerformanceStatsConfig.class); - } - - @Override - protected void startUp() - { - - this.submitTimeout = config.submitTimeout(); - - overlayManager.add(performanceTrackerOverlay); - wsClient.registerMessage(Performance.class); - } - - @Override - protected void shutDown() - { - overlayManager.remove(performanceTrackerOverlay); - wsClient.unregisterMessage(Performance.class); - disable(); - reset(); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - switch (event.getGameState()) - { - case LOGIN_SCREEN: - disable(); - break; - case HOPPING: - hopping = true; - break; - } - } - - @Subscribe - private 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 - private void onStatChanged(StatChanged 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 - private void onFakeXpDrop(FakeXpDrop fakeXpDrop) - { - if (fakeXpDrop.getSkill().equals(Skill.HITPOINTS)) - { - // Auto enables when player would have received hp exp - if (!isEnabled()) - { - enable(); - } - - final int exp = fakeXpDrop.getXp(); - performance.addDamageDealt(calculateDamageDealt(exp), client.getTickCount()); - } - } - - @Subscribe - private void onGameTick(GameTick t) - { - oldTarget = client.getLocalPlayer().getInteracting(); - - if (!isEnabled()) - { - return; - } - - if (isPaused()) - { - pausedTicks++; - return; - } - - performance.incrementTicksSpent(); - hopping = false; - - final int timeout = this.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(); - } - } - - final String name = client.getLocalPlayer().getName(); - performance.setUsername(Text.removeTags(name)); - sendPerformance(); - } - - @Subscribe - private 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(); - } - - private void sendPerformance() - { - final PartyMember me = partyService.getLocalMember(); - if (me != null && me.getMemberId() != null) - { - performance.setMemberId(me.getMemberId()); - wsClient.send(performance); - } - } - - @Subscribe - private void onPerformance(final Performance performance) - { - partyDataMap.put(performance.getMemberId(), performance); - } - - @Subscribe - private void onUserSync(final UserSync event) - { - if (isEnabled()) - { - sendPerformance(); - } - } - - @Subscribe - private void onUserPart(final UserPart event) - { - partyDataMap.remove(event.getMemberId()); - } - - @Subscribe - private void onPartyChanged(final PartyChanged event) - { - // Reset party - partyDataMap.clear(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("performancestats")) - { - return; - } - - this.submitTimeout = config.submitTimeout(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/Game.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/Game.java deleted file mode 100644 index 64deb7876d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/Game.java +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * Copyright (c) 2019, Yani - * 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.pestcontrol; - -import java.time.Duration; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameTick; - -@Slf4j -public class Game -{ - private final Client client; - - private final PestControlPlugin plugin; - - @Getter(AccessLevel.PACKAGE) - private Portal bluePortal = new Portal(PortalColor.BLUE, WidgetPortal.BLUE); - - @Getter(AccessLevel.PACKAGE) - private Portal purplePortal = new Portal(PortalColor.PURPLE, WidgetPortal.PURPLE); - - @Getter(AccessLevel.PACKAGE) - private Portal yellowPortal = new Portal(PortalColor.YELLOW, WidgetPortal.YELLOW); - - @Getter(AccessLevel.PACKAGE) - private Portal redPortal = new Portal(PortalColor.RED, WidgetPortal.RED); - - @Getter(AccessLevel.PACKAGE) - private int shieldsDropped = 0; - - // Game starts with all possible rotations - private PortalRotation[] possibleRotations = PortalRotation.values(); - - private boolean portalLocationsSet = false; - - - private final Instant startTime = Instant.now(); - - public Game(Client client, PestControlPlugin plugin) - { - this.client = client; - this.plugin = plugin; - } - - public void onGameTick(GameTick gameTickEvent) - { - if (!portalLocationsSet) - { - loadPortalLocations(); - } - - WidgetOverlay widgetOverlay = plugin.getWidgetOverlay(); - - if (!purplePortal.isDead() && widgetOverlay.getPortalHitpoints(PortalColor.PURPLE) == 0) - { - killPortal(purplePortal); - } - - if (!yellowPortal.isDead() && widgetOverlay.getPortalHitpoints(PortalColor.YELLOW) == 0) - { - killPortal(yellowPortal); - } - - if (!redPortal.isDead() && widgetOverlay.getPortalHitpoints(PortalColor.RED) == 0) - { - killPortal(redPortal); - } - - if (!bluePortal.isDead() && widgetOverlay.getPortalHitpoints(PortalColor.BLUE) == 0) - { - killPortal(bluePortal); - } - } - - void lowerPortalShield(String portalColor) - { - switch (portalColor.toLowerCase()) - { - case "purple": - lowerPortalShield(purplePortal); - break; - case "red": - lowerPortalShield(redPortal); - break; - case "yellow": - lowerPortalShield(yellowPortal); - break; - case "blue": - lowerPortalShield(bluePortal); - break; - } - } - - private void lowerPortalShield(Portal portal) - { - if (portal.isNotShielded()) - { - return; - } - - log.debug("Shield dropped for {}", portal.getColor()); - - portal.setPortalState(PortalState.ACTIVE); - - int shieldDrop = shieldsDropped++; - - // Remove impossible rotations - List rotations = new ArrayList<>(); - - for (PortalRotation rotation : possibleRotations) - { - if (rotation.getPortal(this, shieldDrop) == portal) - { - rotations.add(rotation); - } - } - - possibleRotations = rotations.toArray(new PortalRotation[0]); - } - - private void killPortal(Portal portal) - { - if (portal.isDead()) - { - return; - } - - log.debug("Portal {} died", portal.getColor()); - - portal.setPortalState(PortalState.DEAD); - } - - private void loadPortalLocations() - { - NPC squire = null; - - for (NPC npc : client.getNpcs()) - { - if (PestControlNpc.isIngameSquireId(npc.getId())) - { - squire = npc; - break; - } - } - - if (squire != null) - { - log.debug("In-game Squire found: {}", squire); - setPortalLocations(squire.getWorldLocation()); - - } - - } - - private void setPortalLocations(WorldPoint squireLocation) - { - int x = squireLocation.getX(); - int y = squireLocation.getY(); - - purplePortal.setLocation(new WorldPoint(x - 26, y - 15, 0)); - bluePortal.setLocation(new WorldPoint(x + 26, y - 18, 0)); - yellowPortal.setLocation(new WorldPoint(x + 15, y - 36, 0)); - redPortal.setLocation(new WorldPoint(x - 9, y - 37, 0)); - - portalLocationsSet = true; - } - - List getPortals() - { - List portalList = new ArrayList<>(); - - portalList.add(getPurplePortal()); - portalList.add(getBluePortal()); - portalList.add(getYellowPortal()); - portalList.add(getRedPortal()); - - return portalList; - } - - Portal getPortal(PortalColor portalColor) - { - if (bluePortal.getColor() == portalColor) - { - return bluePortal; - } - if (redPortal.getColor() == portalColor) - { - return redPortal; - } - if (purplePortal.getColor() == portalColor) - { - return purplePortal; - } - if (yellowPortal.getColor() == portalColor) - { - return yellowPortal; - } - - return null; - } - - Collection getNextPortals() - { - List portals = new ArrayList<>(); - - for (PortalRotation rotation : possibleRotations) - { - Portal portal = rotation.getPortal(this, shieldsDropped); - - if (portal != null && !portals.contains(portal)) - { - portals.add(portal); - } - } - - return portals; - } - - Collection getActivePortals() - { - List portals = new ArrayList<>(); - - for (Portal portal : getPortals()) - { - if (portal.isActive()) - { - portals.add(portal); - } - } - - return portals; - } - - Duration getTimeTillNextPortal() - { - Instant nextShieldDrop; - - if (shieldsDropped == 4) - { - return null; - } - - if (shieldsDropped == 0) - { - nextShieldDrop = Instant.ofEpochSecond(startTime.getEpochSecond() + 17); - } - else - { - nextShieldDrop = Instant.ofEpochSecond(startTime.getEpochSecond() + 17 + (30 * shieldsDropped)); - } - - return Duration.between(Instant.now(), nextShieldDrop); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/GangplankOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/GangplankOverlay.java deleted file mode 100644 index 1e1b24b13a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/GangplankOverlay.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2019, Yani - * 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.pestcontrol; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Shape; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.Player; -import net.runelite.api.Point; -import net.runelite.api.Tile; -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.tooltip.Tooltip; -import net.runelite.client.ui.overlay.tooltip.TooltipManager; -import net.runelite.client.util.ColorUtil; - -@Slf4j -@Singleton -public class GangplankOverlay extends Overlay -{ - private final Client client; - private final PestControlPlugin plugin; - private final TooltipManager tooltipManager; - - @Inject - GangplankOverlay(final Client client, final PestControlPlugin plugin, final TooltipManager toolTipManager) - { - this.plugin = plugin; - this.client = client; - this.tooltipManager = toolTipManager; - - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isOnPestControlMainIsland()) - { - return null; - } - - Player localPlayer = client.getLocalPlayer(); - - if (localPlayer == null) - { - return null; - } - - int combatLevel = localPlayer.getCombatLevel(); - - Color noviceCbColor = (combatLevel >= 40) ? Color.GREEN : Color.RED; - Color intermediateCbColor = (combatLevel >= 70) ? Color.GREEN : Color.RED; - Color veteranCbColor = (combatLevel >= 100) ? Color.GREEN : Color.RED; - - Tile noviceGangplankTile = plugin.getNoviceGangplankTile(); - Tile intermediateGangplankTile = plugin.getIntermediateGangplankTile(); - Tile veteranGangplankTile = plugin.getVeteranGangplankTile(); - - Point mousePosition = client.getMouseCanvasPosition(); - String tooltipString = null; - - if (noviceGangplankTile != null) - { - Shape polygon = noviceGangplankTile.getGameObjects()[0].getConvexHull(); - if (polygon != null) - { - graphics.setColor(noviceCbColor); - graphics.setStroke(new BasicStroke(2)); - graphics.draw(polygon); - graphics.setColor(setColorAlpha(noviceCbColor, 45)); - graphics.fill(polygon); - - if (polygon.contains(mousePosition.getX(), mousePosition.getY())) - { - tooltipString = ColorUtil.wrapWithColorTag("Combat 40+", noviceCbColor) + " (3 points)"; - graphics.setColor(setColorAlpha(noviceCbColor, 65)); - graphics.fill(polygon); - } - } - } - - if (intermediateGangplankTile != null) - { - Shape polygon = intermediateGangplankTile.getGameObjects()[0].getConvexHull(); - if (polygon != null) - { - graphics.setColor(intermediateCbColor); - graphics.setStroke(new BasicStroke(2)); - graphics.draw(polygon); - graphics.setColor(setColorAlpha(intermediateCbColor, 45)); - graphics.fill(polygon); - - if (polygon.contains(mousePosition.getX(), mousePosition.getY())) - { - tooltipString = ColorUtil.wrapWithColorTag("Combat 70+", intermediateCbColor) + " (4 points)"; - graphics.setColor(setColorAlpha(intermediateCbColor, 65)); - graphics.fill(polygon); - } - } - } - - if (veteranGangplankTile != null) - { - Shape polygon = veteranGangplankTile.getGameObjects()[0].getConvexHull(); - if (polygon != null) - { - graphics.setColor(veteranCbColor); - graphics.setStroke(new BasicStroke(2)); - graphics.draw(polygon); - graphics.setColor(setColorAlpha(veteranCbColor, 45)); - graphics.fill(polygon); - - if (polygon.contains(mousePosition.getX(), mousePosition.getY())) - { - tooltipString = ColorUtil.wrapWithColorTag("Combat 100+", veteranCbColor) + " (5 points)"; - graphics.setColor(setColorAlpha(veteranCbColor, 65)); - graphics.fill(polygon); - } - } - } - - if (tooltipString != null) - { - tooltipManager.add(new Tooltip(tooltipString)); - } - - return null; - } - - private Color setColorAlpha(Color color, int alpha) - { - return new Color( - color.getRed(), - color.getGreen(), - color.getBlue(), - alpha - ); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/HintArrowOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/HintArrowOverlay.java deleted file mode 100644 index b22798f57e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/HintArrowOverlay.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (c) 2019, Yani - * 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.pestcontrol; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.NPC; -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; - -@Singleton -public class HintArrowOverlay extends Overlay -{ - private final PestControlPlugin plugin; - private final Client client; - - @Inject - HintArrowOverlay(final PestControlPlugin plugin, final Client client) - { - this.plugin = plugin; - this.client = client; - - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.getGame() == null) - { - return null; - } - - List visibleActivePortals = new ArrayList<>(); - - for (NPC npc : client.getNpcs()) - { - if (PestControlNpc.isActivePortalId(npc.getId())) - { - visibleActivePortals.add(npc); - } - } - - if (!visibleActivePortals.isEmpty()) - { - NPC closestPortalNpc = getClosestNpc(visibleActivePortals); - - if (closestPortalNpc != null) - { - NPC currentHintArrowTarget = client.getHintArrowNpc(); - - if (currentHintArrowTarget == null || currentHintArrowTarget != closestPortalNpc) - { - client.setHintArrow(closestPortalNpc); - } - } - - return null; - } - - Portal closestActivePortal = getClosestPortal(PortalState.ACTIVE); - - if (closestActivePortal != null) - { - WorldPoint currentHintArrowLocation = client.getHintArrowPoint(); - WorldPoint closestActivePortalLocation = closestActivePortal.getLocation(); - - if (currentHintArrowLocation == null || currentHintArrowLocation != closestActivePortalLocation) - { - client.setHintArrow(closestActivePortalLocation); - } - - return null; - } - - Collection nextPortalList = plugin.getGame().getNextPortals(); - - if (nextPortalList.size() == 1) - { - client.setHintArrow(nextPortalList.iterator().next().getLocation()); - - return null; - } - - return null; - } - - private NPC getClosestNpc(List npcList) - { - WorldPoint currentLocation = client.getLocalPlayer().getWorldLocation(); - - NPC closestNpc = null; - int currentShortestDistance = 1337; - int distanceToNpc; - - for (NPC npc : npcList) - { - if (closestNpc != null) - { - distanceToNpc = npc.getWorldLocation().distanceTo(currentLocation); - - if (distanceToNpc < currentShortestDistance) - { - closestNpc = npc; - currentShortestDistance = distanceToNpc; - } - } - else - { - closestNpc = npc; - } - } - - return closestNpc; - } - - private Portal getClosestPortal(PortalState portalState) - { - WorldPoint currentLocation = client.getLocalPlayer().getWorldLocation(); - - Portal closestPortal = null; - int currentShortestDistance = 1337; - int distanceToWorldPoint; - - for (Portal portal : plugin.getGame().getPortals()) - { - if (portal.getPortalState() != portalState) - { - continue; - } - - distanceToWorldPoint = portal.getLocation().distanceTo(currentLocation); - - if (distanceToWorldPoint < currentShortestDistance) - { - closestPortal = portal; - currentShortestDistance = distanceToWorldPoint; - } - } - - return closestPortal; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/NpcHighlightContext.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/NpcHighlightContext.java deleted file mode 100644 index 049f649de0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/NpcHighlightContext.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2019, Yani - * 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.pestcontrol; - -import java.awt.Color; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; -import net.runelite.client.plugins.pestcontrol.config.NpcHighlightStyle; - -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -@Setter(AccessLevel.PACKAGE) -class NpcHighlightContext -{ - private NpcHighlightStyle npcRenderStyle; - private Color color; - private boolean showNpcName; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/NpcHighlightOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/NpcHighlightOverlay.java deleted file mode 100644 index b66085995d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/NpcHighlightOverlay.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2019, Yani - * 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.pestcontrol; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.Shape; -import java.util.HashMap; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.client.plugins.pestcontrol.config.NpcHighlightStyle; -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; - -@Slf4j -@Singleton -public class NpcHighlightOverlay extends Overlay -{ - private final PestControlPlugin plugin; - private final Client client; - - @Inject - NpcHighlightOverlay(final PestControlPlugin plugin, final Client client) - { - this.plugin = plugin; - this.client = client; - - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.getGame() == null) - { - return null; - } - - HashMap highlightedNpcList = plugin.getHighlightedNpcList(); - - for (NPC npc : client.getNpcs()) - { - if (!highlightedNpcList.containsKey(npc.getId())) - { - continue; - } - - NpcHighlightContext npcHighlightContext = plugin.getHighlightedNpcList().get(npc.getId()); - - String name = npcHighlightContext.isShowNpcName() ? npc.getName() : null; - Color color = npcHighlightContext.getColor(); - NpcHighlightStyle highlightStyle = npcHighlightContext.getNpcRenderStyle(); - - switch (highlightStyle) - { - case HULL: - { - renderHullOverlay(graphics, npc, color); - break; - } - case TILE: - { - renderTileOverlay(graphics, npc, color); - break; - } - case BOTH: - { - renderHullOverlay(graphics, npc, color); - renderTileOverlay(graphics, npc, color); - break; - } - } - - if (name != null) - { - renderTextOverlay(graphics, npc, name, color); - } - } - - return null; - } - - private void renderTileOverlay(Graphics2D graphics, NPC npc, Color color) - { - Polygon polygon; - Color fillColor; - - // Double the polygon size if it's a Brawler - if (PestControlNpc.isBrawlerId(npc.getId())) - { - polygon = Perspective.getCanvasTileAreaPoly(client, npc.getLocalLocation(), 2); - fillColor = new Color(color.getRed(), color.getGreen(), color.getBlue(), 35); - } - else - { - polygon = npc.getCanvasTilePoly(); - fillColor = new Color(0, 0, 0, 50); - } - - if (polygon != null) - { - graphics.setColor(color); - graphics.setStroke(new BasicStroke(2)); - graphics.drawPolygon(polygon); - graphics.setColor(fillColor); - graphics.fillPolygon(polygon); - } - } - - private void renderHullOverlay(Graphics2D graphics, NPC npc, Color color) - { - Shape objectClickbox = npc.getConvexHull(); - if (objectClickbox != null) - { - graphics.setColor(color); - graphics.setStroke(new BasicStroke(2)); - graphics.draw(objectClickbox); - graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20)); - graphics.fill(objectClickbox); - } - } - - private void renderTextOverlay(Graphics2D graphics, NPC npc, String text, Color color) - { - Point textLocation = npc.getCanvasTextLocation(graphics, text, npc.getLogicalHeight() + 40); - if (textLocation != null) - { - OverlayUtil.renderTextLocation(graphics, textLocation, text, color); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PestControlConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PestControlConfig.java deleted file mode 100644 index 03162389ad..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PestControlConfig.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2019, Yani - * 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.pestcontrol; - -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.plugins.pestcontrol.config.HighlightPortalOption; -import net.runelite.client.plugins.pestcontrol.config.NpcHighlightStyle; - -@ConfigGroup("pestcontrol") -public interface PestControlConfig extends Config -{ - @ConfigItem( - keyName = "showHintArrow", - name = "Show hint arrows", - description = "Show hint arrows to the portals that can be attacked.", - position = 1 - ) - default boolean showHintArrow() - { - return true; - } - - @ConfigItem( - keyName = "showPortalWeakness", - name = "Show portal weakness", - description = "Show the combat style weakness of the portals. For melee the attack styles are shown: Stab/Crush/Slash", - position = 2 - ) - default boolean showPortalWeakness() - { - return false; - } - - @ConfigItem( - keyName = "highlightGangplanks", - name = "Highlight gangplanks", - description = "Highlight the boarding gangplanks and show the required combat level.", - position = 3 - ) - default boolean highlightGangplanks() - { - return true; - } - - @ConfigItem( - keyName = "highlightPortals", - name = "Highlight portals", - description = "Highlight all, active or shielded portals.", - position = 4 - ) - default HighlightPortalOption portalHighlight() - { - return HighlightPortalOption.ACTIVE; - } - - @ConfigItem( - keyName = "activePortalColor", - name = "Active portal color", - description = "Color of the portals that can be attacked.", - position = 5 - ) - default Color activePortalColor() - { - return Color.GREEN; - } - - @ConfigItem( - keyName = "shieldedPortalColor", - name = "Shielded portal color", - description = "Color of the portals that are shielded.", - position = 6 - ) - default Color shieldedPortalColor() - { - return Color.BLUE; - } - - @ConfigItem( - keyName = "highlightSpinners", - name = "Highlight Spinners", - description = "Highlights Spinners. Highlighting them is recommended as Spinners heal the portals.", - position = 7 - ) - default NpcHighlightStyle highlightSpinners() - { - return NpcHighlightStyle.BOTH; - } - - @ConfigItem( - keyName = "spinnerColor", - name = "Spinner color", - description = "Color of highlighted Spinners.", - position = 8 - ) - default Color spinnerColor() - { - return Color.CYAN; - } - - @ConfigItem( - keyName = "highlightBrawlers", - name = "Highlight Brawlers", - description = "Highlights Brawlers.", - position = 9 - ) - default NpcHighlightStyle highlightBrawlers() - { - return NpcHighlightStyle.TILE; - } - - @ConfigItem( - keyName = "brawlerColor", - name = "Brawler color", - description = "Color of highlighted Brawlers.", - position = 10 - ) - default Color brawlerColor() - { - return Color.ORANGE; - } - - @ConfigItem( - keyName = "highlightRepairables", - name = "Highlight repairables", - description = "Highlight repairable barricades and gates.", - position = 11 - ) - default boolean highlightRepairables() - { - return false; - } - - @ConfigItem( - keyName = "repairableColor", - name = "Repairable color", - description = "Color of highlighted repairables.", - position = 12 - ) - /*default Color repairableColor() - { - return new Color(193, 141, 255); - }*/ - default Color repairableColor() - { - return Color.YELLOW; - } - - @ConfigItem( - keyName = "showPoints", - name = "Show points indicator", - description = "Always display your points when on the island or in the minigame.", - position = 13 - ) - default boolean showPoints() - { - return true; - } - - @ConfigItem( - keyName = "showTimeTillNextPortal", - name = "Show time till next portal", - description = "Show a timer that counts down till the next portal is attackable.", - position = 14 - ) - default boolean showTimeTillNextPortal() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PestControlNpc.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PestControlNpc.java deleted file mode 100644 index 50ca737592..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PestControlNpc.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (c) 2019, Yani - * 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.pestcontrol; - -import com.google.common.collect.ImmutableSet; -import java.util.Set; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.NpcID; - -@Getter(AccessLevel.PACKAGE) -public class PestControlNpc -{ - @Getter(AccessLevel.PACKAGE) - private static final Set splatterIdSet = ImmutableSet.of( - NpcID.SPLATTER, - NpcID.SPLATTER_1690, - NpcID.SPLATTER_1691, - NpcID.SPLATTER_1692, - NpcID.SPLATTER_1693 - ); - - @Getter(AccessLevel.PACKAGE) - public static final Set shifterIdSet = ImmutableSet.of( - NpcID.SHIFTER, - NpcID.SHIFTER_1695, - NpcID.SHIFTER_1696, - NpcID.SHIFTER_1697, - NpcID.SHIFTER_1698, - NpcID.SHIFTER_1699, - NpcID.SHIFTER_1700, - NpcID.SHIFTER_1701, - NpcID.SHIFTER_1702, - NpcID.SHIFTER_1703 - ); - - @Getter(AccessLevel.PACKAGE) - private static final Set spinnerIdSet = ImmutableSet.of( - NpcID.SPINNER, - NpcID.SPINNER_1710, - NpcID.SPINNER_1711, - NpcID.SPINNER_1712, - NpcID.SPINNER_1713 - ); - - @Getter(AccessLevel.PACKAGE) - private static final Set torcherIdSet = ImmutableSet.of( - NpcID.TORCHER, - NpcID.TORCHER_1715, - NpcID.TORCHER_1716, - NpcID.TORCHER_1717, - NpcID.TORCHER_1718, - NpcID.TORCHER_1719, - NpcID.TORCHER_1720, - NpcID.TORCHER_1721, - NpcID.TORCHER_1722, - NpcID.TORCHER_1723 - ); - - @Getter(AccessLevel.PACKAGE) - private static final Set defilerIdSet = ImmutableSet.of( - NpcID.DEFILER, - NpcID.DEFILER_1725, - NpcID.DEFILER_1726, - NpcID.DEFILER_1727, - NpcID.DEFILER_1728, - NpcID.DEFILER_1729, - NpcID.DEFILER_1730, - NpcID.DEFILER_1731, - NpcID.DEFILER_1732, - NpcID.DEFILER_1733 - ); - - @Getter(AccessLevel.PACKAGE) - private static final Set brawlerIdSet = ImmutableSet.of( - NpcID.BRAWLER, - NpcID.BRAWLER_1735, - NpcID.BRAWLER_1736, - NpcID.BRAWLER_1737, - NpcID.BRAWLER_1738 - ); - - @Getter(AccessLevel.PACKAGE) - private static final Set ravagerIdSet = ImmutableSet.of( - NpcID.RAVAGER, - NpcID.RAVAGER_1705, - NpcID.RAVAGER_1706, - NpcID.RAVAGER_1707, - NpcID.RAVAGER_1708 - ); - - @Getter(AccessLevel.PACKAGE) - private static final Set activePortalIdSet = ImmutableSet.of( - NpcID.PORTAL_1747, // Novice Purple Active - NpcID.PORTAL_1748, // Novice Blue Active - NpcID.PORTAL_1749, // Novice Yellow Active - NpcID.PORTAL_1750, // Novice Red Active - NpcID.PORTAL, // Intermediate Purple Active - NpcID.PORTAL_1740, // Intermediate Blue Active - NpcID.PORTAL_1741, // Intermediate Yellow Active - NpcID.PORTAL_1742 // Intermediate Red Active - ); - - @Getter(AccessLevel.PACKAGE) - private static final Set shieldedPortalIdSet = ImmutableSet.of( - NpcID.PORTAL_1751, // Novice Purple Shielded - NpcID.PORTAL_1752, // Novice Blue Shielded - NpcID.PORTAL_1753, // Novice Yellow Shielded - NpcID.PORTAL_1754, // Novice Red Shielded - NpcID.PORTAL_1743, // Intermediate Purple Shielded - NpcID.PORTAL_1744, // Intermediate Blue Shielded - NpcID.PORTAL_1745, // Intermediate Yellow Shielded - NpcID.PORTAL_1746 // Intermediate Red Shielded - ); - - @Getter(AccessLevel.PACKAGE) - private static final Set purplePortalIdSet = ImmutableSet.of( - NpcID.PORTAL_1747, // Novice Purple Active - NpcID.PORTAL_1751, // Novice Purple Shielded - NpcID.PORTAL, // Intermediate Purple Active - NpcID.PORTAL_1743 // Intermediate Purple Shielded - ); - - @Getter(AccessLevel.PACKAGE) - private static final Set bluePortalIdSet = ImmutableSet.of( - NpcID.PORTAL_1748, // Novice Blue Active - NpcID.PORTAL_1752, // Novice Blue Shielded - NpcID.PORTAL_1740, // Intermediate Blue Active - NpcID.PORTAL_1744 // Intermediate Blue Shielded - ); - - @Getter(AccessLevel.PACKAGE) - private static final Set yellowPortalIdSet = ImmutableSet.of( - NpcID.PORTAL_1749, // Novice Yellow Active - NpcID.PORTAL_1753, // Novice Yellow Shielded - NpcID.PORTAL_1741, // Intermediate Yellow Active - NpcID.PORTAL_1745 // Intermediate Yellow Shielded - ); - - @Getter(AccessLevel.PACKAGE) - private static final Set redPortalIdSet = ImmutableSet.of( - NpcID.PORTAL_1750, // Novice Red Active - NpcID.PORTAL_1754, // Novice Red Shielded - NpcID.PORTAL_1742, // Intermediate Red Active - NpcID.PORTAL_1746 // Intermediate Red Shielded - ); - - @Getter(AccessLevel.PACKAGE) - private static final Set ingameVoidKnightIdSet = ImmutableSet.of( - NpcID.VOID_KNIGHT_2950, - NpcID.VOID_KNIGHT_2951, - NpcID.VOID_KNIGHT_2952, - NpcID.VOID_KNIGHT_2953 - ); - - @Getter(AccessLevel.PACKAGE) - private static final Integer ingameSquireId = NpcID.SQUIRE_2949; - - static boolean isSplatterId(int npcId) - { - return splatterIdSet.contains(npcId); - } - - static boolean isShifterId(int npcId) - { - return shifterIdSet.contains(npcId); - } - - static boolean isSpinnerId(int npcId) - { - return brawlerIdSet.contains(npcId); - } - - static boolean isTorcherId(int npcId) - { - return torcherIdSet.contains(npcId); - } - - static boolean isDefilerId(int npcId) - { - return defilerIdSet.contains(npcId); - } - - static boolean isBrawlerId(int npcId) - { - return brawlerIdSet.contains(npcId); - } - - static boolean isRavagerId(int npcId) - { - return ravagerIdSet.contains(npcId); - } - - static boolean isIngameVoidKnightId(int npcId) - { - return ingameVoidKnightIdSet.contains(npcId); - } - - static boolean isIngameSquireId(int npcId) - { - return ingameSquireId == npcId; - } - - static boolean isPortalId(int npcId) - { - return (isActivePortalId(npcId) || isShieldedPortalId(npcId)); - } - - static boolean isActivePortalId(int npcId) - { - return activePortalIdSet.contains(npcId); - } - - private static boolean isShieldedPortalId(int npcId) - { - return shieldedPortalIdSet.contains(npcId); - } - - static boolean isPurplePortalId(int npcId) - { - return purplePortalIdSet.contains(npcId); - } - - static boolean isBluePortalId(int npcId) - { - return bluePortalIdSet.contains(npcId); - } - - static boolean isYellowPortalId(int npcId) - { - return yellowPortalIdSet.contains(npcId); - } - - static boolean isRedPortalId(int npcId) - { - return redPortalIdSet.contains(npcId); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PestControlPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PestControlPlugin.java deleted file mode 100644 index 18add1f20f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PestControlPlugin.java +++ /dev/null @@ -1,714 +0,0 @@ -/* - * Copyright (c) 2017, Kronos - * Copyright (c) 2019, Yani - * 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.pestcontrol; - -import com.google.inject.Inject; -import com.google.inject.Provides; -import com.google.inject.Singleton; -import java.awt.Color; -import java.awt.image.BufferedImage; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.ItemID; -import net.runelite.api.Tile; -import net.runelite.api.TileObject; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameObjectChanged; -import net.runelite.api.events.GameObjectDespawned; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.GroundObjectChanged; -import net.runelite.api.events.GroundObjectDespawned; -import net.runelite.api.events.GroundObjectSpawned; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.pestcontrol.config.HighlightPortalOption; -import net.runelite.client.plugins.pestcontrol.config.NpcHighlightStyle; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; - -@Slf4j -@PluginDescriptor( - name = "Pest Control", - description = "Show helpful information for the Pest Control minigame", - tags = {"minigame", "overlay"}, - type = PluginType.MINIGAME -) -@Singleton -public class PestControlPlugin extends Plugin -{ - private static final int VOID_KNIGHTS_OUTPOST = 10537; - - private final int NOVICE_GANGPLANK = 14315; // Combat 40+ (3 points) - private final int INTERMEDIATE_GANGPLANK = 25631; // Combat 70+ (4 points) - private final int VETERAN_GANGPLANK = 25632; // Combat 100+ (5 points) - - private final Pattern SHIELD_DROP_PATTERN = Pattern.compile("The ([a-z]+), [^ ]+ portal shield has dropped!"); - private final Pattern EXCHANGE_WINDOW_POINTS_PATTERN = Pattern.compile("Points: ([0-9]+)"); - private final Pattern BOAT_POINTS_PATTERN = Pattern.compile("Pest Points: ([0-9]+)"); - private final Pattern AWARDED_PATTERN = Pattern.compile("We've awarded you ([0-9]+) Void Knight Commendation points."); - private final Pattern PURCHASE_PATTERN = Pattern.compile("Remaining Void Knight Commendation Points: ([0-9]+)"); - - @Inject - @Getter(AccessLevel.PACKAGE) - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private ConfigManager configManager; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - @Getter(AccessLevel.PACKAGE) - private ItemManager itemManager; - - @Inject - @Getter(AccessLevel.PACKAGE) - private PestControlConfig config; - - @Inject - @Getter(AccessLevel.PACKAGE) - private WidgetOverlay widgetOverlay; - - @Inject - private HintArrowOverlay hintArrowOverlay; - - @Inject - private NpcHighlightOverlay npcHighlightOverlay; - - @Inject - private RepairOverlay repairOverlay; - - @Inject - private GangplankOverlay gangplankOverlay; - - @Inject - private TimerOverlay timerOverlay; - - @Inject - private PortalWeaknessOverlay portalWeaknessOverlay; - - @Getter(AccessLevel.PACKAGE) - private Game game; - - @Getter(AccessLevel.PACKAGE) - private HashMap highlightedNpcList = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private List highlightedRepairList = new ArrayList<>(); - - @Getter(AccessLevel.PACKAGE) - private Tile noviceGangplankTile; - - @Getter(AccessLevel.PACKAGE) - private Tile intermediateGangplankTile; - - @Getter(AccessLevel.PACKAGE) - private Tile veteranGangplankTile; - - @Getter(AccessLevel.PACKAGE) - private Integer commendationPoints; - - private String userConfigKey; - - private boolean checkForPointWidgets; - - private PointsInfoboxCounter pointsInfoboxCounter; - - private boolean showHintArrow; - private boolean showPortalWeakness; - private boolean highlightGangplanks; - private HighlightPortalOption portalHighlight; - private Color activePortalColor; - private Color shieldedPortalColor; - private NpcHighlightStyle highlightSpinners; - private Color spinnerColor; - private NpcHighlightStyle highlightBrawlers; - private Color brawlerColor; - private boolean highlightRepairables; - @Getter(AccessLevel.PACKAGE) - private Color repairableColor; - private boolean showPoints; - private boolean showTimeTillNextPortal; - - @Provides - PestControlConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(PestControlConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - loadPlugin(); - } - - @Override - protected void shutDown() - { - unloadPlugin(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged configEvent) - { - if (configEvent.getGroup().equals("pestcontrol")) - { - updateConfig(); - unloadPlugin(); - loadPlugin(); - } - } - - private boolean loadLocalUserPoints() - { - if (userConfigKey != null) - { - String configKey = "points." + userConfigKey; - String pointString = configManager.getConfiguration("pestcontrol", configKey); - if (pointString != null) - { - commendationPoints = Integer.parseInt(pointString); - - return true; - } - } - - return false; - } - - private void loadPlugin() - { - if (loadLocalUserPoints()) - { - handlePointsInfoboxCounter(); - } - - overlayManager.add(widgetOverlay); - - if (this.highlightSpinners != NpcHighlightStyle.OFF) - { - for (Integer npcId : PestControlNpc.getSpinnerIdSet()) - { - highlightedNpcList.put(npcId, new NpcHighlightContext( - this.highlightSpinners, - this.spinnerColor, - true - )); - } - } - - if (this.highlightBrawlers != NpcHighlightStyle.OFF) - { - for (Integer npcId : PestControlNpc.getBrawlerIdSet()) - { - highlightedNpcList.put(npcId, new NpcHighlightContext( - this.highlightBrawlers, - this.brawlerColor, - false - )); - } - } - - if (this.portalHighlight != HighlightPortalOption.OFF) - { - if (this.portalHighlight == HighlightPortalOption.ACTIVE || - this.portalHighlight == HighlightPortalOption.ALL) - { - for (Integer portalNpcId : PestControlNpc.getActivePortalIdSet()) - { - highlightedNpcList.put(portalNpcId, new NpcHighlightContext( - NpcHighlightStyle.HULL, - this.activePortalColor, - false - )); - } - } - - if (this.portalHighlight == HighlightPortalOption.SHIELDED || - this.portalHighlight == HighlightPortalOption.ALL) - { - for (Integer portalNpcId : PestControlNpc.getShieldedPortalIdSet()) - { - highlightedNpcList.put(portalNpcId, new NpcHighlightContext( - NpcHighlightStyle.HULL, - this.shieldedPortalColor, - false - )); - } - } - } - - if (!highlightedNpcList.isEmpty()) - { - overlayManager.add(npcHighlightOverlay); - } - - if (this.highlightRepairables) - { - overlayManager.add(repairOverlay); - } - - if (this.showHintArrow) - { - overlayManager.add(hintArrowOverlay); - - if (game != null && client.hasHintArrow()) - { - client.clearHintArrow(); - } - } - - if (this.highlightGangplanks) - { - overlayManager.add(gangplankOverlay); - } - - if (this.showTimeTillNextPortal) - { - overlayManager.add(timerOverlay); - } - - if (this.showPortalWeakness) - { - overlayManager.add(portalWeaknessOverlay); - } - } - - private void unloadPlugin() - { - overlayManager.remove(widgetOverlay); - overlayManager.remove(npcHighlightOverlay); - overlayManager.remove(repairOverlay); - overlayManager.remove(gangplankOverlay); - overlayManager.remove(hintArrowOverlay); - overlayManager.remove(timerOverlay); - overlayManager.remove(portalWeaknessOverlay); - - infoBoxManager.removeInfoBox(pointsInfoboxCounter); - pointsInfoboxCounter = null; - - highlightedNpcList.clear(); - - if (game != null && this.showHintArrow && client.hasHintArrow()) - { - client.clearHintArrow(); - } - } - - @Subscribe - public void onGameStateChanged(GameStateChanged event) - { - // LOGGED_IN also triggers when teleporting to the island - if (event.getGameState() == GameState.LOGGED_IN) - { - handlePointsInfoboxCounter(); - } - } - - private void handlePointsInfoboxCounter() - { - if (!this.showPoints) - { - return; - } - - if (!isOnPestControlMainIsland() && !isInPestControlInstance()) - { - infoBoxManager.removeInfoBox(pointsInfoboxCounter); - pointsInfoboxCounter = null; - - return; - } - - if (commendationPoints == null) - { - if (pointsInfoboxCounter != null) - { - infoBoxManager.removeInfoBox(pointsInfoboxCounter); - pointsInfoboxCounter = null; - } - - return; - } - - if (pointsInfoboxCounter != null) - { - pointsInfoboxCounter.setCount(commendationPoints); - } - else - { - BufferedImage image = itemManager.getImage(ItemID.VOID_SEAL1); - pointsInfoboxCounter = new PointsInfoboxCounter(image, this, commendationPoints); - pointsInfoboxCounter.setTooltip("Void Knight Commendation Points"); - infoBoxManager.addInfoBox(pointsInfoboxCounter); - } - } - - - private void getPointsFromWidgets() - { - - // Get points from dialog after the game - Widget npcDialog = client.getWidget(WidgetInfo.DIALOG_NPC_TEXT); - if (npcDialog != null) - { - String npcText = Text.sanitizeMultilineText(npcDialog.getText()); - Matcher matcher = AWARDED_PATTERN.matcher(npcText); - - if (matcher.find()) - { - int newPoints = Integer.parseInt(matcher.group(1)); - - if (commendationPoints != null) - { - newPoints += commendationPoints; - } - - setCommendationPoints(newPoints); - log.debug("PEST CONTROL [POINTS REWARDED] UPDATE: {}", commendationPoints); - return; - } - } - - // Get points from dialog after purchase - Widget pestControlDialog = client.getWidget(WidgetInfo.MINIGAME_DIALOG_TEXT); - if (pestControlDialog != null) - { - String pestControlDialogText = Text.sanitizeMultilineText(pestControlDialog.getText()); - Matcher matcher = PURCHASE_PATTERN.matcher(pestControlDialogText); - - if (matcher.find()) - { - setCommendationPoints(Integer.parseInt(matcher.group(1))); - log.debug("PEST CONTROL [DIALOG] POINTS UPDATE: {}", commendationPoints); - return; - } - } - - // Get points from exchange window - Widget exchangeWindowPointsWidget = client.getWidget(WidgetInfo.PEST_CONTROL_EXCHANGE_WINDOW_POINTS); - if (exchangeWindowPointsWidget != null) - { - String pointsString = exchangeWindowPointsWidget.getText(); - - Matcher matcher = EXCHANGE_WINDOW_POINTS_PATTERN.matcher(pointsString); - if (matcher.lookingAt()) - { - setCommendationPoints(Integer.parseInt(matcher.group(1))); - log.debug("PEST CONTROL [EXCHANGE WINDOW] POINTS UPDATE: {}", commendationPoints); - return; - } - } - - // Get points in boat - // NOTE: The boat info widget is still active right after the game - // We should therefor only check for point updates if there are no dialogs - Widget boatPointsWidget = client.getWidget(WidgetInfo.PEST_CONTROL_BOAT_INFO_POINTS); - if (boatPointsWidget != null && npcDialog == null && pestControlDialog == null) - { - String pointsString = boatPointsWidget.getText(); - Matcher matcher = BOAT_POINTS_PATTERN.matcher(pointsString); - - if (matcher.lookingAt()) - { - log.debug(matcher.toString()); - log.debug("MATCHER GROUP 1: {}", matcher.group(1)); - setCommendationPoints(Integer.parseInt(matcher.group(1))); - log.debug("PEST CONTROL [BOAT] POINTS UPDATE: {}", commendationPoints); - } - } - } - - private void setCommendationPoints(int newPoints) - { - if (userConfigKey == null) - { - return; - } - - if (commendationPoints == null || commendationPoints != newPoints) - { - commendationPoints = newPoints; - - configManager.setConfiguration( - "pestcontrol", - "points." + userConfigKey, - String.valueOf(commendationPoints) - ); - } - - handlePointsInfoboxCounter(); - } - - @Subscribe - private void onGameTick(GameTick gameTickEvent) - { - // Check for widgets on main island - if (game == null && isOnPestControlMainIsland()) - { - // This must be synchronized for some reason - synchronized (this) - { - if (checkForPointWidgets) - { - checkForPointWidgets = false; - getPointsFromWidgets(); - } - } - } - - // Load the points of the user - if (userConfigKey == null) - { - String username = client.getUsername(); - - if (username == null) - { - return; - } - - userConfigKey = String.valueOf(username.hashCode()); - - log.debug("USER CONFIG SCOPE: {}", userConfigKey); - - if (loadLocalUserPoints()) - { - handlePointsInfoboxCounter(); - } - } - - // Check if the game has started - if (game == null && isInPestControlInstance()) - { - log.debug("Pest control game has started"); - game = new Game(client, this); - } - - // Check if we are in a game - if (game == null) - { - return; - } - - // Check if we left the game - if (!isInPestControlInstance()) - { - if (game != null) - { - log.debug("Pest control game has ended"); - game = null; - } - - return; - } - - game.onGameTick(gameTickEvent); - } - - @Subscribe - private void onChatMessage(ChatMessage chatMessage) - { - if (game != null && chatMessage.getType() == ChatMessageType.GAMEMESSAGE) - { - Matcher matcher = SHIELD_DROP_PATTERN.matcher(chatMessage.getMessage()); - if (matcher.lookingAt()) - { - game.lowerPortalShield(matcher.group(1)); - } - } - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded event) - { - if (game != null) - { - log.debug(event.toString()); - } - - if (isOnPestControlMainIsland() && game == null) - { - checkForPointWidgets = true; - } - } - - private void unlistTileObject(TileObject tileObject) - { - int tileObjectId = tileObject.getId(); - - if (PestControlRepairObject.isRepairableBarricadeId(tileObjectId) || - PestControlRepairObject.isRepairableGateId(tileObjectId)) - { - highlightedRepairList.remove(tileObject); - return; - } - - switch (tileObjectId) - { - case NOVICE_GANGPLANK: - { - noviceGangplankTile = null; - break; - } - case INTERMEDIATE_GANGPLANK: - { - intermediateGangplankTile = null; - break; - } - case VETERAN_GANGPLANK: - { - veteranGangplankTile = null; - break; - } - } - } - - private void handleTileObject(Tile tile, TileObject tileObject) - { - int tileObjectId = tileObject.getId(); - - if (PestControlRepairObject.isRepairableBarricadeId(tileObjectId) || - PestControlRepairObject.isRepairableGateId(tileObjectId)) - { - highlightedRepairList.add(tileObject); - return; - } - - switch (tileObjectId) - { - case NOVICE_GANGPLANK: - { - noviceGangplankTile = tile; - break; - } - case INTERMEDIATE_GANGPLANK: - { - intermediateGangplankTile = tile; - break; - } - case VETERAN_GANGPLANK: - { - veteranGangplankTile = tile; - break; - } - } - } - - @Subscribe - private void onGameObjectSpawned(GameObjectSpawned event) - { - handleTileObject(event.getTile(), event.getGameObject()); - } - - @Subscribe - private void onGameObjectChanged(GameObjectChanged event) - { - unlistTileObject(event.getPrevious()); - handleTileObject(event.getTile(), event.getGameObject()); - } - - @Subscribe - private void onGameObjectDespawned(GameObjectDespawned event) - { - unlistTileObject(event.getGameObject()); - } - - @Subscribe - private void onGroundObjectSpawned(GroundObjectSpawned event) - { - handleTileObject(event.getTile(), event.getGroundObject()); - } - - @Subscribe - private void onGroundObjectChanged(GroundObjectChanged event) - { - unlistTileObject(event.getPrevious()); - handleTileObject(event.getTile(), event.getGroundObject()); - } - - @Subscribe - private void onGroundObjectDespawned(GroundObjectDespawned event) - { - unlistTileObject(event.getGroundObject()); - } - - private boolean isInPestControlInstance() - { - return client.getWidget(WidgetInfo.PEST_CONTROL_BLUE_SHIELD) != null; - } - - boolean isOnPestControlMainIsland() - { - if (client.getLocalPlayer() != null) - { - return client.getLocalPlayer().getWorldLocation().getRegionID() == VOID_KNIGHTS_OUTPOST; - } - return false; - } - - private void updateConfig() - { - this.showHintArrow = config.showHintArrow(); - this.showPortalWeakness = config.showPortalWeakness(); - this.highlightGangplanks = config.highlightGangplanks(); - this.portalHighlight = config.portalHighlight(); - this.activePortalColor = config.activePortalColor(); - this.shieldedPortalColor = config.shieldedPortalColor(); - this.highlightSpinners = config.highlightSpinners(); - this.spinnerColor = config.spinnerColor(); - this.highlightBrawlers = config.highlightBrawlers(); - this.brawlerColor = config.brawlerColor(); - this.highlightRepairables = config.highlightRepairables(); - this.repairableColor = config.repairableColor(); - this.showPoints = config.showPoints(); - this.showTimeTillNextPortal = config.showTimeTillNextPortal(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PestControlRepairObject.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PestControlRepairObject.java deleted file mode 100644 index a3b56e009d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PestControlRepairObject.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2019, Yani - * 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.pestcontrol; - -import com.google.common.collect.ImmutableSet; -import java.util.Set; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ObjectID; - -@Getter(AccessLevel.PACKAGE) -class PestControlRepairObject -{ - @Getter(AccessLevel.PACKAGE) - private static final Set repairableBarricades = ImmutableSet.of( - //ObjectID.BARRICADE_14224, - ObjectID.BARRICADE_14227, - ObjectID.BARRICADE_14228, - ObjectID.BARRICADE_14229, - ObjectID.BARRICADE_14230, - ObjectID.BARRICADE_14231, - ObjectID.BARRICADE_14232 - ); - - @Getter(AccessLevel.PACKAGE) - private static final Set repairableGates = ImmutableSet.of( - ObjectID.GATE_14238, - ObjectID.GATE_14239, - ObjectID.GATE_14240, - ObjectID.GATE_14241, - ObjectID.GATE_14242, - ObjectID.GATE_14243, - ObjectID.GATE_14244, - ObjectID.GATE_14245, - ObjectID.GATE_14246, - ObjectID.GATE_14247, - ObjectID.GATE_14248 - ); - - static boolean isRepairableBarricadeId(int objectId) - { - return repairableBarricades.contains(objectId); - } - - static boolean isRepairableGateId(int objectId) - { - return repairableGates.contains(objectId); - } - - static boolean isRepairableId(int objectId) - { - return isRepairableBarricadeId(objectId) || isRepairableGateId(objectId); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PointsInfoboxCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PointsInfoboxCounter.java deleted file mode 100644 index 8555abf745..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PointsInfoboxCounter.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2019, Yani - * 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.pestcontrol; - -import java.awt.image.BufferedImage; -import net.runelite.client.ui.overlay.infobox.Counter; - -class PointsInfoboxCounter extends Counter -{ - PointsInfoboxCounter(final BufferedImage image, final PestControlPlugin plugin, final int count) - { - super(image, plugin, count); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/Portal.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/Portal.java deleted file mode 100644 index 466c125002..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/Portal.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * Copyright (c) 2019, Yani - * 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.pestcontrol; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.coords.WorldPoint; - -@Getter(AccessLevel.PACKAGE) -@Setter(AccessLevel.PACKAGE) -class Portal -{ - private PortalColor color; - private WidgetPortal widget; - private WorldPoint location; - - private PortalState portalState = PortalState.SHIELDED; - - Portal(final PortalColor color, final WidgetPortal widget) - { - this.color = color; - this.widget = widget; - } - - boolean isNotShielded() - { - return portalState != PortalState.SHIELDED; - } - - public boolean isDead() - { - return portalState == PortalState.DEAD; - } - - public boolean isActive() - { - return (isNotShielded() && !isDead()); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PortalColor.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PortalColor.java deleted file mode 100644 index 8eecadbe0e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PortalColor.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2019, Yani - * 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.pestcontrol; - -import lombok.AccessLevel; -import lombok.Getter; - -@Getter(AccessLevel.PACKAGE) -public enum PortalColor -{ - BLUE, - PURPLE, - YELLOW, - RED -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PortalRotation.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PortalRotation.java deleted file mode 100644 index d74846c551..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PortalRotation.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * Copyright (c) 2019, Yani - * 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.pestcontrol; - -import static net.runelite.client.plugins.pestcontrol.PortalColor.BLUE; -import static net.runelite.client.plugins.pestcontrol.PortalColor.PURPLE; -import static net.runelite.client.plugins.pestcontrol.PortalColor.RED; -import static net.runelite.client.plugins.pestcontrol.PortalColor.YELLOW; - -enum PortalRotation -{ - PBYR(PURPLE, BLUE, YELLOW, RED), - PYBR(PURPLE, YELLOW, BLUE, RED), - BRYP(BLUE, RED, YELLOW, PURPLE), - BPRY(BLUE, PURPLE, RED, YELLOW), - YRPB(YELLOW, RED, PURPLE, BLUE), - YPRB(YELLOW, PURPLE, RED, BLUE); - - private final PortalColor[] portals; - - PortalRotation(final PortalColor first, final PortalColor second, final PortalColor third, final PortalColor fourth) - { - portals = new PortalColor[] - { - first, second, third, fourth - }; - } - - public Portal getPortal(Game game, int index) - { - if (index < 0 || index >= portals.length) - { - return null; - } - - return game.getPortal(portals[index]); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PortalState.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PortalState.java deleted file mode 100644 index 0a569d54b3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PortalState.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2019, Yani - * 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.pestcontrol; - -public enum PortalState -{ - ACTIVE, - SHIELDED, - DEAD -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PortalWeaknessOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PortalWeaknessOverlay.java deleted file mode 100644 index 941f851b6c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/PortalWeaknessOverlay.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 2019, Yani - * 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.pestcontrol; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.awt.AlphaComposite; -import java.awt.Composite; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.ItemID; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.Skill; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.SkillIconManager; -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; - -@Slf4j -@Singleton -public class PortalWeaknessOverlay extends Overlay -{ - private final PestControlPlugin plugin; - private final Client client; - - private final BufferedImage magicImage; - private final BufferedImage rangedImage; - private final BufferedImage stabImage; - private final BufferedImage slashImage; - private final BufferedImage crushImage; - - @Inject - PortalWeaknessOverlay( - final PestControlPlugin plugin, - final Client client, - final ItemManager itemManager, - final SkillIconManager skillIconManager - ) - { - this.plugin = plugin; - this.client = client; - - this.magicImage = skillIconManager.getSkillImage(Skill.MAGIC); - this.rangedImage = skillIconManager.getSkillImage(Skill.RANGED); - - this.stabImage = itemManager.getImage(ItemID.WHITE_DAGGER); - this.slashImage = itemManager.getImage(ItemID.WHITE_SCIMITAR); - this.crushImage = itemManager.getImage(ItemID.WHITE_WARHAMMER); - - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.UNDER_WIDGETS); - } - - private Point getPortalPoint(Portal portal) - { - WorldPoint portalLocation = portal.getLocation(); - LocalPoint localLocation = LocalPoint.fromWorld(client, portalLocation); - - if (localLocation == null) - { - return null; - } - - // We can use any image here as it's only needed to calculate the position - - int zOffset = 100; - return Perspective.getCanvasImageLocation(client, localLocation, magicImage, zOffset); - - } - - private void renderPortalWeakness(Graphics2D graphics, Portal portal, BufferedImage image) - { - Point portalPoint = getPortalPoint(portal); - - if (portalPoint != null) - { - Composite originalComposite = graphics.getComposite(); - Composite translucentComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f); - graphics.setComposite(translucentComposite); - - OverlayUtil.renderImageLocation(graphics, portalPoint, image); - - graphics.setComposite(originalComposite); - } - } - - private void renderDoublePortalWeakness( - Graphics2D graphics, - Portal portal, - BufferedImage imageLeft, - BufferedImage imageRight - ) - { - Point portalPoint = getPortalPoint(portal); - - if (portalPoint != null) - { - Point portalLeft = new Point( - portalPoint.getX() - (imageLeft.getWidth() / 2) - 5, - portalPoint.getY() - ); - - Point portalRight = new Point( - portalPoint.getX() + (imageRight.getWidth() / 2) + 5, - portalPoint.getY() - ); - - Composite originalComposite = graphics.getComposite(); - Composite translucentComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f); - graphics.setComposite(translucentComposite); - - OverlayUtil.renderImageLocation(graphics, portalLeft, imageLeft); - OverlayUtil.renderImageLocation(graphics, portalRight, imageRight); - - graphics.setComposite(originalComposite); - } - } - - @Override - public Dimension render(Graphics2D graphics) - { - Game game = plugin.getGame(); - - if (game == null) - { - return null; - } - - for (Portal portal : game.getPortals()) - { - if (!portal.isDead()) - { - switch (portal.getColor()) - { - case BLUE: - { - renderPortalWeakness(graphics, portal, magicImage); - break; - } - case YELLOW: - { - renderDoublePortalWeakness(graphics, portal, stabImage, slashImage); - break; - } - case RED: - { - renderPortalWeakness(graphics, portal, crushImage); - break; - } - case PURPLE: - { - renderPortalWeakness(graphics, portal, rangedImage); - break; - } - } - } - } - - return null; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/RepairOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/RepairOverlay.java deleted file mode 100644 index 2e96070a4f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/RepairOverlay.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (c) 2019, Yani - * 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.pestcontrol; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Shape; -import net.runelite.api.Client; -import net.runelite.api.Constants; -import net.runelite.api.GameObject; -import net.runelite.api.GroundObject; -import net.runelite.api.Player; -import net.runelite.api.Point; -import net.runelite.api.Scene; -import net.runelite.api.Tile; -import net.runelite.api.WallObject; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayPosition; - -@Singleton -public class RepairOverlay extends Overlay -{ - private final PestControlPlugin plugin; - private final Client client; - - private static final int MAX_DISTANCE = 2400; - - @Inject - RepairOverlay(final PestControlPlugin plugin, final Client client) - { - this.plugin = plugin; - this.client = client; - - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.getGame() == null) - { - return null; - } - - Point mousePosition = client.getMouseCanvasPosition(); - Scene scene = client.getScene(); - Color color = plugin.getRepairableColor(); - Tile[][][] tiles = scene.getTiles(); - int z = client.getPlane(); - - for (int x = 0; x < Constants.SCENE_SIZE; ++x) - { - for (int y = 0; y < Constants.SCENE_SIZE; ++y) - { - Tile tile = tiles[z][x][y]; - - if (tile == null) - { - continue; - } - - Player player = client.getLocalPlayer(); - if (player == null) - { - continue; - } - - // Render GameObjects - GameObject[] gameObjects = tile.getGameObjects(); - if (gameObjects != null) - { - for (GameObject gameObject : gameObjects) - { - if (gameObject == null) - { - continue; - } - - if (PestControlRepairObject.isRepairableId(gameObject.getId())) - { - - if (player.getLocalLocation().distanceTo(gameObject.getLocalLocation()) <= MAX_DISTANCE) - { - renderObjectOverlay(graphics, gameObject.getClickbox(), color, mousePosition); - } - } - } - } - - // Render GameObject - GroundObject groundObject = tile.getGroundObject(); - if (groundObject != null) - { - if (PestControlRepairObject.isRepairableId(groundObject.getId())) - { - - if (player.getLocalLocation().distanceTo(groundObject.getLocalLocation()) <= MAX_DISTANCE) - { - renderObjectOverlay(graphics, groundObject.getClickbox(), color, mousePosition); - } - } - } - - // Render WallObject - WallObject wallObject = tile.getWallObject(); - if (wallObject != null) - { - if (PestControlRepairObject.isRepairableId(wallObject.getId())) - { - - if (player.getLocalLocation().distanceTo(wallObject.getLocalLocation()) <= MAX_DISTANCE) - { - renderObjectOverlay(graphics, wallObject.getClickbox(), color, mousePosition); - } - } - } - } - } - - - - - - - - /*if(plugin.getGame() == null) - { - return null; - } - - Point mousePosition = client.getMouseCanvasPosition(); - - List repairList = plugin.getHighlightedRepairList(); - - for(TileObject tileObject: repairList) - { - //tileObject.getWorldLocation().distanceTo(client.getLocalPlayer().getWorldLocation()); - - Polygon polygon = tileObject.getCanvasTilePoly(); - - if(polygon != null) - { - graphics.setColor(color); - graphics.setStroke(new BasicStroke(2)); - graphics.drawPolygon(polygon); - graphics.setColor(setColorAlpha(color, 40)); - graphics.fill(polygon); - - if(polygon.contains(mousePosition.getX(), mousePosition.getY())) - { - graphics.setColor(setColorAlpha(color, 65)); - graphics.fill(polygon); - } - } - } -*/ - return null; - } - - private void renderObjectOverlay(Graphics2D graphics, Shape area, Color color, Point mousePosition) - { - if (area == null) - { - return; - } - - graphics.setColor(color); - graphics.setStroke(new BasicStroke(2)); - graphics.draw(area); - graphics.setColor(setColorAlpha(color, 50)); - graphics.fill(area); - - if (area.contains(mousePosition.getX(), mousePosition.getY())) - { - graphics.setColor(setColorAlpha(color, 60)); - graphics.fill(area); - } - } - - private Color setColorAlpha(Color color, int alpha) - { - return new Color( - color.getRed(), - color.getGreen(), - color.getBlue(), - alpha - ); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/TimerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/TimerOverlay.java deleted file mode 100644 index 3c118c1763..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/TimerOverlay.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2019, Yani - * 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.pestcontrol; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.time.Duration; -import net.runelite.api.Client; -import net.runelite.api.Point; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -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; - -@Singleton -public class TimerOverlay extends Overlay -{ - private final PestControlPlugin plugin; - private final Client client; - - @Inject - TimerOverlay(final PestControlPlugin plugin, final Client client) - { - this.plugin = plugin; - this.client = client; - - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.getGame() == null) - { - return null; - } - - Widget timeWidget = client.getWidget(WidgetInfo.PEST_CONTROL_INFO_TIME); - - if (timeWidget == null) - { - return null; - } - - int x = timeWidget.getCanvasLocation().getX() + 38; - int y = timeWidget.getCanvasLocation().getY() + 11; - - Duration timeTillNextPortal = plugin.getGame().getTimeTillNextPortal(); - - if (timeTillNextPortal != null) - { - String firstOrNext = (plugin.getGame().getShieldsDropped() == 0) ? "first" : "next"; - String string = String.format("- %s portal: %ds", firstOrNext, timeTillNextPortal.getSeconds()); - - OverlayUtil.renderTextLocation(graphics, new Point(x, y), string, new Color(204, 204, 204)); - } - - return null; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/WidgetOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/WidgetOverlay.java deleted file mode 100644 index b2cf073201..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/WidgetOverlay.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) 2017, Kronos - * Copyright (c) 2017, Adam - * Copyright (c) 2019, Yani - * 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.pestcontrol; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FontMetrics; -import java.awt.Graphics2D; -import java.awt.geom.Rectangle2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayPosition; - -@Slf4j -@Singleton -public class WidgetOverlay extends Overlay -{ - private final Client client; - - private final PestControlPlugin plugin; - - @Inject - public WidgetOverlay(final Client client, final PestControlPlugin plugin) - { - this.plugin = plugin; - this.client = client; - - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - Integer getPortalHitpoints(PortalColor color) - { - if (plugin.getGame() == null) - { - return null; - } - - WidgetInfo healthWidgetInfo = null; - - switch (color) - { - case RED: - { - healthWidgetInfo = WidgetPortal.RED.getHitpoints(); - break; - } - case BLUE: - { - healthWidgetInfo = WidgetPortal.BLUE.getHitpoints(); - break; - } - case PURPLE: - { - healthWidgetInfo = WidgetPortal.PURPLE.getHitpoints(); - break; - } - case YELLOW: - { - healthWidgetInfo = WidgetPortal.YELLOW.getHitpoints(); - break; - } - } - - if (healthWidgetInfo == null) - { - return null; - } - - Widget healthWidget = client.getWidget(healthWidgetInfo); - - if (healthWidget == null) - { - return null; - } - - return Integer.parseInt(healthWidget.getText().trim()); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.getGame() == null) - { - return null; - } - - for (Portal portal : plugin.getGame().getNextPortals()) - { - renderWidgetOverlay(graphics, portal, "NEXT", Color.ORANGE); - } - - for (Portal portal : plugin.getGame().getActivePortals()) - { - renderWidgetOverlay(graphics, portal, "ATT", Color.RED); - } - - renderProgressWidget(graphics); - - return null; - } - - private void renderWidgetOverlay(Graphics2D graphics, Portal portal, String text, Color color) - { - Widget shield = client.getWidget(portal.getWidget().getShield()); - Widget icon = client.getWidget(portal.getWidget().getIcon()); - Widget hp = client.getWidget(portal.getWidget().getHitpoints()); - - Widget bar = client.getWidget(WidgetInfo.PEST_CONTROL_ACTIVITY_BAR).getChild(0); - - Rectangle2D barBounds = bar.getBounds().getBounds2D(); - - // create one rectangle from two different widget bounds - Rectangle2D bounds = union(shield.getBounds().getBounds2D(), icon.getBounds().getBounds2D()); - bounds = union(bounds, hp.getBounds().getBounds2D()); - - graphics.setColor(color); - graphics.draw(new Rectangle2D.Double(bounds.getX(), bounds.getY() - 2, bounds.getWidth(), bounds.getHeight() - 3)); - - FontMetrics fm = graphics.getFontMetrics(); - Rectangle2D textBounds = fm.getStringBounds(text, graphics); - int x = (int) (bounds.getX() + (bounds.getWidth() / 2) - (textBounds.getWidth() / 2)); - int y = (int) (bounds.getY() + bounds.getHeight() + textBounds.getHeight() + barBounds.getHeight()); - - graphics.setColor(Color.BLACK); - graphics.drawString(text, x + 1, y + 5); - graphics.setColor(color); - graphics.drawString(text, x, y + 4); - } - - private void renderProgressWidget(Graphics2D graphics) - { - String text; - int percentage; - - Widget bar = client.getWidget(WidgetInfo.PEST_CONTROL_ACTIVITY_BAR).getChild(0); - Rectangle2D bounds = bar.getBounds().getBounds2D(); - - Widget prgs = client.getWidget(WidgetInfo.PEST_CONTROL_ACTIVITY_PROGRESS).getChild(0); - - // At 0% the inner widget changes and your progress will not increase anymore - if ((int) (prgs.getBounds().getX()) - bounds.getX() != 2) - { - percentage = 0; - text = "FAILED"; - } - else - { - percentage = (int) ((prgs.getBounds().getWidth() / bounds.getWidth()) * 100); - text = percentage + "%"; - } - - Color color = Color.GREEN; - if (percentage < 25) - { - color = Color.RED; - } - - FontMetrics fm = graphics.getFontMetrics(); - Rectangle2D textBounds = fm.getStringBounds(text, graphics); - int x = (int) (bounds.getX() - textBounds.getWidth() - 4); - int y = (int) (bounds.getY() + fm.getHeight() - 2); - - graphics.setColor(Color.BLACK); - graphics.drawString(text, x + 1, y + 1); - graphics.setColor(color); - graphics.drawString(text, x, y); - } - - private static Rectangle2D union(Rectangle2D src1, Rectangle2D src2) - { - double x1 = Math.min(src1.getMinX(), src2.getMinX()); - double y1 = Math.min(src1.getMinY(), src2.getMinY()); - double x2 = Math.max(src1.getMaxX(), src2.getMaxX()); - double y2 = Math.max(src1.getMaxY(), src2.getMaxY()); - - Rectangle2D result = new Rectangle2D.Double(); - result.setFrameFromDiagonal(x1, y1, x2, y2); - - return result; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/WidgetPortal.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/WidgetPortal.java deleted file mode 100644 index f219a2425f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/WidgetPortal.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2017, 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.pestcontrol; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.ToString; -import net.runelite.api.widgets.WidgetInfo; - -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -@ToString -enum WidgetPortal -{ - PURPLE(WidgetInfo.PEST_CONTROL_PURPLE_SHIELD, WidgetInfo.PEST_CONTROL_PURPLE_HEALTH, WidgetInfo.PEST_CONTROL_PURPLE_ICON), - BLUE(WidgetInfo.PEST_CONTROL_BLUE_SHIELD, WidgetInfo.PEST_CONTROL_BLUE_HEALTH, WidgetInfo.PEST_CONTROL_BLUE_ICON), - YELLOW(WidgetInfo.PEST_CONTROL_YELLOW_SHIELD, WidgetInfo.PEST_CONTROL_YELLOW_HEALTH, WidgetInfo.PEST_CONTROL_YELLOW_ICON), - RED(WidgetInfo.PEST_CONTROL_RED_SHIELD, WidgetInfo.PEST_CONTROL_RED_HEALTH, WidgetInfo.PEST_CONTROL_RED_ICON); - - private final WidgetInfo shield; - private final WidgetInfo hitpoints; - private final WidgetInfo icon; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/config/HighlightPortalOption.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/config/HighlightPortalOption.java deleted file mode 100644 index 8e169edde9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/config/HighlightPortalOption.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2019, Yani - * 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.pestcontrol.config; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor -public enum HighlightPortalOption -{ - OFF("Off"), - ACTIVE("Active"), - SHIELDED("Shielded"), - ALL("All"); - - private final String option; - - @Override - public String toString() - { - return option; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/config/NpcHighlightStyle.java b/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/config/NpcHighlightStyle.java deleted file mode 100644 index af60c7b789..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pestcontrol/config/NpcHighlightStyle.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2019, Yani - * 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.pestcontrol.config; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor -public enum NpcHighlightStyle -{ - OFF("Off"), - TILE("Tile"), - HULL("Hull"), - BOTH("Hull + Tile"); - - private final String style; - - @Override - public String toString() - { - return style; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pileindicators/PileIndicatorsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/pileindicators/PileIndicatorsConfig.java deleted file mode 100644 index c3434ff880..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pileindicators/PileIndicatorsConfig.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * 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.pileindicators; - -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.ConfigTitleSection; -import net.runelite.client.config.Range; -import net.runelite.client.config.Title; - -@ConfigGroup("pileindicators") -public interface PileIndicatorsConfig extends Config -{ - @ConfigTitleSection( - keyName = "playerPilesTitle", - name = "Player Piles", - description = "", - position = 0 - ) - default Title playerPilesTitle() - { - return new Title(); - } - - @ConfigItem( - position = 1, - keyName = "enablePlayers", - name = "Enable Player Piling", - description = "Enable the option to highlight players when they pile.", - titleSection = "playerPilesTitle" - ) - default boolean enablePlayers() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "wildyOnlyPlayer", - name = "Wilderness Only", - description = "Show player piling only when in the Wilderness.", - titleSection = "playerPilesTitle" - ) - default boolean wildyOnlyPlayer() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "playerPileColor", - name = "Player Pile Color", - description = "Color used for player piles.", - titleSection = "playerPilesTitle" - ) - default Color playerPileColor() - { - return Color.RED; - } - - @ConfigTitleSection( - keyName = "npcPilesTitle", - name = "NPC Piles", - description = "", - position = 4 - ) - default Title npcPilesTitle() - { - return new Title(); - } - - @ConfigItem( - position = 5, - keyName = "enableNPCS", - name = "Enable NPC Piling", - description = "Enable the option to highlight NPCs when they pile.", - titleSection = "npcPilesTitle" - ) - default boolean enableNPCS() - { - return false; - } - - @ConfigItem( - position = 6, - keyName = "npcPileColor", - name = "NPC Pile Color", - description = "Color used for NPC piles.", - titleSection = "npcPilesTitle" - ) - default Color npcPileColor() - { - return Color.BLUE; - } - - @ConfigTitleSection( - keyName = "mixedPilesTitle", - name = "Mixed Piles", - description = "", - position = 7 - ) - default Title mixedPilesTitle() - { - return new Title(); - } - - @ConfigItem( - position = 8, - keyName = "mixedPileColor", - name = "Mixed Pile Color", - description = "Color used for mixed piles.", - titleSection = "mixedPilesTitle" - ) - default Color mixedPileColor() - { - return new Color(255, 0, 255); - } - - @ConfigTitleSection( - keyName = "pilesSizeTitle", - name = "Pile size", - description = "", - position = 9 - ) - default Title pilesSizeTitle() - { - return new Title(); - } - - @Range( - min = 2 - ) - @ConfigItem( - position = 10, - keyName = "minimumPileSize", - name = "Minimum Pile Size", - description = "Any pile under this size will not show up. (Minimum: 2)", - titleSection = "pilesSizeTitle" - ) - default int minimumPileSize() - { - return 2; - } - - @ConfigTitleSection( - keyName = "miscellaneousTitle", - name = "Miscellaneous", - description = "", - position = 11 - ) - default Title miscellaneousTitle() - { - return new Title(); - } - - @ConfigItem( - position = 12, - keyName = "numberOnly", - name = "Display Number Only", - description = "Shorten \"PILE SIZE: 1\" to \"1\"", - titleSection = "miscellaneousTitle" - ) - default boolean numberOnly() - { - return false; - } - - @ConfigItem( - position = 13, - keyName = "drawPileTile", - name = "Draw Pile Tile", - description = "Draws the tile of the pile for best visibility.", - titleSection = "miscellaneousTitle" - ) - default boolean drawPileTile() - { - return true; - } - - @ConfigItem( - position = 14, - keyName = "drawPileHull", - name = "Draw Pile Convex Hull", - description = "Draws the hull of the pile for best visibility.", - titleSection = "miscellaneousTitle" - ) - default boolean drawPileHull() - { - return false; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pileindicators/PileIndicatorsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/pileindicators/PileIndicatorsOverlay.java deleted file mode 100644 index 1fe970e620..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pileindicators/PileIndicatorsOverlay.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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.pileindicators; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Actor; -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; - -@Singleton -public class PileIndicatorsOverlay extends Overlay -{ - private final PileIndicatorsPlugin plugin; - - @Inject - PileIndicatorsOverlay(final PileIndicatorsPlugin plugin) - { - super(plugin); - this.plugin = plugin; - - setLayer(OverlayLayer.ABOVE_SCENE); - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGH); - } - - @Override - public Dimension render(Graphics2D graphics) - { - List> stackList = plugin.getStacks(); - - if (stackList != null) - { - for (List actorArrayList : stackList) - { - PileType pileType = plugin.getPileType(actorArrayList); - Color pileColor = plugin.getColorByPileType(pileType); - - try - { - Actor actorToRender = actorArrayList.get(0); //guaranteed to have at least two players - final String pileTypeStr = pileType == PileType.PLAYER_PILE ? "PLAYER" : pileType == PileType.NPC_PILE ? "NPC" : pileType == PileType.MIXED_PILE ? "MIXED" : ""; - final String text = plugin.isNumberOnly() ? "" + actorArrayList.size() : (pileTypeStr + " PILE SIZE: " + actorArrayList.size()); - if (plugin.isDrawPileTile()) - { - OverlayUtil.renderPolygon(graphics, actorToRender.getCanvasTilePoly(), pileColor); - } - if (plugin.isDrawPileHull()) - { - OverlayUtil.renderPolygon(graphics, actorToRender.getConvexHull(), pileColor); - } - OverlayUtil.renderTextLocation(graphics, actorToRender.getCanvasTextLocation(graphics, text, 40), text, pileColor); - } - catch (Exception ignored) - { - } - } - } - - return null; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pileindicators/PileIndicatorsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/pileindicators/PileIndicatorsPlugin.java deleted file mode 100644 index 57331eed79..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pileindicators/PileIndicatorsPlugin.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * 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.pileindicators; - -import com.google.inject.Provides; -import java.awt.Color; -import java.util.ArrayList; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -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.NPC; -import net.runelite.api.Player; -import net.runelite.api.Varbits; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "Pile Indicators", - description = "Highlight and count how many npcs/players are stacked on each other.", - tags = {"overlay", "pile", "stack", "pvp", "pvm", "pve"}, - type = PluginType.UTILITY, - enabledByDefault = false -) - -@Singleton -@Slf4j -public class PileIndicatorsPlugin extends Plugin -{ - - @Inject - private Client client; - - @Inject - private PileIndicatorsConfig config; - - @Inject - private OverlayManager overlayManager; - - @Inject - private PileIndicatorsOverlay overlay; - - private boolean enablePlayers; - private boolean wildyOnlyPlayer; - private Color playerPileColor; - private boolean enableNPCS; - private Color npcPileColor; - private Color mixedPileColor; - private int minimumPileSize; - @Getter(AccessLevel.PACKAGE) - private boolean numberOnly; - @Getter(AccessLevel.PACKAGE) - private boolean drawPileTile; - @Getter(AccessLevel.PACKAGE) - private boolean drawPileHull; - - @Provides - PileIndicatorsConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(PileIndicatorsConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - } - - List> getStacks() - { - List> outerArrayList = new ArrayList<>(); - - List pileList = new ArrayList<>(); - - if (this.enableNPCS) - { - for (NPC npc : client.getNpcs()) - { - if (npc != null) - { - pileList.add(npc); - } - } - } - - if (this.enablePlayers && (client.getVar(Varbits.IN_WILDERNESS) > 0 && this.wildyOnlyPlayer) ^ (!this.wildyOnlyPlayer)) - { - for (Player player : client.getPlayers()) - { - if (player != null) - { - pileList.add(player); - } - } - } - - if (pileList.size() == 0) - { - return null; - } - - for (Actor actor : pileList) - { - ArrayList potentialStackArrayList = new ArrayList<>(); - for (Actor actorToCompareTo : pileList) - { - if (!potentialStackArrayList.contains(actorToCompareTo) && actor.getWorldLocation().distanceTo(actorToCompareTo.getWorldLocation()) == 0) - { - potentialStackArrayList.add(actorToCompareTo); - } - } - if (potentialStackArrayList.size() >= this.minimumPileSize) - { - outerArrayList.add(potentialStackArrayList); - } - } - - return outerArrayList.size() != 0 ? outerArrayList : null; - } - - Color getColorByPileType(PileType pileType) - { - switch (pileType) - { - case PLAYER_PILE: - return this.playerPileColor; - case NPC_PILE: - return this.npcPileColor; - case MIXED_PILE: - return this.mixedPileColor; - } - return null; - } - - PileType getPileType(List pile) - { - PileType pileType = null; - - for (Actor actor : pile) - { - if (actor instanceof NPC && pileType == null) - { - pileType = PileType.NPC_PILE; - } - if (actor instanceof Player && pileType == null) - { - pileType = PileType.PLAYER_PILE; - } - if (actor instanceof Player && pileType == PileType.NPC_PILE) - { - pileType = PileType.MIXED_PILE; - } - if (actor instanceof NPC && pileType == PileType.PLAYER_PILE) - { - pileType = PileType.MIXED_PILE; - } - } - return pileType; - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("pileindicators")) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.enablePlayers = config.enablePlayers(); - this.wildyOnlyPlayer = config.wildyOnlyPlayer(); - this.playerPileColor = config.playerPileColor(); - this.enableNPCS = config.enableNPCS(); - this.npcPileColor = config.npcPileColor(); - this.mixedPileColor = config.mixedPileColor(); - this.minimumPileSize = config.minimumPileSize(); - this.numberOnly = config.numberOnly(); - this.drawPileTile = config.drawPileTile(); - this.drawPileHull = config.drawPileHull(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pileindicators/PileType.java b/runelite-client/src/main/java/net/runelite/client/plugins/pileindicators/PileType.java deleted file mode 100644 index 78cebd9d19..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pileindicators/PileType.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.pileindicators; - -public enum PileType -{ - PLAYER_PILE, - NPC_PILE, - MIXED_PILE -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicationLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicationLocation.java deleted file mode 100644 index a10a638e45..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicationLocation.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019 openosrs - * 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 - * openosrs Discord: https://discord.gg/Q7wFtCe - * openosrs website: https://openosrs.com - ******************************************************************************/ - -package net.runelite.client.plugins.playerindicators; - -import com.google.common.collect.ImmutableList; - -public enum PlayerIndicationLocation -{ - /** - * Indicates the player by rendering their username above their head - */ - ABOVE_HEAD, - /** - * Indicates the player by outlining the player model's hull. - * NOTE: this may cause FPS lag if enabled for lots of players - */ - HULL, - /** - * Indicates the player by rendering their username on the minimap - */ - MINIMAP, - /** - * Indicates the player by colorizing their right click menu - */ - MENU, - /** - * Indicates the player by rendering a tile marker underneath them - */ - TILE; - - /** - * - */ - public static final ImmutableList SCENE_LOCATIONS = ImmutableList.of(ABOVE_HEAD, HULL); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsConfig.java deleted file mode 100644 index 651be4f70b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsConfig.java +++ /dev/null @@ -1,633 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.playerindicators; - -import java.awt.Color; -import java.util.EnumSet; -import net.runelite.api.ClanMemberRank; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigSection; -import net.runelite.client.config.ConfigTitleSection; -import net.runelite.client.config.Title; - -@ConfigGroup("playerindicators") -public interface PlayerIndicatorsConfig extends Config -{ - EnumSet defaultPlayerIndicatorMode = EnumSet.complementOf(EnumSet.of(PlayerIndicationLocation.HULL)); - - @ConfigSection( - name = "Yourself", - description = "", - position = 0, - keyName = "yourselfSection" - ) - default boolean yourselfSection() - { - return false; - } - - @ConfigSection( - name = "Friends", - description = "", - position = 1, - keyName = "friendsSection" - ) - default boolean friendsSection() - { - return false; - } - - @ConfigSection( - name = "Clan", - description = "", - position = 2, - keyName = "clanSection" - ) - default boolean clanSection() - { - return false; - } - - @ConfigSection( - name = "Team", - description = "", - position = 3, - keyName = "teamSection" - ) - default boolean teamSection() - { - return false; - } - - @ConfigSection( - name = "Target", - description = "", - position = 4, - keyName = "targetSection" - ) - default boolean targetSection() - { - return false; - } - - @ConfigSection( - name = "Other", - description = "", - position = 5, - keyName = "otherSection" - ) - default boolean otherSection() - { - return false; - } - - @ConfigSection( - name = "Callers", - description = "", - position = 6, - keyName = "callersSection" - ) - default boolean callersSection() - { - return false; - } - - @ConfigSection( - name = "Miscellaneous", - description = "", - position = 7, - keyName = "miscellaneousSection" - ) - default boolean miscellaneousSection() - { - return false; - } - - @ConfigItem( - position = 0, - keyName = "drawOwnName", - name = "Highlight own player", - description = "Configures whether or not your own player should be highlighted", - section = "yourselfSection" - ) - default boolean highlightOwnPlayer() - { - return false; - } - - @ConfigItem( - position = 1, - keyName = "ownNameColor", - name = "Own player color", - description = "Color of your own player", - section = "yourselfSection" - ) - default Color getOwnPlayerColor() - { - return new Color(0, 184, 212); - } - - @ConfigItem( - position = 2, - keyName = "selfIndicatorModes", - name = "Indicator Mode", - description = "Location(s) of the overlay", - section = "yourselfSection", - enumClass = PlayerIndicationLocation.class - ) - default EnumSet selfIndicatorModes() - { - return defaultPlayerIndicatorMode; - } - - @ConfigItem( - position = 0, - keyName = "drawFriendNames", - name = "Highlight friends", - description = "Configures whether or not friends should be highlighted", - section = "friendsSection" - ) - default boolean highlightFriends() - { - return false; - } - - @ConfigItem( - position = 1, - keyName = "friendNameColor", - name = "Friend color", - description = "Color of friend names", - section = "friendsSection" - ) - default Color getFriendColor() - { - return new Color(0, 200, 83); - } - - @ConfigItem( - position = 2, - keyName = "friendIndicatorMode", - name = "Indicator Mode", - description = "Location(s) of the overlay", - section = "friendsSection", - enumClass = PlayerIndicationLocation.class - - ) - default EnumSet friendIndicatorMode() - { - return defaultPlayerIndicatorMode; - } - - @ConfigItem( - position = 0, - keyName = "highlightClan", - name = "Highlight clan members", - description = "Configures whether or clan members should be highlighted", - section = "clanSection" - ) - default boolean highlightClan() - { - return true; - } - - @ConfigItem( - position = 1, - keyName = "clanMemberColor", - name = "Clan member color", - description = "Color of clan members", - section = "clanSection" - ) - default Color getClanColor() - { - return new Color(170, 0, 255); - } - - @ConfigItem( - position = 2, - keyName = "clanIndicatorModes", - name = "Indicator Mode", - description = "Location(s) of the overlay", - section = "clanSection", - enumClass = PlayerIndicationLocation.class - - ) - default EnumSet clanIndicatorModes() - { - return defaultPlayerIndicatorMode; - } - - @ConfigItem( - position = 3, - keyName = "clanMenuIcons", - name = "Show clan ranks", - description = "Add clan rank to right click menu and next to player names", - section = "clanSection" - ) - default boolean showClanRanks() - { - return false; - } - - @ConfigItem( - position = 0, - keyName = "drawTeamMemberNames", - name = "Highlight team members", - description = "Configures whether or not team members should be highlighted", - section = "teamSection" - ) - default boolean highlightTeamMembers() - { - return false; - } - - @ConfigItem( - position = 1, - keyName = "teamMemberColor", - name = "Team member color", - description = "Color of team members", - section = "teamSection" - ) - default Color getTeamcolor() - { - return new Color(19, 110, 247); - } - - @ConfigItem( - position = 2, - keyName = "teamIndicatorModes", - name = "Indicator Mode", - description = "Location(s) of the overlay", - section = "teamSection", - enumClass = PlayerIndicationLocation.class - - ) - default EnumSet teamIndicatorModes() - { - return defaultPlayerIndicatorMode; - } - - @ConfigItem( - position = 0, - keyName = "drawTargetsNames", - name = "Highlight attackable targets", - description = "Configures whether or not attackable targets should be highlighted", - section = "targetSection" - ) - default boolean highlightTargets() - { - return false; - } - - @ConfigItem( - position = 1, - keyName = "targetColor", - name = "Target member color", - description = "Color of attackable targets", - section = "targetSection" - ) - default Color getTargetsColor() - { - return new Color(19, 110, 247); - } - - @ConfigItem( - position = 2, - keyName = "targetsIndicatorModes", - name = "Indicator Mode", - description = "Location(s) of the overlay", - section = "targetSection", - enumClass = PlayerIndicationLocation.class - - ) - default EnumSet targetsIndicatorModes() - { - return defaultPlayerIndicatorMode; - } - - @ConfigItem( - position = 3, - keyName = "showAgility", - name = "Show Agility Levels", - description = "Show the agility level of attackable players next to their name while in the wilderness.", - section = "targetSection" - ) - default boolean showAgilityLevel() - { - return false; - } - - @ConfigItem( - position = 4, - keyName = "agilityFormat", - name = "Format", - description = "Whether to show the agility level as text, or as icons (1 skull >= 1st threshold, 2 skulls >= 2nd threshold).", - section = "targetSection" - ) - default PlayerIndicatorsPlugin.AgilityFormats agilityFormat() - { - return PlayerIndicatorsPlugin.AgilityFormats.TEXT; - } - - @ConfigItem( - position = 5, - keyName = "agilityFirstThreshold", - name = "First Threshold", - description = "When showing agility as icons, show one icon for agility >= this level.", - section = "targetSection" - ) - default int agilityFirstThreshold() - { - return 70; - } - - @ConfigItem( - position = 6, - keyName = "agilitySecondThreshold", - name = "Second Threshold", - description = "When showing agility as icons, show two icons for agility >= this level.", - section = "targetSection" - ) - default int agilitySecondThreshold() - { - return 84; - } - - @ConfigItem( - position = 7, - keyName = "playerSkull", - name = "Show Skull Information", - description = "shows", - section = "targetSection" - ) - default boolean playerSkull() - { - return false; - } - - @ConfigItem( - position = 8, - keyName = "minimapSkullLocation", - name = "Skull Icon Location", - description = "The location of the skull icon for skulled players", - section = "targetSection" - ) - default PlayerIndicatorsPlugin.MinimapSkullLocations skullLocation() - { - return PlayerIndicatorsPlugin.MinimapSkullLocations.AFTER_NAME; - } - - @ConfigItem( - position = 9, - keyName = "targetRisk", - name = "Indicate Target Risk", - description = "Indicates the risk (in K GP) of the target", - section = "targetSection" - ) - default boolean targetRisk() - { - return false; - } - - @ConfigItem( - position = 10, - keyName = "showCombat", - name = "Show Combat Levels", - description = "Show the combat level of attackable players next to their name.", - section = "targetSection" - ) - default boolean showCombatLevel() - { - return false; - } - - @ConfigItem( - position = 0, - keyName = "drawOtherPlayerNames", - name = "Highlight other players", - description = "Configures whether or not other players should be highlighted", - section = "otherSection" - ) - default boolean highlightOtherPlayers() - { - return false; - } - - @ConfigItem( - position = 1, - keyName = "otherPlayerColor", - name = "Other player color", - description = "Color of other players' names", - section = "otherSection" - ) - default Color getOtherColor() - { - return Color.RED; - } - - @ConfigItem( - position = 2, - keyName = "otherIndicatorModes", - name = "Indicator Mode", - description = "Location(s) of the overlay", - section = "otherSection", - enumClass = PlayerIndicationLocation.class - - ) - default EnumSet otherIndicatorModes() - { - return defaultPlayerIndicatorMode; - } - - @ConfigTitleSection( - keyName = "callerConfiguration", - position = 0, - name = "Caller Configuration", - description = "", - section = "callersSection" - ) - default Title callerConfiguration() - { - return new Title(); - } - - @ConfigItem( - position = 1, - keyName = "highlightCallers", - name = "Highlight Callers", - description = "Highlights Callers Onscreen", - section = "callersSection", - titleSection = "callerConfiguration" - ) - default boolean highlightCallers() - { - return false; - } - - @ConfigItem( - position = 2, - keyName = "useClanchatRanks", - name = "Use Ranks as Callers", - description = "Uses clanchat ranks as the list of callers", - section = "callersSection", - titleSection = "callerConfiguration" - ) - default boolean useClanchatRanks() - { - return false; - } - - @ConfigItem( - position = 3, - keyName = "callerRank", - name = "Minimum rank for Clan Caller", - description = "Chooses the minimum rank to use as clanchat callers.", - section = "callersSection", - titleSection = "callerConfiguration" - ) - default ClanMemberRank callerRank() - { - return ClanMemberRank.CAPTAIN; - } - - @ConfigItem( - position = 4, - keyName = "callers", - name = "List of callers to highlight", - description = "Highlights callers, only highlights one at a time. Separate each entry with a comma and enter" + - " in the order you want them highlighted.", - section = "callersSection", - titleSection = "callerConfiguration" - ) - default String callers() - { - return " "; - } - - @ConfigTitleSection( - keyName = "callerIndicators", - position = 5, - name = "Caller Indicators", - description = "", - section = "callersSection" - ) - default Title callerIndicators() - { - return new Title(); - } - - @ConfigItem( - position = 6, - keyName = "callerColor", - name = "Caller Color", - description = "Color of Indicated Callers", - section = "callersSection", - titleSection = "callerIndicators" - ) - default Color callerColor() - { - return Color.WHITE; - } - - @ConfigItem( - position = 7, - keyName = "callerHighlightOptions", - name = "Caller indication methods", - description = "Location(s) of the overlay", - section = "callersSection", - titleSection = "callerIndicators", - enumClass = PlayerIndicationLocation.class - ) - default EnumSet callerHighlightOptions() - { - return defaultPlayerIndicatorMode; - } - - @ConfigTitleSection( - keyName = "callerTargetIndicators", - position = 8, - name = "Caller Target Indicators", - description = "", - section = "callersSection" - ) - default Title callerTargetIndicators() - { - return new Title(); - } - - @ConfigItem( - position = 9, - keyName = "callersTargets", - name = "Calllers' targets", - description = "Highlights the targets of callers", - section = "callersSection", - titleSection = "callerTargetIndicators" - ) - default boolean callersTargets() - { - return true; - } - - @ConfigItem( - position = 10, - keyName = "callerTargetColor", - name = "Callers' targets color", - description = "Color of the the targets of callers", - section = "callersSection", - titleSection = "callerTargetIndicators" - ) - default Color callerTargetColor() - { - return Color.WHITE.darker(); - } - - @ConfigItem( - position = 11, - keyName = "callerTargetHighlightOptions", - name = "Pile indication methods", - description = "How to highlight the callers' target", - section = "callersSection", - titleSection = "callerTargetIndicators", - enumClass = PlayerIndicationLocation.class - ) - default EnumSet callerTargetHighlightOptions() - { - return defaultPlayerIndicatorMode; - } - - @ConfigItem( - position = 0, - keyName = "unchargedGlory", - name = "Uncharged Glory Indication", - description = "Indicates if players have an uncharged glory (this only works if the above head indicator is selected)", - section = "miscellaneousSection" - ) - default boolean unchargedGlory() - { - return false; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsMinimapOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsMinimapOverlay.java deleted file mode 100644 index 38427c1b01..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsMinimapOverlay.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.playerindicators; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.util.Arrays; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Player; -import net.runelite.api.Point; -import net.runelite.api.SkullIcon; -import net.runelite.client.plugins.friendtagging.FriendTaggingPlugin; -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; -import net.runelite.client.util.ImageUtil; - -@Singleton -public class PlayerIndicatorsMinimapOverlay extends Overlay -{ - private final PlayerIndicatorsService playerIndicatorsService; - private final PlayerIndicatorsPlugin plugin; - private final BufferedImage skullIcon = ImageUtil.getResourceStreamFromClass(PlayerIndicatorsPlugin.class, - "skull.png"); - - @Inject - private PlayerIndicatorsMinimapOverlay(final PlayerIndicatorsPlugin plugin, final PlayerIndicatorsService playerIndicatorsService) - { - this.plugin = plugin; - this.playerIndicatorsService = playerIndicatorsService; - setLayer(OverlayLayer.ABOVE_WIDGETS); - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGH); - } - - private void renderMinimapOverlays(Graphics2D graphics, Player actor, PlayerRelation relation) - { - if (!plugin.getLocationHashMap().containsKey(relation) || actor.getName() == null) - { - return; - } - - final List indicationLocations = Arrays.asList(plugin.getLocationHashMap().get(relation)); - final Color color = plugin.getRelationColorHashMap().get(relation); - - if (indicationLocations.contains(PlayerIndicationLocation.MINIMAP)) - { - String name = actor.getName().replace('\u00A0', ' '); - String tag = ""; - String prefix = "tag_"; - if (FriendTaggingPlugin.taggedFriends.containsKey(prefix + name.trim().toLowerCase())) - { - tag = " [" + FriendTaggingPlugin.taggedFriends.get(prefix + name.trim().toLowerCase()) + "] "; - } - - name += tag; - - net.runelite.api.Point minimapLocation = actor.getMinimapLocation(); - - if (minimapLocation != null) - { - if (plugin.isShowCombatLevel()) - { - name += "-(" + actor.getCombatLevel() + ")"; - } - if (actor.getSkullIcon() != null && plugin.isPlayerSkull() && actor.getSkullIcon() == SkullIcon.SKULL) - { - final int width = graphics.getFontMetrics().stringWidth(name); - final int height = graphics.getFontMetrics().getHeight(); - if (plugin.getSkullLocation().equals(PlayerIndicatorsPlugin.MinimapSkullLocations.AFTER_NAME)) - { - OverlayUtil.renderImageLocation(graphics, new Point(minimapLocation.getX() - + width, minimapLocation.getY() - height), - ImageUtil.resizeImage(skullIcon, height, height)); - } - else - { - OverlayUtil.renderImageLocation(graphics, new Point(minimapLocation.getX(), - minimapLocation.getY() - height), - ImageUtil.resizeImage(skullIcon, height, height)); - minimapLocation = new Point(minimapLocation.getX() + skullIcon.getWidth(), minimapLocation.getY()); - } - } - OverlayUtil.renderTextLocation(graphics, minimapLocation, name, color); - } - - } - - } - - @Override - public Dimension render(Graphics2D graphics) - { - playerIndicatorsService.forEachPlayer((player, playerRelation) -> renderMinimapOverlays(graphics, player, playerRelation)); - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsOverlay.java deleted file mode 100644 index 1e6e9c1388..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsOverlay.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * Copyright (c) 2019, 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.playerindicators; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.util.Arrays; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.ItemID; -import net.runelite.api.Player; -import net.runelite.api.Point; -import net.runelite.api.Varbits; -import net.runelite.api.WorldType; -import net.runelite.api.kit.KitType; -import net.runelite.client.game.ClanManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.util.ImageUtil; - -@Slf4j -@Singleton -public class PlayerIndicatorsOverlay extends Overlay -{ - private static final int ACTOR_OVERHEAD_TEXT_MARGIN = 40; - private static final int ACTOR_HORIZONTAL_TEXT_MARGIN = 10; - private static final Object[] NULL_OBJ = new Object[]{null}; - private final BufferedImage agilityIcon = ImageUtil.getResourceStreamFromClass(PlayerIndicatorsPlugin.class, - "agility.png"); - private final BufferedImage noAgilityIcon = ImageUtil.getResourceStreamFromClass(PlayerIndicatorsPlugin.class, - "no-agility.png"); - private final BufferedImage skullIcon = ImageUtil.getResourceStreamFromClass(PlayerIndicatorsPlugin.class, - "skull.png"); - private final PlayerIndicatorsPlugin plugin; - private final PlayerIndicatorsService playerIndicatorsService; - @Inject - private Client client; - @Inject - private ClanManager clanManager; - - @Inject - public PlayerIndicatorsOverlay(PlayerIndicatorsPlugin plugin, PlayerIndicatorsService playerIndicatorsService) - { - this.plugin = plugin; - this.playerIndicatorsService = playerIndicatorsService; - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.MED); - } - - @Override - public Dimension render(Graphics2D graphics) - { - playerIndicatorsService.forEachPlayer((player, playerRelation) -> drawSceneOverlays(graphics, player, playerRelation)); - return null; - } - - private void drawSceneOverlays(Graphics2D graphics, Player actor, PlayerRelation relation) - { - if (actor.getName() == null || !plugin.getLocationHashMap().containsKey(relation)) - { - return; - } - - final List indicationLocations = Arrays.asList(plugin.getLocationHashMap().get(relation)); - final Color color = plugin.getRelationColorHashMap().get(relation); - final boolean skulls = plugin.isPlayerSkull(); - final String name = actor.getName(); - final int zOffset = actor.getLogicalHeight() + ACTOR_OVERHEAD_TEXT_MARGIN; - final Point textLocation = actor.getCanvasTextLocation(graphics, name, zOffset); - - if (indicationLocations.contains(PlayerIndicationLocation.ABOVE_HEAD)) - { - final StringBuilder nameSb = new StringBuilder(name); - - if (plugin.isShowCombatLevel()) - { - nameSb.append(" ("); - nameSb.append(actor.getCombatLevel()); - nameSb.append(")"); - } - - if (plugin.isUnchargedGlory() && - actor.getPlayerAppearance().getEquipmentId(KitType.AMULET) == ItemID.AMULET_OF_GLORY) - { - nameSb.append(" (glory)"); - } - - final String builtString = nameSb.toString(); - final int x = graphics.getFontMetrics().stringWidth(builtString); - final int y = graphics.getFontMetrics().getHeight(); - - if (plugin.isHighlightClan() && actor.isClanMember() && plugin.isShowClanRanks() && relation == PlayerRelation.CLAN) - { - if (clanManager.getRank(actor.getName()) != null) - { - final BufferedImage clanRankImage = clanManager.getClanImage(clanManager.getRank(actor.getName())); - if (clanRankImage != null) - { - OverlayUtil.renderActorTextAndImage(graphics, actor, builtString, color, - ImageUtil.resizeImage(clanRankImage, y, y), 0, ACTOR_HORIZONTAL_TEXT_MARGIN); - } - } - } - else if (skulls && actor.getSkullIcon() != null && relation.equals(PlayerRelation.TARGET)) - { - - OverlayUtil.renderActorTextAndImage(graphics, actor, builtString, color, - ImageUtil.resizeImage(skullIcon, y, y), ACTOR_OVERHEAD_TEXT_MARGIN, ACTOR_HORIZONTAL_TEXT_MARGIN); - } - else - { - OverlayUtil.renderActorTextOverlay(graphics, actor, builtString, color); - } - } - if (actor.getConvexHull() != null && indicationLocations.contains(PlayerIndicationLocation.HULL)) - { - OverlayUtil.renderPolygon(graphics, actor.getConvexHull(), color); - } - - if (indicationLocations.contains(PlayerIndicationLocation.TILE)) - { - if (actor.getCanvasTilePoly() != null) - { - OverlayUtil.renderPolygon(graphics, actor.getCanvasTilePoly(), color); - } - } - - if (relation.equals(PlayerRelation.TARGET)) - { - if (plugin.isShowAgilityLevel() && checkWildy() && plugin.getResultCache().containsKey(actor.getName())) - { - if (textLocation == null) - { - return; - } - - final int level = plugin.getResultCache().get(actor.getName()).getAgility().getLevel(); - - if (plugin.getAgilityFormat() == PlayerIndicatorsPlugin.AgilityFormats.ICONS) - { - - final int width = plugin.isShowCombatLevel() ? graphics.getFontMetrics().stringWidth(name) - + ACTOR_HORIZONTAL_TEXT_MARGIN : graphics.getFontMetrics().stringWidth(name); - - final int height = graphics.getFontMetrics().getHeight(); - if (level >= plugin.getAgilityFirstThreshold()) - { - OverlayUtil.renderImageLocation(graphics, - new Point(textLocation.getX() + 5 + width, - textLocation.getY() - height), - ImageUtil.resizeImage(agilityIcon, height, height)); - } - if (level >= plugin.getAgilitySecondThreshold()) - { - OverlayUtil.renderImageLocation(graphics, - new Point(textLocation.getX() + agilityIcon.getWidth() + width, - textLocation.getY() - height), - ImageUtil.resizeImage(agilityIcon, height, height)); - } - if (level < plugin.getAgilityFirstThreshold()) - { - OverlayUtil.renderImageLocation(graphics, - new Point(textLocation.getX() + 5 + width, - textLocation.getY() - height), - ImageUtil.resizeImage(noAgilityIcon, height, height)); - } - } - else - { - Color agiColor = Color.WHITE; - - if (level >= plugin.getAgilityFirstThreshold()) - { - agiColor = Color.CYAN; - } - else if (level >= plugin.getAgilitySecondThreshold()) - { - agiColor = Color.GREEN; - } - else if (level < plugin.getAgilityFirstThreshold()) - { - agiColor = Color.RED; - } - - final String n = level + " " + "Agility"; - OverlayUtil.renderActorTextOverlay(graphics, actor, n, agiColor, 60); - } - } - } - } - - private boolean checkWildy() - { - return client.getVar(Varbits.IN_WILDERNESS) == 1 || WorldType.isAllPvpWorld(client.getWorldType()); - } - - -} 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 deleted file mode 100644 index a626932d9a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsPlugin.java +++ /dev/null @@ -1,589 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.playerindicators; - -import com.google.inject.Provides; -import java.awt.Color; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Actor; -import net.runelite.api.ClanMember; -import net.runelite.api.ClanMemberRank; -import static net.runelite.api.ClanMemberRank.UNRANKED; -import net.runelite.api.Client; -import net.runelite.api.MenuEntry; -import static net.runelite.api.MenuOpcode.*; -import net.runelite.api.Player; -import net.runelite.api.events.ClanMemberJoined; -import net.runelite.api.events.ClanMemberLeft; -import net.runelite.api.events.InteractingChanged; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.PlayerSpawned; -import net.runelite.api.util.Text; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ClanManager; -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.ColorUtil; -import net.runelite.client.util.PvPUtil; -import net.runelite.http.api.hiscore.HiscoreClient; -import net.runelite.http.api.hiscore.HiscoreResult; - -@PluginDescriptor( - name = "Player Indicators", - description = "Highlight players on-screen and/or on the minimap", - tags = {"highlight", "minimap", "overlay", "players", "pklite"}, - type = PluginType.UTILITY -) -@Singleton -@Getter(AccessLevel.PACKAGE) -public class PlayerIndicatorsPlugin extends Plugin -{ - private static final HiscoreClient HISCORE_CLIENT = new HiscoreClient(); - private final List callers = new ArrayList<>(); - private final Map colorizedMenus = new ConcurrentHashMap<>(); - private final Map relationColorHashMap = new ConcurrentHashMap<>(); - private final Map locationHashMap = new ConcurrentHashMap<>(); - private final Map callerPiles = new ConcurrentHashMap<>(); - @Getter(AccessLevel.PACKAGE) - private final Map resultCache = new HashMap<>(); - private final ExecutorService executorService = Executors.newFixedThreadPool(100); - - @Inject - @Getter(AccessLevel.NONE) - private OverlayManager overlayManager; - - @Inject - @Getter(AccessLevel.NONE) - private PlayerIndicatorsConfig config; - - @Inject - @Getter(AccessLevel.NONE) - private PlayerIndicatorsOverlay playerIndicatorsOverlay; - - @Inject - @Getter(AccessLevel.NONE) - private PlayerIndicatorsMinimapOverlay playerIndicatorsMinimapOverlay; - - @Inject - @Getter(AccessLevel.NONE) - private Client client; - - @Inject - @Getter(AccessLevel.NONE) - private ClanManager clanManager; - - @Inject - @Getter(AccessLevel.NONE) - private EventBus eventBus; - - private ClanMemberRank callerRank; - private PlayerIndicatorsPlugin.AgilityFormats agilityFormat; - private PlayerIndicatorsPlugin.MinimapSkullLocations skullLocation; - private String configCallers; - private boolean highlightCallerTargets; - private boolean highlightCallers; - private boolean highlightClan; - private boolean highlightFriends; - private boolean highlightOther; - private boolean highlightOwnPlayer; - private boolean highlightTargets; - private boolean highlightTeam; - private boolean playerSkull; - private boolean showAgilityLevel; - private boolean showClanRanks; - private boolean showCombatLevel; - private boolean targetRisk; - private boolean unchargedGlory; - private boolean useClanchatRanks; - private int agilityFirstThreshold; - private int agilitySecondThreshold; - - @Provides - PlayerIndicatorsConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(PlayerIndicatorsConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - resultCache.clear(); - overlayManager.add(playerIndicatorsOverlay); - overlayManager.add(playerIndicatorsMinimapOverlay); - getCallerList(); - } - - @Override - protected void shutDown() - { - overlayManager.remove(playerIndicatorsOverlay); - overlayManager.remove(playerIndicatorsMinimapOverlay); - resultCache.clear(); - } - - @Subscribe - private void onInteractingChanged(InteractingChanged event) - { - if (!this.highlightCallerTargets || event.getSource() == null || callers.isEmpty() || !isCaller(event.getSource())) - { - return; - } - - final Actor caller = event.getSource(); - - if (this.callerPiles.containsKey(caller.getName())) - { - if (event.getTarget() == null) - { - callerPiles.remove(caller.getName()); - return; - } - - callerPiles.replace(caller.getName(), event.getTarget()); - return; - } - - if (event.getTarget() == null) - { - return; - } - - callerPiles.put(caller.getName(), event.getTarget()); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("playerindicators")) - { - return; - } - - updateConfig(); - } - - @Subscribe - private void onClanMemberJoined(ClanMemberJoined event) - { - getCallerList(); - } - - @Subscribe - private void onClanMemberLeft(ClanMemberLeft event) - { - getCallerList(); - } - - @Subscribe - private void onPlayerSpawned(PlayerSpawned event) - { - final Player player = event.getPlayer(); - - if (!this.showAgilityLevel || resultCache.containsKey(player.getName())) - { - return; - } - - executorService.submit(() -> - { - HiscoreResult result; - do - { - try - { - result = HISCORE_CLIENT.lookup(player.getName()); - } - catch (IOException ex) - { - result = null; - try - { - Thread.sleep(250); - } - catch (InterruptedException e) - { - e.printStackTrace(); - } - } - } - while (result == null); - - resultCache.put(player.getName(), result); - }); - } - - @Subscribe - private void onMenuEntryAdded(MenuEntryAdded menuEntryAdded) - { - int type = menuEntryAdded.getOpcode(); - - if (type >= 2000) - { - type -= 2000; - } - - int identifier = menuEntryAdded.getIdentifier(); - if (type == FOLLOW.getId() || type == TRADE.getId() - || type == SPELL_CAST_ON_PLAYER.getId() || type == ITEM_USE_ON_PLAYER.getId() - || type == PLAYER_FIRST_OPTION.getId() - || type == PLAYER_SECOND_OPTION.getId() - || type == PLAYER_THIRD_OPTION.getId() - || type == PLAYER_FOURTH_OPTION.getId() - || type == PLAYER_FIFTH_OPTION.getId() - || type == PLAYER_SIXTH_OPTION.getId() - || type == PLAYER_SEVENTH_OPTION.getId() - || type == PLAYER_EIGTH_OPTION.getId() - || type == RUNELITE.getId()) - { - final Player localPlayer = client.getLocalPlayer(); - final Player[] players = client.getCachedPlayers(); - Player player = null; - - if (identifier >= 0 && identifier < players.length) - { - player = players[identifier]; - } - - if (player == null) - { - return; - } - - int image = -1; - int image2 = -1; - Color color = null; - - if (this.highlightCallers && isCaller(player)) - { - if (Arrays.asList(this.locationHashMap.get(PlayerRelation.CALLER)).contains(PlayerIndicationLocation.MENU)) - { - color = relationColorHashMap.get(PlayerRelation.CALLER); - } - } - else if (this.highlightCallerTargets && isPile(player)) - { - if (Arrays.asList(this.locationHashMap.get(PlayerRelation.CALLER_TARGET)).contains(PlayerIndicationLocation.MENU)) - { - color = relationColorHashMap.get(PlayerRelation.CALLER_TARGET); - } - } - else if (this.highlightFriends && client.isFriended(player.getName(), false)) - { - if (Arrays.asList(this.locationHashMap.get(PlayerRelation.FRIEND)).contains(PlayerIndicationLocation.MENU)) - { - color = relationColorHashMap.get(PlayerRelation.FRIEND); - } - } - else if (this.highlightClan && player.isClanMember()) - { - if (Arrays.asList(this.locationHashMap.get(PlayerRelation.CLAN)).contains(PlayerIndicationLocation.MENU)) - { - color = relationColorHashMap.get(PlayerRelation.CLAN); - } - - ClanMemberRank rank = clanManager.getRank(player.getName()); - if (rank != UNRANKED) - { - image = clanManager.getIconNumber(rank); - } - } - else if (this.highlightTeam && player.getTeam() > 0 && (localPlayer != null ? localPlayer.getTeam() : -1) == player.getTeam()) - { - if (Arrays.asList(this.locationHashMap.get(PlayerRelation.TEAM)).contains(PlayerIndicationLocation.MENU)) - { - color = relationColorHashMap.get(PlayerRelation.TEAM); - } - } - else if (this.highlightOther && !player.isClanMember() && !player.isFriend() && !PvPUtil.isAttackable(client, player)) - { - if (Arrays.asList(this.locationHashMap.get(PlayerRelation.OTHER)).contains(PlayerIndicationLocation.MENU)) - { - color = relationColorHashMap.get(PlayerRelation.OTHER); - } - } - else if (this.highlightTargets && !player.isClanMember() && !client.isFriended(player.getName(), - false) && PvPUtil.isAttackable(client, player)) - { - if (Arrays.asList(this.locationHashMap.get(PlayerRelation.TARGET)).contains(PlayerIndicationLocation.MENU)) - { - color = relationColorHashMap.get(PlayerRelation.TARGET); - } - } - - - if (this.playerSkull && !player.isClanMember() && player.getSkullIcon() != null) - { - image2 = 35; - } - - if (image != -1 || color != null) - { - final MenuEntry[] menuEntries = client.getMenuEntries(); - final MenuEntry lastEntry = menuEntries[menuEntries.length - 1]; - - - if (color != null) - { - // strip out existing '); - if (idx != -1) - { - target = target.substring(idx + 1); - } - - lastEntry.setTarget(ColorUtil.prependColorTag(target, color)); - } - if (image != -1) - { - lastEntry.setTarget("" + lastEntry.getTarget()); - } - - if (image2 != -1 && this.playerSkull) - { - lastEntry.setTarget("" + lastEntry.getTarget()); - } - - client.setMenuEntries(menuEntries); - } - } - } - - - private void getCallerList() - { - if (!this.highlightCallers) - { - return; - } - - callers.clear(); - - if (this.useClanchatRanks && client.getClanMembers() != null) - { - for (ClanMember clanMember : client.getClanMembers()) - { - if (clanMember.getRank().getValue() > this.callerRank.getValue()) - { - callers.add(Text.standardize(clanMember.getUsername())); - } - } - } - - if (this.configCallers.contains(",")) - { - callers.addAll(Arrays.asList(this.configCallers.split(","))); - return; - } - - if (!this.configCallers.equals("")) - { - callers.add(this.configCallers); - } - } - - /** - * Checks if a player is a caller - * - * @param player The player to check - * @return true if they are, false otherwise - */ - boolean isCaller(Actor player) - { - if (player == null || player.getName() == null) - { - return false; - } - - if (callers.size() > 0) - { - for (String name : callers) - { - String finalName = Text.standardize(name.trim()); - if (Text.standardize(player.getName()).equals(finalName)) - { - return true; - } - } - } - - return false; - } - - /** - * Checks if a player is currently a target of any of the current callers - * - * @param actor The player to check - * @return true if they are a target, false otherwise - */ - public boolean isPile(Actor actor) - { - /** - if (!(actor instanceof Player)) - { - return false; - } - **/ - if (actor == null) - { - return false; - } - - return callerPiles.containsValue(actor); - } - - - private void updateConfig() - { - locationHashMap.clear(); - relationColorHashMap.clear(); - this.highlightOwnPlayer = config.highlightOwnPlayer(); - if (this.highlightOwnPlayer) - { - relationColorHashMap.put(PlayerRelation.SELF, config.getOwnPlayerColor()); - if (config.selfIndicatorModes() != null) - { - locationHashMap.put(PlayerRelation.SELF, EnumSet.copyOf(config.selfIndicatorModes()).toArray()); - } - } - - this.highlightFriends = config.highlightFriends(); - if (this.highlightFriends) - { - relationColorHashMap.put(PlayerRelation.FRIEND, config.getFriendColor()); - if (config.friendIndicatorMode() != null) - { - locationHashMap.put(PlayerRelation.FRIEND, config.friendIndicatorMode().toArray()); - } - } - - this.highlightClan = config.highlightClan(); - if (this.highlightClan) - { - relationColorHashMap.put(PlayerRelation.CLAN, config.getClanColor()); - if (config.clanIndicatorModes() != null) - { - locationHashMap.put(PlayerRelation.CLAN, config.clanIndicatorModes().toArray()); - } - } - - this.highlightTeam = config.highlightTeamMembers(); - if (this.highlightTeam) - { - relationColorHashMap.put(PlayerRelation.TEAM, config.getTeamcolor()); - if (config.teamIndicatorModes() != null) - { - locationHashMap.put(PlayerRelation.TEAM, config.teamIndicatorModes().toArray()); - } - } - - this.highlightOther = config.highlightOtherPlayers(); - if (this.highlightOther) - { - relationColorHashMap.put(PlayerRelation.OTHER, config.getOtherColor()); - if (config.otherIndicatorModes() != null) - { - locationHashMap.put(PlayerRelation.OTHER, EnumSet.copyOf(config.otherIndicatorModes()).toArray()); - } - } - - this.highlightTargets = config.highlightTargets(); - if (this.highlightTargets) - { - relationColorHashMap.put(PlayerRelation.TARGET, config.getTargetsColor()); - if (config.targetsIndicatorModes() != null) - { - locationHashMap.put(PlayerRelation.TARGET, config.targetsIndicatorModes().toArray()); - } - } - - this.highlightCallers = config.highlightCallers(); - if (this.highlightCallers) - { - this.callerRank = config.callerRank(); - - this.configCallers = config.callers(); - relationColorHashMap.put(PlayerRelation.CALLER, config.callerColor()); - if (config.callerHighlightOptions() != null) - { - locationHashMap.put(PlayerRelation.CALLER, config.callerHighlightOptions().toArray()); - } - getCallerList(); - } - - this.highlightCallerTargets = config.callersTargets(); - if (this.highlightCallerTargets) - { - relationColorHashMap.put(PlayerRelation.CALLER_TARGET, config.callerTargetColor()); - if (config.callerTargetHighlightOptions() != null) - { - locationHashMap.put(PlayerRelation.CALLER_TARGET, config.callerTargetHighlightOptions().toArray()); - } - } - - this.showClanRanks = config.showClanRanks(); - this.showCombatLevel = config.showCombatLevel(); - this.showAgilityLevel = config.showAgilityLevel(); - this.agilityFirstThreshold = config.agilityFirstThreshold(); - this.agilitySecondThreshold = config.agilitySecondThreshold(); - this.agilityFormat = config.agilityFormat(); - this.playerSkull = config.playerSkull(); - this.skullLocation = config.skullLocation(); - this.targetRisk = config.targetRisk(); - this.useClanchatRanks = config.useClanchatRanks(); - this.unchargedGlory = config.unchargedGlory(); - } - - public enum MinimapSkullLocations - { - BEFORE_NAME, - AFTER_NAME - } - - public enum AgilityFormats - { - TEXT, - ICONS - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsService.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsService.java deleted file mode 100644 index 3de622159c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsService.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.playerindicators; - -import java.util.List; -import java.util.Objects; -import java.util.function.BiConsumer; -import java.util.function.Predicate; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Player; -import net.runelite.client.util.PvPUtil; - -@Singleton -public class PlayerIndicatorsService -{ - private final Client client; - private final PlayerIndicatorsPlugin plugin; - - private final Predicate self; - private final Predicate friend; - private final Predicate clan; - private final Predicate team; - private final Predicate target; - private final Predicate other; - private final Predicate caller; - private final Predicate callerTarget; - - @Inject - private PlayerIndicatorsService(final Client client, final PlayerIndicatorsPlugin plugin) - { - this.client = client; - this.plugin = plugin; - - self = (player) -> (client.getLocalPlayer().equals(player) - && plugin.getLocationHashMap().containsKey(PlayerRelation.SELF)); - - friend = (player) -> (!player.equals(client.getLocalPlayer()) - && client.isFriended(player.getName(), false) - && plugin.getLocationHashMap().containsKey(PlayerRelation.FRIEND)); - - clan = (player) -> (player.isClanMember() && !client.getLocalPlayer().equals(player) && !client.isFriended(player.getName(), false) - && plugin.getLocationHashMap().containsKey(PlayerRelation.CLAN)); - - team = (player) -> (Objects.requireNonNull(client.getLocalPlayer()).getTeam() != 0 && !player.isClanMember() - && !client.isFriended(player.getName(), false) - && client.getLocalPlayer().getTeam() == player.getTeam() - && plugin.getLocationHashMap().containsKey(PlayerRelation.TEAM)); - - target = (player) -> (!team.test(player) && !clan.test(player) - && !client.isFriended(player.getName(), false) && PvPUtil.isAttackable(client, player) - && !client.getLocalPlayer().equals(player) && !clan.test(player) && plugin.getLocationHashMap().containsKey(PlayerRelation.TARGET)); - - caller = (player) -> (plugin.isCaller(player) && plugin.getLocationHashMap().containsKey(PlayerRelation.CALLER)); - - callerTarget = (player) -> (plugin.isPile(player) && plugin.getLocationHashMap().containsKey(PlayerRelation.CALLER_TARGET)); - - other = (player) -> - (!PvPUtil.isAttackable(client, player) && !client.getLocalPlayer().equals(player) - && !team.test(player) && !clan.test(player) && !client.isFriended(player.getName(), false) - && plugin.getLocationHashMap().containsKey(PlayerRelation.OTHER)); - - } - - public void forEachPlayer(final BiConsumer consumer) - { - if (!highlight()) - { - return; - } - - final List players = client.getPlayers(); - for (Player p : players) - { - if (caller.test(p)) - { - consumer.accept(p, PlayerRelation.CALLER); - continue; - } - if (callerTarget.test(p)) - { - consumer.accept(p, PlayerRelation.CALLER_TARGET); - continue; - } - if (other.test(p)) - { - consumer.accept(p, PlayerRelation.OTHER); - continue; - } - if (self.test(p)) - { - consumer.accept(p, PlayerRelation.SELF); - continue; - } - if (friend.test(p)) - { - consumer.accept(p, PlayerRelation.FRIEND); - continue; - } - if (clan.test(p)) - { - consumer.accept(p, PlayerRelation.CLAN); - continue; - } - if (team.test(p)) - { - consumer.accept(p, PlayerRelation.TEAM); - continue; - } - if (target.test(p)) - { - consumer.accept(p, PlayerRelation.TARGET); - } - } - } - - private boolean highlight() - { - return plugin.isHighlightOwnPlayer() || plugin.isHighlightClan() - || plugin.isHighlightFriends() || plugin.isHighlightOther() || plugin.isHighlightTargets() - || plugin.isHighlightCallers() || plugin.isHighlightTeam() || plugin.isHighlightCallerTargets(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerNameLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerNameLocation.java deleted file mode 100644 index 14a4eff208..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerNameLocation.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2019, 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.playerindicators; - -import lombok.AllArgsConstructor; - -@AllArgsConstructor -public enum PlayerNameLocation -{ - - DISABLED("Disabled"), - ABOVE_HEAD("Above head"), - MODEL_CENTER("Center of model"), - MODEL_RIGHT("Right of model"); - - private final String name; - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerRelation.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerRelation.java deleted file mode 100644 index ac4b346b2f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerRelation.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019 openosrs - * 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 - * openosrs Discord: https://discord.gg/Q7wFtCe - * openosrs website: https://openosrs.com - ******************************************************************************/ - -package net.runelite.client.plugins.playerindicators; - -public enum PlayerRelation -{ - SELF, - FRIEND, - CLAN, - TEAM, - TARGET, - OTHER, - CALLER, - CALLER_TARGET -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerinfo/PlayerInfoConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerinfo/PlayerInfoConfig.java deleted file mode 100644 index ad57c8c091..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerinfo/PlayerInfoConfig.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.playerinfo; - -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.ConfigTitleSection; -import net.runelite.client.config.Title; - -@ConfigGroup("playerinfo") -public interface PlayerInfoConfig extends Config -{ - @ConfigTitleSection( - keyName = "overlaysTitle", - name = "Overlays", - description = "", - position = 0 - ) - default Title overlaysTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "enableHealth", - name = "Enable Health Display", - description = "Configures whether or not to display health information", - position = 1, - titleSection = "overlaysTitle" - ) - default boolean enableHealth() - { - return true; - } - - @ConfigItem( - keyName = "enablePrayer", - name = "Enable Prayer Display", - description = "Configures whether or not to display prayer information", - position = 2, - titleSection = "overlaysTitle" - ) - default boolean enablePrayer() - { - return true; - } - - @ConfigItem( - keyName = "enableEnergy", - name = "Enable Run Energy Display", - description = "Configures whether or not to display run energy information", - position = 3, - titleSection = "overlaysTitle" - ) - default boolean enableEnergy() - { - return true; - } - - @ConfigItem( - keyName = "enableSpec", - name = "Enable Special Attack Display", - description = "Configures whether or not to display special attack information", - position = 4, - titleSection = "overlaysTitle" - ) - default boolean enableSpec() - { - return true; - } - - @ConfigItem( - keyName = "enableWorld", - name = "Enable World Display", - description = "Configures whether or not to display world information", - position = 5, - titleSection = "overlaysTitle" - ) - default boolean enableWorld() - { - return true; - } - - @ConfigTitleSection( - keyName = "colorsTitle", - name = "Colors", - description = "", - position = 6 - ) - default Title colorsTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "colorHigh", - name = "Color High", - description = "The color displayed for high values.", - position = 7, - titleSection = "colorsTitle" - ) - default Color colorHigh() - { - return Color.GREEN; - } - - @ConfigItem( - keyName = "colorMed", - name = "Color Medium", - description = "The color displayed for medium values.", - position = 8, - titleSection = "colorsTitle" - ) - default Color colorMed() - { - return Color.YELLOW; - } - - @ConfigItem( - keyName = "colorLow", - name = "Color Low", - description = "The color displayed for low values.", - position = 7, - titleSection = "colorsTitle" - ) - default Color colorLow() - { - return Color.RED; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerinfo/PlayerInfoCustomIndicator.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerinfo/PlayerInfoCustomIndicator.java deleted file mode 100644 index f976c61171..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerinfo/PlayerInfoCustomIndicator.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.playerinfo; - -import java.awt.Color; -import java.awt.image.BufferedImage; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.Skill; -import net.runelite.api.VarPlayer; -import net.runelite.client.ui.overlay.infobox.InfoBox; -import net.runelite.client.util.ColorUtil; - -public class PlayerInfoCustomIndicator extends InfoBox -{ - @AllArgsConstructor - @Getter(AccessLevel.PACKAGE) - enum IndicatorType - { - HEALTH("Current Hitpoints"), - PRAYER("Current Prayer Points"), - ENERGY("Current Run Energy"), - SPECIAL("Current Special Attack"), - WORLD("Current World"); - - private final String description; - } - - private final PlayerInfoPlugin plugin; - private final Client client; - private final IndicatorType type; - - PlayerInfoCustomIndicator(final BufferedImage image, final PlayerInfoPlugin plugin, final Client client, final IndicatorType type) - { - super(image, plugin); - this.plugin = plugin; - this.client = client; - this.type = type; - - setTooltip(type.getDescription()); - } - - @Override - public String getText() - { - switch (type) - { - case HEALTH: - return String.valueOf(client.getBoostedSkillLevel(Skill.HITPOINTS)); - case PRAYER: - return String.valueOf(client.getBoostedSkillLevel(Skill.PRAYER)); - case ENERGY: - return String.valueOf(client.getEnergy()); - case SPECIAL: - return String.valueOf(client.getVar(VarPlayer.SPECIAL_ATTACK_PERCENT) / 10); - case WORLD: - return String.valueOf(client.getWorld()); - } - - return null; - } - - @Override - public Color getTextColor() - { - float currLvl = 0; - switch (type) - { - case HEALTH: - currLvl = client.getBoostedSkillLevel(Skill.HITPOINTS) / (float) client.getRealSkillLevel(Skill.HITPOINTS); - break; - case PRAYER: - currLvl = client.getBoostedSkillLevel(Skill.PRAYER) / (float) client.getRealSkillLevel(Skill.PRAYER); - break; - case ENERGY: - currLvl = client.getEnergy() / 100.0F; - break; - case SPECIAL: - currLvl = client.getVar(VarPlayer.SPECIAL_ATTACK_PERCENT) / 1000.0F; - break; - case WORLD: - currLvl = 1000; // hacky - } - - if (currLvl > 1.0) - { - return plugin.getColorHigh(); - } - else if (currLvl > 0.5) - { - return ColorUtil.colorLerp(plugin.getColorMed(), plugin.getColorHigh(), (currLvl * 2) - 1.0F); - } - else - { - return ColorUtil.colorLerp(plugin.getColorLow(), plugin.getColorMed(), (currLvl * 2)); - } - } - - @Override - public boolean render() - { - switch (type) - { - case HEALTH: - return plugin.isEnableHealth(); - case PRAYER: - return plugin.isEnablePrayer(); - case ENERGY: - return plugin.isEnableEnergy(); - case SPECIAL: - return plugin.isEnableSpec(); - case WORLD: - return plugin.isEnableWorld(); - } - - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerinfo/PlayerInfoPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerinfo/PlayerInfoPlugin.java deleted file mode 100644 index 7eb37e25c1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerinfo/PlayerInfoPlugin.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.playerinfo; - -import com.google.inject.Provides; -import java.awt.Color; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.SpriteID; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import static net.runelite.client.plugins.playerinfo.PlayerInfoCustomIndicator.IndicatorType; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; - -@PluginDescriptor( - name = "Player Information", - description = "An alternative to the Minimap Orbs", - tags = {"combat", "overlay"}, - type = PluginType.UTILITY, - enabledByDefault = false -) -@Singleton -public class PlayerInfoPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private PlayerInfoConfig config; - - @Inject - private SpriteManager spriteManager; - - @Getter(AccessLevel.PACKAGE) - private boolean enableHealth; - @Getter(AccessLevel.PACKAGE) - private boolean enablePrayer; - @Getter(AccessLevel.PACKAGE) - private boolean enableEnergy; - @Getter(AccessLevel.PACKAGE) - private boolean enableSpec; - @Getter(AccessLevel.PACKAGE) - private boolean enableWorld; - @Getter(AccessLevel.PACKAGE) - private Color colorHigh; - @Getter(AccessLevel.PACKAGE) - private Color colorMed; - @Getter(AccessLevel.PACKAGE) - private Color colorLow; - - @Provides - PlayerInfoConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(PlayerInfoConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - clientThread.invoke(() -> - { - if (client.getGameState().ordinal() < GameState.LOGIN_SCREEN.ordinal()) - { - return false; - } - - BufferedImage healthImg = spriteManager.getSprite(SpriteID.MINIMAP_ORB_HITPOINTS_ICON, 0); - BufferedImage prayerImg = spriteManager.getSprite(SpriteID.MINIMAP_ORB_PRAYER_ICON, 0); - BufferedImage energyImg = spriteManager.getSprite(SpriteID.MINIMAP_ORB_RUN_ICON, 0); - BufferedImage combatImg = spriteManager.getSprite(SpriteID.MINIMAP_ORB_SPECIAL_ICON, 0); - BufferedImage worldImg = spriteManager.getSprite(SpriteID.MINIMAP_ORB_WORLD_MAP_PLANET, 0); - - infoBoxManager.addInfoBox(new PlayerInfoCustomIndicator(healthImg, this, client, IndicatorType.HEALTH)); - infoBoxManager.addInfoBox(new PlayerInfoCustomIndicator(prayerImg, this, client, IndicatorType.PRAYER)); - infoBoxManager.addInfoBox(new PlayerInfoCustomIndicator(energyImg, this, client, IndicatorType.ENERGY)); - infoBoxManager.addInfoBox(new PlayerInfoCustomIndicator(combatImg, this, client, IndicatorType.SPECIAL)); - infoBoxManager.addInfoBox(new PlayerInfoCustomIndicator(worldImg, this, client, IndicatorType.WORLD)); - - return true; - }); - } - - @Override - protected void shutDown() - { - infoBoxManager.removeIf(i -> i instanceof PlayerInfoCustomIndicator); - } - - private void updateConfig() - { - this.enableHealth = config.enableHealth(); - this.enablePrayer = config.enablePrayer(); - this.enableEnergy = config.enableEnergy(); - this.enableSpec = config.enableSpec(); - this.enableWorld = config.enableWorld(); - this.colorHigh = config.colorHigh(); - this.colorMed = config.colorMed(); - this.colorLow = config.colorLow(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerscouter/PlayerScouter.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerscouter/PlayerScouter.java deleted file mode 100644 index 501440123a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerscouter/PlayerScouter.java +++ /dev/null @@ -1,493 +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.playerscouter; - -import com.google.inject.Provides; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import javax.inject.Inject; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.Varbits; -import net.runelite.api.WorldType; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.PlayerContainer; -import net.runelite.client.game.PlayerManager; -import net.runelite.client.game.WorldLocation; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.util.QuantityFormatter; -import net.runelite.http.api.discord.DiscordClient; -import net.runelite.http.api.discord.DiscordEmbed; -import net.runelite.http.api.discord.DiscordMessage; -import net.runelite.http.api.discord.embed.AuthorEmbed; -import net.runelite.http.api.discord.embed.FieldEmbed; -import net.runelite.http.api.discord.embed.FooterEmbed; -import net.runelite.http.api.discord.embed.ThumbnailEmbed; -import net.runelite.http.api.item.ItemStats; -import okhttp3.HttpUrl; - -@PluginDescriptor( - name = "Player Scouter", - description = "Scout players and output them to your discord channel!", - type = PluginType.PVP, - enabledByDefault = false -) -@Slf4j -public class PlayerScouter extends Plugin -{ - private static final DiscordClient DISCORD_CLIENT = new DiscordClient(); - private static final SimpleDateFormat SDF = new SimpleDateFormat("MMM dd h:mm a z"); - private static final String ICON_URL = "https://www.osrsbox.com/osrsbox-db/items-icons/"; // Add item id + ".png" - - @Inject - private Client client; - @Inject - private ItemManager itemManager; - @Inject - private PlayerScouterConfig config; - @Inject - private PlayerManager playerManager; - - private final Map blacklist = new HashMap<>(); - private HttpUrl webhook; - private int minimumRisk; - private int minimumValue; - private int timeout; - private int minimumCombat; - private int maximumCombat; - private boolean onlyWildy; - private boolean outputItems; - private boolean scoutFriends; - private boolean scoutClan; - - @Provides - PlayerScouterConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(PlayerScouterConfig.class); - } - - @Override - protected void startUp() - { - blacklist.clear(); - updateConfig(); - } - - @Override - protected void shutDown() - { - blacklist.clear(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("playerscouter")) - { - return; - } - - updateConfig(); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGGED_IN) - { - return; - } - - blacklist.clear(); - } - - @Subscribe - private void onGameTick(GameTick event) - { - resetBlacklist(); - - if (!checkWildy() || this.webhook == null) - { - return; - } - - final List players = new ArrayList<>(); - - for (PlayerContainer player : playerManager.getPlayerContainers()) - { - if (player.isScouted()) - { - player.setScoutTimer(player.getScoutTimer() - 1); - if (player.getScoutTimer() <= 0) - { - player.setScouted(false); - player.setScoutTimer(500); - } - continue; - } - - if (player.getPlayer().getCombatLevel() < this.minimumCombat || player.getPlayer().getCombatLevel() > this.maximumCombat) - { - continue; - } - - if ((player.getPlayer().getCombatLevel() >= this.minimumCombat && - player.getPlayer().getCombatLevel() <= this.maximumCombat) && - player.getRisk() > this.minimumRisk) - { - if (player.getSkills() == null) - { - if (player.isHttpRetry()) - { - continue; - } - playerManager.updateStats(player.getPlayer()); - continue; - } - if (config.mini()) - { - players.add(player); - continue; - } - addPlayer(player); - } - } - - if (config.mini()) - { - players.sort(Comparator.comparingInt(PlayerContainer::getRisk).reversed()); - scoutMini(players); - } - } - - private void addPlayer(PlayerContainer player) - { - if (player.getPlayer() == client.getLocalPlayer() - || (!blacklist.isEmpty() && blacklist.containsKey(player.getName())) - || (!this.scoutFriends && client.isFriended(player.getName(), false) - || (!this.scoutClan && client.isClanMember(player.getName())))) - { - log.debug("Player Rejected: {}", player.getName()); - return; - } - - blacklist.put(player.getName(), client.getTickCount() + this.timeout); - scoutPlayer(player); - } - - private void resetBlacklist() - { - if (blacklist.isEmpty()) - { - return; - } - - Iterator> iter = blacklist.entrySet().iterator(); - - iter.forEachRemaining(entry -> - { - if (entry.getValue() == client.getTickCount()) - { - iter.remove(); - } - }); - } - - private boolean checkWildy() - { - if (!this.onlyWildy) - { - return true; - } - - return client.getVar(Varbits.IN_WILDERNESS) == 1 || WorldType.isPvpWorld(client.getWorldType()); - } - - private void updateConfig() - { - this.webhook = HttpUrl.parse(config.webhook()); - this.minimumRisk = config.minimumRisk(); - this.minimumValue = config.minimumValue(); - this.timeout = config.timeout(); - this.onlyWildy = config.onlyWildy(); - this.outputItems = config.outputItems(); - this.scoutClan = config.scoutClan(); - this.scoutFriends = config.scoutFriends(); - this.minimumCombat = config.minimumCombat(); - this.maximumCombat = config.maximumCombat(); - } - - private void scoutMini(List players) - { - if (client.getLocalPlayer() == null) - { - return; - } - - final List fieldList = new ArrayList<>(); - final String location = WorldLocation.location(client.getLocalPlayer().getWorldLocation()); - final int cap = Math.min(players.size(), 25); - - int highestValue = 0; - int id = 0; - int risk = 0; - for (int i = 0; i < cap; i++) - { - final PlayerContainer player = players.get(i); - final Map.Entry entry = getEntry(player.getGear()); - risk += player.getRisk(); - if (entry != null) - { - final int mostValued = (int) entry.getValue(); - final int mostValuedId = (int) entry.getKey(); - - if (mostValued > highestValue) - { - highestValue = mostValued; - id = mostValuedId; - } - } - - String name = "☠️ " + player.getName() + " ☠️"; - - if (player.getPlayer().getSkullIcon() == null) - { - name = player.getName(); - } - - fieldList.add(FieldEmbed.builder() - .name(name) - .value(QuantityFormatter.quantityToRSDecimalStack(player.getRisk())) - .inline(true) - .build()); - - player.setScouted(true); - } - - String iconId = String.valueOf(id); - String icon = ICON_URL + iconId + ".png"; - - ThumbnailEmbed image = ThumbnailEmbed.builder() - .url(ICON_URL + iconId + ".png") - .build(); - - String color = "8388352"; - - if (risk < 1000000 && risk > 150000) - { - //blue - color = "32767"; - } - else if (risk > 1000000) - { - //orange - color = "16744448"; - } - - message(location, icon, image, fieldList, color); - } - - private void scoutPlayer(PlayerContainer player) - { - if (player.isScouted()) - { - return; - } - - List fieldList = new ArrayList<>(); - //green - String color = "8388352"; - - if (player.getRisk() < 1000000 && player.getRisk() > 150000) - { - //blue - color = "32767"; - } - else if (player.getRisk() > 1000000) - { - //orange - color = "16744448"; - } - - ThumbnailEmbed image = ThumbnailEmbed.builder() - .url(ICON_URL + player.getWeapon() + ".png") - .build(); - - fieldList.add(FieldEmbed.builder() - .name("Risk") - .value(QuantityFormatter.quantityToRSDecimalStack(player.getRisk())) - .inline(true) - .build()); - - fieldList.add(FieldEmbed.builder() - .name("World") - .value(Integer.toString(client.getWorld())) - .inline(true) - .build()); - - fieldList.add(FieldEmbed.builder() - .name("Combat Level") - .value(Integer.toString(player.getPlayer().getCombatLevel())) - .inline(true) - .build()); - - if (client.getVar(Varbits.IN_WILDERNESS) == 1) - { - fieldList.add(FieldEmbed.builder() - .name("Wildy Level") - .value(Integer.toString(player.getWildyLevel())) - .inline(true) - .build()); - - fieldList.add(FieldEmbed.builder() - .name("Location") - .value(player.getLocation()) - .inline(true) - .build()); - } - - fieldList.add(FieldEmbed.builder() - .name("Target") - .value(player.getTargetString()) - .inline(true) - .build()); - - if (this.outputItems) - { - fieldList.add(FieldEmbed.builder() - .name("Risked Items Sorted by Value") - .value("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━") - .build()); - - int items = 0; - - for (Map.Entry entry : player.getRiskedGear().entrySet()) - { - Integer gear = entry.getKey(); - Integer value = entry.getValue(); - if (value <= 0 || value <= this.minimumValue) - { - items++; - continue; - } - - ItemStats item = itemManager.getItemStats(gear, false); - String name = itemManager.getItemDefinition(gear).getName(); - - if (item == null) - { - log.error("Item is Null: {}", gear); - continue; - } - - fieldList.add(FieldEmbed.builder() - .name(name) - .value("Value: " + QuantityFormatter.quantityToRSDecimalStack(value)) - .inline(true) - .build()); - } - - if (items > 0) - { - fieldList.add(FieldEmbed.builder() - .name("Items below value: " + this.minimumValue) - .value(Integer.toString(items)) - .inline(true) - .build()); - } - } - - - Map.Entry entry = getEntry(player.getGear()); - String iconId = entry == null ? String.valueOf(1) : String.valueOf(entry.getKey()); - String icon = ICON_URL + iconId + ".png"; - String name = "☠️ " + player.getName() + " ☠️"; - - if (player.getPlayer().getSkullIcon() == null) - { - name = player.getName(); - } - - message(name, icon, image, fieldList, color); - player.setScouted(true); - } - - private void message(String name, String iconUrl, ThumbnailEmbed thumbnail, List fields, String color) - { - log.debug("Message Contents: {}, {}, {}, {}, {}", name, " ", thumbnail, Arrays.toString(fields.toArray()), this.webhook); - log.debug("Fields: {}", fields); - - if (name.isEmpty() || fields.isEmpty()) - { - log.debug("Discord message will fail with a missing name/description/field"); - return; - } - - final Date currentTime = new Date(System.currentTimeMillis()); - - DiscordEmbed discordEmbed = new DiscordEmbed( - AuthorEmbed.builder() - .icon_url(iconUrl) - .name(name) - .build(), - thumbnail, - " ", - FooterEmbed.builder() - .icon_url("https://raw.githubusercontent.com/runelite/runelite/master/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/ultimate_ironman.png") - .text("Gabon Scouter | Time: " + SDF.format(currentTime)) - .build(), - color, - fields - ); - - DiscordMessage discordMessage = discordEmbed.toDiscordMessage("Gabon Scouter", " ", "https://i.imgur.com/2A6dr7q.png"); - - DISCORD_CLIENT.message(this.webhook, discordMessage); - } - - private static Map.Entry getEntry(LinkedHashMap map) - { - if (!map.isEmpty()) - { - return map.entrySet().iterator().next(); - } - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerscouter/PlayerScouterConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerscouter/PlayerScouterConfig.java deleted file mode 100644 index d60513e890..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerscouter/PlayerScouterConfig.java +++ /dev/null @@ -1,164 +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.playerscouter; - -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("playerscouter") -public interface PlayerScouterConfig extends Config -{ - @ConfigItem( - keyName = "webhook", - name = "Webhook Url", - description = "Input the url for your webhook.", - position = 0, - secret = true - ) - default String webhook() - { - return ""; - } - - @ConfigItem( - keyName = "mini", - name = "Minify Output", - description = "", - position = 0, - secret = true - ) - default boolean mini() - { - return true; - } - - @ConfigItem( - keyName = "onlyWildy", - name = "Only Scout in Wildy", - description = "This will only scout players in the wilderness.", - position = 1 - ) - default boolean onlyWildy() - { - return true; - } - - @ConfigItem( - keyName = "scoutClan", - name = "Scout Clan Members", - description = "Enable this to scout clan members.", - position = 2 - ) - default boolean scoutClan() - { - return true; - } - - @ConfigItem( - keyName = "scoutFriends", - name = "Scout Friends", - description = "Enable this to scout friends.", - position = 3 - ) - default boolean scoutFriends() - { - return true; - } - - @ConfigItem( - keyName = "outputItems", - name = "Output Items", - description = "This will output all of their risked gear to the webhook.", - position = 4 - ) - default boolean outputItems() - { - return false; - } - - @ConfigItem( - keyName = "minimumRisk", - name = "Minimum Risk", - description = "Minimum risk for the player to be scouted.", - position = 5 - ) - default int minimumRisk() - { - return 1; - } - - @ConfigItem( - keyName = "minimumValue", - name = "Minimum Value", - description = "Minimum value for the item to be posted on discord.", - position = 6 - ) - default int minimumValue() - { - return 1000; - } - - @Range( - min = 3, - max = 125 - ) - @ConfigItem( - keyName = "minimumCombat", - name = "Minimum Combat Level", - description = "The Minimum Combat Level you wish to scout.", - position = 7 - ) - default int minimumCombat() - { - return 3; - } - - @Range( - min = 4, - max = 126 - ) - @ConfigItem( - keyName = "maximumCombat", - name = "Maximum Combat Level", - description = "The Maximum Combat Level you wish to scout.", - position = 8 - ) - default int maximumCombat() - { - return 126; - } - - @ConfigItem( - keyName = "timeout", - name = "Timeout", - description = "Minimum amount of ticks before the player can be scouted again. (1 tick = 600ms)", - position = 9 - ) - default int timeout() - { - return 500; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poh/BurnerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/poh/BurnerOverlay.java deleted file mode 100644 index 45d38e4e8c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/poh/BurnerOverlay.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.poh; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.time.Duration; -import java.time.Instant; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -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.components.ProgressPieComponent; - -@Singleton -class BurnerOverlay extends Overlay -{ - private final Client client; - private final PohPlugin plugin; - - @Inject - private BurnerOverlay(final Client client, final PohPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isShowBurner()) - { - return null; - } - - plugin.getIncenseBurners().forEach((tile, burner) -> - { - if (tile.getPlane() != client.getPlane()) - { - return; - } - - if (!PohPlugin.BURNER_LIT.contains(burner.getId())) - { - return; - } - - final Instant now = Instant.now(); - final long startCountdown = Duration.between(burner.getStart(), now).getSeconds(); - final double certainSec = burner.getCountdownTimer() - startCountdown; - - long endCountdown = 0; - - if (certainSec <= 0) - { - if (burner.getEnd() == null) - { - burner.setEnd(Instant.now()); - } - - endCountdown = Duration.between(burner.getEnd(), now).getSeconds(); - } - - final double randomSec = burner.getRandomTimer() - endCountdown; - final ProgressPieComponent pieComponent = new ProgressPieComponent(); - final Point loc = Perspective.localToCanvas(client, tile.getLocalLocation(), tile.getPlane()); - - if (loc == null) - { - return; - } - - pieComponent.setPosition(loc); - - if (certainSec > 0) - { - pieComponent.setProgress(certainSec / burner.getCountdownTimer()); - pieComponent.setFill(Color.GREEN); - pieComponent.setBorderColor(Color.GREEN); - pieComponent.render(graphics); - } - else if (randomSec > 0) - { - pieComponent.setProgress(randomSec / burner.getRandomTimer()); - pieComponent.setFill(Color.ORANGE); - pieComponent.setBorderColor(Color.ORANGE); - pieComponent.render(graphics); - } - }); - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poh/IncenseBurner.java b/runelite-client/src/main/java/net/runelite/client/plugins/poh/IncenseBurner.java deleted file mode 100644 index 3d6acd175b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/poh/IncenseBurner.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.poh; - -import java.time.Instant; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; - -@Getter(AccessLevel.PACKAGE) -@Setter(AccessLevel.PACKAGE) -@RequiredArgsConstructor -@AllArgsConstructor -class IncenseBurner -{ - private final Instant start = Instant.now(); - private final int id; - private double countdownTimer; - private double randomTimer; - private Instant end; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohConfig.java deleted file mode 100644 index 9496352800..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohConfig.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.poh; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("poh") -public interface PohConfig extends Config -{ - @ConfigItem( - keyName = "showPortals", - name = "Show Portals", - description = "Configures whether to display teleport portals" - ) - default boolean showPortals() - { - return true; - } - - @ConfigItem( - keyName = "showAltar", - name = "Show Altar", - description = "Configures whether or not the altar is displayed" - ) - default boolean showAltar() - { - return true; - } - - @ConfigItem( - keyName = "showGlory", - name = "Show Glory mount", - description = "Configures whether or not the mounted glory is displayed" - ) - default boolean showGlory() - { - return true; - } - - @ConfigItem( - keyName = "showPools", - name = "Show Pools", - description = "Configures whether or not the pools are displayed" - ) - default boolean showPools() - { - return true; - } - - @ConfigItem( - keyName = "showRepairStand", - name = "Show Repair stand", - description = "Configures whether or not the repair stand is displayed" - ) - default boolean showRepairStand() - { - return true; - } - - @ConfigItem( - keyName = "showExitPortal", - name = "Show Exit portal", - description = "Configures whether or not the exit portal is displayed" - ) - default boolean showExitPortal() - { - return true; - } - - @ConfigItem( - keyName = "showBurner", - name = "Show Incense Burner timers", - description = "Configures whether or not unlit/lit burners are displayed" - ) - default boolean showBurner() - { - return true; - } - - @ConfigItem( - keyName = "showSpellbook", - name = "Show Spellbook altar", - description = "Configures whether or not the Spellbook altar is displayed" - ) - default boolean showSpellbook() - { - return true; - } - - @ConfigItem( - keyName = "showJewelleryBox", - name = "Show Jewellery Box", - description = "Configures whether or not the jewellery box is displayed" - ) - default boolean showJewelleryBox() - { - return true; - } - - @ConfigItem( - keyName = "showMagicTravel", - name = "Show Fairy/ Spirit Tree/ Obelisk", - description = "Configures whether or not the Fairy ring, Spirit tree or Obelisk is displayed" - ) - default boolean showMagicTravel() - { - return true; - } - - @ConfigItem( - keyName = "showPortalNexus", - name = "Show Portal Nexus", - description = "Configures whether or not the Portal Nexus is displayed" - ) - default boolean showPortalNexus() - { - return true; - } - - @ConfigItem( - keyName = "showDigsitePendant", - name = "Show Digsite Pendant", - description = "Configures whether or not the Digsite Pendant is displayed" - ) - default boolean showDigsitePendant() - { - return true; - } - - @ConfigItem( - keyName = "showXericsTalisman", - name = "Show Xeric's Talisman", - description = "Configures whether or not the Xeric's Talisman is displayed" - ) - default boolean showXericsTalisman() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohIcons.java b/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohIcons.java deleted file mode 100644 index 795a3ecaf4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohIcons.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.poh; - -import com.google.common.collect.ImmutableMap; -import java.awt.image.BufferedImage; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import static net.runelite.api.NullObjectID.*; -import static net.runelite.api.ObjectID.*; -import net.runelite.client.util.ImageUtil; - -public enum PohIcons -{ - EXITPORTAL("exitportal", PORTAL_4525), - VARROCK("varrock", NULL_13615, NULL_13622, NULL_13629), - FALADOR("falador", FALADOR_PORTAL, FALADOR_PORTAL_13624, FALADOR_PORTAL_13631), - LUMBRIDGE("lumbridge", LUMBRIDGE_PORTAL, LUMBRIDGE_PORTAL_13623, LUMBRIDGE_PORTAL_13630), - ARDOUGNE("ardougne", ARDOUGNE_PORTAL, ARDOUGNE_PORTAL_13626, ARDOUGNE_PORTAL_13633), - YANILLE("yanille", NULL_13620, NULL_13627, NULL_13634), - CAMELOT("camelot", NULL_13618, NULL_13625, NULL_13632), - LUNARISLE("lunarisle", LUNAR_ISLE_PORTAL, LUNAR_ISLE_PORTAL_29347, LUNAR_ISLE_PORTAL_29355), - WATERBIRTH("waterbirth", WATERBIRTH_ISLAND_PORTAL, WATERBIRTH_ISLAND_PORTAL_29350, WATERBIRTH_ISLAND_PORTAL_29358), - FISHINGGUILD("fishingguild", FISHING_GUILD_PORTAL, FISHING_GUILD_PORTAL_29351, FISHING_GUILD_PORTAL_29359), - SENNTISTEN("senntisten", SENNTISTEN_PORTAL, SENNTISTEN_PORTAL_29348, SENNTISTEN_PORTAL_29356), - KHARYLL("kharyll", KHARYRLL_PORTAL, KHARYRLL_PORTAL_29346, KHARYRLL_PORTAL_29354), - ANNAKARL("annakarl", ANNAKARL_PORTAL, ANNAKARL_PORTAL_29349, ANNAKARL_PORTAL_29357), - KOUREND("kourend", KOUREND_PORTAL, KOUREND_PORTAL_29353, KOUREND_PORTAL_29361), - MARIM("marim", MARIM_PORTAL, MARIM_PORTAL_29352, MARIM_PORTAL_29360), - TROLLSTRONGHOLD("trollheim", TROLL_STRONGHOLD_PORTAL, TROLL_STRONGHOLD_PORTAL_33180, TROLL_STRONGHOLD_PORTAL_33181), - GHORROCK("ghorrock", GHORROCK_PORTAL, GHORROCK_PORTAL_33436, GHORROCK_PORTAL_33439), - CARRALLANGAR("carrallangar", CARRALLANGAR_PORTAL, CARRALLANGAR_PORTAL_33437, CARRALLANGAR_PORTAL_33440), - CATHERBY("catherby", CATHERBY_PORTAL, CATHERBY_PORTAL_33435, CATHERBY_PORTAL_33438), - ALTAR("altar", - ALTAR_13179, ALTAR_13180, ALTAR_13181, ALTAR_13182, ALTAR_13183, ALTAR_13184, ALTAR_13185, ALTAR_13186, - ALTAR_13187, ALTAR_13188, ALTAR_13189, ALTAR_13190, ALTAR_13191, ALTAR_13192, ALTAR_13193, ALTAR_13194, - ALTAR_13196, ALTAR_13197, ALTAR_13198, ALTAR_13199 - ), - POOLS("pool", POOL_OF_RESTORATION, POOL_OF_REVITALISATION, POOL_OF_REJUVENATION, FANCY_REJUVENATION_POOL, ORNATE_REJUVENATION_POOL), - GLORY("glory", AMULET_OF_GLORY), - REPAIR("repair", ARMOUR_REPAIR_STAND), - SPELLBOOKALTAR("spellbook", ANCIENT_ALTAR, LUNAR_ALTAR, DARK_ALTAR, ALTAR_OF_THE_OCCULT), - JEWELLERYBOX("jewellery", NULL_29154, NULL_29155, NULL_29156), - MAGICTRAVEL("transportation", SPIRIT_TREE_29227, NULL_29228, NULL_29229, OBELISK_31554), - PORTALNEXUS("portalnexus", - PORTAL_NEXUS, PORTAL_NEXUS_33355, PORTAL_NEXUS_33356, PORTAL_NEXUS_33357, PORTAL_NEXUS_33358, PORTAL_NEXUS_33359, PORTAL_NEXUS_33360, - PORTAL_NEXUS_33361, PORTAL_NEXUS_33362, PORTAL_NEXUS_33363, PORTAL_NEXUS_33364, PORTAL_NEXUS_33365, PORTAL_NEXUS_33366, PORTAL_NEXUS_33367, - PORTAL_NEXUS_33368, PORTAL_NEXUS_33369, PORTAL_NEXUS_33370, PORTAL_NEXUS_33371, PORTAL_NEXUS_33372, PORTAL_NEXUS_33373, PORTAL_NEXUS_33374, - PORTAL_NEXUS_33375, PORTAL_NEXUS_33376, PORTAL_NEXUS_33377, PORTAL_NEXUS_33378, PORTAL_NEXUS_33379, PORTAL_NEXUS_33380, PORTAL_NEXUS_33381, - PORTAL_NEXUS_33382, PORTAL_NEXUS_33383, PORTAL_NEXUS_33384, PORTAL_NEXUS_33385, PORTAL_NEXUS_33386, PORTAL_NEXUS_33387, PORTAL_NEXUS_33388, - PORTAL_NEXUS_33389, PORTAL_NEXUS_33390, PORTAL_NEXUS_33391, PORTAL_NEXUS_33392, PORTAL_NEXUS_33393, PORTAL_NEXUS_33394, PORTAL_NEXUS_33395, - PORTAL_NEXUS_33396, PORTAL_NEXUS_33397, PORTAL_NEXUS_33398, PORTAL_NEXUS_33399, PORTAL_NEXUS_33400, PORTAL_NEXUS_33401, PORTAL_NEXUS_33402, - PORTAL_NEXUS_33403, PORTAL_NEXUS_33404, PORTAL_NEXUS_33405, PORTAL_NEXUS_33406, PORTAL_NEXUS_33407, PORTAL_NEXUS_33408, PORTAL_NEXUS_33409, - PORTAL_NEXUS_33410, PORTAL_NEXUS_33423, PORTAL_NEXUS_33424, PORTAL_NEXUS_33425, PORTAL_NEXUS_33426, PORTAL_NEXUS_33427, PORTAL_NEXUS_33428, - PORTAL_NEXUS_33429, PORTAL_NEXUS_33430, PORTAL_NEXUS_33431, PORTAL_NEXUS_37547, PORTAL_NEXUS_37548, PORTAL_NEXUS_37549, PORTAL_NEXUS_37550, - PORTAL_NEXUS_37551, PORTAL_NEXUS_37552, PORTAL_NEXUS_37553, PORTAL_NEXUS_37554, PORTAL_NEXUS_37555, PORTAL_NEXUS_37556, PORTAL_NEXUS_37557, - PORTAL_NEXUS_37558, PORTAL_NEXUS_37559, PORTAL_NEXUS_37560, PORTAL_NEXUS_37561, PORTAL_NEXUS_37562, PORTAL_NEXUS_37563, PORTAL_NEXUS_37564, - PORTAL_NEXUS_37565, PORTAL_NEXUS_37566, PORTAL_NEXUS_37567, PORTAL_NEXUS_37568, PORTAL_NEXUS_37569, PORTAL_NEXUS_37570, PORTAL_NEXUS_37571, - PORTAL_NEXUS_37572, PORTAL_NEXUS_37573, PORTAL_NEXUS_37574, PORTAL_NEXUS_37575, PORTAL_NEXUS_37576, PORTAL_NEXUS_37577, PORTAL_NEXUS_37578, - PORTAL_NEXUS_37579, PORTAL_NEXUS_37580 - ), - XERICSTALISMAN("xericstalisman", - XERICS_TALISMAN, XERICS_TALISMAN_33412, XERICS_TALISMAN_33413, XERICS_TALISMAN_33414, XERICS_TALISMAN_33415, XERICS_TALISMAN_33419 - ), - DIGSITEPENDANT("digsitependant", - DIGSITE_PENDANT, DIGSITE_PENDANT_33417, DIGSITE_PENDANT_33418, DIGSITE_PENDANT_33420 - ); - - private static final Map minimapIcons; - - @Getter(AccessLevel.PACKAGE) - private final String imageResource; - @Getter(AccessLevel.PACKAGE) - private final int[] Ids; - - private BufferedImage image; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (PohIcons icon : values()) - { - for (Integer spotId : icon.getIds()) - { - builder.put(spotId, icon); - } - } - - minimapIcons = builder.build(); - } - - PohIcons(String imageResource, int... ids) - { - this.imageResource = imageResource; - this.Ids = ids; - } - - public static PohIcons getIcon(int id) - { - return minimapIcons.get(id); - } - - public BufferedImage getImage() - { - if (image != null) - { - return image; - } - - image = ImageUtil.getResourceStreamFromClass(getClass(), getImageResource() + ".png"); - - return image; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohOverlay.java deleted file mode 100644 index 6ecb5392a4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohOverlay.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.poh; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -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; - -@Singleton -public class PohOverlay extends Overlay -{ - private static final PohIcons[] PORTALS = new PohIcons[] - { - PohIcons.LUMBRIDGE, PohIcons.FALADOR, PohIcons.VARROCK, PohIcons.CAMELOT, PohIcons.ARDOUGNE, - PohIcons.YANILLE, PohIcons.LUNARISLE, PohIcons.WATERBIRTH, PohIcons.FISHINGGUILD, - PohIcons.SENNTISTEN, PohIcons.KHARYLL, PohIcons.ANNAKARL, PohIcons.KOUREND, PohIcons.MARIM, PohIcons.TROLLSTRONGHOLD, PohIcons.CARRALLANGAR, PohIcons.CATHERBY, PohIcons.GHORROCK - - }; - - private static final int MAX_DISTANCE = 2350; - - @Getter(AccessLevel.PACKAGE) - private final List iconList = new ArrayList<>(); - - private final Client client; - private final PohPlugin plugin; - - @Inject - public PohOverlay(final Client client, final PohPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - LocalPoint localLocation = client.getLocalPlayer().getLocalLocation(); - plugin.getPohObjects().forEach((object, tile) -> - { - LocalPoint location = object.getLocalLocation(); - if (tile.getPlane() == client.getPlane() && localLocation.distanceTo(location) <= MAX_DISTANCE) - { - PohIcons icon = PohIcons.getIcon(object.getId()); - - if (icon != null && iconList.contains(icon)) - { - net.runelite.api.Point minimapLoc = Perspective.getMiniMapImageLocation(client, object.getLocalLocation(), icon.getImage()); - - if (minimapLoc != null) - { - graphics.drawImage(icon.getImage(), minimapLoc.getX(), minimapLoc.getY(), null); - } - } - } - }); - - return null; - } - - public void updateConfig() - { - iconList.clear(); - if (plugin.isShowPortals()) - { - Collections.addAll(iconList, PORTALS); - } - if (plugin.isShowAltar()) - { - iconList.add(PohIcons.ALTAR); - } - if (plugin.isShowGlory()) - { - iconList.add(PohIcons.GLORY); - } - if (plugin.isShowRepairStand()) - { - iconList.add(PohIcons.REPAIR); - } - if (plugin.isShowPools()) - { - iconList.add(PohIcons.POOLS); - } - if (plugin.isShowExitPortal()) - { - iconList.add(PohIcons.EXITPORTAL); - } - if (plugin.isShowSpellbook()) - { - iconList.add(PohIcons.SPELLBOOKALTAR); - } - if (plugin.isShowJewelleryBox()) - { - iconList.add(PohIcons.JEWELLERYBOX); - } - if (plugin.isShowMagicTravel()) - { - iconList.add(PohIcons.MAGICTRAVEL); - } - if (plugin.isShowPortalNexus()) - { - iconList.add(PohIcons.PORTALNEXUS); - } - if (plugin.isShowDigsitePendant()) - { - iconList.add(PohIcons.DIGSITEPENDANT); - } - if (plugin.isShowXericsTalisman()) - { - iconList.add(PohIcons.XERICSTALISMAN); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohPlugin.java deleted file mode 100644 index 74c84e866f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohPlugin.java +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.poh; - -import com.google.common.collect.Sets; -import com.google.inject.Provides; -import java.io.IOException; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ScheduledExecutorService; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -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.Constants; -import net.runelite.api.DecorativeObject; -import net.runelite.api.GameObject; -import net.runelite.api.GameState; -import net.runelite.api.ObjectID; -import net.runelite.api.Player; -import net.runelite.api.Tile; -import net.runelite.api.TileObject; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.events.AnimationChanged; -import net.runelite.api.events.DecorativeObjectDespawned; -import net.runelite.api.events.DecorativeObjectSpawned; -import net.runelite.api.events.GameObjectDespawned; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GameStateChanged; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.HiscoreManager; -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.http.api.hiscore.HiscoreEndpoint; -import net.runelite.http.api.hiscore.HiscoreResult; -import net.runelite.http.api.hiscore.Skill; - -@PluginDescriptor( - name = "Player-owned House", - description = "Show minimap icons and mark unlit/lit burners", - tags = {"construction", "poh", "minimap", "overlay"}, - type = PluginType.UTILITY -) -@Slf4j -@Singleton -public class PohPlugin extends Plugin -{ - static final Set BURNER_UNLIT = Sets.newHashSet(ObjectID.INCENSE_BURNER, ObjectID.INCENSE_BURNER_13210, ObjectID.INCENSE_BURNER_13212); - static final Set BURNER_LIT = Sets.newHashSet(ObjectID.INCENSE_BURNER_13209, ObjectID.INCENSE_BURNER_13211, ObjectID.INCENSE_BURNER_13213); - - @Getter(AccessLevel.PACKAGE) - private final Map pohObjects = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private final Map incenseBurners = new HashMap<>(); - - @Inject - private OverlayManager overlayManager; - - @Inject - private PohOverlay overlay; - - @Inject - private PohConfig config; - - @Inject - private Client client; - - @Inject - private ScheduledExecutorService executor; - - @Inject - private HiscoreManager hiscoreManager; - - @Inject - private BurnerOverlay burnerOverlay; - - @Getter(AccessLevel.PACKAGE) - private boolean showPortals; - @Getter(AccessLevel.PACKAGE) - private boolean showAltar; - @Getter(AccessLevel.PACKAGE) - private boolean showGlory; - @Getter(AccessLevel.PACKAGE) - private boolean showPools; - @Getter(AccessLevel.PACKAGE) - private boolean showRepairStand; - @Getter(AccessLevel.PACKAGE) - private boolean showExitPortal; - @Getter(AccessLevel.PACKAGE) - private boolean showBurner; - @Getter(AccessLevel.PACKAGE) - private boolean showSpellbook; - @Getter(AccessLevel.PACKAGE) - private boolean showJewelleryBox; - @Getter(AccessLevel.PACKAGE) - private boolean showMagicTravel; - @Getter(AccessLevel.PACKAGE) - private boolean showPortalNexus; - @Getter(AccessLevel.PACKAGE) - private boolean showDigsitePendant; - @Getter(AccessLevel.PACKAGE) - private boolean showXericsTalisman; - - @Provides - PohConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(PohConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - overlayManager.add(burnerOverlay); - overlay.updateConfig(); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - overlayManager.remove(burnerOverlay); - pohObjects.clear(); - incenseBurners.clear(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("poh")) - { - return; - } - - updateConfig(); - - overlay.updateConfig(); - } - - @Subscribe - private void onGameObjectSpawned(GameObjectSpawned event) - { - final GameObject gameObject = event.getGameObject(); - - if (!BURNER_LIT.contains(gameObject.getId()) && !BURNER_UNLIT.contains(gameObject.getId())) - { - if (PohIcons.getIcon(gameObject.getId()) != null) - { - pohObjects.put(gameObject, event.getTile()); - } - - return; - } - - final double countdownTimer = 130.0; // Minimum amount of seconds a burner will light - final double randomTimer = 30.0; // Minimum amount of seconds a burner will light - incenseBurners.put(event.getTile(), new IncenseBurner(gameObject.getId(), countdownTimer, randomTimer, null)); - } - - @Subscribe - private void onGameObjectDespawned(GameObjectDespawned event) - { - GameObject gameObject = event.getGameObject(); - pohObjects.remove(gameObject); - } - - @Subscribe - private void onDecorativeObjectSpawned(DecorativeObjectSpawned event) - { - DecorativeObject decorativeObject = event.getDecorativeObject(); - if (PohIcons.getIcon(decorativeObject.getId()) != null) - { - pohObjects.put(decorativeObject, event.getTile()); - } - } - - @Subscribe - private void onDecorativeObjectDespawned(DecorativeObjectDespawned event) - { - DecorativeObject decorativeObject = event.getDecorativeObject(); - pohObjects.remove(decorativeObject); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOADING) - { - pohObjects.clear(); - incenseBurners.clear(); - } - } - - @Subscribe - private void onAnimationChanged(AnimationChanged event) - { - final Actor actor = event.getActor(); - final String actorName = actor.getName(); - - if (!(actor instanceof Player) || actor.getAnimation() != AnimationID.INCENSE_BURNER) - { - return; - } - - final LocalPoint loc = actor.getLocalLocation(); - - // Find burner closest to player - incenseBurners.keySet() - .stream() - .min(Comparator.comparingInt(a -> loc.distanceTo(a.getLocalLocation()))) - .ifPresent(tile -> - { - final IncenseBurner incenseBurner = incenseBurners.get(tile); - - if (actor == client.getLocalPlayer()) - { - int level = client.getRealSkillLevel(net.runelite.api.Skill.FIREMAKING); - updateBurner(incenseBurner, level); - } - else if (actorName != null) - { - lookupPlayer(actorName, incenseBurner); - } - }); - - } - - private void lookupPlayer(String playerName, IncenseBurner incenseBurner) - { - executor.execute(() -> - { - try - { - final HiscoreResult playerStats = hiscoreManager.lookup(playerName, HiscoreEndpoint.NORMAL); - - if (playerStats == null) - { - return; - } - - final Skill fm = playerStats.getFiremaking(); - final int level = fm.getLevel(); - updateBurner(incenseBurner, Math.max(level, 1)); - } - catch (IOException e) - { - log.warn("Error fetching Hiscore data " + e.getMessage()); - } - }); - } - - private static void updateBurner(IncenseBurner incenseBurner, int fmLevel) - { - final double tickLengthSeconds = Constants.GAME_TICK_LENGTH / 1000.0; - incenseBurner.setCountdownTimer((200 + fmLevel) * tickLengthSeconds); - incenseBurner.setRandomTimer(fmLevel * tickLengthSeconds); - } - - private void updateConfig() - { - this.showPortals = config.showPortals(); - this.showAltar = config.showAltar(); - this.showGlory = config.showGlory(); - this.showPools = config.showPools(); - this.showRepairStand = config.showRepairStand(); - this.showExitPortal = config.showExitPortal(); - this.showBurner = config.showBurner(); - this.showSpellbook = config.showSpellbook(); - this.showJewelleryBox = config.showJewelleryBox(); - this.showMagicTravel = config.showMagicTravel(); - this.showPortalNexus = config.showPortalNexus(); - this.showDigsitePendant = config.showDigsitePendant(); - this.showXericsTalisman = config.showXericsTalisman(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poison/ActorPoisonInfo.java b/runelite-client/src/main/java/net/runelite/client/plugins/poison/ActorPoisonInfo.java deleted file mode 100644 index dcd54b3a60..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/poison/ActorPoisonInfo.java +++ /dev/null @@ -1,31 +0,0 @@ -package net.runelite.client.plugins.poison; - -import lombok.Data; - -@Data -class ActorPoisonInfo -{ - /** - * Plain and simple, the last poison damage this actor received - */ - private int lastDamage; - - /** - * What the poison varp for this actor would be. -1 if unknown - * This should always be known if the actor is venomed - */ - private int accurateDamage; - - /** - * How many ticks after the tickcount is divisible by 30 the poison will hit. - *

- * For instance, if something gets hit by poison on tick 607 this will be 7, as 607 % 30 == 7. - * With this info you know all the times to expect a poison hit - */ - private int cycle; - - /** - * This is to be able to remove the overlay if someone doesn't get hit - */ - private int lastDamageTick; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonActorOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonActorOverlay.java deleted file mode 100644 index ebb5af7d26..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonActorOverlay.java +++ /dev/null @@ -1,156 +0,0 @@ -package net.runelite.client.plugins.poison; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Actor; -import net.runelite.api.Client; -import net.runelite.api.Constants; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.SpriteID; -import net.runelite.api.coords.LocalPoint; -import static net.runelite.client.plugins.poison.PoisonPlugin.POISON_TICK_TICKS; -import static net.runelite.client.plugins.poison.PoisonPlugin.VENOM_THRESHOLD; -import static net.runelite.client.plugins.poison.PoisonPlugin.nextDamage; -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; - -@Singleton -public class PoisonActorOverlay extends Overlay -{ - private final PoisonPlugin plugin; - private final Client client; - private boolean displayTicks; - private int fontSize; - private Font font; - - @Inject - PoisonActorOverlay(final PoisonPlugin plugin, final Client client) - { - this.plugin = plugin; - this.client = client; - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D g) - { - final Map actors = plugin.getPoisonedActors(); - - if (actors.isEmpty()) - { - return null; - } - - final int tickCount = client.getTickCount(); - final int modTickCount = tickCount % 30; - - if (font == null) - { - font = g.getFont().deriveFont(fontSize * 2.0f); - } - - g.setFont(font); - - for (Map.Entry entry : actors.entrySet()) - { - Actor a = entry.getKey(); - - if (a == null) - { - continue; - } - - ActorPoisonInfo i = entry.getValue(); - - int accurateDamage = i.getAccurateDamage(); - int damage; - - if (accurateDamage != -1) - { - damage = nextDamage(accurateDamage); - } - else - { - damage = i.getLastDamage(); - } - - boolean venomed = accurateDamage >= VENOM_THRESHOLD; - - String timeLeft = getTimeLeft(modTickCount, i.getCycle()); - - renderOverlayFor(g, a, damage, timeLeft, venomed); - } - - return null; - } - - private String getTimeLeft(int tickCount, int cycle) - { - if (tickCount > cycle) - { - cycle += POISON_TICK_TICKS; - } - - int timeLeft = (cycle - tickCount); - - if (!displayTicks) - { - timeLeft = timeLeft * Constants.GAME_TICK_LENGTH / 1000; - } - - return String.valueOf(timeLeft); - } - - private void renderOverlayFor(Graphics2D g, Actor actor, int damage, String timeLeft, boolean venomed) - { - BufferedImage splat = plugin.getSplat(venomed ? SpriteID.HITSPLAT_DARK_GREEN_VENOM : SpriteID.HITSPLAT_GREEN_POISON, damage); - - LocalPoint localLocation = actor.getLocalLocation(); - if (localLocation == null) - { - return; - } - - Point overlayLocation = Perspective.getCanvasImageLocation(client, localLocation, splat, 0); - - if (overlayLocation == null) - { - return; - } - - int textOffset = splat.getHeight() - (splat.getHeight() - fontSize) / 2; - - Point textLocation = new Point(overlayLocation.getX() + splat.getWidth() + 3, overlayLocation.getY() + textOffset); - - g.drawImage(splat, overlayLocation.getX(), overlayLocation.getY(), null); - OverlayUtil.renderTextLocation(g, textLocation, timeLeft, Color.WHITE); - } - - void setFontSize(int size) - { - if (font != null) - { - fontSize = size; - font = font.deriveFont(fontSize * 2.0f); - } - else - { - fontSize = size; - } - } - - void setDisplayTicks(boolean displayTicks) - { - this.displayTicks = displayTicks; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonConfig.java deleted file mode 100644 index a694bf0ce7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonConfig.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2018 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.poison; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup(PoisonConfig.GROUP) -public interface PoisonConfig extends Config -{ - String GROUP = "poison"; - - @ConfigItem( - keyName = "showInfoboxes", - name = "Show Infoboxes", - description = "Configures whether to show the infoboxes" - ) - default boolean showInfoboxes() - { - return false; - } - - @ConfigItem( - keyName = "changeHealthIcon", - name = "Change HP Orb Icon", - description = "Configures whether the hp orb icon should change color to match poison/disease" - ) - default boolean changeHealthIcon() - { - return true; - } - - @ConfigItem( - keyName = "showPlayers", - name = "Show for players", - description = "Show poison timers for other players", - position = 1 - ) - default boolean showForPlayers() - { - return false; - } - - @ConfigItem( - keyName = "showNpcs", - name = "Show for NPCs", - description = "Show poison timers for NPCs", - position = 2 - ) - default boolean showForNpcs() - { - return false; - } - - @ConfigItem( - keyName = "fontsize", - name = "Font size", - description = "The size the time left text for other players/npc's will be", - position = 3 - ) - default int fontSize() - { - return 8; - } - - @ConfigItem( - keyName = "ticks", - name = "Gametick timers", - description = "Use gameticks instead of seconds for timers", - position = 4 - ) - default boolean ticks() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonInfobox.java b/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonInfobox.java deleted file mode 100644 index 0810be80a9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonInfobox.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2018 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.poison; - -import java.awt.Color; -import java.awt.image.BufferedImage; -import java.time.Duration; -import java.time.Instant; -import java.time.temporal.ChronoUnit; -import net.runelite.client.ui.overlay.infobox.Timer; - -class PoisonInfobox extends Timer -{ - private final PoisonPlugin plugin; - - PoisonInfobox(final int duration, final BufferedImage image, final PoisonPlugin plugin) - { - super(duration, ChronoUnit.MILLIS, image, plugin); - this.plugin = plugin; - } - - @Override - public String getTooltip() - { - return plugin.createTooltip(); - } - - @Override - public Color getTextColor() - { - return Color.RED.brighter(); - } - - @Override - public String getText() - { - Duration timeLeft = Duration.between(Instant.now(), getEndTime()); - - if (!timeLeft.isNegative()) - { - return super.getText(); - } - return " "; - } - - @Override - public boolean render() - { - return true; - } - - @Override - public boolean cull() - { - return false; - } -} - diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonOverlay.java deleted file mode 100644 index e709e4473a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonOverlay.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2018 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.poison; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Point; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -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.tooltip.Tooltip; -import net.runelite.client.ui.overlay.tooltip.TooltipManager; - -@Singleton -class PoisonOverlay extends Overlay -{ - private final PoisonPlugin plugin; - private final Client client; - private final TooltipManager tooltipManager; - - @Inject - private PoisonOverlay(final PoisonPlugin plugin, final Client client, final TooltipManager tooltipManager) - { - this.plugin = plugin; - this.client = client; - this.tooltipManager = tooltipManager; - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.getLastDamage() <= 0) - { - return null; - } - - final Widget healthOrb = client.getWidget(WidgetInfo.MINIMAP_HEALTH_ORB); - - if (healthOrb == null || healthOrb.isHidden()) - { - return null; - } - - final Rectangle bounds = healthOrb.getBounds(); - - if (bounds.getX() <= 0) - { - return null; - } - - final Point mousePosition = client.getMouseCanvasPosition(); - - if (bounds.contains(mousePosition.getX(), mousePosition.getY())) - { - tooltipManager.add(new Tooltip(plugin.createTooltip())); - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonPlugin.java deleted file mode 100644 index 4208a3575f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/poison/PoisonPlugin.java +++ /dev/null @@ -1,523 +0,0 @@ -/* - * Copyright (c) 2018 Hydrox6 - * Copyright (c) 2019, Lucas - * 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.poison; - -import com.google.inject.Provides; -import java.awt.Color; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.image.BufferedImage; -import java.text.MessageFormat; -import java.time.Duration; -import java.time.Instant; -import java.time.temporal.ChronoUnit; -import java.util.HashMap; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.Getter; -import net.runelite.api.Actor; -import net.runelite.api.Client; -import static net.runelite.api.Constants.GAME_TICK_LENGTH; -import net.runelite.api.GameState; -import net.runelite.api.Hitsplat; -import net.runelite.api.NPC; -import net.runelite.api.Player; -import net.runelite.api.SpriteID; -import net.runelite.api.VarPlayer; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.HitsplatApplied; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.PlayerDespawned; -import net.runelite.api.events.VarbitChanged; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; -import net.runelite.client.util.ColorUtil; -import net.runelite.client.util.ImageUtil; - -@PluginDescriptor( - name = "Poison", - description = "Tracks current damage values for Poison and Venom", - tags = {"combat", "poison", "venom", "heart", "hp"}, - type = PluginType.UTILITY -) -@Singleton -public class PoisonPlugin extends Plugin -{ - static final int POISON_TICK_TICKS = 30; - static final int VENOM_THRESHOLD = 1000000; - private static final int VENOM_UTILITY = 999997; - private static final int VENOM_MAXIMUM_DAMAGE = 20; - private static final int POISON_TICK_MILLIS = POISON_TICK_TICKS * GAME_TICK_LENGTH; - - private static final BufferedImage HEART_DISEASE; - private static final BufferedImage HEART_POISON; - private static final BufferedImage HEART_VENOM; - - static - { - HEART_DISEASE = ImageUtil.resizeCanvas(ImageUtil.getResourceStreamFromClass(PoisonPlugin.class, "1067-DISEASE.png"), 26, 26); - HEART_POISON = ImageUtil.resizeCanvas(ImageUtil.getResourceStreamFromClass(PoisonPlugin.class, "1067-POISON.png"), 26, 26); - HEART_VENOM = ImageUtil.resizeCanvas(ImageUtil.getResourceStreamFromClass(PoisonPlugin.class, "1067-VENOM.png"), 26, 26); - } - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private PoisonOverlay poisonOverlay; - - @Inject - private OverlayManager overlayManager; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private SpriteManager spriteManager; - - @Inject - private PoisonConfig config; - - @Inject - private PoisonActorOverlay actorOverlay; - - @Getter - private int lastDamage; - - private boolean envenomed; - private PoisonInfobox infobox; - private Instant nextPoisonTick; - private int lastValue = 0; - private int lastDiseaseValue = 0; - private BufferedImage heart; - private int nextTickCount; - - @Getter - private Map poisonedActors = new HashMap<>(); - - private boolean showInfoboxes; - private boolean changeHealthIcon; - private boolean showForPlayers; - private boolean showForNpcs; - private int fontSize; - - @Provides - PoisonConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(PoisonConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - actorOverlay.setFontSize(this.fontSize); - overlayManager.add(poisonOverlay); - - if (this.showForNpcs || this.showForPlayers) - { - overlayManager.add(actorOverlay); - } - - if (client.getGameState() == GameState.LOGGED_IN) - { - clientThread.invoke(this::checkHealthIcon); - } - } - - @Override - protected void shutDown() - { - overlayManager.remove(poisonOverlay); - - if (infobox != null) - { - infoBoxManager.removeInfoBox(infobox); - infobox = null; - } - - envenomed = false; - lastDamage = 0; - nextPoisonTick = null; - lastValue = 0; - lastDiseaseValue = 0; - overlayManager.remove(actorOverlay); - - clientThread.invoke(this::resetHealthIcon); - } - - @Subscribe - private void onVarbitChanged(VarbitChanged event) - { - final int poisonValue = client.getVar(VarPlayer.POISON); - if (poisonValue != lastValue) - { - envenomed = poisonValue >= VENOM_THRESHOLD; - - if (nextTickCount - client.getTickCount() <= 30 || lastValue == 0) - { - nextPoisonTick = Instant.now().plus(Duration.of(POISON_TICK_MILLIS, ChronoUnit.MILLIS)); - nextTickCount = client.getTickCount() + 30; - } - - lastValue = poisonValue; - final int damage = nextDamage(poisonValue); - this.lastDamage = damage; - - if (this.showInfoboxes) - { - if (infobox != null) - { - infoBoxManager.removeInfoBox(infobox); - infobox = null; - } - - if (damage > 0) - { - final BufferedImage image = getSplat(envenomed ? SpriteID.HITSPLAT_DARK_GREEN_VENOM : SpriteID.HITSPLAT_GREEN_POISON, damage); - - if (image != null) - { - int duration = 600 * (nextTickCount - client.getTickCount()); - infobox = new PoisonInfobox(duration, image, this); - infoBoxManager.addInfoBox(infobox); - } - } - } - checkHealthIcon(); - } - - final int diseaseValue = client.getVar(VarPlayer.DISEASE_VALUE); - if (diseaseValue != lastDiseaseValue) - { - lastDiseaseValue = diseaseValue; - checkHealthIcon(); - } - } - - @Subscribe - private void onHitsplatApplied(HitsplatApplied event) - { - Hitsplat.HitsplatType type = event.getHitsplat().getHitsplatType(); - - if (type != Hitsplat.HitsplatType.POISON && type != Hitsplat.HitsplatType.VENOM) - { - return; - } - - Actor actor = event.getActor(); - - if (actor == client.getLocalPlayer() || - actor instanceof NPC && !this.showForNpcs || - actor instanceof Player && !this.showForPlayers) - { - return; - } - - int tickCount = client.getTickCount(); - int damage = event.getHitsplat().getAmount(); - - ActorPoisonInfo info = poisonedActors.get(actor); - - if (info == null) - { - info = new ActorPoisonInfo(); - info.setAccurateDamage(-1); - info.setLastDamage(damage); - - poisonedActors.put(actor, info); - } - - if (info.getAccurateDamage() != -1) - { - int accurateDamage = info.getAccurateDamage(); - accurateDamage -= 1; - - if (accurateDamage == 0) - { - poisonedActors.remove(actor); - return; - } - - info.setAccurateDamage(accurateDamage); - } - - if (type == Hitsplat.HitsplatType.VENOM) - { - info.setAccurateDamage(damage / 2 + VENOM_UTILITY + 1); - } - else if (info.getLastDamage() != damage) - { - // The damage changed so we know the accurate value! - // This may of course not be 100% accurate - // (if someone gets repoisoned for instance) - info.setAccurateDamage(damage * 5 - 1); - - info.setLastDamage(damage); - } - - info.setCycle(tickCount % POISON_TICK_TICKS); - info.setLastDamageTick(tickCount); - } - - @Subscribe - private void onGameTick(GameTick event) - { - int tickCount = client.getTickCount(); - - // Remove the actor if the last damage tick was over 35 ticks ago. - poisonedActors.values().removeIf(info -> info.getLastDamageTick() + POISON_TICK_TICKS + 5 < tickCount); - } - - @Subscribe - private void onNpcDespawned(NpcDespawned event) - { - poisonedActors.remove(event.getNpc()); - } - - @Subscribe - private void onPlayerDespawned(PlayerDespawned event) - { - poisonedActors.remove(event.getPlayer()); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals(PoisonConfig.GROUP)) - { - return; - } - - updateConfig(); - - if (!this.showInfoboxes && infobox != null) - { - infoBoxManager.removeInfoBox(infobox); - infobox = null; - } - - if (this.changeHealthIcon) - { - clientThread.invoke(this::checkHealthIcon); - } - else - { - clientThread.invoke(this::resetHealthIcon); - } - - if (event.getKey().startsWith("show")) - { - overlayManager.remove(actorOverlay); - - if (!this.showForPlayers && !this.showForNpcs) - { - poisonedActors.clear(); - } - else - { - if (!this.showForNpcs) - { - poisonedActors.entrySet().removeIf(a -> a instanceof NPC); - } - - if (!this.showForPlayers) - { - poisonedActors.entrySet().removeIf(a -> a instanceof Player); - } - - overlayManager.add(actorOverlay); - } - } - - if (event.getKey().equals("fontsize")) - { - actorOverlay.setFontSize(this.fontSize); - } - } - - static int nextDamage(int poisonValue) - { - int damage; - - if (poisonValue >= VENOM_THRESHOLD) - { - //Venom Damage starts at 6, and increments in twos; - //The VarPlayer increments in values of 1, however. - poisonValue -= VENOM_UTILITY; - damage = poisonValue * 2; - //Venom Damage caps at 20, but the VarPlayer keeps increasing - if (damage > VENOM_MAXIMUM_DAMAGE) - { - damage = VENOM_MAXIMUM_DAMAGE; - } - } - else - { - damage = (int) Math.ceil(poisonValue / 5.0f); - } - - return damage; - } - - BufferedImage getSplat(int id, int damage) - { - //Get a copy of the hitsplat to get a clean one each time - final BufferedImage rawSplat = spriteManager.getSprite(id, 0); - if (rawSplat == null) - { - return null; - } - - final BufferedImage splat = new BufferedImage( - rawSplat.getColorModel(), - rawSplat.copyData(null), - rawSplat.getColorModel().isAlphaPremultiplied(), - null); - - final Graphics g = splat.getGraphics(); - g.setFont(FontManager.getRunescapeSmallFont()); - - // Align the text in the centre of the hitsplat - final FontMetrics metrics = g.getFontMetrics(); - final String text = String.valueOf(damage); - final int x = (splat.getWidth() - metrics.stringWidth(text)) / 2; - final int y = (splat.getHeight() - metrics.getHeight()) / 2 + metrics.getAscent(); - - g.setColor(Color.BLACK); - g.drawString(String.valueOf(damage), x + 1, y + 1); - g.setColor(Color.WHITE); - g.drawString(String.valueOf(damage), x, y); - return splat; - } - - private static String getFormattedTime(Duration timeLeft) - { - if (timeLeft.isNegative()) - { - return "Now!"; - } - - int seconds = (int) (timeLeft.toMillis() / 1000L); - int minutes = seconds / 60; - int secs = seconds % 60; - - return String.format("%d:%02d", minutes, secs); - } - - String createTooltip() - { - Duration timeLeft; - if (nextPoisonTick.isBefore(Instant.now()) && !envenomed) - { - timeLeft = Duration.of(POISON_TICK_MILLIS * (lastValue - 1), ChronoUnit.MILLIS); - } - else - { - timeLeft = Duration.between(Instant.now(), nextPoisonTick).plusMillis(POISON_TICK_MILLIS * (lastValue - 1)); - } - - String line1 = MessageFormat.format("Next {0} damage: {1}
Time until damage: {2}", - envenomed ? "venom" : "poison", ColorUtil.wrapWithColorTag(String.valueOf(lastDamage), Color.RED), - getFormattedTime(Duration.between(Instant.now(), nextPoisonTick))); - String line2 = envenomed ? "" : MessageFormat.format("
Time until cure: {0}", getFormattedTime(timeLeft)); - - return line1 + line2; - } - - private void checkHealthIcon() - { - if (!this.changeHealthIcon) - { - return; - } - - final BufferedImage newHeart; - final int poison = client.getVar(VarPlayer.IS_POISONED); - - if (poison >= VENOM_THRESHOLD) - { - newHeart = HEART_VENOM; - } - else if (poison > 0) - { - newHeart = HEART_POISON; - } - else if (client.getVar(VarPlayer.DISEASE_VALUE) > 0) - { - newHeart = HEART_DISEASE; - } - else - { - resetHealthIcon(); - return; - } - - // Only update sprites when the heart icon actually changes - if (newHeart != null && !newHeart.equals(heart)) - { - heart = newHeart; - client.getWidgetSpriteCache().reset(); - client.getSpriteOverrides().put(SpriteID.MINIMAP_ORB_HITPOINTS_ICON, ImageUtil.getImageSprite(heart, client)); - } - } - - private void resetHealthIcon() - { - if (heart == null) - { - return; - } - - client.getWidgetSpriteCache().reset(); - client.getSpriteOverrides().remove(SpriteID.MINIMAP_ORB_HITPOINTS_ICON); - heart = null; - } - - private void updateConfig() - { - this.showInfoboxes = config.showInfoboxes(); - this.changeHealthIcon = config.changeHealthIcon(); - this.showForPlayers = config.showForPlayers(); - this.showForNpcs = config.showForNpcs(); - this.fontSize = config.fontSize(); - actorOverlay.setDisplayTicks(config.ticks()); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayagainstplayer/PrayAgainstPlayerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayagainstplayer/PrayAgainstPlayerConfig.java deleted file mode 100644 index 136b8415d1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayagainstplayer/PrayAgainstPlayerConfig.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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.prayagainstplayer; - -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("prayagainstplayer") -public interface PrayAgainstPlayerConfig extends Config -{ - @ConfigItem( - position = 1, - keyName = "ignoreFriends", - name = "Ignore Friends", - description = "This lets you decide whether you want friends to be highlighted by this plugin." - ) - default boolean ignoreFriends() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "ignoreClanMates", - name = "Ignore Clan Mates", - description = "This lets you decide whether you want clan mates to be highlighted by this plugin." - ) - default boolean ignoreClanMates() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "drawTargetPrayAgainstPrayerTab", - name = "Draw what to pray from prayer tab", - description = "Tells you what to pray from what weapon the attacker is holding from the prayer tab" - ) - default boolean drawTargetPrayAgainstPrayerTab() - { - return false; - } - - @ConfigItem( - position = 4, - keyName = "highlightAttackers", - name = "Highlight Attackers", - description = "This will highlight attackers." - ) - default boolean highlightAttackers() - { - return false; - } - - @Range( - min = 1, - max = 10 - ) - @ConfigItem( - position = 5, - keyName = "highlightWidth", - name = "Highlight Width", - description = "This will set the highlight attackers outline width.", - hidden = true, - unhide = "highlightAttackers" - ) - default int highlightWidth() - { - return 4; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayagainstplayer/PrayAgainstPlayerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayagainstplayer/PrayAgainstPlayerOverlay.java deleted file mode 100644 index ce5f951a0a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayagainstplayer/PrayAgainstPlayerOverlay.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.prayagainstplayer; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.client.game.PlayerContainer; -import net.runelite.client.game.PlayerManager; -import net.runelite.client.graphics.ModelOutlineRenderer; -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; - -@Singleton -class PrayAgainstPlayerOverlay extends Overlay -{ - private final PrayAgainstPlayerPlugin plugin; - private final PlayerManager playerManager; - private final ModelOutlineRenderer outlineRenderer; - - @Inject - private PrayAgainstPlayerOverlay( - final PrayAgainstPlayerPlugin plugin, - final PlayerManager playerManager, - final ModelOutlineRenderer outlineRenderer - ) - { - this.plugin = plugin; - this.playerManager = playerManager; - this.outlineRenderer = outlineRenderer; - setLayer(OverlayLayer.ABOVE_SCENE); - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGH); - } - - @Override - public Dimension render(Graphics2D graphics) - { - for (PlayerContainer player : playerManager.getAllAttackers()) - { - if (player.getPlayer() == null - || (plugin.isIgnoreFriends() && player.isFriend() - || (plugin.isIgnoreClanMates() && player.isClan())) - ) - { - continue; - } - - if (plugin.isHighlightAttackers()) - { - outlineRenderer.drawOutline(player.getPlayer(), plugin.getHighlightWidth(), player.getAttackStyle().getColor()); - } - } - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayagainstplayer/PrayAgainstPlayerOverlayPrayerTab.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayagainstplayer/PrayAgainstPlayerOverlayPrayerTab.java deleted file mode 100644 index 62317d12f6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayagainstplayer/PrayAgainstPlayerOverlayPrayerTab.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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.prayagainstplayer; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.Rectangle; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.VarClientInt; -import net.runelite.api.vars.InterfaceTab; -import net.runelite.api.widgets.Widget; -import net.runelite.client.game.AttackStyle; -import net.runelite.client.game.PlayerContainer; -import net.runelite.client.game.PlayerManager; -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; - -@Singleton -class PrayAgainstPlayerOverlayPrayerTab extends Overlay -{ - - private final PlayerManager playerManager; - private final Client client; - - @Inject - private PrayAgainstPlayerOverlayPrayerTab( - final PlayerManager playerManager, - final Client client - ) - { - this.client = client; - this.playerManager = playerManager; - setPosition(OverlayPosition.DETACHED); - setLayer(OverlayLayer.ALWAYS_ON_TOP); - setPriority(OverlayPriority.MED); - } - - - @Override - public Dimension render(Graphics2D graphics) - { - for (PlayerContainer player : playerManager.getAllAttackers()) - { - if (player.getAttackStyle() == AttackStyle.UNKNOWN) - { - continue; - } - - final Widget widget = client.getWidget(player.getAttackStyle().getPrayer().getWidgetInfo()); - - if (widget == null) - { - continue; - } - - if (client.getVar(VarClientInt.INTERFACE_TAB) == InterfaceTab.PRAYER.getId() && - !client.isPrayerActive(player.getAttackStyle().getPrayer())) - { - OverlayUtil.renderPolygon(graphics, rectangleToPolygon(widget.getBounds()), Color.RED); - break; - } - } - return null; - } - - private static Polygon rectangleToPolygon(Rectangle rect) - { - int[] xpoints = {rect.x, rect.x + rect.width, rect.x + rect.width, rect.x}; - int[] ypoints = {rect.y, rect.y, rect.y + rect.height, rect.y + rect.height}; - - return new Polygon(xpoints, ypoints, 4); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayagainstplayer/PrayAgainstPlayerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayagainstplayer/PrayAgainstPlayerPlugin.java deleted file mode 100644 index b66e263efb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayagainstplayer/PrayAgainstPlayerPlugin.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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.prayagainstplayer; - -import com.google.inject.Provides; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.SpriteManager; -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; - -@PluginDescriptor( - name = "Pray Against Player", - description = "Use plugin in PvP situations for best results!!", - tags = {"highlight", "pvp", "overlay", "players"}, - type = PluginType.PVP, - enabledByDefault = false -) -@Singleton -@Getter(AccessLevel.PACKAGE) -public class PrayAgainstPlayerPlugin extends Plugin -{ - @Inject - private Client client; - @Inject - private SpriteManager spriteManager; - @Inject - private OverlayManager overlayManager; - @Inject - private PrayAgainstPlayerOverlay overlay; - @Inject - private PrayAgainstPlayerOverlayPrayerTab overlayPrayerTab; - @Inject - private PrayAgainstPlayerConfig config; - - private boolean ignoreFriends; - private boolean ignoreClanMates; - private boolean drawTargetPrayAgainstPrayerTab; - private boolean highlightAttackers; - private int highlightWidth; - - @Provides - PrayAgainstPlayerConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(PrayAgainstPlayerConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - overlayManager.add(overlay); - overlayManager.add(overlayPrayerTab); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - overlayManager.remove(overlayPrayerTab); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("prayagainstplayer")) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.ignoreFriends = config.ignoreFriends(); - this.ignoreClanMates = config.ignoreClanMates(); - this.drawTargetPrayAgainstPrayerTab = config.drawTargetPrayAgainstPrayerTab(); - this.highlightAttackers = config.highlightAttackers(); - this.highlightWidth = config.highlightWidth(); - - if (this.drawTargetPrayAgainstPrayerTab) - { - overlayManager.add(overlayPrayerTab); - } - else - { - overlayManager.remove(overlayPrayerTab); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerBarOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerBarOverlay.java deleted file mode 100644 index 11abc01fc9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerBarOverlay.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * Copyright (c) 2018, Chdata - * 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.prayer; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import net.runelite.api.Player; -import net.runelite.api.Point; -import net.runelite.api.Skill; -import net.runelite.api.SpriteID; -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.util.ImageUtil; - -@Singleton -class PrayerBarOverlay extends Overlay -{ - private static final Color BAR_FILL_COLOR = new Color(0, 149, 151); - private static final Color BAR_BG_COLOR = Color.black; - private static final Color FLICK_HELP_COLOR = Color.white; - private static final Dimension PRAYER_BAR_SIZE = new Dimension(30, 5); - private static final int HD_PRAYER_BAR_PADDING = 1; - private static final BufferedImage HD_FRONT_BAR = ImageUtil.getResourceStreamFromClass(PrayerPlugin.class, "front.png"); - private static final BufferedImage HD_BACK_BAR = ImageUtil.getResourceStreamFromClass(PrayerPlugin.class, "back.png"); - - private final Client client; - private final PrayerPlugin plugin; - - private boolean showingPrayerBar; - - @Inject - private PrayerBarOverlay(final Client client, final PrayerPlugin plugin) - { - this.client = client; - this.plugin = plugin; - - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGH); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isShowPrayerBar() || !showingPrayerBar) - { - return null; - } - - final int height = client.getLocalPlayer().getLogicalHeight() + 10; - final LocalPoint localLocation = client.getLocalPlayer().getLocalLocation(); - final Point canvasPoint = Perspective.localToCanvas(client, localLocation, client.getPlane(), height); - - final float ratio = (float) client.getBoostedSkillLevel(Skill.PRAYER) / client.getRealSkillLevel(Skill.PRAYER); - - // Draw HD bar - if (client.getSpriteOverrides().containsKey(SpriteID.HEALTHBAR_DEFAULT_FRONT_30PX)) - { - final int barWidth = HD_FRONT_BAR.getWidth(); - final int barHeight = HD_FRONT_BAR.getHeight(); - final int barX = canvasPoint.getX() - barWidth / 2; - final int barY = canvasPoint.getY(); - - // Include padding so the bar doesn't show empty at very low prayer values - final int progressFill = (int) Math.ceil(Math.max(HD_PRAYER_BAR_PADDING * 2, Math.min((barWidth * ratio), barWidth))); - - graphics.drawImage(HD_BACK_BAR, barX, barY, barWidth, barHeight, null); - // Use a sub-image to create the same effect the HD Health Bar has - graphics.drawImage(HD_FRONT_BAR.getSubimage(0, 0, progressFill, barHeight), barX, barY, progressFill, barHeight, null); - - if ((plugin.isPrayersActive() || plugin.isPrayerFlickAlwaysOn()) - && (plugin.getPrayerFlickLocation().equals(PrayerFlickLocation.PRAYER_BAR) - || plugin.getPrayerFlickLocation().equals(PrayerFlickLocation.BOTH))) - { - final double t = plugin.getTickProgress(); - final int halfBarWidth = (barWidth / 2) - HD_PRAYER_BAR_PADDING; - - final int xOffset = (int) (-Math.cos(t) * halfBarWidth) + halfBarWidth; - - graphics.setColor(FLICK_HELP_COLOR); - // Padding is accounted for in the offset calculation - graphics.fillRect(barX + xOffset, barY + HD_PRAYER_BAR_PADDING, 1, barHeight - HD_PRAYER_BAR_PADDING * 2); - } - - return new Dimension(barWidth, barHeight); - } - - // Draw bar - final int barX = canvasPoint.getX() - 15; - final int barY = canvasPoint.getY(); - final int barWidth = PRAYER_BAR_SIZE.width; - final int barHeight = PRAYER_BAR_SIZE.height; - - // Restricted by the width to prevent the bar from being too long while you are boosted above your real prayer level. - final int progressFill = (int) Math.ceil(Math.min((barWidth * ratio), barWidth)); - - graphics.setColor(BAR_BG_COLOR); - graphics.fillRect(barX, barY, barWidth, barHeight); - graphics.setColor(BAR_FILL_COLOR); - graphics.fillRect(barX, barY, progressFill, barHeight); - - if ((plugin.isPrayersActive() || plugin.isPrayerFlickAlwaysOn()) - && (plugin.getPrayerFlickLocation().equals(PrayerFlickLocation.PRAYER_BAR) - || plugin.getPrayerFlickLocation().equals(PrayerFlickLocation.BOTH))) - { - double t = plugin.getTickProgress(); - - final int xOffset = (int) (-Math.cos(t) * barWidth / 2) + barWidth / 2; - - graphics.setColor(FLICK_HELP_COLOR); - graphics.fillRect(barX + xOffset, barY, 1, barHeight); - } - - return new Dimension(barWidth, barHeight); - } - - void onTick() - { - final Player localPlayer = client.getLocalPlayer(); - showingPrayerBar = true; - - if (localPlayer == null) - { - showingPrayerBar = false; - return; - } - - if (plugin.isHideIfNotPraying() && !plugin.isPrayersActive()) - { - showingPrayerBar = false; - return; - } - - if (plugin.isHideIfOutOfCombat() && localPlayer.getHealth() == -1) - { - showingPrayerBar = false; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerConfig.java deleted file mode 100644 index 9a22f48cc4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerConfig.java +++ /dev/null @@ -1,132 +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.prayer; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("prayer") -public interface PrayerConfig extends Config -{ - @ConfigItem( - position = 0, - keyName = "prayerFlickLocation", - name = "Pray flick location", - description = "Choose where to display the prayer flick helper." - ) - default PrayerFlickLocation prayerFlickLocation() - { - return PrayerFlickLocation.NONE; - } - - @ConfigItem( - position = 1, - keyName = "prayerFlickAlwaysOn", - name = "Never hide prayer flick helper", - description = "Show prayer flick helper regardless of if you're praying or not." - ) - default boolean prayerFlickAlwaysOn() - { - return false; - } - - @ConfigItem( - position = 2, - keyName = "prayerIndicator", - name = "Boost indicator", - description = "Enable infoboxes for prayers." - ) - default boolean prayerIndicator() - { - return false; - } - - @ConfigItem( - position = 3, - keyName = "prayerIndicatorOverheads", - name = "Overhead indicator", - description = "Also enable infoboxes for overheads." - ) - default boolean prayerIndicatorOverheads() - { - return false; - } - - @ConfigItem( - position = 4, - keyName = "showPrayerDoseIndicator", - name = "Show prayer dose indicator", - description = "Enables the prayer dose indicator." - ) - default boolean showPrayerDoseIndicator() - { - return true; - } - - @ConfigItem( - position = 5, - keyName = "showPrayerTooltip", - name = "Show prayer orb tooltip", - description = "Displays time remaining and prayer bonus as a tooltip on the quick-prayer icon." - ) - default boolean showPrayerStatistics() - { - return true; - } - - @ConfigItem( - position = 6, - keyName = "showPrayerBar", - name = "Show prayer bar", - description = "Displays prayer bar under HP bar when praying." - ) - default boolean showPrayerBar() - { - return false; - } - - @ConfigItem( - position = 7, - keyName = "prayerBarHideIfNotPraying", - name = "Hide bar while prayer is inactive", - description = "Prayer bar will be hidden while prayers are inactive." - ) - default boolean hideIfNotPraying() - { - return true; - } - - @ConfigItem( - position = 8, - keyName = "prayerBarHideIfNonCombat", - name = "Hide bar while out-of-combat", - description = "Prayer bar will be hidden while out-of-combat." - ) - default boolean hideIfOutOfCombat() - { - return false; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerCounter.java deleted file mode 100644 index 68f36872ce..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerCounter.java +++ /dev/null @@ -1,61 +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.prayer; - -import java.awt.Color; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.ui.overlay.infobox.InfoBox; - -class PrayerCounter extends InfoBox -{ - @Getter(AccessLevel.PACKAGE) - private final PrayerType prayerType; - - PrayerCounter(final Plugin plugin, final PrayerType prayerType) - { - super(null, plugin); - this.prayerType = prayerType; - } - - @Override - public String getText() - { - return null; - } - - @Override - public Color getTextColor() - { - return null; - } - - @Override - public String getTooltip() - { - return prayerType.getDescription(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerDoseOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerDoseOverlay.java deleted file mode 100644 index 549d4d6d2e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerDoseOverlay.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (c) 2018, Ethan - * 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.prayer; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.time.Duration; -import java.time.Instant; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Setter; -import net.runelite.api.Client; -import net.runelite.api.Constants; -import net.runelite.api.Point; -import net.runelite.api.Prayer; -import net.runelite.api.Skill; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -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.tooltip.Tooltip; -import net.runelite.client.ui.overlay.tooltip.TooltipManager; -import net.runelite.client.util.ColorUtil; -import org.apache.commons.lang3.StringUtils; - -@Singleton -class PrayerDoseOverlay extends Overlay -{ - private static final float PULSE_TIME = 2f * Constants.GAME_TICK_LENGTH; - - private static final Color START_COLOR = new Color(0, 255, 255); - private static final Color END_COLOR = new Color(0, 92, 92); - - private final Client client; - private final PrayerPlugin plugin; - private final TooltipManager tooltipManager; - private Instant startOfLastTick = Instant.now(); - private boolean trackTick = true; - - @Setter(AccessLevel.PACKAGE) - private int prayerBonus; - @Setter(AccessLevel.PACKAGE) - private boolean hasPrayerRestore; - @Setter(AccessLevel.PACKAGE) - private int bonusPrayer; - @Setter(AccessLevel.PACKAGE) - private boolean hasHolyWrench; - - @Inject - private PrayerDoseOverlay(final Client client, final TooltipManager tooltipManager, final PrayerPlugin plugin) - { - this.client = client; - this.tooltipManager = tooltipManager; - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - } - - void onTick() - { - // Only track the time on every other tick - if (trackTick) - { - startOfLastTick = Instant.now(); //Reset the tick timer - trackTick = false; - } - else - { - trackTick = true; - } - } - - @Override - public Dimension render(Graphics2D graphics) - { - final Widget xpOrb = client.getWidget(WidgetInfo.MINIMAP_QUICK_PRAYER_ORB); - if (xpOrb == null || xpOrb.isHidden()) - { - return null; - } - - final Rectangle bounds = xpOrb.getBounds(); - if (bounds.getX() <= 0) - { - return null; - } - - final Point mousePosition = client.getMouseCanvasPosition(); - - if (plugin.isShowPrayerStatistics() && bounds.contains(mousePosition.getX(), mousePosition.getY())) - { - final String tooltip = "Time Remaining: " + getEstimatedTimeRemaining() + - "
" + - "Prayer Bonus: " + prayerBonus; - - tooltipManager.add(new Tooltip(tooltip)); - } - - if (!plugin.isShowPrayerDoseIndicator() || !hasPrayerRestore) - { - return null; - } - - final int currentPrayer = client.getBoostedSkillLevel(Skill.PRAYER); - final int maxPrayer = client.getRealSkillLevel(Skill.PRAYER); - - final int prayerPointsMissing = maxPrayer - currentPrayer; - if (prayerPointsMissing <= 0) - { - return null; - } - - final double dosePercentage = hasHolyWrench ? .27 : .25; - final int basePointsRestored = (int) Math.floor(maxPrayer * dosePercentage); - - final int pointsRestored = basePointsRestored + 7 + bonusPrayer; - - if (prayerPointsMissing < pointsRestored) - { - return null; - } - - // Purposefully using height twice here as the bounds of the prayer orb includes the number sticking out the side - final int orbInnerSize = (int) bounds.getHeight(); - - final int orbInnerX = (int) (bounds.getX() + 24); // x pos of the inside of the prayer orb - final int orbInnerY = (int) (bounds.getY() - 1); // y pos of the inside of the prayer orb - - final long timeSinceLastTick = Duration.between(startOfLastTick, Instant.now()).toMillis(); - - final float tickProgress = Math.min(timeSinceLastTick / PULSE_TIME, 1); // Cap between 0 and 1 - final double t = tickProgress * Math.PI; // Convert to 0 - pi - - graphics.setColor(ColorUtil.colorLerp(START_COLOR, END_COLOR, Math.sin(t))); - graphics.setStroke(new BasicStroke(2)); - graphics.drawOval(orbInnerX, orbInnerY, orbInnerSize, orbInnerSize); - - return new Dimension((int) bounds.getWidth(), (int) bounds.getHeight()); - } - - private double getPrayerDrainRate(Client client) - { - double drainRate = 0.0; - - for (Prayer prayer : Prayer.values()) - { - if (client.isPrayerActive(prayer)) - { - drainRate += prayer.getDrainRate(); - } - } - - return drainRate; - } - - private String getEstimatedTimeRemaining() - { - // Base data - final double drainRate = getPrayerDrainRate(client); - - if (drainRate == 0) - { - return "N/A"; - } - - final int currentPrayer = client.getBoostedSkillLevel(Skill.PRAYER); - - // Calculate how many seconds each prayer points last so the prayer bonus can be applied - final double secondsPerPoint = (60.0 / drainRate) * (1.0 + (prayerBonus / 30.0)); - - // Calculate the number of seconds left - final double secondsLeft = (currentPrayer * secondsPerPoint); - final int minutes = (int) Math.floor(secondsLeft / 60.0); - final int seconds = (int) Math.floor(secondsLeft - (minutes * 60.0)); - - // Return the text - return minutes + ":" + StringUtils.leftPad(Integer.toString(seconds), 2, "0"); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerFlickLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerFlickLocation.java deleted file mode 100644 index 593ad87bc8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerFlickLocation.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2018, Forsco - * 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.prayer; - -public enum PrayerFlickLocation -{ - NONE, - PRAYER_ORB, - PRAYER_BAR, - BOTH -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerFlickOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerFlickOverlay.java deleted file mode 100644 index 56e4dc1660..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerFlickOverlay.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2017, 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.prayer; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.geom.Rectangle2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayPosition; - -@Singleton -class PrayerFlickOverlay extends Overlay -{ - private final Client client; - private final PrayerPlugin plugin; - - @Inject - private PrayerFlickOverlay(Client client, PrayerPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - // If there are no prayers active or flick location is set to the prayer bar we don't require the flick helper - if ((!plugin.isPrayersActive() && !plugin.isPrayerFlickAlwaysOn()) - || plugin.getPrayerFlickLocation().equals(PrayerFlickLocation.NONE) - || plugin.getPrayerFlickLocation().equals(PrayerFlickLocation.PRAYER_BAR)) - { - return null; - } - - Widget xpOrb = client.getWidget(WidgetInfo.MINIMAP_QUICK_PRAYER_ORB); - if (xpOrb == null) - { - return null; - } - - Rectangle2D bounds = xpOrb.getBounds().getBounds2D(); - if (bounds.getX() <= 0) - { - return null; - } - - //Purposefully using height twice here as the bounds of the prayer orb includes the number sticking out the side - int orbInnerHeight = (int) bounds.getHeight(); - - int orbInnerX = (int) (bounds.getX() + 24);//x pos of the inside of the prayer orb - int orbInnerY = (int) (bounds.getY() - 1);//y pos of the inside of the prayer orb - - double t = plugin.getTickProgress(); - - int xOffset = (int) (-Math.cos(t) * orbInnerHeight / 2) + orbInnerHeight / 2; - int indicatorHeight = (int) (Math.sin(t) * orbInnerHeight); - - int yOffset = (orbInnerHeight / 2) - (indicatorHeight / 2); - - graphics.setColor(Color.cyan); - graphics.fillRect(orbInnerX + xOffset, orbInnerY + yOffset, 1, indicatorHeight); - - return new Dimension((int) bounds.getWidth(), (int) bounds.getHeight()); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerPlugin.java deleted file mode 100644 index f17499c121..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerPlugin.java +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * 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.prayer; - -import com.google.inject.Provides; -import java.time.Duration; -import java.time.Instant; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -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.ItemContainer; -import net.runelite.api.Prayer; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.SpriteManager; -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.ui.overlay.infobox.InfoBoxManager; -import net.runelite.http.api.item.ItemStats; - -@PluginDescriptor( - name = "Prayer", - description = "Show various information related to prayer", - tags = {"combat", "flicking", "overlay"}, - type = PluginType.UTILITY -) -@Singleton -public class PrayerPlugin extends Plugin -{ - private final PrayerCounter[] prayerCounter = new PrayerCounter[PrayerType.values().length]; - - private Instant startOfLastTick = Instant.now(); - - @Getter(AccessLevel.PACKAGE) - private boolean prayersActive = false; - - @Inject - private Client client; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private SpriteManager spriteManager; - - @Inject - private OverlayManager overlayManager; - - @Inject - private PrayerFlickOverlay flickOverlay; - - @Inject - private PrayerDoseOverlay doseOverlay; - - @Inject - private PrayerBarOverlay barOverlay; - - @Inject - private PrayerConfig config; - - @Inject - private ItemManager itemManager; - - @Getter(AccessLevel.PACKAGE) - private PrayerFlickLocation prayerFlickLocation; - @Getter(AccessLevel.PACKAGE) - private boolean prayerFlickAlwaysOn; - private boolean prayerIndicator; - private boolean prayerIndicatorOverheads; - @Getter(AccessLevel.PACKAGE) - private boolean showPrayerDoseIndicator; - @Getter(AccessLevel.PACKAGE) - private boolean showPrayerStatistics; - @Getter(AccessLevel.PACKAGE) - private boolean showPrayerBar; - @Getter(AccessLevel.PACKAGE) - private boolean hideIfNotPraying; - @Getter(AccessLevel.PACKAGE) - private boolean hideIfOutOfCombat; - - @Provides - PrayerConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(PrayerConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(flickOverlay); - overlayManager.add(doseOverlay); - overlayManager.add(barOverlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(flickOverlay); - overlayManager.remove(doseOverlay); - overlayManager.remove(barOverlay); - removeIndicators(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("prayer")) - { - updateConfig(); - if (!this.prayerIndicator) - { - removeIndicators(); - } - else if (!this.prayerIndicatorOverheads) - { - removeOverheadsIndicators(); - } - } - } - - @Subscribe - private void onItemContainerChanged(final ItemContainerChanged event) - { - final ItemContainer container = event.getItemContainer(); - final ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); - final ItemContainer equipment = client.getItemContainer(InventoryID.EQUIPMENT); - - if (container != null && (container.equals(inventory) || container.equals(equipment))) - { - doseOverlay.setHasHolyWrench(false); - doseOverlay.setHasPrayerRestore(false); - doseOverlay.setBonusPrayer(0); - - if (inventory != null) - { - checkContainerForPrayer(inventory.getItems()); - } - - if (equipment != null) - { - doseOverlay.setPrayerBonus(checkContainerForPrayer(equipment.getItems())); - } - - } - } - - @Subscribe - private void onGameTick(GameTick tick) - { - prayersActive = isAnyPrayerActive(); - - if (!this.prayerFlickLocation.equals(PrayerFlickLocation.NONE)) - { - startOfLastTick = Instant.now(); - } - - if (this.showPrayerDoseIndicator) - { - doseOverlay.onTick(); - } - - if (this.showPrayerBar) - { - barOverlay.onTick(); - } - - if (!this.prayerIndicator) - { - return; - } - - for (PrayerType prayerType : PrayerType.values()) - { - Prayer prayer = prayerType.getPrayer(); - int ord = prayerType.ordinal(); - - if (client.isPrayerActive(prayer)) - { - if (prayerType.isOverhead() && !this.prayerIndicatorOverheads) - { - continue; - } - - if (prayerCounter[ord] == null) - { - PrayerCounter counter = prayerCounter[ord] = new PrayerCounter(this, prayerType); - spriteManager.getSpriteAsync(prayerType.getSpriteID(), 0, - counter::setImage); - infoBoxManager.addInfoBox(counter); - } - } - else if (prayerCounter[ord] != null) - { - infoBoxManager.removeInfoBox(prayerCounter[ord]); - prayerCounter[ord] = null; - } - } - } - - private int checkContainerForPrayer(Item[] items) - { - if (items == null) - { - return 0; - } - - int total = 0; - - boolean hasPrayerPotion = false; - boolean hasSuperRestore = false; - boolean hasSanfew = false; - - for (Item item : items) - { - if (item == null) - { - continue; - } - - final PrayerRestoreType type = PrayerRestoreType.getType(item.getId()); - - if (type != null) - { - switch (type) - { - case PRAYERPOT: - hasPrayerPotion = true; - break; - case RESTOREPOT: - hasSuperRestore = true; - break; - case SANFEWPOT: - hasSanfew = true; - break; - case HOLYWRENCH: - doseOverlay.setHasHolyWrench(true); - break; - } - } - - ItemStats is = itemManager.getItemStats(item.getId(), false); - if (is != null && is.getEquipment() != null) - { - total += is.getEquipment().getPrayer(); - } - } - - if (hasSanfew || hasSuperRestore || hasPrayerPotion) - { - doseOverlay.setHasPrayerRestore(true); - if (hasSanfew) - { - doseOverlay.setBonusPrayer(2); - } - else if (hasSuperRestore) - { - doseOverlay.setBonusPrayer(1); - } - } - - return total; - } - - double getTickProgress() - { - long timeSinceLastTick = Duration.between(startOfLastTick, Instant.now()).toMillis(); - - float tickProgress = (timeSinceLastTick % Constants.GAME_TICK_LENGTH) / (float) Constants.GAME_TICK_LENGTH; - return tickProgress * Math.PI; - } - - private boolean isAnyPrayerActive() - { - for (Prayer pray : Prayer.values())//Check if any prayers are active - { - if (client.isPrayerActive(pray)) - { - return true; - } - } - - return false; - } - - private void removeIndicators() - { - infoBoxManager.removeIf(entry -> entry instanceof PrayerCounter); - } - - private void removeOverheadsIndicators() - { - infoBoxManager.removeIf(entry -> entry instanceof PrayerCounter - && ((PrayerCounter) entry).getPrayerType().isOverhead()); - } - - private void updateConfig() - { - this.prayerFlickLocation = config.prayerFlickLocation(); - this.prayerFlickAlwaysOn = config.prayerFlickAlwaysOn(); - this.prayerIndicator = config.prayerIndicator(); - this.prayerIndicatorOverheads = config.prayerIndicatorOverheads(); - this.showPrayerDoseIndicator = config.showPrayerDoseIndicator(); - this.showPrayerStatistics = config.showPrayerStatistics(); - this.showPrayerBar = config.showPrayerBar(); - this.hideIfNotPraying = config.hideIfNotPraying(); - this.hideIfOutOfCombat = config.hideIfOutOfCombat(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerRestoreType.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerRestoreType.java deleted file mode 100644 index 426eacf782..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerRestoreType.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.prayer; - -import com.google.common.collect.ImmutableMap; -import java.util.Map; -import net.runelite.api.ItemID; - -enum PrayerRestoreType -{ - RESTOREPOT(ItemID.SUPER_RESTORE4, ItemID.SUPER_RESTORE3, ItemID.SUPER_RESTORE2, ItemID.SUPER_RESTORE1), - PRAYERPOT(ItemID.PRAYER_POTION4, ItemID.PRAYER_POTION3, ItemID.PRAYER_POTION2, ItemID.PRAYER_POTION1), - SANFEWPOT(ItemID.SANFEW_SERUM4, ItemID.SANFEW_SERUM3, ItemID.SANFEW_SERUM2, ItemID.SANFEW_SERUM1), - HOLYWRENCH(ItemID.PRAYER_CAPE, ItemID.PRAYER_CAPET, ItemID.PRAYER_CAPE_10643, ItemID.MAX_CAPE, ItemID.MAX_CAPE_13282, - ItemID.MAX_CAPE_13342, ItemID.HOLY_WRENCH, ItemID.RING_OF_THE_GODS_I); - - private static final Map prayerRestores; - - private final int[] items; - - PrayerRestoreType(final int... items) - { - this.items = items; - } - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - for (PrayerRestoreType prayerRestoreType : values()) - { - for (int itemId : prayerRestoreType.items) - { - builder.put(itemId, prayerRestoreType); - } - } - prayerRestores = builder.build(); - } - - static PrayerRestoreType getType(final int itemId) - { - return prayerRestores.get(itemId); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerType.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerType.java deleted file mode 100644 index 9431f81566..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayer/PrayerType.java +++ /dev/null @@ -1,72 +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.prayer; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.Prayer; -import net.runelite.api.SpriteID; - -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -enum PrayerType -{ - THICK_SKIN("Thick Skin", Prayer.THICK_SKIN, "+5% Defence", SpriteID.PRAYER_THICK_SKIN, false), - BURST_OF_STRENGTH("Burst of Strength", Prayer.BURST_OF_STRENGTH, "+5% Strenth", SpriteID.PRAYER_BURST_OF_STRENGTH, false), - CLARITY_OF_THOUGHT("Clarity of Thought", Prayer.CLARITY_OF_THOUGHT, "+5% Attack", SpriteID.PRAYER_CLARITY_OF_THOUGHT, false), - SHARP_EYE("Sharp Eye", Prayer.SHARP_EYE, "+5% Ranged", SpriteID.PRAYER_SHARP_EYE, false), - MYSTIC_WILL("Mystic Will", Prayer.MYSTIC_WILL, "+5% Magical attack and defence", SpriteID.PRAYER_MYSTIC_WILL, false), - ROCK_SKIN("Rock Skin", Prayer.ROCK_SKIN, "+10% Defence", SpriteID.PRAYER_ROCK_SKIN, false), - SUPERHUMAN_STRENGTH("Superhuman Strength", Prayer.SUPERHUMAN_STRENGTH, "+10% Strength", SpriteID.PRAYER_SUPERHUMAN_STRENGTH, false), - IMPROVED_REFLEXES("Improved Reflexes", Prayer.IMPROVED_REFLEXES, "+10% Attack", SpriteID.PRAYER_IMPROVED_REFLEXES, false), - RAPID_RESTORE("Rapid Restore", Prayer.RAPID_RESTORE, "2 x Restore rate for all skills except Hitpoints and Prayer", SpriteID.PRAYER_RAPID_RESTORE, false), - RAPID_HEAL("Rapid Heal", Prayer.RAPID_HEAL, "2 x Restore rate for Hitpoints", SpriteID.PRAYER_RAPID_HEAL, false), - PROTECT_ITEM("Protect Item", Prayer.PROTECT_ITEM, "Player keeps 1 extra item when they die", SpriteID.PRAYER_PROTECT_ITEM, false), - HAWK_EYE("Hawk Eye", Prayer.HAWK_EYE, "+10% Ranged", SpriteID.PRAYER_HAWK_EYE, false), - MYSTIC_LORE("Mystic Lore", Prayer.MYSTIC_LORE, "+10% Magical attack and defence", SpriteID.PRAYER_MYSTIC_LORE, false), - STEEL_SKIN("Steel Skin", Prayer.STEEL_SKIN, "+15% Defence", SpriteID.PRAYER_STEEL_SKIN, false), - ULTIMATE_STRENGTH("Ultimate Strength", Prayer.ULTIMATE_STRENGTH, "+15% Strength", SpriteID.PRAYER_ULTIMATE_STRENGTH, false), - INCREDIBLE_REFLEXES("Incredible reflexes", Prayer.INCREDIBLE_REFLEXES, "+15% Attack", SpriteID.PRAYER_INCREDIBLE_REFLEXES, false), - PROTECT_FROM_MAGIC("protect from magic", Prayer.PROTECT_FROM_MAGIC, "Protects against magic attacks", SpriteID.PRAYER_PROTECT_FROM_MAGIC, true), - PROTECT_FROM_MISSILES("Protect from missiles", Prayer.PROTECT_FROM_MISSILES, "Protects against ranged attacks", SpriteID.PRAYER_PROTECT_FROM_MISSILES, true), - PROTECT_FROM_MELEE("Protect from melee", Prayer.PROTECT_FROM_MELEE, "Protects against melee attacks", SpriteID.PRAYER_PROTECT_FROM_MELEE, true), - EAGLE_EYE("Eagle Eye", Prayer.EAGLE_EYE, "+15% Ranged", SpriteID.PRAYER_EAGLE_EYE, false), - MYSTIC_MIGHT("Mystic Might", Prayer.MYSTIC_MIGHT, "+15% Magical attack and defence", SpriteID.PRAYER_MYSTIC_MIGHT, false), - RETRIBUTION("Retribution", Prayer.RETRIBUTION, "Deals damage up to 25% of your Prayer level to nearby targets upon the user's death", SpriteID.PRAYER_RETRIBUTION, true), - REDEMPTION("Redemption", Prayer.REDEMPTION, "Heals the player if they fall below 10% health", SpriteID.PRAYER_REDEMPTION, true), - SMITE("Smite", Prayer.SMITE, "Removes 1 Prayer point from an enemy for every 4 damage inflicted on the enemy", SpriteID.PRAYER_SMITE, true), - PRESERVE("Preserve", Prayer.PRESERVE, "Boosted stats last 50% longer", SpriteID.PRAYER_PRESERVE, false), - CHIVALRY("Chivalry", Prayer.CHIVALRY, "+15% Attack, +18% Strength, +20% Defence", SpriteID.PRAYER_CHIVALRY, false), - PIETY("Piety", Prayer.PIETY, "+20% Attack, +23% Strength, +25% Defence", SpriteID.PRAYER_PIETY, false), - RIGOUR("Rigour", Prayer.RIGOUR, "+20% Ranged attack, +23% Ranged strength, +25% Defence", SpriteID.PRAYER_RIGOUR, false), - AUGURY("Augury", Prayer.AUGURY, "+25% Magical attack and defence, +25% Defence", SpriteID.PRAYER_AUGURY, false); - - private final String name; - private final Prayer prayer; - private final String description; - private final int spriteID; - private final boolean overhead; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayeralert/PrayerAlertConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayeralert/PrayerAlertConfig.java deleted file mode 100644 index 1ee5230fbc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayeralert/PrayerAlertConfig.java +++ /dev/null @@ -1,47 +0,0 @@ -// prayeralert - Plugin for the OSRS RuneLite client to alert the player when their prayer is low. -// Copyright (C) 2019 lachlan-smith, mikkikur - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -package net.runelite.client.plugins.prayeralert; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("prayeralert") -public interface PrayerAlertConfig extends Config -{ - @ConfigItem( - position = 1, - keyName = "alwaysShowAlert", - name = "Always show prayer alert", - description = "Show the alert, even without prayer restore in inventory" - ) - default boolean alwaysShowAlert() - { - return false; - } - - @ConfigItem( - position = 2, - keyName = "oldRenderMode", - name = "Render using old method", - description = "Render the prayer alert using the old method" - ) - default boolean oldRenderMode() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayeralert/PrayerAlertOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayeralert/PrayerAlertOverlay.java deleted file mode 100644 index c768fd3749..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayeralert/PrayerAlertOverlay.java +++ /dev/null @@ -1,212 +0,0 @@ -// prayeralert - Plugin for the OSRS RuneLite client to alert the player when their prayer is low. -// Copyright (C) 2019 lachlan-smith, mikkikur - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -package net.runelite.client.plugins.prayeralert; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemID; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.itemstats.stats.Stat; -import net.runelite.client.plugins.itemstats.stats.Stats; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; -import net.runelite.client.ui.overlay.components.ImageComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -@Singleton -class PrayerAlertOverlay extends Overlay -{ - private final Client client; - private final PrayerAlertPlugin plugin; - private final PanelComponent panelComponent = new PanelComponent(); - private final ItemManager itemManager; - - private final Stat prayer = Stats.PRAYER; - - @Inject - private PrayerAlertOverlay(final Client client, final PrayerAlertPlugin plugin, final ItemManager itemManager) - { - setPosition(OverlayPosition.TOP_RIGHT); - setPriority(OverlayPriority.LOW); - this.client = client; - this.plugin = plugin; - this.itemManager = itemManager; - } - - @Override - public Dimension render(Graphics2D graphics) - { - panelComponent.getChildren().clear(); - int prayerLevel = getPrayerLevel(); - int prayerPoints = getPrayerPoints(); - if (plugin.isOldRenderMode()) - { - if (plugin.isAlwaysShowAlert()) - { - boolean drink = drinkPrayerPotion(prayerLevel, prayerPoints); - if (drink) - { - oldPrayerRestorePanel(graphics); - } - } - else - { - boolean drink = drinkPrayerPotion(prayerLevel, prayerPoints); - boolean hasPrayerPotion = checkInventoryForPotion(); - if (drink && hasPrayerPotion) - { - oldPrayerRestorePanel(graphics); - } - } - } - else - { - if (plugin.isAlwaysShowAlert()) - { - boolean drink = drinkPrayerPotion(prayerLevel, prayerPoints); - if (drink) - { - prayerRestorePanel(panelComponent, graphics); - } - } - else - { - boolean drink = drinkPrayerPotion(prayerLevel, prayerPoints); - boolean hasPrayerPotion = checkInventoryForPotion(); - if (drink && hasPrayerPotion) - { - prayerRestorePanel(panelComponent, graphics); - } - } - } - return panelComponent.render(graphics); - } - - private int getPrayerLevel() - { - return prayer.getMaximum(client); - } - - private int getPrayerPoints() - { - return prayer.getValue(client); - } - - private boolean drinkPrayerPotion(int prayerLevel, int prayerPoints) - { - boolean drink = false; - int prayerPotionRestoreValue = 7; - double quarterOfPrayerLevel = (0.25) * (double) prayerLevel; - - prayerPotionRestoreValue = prayerPotionRestoreValue + (int) quarterOfPrayerLevel; - - if (prayerPoints < (prayerLevel - prayerPotionRestoreValue)) - { - drink = true; - } - - return drink; - } - - private boolean checkInventoryForPotion() - { - ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); - Item[] inventoryItems; - boolean hasPrayerPotion = false; - - int[] potionID = {ItemID.PRAYER_POTION1, ItemID.PRAYER_POTION2, ItemID.PRAYER_POTION3, ItemID.PRAYER_POTION4, ItemID.PRAYER_POTION1_20396, ItemID.PRAYER_POTION2_20395, - ItemID.PRAYER_POTION3_20394, ItemID.PRAYER_POTION4_20393, ItemID.PRAYER_MIX1, ItemID.PRAYER_MIX2, ItemID.SUPER_RESTORE1, ItemID.SUPER_RESTORE2, - ItemID.SUPER_RESTORE3, ItemID.SUPER_RESTORE4, ItemID.SUPER_RESTORE_MIX1, ItemID.SUPER_RESTORE_MIX2}; - - if (inventory != null) - { - inventoryItems = inventory.getItems(); - for (Item item : inventoryItems) - { - for (int prayerPotionId : potionID) - { - if (item.getId() == prayerPotionId) - { - hasPrayerPotion = true; - break; - } - } - } - } - - return hasPrayerPotion; - } - - private void prayerRestorePanel(PanelComponent panelComponent, Graphics2D graphics) - { - ImageComponent component = new ImageComponent(itemManager.getImage(ItemID.PRAYER_POTION4)); - component.translate(2, 0); - panelComponent.getChildren().add(component); - panelComponent.getChildren().add(TitleComponent.builder() - .text("Drink") - .color(Color.RED) - .build()); - panelComponent.setPreferredSize(new Dimension( - graphics.getFontMetrics().stringWidth("Drink") + 14, 0)); - } - - private void oldPrayerRestorePanel(Graphics2D graphics) - { - graphics.translate(-100, 15); - graphics.setColor(new Color(0.2f, 0.2f, 0.2f, 0.5f)); - graphics.fillRect(0, 0, 100, 45); - - graphics.drawImage(itemManager.getImage(ItemID.PRAYER_POTION4), null, 14, 7); - - Font dropShadow1 = FontManager.getRunescapeFont(); - dropShadow1 = dropShadow1.deriveFont(Font.PLAIN); - graphics.setFont(dropShadow1); - graphics.setColor(new Color(0f, 0f, 0f, 0.6f)); - graphics.drawString("Drink", 56, 20); - - Font drinkFont1 = FontManager.getRunescapeFont(); - drinkFont1 = drinkFont1.deriveFont(Font.PLAIN); - graphics.setFont(drinkFont1); - graphics.setColor(new Color(1.0f, 0.03529412f, 0.0f)); - graphics.translate(-0.8, -0.8); - graphics.drawString("Drink", 56, 20); - - Font dropShadow2 = FontManager.getRunescapeFont(); - dropShadow2 = dropShadow2.deriveFont(Font.PLAIN); - graphics.setFont(dropShadow2); - graphics.setColor(new Color(0f, 0f, 0f, 0.6f)); - graphics.drawString("Potion", 53, 40); - - Font drinkFont2 = FontManager.getRunescapeFont(); - drinkFont2 = drinkFont2.deriveFont(Font.PLAIN); - graphics.setFont(drinkFont2); - graphics.setColor(new Color(1.0f, 0.03529412f, 0.0f)); - graphics.translate(-0.8, -0.8); - graphics.drawString("Potion", 53, 40); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/prayeralert/PrayerAlertPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/prayeralert/PrayerAlertPlugin.java deleted file mode 100644 index d6739fbef8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/prayeralert/PrayerAlertPlugin.java +++ /dev/null @@ -1,86 +0,0 @@ -// prayeralert - Plugin for the OSRS RuneLite client to alert the player when their prayer is low. -// Copyright (C) 2019 lachlan-smith, mikkikur - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -package net.runelite.client.plugins.prayeralert; - -import com.google.inject.Provides; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "Prayer Alerter", - description = "Alert the player when prayer is low", - tags = {"prayer", "overlay"}, - type = PluginType.UTILITY, - enabledByDefault = false -) -@Singleton -public class PrayerAlertPlugin extends Plugin -{ - @Inject - private OverlayManager overlayManager; - - @Inject - private PrayerAlertOverlay overlay; - - @Inject - private PrayerAlertConfig config; - - @Getter(AccessLevel.PACKAGE) - private boolean alwaysShowAlert; - @Getter(AccessLevel.PACKAGE) - private boolean oldRenderMode; - - @Provides - PrayerAlertConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(PrayerAlertConfig.class); - } - - @Override - protected void startUp() - { - this.alwaysShowAlert = config.alwaysShowAlert(); - this.oldRenderMode = config.oldRenderMode(); - - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("prayeralert")) - { - this.alwaysShowAlert = config.alwaysShowAlert(); - this.oldRenderMode = config.oldRenderMode(); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/privateserver/PrivateServerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/privateserver/PrivateServerConfig.java deleted file mode 100644 index af05480ffc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/privateserver/PrivateServerConfig.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.runelite.client.plugins.privateserver; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("privateserver") - -public interface PrivateServerConfig extends Config -{ - - @ConfigItem( - keyName = "codebase", - name = "URL (codebase)", - description = "IP address or URL of RSPS you wish to connect to.", - position = 0 - ) - default String codebase() - { - return "http://127.0.0.1"; - } - - @ConfigItem( - keyName = "modulus", - name = "Key (modulus)", - description = "RSA key used by the RSPS you wish to connect to.", - position = 1 - ) - default String modulus() - { - return "83ff79a3e258b99ead1a70e1049883e78e513c4cdec538d8da9483879a9f81689c0c7d146d7b82b52d05cf26132b1cda5930eeef894e4ccf3d41eebc3aabe54598c4ca48eb5a31d736bfeea17875a35558b9e3fcd4aebe2a9cc970312a477771b36e173dc2ece6001ab895c553e2770de40073ea278026f36961c94428d8d7db"; - } - -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/privateserver/PrivateServerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/privateserver/PrivateServerPlugin.java deleted file mode 100644 index a9bce44342..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/privateserver/PrivateServerPlugin.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2019, xperiaclash - * Copyright (c) 2019, ganom - * 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.privateserver; - -import com.google.inject.Provides; -import java.math.BigInteger; -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.client.RuneLite; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.util.StringFileUtils; - -@PluginDescriptor( - name = "Private Server", - description = "Settings for connecting to non official servers", - tags = {"RSPS", "Server", "Private"}, - type = PluginType.MISCELLANEOUS, - enabledByDefault = false -) -@Singleton -@Slf4j -public class PrivateServerPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private PrivateServerConfig config; - - @Provides - PrivateServerConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(PrivateServerConfig.class); - } - - @Override - protected void startUp() - { - if (!RuneLite.allowPrivateServer) - { - return; - } - - if (!config.modulus().equals("")) - { - client.setModulus(new BigInteger(config.modulus(), 16)); - } - } - - @Override - protected void shutDown() - { - client.setModulus(null); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("privateserver")) - { - return; - } - - if (event.getKey().equals("modulus")) - { - if (RuneLite.allowPrivateServer && !config.modulus().equals("")) - { - client.setModulus(new BigInteger(config.modulus(), 16)); - } - } - else if (event.getKey().equals("codebase")) - { - StringFileUtils.writeStringToFile(RuneLite.RUNELITE_DIR + "/codebase", config.codebase()); - String message = "Client restart required after codebase change\n"; - JOptionPane.showMessageDialog(new JFrame(), message, "Restart required", - JOptionPane.WARNING_MESSAGE); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/profiles/ProfilePanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/profiles/ProfilePanel.java deleted file mode 100644 index 75a0819842..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/profiles/ProfilePanel.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2019, Spedwards - * 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.profiles; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.security.spec.InvalidKeySpecException; -import javax.crypto.BadPaddingException; -import javax.crypto.IllegalBlockSizeException; -import javax.crypto.NoSuchPaddingException; -import javax.inject.Singleton; -import javax.swing.BorderFactory; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import javax.swing.border.CompoundBorder; -import javax.swing.border.EmptyBorder; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.util.ImageUtil; - -@Slf4j -@Singleton -class ProfilePanel extends JPanel -{ - private static final ImageIcon DELETE_ICON; - private static final ImageIcon DELETE_HOVER_ICON; - - static - { - final BufferedImage deleteImg = ImageUtil.getResourceStreamFromClass(ProfilesPlugin.class, "delete_icon.png"); - DELETE_ICON = new ImageIcon(deleteImg); - DELETE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(deleteImg, -100)); - } - - private final String loginText; - private String password = null; - - ProfilePanel(final Client client, final String data, final ProfilesPlugin plugin, final ProfilesPanel parent) - { - String[] parts = data.split(":"); - this.loginText = parts[1]; - if (parts.length == 3) - { - this.password = parts[2]; - } - - final ProfilePanel panel = this; - - setLayout(new BorderLayout()); - setBackground(ColorScheme.DARKER_GRAY_COLOR); - - JPanel labelWrapper = new JPanel(new BorderLayout()); - labelWrapper.setBackground(ColorScheme.DARKER_GRAY_COLOR); - labelWrapper.setBorder(new CompoundBorder( - BorderFactory.createMatteBorder(0, 0, 1, 0, ColorScheme.DARK_GRAY_COLOR), - BorderFactory.createLineBorder(ColorScheme.DARKER_GRAY_COLOR) - )); - - JPanel panelActions = new JPanel(new BorderLayout(3, 0)); - panelActions.setBorder(new EmptyBorder(0, 0, 0, 8)); - panelActions.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - JLabel delete = new JLabel(); - delete.setIcon(DELETE_ICON); - delete.setToolTipText("Delete account profile"); - delete.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent e) - { - panel.getParent().remove(panel); - try - { - parent.removeProfile(data); - } - catch (InvalidKeySpecException | NoSuchAlgorithmException | IllegalBlockSizeException | InvalidKeyException | BadPaddingException | NoSuchPaddingException ex) - { - log.error(e.toString()); - } - } - - @Override - public void mouseEntered(MouseEvent e) - { - delete.setIcon(DELETE_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent e) - { - delete.setIcon(DELETE_ICON); - } - }); - - panelActions.add(delete, BorderLayout.EAST); - - JLabel label = new JLabel(); - label.setText(parts[0]); - label.setBorder(null); - label.setBackground(ColorScheme.DARKER_GRAY_COLOR); - label.setPreferredSize(new Dimension(0, 24)); - label.setForeground(Color.WHITE); - label.setBorder(new EmptyBorder(0, 8, 0, 0)); - - labelWrapper.add(label, BorderLayout.CENTER); - labelWrapper.add(panelActions, BorderLayout.EAST); - label.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent e) - { - if (SwingUtilities.isLeftMouseButton(e) && client.getGameState() == GameState.LOGIN_SCREEN) - { - client.setUsername(loginText); - if (plugin.isRememberPassword() && password != null) - { - client.setPassword(password); - } - } - } - }); - - JPanel bottomContainer = new JPanel(new BorderLayout()); - bottomContainer.setBorder(new EmptyBorder(8, 0, 8, 0)); - bottomContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR); - bottomContainer.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent e) - { - if (SwingUtilities.isLeftMouseButton(e) && client.getGameState() == GameState.LOGIN_SCREEN) - { - client.setUsername(loginText); - if (plugin.isRememberPassword() && password != null) - { - client.setPassword(password); - } - } - } - }); - - if (plugin.isDisplayEmailAddress()) - { - JLabel login = new JLabel(); - login.setText(plugin.isStreamerMode() ? "Hidden email" : loginText); - login.setBorder(null); - login.setPreferredSize(new Dimension(0, 24)); - login.setForeground(Color.WHITE); - login.setBorder(new EmptyBorder(0, 8, 0, 0)); - - bottomContainer.add(login, BorderLayout.CENTER); - add(bottomContainer, BorderLayout.CENTER); - } - add(labelWrapper, BorderLayout.NORTH); - - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/profiles/ProfilesConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/profiles/ProfilesConfig.java deleted file mode 100644 index 7e7a22da15..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/profiles/ProfilesConfig.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2019, Spedwards - * 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.profiles; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("profiles") -public interface ProfilesConfig extends Config -{ - @ConfigItem( - keyName = "profilesData", - name = "", - description = "", - hidden = true - ) - default String profilesData() - { - return ""; - } - - @ConfigItem( - keyName = "profilesData", - name = "", - description = "" - ) - void profilesData(String str); - - @ConfigItem( - keyName = "salt", - name = "", - description = "", - hidden = true - ) - default String salt() - { - return ""; - } - - @ConfigItem( - keyName = "salt", - name = "", - description = "" - ) - void salt(String key); - - @ConfigItem( - keyName = "rememberPassword", - name = "Remember Password", - description = "Remembers passwords for accounts", - position = 0 - ) - default boolean rememberPassword() - { - return true; - } - - @ConfigItem( - keyName = "displayEmailAddress", - name = "Display email field", - description = "Displays the email address field", - position = 1 - ) - default boolean displayEmailAddress() - { - return false; - } - - @ConfigItem( - keyName = "streamerMode", - name = "Hide email addresses", - description = "Hides your account emails", - position = 2, - hidden = true, - unhide = "displayEmailAddress" - ) - default boolean streamerMode() - { - return false; - } - - @ConfigItem( - keyName = "switchPanel", - name = "Auto-open Panel", - description = "Automatically switch to the account switcher panel on the login screen", - position = 3 - ) - default boolean switchPanel() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/profiles/ProfilesPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/profiles/ProfilesPanel.java deleted file mode 100644 index a5de549873..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/profiles/ProfilesPanel.java +++ /dev/null @@ -1,549 +0,0 @@ -/* - * Copyright (c) 2019, Spedwards - * 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.profiles; - -import java.awt.BorderLayout; -import java.awt.Font; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.security.SecureRandom; -import java.security.spec.InvalidKeySpecException; -import java.security.spec.KeySpec; -import java.util.Arrays; -import java.util.Base64; -import javax.annotation.Nullable; -import javax.crypto.BadPaddingException; -import javax.crypto.Cipher; -import javax.crypto.IllegalBlockSizeException; -import javax.crypto.NoSuchPaddingException; -import javax.crypto.SecretKey; -import javax.crypto.SecretKeyFactory; -import javax.crypto.spec.PBEKeySpec; -import javax.crypto.spec.SecretKeySpec; -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JPasswordField; -import javax.swing.JTextField; -import javax.swing.SwingUtilities; -import javax.swing.border.EmptyBorder; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.DynamicGridLayout; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.PluginPanel; - -@Slf4j -@Singleton -class ProfilesPanel extends PluginPanel -{ - private static final int iterations = 100000; - private static final String UNLOCK_PASSWORD = "Encryption Password"; - private static final String ACCOUNT_USERNAME = "Account Username"; - private static final String ACCOUNT_LABEL = "Account Label"; - private static final String PASSWORD_LABEL = "Account Password"; - private static final String HELP = "To add and load accounts, first enter a password into the Encryption Password " + - "field then press %s.

You can now add as many accounts as you would like.

The next time you restart " + - "openosrs, enter your encryption password and click load accounts to see the accounts you entered."; - - @Inject - @Nullable - private Client client; - - @Inject - private ProfilesConfig profilesConfig; - - @Inject ProfilesPlugin profilesPlugin; - - private final JPasswordField txtDecryptPassword = new JPasswordField(UNLOCK_PASSWORD); - private final JTextField txtAccountLabel = new JTextField(ACCOUNT_LABEL); - private final JPasswordField txtAccountLogin = new JPasswordField(ACCOUNT_USERNAME); - private final JPasswordField txtPasswordLogin = new JPasswordField(PASSWORD_LABEL); - private final JPanel profilesPanel = new JPanel(); - private final JPanel accountPanel = new JPanel(); - private final JPanel loginPanel = new JPanel(); - - void init() - { - final String LOAD_ACCOUNTS = profilesConfig.salt().length() == 0 ? "Save" : "Unlock"; - - setLayout(new BorderLayout(0, 10)); - setBackground(ColorScheme.DARK_GRAY_COLOR); - setBorder(new EmptyBorder(10, 10, 10, 10)); - - final Font smallFont = FontManager.getRunescapeSmallFont(); - - JPanel helpPanel = new JPanel(); - helpPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - helpPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); - helpPanel.setLayout(new DynamicGridLayout(1, 1)); - - JLabel helpLabel = new JLabel(htmlLabel(String.format(HELP, profilesConfig.salt().length() == 0 ? "save" : "unlock"))); - helpLabel.setFont(smallFont); - - helpPanel.add(helpLabel); - - loginPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - loginPanel.setBorder(new EmptyBorder(10, 10, 10, 3)); - loginPanel.setLayout(new DynamicGridLayout(0, 1, 0, 5)); - - txtDecryptPassword.setEchoChar((char) 0); - txtDecryptPassword.setForeground(ColorScheme.LIGHT_GRAY_COLOR); - txtDecryptPassword.setToolTipText(UNLOCK_PASSWORD); - - txtDecryptPassword.addActionListener(e -> decryptAccounts()); - - txtDecryptPassword.addFocusListener(new FocusListener() - { - @Override - public void focusGained(FocusEvent e) - { - if (String.valueOf(txtDecryptPassword.getPassword()).equals(UNLOCK_PASSWORD)) - { - txtDecryptPassword.setText(""); - txtDecryptPassword.setEchoChar('*'); - } - } - - @Override - public void focusLost(FocusEvent e) - { - if (txtDecryptPassword.getPassword().length == 0) - { - txtDecryptPassword.setText(UNLOCK_PASSWORD); - txtDecryptPassword.setEchoChar((char) 0); - } - } - }); - - JButton btnLoadAccounts = new JButton(LOAD_ACCOUNTS); - btnLoadAccounts.setToolTipText(LOAD_ACCOUNTS); - btnLoadAccounts.addMouseListener(new MouseListener() - { - @Override - public void mouseClicked(MouseEvent e) - { - - } - - @Override - public void mousePressed(MouseEvent e) - { - decryptAccounts(); - } - - @Override - public void mouseReleased(MouseEvent e) - { - - } - - @Override - public void mouseEntered(MouseEvent e) - { - - } - - @Override - public void mouseExited(MouseEvent e) - { - - } - }); - - loginPanel.add(txtDecryptPassword); - loginPanel.add(btnLoadAccounts); - - accountPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - accountPanel.setBorder(new EmptyBorder(10, 10, 10, 3)); - accountPanel.setLayout(new DynamicGridLayout(0, 1, 0, 5)); - - txtAccountLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR); - txtAccountLabel.addFocusListener(new FocusListener() - { - @Override - public void focusGained(FocusEvent e) - { - if (txtAccountLabel.getText().equals(ACCOUNT_LABEL)) - { - txtAccountLabel.setText(""); - } - } - - @Override - public void focusLost(FocusEvent e) - { - if (txtAccountLabel.getText().isEmpty()) - { - txtAccountLabel.setText(ACCOUNT_LABEL); - } - } - }); - - // Do not hide username characters until they focus or if in streamer mode - txtAccountLogin.setEchoChar((char) 0); - txtAccountLogin.setForeground(ColorScheme.LIGHT_GRAY_COLOR); - txtAccountLogin.addFocusListener(new FocusListener() - { - @Override - public void focusGained(FocusEvent e) - { - if (ACCOUNT_USERNAME.equals(String.valueOf(txtAccountLogin.getPassword()))) - { - txtAccountLogin.setText(""); - if (profilesPlugin.isStreamerMode()) - { - txtAccountLogin.setEchoChar('*'); - } - } - } - - @Override - public void focusLost(FocusEvent e) - { - if (txtAccountLogin.getPassword().length == 0) - { - txtAccountLogin.setText(ACCOUNT_USERNAME); - txtAccountLogin.setEchoChar((char) 0); - } - } - }); - - txtPasswordLogin.setEchoChar((char) 0); - txtPasswordLogin.setForeground(ColorScheme.LIGHT_GRAY_COLOR); - txtPasswordLogin.setToolTipText(PASSWORD_LABEL); - txtPasswordLogin.addFocusListener(new FocusListener() - { - @Override - public void focusGained(FocusEvent e) - { - if (PASSWORD_LABEL.equals(String.valueOf(txtPasswordLogin.getPassword()))) - { - txtPasswordLogin.setText(""); - txtPasswordLogin.setEchoChar('*'); - } - } - - @Override - public void focusLost(FocusEvent e) - { - if (txtPasswordLogin.getPassword().length == 0) - { - txtPasswordLogin.setText(PASSWORD_LABEL); - txtPasswordLogin.setEchoChar((char) 0); - } - } - }); - - JButton btnAddAccount = new JButton("Add Account"); - btnAddAccount.setBackground(ColorScheme.DARKER_GRAY_COLOR); - btnAddAccount.addActionListener(e -> - { - String labelText = String.valueOf(txtAccountLabel.getText()); - String loginText = String.valueOf(txtAccountLogin.getPassword()); - String passwordText = String.valueOf(txtPasswordLogin.getPassword()); - - if (labelText.equals(ACCOUNT_LABEL) || loginText.equals(ACCOUNT_USERNAME)) - { - return; - } - String data; - if (profilesPlugin.isRememberPassword() && txtPasswordLogin.getPassword() != null) - { - data = labelText + ":" + loginText + ":" + passwordText; - } - else - { - data = labelText + ":" + loginText; - } - - try - { - if (!addProfile(data)) - { - return; - } - - redrawProfiles(); - } - catch (InvalidKeySpecException | NoSuchAlgorithmException | IllegalBlockSizeException | InvalidKeyException | BadPaddingException | NoSuchPaddingException ex) - { - log.error(e.toString()); - } - - txtAccountLabel.setText(ACCOUNT_LABEL); - - txtAccountLogin.setText(ACCOUNT_USERNAME); - txtAccountLogin.setEchoChar((char) 0); - - txtPasswordLogin.setText(PASSWORD_LABEL); - txtPasswordLogin.setEchoChar((char) 0); - }); - - txtAccountLogin.addKeyListener(new KeyAdapter() - { - @Override - public void keyPressed(KeyEvent e) - { - if (e.getKeyCode() == KeyEvent.VK_ENTER) - { - btnAddAccount.doClick(); - btnAddAccount.requestFocus(); - } - } - }); - txtAccountLogin.addMouseListener(new MouseListener() - { - @Override - public void mouseClicked(MouseEvent e) - { - - - } - - @Override - public void mousePressed(MouseEvent e) - { - - } - - @Override - public void mouseReleased(MouseEvent e) - { - - } - - @Override - public void mouseEntered(MouseEvent e) - { - } - - @Override - public void mouseExited(MouseEvent e) - { - - } - }); - - accountPanel.add(txtAccountLabel); - accountPanel.add(txtAccountLogin); - if (profilesPlugin.isRememberPassword()) - { - accountPanel.add(txtPasswordLogin); - } - accountPanel.add(btnAddAccount); - - add(helpPanel, BorderLayout.NORTH); - add(loginPanel, BorderLayout.CENTER); - - // addAccounts(config.profilesData()); - } - - private void decryptAccounts() - { - if (txtDecryptPassword.getPassword().length == 0 || String.valueOf(txtDecryptPassword.getPassword()).equals(UNLOCK_PASSWORD)) - { - showErrorMessage("Unable to load data", "Please enter a password!"); - return; - } - - boolean error = false; - try - { - redrawProfiles(); - } - catch (InvalidKeySpecException | NoSuchAlgorithmException | IllegalBlockSizeException | InvalidKeyException | BadPaddingException | NoSuchPaddingException ex) - { - error = true; - showErrorMessage("Unable to load data", "Incorrect password!"); - txtDecryptPassword.setText(""); - } - - if (error) - { - return; - } - - remove(loginPanel); - add(accountPanel, BorderLayout.CENTER); - - profilesPanel.setLayout(new DynamicGridLayout(0, 1, 0, 3)); - add(profilesPanel, BorderLayout.SOUTH); - } - - void redrawProfiles() throws InvalidKeySpecException, NoSuchAlgorithmException, IllegalBlockSizeException, InvalidKeyException, BadPaddingException, NoSuchPaddingException - { - profilesPanel.removeAll(); - addAccounts(getProfileData()); - - revalidate(); - repaint(); - } - - private void addAccount(String data) - { - ProfilePanel profile = new ProfilePanel(client, data, profilesPlugin, this); - profilesPanel.add(profile); - - revalidate(); - repaint(); - } - - private void addAccounts(String data) - { - // log.info("Data: " + data); - data = data.trim(); - if (!data.contains(":")) - { - return; - } - Arrays.stream(data.split("\\n")).forEach(this::addAccount); - } - - private boolean addProfile(String data) throws InvalidKeySpecException, NoSuchAlgorithmException, IllegalBlockSizeException, InvalidKeyException, BadPaddingException, NoSuchPaddingException - { - return setProfileData( - getProfileData() + data + "\n"); - } - - void removeProfile(String data) throws InvalidKeySpecException, NoSuchAlgorithmException, IllegalBlockSizeException, InvalidKeyException, BadPaddingException, NoSuchPaddingException - { - setProfileData( - getProfileData().replaceAll(data + "\\n", "")); - revalidate(); - repaint(); - - } - - private void setSalt(byte[] bytes) - { - profilesConfig.salt(base64Encode(bytes)); - } - - private byte[] getSalt() - { - if (profilesConfig.salt().length() == 0) - { - return new byte[0]; - } - return base64Decode(profilesConfig.salt()); - } - - private SecretKey getAesKey() throws NoSuchAlgorithmException, InvalidKeySpecException - { - if (getSalt().length == 0) - { - byte[] b = new byte[16]; - SecureRandom.getInstanceStrong().nextBytes(b); - setSalt(b); - } - SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256"); - KeySpec spec = new PBEKeySpec(txtDecryptPassword.getPassword(), getSalt(), iterations, 128); - return factory.generateSecret(spec); - } - - private String getProfileData() throws InvalidKeySpecException, NoSuchAlgorithmException, IllegalBlockSizeException, InvalidKeyException, BadPaddingException, NoSuchPaddingException - { - String tmp = profilesConfig.profilesData(); - if (tmp.startsWith("¬")) - { - tmp = tmp.substring(1); - return decryptText(base64Decode(tmp), getAesKey()); - } - return tmp; - } - - private boolean setProfileData(String data) throws InvalidKeySpecException, NoSuchAlgorithmException, IllegalBlockSizeException, InvalidKeyException, BadPaddingException, NoSuchPaddingException - { - if (txtDecryptPassword.getPassword().length == 0 || String.valueOf(txtDecryptPassword.getPassword()).equals(UNLOCK_PASSWORD)) - { - showErrorMessage("Unable to save data", "Please enter a password!"); - return false; - } - byte[] enc = encryptText(data, getAesKey()); - if (enc.length == 0) - { - return false; - } - String s = "¬" + base64Encode(enc); - profilesConfig.profilesData(s); - return true; - } - - private byte[] base64Decode(String data) - { - return Base64.getDecoder().decode(data); - } - - private String base64Encode(byte[] data) - { - return Base64.getEncoder().encodeToString(data); - } - - /** - * Encrypts login info - * - * @param text text to encrypt - * @return encrypted string - */ - private static byte[] encryptText(String text, SecretKey aesKey) throws NoSuchAlgorithmException, IllegalBlockSizeException, InvalidKeyException, BadPaddingException, NoSuchPaddingException - { - Cipher cipher = Cipher.getInstance("AES"); - SecretKeySpec newKey = new SecretKeySpec(aesKey.getEncoded(), "AES"); - cipher.init(Cipher.ENCRYPT_MODE, newKey); - return cipher.doFinal(text.getBytes()); - } - - private static String decryptText(byte[] enc, SecretKey aesKey) throws NoSuchAlgorithmException, IllegalBlockSizeException, InvalidKeyException, BadPaddingException, NoSuchPaddingException - { - Cipher cipher = Cipher.getInstance("AES"); - SecretKeySpec newKey = new SecretKeySpec(aesKey.getEncoded(), "AES"); - cipher.init(Cipher.DECRYPT_MODE, newKey); - return new String(cipher.doFinal(enc)); - } - - private static void showErrorMessage(String title, String text) - { - SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog(null, - text, - title, - JOptionPane.ERROR_MESSAGE)); - } - - private static String htmlLabel(String text) - { - return "" + text + ""; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/profiles/ProfilesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/profiles/ProfilesPlugin.java deleted file mode 100644 index 5721638979..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/profiles/ProfilesPlugin.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2019, Spedwards - * 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.profiles; - -import com.google.inject.Provides; -import java.awt.image.BufferedImage; -import java.util.concurrent.ScheduledExecutorService; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.GameState; -import net.runelite.api.events.GameStateChanged; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.util.ImageUtil; - -@PluginDescriptor( - name = "Account Switcher", - description = "Allow for a allows you to easily switch between multiple OSRS Accounts", - tags = {"profile", "account", "login", "log in", "pklite"}, - type = PluginType.MISCELLANEOUS, - enabledByDefault = false -) -@Singleton -public class ProfilesPlugin extends Plugin -{ - @Inject - private ClientToolbar clientToolbar; - - @Inject - private ProfilesConfig config; - - @Inject - private ScheduledExecutorService executorService; - - private ProfilesPanel panel; - private NavigationButton navButton; - @Getter(AccessLevel.PACKAGE) - private boolean switchToPanel; - @Getter(AccessLevel.PACKAGE) - private boolean streamerMode; - @Getter(AccessLevel.PACKAGE) - private boolean displayEmailAddress; - @Getter(AccessLevel.PACKAGE) - private boolean rememberPassword; - - - @Provides - ProfilesConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(ProfilesConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - panel = injector.getInstance(ProfilesPanel.class); - panel.init(); - - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "profiles_icon.png"); - - navButton = NavigationButton.builder() - .tooltip("Profiles") - .icon(icon) - .priority(8) - .panel(panel) - .onReady(() -> executorService.submit(() -> OpenPanel(true))) - .build(); - - clientToolbar.addNavigation(navButton); - } - - @Override - protected void shutDown() - { - clientToolbar.removeNavigation(navButton); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (!this.switchToPanel) - { - return; - } - if (event.getGameState().equals(GameState.LOGIN_SCREEN)) - { - if (!navButton.isSelected()) - { - OpenPanel(true); - } - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) throws Exception - { - if (event.getGroup().equals("profiles") && event.getKey().equals("rememberPassword")) - { - panel = injector.getInstance(ProfilesPanel.class); - this.shutDown(); - this.startUp(); - updateConfig(); - } - if (event.getGroup().equals("profiles") && !event.getKey().equals("rememberPassword")) - { - updateConfig(); - panel = injector.getInstance(ProfilesPanel.class); - panel.redrawProfiles(); - } - } - - private void OpenPanel(boolean openPanel) - { - if (openPanel && this.switchToPanel) - { - // If we haven't seen the latest feed item, - // open the feed panel. - navButton.getOnSelect().run(); - } - } - - - private void updateConfig() - { - this.switchToPanel = config.switchPanel(); - this.rememberPassword = config.rememberPassword(); - this.streamerMode = config.streamerMode(); - this.displayEmailAddress = config.displayEmailAddress(); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/PuzzleSolverConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/PuzzleSolverConfig.java deleted file mode 100644 index eee4a3ab63..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/PuzzleSolverConfig.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.puzzlesolver; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("puzzlesolver") -public interface PuzzleSolverConfig extends Config -{ - @ConfigItem( - keyName = "displaySolution", - name = "Display solution", - description = "Display a solution to the puzzle" - ) - default boolean displaySolution() - { - return true; - } - - @ConfigItem( - keyName = "displayRemainingMoves", - name = "Display remaining moves", - description = "Add a text line above puzzle boxes displaying the amount of remaining moves" - ) - default boolean displayRemainingMoves() - { - return true; - } - - @ConfigItem( - keyName = "drawDots", - name = "Draw dots instead of arrows", - description = "Draw dots increasing in size instead of arrows for the solution" - ) - default boolean drawDots() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/PuzzleSolverOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/PuzzleSolverOverlay.java deleted file mode 100644 index 7dc1db8748..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/PuzzleSolverOverlay.java +++ /dev/null @@ -1,485 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * Copyright (c) 2018, Henke - * 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.client.plugins.puzzlesolver; - -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.awt.image.BufferedImage; -import java.util.Arrays; -import java.util.concurrent.Future; -import java.util.concurrent.ScheduledExecutorService; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import static net.runelite.api.SpriteID.MINIMAP_DESTINATION_FLAG; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.plugins.puzzlesolver.solver.PuzzleSolver; -import static net.runelite.client.plugins.puzzlesolver.solver.PuzzleSolver.BLANK_TILE_VALUE; -import static net.runelite.client.plugins.puzzlesolver.solver.PuzzleSolver.DIMENSION; -import net.runelite.client.plugins.puzzlesolver.solver.PuzzleState; -import net.runelite.client.plugins.puzzlesolver.solver.heuristics.ManhattanDistance; -import net.runelite.client.plugins.puzzlesolver.solver.pathfinding.IDAStar; -import net.runelite.client.plugins.puzzlesolver.solver.pathfinding.IDAStarMM; -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; -import net.runelite.client.ui.overlay.components.BackgroundComponent; -import net.runelite.client.ui.overlay.components.TextComponent; -import net.runelite.client.util.ImageUtil; - -@Singleton -public class PuzzleSolverOverlay extends Overlay -{ - private static final int INFO_BOX_WIDTH = 100; - private static final int INFO_BOX_OFFSET_Y = 50; - private static final int INFO_BOX_TOP_BORDER = 2; - private static final int INFO_BOX_BOTTOM_BORDER = 2; - - private static final int PUZZLE_TILE_SIZE = 39; - private static final int DOT_MARKER_SIZE = 16; - - private final Client client; - private final PuzzleSolverPlugin plugin; - private final ScheduledExecutorService executorService; - private final SpriteManager spriteManager; - - private PuzzleSolver solver; - private Future solverFuture; - private int[] cachedItems; - - private BufferedImage upArrow; - private BufferedImage leftArrow; - private BufferedImage rightArrow; - - @Inject - public PuzzleSolverOverlay(final Client client, final PuzzleSolverPlugin plugin, final ScheduledExecutorService executorService, final SpriteManager spriteManager) - { - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGH); - setLayer(OverlayLayer.ABOVE_WIDGETS); - this.client = client; - this.plugin = plugin; - this.executorService = executorService; - this.spriteManager = spriteManager; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if ((!plugin.isDisplaySolution() && !plugin.isDisplayRemainingMoves()) - || client.getGameState() != GameState.LOGGED_IN) - { - return null; - } - - boolean useNormalSolver = true; - ItemContainer container = client.getItemContainer(InventoryID.PUZZLE_BOX); - - if (container == null) - { - useNormalSolver = false; - container = client.getItemContainer(InventoryID.MONKEY_MADNESS_PUZZLE_BOX); - - if (container == null) - { - return null; - } - } - - Widget puzzleBox = client.getWidget(WidgetInfo.PUZZLE_BOX); - - if (puzzleBox == null) - { - return null; - } - - net.runelite.api.Point puzzleBoxLocation = puzzleBox.getCanvasLocation(); - - String infoString = "Solving.."; - - int[] itemIds = getItemIds(container, useNormalSolver); - boolean shouldCache = false; - - if (solver != null) - { - if (solver.hasFailed()) - { - infoString = "The puzzle could not be solved"; - } - else - { - if (solver.hasSolution()) - { - boolean foundPosition = false; - - // Find the current state by looking at the current step and then the next 5 steps - for (int i = 0; i < 6; i++) - { - int j = solver.getPosition() + i; - - if (j == solver.getStepCount()) - { - break; - } - - PuzzleState currentState = solver.getStep(j); - - // If this is false, player has moved the empty tile - if (currentState != null && currentState.hasPieces(itemIds)) - { - foundPosition = true; - solver.setPosition(j); - if (i > 0) - { - shouldCache = true; - } - break; - } - } - - // If looking at the next steps didn't find the current state, - // see if we can find the current state in the 5 previous steps - if (!foundPosition) - { - for (int i = 1; i < 6; i++) - { - int j = solver.getPosition() - i; - - if (j < 0) - { - break; - } - - PuzzleState currentState = solver.getStep(j); - - if (currentState != null && currentState.hasPieces(itemIds)) - { - foundPosition = true; - shouldCache = true; - solver.setPosition(j); - break; - } - } - } - - if (foundPosition) - { - int stepsLeft = solver.getStepCount() - solver.getPosition() - 1; - - if (stepsLeft == 0) - { - infoString = "Solved!"; - } - else if (plugin.isDisplayRemainingMoves()) - { - infoString = "Moves left: " + stepsLeft; - } - else - { - infoString = null; - } - - if (plugin.isDisplaySolution()) - { - if (plugin.isDrawDots()) - { - graphics.setColor(Color.YELLOW); - - // Display the next 4 steps - for (int i = 1; i < 5; i++) - { - int j = solver.getPosition() + i; - - if (j >= solver.getStepCount()) - { - break; - } - - PuzzleState futureMove = solver.getStep(j); - - if (futureMove == null) - { - break; - } - - int blankX = futureMove.getEmptyPiece() % DIMENSION; - int blankY = futureMove.getEmptyPiece() / DIMENSION; - - int markerSize = DOT_MARKER_SIZE - i * 3; - - int x = puzzleBoxLocation.getX() + blankX * PUZZLE_TILE_SIZE - + PUZZLE_TILE_SIZE / 2 - markerSize / 2; - - int y = puzzleBoxLocation.getY() + blankY * PUZZLE_TILE_SIZE - + PUZZLE_TILE_SIZE / 2 - markerSize / 2; - - graphics.fillOval(x, y, markerSize, markerSize); - } - } - else - { - // Find the current blank tile position - PuzzleState currentMove = solver.getStep(solver.getPosition()); - - int lastBlankX = currentMove.getEmptyPiece() % DIMENSION; - int lastBlankY = currentMove.getEmptyPiece() / DIMENSION; - - // Display the next 3 steps - for (int i = 1; i < 4; i++) - { - int j = solver.getPosition() + i; - - if (j >= solver.getStepCount()) - { - break; - } - - PuzzleState futureMove = solver.getStep(j); - - if (futureMove == null) - { - break; - } - - int blankX = futureMove.getEmptyPiece() % DIMENSION; - int blankY = futureMove.getEmptyPiece() / DIMENSION; - - int xDelta = blankX - lastBlankX; - int yDelta = blankY - lastBlankY; - - BufferedImage arrow; - if (xDelta > 0) - { - arrow = getRightArrow(); - } - else if (xDelta < 0) - { - arrow = getLeftArrow(); - } - else if (yDelta > 0) - { - arrow = getDownArrow(); - } - else - { - arrow = getUpArrow(); - } - - if (arrow == null) - { - continue; - } - - int x = puzzleBoxLocation.getX() + blankX * PUZZLE_TILE_SIZE - + PUZZLE_TILE_SIZE / 2 - arrow.getWidth() / 2; - - int y = puzzleBoxLocation.getY() + blankY * PUZZLE_TILE_SIZE - + PUZZLE_TILE_SIZE / 2 - arrow.getHeight() / 2; - - OverlayUtil.renderImageLocation(graphics, new net.runelite.api.Point(x, y), arrow); - - lastBlankX = blankX; - lastBlankY = blankY; - } - } - } - } - } - } - } - - // Draw info box - if (infoString != null) - { - int x = puzzleBoxLocation.getX() + puzzleBox.getWidth() / 2 - INFO_BOX_WIDTH / 2; - int y = puzzleBoxLocation.getY() - INFO_BOX_OFFSET_Y; - - FontMetrics fm = graphics.getFontMetrics(); - int height = INFO_BOX_TOP_BORDER + fm.getHeight() + INFO_BOX_BOTTOM_BORDER; - - BackgroundComponent backgroundComponent = new BackgroundComponent(); - backgroundComponent.setRectangle(new Rectangle(x, y, INFO_BOX_WIDTH, height)); - backgroundComponent.render(graphics); - - int textOffsetX = (INFO_BOX_WIDTH - fm.stringWidth(infoString)) / 2; - int textOffsetY = fm.getHeight(); - - TextComponent textComponent = new TextComponent(); - textComponent.setPosition(new Point(x + textOffsetX, y + textOffsetY)); - textComponent.setText(infoString); - textComponent.render(graphics); - } - - // Solve the puzzle if we don't have an up to date solution - if (solver == null || cachedItems == null - || (!shouldCache && solver.hasExceededWaitDuration() && !Arrays.equals(cachedItems, itemIds))) - { - solve(itemIds, useNormalSolver); - shouldCache = true; - } - - if (shouldCache) - { - cacheItems(itemIds); - } - - return null; - } - - private int[] getItemIds(ItemContainer container, boolean useNormalSolver) - { - int[] itemIds = new int[DIMENSION * DIMENSION]; - - Item[] items = container.getItems(); - - for (int i = 0; i < items.length; i++) - { - itemIds[i] = items[i].getId(); - } - - // If blank is in the last position, items doesn't contain it, so let's add it manually - if (itemIds.length > items.length) - { - itemIds[items.length] = BLANK_TILE_VALUE; - } - - return convertToSolverFormat(itemIds, useNormalSolver); - } - - private int[] convertToSolverFormat(int[] items, boolean useNormalSolver) - { - int lowestId = Integer.MAX_VALUE; - - int[] convertedItems = new int[items.length]; - - for (int id : items) - { - if (id == BLANK_TILE_VALUE) - { - continue; - } - - if (lowestId > id) - { - lowestId = id; - } - } - - for (int i = 0; i < items.length; i++) - { - if (items[i] != BLANK_TILE_VALUE) - { - int value = items[i] - lowestId; - - // The MM puzzle has gaps - if (!useNormalSolver) - { - value /= 2; - } - - convertedItems[i] = value; - } - else - { - convertedItems[i] = BLANK_TILE_VALUE; - } - } - - return convertedItems; - } - - private void cacheItems(int[] items) - { - cachedItems = new int[items.length]; - System.arraycopy(items, 0, cachedItems, 0, cachedItems.length); - } - - private void solve(int[] items, boolean useNormalSolver) - { - if (solverFuture != null) - { - solverFuture.cancel(true); - } - - PuzzleState puzzleState = new PuzzleState(items); - - if (useNormalSolver) - { - solver = new PuzzleSolver(new IDAStar(new ManhattanDistance()), puzzleState); - } - else - { - solver = new PuzzleSolver(new IDAStarMM(new ManhattanDistance()), puzzleState); - } - - solverFuture = executorService.submit(solver); - } - - private BufferedImage getDownArrow() - { - return spriteManager.getSprite(MINIMAP_DESTINATION_FLAG, 1); - } - - private BufferedImage getUpArrow() - { - if (upArrow == null) - { - upArrow = ImageUtil.rotateImage(getDownArrow(), Math.PI); - } - return upArrow; - } - - private BufferedImage getLeftArrow() - { - if (leftArrow == null) - { - leftArrow = ImageUtil.rotateImage(getDownArrow(), Math.PI / 2); - } - return leftArrow; - } - - private BufferedImage getRightArrow() - { - if (rightArrow == null) - { - rightArrow = ImageUtil.rotateImage(getDownArrow(), 3 * Math.PI / 2); - } - return rightArrow; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/PuzzleSolverPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/PuzzleSolverPlugin.java deleted file mode 100644 index 7fc3645b66..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/PuzzleSolverPlugin.java +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.puzzlesolver; - -import com.google.inject.Provides; -import java.awt.Color; -import java.util.Arrays; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import static net.runelite.api.widgets.WidgetInfo.LIGHT_BOX_BUTTON_A; -import static net.runelite.api.widgets.WidgetInfo.LIGHT_BOX_BUTTON_B; -import static net.runelite.api.widgets.WidgetInfo.LIGHT_BOX_BUTTON_C; -import static net.runelite.api.widgets.WidgetInfo.LIGHT_BOX_BUTTON_D; -import static net.runelite.api.widgets.WidgetInfo.LIGHT_BOX_BUTTON_E; -import static net.runelite.api.widgets.WidgetInfo.LIGHT_BOX_BUTTON_F; -import static net.runelite.api.widgets.WidgetInfo.LIGHT_BOX_BUTTON_G; -import static net.runelite.api.widgets.WidgetInfo.LIGHT_BOX_BUTTON_H; -import static net.runelite.api.widgets.WidgetInfo.TO_GROUP; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.puzzlesolver.lightbox.Combination; -import net.runelite.client.plugins.puzzlesolver.lightbox.LightBox; -import net.runelite.client.plugins.puzzlesolver.lightbox.LightboxSolution; -import net.runelite.client.plugins.puzzlesolver.lightbox.LightboxSolver; -import net.runelite.client.plugins.puzzlesolver.lightbox.LightboxState; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.util.ColorUtil; - -@PluginDescriptor( - name = "Puzzle Solver", - description = "Show you where to click to solve puzzle boxes", - tags = {"clues", "scrolls", "overlay"}, - type = PluginType.UTILITY -) -@Slf4j -@Singleton -public class PuzzleSolverPlugin extends Plugin -{ - private static final Color CORRECT_MUSEUM_PUZZLE_ANSWER_COLOR = new Color(0, 248, 128); - - @Inject - private OverlayManager overlayManager; - - @Inject - private PuzzleSolverOverlay overlay; - - @Inject - private Client client; - - @Inject - private PuzzleSolverConfig config; - - private LightboxState lightbox; - private final LightboxState[] changes = new LightboxState[LightBox.COMBINATIONS_POWER]; - private Combination lastClick; - private boolean lastClickInvalid; - - @Getter(AccessLevel.PACKAGE) - private boolean displaySolution; - @Getter(AccessLevel.PACKAGE) - private boolean displayRemainingMoves; - @Getter(AccessLevel.PACKAGE) - private boolean drawDots; - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - } - - @Provides - PuzzleSolverConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(PuzzleSolverConfig.class); - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded widget) - { - if (widget.getGroupId() != WidgetID.VARROCK_MUSEUM_QUIZ_GROUP_ID) - { - return; - } - - final Widget questionWidget = client.getWidget(WidgetInfo.VARROCK_MUSEUM_QUESTION); - - if (questionWidget == null) - { - return; - } - - final Widget answerWidget = VarrockMuseumAnswer.findCorrect( - client, - questionWidget.getText(), - WidgetInfo.VARROCK_MUSEUM_FIRST_ANSWER, - WidgetInfo.VARROCK_MUSEUM_SECOND_ANSWER, - WidgetInfo.VARROCK_MUSEUM_THIRD_ANSWER); - - if (answerWidget == null) - { - return; - } - - final String answerText = answerWidget.getText(); - if (answerText.equals(Text.removeTags(answerText))) - { - answerWidget.setText(ColorUtil.wrapWithColorTag(answerText, CORRECT_MUSEUM_PUZZLE_ANSWER_COLOR)); - } - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked menuOptionClicked) - { - int widgetId = menuOptionClicked.getParam1(); - if (TO_GROUP(widgetId) != WidgetID.LIGHT_BOX_GROUP_ID) - { - return; - } - - Combination combination; - if (widgetId == LIGHT_BOX_BUTTON_A.getId()) - { - combination = Combination.A; - } - else if (widgetId == LIGHT_BOX_BUTTON_B.getId()) - { - combination = Combination.B; - } - else if (widgetId == LIGHT_BOX_BUTTON_C.getId()) - { - combination = Combination.C; - } - else if (widgetId == LIGHT_BOX_BUTTON_D.getId()) - { - combination = Combination.D; - } - else if (widgetId == LIGHT_BOX_BUTTON_E.getId()) - { - combination = Combination.E; - } - else if (widgetId == LIGHT_BOX_BUTTON_F.getId()) - { - combination = Combination.F; - } - else if (widgetId == LIGHT_BOX_BUTTON_G.getId()) - { - combination = Combination.G; - } - else if (widgetId == LIGHT_BOX_BUTTON_H.getId()) - { - combination = Combination.H; - } - else - { - return; - } - - if (lastClick != null) - { - lastClickInvalid = true; - } - else - { - lastClick = combination; - } - } - - @Subscribe - public void onGameTick(GameTick event) - { - Widget lightboxWidget = client.getWidget(WidgetInfo.LIGHT_BOX_CONTENTS); - if (lightboxWidget == null) - { - if (lightbox != null) - { - lastClick = null; - lastClickInvalid = false; - lightbox = null; - Arrays.fill(changes, null); - } - return; - } - - // get current state from widget - LightboxState lightboxState = new LightboxState(); - int index = 0; - for (Widget light : lightboxWidget.getDynamicChildren()) - { - boolean lit = light.getItemId() == LightBox.LIGHT_BULB_ON; - lightboxState.setState(index / LightBox.WIDTH, index % LightBox.HEIGHT, lit); - index++; - } - - if (lightboxState.equals(lightbox)) - { - return; // no change - } - - log.debug("Lightbox changed!"); - - LightboxState prev = lightbox; - lightbox = lightboxState; - - if (lastClick == null || lastClickInvalid) - { - lastClick = null; - lastClickInvalid = false; - return; - } - - LightboxState diff = lightboxState.diff(prev); - changes[lastClick.ordinal()] = diff; - - log.debug("Recorded diff for {}", lastClick); - lastClick = null; - - // try to solve - LightboxSolver solver = new LightboxSolver(); - solver.setInitial(lightbox); - int idx = 0; - for (LightboxState state : changes) - { - if (state != null) - { - Combination combination = Combination.values()[idx]; - solver.setSwitchChange(combination, state); - } - ++idx; - } - - LightboxSolution solution = solver.solve(); - if (solution != null) - { - log.debug("Got solution: {}", solution); - } - - // Set solution to title - Widget lightbox = client.getWidget(WidgetInfo.LIGHT_BOX); - if (lightbox != null) - { - Widget title = lightbox.getChild(1); - if (solution != null && solution.numMoves() > 0) - { - title.setText("Light box - Solution: " + solution); - } - else if (solution != null) - { - title.setText("Light box - Solution: solved!"); - } - else - { - title.setText("Light box - Solution: unknown"); - } - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("puzzlesolver")) - { - updateConfig(); - } - } - - private void updateConfig() - { - this.displaySolution = config.displaySolution(); - this.displayRemainingMoves = config.displayRemainingMoves(); - this.drawDots = config.drawDots(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/VarrockMuseumAnswer.java b/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/VarrockMuseumAnswer.java deleted file mode 100644 index 985b3a6b4e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/VarrockMuseumAnswer.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2018, Viktor - * Copyright (c) 2018, Tomas Slusny - * 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.puzzlesolver; - -import com.google.common.collect.ImmutableMap; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.api.Client; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; - -@Getter(AccessLevel.PACKAGE) -@RequiredArgsConstructor -enum VarrockMuseumAnswer -{ - LIZARD_1("How does a lizard regulate body heat?", "Sunlight."), - LIZARD_2("Who discovered how to kill lizards?", "The Slayer Masters."), - LIZARD_3("How many eyes does a lizard have?", "Three."), - LIZARD_4("What order do lizards belong to?", "Squamata."), - LIZARD_5("What happens when a lizard becomes cold?", "It becomes sleepy."), - LIZARD_6("Lizard skin is made of the same substance as?", "Hair."), - - TORTOISE_1("What is the name of the oldest tortoise ever recorded?", "Mibbiwocket."), - TORTOISE_2("What is a tortoise's favourite food?", "Vegetables."), - TORTOISE_3("Name the explorer who discovered the world's oldest tortoise.", "Admiral Bake."), - TORTOISE_4("How does the tortoise protect itself?", "Hard shell."), - TORTOISE_5("If a tortoise had twenty rings on its shell, how old would it be?", "Twenty years."), - TORTOISE_6("Which race breeds tortoises for battle?", "Gnomes."), - - DRAGON_1("What is considered a delicacy by dragons?", "Runite."), - DRAGON_2("What is the best defence against a dragon's attack?", "Anti dragon-breath shield."), - DRAGON_3("How long do dragons live?", "Unknown."), - DRAGON_4("Which of these is not a type of dragon?", "Elemental."), - DRAGON_5("What is the favoured territory of a dragon?", "Old battle sites."), - DRAGON_6("Approximately how many feet tall do dragons stand?", "Twelve."), - - WYVERN_1("How did the wyverns die out?", "Climate change."), - WYVERN_2("How many legs does a wyvern have?", "Two."), - WYVERN_3("Where have wyvern bones been found?", "Asgarnia."), - WYVERN_4("Which genus does the wyvern theoretically belong to?", "Reptiles."), - WYVERN_5("What are the wyverns' closest relations?", "Dragons."), - WYVERN_6("What is the ambient temperature of wyvern bones?", "Below room temperature."), - - SNAIL_1("What is special about the shell of the giant Morytanian snail?", "It is resistant to acid."), - SNAIL_2("How do Morytanian snails capture their prey?", "Spitting acid."), - SNAIL_3("Which of these is a snail byproduct?", "Fireproof oil."), - SNAIL_4("What does 'Achatina Acidia' mean?", "Acid-spitting snail."), - SNAIL_5("How do snails move?", "Contracting and stretching."), - SNAIL_6("What is the 'trapdoor', which snails use to cover the entrance to their shells called?", "An operculum."), - - SNAKE_1("What is snake venom adapted from?", "Stomach acid."), - SNAKE_2("Aside from their noses, what do snakes use to smell?", "Tongue."), - SNAKE_3("If a snake sticks its tongue out at you, what is it doing?", "Seeing how you smell."), - SNAKE_4("If some snakes use venom to kill their prey, what do other snakes use?", "Constriction."), - SNAKE_5("Lizards and snakes belong to the same order - what is it?", "Squamata."), - SNAKE_6("Which habitat do snakes prefer?", "Anywhere."), - - SLUG_1("We assume that sea slugs have a stinging organ on their soft skin - what is it called?", "Nematocysts."), - SLUG_2("Why has the museum never examined a live sea slug?", "The researchers keep vanishing."), - SLUG_3("What do we think the sea slug feeds upon?", "Seaweed."), - SLUG_4("What are the two fangs presumed to be used for?", "Defense or display."), - SLUG_5("Off of which coastline would you find sea slugs?", "Ardougne."), - SLUG_6("In what way are sea slugs similar to snails?", "They have a hard shell."), - - MONKEY_1("Which type of primates do monkeys belong to?", "Simian."), - MONKEY_2("Which have the lighter colour: Karamjan or Harmless monkeys?", "Harmless."), - MONKEY_3("Monkeys love bananas. What else do they like to eat?", "Bitternuts."), - MONKEY_4("There are two known families of monkeys. One is Karamjan, the other is...?", "Harmless."), - MONKEY_5("What colour mohawk do Karamjan monkeys have?", "Red."), - MONKEY_6("What have Karamjan monkeys taken a deep dislike to?", "Seaweed."), - - KALPHITE_1("Kalphites are ruled by a...?", "Pasha."), - KALPHITE_2("What is the lowest caste in kalphite society?", "Worker."), - KALPHITE_3("What are the armoured plates on a kalphite called?", "Lamellae."), - KALPHITE_4("Are kalphites carnivores, herbivores or omnivores?", "Carnivores."), - KALPHITE_5("What are kalphites assumed to have evolved from?", "Scarab beetles."), - KALPHITE_6("Name the prominent figure in kalphite mythology?", "Scabaras."), - - TERRORBIRD_1("What is a terrorbird's preferred food?", "Anything."), - TERRORBIRD_2("Who use terrorbirds as mounts?", "Gnomes."), - TERRORBIRD_3("Where do terrorbirds get most of their water?", "Eating plants."), - TERRORBIRD_4("How many claws do terrorbirds have?", "Four."), - TERRORBIRD_5("What do terrorbirds eat to aid digestion?", "Stones."), - TERRORBIRD_6("How many teeth do terrorbirds have?", "0."), - - PENGUIN_1("Which sense do penguins rely on when hunting?", "Sight."), - PENGUIN_2("Which skill seems unusual for the penguins to possess?", "Planning."), - PENGUIN_3("How do penguins keep warm?", "A layer of fat."), - PENGUIN_4("What is the preferred climate for penguins?", "Cold."), - PENGUIN_5("Describe the behaviour of penguins?", "Social."), - PENGUIN_6("When do penguins fast?", "During breeding."), - - MOLE_1("What habitat do moles prefer?", "Subterranean."), - MOLE_2("Why are moles considered to be an agricultural pest?", "They dig holes."), - MOLE_3("Who discovered giant moles?", "Wyson the Gardener."), - MOLE_4("What would you call a group of young moles?", "A labour."), - MOLE_5("What is a mole's favourite food?", "Insects and other invertebrates."), - MOLE_6("Which family do moles belong to?", "The Talpidae family."), - - CAMEL_1("What is produced by feeding chilli to a camel?", "Toxic dung."), - CAMEL_2("If an ugthanki has one, how many does a bactrian have?", "Two."), - CAMEL_3("Camels: herbivore, carnivore or omnivore?", "Omnivore."), - CAMEL_4("What is the usual mood for a camel?", "Annoyed."), - CAMEL_5("Where would you find an ugthanki?", "Al Kharid."), - CAMEL_6("Which camel byproduct is known to be very nutritious?", "Milk."), - - LEECH_1("What is the favoured habitat of leeches?", "Water."), - LEECH_2("What shape is the inside of a leech's mouth?", "'Y'-shaped."), - LEECH_3("Which of these is not eaten by leeches?", "Apples."), - LEECH_4("What contributed to the giant growth of Morytanian leeches?", "Environment."), - LEECH_5("What is special about Morytanian leeches?", "They attack by jumping."), - LEECH_6("How does a leech change when it feeds?", "It doubles in size."); - - private static final Map MATCHES; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (VarrockMuseumAnswer varrockMuseumAnswer : VarrockMuseumAnswer.values()) - { - builder.put(varrockMuseumAnswer.question, varrockMuseumAnswer.answer); - } - - MATCHES = builder.build(); - } - - private final String question; - private final String answer; - - static Widget findCorrect(final Client client, final String question, final WidgetInfo... widgets) - { - final String s = MATCHES.get(question); - - for (WidgetInfo widgetInfo : widgets) - { - final Widget widget = client.getWidget(widgetInfo); - - if (widget != null && widget.getText().equals(s)) - { - return widget; - } - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/lightbox/Combination.java b/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/lightbox/Combination.java deleted file mode 100644 index 809a66d9d3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/lightbox/Combination.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2018, 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.puzzlesolver.lightbox; - -public enum Combination -{ - A, B, C, D, E, F, G, H -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/lightbox/LightBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/lightbox/LightBox.java deleted file mode 100644 index e542213356..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/lightbox/LightBox.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2018, 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.puzzlesolver.lightbox; - -public class LightBox -{ - public static final int WIDTH = 5; - public static final int HEIGHT = 5; - public static final int COMBINATIONS_POWER = 8; - public static final int LIGHT_BULB_ON = 20357; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/lightbox/LightboxSolution.java b/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/lightbox/LightboxSolution.java deleted file mode 100644 index bba03c6315..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/lightbox/LightboxSolution.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2018, 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.puzzlesolver.lightbox; - -import lombok.AllArgsConstructor; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; - -@EqualsAndHashCode -@NoArgsConstructor -@AllArgsConstructor -public class LightboxSolution -{ - private int solution; - - public void flip(Combination c) - { - solution ^= (1 << c.ordinal()); - } - - public int numMoves() - { - int count = 0; - int cur = solution; - for (int i = 0; i < Combination.values().length; ++i) - { - count += cur & 1; - cur >>= 1; - } - return count; - } - - @Override - public String toString() - { - StringBuilder stringBuilder = new StringBuilder(); - for (Combination combination : Combination.values()) - { - if (((solution >>> combination.ordinal()) & 1) != 0) - { - stringBuilder.append(combination.name()); - } - } - return stringBuilder.toString(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/lightbox/LightboxSolver.java b/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/lightbox/LightboxSolver.java deleted file mode 100644 index 9dcf6b4a7a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/lightbox/LightboxSolver.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2018, 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.puzzlesolver.lightbox; - -public class LightboxSolver -{ - private LightboxState initial; - private final LightboxState[] switches = new LightboxState[LightBox.COMBINATIONS_POWER]; - - private static boolean isBitSet(int num, int bit) - { - return ((num >>> bit) & 1) != 0; - } - - private static boolean isSolved(LightboxState s) - { - for (int i = 0; i < LightBox.WIDTH; ++i) - { - for (int j = 0; j < LightBox.HEIGHT; ++j) - { - if (!s.getState(i, j)) - { - return false; - } - } - } - return true; - } - - public LightboxSolution solve() - { - LightboxSolution solution = null; - outer: - for (int i = 0; i < Math.pow(2, LightBox.COMBINATIONS_POWER); ++i) - { - LightboxState s = initial; - - for (int bit = 0; bit < LightBox.COMBINATIONS_POWER; ++bit) - { - if (isBitSet(i, bit)) - { - // this switch is unknown, so this can't be a valid answer - if (switches[bit] == null) - { - continue outer; - } - - s = s.diff(switches[bit]); - } - } - - if (isSolved(s)) - { - LightboxSolution sol = new LightboxSolution(i); - if (solution == null || sol.numMoves() < solution.numMoves()) - { - solution = sol; - } - } - } - - return solution; - } - - public void setInitial(LightboxState initial) - { - this.initial = initial; - } - - public void setSwitchChange(Combination combination, LightboxState newState) - { - switches[combination.ordinal()] = newState; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/lightbox/LightboxState.java b/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/lightbox/LightboxState.java deleted file mode 100644 index df690c1b74..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/lightbox/LightboxState.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2018, 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.puzzlesolver.lightbox; - -import lombok.EqualsAndHashCode; - -@EqualsAndHashCode -public class LightboxState -{ - private final boolean[][] state = new boolean[LightBox.WIDTH][LightBox.HEIGHT]; - - public void setState(int x, int y, boolean s) - { - state[x][y] = s; - } - - public boolean getState(int x, int y) - { - return state[x][y]; - } - - public LightboxState diff(LightboxState other) - { - LightboxState newState = new LightboxState(); - - for (int i = 0; i < LightBox.WIDTH; ++i) - { - for (int j = 0; j < LightBox.HEIGHT; ++j) - { - newState.state[i][j] = state[i][j] ^ other.state[i][j]; - } - } - - return newState; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/PuzzleSolver.java b/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/PuzzleSolver.java deleted file mode 100644 index 5270bcd452..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/PuzzleSolver.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.puzzlesolver.solver; - -import com.google.common.base.Stopwatch; -import java.time.Duration; -import java.util.List; -import net.runelite.client.plugins.puzzlesolver.solver.pathfinding.Pathfinder; - -public class PuzzleSolver implements Runnable -{ - public static final int DIMENSION = 5; - public static final int BLANK_TILE_VALUE = -1; - - private static final Duration MAX_WAIT_DURATION = Duration.ofMillis(1500); - - private final Pathfinder pathfinder; - private final PuzzleState startState; - - private List solution; - private int position; - private Stopwatch stopwatch; - private boolean failed = false; - - public PuzzleSolver(Pathfinder pathfinder, PuzzleState startState) - { - this.pathfinder = pathfinder; - this.startState = startState; - } - - public PuzzleState getStep(int stepIdx) - { - return solution.get(stepIdx); - } - - public int getStepCount() - { - return solution.size(); - } - - public boolean hasSolution() - { - return solution != null; - } - - public int getPosition() - { - return position; - } - - public void setPosition(int position) - { - this.position = position; - } - - public boolean hasExceededWaitDuration() - { - return stopwatch != null && stopwatch.elapsed().compareTo(MAX_WAIT_DURATION) > 0; - } - - public boolean hasFailed() - { - return failed; - } - - @Override - public void run() - { - stopwatch = Stopwatch.createStarted(); - solution = pathfinder.computePath(startState); - failed = solution == null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/PuzzleState.java b/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/PuzzleState.java deleted file mode 100644 index 0946c504ab..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/PuzzleState.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.puzzlesolver.solver; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import static net.runelite.client.plugins.puzzlesolver.solver.PuzzleSolver.BLANK_TILE_VALUE; -import static net.runelite.client.plugins.puzzlesolver.solver.PuzzleSolver.DIMENSION; -import net.runelite.client.plugins.puzzlesolver.solver.heuristics.Heuristic; - -public class PuzzleState -{ - private PuzzleState parent; - - private int[] pieces; - private int emptyPiece = -1; - - private int h = -1; - - public PuzzleState(int[] pieces) - { - if (pieces == null) - { - throw new IllegalStateException("Pieces cannot be null"); - } - - if (DIMENSION * DIMENSION != pieces.length) - { - throw new IllegalStateException("Piece array does not have the right dimensions"); - } - - this.pieces = pieces; - findEmptyPiece(); - } - - private PuzzleState(PuzzleState state) - { - this.pieces = Arrays.copyOf(state.pieces, state.pieces.length); - this.emptyPiece = state.emptyPiece; - } - - private void findEmptyPiece() - { - for (int i = 0; i < pieces.length; i++) - { - if (pieces[i] == BLANK_TILE_VALUE) - { - this.emptyPiece = i; - return; - } - } - throw new IllegalStateException("Incorrect empty piece passed in!"); - } - - public List computeMoves() - { - List moves = new ArrayList<>(); - - int emptyPieceX = emptyPiece % DIMENSION; - int emptyPieceY = emptyPiece / DIMENSION; - - // Move left if there is space to the left - if (emptyPieceX > 0 && (parent == null || parent.emptyPiece != emptyPiece - 1)) - { - PuzzleState state = new PuzzleState(this); - state.parent = this; - - state.pieces[emptyPiece - 1] = BLANK_TILE_VALUE; - state.pieces[emptyPiece] = pieces[emptyPiece - 1]; - state.emptyPiece--; - - moves.add(state); - } - - // Move right if there is space to the right - if (emptyPieceX < DIMENSION - 1 && (parent == null || parent.emptyPiece != emptyPiece + 1)) - { - PuzzleState state = new PuzzleState(this); - state.parent = this; - - state.pieces[emptyPiece + 1] = BLANK_TILE_VALUE; - state.pieces[emptyPiece] = pieces[emptyPiece + 1]; - state.emptyPiece++; - - moves.add(state); - } - - // Move up if there is space upwards - if (emptyPieceY > 0 && (parent == null || parent.emptyPiece != emptyPiece - DIMENSION)) - { - PuzzleState state = new PuzzleState(this); - state.parent = this; - - state.pieces[emptyPiece - DIMENSION] = BLANK_TILE_VALUE; - state.pieces[emptyPiece] = pieces[emptyPiece - DIMENSION]; - state.emptyPiece -= DIMENSION; - - moves.add(state); - } - - // Move down if there is space downwards - if (emptyPieceY < DIMENSION - 1 && (parent == null || parent.emptyPiece != emptyPiece + DIMENSION)) - { - PuzzleState state = new PuzzleState(this); - state.parent = this; - - state.pieces[emptyPiece + DIMENSION] = BLANK_TILE_VALUE; - state.pieces[emptyPiece] = pieces[emptyPiece + DIMENSION]; - state.emptyPiece += DIMENSION; - - moves.add(state); - } - - return moves; - } - - public PuzzleState getParent() - { - return parent; - } - - public boolean hasPieces(int[] pieces) - { - return Arrays.equals(pieces, this.pieces); - } - - public int getPiece(int x, int y) - { - return pieces[y * DIMENSION + x]; - } - - public int getEmptyPiece() - { - return emptyPiece; - } - - public int getHeuristicValue(Heuristic heuristic) - { - if (h == -1) - { - // cache the value - h = heuristic.computeValue(this); - } - - return h; - } - - public PuzzleState swap(int x1, int y1, int x2, int y2) - { - int val1 = getPiece(x1, y1); - int val2 = getPiece(x2, y2); - - if (!isValidSwap(x1, y1, x2, y2)) - { - throw new IllegalStateException(String.format("Invalid swap: (%1$d, %2$d), (%3$d, %4$d)", x1, y1, x2, y2)); - } - - PuzzleState newState = new PuzzleState(this); - - newState.pieces[y1 * DIMENSION + x1] = val2; - newState.pieces[y2 * DIMENSION + x2] = val1; - newState.findEmptyPiece(); - - return newState; - } - - private boolean isValidSwap(int x1, int y1, int x2, int y2) - { - int absX = Math.abs(x1 - x2); - int absY = Math.abs(y1 - y2); - - if (getPiece(x1, y1) != BLANK_TILE_VALUE && getPiece(x2, y2) != BLANK_TILE_VALUE) - { - return false; - } - - if (x1 == x2 && absY == 1) - { - return true; - } - - return y1 == y2 && absX == 1; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/PuzzleSwapPattern.java b/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/PuzzleSwapPattern.java deleted file mode 100644 index 4c248e711e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/PuzzleSwapPattern.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2018, Steffen Hauge - * 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.puzzlesolver.solver; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@RequiredArgsConstructor -@Getter(AccessLevel.PUBLIC) -public enum PuzzleSwapPattern -{ - ROTATE_LEFT_UP(new int[]{1, -1, 0, -1, -1, -1, -1, 0}, 1, 1), //Reference point - ROTATE_LEFT_DOWN(1, -1), - ROTATE_RIGHT_UP(-1, 1), - ROTATE_RIGHT_DOWN(-1, -1), - ROTATE_UP_LEFT(new int[]{-1, 1, -1, 0, -1, -1, 0, -1}, 1, 1), //Reference point - ROTATE_UP_RIGHT(-1, 1), - ROTATE_DOWN_LEFT(1, -1), - ROTATE_DOWN_RIGHT(-1, -1), - LAST_PIECE_ROW(new int[]{-1, -1, 0, -1, -1, 0, -1, 1}, 1, 1), - LAST_PIECE_COLUMN(new int[]{-1, -1, -1, 0, 0, -1, 1, -1}, 1, 1), - SHUFFLE_UP_RIGHT(new int[]{1, -1, 0, -1}, 1, 1), - SHUFFLE_UP_LEFT(new int[]{-1, -1, 0, -1}, 1, 1), - SHUFFLE_UP_BELOW(new int[]{-1, 1, -1, 0}, 1, 1), - SHUFFLE_UP_ABOVE(new int[]{-1, -1, -1, 0}, 1, 1); - - /** - * Points used for swaps relative to locVal - */ - private final int[] points; - /** - * Modifier for X coordinate - */ - private final int modX; - /** - * Modifier for Y coordinate - */ - private final int modY; - - PuzzleSwapPattern(int modX, int modY) - { - this(null, modX, modY); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/heuristics/Heuristic.java b/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/heuristics/Heuristic.java deleted file mode 100644 index b450280992..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/heuristics/Heuristic.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.puzzlesolver.solver.heuristics; - -import net.runelite.client.plugins.puzzlesolver.solver.PuzzleState; - -public interface Heuristic -{ - int computeValue(PuzzleState state); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/heuristics/ManhattanDistance.java b/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/heuristics/ManhattanDistance.java deleted file mode 100644 index 72c97d9265..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/heuristics/ManhattanDistance.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * Copyright (c) 2018, Henke - * 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.client.plugins.puzzlesolver.solver.heuristics; - -import static net.runelite.client.plugins.puzzlesolver.solver.PuzzleSolver.BLANK_TILE_VALUE; -import static net.runelite.client.plugins.puzzlesolver.solver.PuzzleSolver.DIMENSION; -import net.runelite.client.plugins.puzzlesolver.solver.PuzzleState; - -/** - * An implementation of the manhattan distance heuristic function. - *

- * https://heuristicswiki.wikispaces.com/Manhattan+Distance - */ -public class ManhattanDistance implements Heuristic -{ - @Override - public int computeValue(PuzzleState state) - { - int value = 0; - - PuzzleState parent = state.getParent(); - - if (parent == null) - { - for (int x = 0; x < DIMENSION; x++) - { - for (int y = 0; y < DIMENSION; y++) - { - int piece = state.getPiece(x, y); - - if (piece == BLANK_TILE_VALUE) - { - continue; - } - - int goalX = piece % DIMENSION; - int goalY = piece / DIMENSION; - - value += Math.abs(x - goalX) + Math.abs(y - goalY); - } - } - } - else - { - /* - If the Manhattan distance for the parent has already been - calculated, we can take advantage of that and just - add/subtract from their heuristic value. - - Doing this decreases the execution time of the heuristic by about 25%. - */ - value = parent.getHeuristicValue(this); - - int x = parent.getEmptyPiece() % DIMENSION; - int y = parent.getEmptyPiece() / DIMENSION; - - int x2 = state.getEmptyPiece() % DIMENSION; - int y2 = state.getEmptyPiece() / DIMENSION; - - int piece = state.getPiece(x, y); - - if (x2 > x) - { - int targetX = piece % DIMENSION; - - // right - if (targetX > x) - { - value++; - } - else - { - value--; - } - } - else if (x2 < x) - { - int targetX = piece % DIMENSION; - - // left - if (targetX < x) - { - value++; - } - else - { - value--; - } - } - else if (y2 > y) - { - int targetY = piece / DIMENSION; - - // down - if (targetY > y) - { - value++; - } - else - { - value--; - } - } - else - { - int targetY = piece / DIMENSION; - - // up - if (targetY < y) - { - value++; - } - else - { - value--; - } - } - } - - return value; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/pathfinding/IDAStar.java b/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/pathfinding/IDAStar.java deleted file mode 100644 index fbd451b515..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/pathfinding/IDAStar.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.puzzlesolver.solver.pathfinding; - -import java.util.ArrayList; -import java.util.List; -import net.runelite.client.plugins.puzzlesolver.solver.PuzzleState; -import net.runelite.client.plugins.puzzlesolver.solver.heuristics.Heuristic; - -/** - * An implementation of the IDA* algorithm. - *

- * https://en.wikipedia.org/wiki/Iterative_deepening_A* - */ -public class IDAStar extends Pathfinder -{ - public IDAStar(Heuristic heuristic) - { - super(heuristic); - } - - @Override - public List computePath(PuzzleState root) - { - PuzzleState goalNode = path(root); - - List path = new ArrayList<>(); - - PuzzleState parent = goalNode; - while (parent != null) - { - path.add(0, parent); - parent = parent.getParent(); - } - - return path; - } - - private PuzzleState path(PuzzleState root) - { - int bound = root.getHeuristicValue(getHeuristic()); - - while (true) - { - PuzzleState t = search(root, 0, bound); - - if (t != null) - { - return t; - } - - bound += 1; - } - } - - private PuzzleState search(PuzzleState node, int g, int bound) - { - int h = node.getHeuristicValue(getHeuristic()); - int f = g + h; - - if (f > bound) - { - return null; - } - - if (h == 0) - { - return node; - } - - for (PuzzleState successor : node.computeMoves()) - { - PuzzleState t = search(successor, g + 1, bound); - - if (t != null) - { - return t; - } - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/pathfinding/IDAStarMM.java b/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/pathfinding/IDAStarMM.java deleted file mode 100644 index c066d5f20b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/pathfinding/IDAStarMM.java +++ /dev/null @@ -1,716 +0,0 @@ -/* - * Copyright (c) 2018, Steffen Hauge - * 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.puzzlesolver.solver.pathfinding; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import net.runelite.api.Point; -import static net.runelite.client.plugins.puzzlesolver.solver.PuzzleSolver.BLANK_TILE_VALUE; -import static net.runelite.client.plugins.puzzlesolver.solver.PuzzleSolver.DIMENSION; -import net.runelite.client.plugins.puzzlesolver.solver.PuzzleState; -import net.runelite.client.plugins.puzzlesolver.solver.PuzzleSwapPattern; -import static net.runelite.client.plugins.puzzlesolver.solver.PuzzleSwapPattern.*; -import net.runelite.client.plugins.puzzlesolver.solver.heuristics.Heuristic; - -public class IDAStarMM extends IDAStar -{ - private PuzzleState currentState; - private final List stateList = new ArrayList<>(); - private final List> validRowNumbers = new ArrayList<>(); - private final List> validColumnNumbers = new ArrayList<>(); - - public IDAStarMM(Heuristic heuristic) - { - super(heuristic); - - //Add valid numbers for rows and columns - validRowNumbers.add(Arrays.asList(0, 1, 2, 3, 4)); - validRowNumbers.add(Arrays.asList(6, 7, 8, 9)); - validColumnNumbers.add(Arrays.asList(5, 10, 15, 20)); - } - - @Override - public List computePath(PuzzleState root) - { - currentState = root; - stateList.add(root); - - List path = new ArrayList<>(); - - //Reduce to 4x5 - solveRow(0); - - //Reduce to 4x4 - solveColumn(); - - //Reduce to 3x4 - solveRow(1); - - //Remove last state - stateList.remove(stateList.size() - 1); - - //Pathfinder for 4x4 - path.addAll(super.computePath(currentState)); - - path.addAll(0, stateList); - - return path; - } - - private void solveRow(int row) - { - for (int i = row; i < DIMENSION; i++) - { - int valTarget = row * DIMENSION + i; - - int valCurrent = currentState.getPiece(i, row); - - if (valCurrent != valTarget) - { - moveTowardsVal(valTarget, i, row, true); - } - } - } - - private void solveColumn() - { - int column = 0; - - for (int i = column + 1; i < DIMENSION; i++) - { - int valTarget = column + i * DIMENSION; - - int valCurrent = currentState.getPiece(column, i); - - if (valCurrent != valTarget) - { - moveTowardsVal(valTarget, column, i, false); - } - } - } - - private void moveTowardsVal(int valTarget, int x, int y, boolean rowMode) - { - //Not in place - boolean reached = false; - - while (currentState.getPiece(x, y) != valTarget) - { - //Find piece location - Point locVal = findPiece(valTarget); - Point locBlank = findPiece(BLANK_TILE_VALUE); - - if (reached) - { - //Swap towards locTarget - if (rowMode) - { - alignTargetX(valTarget, x, y); - swapUpRow(valTarget, x, y); - } - else - { - alignTargetY(valTarget, x, y); - swapLeftColumn(valTarget, x, y); - } - } - else - { - int distX = locVal.getX() - locBlank.getX(); - int distY = locVal.getY() - locBlank.getY(); - int distAbsX = Math.abs(distX); - int distAbsY = Math.abs(distY); - - if (distX == 0) - { - //Same column - if (distAbsY == 1) - { - //Next to - reached = true; - } - else - { - //More than 2 away, move towards on Y-axis - if (distY >= 2) - { - Point locSwap = new Point(locBlank.getX(), locBlank.getY() + 1); - swap(locBlank, locSwap); - } - else if (distY <= -2) - { - Point locSwap = new Point(locBlank.getX(), locBlank.getY() - 1); - swap(locBlank, locSwap); - } - } - } - else if (distY == 0) - { - //Same row - if (distAbsX == 1) - { - //Next to - reached = true; - } - else - { - //More than 2 away, move towards on X-axis - if (distX >= 2) - { - Point locSwap = new Point(locBlank.getX() + 1, locBlank.getY()); - swap(locBlank, locSwap); - } - else if (distX <= -2) - { - Point locSwap = new Point(locBlank.getX() - 1, locBlank.getY()); - swap(locBlank, locSwap); - } - } - } - else - { - //Different row and column - if (rowMode) - { - //Check if already correct above - if (locBlank.getY() - 1 == y - && validRowNumbers.get(y).contains(currentState.getPiece(locBlank.getX(), locBlank.getY() - 1)) - && currentState.getPiece(locBlank.getX(), locBlank.getY() - 1) < valTarget - && distY <= -1) - { - //Move forward - Point locSwap = new Point(locBlank.getX() + 1, locBlank.getY()); - swap(locBlank, locSwap); - continue; - } - - //Move downwards or upwards - if (distY >= 1) - { - Point locSwap = new Point(locBlank.getX(), locBlank.getY() + 1); - swap(locBlank, locSwap); - } - else - { - Point locSwap = new Point(locBlank.getX(), locBlank.getY() - 1); - swap(locBlank, locSwap); - } - } - else - { - //Check if already correct to the left - if (locBlank.getX() - 1 == x - && validColumnNumbers.get(x).contains(currentState.getPiece(locBlank.getX() - 1, locBlank.getY())) - && currentState.getPiece(locBlank.getX() - 1, locBlank.getY()) < valTarget - && distX <= -1) - { - //Move down - Point locSwap = new Point(locBlank.getX(), locBlank.getY() + 1); - swap(locBlank, locSwap); - continue; - } - - //Move right or left - if (distX >= 1) - { - Point locSwap = new Point(locBlank.getX() + 1, locBlank.getY()); - swap(locBlank, locSwap); - } - else - { - Point locSwap = new Point(locBlank.getX() - 1, locBlank.getY()); - swap(locBlank, locSwap); - } - } - } - } - } - } - - private void alignTargetX(int valTarget, int x, int y) - { - Point locVal = findPiece(valTarget); - - //Check if same column - if (locVal.getX() == x) - { - return; - } - - //1 = right, -1 = left - int direction = Integer.signum(x - locVal.getX()); - - while (locVal.getX() != x) - { - locVal = findPiece(valTarget); - Point locBlank = findPiece(BLANK_TILE_VALUE); - - //Check if aligned - if (x - locVal.getX() == 0) - { - break; - } - - if (locVal.getX() == locBlank.getX()) - { - int diff = locBlank.getY() - locVal.getY(); - if (diff == 1) - { - //Below - Point loc1 = new Point(locBlank.getX() + direction, locBlank.getY()); - Point loc2 = new Point(loc1.getX(), loc1.getY() - 1); - - swap(locBlank, loc1); - swap(loc1, loc2); - swap(loc2, locVal); - } - else if (diff == -1) - { - //Above - swap(locBlank, locVal); - } - } - else if (locVal.getY() == locBlank.getY()) - { - int diff = locBlank.getX() - locVal.getX(); - if (diff == 1) - { - //Right - if (direction == 1) - { - swap(locVal, locBlank); - } - else if (direction == -1) - { - //Check space - if (locVal.getY() == DIMENSION - 1) - { - //No space below, use upper rotate - performSwapPattern(locBlank, locVal, ROTATE_LEFT_UP); - } - else - { - //Space below, use lower rotate - performSwapPattern(locBlank, locVal, ROTATE_LEFT_DOWN); - } - } - } - else if (diff == -1) - { - //Left - if (direction == -1) - { - swap(locVal, locBlank); - } - else if (direction == 1) - { - //Check space - if (locVal.getY() == DIMENSION - 1) - { - //No space below, use upper rotate - performSwapPattern(locBlank, locVal, ROTATE_RIGHT_UP); - } - else - { - //Space below, use lower rotate - performSwapPattern(locBlank, locVal, ROTATE_RIGHT_DOWN); - } - } - } - } - } - } - - //Swaps up until inserted into the correct place - private void swapUpRow(int valTarget, int x, int y) - { - Point locVal = findPiece(valTarget); - Point locBlank = findPiece(BLANK_TILE_VALUE); - - //Check if already placed correct - if (locVal.getX() == x && locVal.getY() == y) - { - return; - } - - //Check if simple swap is enough - if (locBlank.getX() == x && locBlank.getY() == y && locVal.getY() - 1 == y) - { - swap(locBlank, locVal); - return; - } - - //Move up - while (true) - { - locVal = findPiece(valTarget); - locBlank = findPiece(BLANK_TILE_VALUE); - - //Check if already placed correct - if (locVal.getX() == x && locVal.getY() == y) - { - return; - } - - if (locVal.getX() == locBlank.getX()) - { - int diff = locBlank.getY() - locVal.getY(); - if (diff == 1) - { - //Below - - //Last piece - if (x == DIMENSION - 1) - { - performSwapPattern(locBlank, locVal, LAST_PIECE_ROW); - return; - } - - performSwapPattern(locBlank, locVal, ROTATE_UP_RIGHT); - } - else if (diff == -1) - { - //Above - swap(locBlank, locVal); - } - } - else if (locVal.getY() == locBlank.getY()) - { - int diff = locBlank.getX() - locVal.getX(); - if (diff == 1) - { - //Right - performSwapPattern(locBlank, locVal, SHUFFLE_UP_RIGHT); - } - else if (diff == -1) - { - //Left - - //Don't remove correct pieces from row - if (locVal.getY() - 1 == y) - { - //Swap blank to below and continue - Point loc1 = new Point(locBlank.getX(), locBlank.getY() + 1); - Point loc2 = new Point(loc1.getX() + 1, loc1.getY()); - - swap(locBlank, loc1); - swap(loc1, loc2); - - continue; - } - - performSwapPattern(locBlank, locVal, SHUFFLE_UP_LEFT); - } - } - } - } - - private void alignTargetY(int valTarget, int x, int y) - { - Point locVal = findPiece(valTarget); - - //Check if same row - if (locVal.getY() == y) - { - return; - } - - //1 = down, -1 = up - int direction = Integer.signum(y - locVal.getY()); - - while (locVal.getY() != y) - { - locVal = findPiece(valTarget); - Point locBlank = findPiece(BLANK_TILE_VALUE); - - //Check if aligned - if (y - locVal.getY() == 0) - { - break; - } - - if (locVal.getY() == locBlank.getY()) - { - int diff = locBlank.getX() - locVal.getX(); - if (diff == 1) - { - //Right - Point loc1 = new Point(locBlank.getX(), locBlank.getY() + direction); - Point loc2 = new Point(loc1.getX() - 1, loc1.getY()); - - swap(locBlank, loc1); - swap(loc1, loc2); - swap(loc2, locVal); - } - else if (diff == -1) - { - //Left - swap(locBlank, locVal); - } - } - else if (locVal.getX() == locBlank.getX()) - { - int diff = locBlank.getY() - locVal.getY(); - if (diff == 1) - { - //Below - if (direction == 1) - { - swap(locVal, locBlank); - } - else if (direction == -1) - { - //Check space - if (locVal.getX() == DIMENSION - 1) - { - //No space to the right, use left rotate - performSwapPattern(locBlank, locVal, ROTATE_UP_LEFT); - } - else - { - //Space to the right, use right rotate - performSwapPattern(locBlank, locVal, ROTATE_UP_RIGHT); - } - } - } - else if (diff == -1) - { - //Above - if (direction == -1) - { - swap(locVal, locBlank); - } - else if (direction == 1) - { - //Check space - if (locVal.getX() == DIMENSION - 1) - { - //No space to the right, use left rotate - performSwapPattern(locBlank, locVal, ROTATE_DOWN_LEFT); - } - else - { - //Space to the right, use right rotate - performSwapPattern(locBlank, locVal, ROTATE_DOWN_RIGHT); - } - } - } - } - } - } - - //Swaps left until inserted into the correct place - private void swapLeftColumn(int valTarget, int x, int y) - { - Point locVal = findPiece(valTarget); - Point locBlank = findPiece(BLANK_TILE_VALUE); - - //Check if already placed correct - if (locVal.getX() == x && locVal.getY() == y) - { - return; - } - - //Check if simple swap is enough - if (locBlank.getX() == x && locBlank.getY() == y && locVal.getX() - 1 == x) - { - swap(locBlank, locVal); - return; - } - - //Move left - while (true) - { - locVal = findPiece(valTarget); - locBlank = findPiece(BLANK_TILE_VALUE); - - //Check if already placed correct - if (locVal.getX() == x && locVal.getY() == y) - { - return; - } - - if (locVal.getX() == locBlank.getX()) - { - int diff = locBlank.getY() - locVal.getY(); - if (diff == 1) - { - //Below - performSwapPattern(locBlank, locVal, SHUFFLE_UP_BELOW); - } - else if (diff == -1) - { - //Above - - //Don't remove correct pices from row - if (locVal.getX() - 1 == x) - { - //Swap blank to right and continue - Point loc1 = new Point(locBlank.getX() + 1, locBlank.getY()); - Point loc2 = new Point(loc1.getX(), loc1.getY() + 1); - - swap(locBlank, loc1); - swap(loc1, loc2); - - continue; - } - - performSwapPattern(locBlank, locVal, SHUFFLE_UP_ABOVE); - } - } - else if (locVal.getY() == locBlank.getY()) - { - int diff = locBlank.getX() - locVal.getX(); - if (diff == 1) - { - //Right - - //Last piece - if (y == DIMENSION - 1) - { - performSwapPattern(locBlank, locVal, LAST_PIECE_COLUMN); - return; - } - - performSwapPattern(locBlank, locVal, ROTATE_LEFT_DOWN); - } - else if (diff == -1) - { - //Left - swap(locBlank, locVal); - } - } - } - } - - private void swap(Point p1, Point p2) - { - PuzzleState newState = currentState.swap(p1.getX(), p1.getY(), p2.getX(), p2.getY()); - - currentState = newState; - stateList.add(newState); - } - - private Point findPiece(int val) - { - for (int x = 0; x < DIMENSION; x++) - { - for (int y = 0; y < DIMENSION; y++) - { - if (currentState.getPiece(x, y) == val) - { - return new Point(x, y); - } - } - } - // This should never happen - throw new IllegalStateException("Piece wasn't found!"); - } - - /** - * Assumes locBlank is first point for swap and locVal is last point for swap - *

- * swap(locBlank, loc1); - * swap(loc1, loc2); - * swap(loc2, locVal); - */ - private void performSwapPattern(Point locBlank, Point locVal, PuzzleSwapPattern pattern) - { - int[] offsets; - switch (pattern) - { - case ROTATE_LEFT_UP: - case ROTATE_RIGHT_UP: - case ROTATE_RIGHT_DOWN: - case ROTATE_LEFT_DOWN: - offsets = ROTATE_LEFT_UP.getPoints(); - break; - case ROTATE_UP_LEFT: - case ROTATE_UP_RIGHT: - case ROTATE_DOWN_LEFT: - case ROTATE_DOWN_RIGHT: - offsets = ROTATE_UP_LEFT.getPoints(); - break; - default: - offsets = pattern.getPoints(); - } - - if (offsets == null || offsets.length % 2 == 1) - { - // This should never happen - throw new IllegalStateException("Unexpected points given in pattern!"); - } - - int modX = pattern.getModX(); - int modY = pattern.getModY(); - - ArrayList points = new ArrayList<>(); - - for (int i = 0; i < offsets.length; i += 2) - { - int x = locVal.getX() + modX * offsets[i]; - int y = locVal.getY() + modY * offsets[i + 1]; - - points.add(new Point(x, y)); - } - - // Add locVal as last point - points.add(locVal); - - if (pattern != LAST_PIECE_ROW && pattern != LAST_PIECE_COLUMN) - { - Point start = locBlank; - for (Point p : points) - { - swap(start, p); - start = p; - } - } - else - { - Point loc1 = points.get(0); - Point loc2 = points.get(1); - Point loc3 = points.get(2); - Point loc4 = points.get(3); - - swap(locBlank, locVal); - swap(locVal, loc3); - swap(loc3, loc1); - swap(loc1, loc2); - swap(loc2, locVal); - swap(locVal, loc3); - swap(loc3, loc1); - swap(loc1, loc2); - swap(loc2, locVal); - swap(locVal, locBlank); - swap(locBlank, loc4); - swap(loc4, loc3); - swap(loc3, loc1); - swap(loc1, loc2); - swap(loc2, locVal); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/pathfinding/Pathfinder.java b/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/pathfinding/Pathfinder.java deleted file mode 100644 index d742f327cb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/puzzlesolver/solver/pathfinding/Pathfinder.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.puzzlesolver.solver.pathfinding; - -import java.util.List; -import net.runelite.client.plugins.puzzlesolver.solver.PuzzleState; -import net.runelite.client.plugins.puzzlesolver.solver.heuristics.Heuristic; - -public abstract class Pathfinder -{ - private final Heuristic heuristic; - - Pathfinder(Heuristic heuristic) - { - this.heuristic = heuristic; - } - - Heuristic getHeuristic() - { - return heuristic; - } - - public abstract List computePath(PuzzleState start); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/AttackMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/AttackMode.java deleted file mode 100644 index 846388dcde..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/AttackMode.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.pvptools; - -public enum AttackMode -{ - CLAN("Clan"), - FRIENDS("Friends"), - BOTH("Both"); - - private final String name; - - AttackMode(final String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/CurrentPlayersJFrame.java b/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/CurrentPlayersJFrame.java deleted file mode 100644 index dba8be11bd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/CurrentPlayersJFrame.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2019. PKLite - All Rights Reserved - * Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited. - * Proprietary and confidential. Refer to PKLite License file for more information on - * full terms of this copyright and to determine what constitutes authorized use. - * Written by PKLite(ST0NEWALL, others) , 2019 - * - */ - -package net.runelite.client.plugins.pvptools; - -import java.awt.BorderLayout; -import java.awt.Font; -import java.awt.Toolkit; -import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.StringSelection; -import java.awt.event.ActionListener; -import java.util.List; -import javax.inject.Singleton; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import net.runelite.api.Client; -import net.runelite.client.ui.FontManager; - -@Singleton -class CurrentPlayersJFrame extends JFrame -{ - - CurrentPlayersJFrame(final Client client, final PvpToolsPlugin pvpToolsPlugin, final List list) - { - super(); - int x = client.getCanvas().getLocationOnScreen().x + client.getCanvas().getWidth(); - int y = client.getCanvas().getLocationOnScreen().y; - JPanel scrollContainerCurrent = new JPanel(new BorderLayout()); - - JScrollPane jScrollPane = new JScrollPane(scrollContainerCurrent); - JButton refreshJButton = new JButton("Refresh"); - refreshJButton.addActionListener(pvpToolsPlugin.currentPlayersActionListener); - JButton copyJButton = new JButton("Copy List"); - JList currentPlayersJList = new JList<>(list.toArray()); - ActionListener copyButtonActionListener = e -> - { - StringSelection stringSelection; - Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); - StringBuilder stringBuilder = new StringBuilder(); - list.forEach(s -> - { - stringBuilder.append(s); - stringBuilder.append(System.getProperty("line.separator")); - }); - stringSelection = new StringSelection(stringBuilder.toString()); - clipboard.setContents(stringSelection, stringSelection); - }; - copyJButton.addActionListener(copyButtonActionListener); - this.setTitle("Current CC Members"); - this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - JLabel titleLabel = new JLabel("Current CC Members"); - titleLabel.setFont(FontManager.getRunescapeFont().deriveFont(Font.BOLD, 18)); - currentPlayersJList.setFont(new Font("Arial", Font.PLAIN, 14)); - scrollContainerCurrent.add(refreshJButton, BorderLayout.NORTH); - scrollContainerCurrent.add(titleLabel, BorderLayout.CENTER); - JPanel footerPanel = new JPanel(new BorderLayout()); - footerPanel.add(currentPlayersJList, BorderLayout.NORTH); - footerPanel.add(copyJButton, BorderLayout.CENTER); - scrollContainerCurrent.add(footerPanel, BorderLayout.SOUTH); - this.add(jScrollPane); - this.setLocation(x, y); - this.setMaximumSize(Toolkit.getDefaultToolkit().getScreenSize()); - this.pack(); - this.setVisible(true); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/MissingPlayersJFrame.java b/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/MissingPlayersJFrame.java deleted file mode 100644 index 15b34e9f25..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/MissingPlayersJFrame.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2019. PKLite - All Rights Reserved - * Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited. - * Proprietary and confidential. Refer to PKLite License file for more information on - * full terms of this copyright and to determine what constitutes authorized use. - * Written by PKLite(ST0NEWALL, others) , 2019 - * - */ - -package net.runelite.client.plugins.pvptools; - -import java.awt.BorderLayout; -import java.awt.Font; -import java.awt.Toolkit; -import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.StringSelection; -import java.awt.event.ActionListener; -import java.util.List; -import javax.inject.Singleton; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import net.runelite.api.Client; -import net.runelite.client.ui.FontManager; - -@Singleton -class MissingPlayersJFrame extends JFrame -{ - - MissingPlayersJFrame(final Client client, final PvpToolsPlugin pvpToolsPlugin, final List list) - { - super(); - int x = client.getCanvas().getLocationOnScreen().x + client.getCanvas().getWidth(); - int y = client.getCanvas().getLocationOnScreen().y; - JPanel scrollConatiner = new JPanel(new BorderLayout()); - - JScrollPane jScrollPane = new JScrollPane(scrollConatiner); - JButton refreshJButton = new JButton("Refresh"); - refreshJButton.addActionListener(pvpToolsPlugin.playersButtonActionListener); - JButton copyJButton = new JButton("Copy List"); - JList missingPlayersJList = new JList<>(list.toArray()); - ActionListener copyButtonActionListener = e -> - { - StringSelection stringSelection; - Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); - StringBuilder stringBuilder = new StringBuilder(); - list.forEach(s -> - { - stringBuilder.append(s); - stringBuilder.append(System.getProperty("line.separator")); - }); - stringSelection = new StringSelection(stringBuilder.toString()); - clipboard.setContents(stringSelection, stringSelection); - }; - copyJButton.addActionListener(copyButtonActionListener); - this.setTitle("Missing CC Members"); - this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - JLabel titleLabel = new JLabel("Missing CC Members"); - titleLabel.setFont(FontManager.getRunescapeFont().deriveFont(Font.BOLD, 18)); - missingPlayersJList.setFont(new Font("Arial", Font.PLAIN, 14)); - scrollConatiner.add(refreshJButton, BorderLayout.NORTH); - scrollConatiner.add(titleLabel, BorderLayout.CENTER); - JPanel footerPanel = new JPanel(new BorderLayout()); - footerPanel.add(missingPlayersJList, BorderLayout.NORTH); - footerPanel.add(copyJButton, BorderLayout.CENTER); - scrollConatiner.add(footerPanel, BorderLayout.SOUTH); - this.add(jScrollPane); - this.setLocation(x, y); - this.setMaximumSize(Toolkit.getDefaultToolkit().getScreenSize()); - this.pack(); - this.setVisible(true); - } -} 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 deleted file mode 100644 index b465d812a4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PlayerCountOverlay.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * ****************************************************************************** - * * Copyright (c) 2019 openosrs - * * 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 - * * openosrs Discord: https://discord.gg/Q7wFtCe - * * openosrs website: https://openosrs.com - * ***************************************************************************** - */ - -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 javax.inject.Singleton; -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; -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; - -@Singleton -public class PlayerCountOverlay extends Overlay -{ - private static final int[] CLAN_WARS_REGIONS = {9520, 13135, 13134, 13133, 13131, 13130, 13387, 13386}; - - private final PvpToolsPlugin pvpToolsPlugin; - private final Client client; - - - @Inject - public PlayerCountOverlay(final PvpToolsPlugin pvpToolsPlugin, final Client client) - { - this.pvpToolsPlugin = pvpToolsPlugin; - this.client = client; - setLayer(OverlayLayer.ABOVE_WIDGETS); - setPriority(OverlayPriority.HIGHEST); - setPosition(OverlayPosition.TOP_LEFT); - this.setPreferredPosition(OverlayPosition.TOP_LEFT); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (pvpToolsPlugin.isCountPlayers() && - (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); - } - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PvpToolsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PvpToolsConfig.java deleted file mode 100644 index 83e25ffdc6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PvpToolsConfig.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2019. PKLite - All Rights Reserved - * Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited. - * Proprietary and confidential. Refer to PKLite License file for more information on - * full terms of this copyright and to determine what constitutes authorized use. - * Written by PKLite(ST0NEWALL, others) , 2019 - * - */ - -package net.runelite.client.plugins.pvptools; - -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("pvptools") -public interface PvpToolsConfig extends Config -{ - @ConfigItem( - keyName = "countPlayers", - name = "Count Players", - description = "When in PvP zones, counts the attackable players in and not in player's CC", - position = 0 - ) - default boolean countPlayers() - { - return true; - } - - @ConfigItem( - keyName = "countOverHeads", - name = "Count Enemy Overheads", - description = "Counts the number of each protection prayer attackable targets not in your CC are currently using", - position = 1 - ) - default boolean countOverHeads() - { - return true; - } - - @ConfigItem( - keyName = "renderSelfHotkey", - name = "Render Self Hotkey", - description = "Toggles renderself when you press the hotkey", - position = 2 - ) - default Keybind renderSelf() - { - return Keybind.NOT_SET; - } - - @ConfigItem( - keyName = "hideAttack", - name = "Hide attack", - description = "Hides the attack option for clanmates, friends, or both", - position = 3 - ) - default boolean hideAttack() - { - return false; - } - - @ConfigItem( - keyName = "hideAttackMode", - name = "Mode", - description = "", - position = 4, - hidden = true, - unhide = "hideAttack" - ) - default AttackMode hideAttackMode() - { - return AttackMode.FRIENDS; - } - - @ConfigItem( - keyName = "hideCast", - name = "Hide cast", - description = "Hides the cast option for clanmates, friends, or both", - position = 5 - ) - default boolean hideCast() - { - return false; - } - - @ConfigItem( - keyName = "hideCastMode", - name = "Mode", - description = "", - position = 6, - hidden = true, - unhide = "hideCast" - ) - default AttackMode hideCastMode() - { - return AttackMode.FRIENDS; - } - - @ConfigItem( - keyName = "hideCastIgnored", - name = "Ignored spells", - description = "Spells that should not be hidden from being cast, separated by a comma", - position = 7, - hidden = true, - unhide = "hideCast" - ) - default String hideCastIgnored() - { - return "cure other, energy transfer, heal other, vengeance other"; - } - - @ConfigItem( - keyName = "riskCalculator", - name = "Risk Calculator", - description = "Enables a panel in the PvP Tools Panel that shows the players current risk", - position = 8 - ) - default boolean riskCalculatorEnabled() - { - return true; - } - - @ConfigItem( - keyName = "missingPlayers", - name = "Missing CC Players", - description = "Adds a button to the PvP Tools panel that opens a window showing which CC members are not at the current players location", - position = 9 - ) - default boolean missingPlayersEnabled() - { - return true; - } - - @ConfigItem( - keyName = "currentPlayers", - name = "Current CC Players", - description = "Adds a button to the PvP Tools panel that opens a window showing which CC members currently at the players location", - position = 10 - ) - default boolean currentPlayersEnabled() - { - return true; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PvpToolsPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PvpToolsPanel.java deleted file mode 100644 index bcf779909b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PvpToolsPanel.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2019. PKLite - All Rights Reserved - * Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited. - * Proprietary and confidential. Refer to PKLite License file for more information on - * full terms of this copyright and to determine what constitutes authorized use. - * Written by PKLite(ST0NEWALL, others) , 2019 - * - */ - -package net.runelite.client.plugins.pvptools; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Font; -import java.awt.GridLayout; -import javax.inject.Singleton; -import javax.swing.Box; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; -import lombok.extern.slf4j.Slf4j; -import net.runelite.client.plugins.info.JRichTextPane; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.PluginPanel; - -@Slf4j -@Singleton -class PvpToolsPanel extends PluginPanel -{ - - private final JLabel loggedLabel = new JLabel(); - private final JRichTextPane emailLabel = new JRichTextPane(); - final JLabel numCC = new JLabel(); - final JLabel numOther = new JLabel(); - final JLabel numMageJLabel = new JLabel(" "); - final JLabel numRangeJLabel = new JLabel(" "); - final JLabel numMeleeJLabel = new JLabel(" "); - final JLabel totalRiskLabel = new JLabel(" "); - final JLabel riskProtectingItem = new JLabel(" "); - final JLabel biggestItemLabel = new JLabel("Protected Item: "); - final JButton missingPlayers = new JButton("Show missing CC members"); - final JButton currentPlayers = new JButton("Show current CC members"); - private final JLabel numBrews = new JLabel(); - private final JPanel missingPlayersPanel = new JPanel(); - - - public static String htmlLabel(String key, String value) - { - return "" + key + "" + value + ""; - } - - void init() - { - setLayout(new BorderLayout()); - setBackground(ColorScheme.DARK_GRAY_COLOR); - setBorder(new EmptyBorder(10, 10, 10, 10)); - - - JPanel versionPanel = new JPanel(); - versionPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - versionPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); - versionPanel.setLayout(new GridLayout(0, 1)); - - JPanel riskPanel = new JPanel(); - riskPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - riskPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); - riskPanel.setLayout(new GridLayout(0, 1)); - - final Font smallFont = FontManager.getRunescapeSmallFont(); - - numCC.setText(htmlLabel("Friendly Player Count: ", "0")); - numOther.setText(htmlLabel("Other Player Count: ", "0")); - numBrews.setText(htmlLabel("Player brew count: ", "0")); - numMageJLabel.setText(htmlLabel("Enemies Praying Mage: ", "0")); - numMageJLabel.setFont(FontManager.getRunescapeFont()); - numRangeJLabel.setText(htmlLabel("Enemies Praying Range: ", "0")); - numRangeJLabel.setFont(FontManager.getRunescapeFont()); - numMeleeJLabel.setText(htmlLabel("Enemies Praying Melee: ", "0")); - numMeleeJLabel.setFont(FontManager.getRunescapeFont()); - - totalRiskLabel.setText(htmlLabel("Total risk: ", "0")); - totalRiskLabel.setFont(FontManager.getRunescapeFont()); - riskProtectingItem.setText(htmlLabel("Risk Protecting Item: ", "0")); - riskProtectingItem.setFont(FontManager.getRunescapeFont()); - biggestItemLabel.setText("Most Valuable Item: "); - - - JLabel revision = new JLabel(); - revision.setFont(smallFont); - - revision.setText("Oldschool revision: "); - - loggedLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR); - loggedLabel.setFont(smallFont); - - emailLabel.setForeground(Color.WHITE); - emailLabel.setFont(smallFont); - - versionPanel.add(numCC); - versionPanel.add(numOther); - versionPanel.add(numBrews); - versionPanel.add(numMageJLabel); - versionPanel.add(numRangeJLabel); - versionPanel.add(numMeleeJLabel); - - versionPanel.add(Box.createGlue()); - versionPanel.add(loggedLabel); - versionPanel.add(emailLabel); - - riskPanel.add(totalRiskLabel); - riskPanel.add(riskProtectingItem); - riskPanel.add(biggestItemLabel); - - add(versionPanel, BorderLayout.NORTH); - add(riskPanel, BorderLayout.CENTER); - - currentPlayers.setVisible(false); - missingPlayers.setVisible(false); - missingPlayersPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - missingPlayersPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); - missingPlayersPanel.setLayout(new GridLayout(0, 1)); - missingPlayersPanel.add(missingPlayers, BorderLayout.AFTER_LAST_LINE); - missingPlayersPanel.add(currentPlayers, BorderLayout.AFTER_LAST_LINE); - add(missingPlayersPanel, BorderLayout.AFTER_LAST_LINE); - - } - - void disablePlayerCount() - { - this.numOther.setText("Disabled"); - this.numCC.setText("Disabled"); - this.numCC.repaint(); - this.numOther.repaint(); - } - - void disablePrayerCount() - { - this.numMageJLabel.setText("disabled"); - this.numRangeJLabel.setText("disabled"); - this.numMeleeJLabel.setText("disabled"); - this.numMageJLabel.repaint(); - this.numRangeJLabel.repaint(); - this.numMeleeJLabel.repaint(); - } - - void disableRiskCalculator() - { - this.totalRiskLabel.setText("disabled"); - this.riskProtectingItem.setText("disabled"); - this.biggestItemLabel.setText("disabled"); - this.totalRiskLabel.repaint(); - this.riskProtectingItem.repaint(); - this.biggestItemLabel.repaint(); - } -} 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 deleted file mode 100644 index dd2e4f82c9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PvpToolsPlugin.java +++ /dev/null @@ -1,693 +0,0 @@ -/* - * ****************************************************************************** - * * Copyright (c) 2019 openosrs - * * 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 - * * openosrs Discord: https://discord.gg/Q7wFtCe - * * openosrs website: https://openosrs.com - * ***************************************************************************** - */ - -package net.runelite.client.plugins.pvptools; - -import com.google.common.collect.Sets; -import com.google.inject.Provides; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.image.BufferedImage; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.NavigableMap; -import java.util.Objects; -import java.util.Set; -import java.util.TreeMap; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.stream.Collectors; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.ClanMember; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemDefinition; -import net.runelite.api.Player; -import net.runelite.api.SkullIcon; -import net.runelite.api.Varbits; -import net.runelite.api.WorldType; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.PlayerDespawned; -import net.runelite.api.events.PlayerSpawned; -import net.runelite.api.util.Text; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.config.Keybind; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.input.KeyManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.clanchat.ClanChatPlugin; -import static net.runelite.client.plugins.pvptools.PvpToolsPanel.htmlLabel; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.util.AsyncBufferedImage; -import net.runelite.client.util.HotkeyListener; -import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.PvPUtil; -import net.runelite.client.util.QuantityFormatter; -import org.apache.commons.lang3.ArrayUtils; - -@PluginDescriptor( - name = "PvP Tools", - description = "Enable the PvP Tools panel", - tags = {"panel", "pvp", "pk", "pklite", "renderself"}, - type = PluginType.PVP, - enabledByDefault = false -) -@Singleton -public class PvpToolsPlugin extends Plugin -{ - @Inject - PlayerCountOverlay playerCountOverlay; - - private PvpToolsPanel panel; - private MissingPlayersJFrame missingPlayersJFrame; - private CurrentPlayersJFrame currentPlayersJFrame; - private NavigationButton navButton; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private boolean hideAll; - private boolean loaded; - - @Inject - private OverlayManager overlayManager; - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private ItemManager itemManager; - - private final PvpToolsPlugin uhPvpToolsPlugin = this; - - /** - * ActionListener for the missing cc members and refresh buttons - */ - final ActionListener playersButtonActionListener = new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - if (missingPlayersJFrame != null) - { - missingPlayersJFrame.dispose(); - missingPlayersJFrame = null; - missingPlayersJFrame = new MissingPlayersJFrame(client, uhPvpToolsPlugin, getMissingMembers()); - } - else - { - missingPlayersJFrame = new MissingPlayersJFrame(client, uhPvpToolsPlugin, getMissingMembers()); - } - } - }; - - final ActionListener currentPlayersActionListener = new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - if (currentPlayersJFrame != null) - { - currentPlayersJFrame.dispose(); - currentPlayersJFrame = null; - currentPlayersJFrame = new CurrentPlayersJFrame(client, uhPvpToolsPlugin, getCurrentMembers()); - } - else - { - currentPlayersJFrame = new CurrentPlayersJFrame(client, uhPvpToolsPlugin, getCurrentMembers()); - } - } - }; - - @Getter(AccessLevel.PACKAGE) - private boolean countPlayers; - private boolean countOverHeads; - @Getter(AccessLevel.PACKAGE) - private Keybind renderSelf; - private boolean riskCalculatorEnabled; - private boolean missingPlayersEnabled; - private boolean currentPlayersEnabled; - private boolean hideAttack; - private AttackMode hideAttackMode; - private boolean hideCast; - private AttackMode hideCastMode; - private Set unhiddenCasts; - - @Inject - private ClientToolbar clientToolbar; - - @Inject - private KeyManager keyManager; - - @Inject - private PvpToolsConfig config; - - private final HotkeyListener renderselfHotkeyListener = new HotkeyListener(() -> this.renderSelf) - { - public void hotkeyPressed() - { - client.setRenderSelf(!client.getRenderSelf()); - } - }; - - private int[] overheadCount = new int[]{0, 0, 0}; - - @Getter - private int enemyPlayerCount = 0; - @Getter - private int friendlyPlayerCount = 0; - - private List getMissingMembers() - { - CopyOnWriteArrayList ccMembers = ClanChatPlugin.getClanMembers(); - ArrayList missingMembers = new ArrayList<>(); - for (ClanMember clanMember : client.getClanMembers()) - { - if (!Objects.isNull(clanMember)) - { - List arrayList = ccMembers.stream().map(player -> Text.removeTags(Text.standardize(player.getName()))).collect(Collectors.toList()); - if (!arrayList.contains(Text.removeTags(Text.standardize(clanMember.getUsername()))) && !missingMembers.contains(clanMember.getUsername())) - { - missingMembers.add("[W" + clanMember.getWorld() + "] - " + clanMember.getUsername()); - } - } - } - - return missingMembers; - } - - private List getCurrentMembers() - { - CopyOnWriteArrayList ccMembers = ClanChatPlugin.getClanMembers(); - ArrayList currentMembers = new ArrayList<>(); - for (ClanMember clanMember : client.getClanMembers()) - { - if (!Objects.isNull(clanMember)) - { - List arrayList = ccMembers.stream().map(player -> Text.removeTags(Text.standardize(player.getName()))).collect(Collectors.toList()); - if (arrayList.contains(Text.removeTags(Text.standardize(clanMember.getUsername()))) && !currentMembers.contains(clanMember.getUsername())) - { - currentMembers.add(clanMember.getUsername()); - } - } - } - - return currentMembers; - } - - - @Provides - PvpToolsConfig config(ConfigManager configManager) - { - return configManager.getConfig(PvpToolsConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(playerCountOverlay); - keyManager.registerKeyListener(renderselfHotkeyListener); - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "skull.png"); - - panel = new PvpToolsPanel(); - panel.init(); - - navButton = NavigationButton.builder() - .tooltip("PvP Tools") - .icon(icon) - .priority(5) - .panel(panel) - .build(); - - panel.missingPlayers.addActionListener(playersButtonActionListener); - panel.currentPlayers.addActionListener(currentPlayersActionListener); - clientToolbar.addNavigation(navButton); - - if (this.missingPlayersEnabled) - { - panel.missingPlayers.setVisible(true); - } - - if (this.currentPlayersEnabled) - { - panel.currentPlayers.setVisible(true); - } - - if (client.getGameState() == GameState.LOGGED_IN) - { - setCastOptions(); - } - } - - @Override - protected void shutDown() - { - overlayManager.remove(playerCountOverlay); - keyManager.unregisterKeyListener(renderselfHotkeyListener); - clientToolbar.removeNavigation(navButton); - - if (client.getGameState() == GameState.LOGGED_IN) - { - resetCastOptions(); - } - - loaded = false; - } - - @Subscribe - private void onConfigChanged(ConfigChanged configChanged) - { - if (!"pvptools".equals(configChanged.getGroup())) - { - return; - } - - updateConfig(); - - switch (configChanged.getKey()) - { - case "countPlayers": - if (this.countPlayers) - { - updatePlayers(); - } - if (!this.countPlayers) - { - panel.disablePlayerCount(); - } - break; - case "countOverHeads": - if (this.countOverHeads) - { - countOverHeads(); - } - if (!this.countOverHeads) - { - panel.disablePrayerCount(); - } - break; - case "riskCalculator": - if (this.riskCalculatorEnabled) - { - getCarriedWealth(); - } - if (!this.riskCalculatorEnabled) - { - panel.disableRiskCalculator(); - } - break; - case "missingPlayers": - if (this.missingPlayersEnabled) - { - panel.missingPlayers.setVisible(true); - } - break; - case "currentPlayers": - if (this.currentPlayersEnabled) - { - panel.currentPlayers.setVisible(true); - } - break; - case "hideAttack": - case "hideAttackMode": - if (this.hideAttack) - { - hideAttackOptions(this.hideAttackMode); - } - else - { - client.setHideFriendAttackOptions(false); - client.setHideClanmateAttackOptions(false); - } - break; - case "hideCast": - case "hideCastMode": - case "hideCastIgnored": - setCastOptions(); - break; - default: - break; - } - } - - @Subscribe - private void onItemContainerChanged(ItemContainerChanged event) - { - if (event.getItemContainer().equals(client.getItemContainer(InventoryID.INVENTORY)) && - this.riskCalculatorEnabled) - { - getCarriedWealth(); - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState().equals(GameState.LOGGED_IN)) - { - if (this.riskCalculatorEnabled) - { - getCarriedWealth(); - } - if (this.countPlayers) - { - updatePlayers(); - } - if (!loaded) - { - setCastOptions(); - } - } - } - - @Subscribe - private void onPlayerSpawned(PlayerSpawned event) - { - if (this.countPlayers && PvPUtil.isAttackable(client, event.getPlayer())) - { - updatePlayers(); - } - if (this.countOverHeads) - { - countOverHeads(); - } - } - - @Subscribe - private void onPlayerDespawned(PlayerDespawned event) - { - if (this.countPlayers && PvPUtil.isAttackable(client, event.getPlayer())) - { - updatePlayers(); - } - if (this.countOverHeads) - { - countOverHeads(); - } - } - - /** - * Updates the PvP Tools panel with the numbers for enemy protection prayers - */ - private void updatePrayerNumbers() - { - panel.numMageJLabel.setText(htmlLabel("Enemies Praying Mage: ", String.valueOf(overheadCount[0]))); - panel.numRangeJLabel.setText(htmlLabel("Enemies Praying Range: ", String.valueOf(overheadCount[1]))); - panel.numMeleeJLabel.setText(htmlLabel("Enemies Praying Melee: ", String.valueOf(overheadCount[2]))); - panel.numMageJLabel.repaint(); - panel.numRangeJLabel.repaint(); - panel.numMeleeJLabel.repaint(); - } - - private void updatePlayers() - { - friendlyPlayerCount = 0; - enemyPlayerCount = 0; - if (this.countPlayers) - { - for (Player p : client.getPlayers()) - { - if (Objects.nonNull(p)) - { - if (p.equals(client.getLocalPlayer())) - { - continue; - } - if (PvPUtil.isAttackable(client, p)) - { - if (p.isClanMember()) - { - friendlyPlayerCount++; - } - else - { - enemyPlayerCount++; - } - } - } - } - - 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(); - } - } - - private void countOverHeads() - { - overheadCount = new int[]{0, 0, 0}; - for (Player p : client.getPlayers()) - { - if (Objects.nonNull(p) && PvPUtil.isAttackable(client, p) && - !p.isClanMember() && !(p.getOverheadIcon() == null)) - { - switch (p.getOverheadIcon()) - { - case MAGIC: - overheadCount[0]++; - break; - case RANGED: - overheadCount[1]++; - break; - case MELEE: - overheadCount[2]++; - break; - } - } - } - updatePrayerNumbers(); - } - - /** - * Calculates the player's risk based on Item Price of all items in their inventory and equipment - */ - private void getCarriedWealth() - { - if (!this.riskCalculatorEnabled) - { - return; - } - - final ItemContainer equipment = client.getItemContainer(InventoryID.EQUIPMENT); - final ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); - final Player player = client.getLocalPlayer(); - - if (equipment == null || equipment.getItems() == null || - inventory == null || inventory.getItems() == null || - player == null) - { - return; - } - - final Item[] items = ArrayUtils.addAll(equipment.getItems(), inventory.getItems()); - final TreeMap priceMap = new TreeMap<>(Comparator.comparingInt(Integer::intValue)); - int wealth = 0; - for (Item i : items) - { - int value = (itemManager.getItemPrice(i.getId()) * i.getQuantity()); - final ItemDefinition itemComposition = itemManager.getItemDefinition(i.getId()); - - if (!itemComposition.isTradeable() && value == 0) - { - value = itemComposition.getPrice() * i.getQuantity(); - priceMap.put(value, i); - } - else - { - value = itemManager.getItemPrice(i.getId()) * i.getQuantity(); - if (i.getId() > 0 && value > 0) - { - priceMap.put(value, i); - } - } - wealth += value; - } - - panel.totalRiskLabel.setText(htmlLabel("Total risk: ", QuantityFormatter.quantityToRSDecimalStack(wealth))); - panel.totalRiskLabel.repaint(); - - int itemLimit = 0; - if (player.getSkullIcon() != null && player.getSkullIcon() == SkullIcon.SKULL) - { - itemLimit = 1; - } - if (player.getSkullIcon() == null) - { - itemLimit = 4; - } - - AsyncBufferedImage itemImage = null; - - NavigableMap descendingMap = priceMap.descendingMap(); - - for (int i = 0; i < itemLimit; i++) - { - if (i == 0) - { - if (!descendingMap.isEmpty()) - { - itemImage = itemManager.getImage(descendingMap.pollFirstEntry().getValue().getId()); - } - } - else - { - if (!descendingMap.isEmpty()) - { - itemManager.getItemDefinition(priceMap.descendingMap().pollFirstEntry().getValue().getId()) - .getName(); - } - } - } - panel.riskProtectingItem.setText(htmlLabel("Risk Protecting Item: ", - QuantityFormatter.quantityToRSDecimalStack(descendingMap.keySet().stream().mapToInt(Integer::intValue).sum()))); - panel.riskProtectingItem.repaint(); - - panel.biggestItemLabel.setText("Most Valuable Item: "); - if (itemImage != null) - { - itemImage.addTo(panel.biggestItemLabel); - } - panel.biggestItemLabel.repaint(); - } - - /** - * Given an AttackMode, hides the appropriate attack options. - * - * @param mode The {@link AttackMode} specifying clanmates, friends, or both. - */ - private void hideAttackOptions(AttackMode mode) - { - switch (mode) - { - case CLAN: - client.setHideClanmateAttackOptions(true); - client.setHideFriendAttackOptions(false); - break; - case FRIENDS: - client.setHideFriendAttackOptions(true); - client.setHideClanmateAttackOptions(false); - break; - case BOTH: - client.setHideClanmateAttackOptions(true); - client.setHideFriendAttackOptions(true); - break; - } - } - - /** - * Given an AttackMode, hides the appropriate cast options. - * - * @param mode The {@link AttackMode} specifying clanmates, friends, or both. - */ - private void hideCastOptions(AttackMode mode) - { - switch (mode) - { - case CLAN: - client.setHideClanmateCastOptions(true); - client.setHideFriendCastOptions(false); - break; - case FRIENDS: - client.setHideFriendCastOptions(true); - client.setHideClanmateCastOptions(false); - break; - case BOTH: - client.setHideClanmateCastOptions(true); - client.setHideFriendCastOptions(true); - break; - } - } - - public void setCastOptions() - { - clientThread.invoke(() -> - { - if ((client.getVar(Varbits.IN_RAID) == 1 || client.getVar(Varbits.THEATRE_OF_BLOOD) == 2) - || (client.getVar(Varbits.IN_WILDERNESS) != 1 && !WorldType.isAllPvpWorld(client.getWorldType()))) - { - return; - } - - if (this.hideAttack) - { - hideAttackOptions(this.hideAttackMode); - } - else - { - client.setHideFriendAttackOptions(false); - client.setHideClanmateAttackOptions(false); - } - - if (this.hideCast) - { - hideCastOptions(this.hideCastMode); - } - else - { - client.setHideFriendCastOptions(false); - client.setHideClanmateCastOptions(false); - } - - client.setUnhiddenCasts(this.unhiddenCasts); - - loaded = true; - }); - } - - private void resetCastOptions() - { - clientThread.invoke(() -> - { - if (client.getVar(Varbits.IN_RAID) == 1 || client.getVar(Varbits.THEATRE_OF_BLOOD) == 2) - { - return; - } - - client.setHideFriendAttackOptions(false); - client.setHideFriendCastOptions(false); - }); - } - - private void updateConfig() - { - this.countPlayers = config.countPlayers(); - this.countOverHeads = config.countOverHeads(); - this.renderSelf = config.renderSelf(); - this.riskCalculatorEnabled = config.riskCalculatorEnabled(); - this.missingPlayersEnabled = config.missingPlayersEnabled(); - this.currentPlayersEnabled = config.currentPlayersEnabled(); - this.hideAttack = config.hideAttack(); - this.hideAttackMode = config.hideAttackMode(); - this.hideCast = config.hideCast(); - this.hideCastMode = config.hideCastMode(); - this.unhiddenCasts = Sets.newHashSet(Text.fromCSV(config.hideCastIgnored().toLowerCase())); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderConfig.java deleted file mode 100644 index b08f16af7f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderConfig.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2018, Steffen Hauge - * 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.pyramidplunder; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigTitleSection; -import net.runelite.client.config.Title; - -@ConfigGroup("pyramidplunder") -public interface PyramidPlunderConfig extends Config -{ - @ConfigTitleSection( - keyName = "overlaysTitle", - name = "Overlays", - description = "", - position = 1 - ) - default Title overlaysTitle() - { - return new Title(); - } - - @ConfigItem( - position = 2, - keyName = "showPlunderStatus", - name = "Show session stats", - description = "Configures whether to display pyramid plunder session stats", - titleSection = "overlaysTitle" - ) - default boolean showPlunderStatus() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "hideWidget", - name = "Hide default widget", - description = "Hide the default widget", - titleSection = "overlaysTitle" - ) - default boolean hideWidget() - { - return true; - } - - @ConfigItem( - position = 4, - keyName = "showTimer", - name = "Display numerical timer", - description = "Displays a numerical timer instead of the default timer", - titleSection = "overlaysTitle" - ) - default boolean showTimer() - { - return true; - } - - @ConfigTitleSection( - keyName = "highlightsTitle", - name = "Highlights", - description = "", - position = 5 - ) - default Title highlightsTitle() - { - return new Title(); - } - - @ConfigItem( - position = 6, - keyName = "highlightDoors", - name = "Highlights doors", - description = "Highlights the four doors in each room", - titleSection = "highlightsTitle" - ) - default boolean highlightDoors() - { - return true; - } - - @ConfigItem( - position = 7, - keyName = "highlightSpearTrap", - name = "Highlights spear traps", - description = "Highlights the spear traps in each room", - titleSection = "highlightsTitle" - ) - default boolean highlightSpearTrap() - { - return false; - } - - @ConfigTitleSection( - keyName = "warningsTitle", - name = "Warnings", - description = "", - position = 8 - ) - default Title warningsTitle() - { - return new Title(); - } - - @ConfigItem( - position = 9, - keyName = "firstWarningTime", - name = "First warning time", - description = "Recolor time left(s)", - titleSection = "warningsTitle" - ) - default int firstWarningTime() - { - return 90; - } - - @ConfigItem( - position = 10, - keyName = "secondWarningTime", - name = "Second warning time", - description = "Recolor time left(s)", - titleSection = "warningsTitle" - ) - default int secondWarningTime() - { - return 30; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderOverlay.java deleted file mode 100644 index 971b765126..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderOverlay.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2018, Steffen Hauge - * 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.pyramidplunder; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Shape; -import java.text.DecimalFormat; -import java.text.NumberFormat; -import java.util.Locale; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.ObjectDefinition; -import net.runelite.api.Point; -import net.runelite.api.Tile; -import net.runelite.api.TileObject; -import net.runelite.api.Varbits; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import static net.runelite.client.plugins.pyramidplunder.PyramidPlunderPlugin.CLOSED_DOOR; -import static net.runelite.client.plugins.pyramidplunder.PyramidPlunderPlugin.OPENED_DOOR; -import static net.runelite.client.plugins.pyramidplunder.PyramidPlunderPlugin.TRAP; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.ui.overlay.components.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; - -@Singleton -public class PyramidPlunderOverlay extends Overlay -{ - private static final int MAX_DISTANCE = 2400; - private static final Color COLOR_DOOR = Color.GREEN; - private static final Color COLOR_SPEAR_TRAP = Color.ORANGE; - - private final Client client; - private final PyramidPlunderPlugin plugin; - private final PanelComponent panelComponent = new PanelComponent(); - - private static final int MAX_TICK_COUNT = 500; - private static final double TICK_LENGTH = 0.6; - - private static final NumberFormat TIME_LEFT_FORMATTER = DecimalFormat.getInstance(Locale.US); - - static - { - ((DecimalFormat) TIME_LEFT_FORMATTER).applyPattern("#0.0"); - } - - @Inject - private PyramidPlunderOverlay(final Client client, final PyramidPlunderPlugin plugin) - { - this.client = client; - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isInGame()) - { - return null; - } - - LocalPoint playerLocation = client.getLocalPlayer().getLocalLocation(); - Point mousePosition = client.getMouseCanvasPosition(); - - for (Map.Entry entry : plugin.getHighlighted().entrySet()) - { - TileObject object = entry.getKey(); - Tile tile = entry.getValue(); - - if (tile.getPlane() == client.getPlane() && - object.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE) - { - int objectID = object.getId(); - if (object.getId() == CLOSED_DOOR || object.getId() == OPENED_DOOR) - { - //Impostor - ObjectDefinition comp = client.getObjectDefinition(objectID); - ObjectDefinition impostor = comp.getImpostor(); - - if (impostor == null) - { - continue; - } - objectID = impostor.getId(); - } - - Shape objectClickbox = object.getClickbox(); - if (objectClickbox != null) - { - Color configColor = Color.GREEN; - switch (objectID) - { - case TRAP: - configColor = COLOR_SPEAR_TRAP; - break; - case OPENED_DOOR: // Does this need a overlay? - case CLOSED_DOOR: - configColor = COLOR_DOOR; - break; - } - - OverlayUtil.renderClickBox(graphics, mousePosition, objectClickbox, configColor); - } - } - } - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - if (plugin.isShowPlunderStatus()) - { - final Widget widget = client.getWidget(WidgetInfo.PYRAMID_PLUNDER_DATA); - if (widget == null) - { - return null; - } - - toggleDefaultWidget(plugin.isHideWidget()); - - panelComponent.getChildren().clear(); - - panelComponent.getChildren().add(TitleComponent.builder() - .text("Pyramid Plunder") - .build()); - - //Calculate time based on current pp timer tick - final int currentTick = client.getVar(Varbits.PYRAMID_PLUNDER_TIMER); - final double baseTick = (MAX_TICK_COUNT - currentTick) * TICK_LENGTH; - final double timeLeft = Math.max(0.0, baseTick); - final String timeLeftStr = TIME_LEFT_FORMATTER.format(timeLeft); - - tableComponent.addRow("Time left:", ColorUtil.prependColorTag(timeLeftStr, getColor(currentTick))); - tableComponent.addRow("Room:", client.getVar(Varbits.PYRAMID_PLUNDER_ROOM) + "/8"); - - panelComponent.getChildren().add(tableComponent); - - return panelComponent.render(graphics); - } - return null; - } - - private void toggleDefaultWidget(boolean hide) - { - final Widget widget = client.getWidget(WidgetInfo.PYRAMID_PLUNDER_DATA); - - if (widget == null) - { - return; - } - - widget.setHidden(hide); - } - - private Color getColor(int timeLeft) - { - if (timeLeft < plugin.getSecondWarningTime()) - { - return Color.RED; - } - else if (timeLeft < plugin.getFirstWarningTime()) - { - return Color.YELLOW; - } - - return Color.WHITE; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderPlugin.java deleted file mode 100644 index 5c70cecba7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderPlugin.java +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright (c) 2018, Steffen Hauge - * Copyright (c) 2019, Lucas - * 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.pyramidplunder; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Provides; -import java.time.temporal.ChronoUnit; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import static net.runelite.api.Constants.GAME_TICK_LENGTH; -import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE; -import static net.runelite.api.ObjectID.SPEARTRAP_21280; -import static net.runelite.api.ObjectID.TOMB_DOOR_20948; -import static net.runelite.api.ObjectID.TOMB_DOOR_20949; -import net.runelite.api.Player; -import net.runelite.api.Tile; -import net.runelite.api.TileObject; -import net.runelite.api.Varbits; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameObjectChanged; -import net.runelite.api.events.GameObjectDespawned; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.events.WallObjectChanged; -import net.runelite.api.events.WallObjectDespawned; -import net.runelite.api.events.WallObjectSpawned; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -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.ui.overlay.infobox.InfoBoxManager; - -@PluginDescriptor( - name = "PyramidPlunder", - description = "Highlights doors and spear traps in pyramid plunder and adds a numerical timer", - tags = {"pyramidplunder", "pyramid", "plunder", "overlay", "skilling", "thieving"}, - type = PluginType.MINIGAME, - enabledByDefault = false -) -@Singleton -public class PyramidPlunderPlugin extends Plugin -{ - private static final int PYRAMID_PLUNDER_REGION_ID = 7749; - private static final int PYRAMID_PLUNDER_TIMER_MAX = 500; - static final int TRAP = SPEARTRAP_21280; - static final int CLOSED_DOOR = TOMB_DOOR_20948; - static final int OPENED_DOOR = TOMB_DOOR_20949; - - // // Next 2 are in here for anyone who wants to spend more time on this -// private static final Set LOOTABLE = ImmutableSet.of( -// GRAND_GOLD_CHEST, -// SARCOPHAGUS_21255, -// URN_21261, -// URN_21262, -// URN_21263 -// ); -// private static final Set LOOTED = ImmutableSet.of( -// OPENED_GOLD_CHEST, -// SARCOPHAGUS_21256, -// URN_21265, -// URN_21266, -// URN_21267 -// ); - private static final Set DOOR_WALL_IDS = ImmutableSet.of( - 26618, 26619, 26620, 26621 - ); - - @Getter - private final Map highlighted = new HashMap<>(); - - @Inject - private Client client; - - @Inject - private PyramidPlunderConfig config; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private ItemManager itemManager; - - @Inject - private OverlayManager overlayManager; - - @Inject - private PyramidPlunderOverlay pyramidPlunderOverlay; - - @Getter - private boolean isInGame; - - private int pyramidTimer; - - @Getter(AccessLevel.PACKAGE) - private boolean showPlunderStatus; - private boolean highlightDoors; - private boolean highlightSpearTrap; - private boolean showTimer; - @Getter(AccessLevel.PACKAGE) - private boolean hideWidget; - @Getter(AccessLevel.PACKAGE) - private int firstWarningTime; - @Getter(AccessLevel.PACKAGE) - private int secondWarningTime; - - @Provides - PyramidPlunderConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(PyramidPlunderConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - } - - @Override - protected void shutDown() - { - overlayManager.remove(pyramidPlunderOverlay); - highlighted.clear(); - reset(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!"pyramidplunder".equals(event.getGroup())) - { - return; - } - - updateConfig(); - - if (!this.showTimer) - { - removeTimer(); - } - - if (this.showTimer && isInGame) - { - int remainingTime = GAME_TICK_LENGTH * (PYRAMID_PLUNDER_TIMER_MAX - pyramidTimer); - - if (remainingTime >= 2) - { - showTimer(remainingTime, ChronoUnit.MILLIS); - } - } - } - - private void removeTimer() - { - infoBoxManager.removeIf(infoBox -> infoBox instanceof PyramidPlunderTimer); - } - - private void showTimer() - { - showTimer(5, ChronoUnit.MINUTES); - } - - private void showTimer(int period, ChronoUnit chronoUnit) - { - removeTimer(); - - infoBoxManager.addInfoBox( - new PyramidPlunderTimer( - this, - itemManager.getImage(PHARAOHS_SCEPTRE), - period, - chronoUnit - ) - ); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - switch (event.getGameState()) - { - case HOPPING: - case LOGIN_SCREEN: - reset(); - break; - case LOADING: - highlighted.clear(); - break; - case LOGGED_IN: - if (!isInRegion()) - { - reset(); - } - break; - } - } - - private boolean isInRegion() - { - Player local = client.getLocalPlayer(); - if (local == null) - { - return false; - } - - WorldPoint location = local.getWorldLocation(); - return location.getRegionID() == PYRAMID_PLUNDER_REGION_ID; - - } - - @Subscribe - private void onVarbitChanged(VarbitChanged event) - { - int lastValue = pyramidTimer; - pyramidTimer = client.getVar(Varbits.PYRAMID_PLUNDER_TIMER); - - if (lastValue == pyramidTimer) - { - return; - } - - if (pyramidTimer == 0) - { - reset(); - return; - } - - if (pyramidTimer == 1) - { - overlayManager.add(pyramidPlunderOverlay); - isInGame = true; - if (this.showTimer) - { - showTimer(); - } - } - } - - private void reset() - { - isInGame = false; - overlayManager.remove(pyramidPlunderOverlay); - removeTimer(); - } - - @Subscribe - private void onGameObjectSpawned(GameObjectSpawned event) - { - onTileObject(event.getTile(), null, event.getGameObject()); - } - - @Subscribe - private void onGameObjectChanged(GameObjectChanged event) - { - onTileObject(event.getTile(), event.getPrevious(), event.getGameObject()); - } - - @Subscribe - private void onGameObjectDespawned(GameObjectDespawned event) - { - onTileObject(event.getTile(), event.getGameObject(), null); - } - - @Subscribe - private void onWallObjectSpawned(WallObjectSpawned event) - { - onTileObject(event.getTile(), null, event.getWallObject()); - } - - @Subscribe - private void onWallObjectChanged(WallObjectChanged event) - { - onTileObject(event.getTile(), event.getPrevious(), event.getWallObject()); - } - - @Subscribe - private void onWallObjectDespawned(WallObjectDespawned event) - { - onTileObject(event.getTile(), event.getWallObject(), null); - } - - private void onTileObject(Tile tile, TileObject oldObject, TileObject newObject) - { - highlighted.remove(oldObject); - - if (newObject == null) - { - return; - } - - int id = newObject.getId(); - if (id == TRAP && this.highlightSpearTrap || - (DOOR_WALL_IDS.contains(id) || id == OPENED_DOOR || id == CLOSED_DOOR) && this.highlightDoors) - { - highlighted.put(newObject, tile); - } - } - - private void updateConfig() - { - this.showPlunderStatus = config.showPlunderStatus(); - this.highlightDoors = config.highlightDoors(); - this.highlightSpearTrap = config.highlightSpearTrap(); - this.showTimer = config.showTimer(); - this.hideWidget = config.hideWidget(); - this.firstWarningTime = config.firstWarningTime(); - this.secondWarningTime = config.secondWarningTime(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderTimer.java b/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderTimer.java deleted file mode 100644 index 1cdda8a503..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderTimer.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2018, Steffen Hauge - * 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.pyramidplunder; - -import java.awt.image.BufferedImage; -import java.time.temporal.ChronoUnit; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.ui.overlay.infobox.Timer; - -class PyramidPlunderTimer extends Timer -{ - PyramidPlunderTimer(final Plugin plugin, final BufferedImage image, final int period, final ChronoUnit chronoUnit) - { - super(period, chronoUnit, image, plugin); - setTooltip("Time left until minigame ends"); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/questlist/QuestListPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/questlist/QuestListPlugin.java deleted file mode 100644 index 684a5dc9bc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/questlist/QuestListPlugin.java +++ /dev/null @@ -1,430 +0,0 @@ -/* - * Copyright (c) 2019 Spudjb - * 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.questlist; - -import com.google.common.collect.ImmutableList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Comparator; -import java.util.EnumMap; -import java.util.List; -import java.util.stream.Collectors; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.ScriptID; -import net.runelite.api.SoundEffectID; -import net.runelite.api.SpriteID; -import net.runelite.api.VarClientInt; -import net.runelite.api.Varbits; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.api.events.VarClientIntChanged; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.util.Text; -import net.runelite.api.vars.InterfaceTab; -import net.runelite.api.widgets.JavaScriptCallback; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.api.widgets.WidgetPositionMode; -import net.runelite.api.widgets.WidgetType; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.game.chatbox.ChatboxPanelManager; -import net.runelite.client.game.chatbox.ChatboxTextInput; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Quest List", - description = "Adds searching and filtering to the quest list", - type = PluginType.UTILITY -) -@Singleton -public class QuestListPlugin extends Plugin -{ - private static final int ENTRY_PADDING = 8; - private static final List QUEST_HEADERS = ImmutableList.of("Free Quests", "Members' Quests", "Miniquests"); - - private static final String MENU_OPEN = "Open"; - private static final String MENU_CLOSE = "Close"; - - private static final String MENU_TOGGLE = "Toggle"; - - private static final String MENU_SEARCH = "Search"; - private static final String MENU_SHOW = "Show"; - - @Inject - private Client client; - - @Inject - private ChatboxPanelManager chatboxPanelManager; - - @Inject - private ClientThread clientThread; - - private ChatboxTextInput searchInput; - private Widget questSearchButton; - private Widget questHideButton; - - private EnumMap> questSet; - - private QuestState currentFilterState; - - @Override - protected void startUp() - { - clientThread.invoke(this::addQuestButtons); - } - - @Override - protected void shutDown() - { - Widget header = client.getWidget(WidgetInfo.QUESTLIST_BOX); - if (header != null) - { - header.deleteAllChildren(); - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged e) - { - if (e.getGameState() == GameState.LOGGING_IN) - { - currentFilterState = QuestState.ALL; - } - } - - @Subscribe - private void onScriptCallbackEvent(ScriptCallbackEvent event) - { - if (!event.getEventName().equals("questProgressUpdated")) - { - return; - } - - addQuestButtons(); - } - - private void addQuestButtons() - { - Widget header = client.getWidget(WidgetInfo.QUESTLIST_BOX); - if (header != null) - { - header.deleteAllChildren(); - - questSearchButton = header.createChild(-1, WidgetType.GRAPHIC); - questSearchButton.setSpriteId(SpriteID.GE_SEARCH); - questSearchButton.setOriginalWidth(18); - questSearchButton.setOriginalHeight(17); - questSearchButton.setXPositionMode(WidgetPositionMode.ABSOLUTE_RIGHT); - questSearchButton.setOriginalX(5); - questSearchButton.setOriginalY(0); - questSearchButton.setHasListener(true); - questSearchButton.setAction(1, MENU_OPEN); - questSearchButton.setOnOpListener((JavaScriptCallback) e -> openSearch()); - questSearchButton.setName(MENU_SEARCH); - questSearchButton.revalidate(); - - questHideButton = header.createChild(-1, WidgetType.GRAPHIC); - redrawHideButton(); - - questHideButton.setOriginalWidth(13); - questHideButton.setOriginalHeight(13); - questHideButton.setXPositionMode(WidgetPositionMode.ABSOLUTE_RIGHT); - questHideButton.setOriginalX(24); - questHideButton.setOriginalY(2); - questHideButton.setHasListener(true); - questHideButton.setOnOpListener((JavaScriptCallback) e -> toggleHidden()); - questHideButton.setAction(1, MENU_TOGGLE); - questHideButton.revalidate(); - - questSet = new EnumMap<>(QuestContainer.class); - - updateFilter(); - } - } - - @Subscribe - private void onVarbitChanged(VarbitChanged varbitChanged) - { - if (isChatboxOpen() && isNotOnQuestTab()) - { - chatboxPanelManager.close(); - } - } - - @Subscribe - private void onVarClientIntChanged(VarClientIntChanged varClientIntChanged) - { - if (varClientIntChanged.getIndex() == VarClientInt.INTERFACE_TAB.getIndex() && isChatboxOpen() && isNotOnQuestTab()) - { - chatboxPanelManager.close(); - } - } - - private void toggleHidden() - { - QuestState[] questStates = QuestState.values(); - int nextState = (currentFilterState.ordinal() + 1) % questStates.length; - currentFilterState = questStates[nextState]; - - redrawHideButton(); - - updateFilter(); - client.playSoundEffect(SoundEffectID.UI_BOOP); - } - - private void redrawHideButton() - { - questHideButton.setSpriteId(currentFilterState.getSpriteId()); - questHideButton.setName(MENU_SHOW + " " + currentFilterState.getName()); - } - - private boolean isNotOnQuestTab() - { - return client.getVar(Varbits.QUEST_TAB) != 0 || client.getVar(VarClientInt.INTERFACE_TAB) != InterfaceTab.QUEST.getId(); - } - - private boolean isChatboxOpen() - { - return searchInput != null && chatboxPanelManager.getCurrentInput() == searchInput; - } - - private void closeSearch() - { - updateFilter(""); - chatboxPanelManager.close(); - client.playSoundEffect(SoundEffectID.UI_BOOP); - } - - private void openSearch() - { - updateFilter(""); - client.playSoundEffect(SoundEffectID.UI_BOOP); - questSearchButton.setAction(1, MENU_CLOSE); - questSearchButton.setOnOpListener((JavaScriptCallback) e -> closeSearch()); - searchInput = chatboxPanelManager.openTextInput("Search quest list") - .onChanged(s -> clientThread.invokeLater(() -> updateFilter(s))) - .onClose(() -> - { - clientThread.invokeLater(() -> updateFilter("")); - questSearchButton.setOnOpListener((JavaScriptCallback) e -> openSearch()); - questSearchButton.setAction(1, MENU_OPEN); - }) - .build(); - } - - private void updateFilter() - { - String filter = ""; - if (isChatboxOpen()) - { - filter = searchInput.getValue(); - } - - updateFilter(filter); - } - - private void updateFilter(String filter) - { - filter = filter.toLowerCase(); - final Widget container = client.getWidget(WidgetInfo.QUESTLIST_CONTAINER); - - final Widget freeList = client.getWidget(QuestContainer.FREE_QUESTS.widgetInfo); - final Widget memberList = client.getWidget(QuestContainer.MEMBER_QUESTS.widgetInfo); - final Widget miniList = client.getWidget(QuestContainer.MINI_QUESTS.widgetInfo); - - if (container == null || freeList == null || memberList == null || miniList == null) - { - return; - } - - updateList(QuestContainer.FREE_QUESTS, filter); - updateList(QuestContainer.MEMBER_QUESTS, filter); - updateList(QuestContainer.MINI_QUESTS, filter); - - memberList.setOriginalY(freeList.getOriginalY() + freeList.getOriginalHeight() + ENTRY_PADDING); - miniList.setOriginalY(memberList.getOriginalY() + memberList.getOriginalHeight() + ENTRY_PADDING); - - // originalHeight is changed within updateList so revalidate all lists - freeList.revalidate(); - memberList.revalidate(); - miniList.revalidate(); - - int y = miniList.getRelativeY() + miniList.getHeight() + 10; - - int newHeight; - if (container.getScrollHeight() > 0) - { - newHeight = (container.getScrollY() * y) / container.getScrollHeight(); - } - else - { - newHeight = 0; - } - - container.setScrollHeight(y); - container.revalidateScroll(); - - clientThread.invokeLater(() -> - client.runScript( - ScriptID.UPDATE_SCROLLBAR, - WidgetInfo.QUESTLIST_SCROLLBAR.getId(), - WidgetInfo.QUESTLIST_CONTAINER.getId(), - newHeight - )); - } - - private void updateList(QuestContainer questContainer, String filter) - { - Widget list = client.getWidget(questContainer.widgetInfo); - if (list == null) - { - return; - } - - Collection quests = questSet.get(questContainer); - - if (quests != null && - // Check to make sure the list hasn't been rebuild since we were last her - // Do this by making sure the list's dynamic children are the same as when we last saw them - quests.stream().noneMatch(w -> - { - Widget codeWidget = w.getQuest(); - if (codeWidget == null) - { - return false; - } - return list.getChild(codeWidget.getIndex()) == codeWidget; - })) - { - quests = null; - } - - if (quests == null) - { - // Find all of the widgets that we care about, sorting by their Y value - quests = Arrays.stream(list.getDynamicChildren()) - .sorted(Comparator.comparing(Widget::getRelativeY)) - .filter(w -> !QUEST_HEADERS.contains(w.getText())) - .map(w -> new QuestWidget(w, Text.removeTags(w.getText()).toLowerCase())) - .collect(Collectors.toList()); - questSet.put(questContainer, quests); - } - - // offset because of header - int y = 20; - for (QuestWidget questInfo : quests) - { - Widget quest = questInfo.getQuest(); - QuestState questState = QuestState.getByColor(quest.getTextColor()); - - boolean hidden; - if (!filter.isEmpty()) - { - // If searching, show result regardless of filtered state - hidden = !questInfo.getTitle().contains(filter); - } - else - { - // Otherwise hide if it doesn't match the filter state - if (currentFilterState == QuestState.NOT_COMPLETED) - { - hidden = questState == QuestState.COMPLETE; - } - else - { - hidden = currentFilterState != QuestState.ALL && questState != currentFilterState; - } - } - - quest.setHidden(hidden); - quest.setOriginalY(y); - quest.revalidate(); - - if (!hidden) - { - y += quest.getHeight(); - } - } - - list.setOriginalHeight(y); - } - - @AllArgsConstructor - @Getter(AccessLevel.PRIVATE) - private enum QuestContainer - { - FREE_QUESTS(WidgetInfo.QUESTLIST_FREE_CONTAINER), - MEMBER_QUESTS(WidgetInfo.QUESTLIST_MEMBERS_CONTAINER), - MINI_QUESTS(WidgetInfo.QUESTLIST_MINIQUEST_CONTAINER); - - private final WidgetInfo widgetInfo; - } - - @AllArgsConstructor - @Getter(AccessLevel.PRIVATE) - private enum QuestState - { - NOT_STARTED(0xff0000, "Not started", SpriteID.MINIMAP_ORB_HITPOINTS), - IN_PROGRESS(0xffff00, "In progress", SpriteID.MINIMAP_ORB_HITPOINTS_DISEASE), - COMPLETE(0xdc10d, "Completed", SpriteID.MINIMAP_ORB_HITPOINTS_POISON), - ALL(0, "All", SpriteID.MINIMAP_ORB_PRAYER), - NOT_COMPLETED(0, "Not Completed", SpriteID.MINIMAP_ORB_RUN); - - private final int color; - private final String name; - private final int spriteId; - - static QuestState getByColor(int color) - { - for (QuestState value : values()) - { - if (value.getColor() == color) - { - return value; - } - } - - return null; - } - } - - @Data - @AllArgsConstructor - private static class QuestWidget - { - private Widget quest; - private String title; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/Parse.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/Parse.java deleted file mode 100644 index 9e40aa3a3f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/Parse.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2019, Owain van Brakel - * 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.raids; - -import com.google.common.base.Splitter; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import lombok.extern.slf4j.Slf4j; - -@Slf4j -public class Parse -{ - public static boolean parse(String value) - { - final ArrayList rooms = new ArrayList<>(); - Collections.addAll(rooms, "tekton", "muttadiles", "guardians", "vespula", "shamans", "vasa", "vanguards", "mystics", "crabs", "ice demon", "tightrope", "thieving", "unknown"); - - List enteredRooms = Splitter - .on(",") - .trimResults() - .omitEmptyStrings() - .splitToList(value); - - for (String room : enteredRooms) - { - if (!rooms.contains(room.toLowerCase())) - { - return false; - } - } - - return true; - } -} 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 deleted file mode 100644 index 42b22d2f42..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/Raid.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel - * 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.raids; - -import com.google.common.base.Joiner; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.plugins.raids.solver.Layout; -import net.runelite.client.plugins.raids.solver.Room; - -class Raid -{ - @Getter(AccessLevel.PACKAGE) - private final RaidRoom[] rooms = new RaidRoom[16]; - - @Getter(AccessLevel.PACKAGE) - private Layout layout; - - void updateLayout(Layout layout) - { - if (layout == null) - { - return; - } - - this.layout = layout; - - for (int i = 0; i < rooms.length; i++) - { - if (layout.getRoomAt(i) == null) - { - continue; - } - - RaidRoom room = rooms[i]; - - if (room == null) - { - RoomType type = RoomType.fromCode(layout.getRoomAt(i).getSymbol()); - room = type.getUnsolvedRoom(); - setRoom(room, i); - } - } - } - - public RaidRoom getRoom(int position) - { - return rooms[position]; - } - - void setRoom(RaidRoom room, int position) - { - if (position < rooms.length) - { - rooms[position] = room; - } - } - - RaidRoom[] getCombatRooms() - { - List combatRooms = new ArrayList<>(); - - for (Room room : layout.getRooms()) - { - if (room == null) - { - continue; - } - - if (rooms[room.getPosition()].getType() == RoomType.COMBAT) - { - combatRooms.add(rooms[room.getPosition()]); - } - } - - return combatRooms.toArray(new RaidRoom[0]); - } - - String getRotationString() - { - return Joiner.on(",").join(Arrays.stream(getCombatRooms()).map(RaidRoom::getName).toArray()); - } - - 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()); - } - - void setCombatRooms(RaidRoom[] combatRooms) - { - int index = 0; - - for (Room room : layout.getRooms()) - { - if (room == null) - { - continue; - } - - if (rooms[room.getPosition()].getType() == RoomType.COMBAT) - { - rooms[room.getPosition()] = combatRooms[index]; - index++; - } - } - } - - String toCode() - { - StringBuilder builder = new StringBuilder(); - - for (RaidRoom room : rooms) - { - if (room != null) - { - builder.append(room.getType().getCode()); - } - else - { - builder.append(" "); - } - } - - return builder.toString(); - } - - /** - * Get the raid rooms in the order they are in the raid - * @return - */ - List getOrderedRooms() - { - List orderedRooms = new ArrayList<>(); - for (Room r : getLayout().getRooms()) - { - final int position = r.getPosition(); - final RaidRoom room = getRoom(position); - - if (room == null) - { - continue; - } - - orderedRooms.add(room); - } - - return orderedRooms; - } - - String toRoomString() - { - final StringBuilder sb = new StringBuilder(); - - for (Room r : getLayout().getRooms()) - { - final int position = r.getPosition(); - final RaidRoom room = getRoom(position); - - if (room == null) - { - continue; - } - - switch (room.getType()) - { - case PUZZLE: - case COMBAT: - sb.append(room.getName()).append(", "); - break; - } - } - - final String roomsString = sb.toString(); - return roomsString.substring(0, roomsString.length() - 2); - } -} \ No newline at end of file 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 deleted file mode 100644 index a5bf0e314e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidRoom.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel - * 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.raids; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@RequiredArgsConstructor -@Getter -public enum RaidRoom -{ - START("Start", RoomType.START), - END("End", RoomType.END), - SCAVENGERS("Scavengers", RoomType.SCAVENGERS), - FARMING("Farming", RoomType.FARMING), - EMPTY("Empty", RoomType.EMPTY), - - TEKTON("Tekton", RoomType.COMBAT), - MUTTADILES("Muttadiles", RoomType.COMBAT), - GUARDIANS("Guardians", RoomType.COMBAT), - VESPULA("Vespula", RoomType.COMBAT), - SHAMANS("Shamans", RoomType.COMBAT), - VASA("Vasa", RoomType.COMBAT), - VANGUARDS("Vanguards", RoomType.COMBAT), - MYSTICS("Mystics", RoomType.COMBAT), - UNKNOWN_COMBAT("Unknown (combat)", RoomType.COMBAT), - - CRABS("Crabs", RoomType.PUZZLE), - ICE_DEMON("Ice Demon", RoomType.PUZZLE), - TIGHTROPE("Tightrope", RoomType.PUZZLE), - THIEVING("Thieving", RoomType.PUZZLE), - UNKNOWN_PUZZLE("Unknown (puzzle)", RoomType.PUZZLE); - - static final int ROOM_MAX_SIZE = 32; - - private final String name; - private final RoomType type; -} \ No newline at end of file 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 deleted file mode 100644 index 419ec8cefb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java +++ /dev/null @@ -1,474 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel - * 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.raids; - -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.ConfigTitleSection; -import net.runelite.client.config.Title; - -@ConfigGroup("raids") -public interface RaidsConfig extends Config -{ - @ConfigTitleSection( - keyName = "scouterConfig", - name = "Scouter Config", - description = "", - position = 0 - ) - default Title scouterConfig() - { - return new Title(); - } - - - @ConfigItem( - position = 1, - titleSection = "scouterConfig", - keyName = "enhanceScouterTitle", - name = "Enhance scouter title", - description = "Adds #combat and good puzzles to scouter title" - ) - default boolean enhanceScouterTitle() - { - return true; - } - - @ConfigItem( - position = 2, - titleSection = "scouterConfig", - keyName = "hideBackground", - name = "Hide Scouter Background", - description = "Removes the scouter background, and makes it transparent." - ) - default boolean hideBackground() - { - return true; - } - - @ConfigItem( - position = 2, - titleSection = "scouterConfig", - keyName = "raidsTimer", - name = "Display elapsed raid time", - description = "Display elapsed raid time" - ) - default boolean raidsTimer() - { - return true; - } - - @ConfigItem( - position = 3, - titleSection = "scouterConfig", - keyName = "pointsMessage", - name = "Display points in chatbox after raid", - description = "Display a message with total points, individual points and percentage at the end of a raid" - ) - default boolean pointsMessage() - { - return true; - } - - - @ConfigItem( - position = 4, - titleSection = "scouterConfig", - keyName = "ptsHr", - name = "Enable points per hour message", - description = "Enable the message" - ) - default boolean ptsHr() - { - return true; - } - - @ConfigItem( - position = 5, - titleSection = "scouterConfig", - keyName = "scoutOverlay", - name = "Show scout overlay", - description = "Display an overlay that shows the current raid layout (when entering lobby)" - ) - default boolean scoutOverlay() - { - return true; - } - - @ConfigItem( - position = 6, - titleSection = "scouterConfig", - keyName = "scoutOverlayAtBank", - name = "Show scout overlay outside lobby", - description = "Keep the overlay active while at the raids area" - ) - default boolean scoutOverlayAtBank() - { - return true; - } - - @ConfigItem( - position = 7, - titleSection = "scouterConfig", - keyName = "scoutOverlayInRaid", - name = "Show scout overlay inside raid", - description = "Keep the overlay active while inside raid" - ) - default boolean scoutOverlayInRaid() - { - return false; - } - - @ConfigItem( - position = 8, - titleSection = "scouterConfig", - keyName = "displayFloorBreak", - name = "Layout floor break", - description = "Displays floor break in layout" - ) - default boolean displayFloorBreak() - { - return false; - } - - @ConfigItem( - position = 9, - titleSection = "scouterConfig", - keyName = "showRecommendedItems", - name = "Show recommended items", - description = "Adds overlay with recommended items to scouter" - ) - default boolean showRecommendedItems() - { - return false; - } - - @ConfigItem( - position = 10, - titleSection = "scouterConfig", - keyName = "recommendedItems", - name = "Recommended items", - hidden = true, - unhide = "showRecommendedItems", - description = "User-set recommended items in the form: [muttadiles,ice barrage,zamorak godsword],[tekton,elder maul], ..." - ) - default String recommendedItems() - { - return "[muttadiles,zamorak godsword],[Vasa,ghrazi rapier],[Guardians,Dragon pickaxe],[Mystics,Salve amulet(ei)],[Shamans,Antidote++],[Vespula,Super restore(4)]"; - } - - @ConfigItem( - position = 11, - titleSection = "scouterConfig", - keyName = "alwaysShowWorldAndCC", - name = "Always show CC and World", - description = "The CC and World are not removed from being in the in-game scouter" - ) - default boolean alwaysShowWorldAndCC() - { - return true; - } - - @ConfigItem( - position = 12, - titleSection = "scouterConfig", - keyName = "displayLayoutMessage", - name = "Send raid layout message when entering raid", - description = "Sends game message with raid layout on entering new raid" - ) - default boolean displayLayoutMessage() - { - return false; - } - - @ConfigTitleSection( - keyName = "roomConfig", - name = "Room Config", - description = "", - position = 13 - ) - default Title roomConfig() - { - return new Title(); - } - - @ConfigItem( - position = 14, - titleSection = "roomConfig", - keyName = "colorTightrope", - name = "Color tightrope", - description = "Colors tightrope a separate color" - ) - default boolean colorTightrope() - { - return true; - } - - @ConfigItem( - position = 15, - titleSection = "roomConfig", - keyName = "tightropeColor", - name = "Tightrope color", - description = "The color of tightropes", - hidden = true, - unhide = "colorTightrope" - ) - default Color tightropeColor() - { - return Color.MAGENTA; - } - - @ConfigItem( - position = 16, - titleSection = "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, - titleSection = "roomConfig", - keyName = "goodCrabColor", - name = "Good Crab color", - description = "The color of good crabs", - hidden = true, - unhide = "crabHandler" - ) - default Color goodCrabColor() - { - return new Color(255, 155, 245); - } - - @ConfigItem( - position = 17, - titleSection = "roomConfig", - keyName = "rareCrabColor", - name = "Rare Crab color", - description = "The color of rare crabs", - hidden = true, - unhide = "crabHandler" - ) - default Color rareCrabColor() - { - return new Color(255, 200, 0); - } - - @ConfigItem( - position = 18, - titleSection = "roomConfig", - keyName = "enableRotationWhitelist", - name = "Enable rotation whitelist", - description = "Enable the rotation whitelist" - ) - default boolean enableRotationWhitelist() - { - return false; - } - - @ConfigItem( - position = 19, - titleSection = "roomConfig", - keyName = "whitelistedRotations", - name = "Whitelisted rotations", - hidden = true, - unhide = "enableRotationWhitelist", - description = "Warn when boss rotation doesn't match a whitelisted one. Add rotations like [tekton, muttadile, guardians]" - ) - default String whitelistedRotations() - { - return ""; - } - - @ConfigItem( - position = 20, - titleSection = "roomConfig", - keyName = "enableLayoutWhitelist", - name = "Enable layout whitelist", - description = "Enable the layout whitelist" - ) - default boolean enableLayoutWhitelist() - { - return false; - } - - @ConfigItem( - position = 21, - titleSection = "roomConfig", - keyName = "whitelistedLayouts", - name = "Whitelisted layouts", - hidden = true, - unhide = "enableLayoutWhitelist", - description = "Warn when layout doesn't match a whitelisted one. Add layouts like CFSCPPCSCF separated with comma" - ) - default String whitelistedLayouts() - { - return ""; - } - - @ConfigItem( - position = 22, - titleSection = "roomConfig", - keyName = "showScavsFarms", - name = "Show scavengers and farming", - description = "Adds scavengers and farming to the room breakdown" - ) - default boolean showScavsFarms() - { - return false; - } - - @ConfigItem( - position = 23, - titleSection = "roomConfig", - keyName = "scavsBeforeIce", - name = "Show last scavs for Ice Demon", - description = "Highlights final scavengers before Ice Demon" - ) - default boolean scavsBeforeIce() - { - return false; - } - - @ConfigItem( - position = 24, - titleSection = "roomConfig", - keyName = "scavsBeforeOlm", - name = "Show last scavs for Olm", - description = "Highlights final scavengers before Olm" - ) - default boolean scavsBeforeOlm() - { - return true; - } - - @ConfigItem( - position = 25, - titleSection = "roomConfig", - keyName = "scavPrepColor", - name = "Last scavs color", - description = "The color of the final scavs before Ice Demon/Olm" - ) - default Color scavPrepColor() - { - return new Color(130, 222, 255); //light blue - } - - @ConfigItem( - position = 26, - titleSection = "roomConfig", - keyName = "whitelistedRooms", - name = "Whitelisted rooms", - description = "Display whitelisted rooms in green on the overlay. Separate with comma (full name)", - parse = true, - clazz = Parse.class, - method = "parse" - ) - default String whitelistedRooms() - { - return ""; - } - - @ConfigItem( - position = 27, - titleSection = "roomConfig", - keyName = "blacklistedRooms", - name = "Blacklisted rooms", - description = "Display blacklisted rooms in red on the overlay. Separate with comma (full name)", - parse = true, - clazz = Parse.class, - method = "parse" - ) - default String blacklistedRooms() - { - return ""; - } - - @ConfigTitleSection( - keyName = "hideRooms", - name = "Hide Rooms", - description = "", - position = 28 - ) - default Title hideRooms() - { - return new Title(); - } - - @ConfigItem( - position = 29, - titleSection = "hideRooms", - keyName = "hideRopeless", - name = "Hide no Tightrope raids", - description = "Completely hides raids with no tightrope" - ) - default boolean hideRopeless() - { - return false; - } - - @ConfigItem( - position = 30, - titleSection = "hideRooms", - keyName = "hideVanguards", - name = "Hide Vanguard raids", - description = "Completely hides raids with Vanguards" - ) - default boolean hideVanguards() - { - return false; - } - - @ConfigItem( - position = 31, - titleSection = "hideRooms", - keyName = "hideUnknownCombat", - name = "Hide Unknown combat raids", - description = "Completely hides raids with Unknown combat" - ) - default boolean hideUnknownCombat() - { - return false; - } - - @ConfigItem( - position = 32, - keyName = "partyDisplay", - name = "Party Info Display", - description = "Display an overlay that shows information about the current party" - ) - default boolean partyDisplay() - { - return false; - } -} 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 deleted file mode 100644 index 64e1f01efb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java +++ /dev/null @@ -1,473 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel - * 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.raids; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.SpriteID; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.plugins.raids.solver.Room; -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; -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; -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; -import net.runelite.client.util.ImageUtil; - -@Singleton -public class RaidsOverlay extends Overlay -{ - private static final int OLM_PLANE = 0; - private static final int BORDER_OFFSET = 2; - private static final int ICON_SIZE = 32; - private static final int SMALL_ICON_SIZE = 21; - private static final int TITLE_COMPONENT_HEIGHT = 20; - private static final int LINE_COMPONENT_HEIGHT = 16; - static final String BROADCAST_ACTION = "Broadcast layout"; - private final PanelComponent panelComponent = new PanelComponent(); - private final ItemManager itemManager; - private final SpriteManager spriteManager; - private final PanelComponent panelImages = new PanelComponent(); - private final Client client; - private final RaidsPlugin plugin; - @Setter(AccessLevel.PACKAGE) - private boolean sharable = false; - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private boolean scoutOverlayShown = false; - @Getter(AccessLevel.PACKAGE) - private boolean scouterActive = false; - @Getter(AccessLevel.PACKAGE) - private int width; - @Getter(AccessLevel.PACKAGE) - private int height; - - @Inject - private RaidsOverlay(final Client client, final RaidsPlugin plugin, final ItemManager itemManager, final SpriteManager spriteManager) - { - super(plugin); - setPosition(OverlayPosition.TOP_LEFT); - setPriority(OverlayPriority.LOW); - this.client = client; - this.plugin = plugin; - this.itemManager = itemManager; - this.spriteManager = spriteManager; - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Raids overlay")); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY, BROADCAST_ACTION, "Raids overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isScoutOverlay() || !scoutOverlayShown || plugin.isInRaidChambers() && client.getPlane() == OLM_PLANE) - { - return null; - } - - scouterActive = false; - panelComponent.getChildren().clear(); - - if (plugin.isHideBackground()) - { - panelComponent.setBackgroundColor(null); - } - else - { - panelComponent.setBackgroundColor(ComponentConstants.STANDARD_BACKGROUND_COLOR); - } - - if (plugin.getRaid() == null || plugin.getRaid().getLayout() == null) - { - panelComponent.getChildren().add(TitleComponent.builder() - .text("Unable to scout this raid!") - .color(Color.RED) - .build()); - - return panelComponent.render(graphics); - } - - Color color = Color.WHITE; - String layout = plugin.getRaid().getLayout().toCodeString(); - String displayLayout; - if (plugin.isDisplayFloorBreak()) - { - displayLayout = plugin.getRaid().getLayout().toCode(); - displayLayout = displayLayout.substring(0, displayLayout.length() - 1).replaceAll("#", "").replaceFirst("¤", " | "); - } - else - { - displayLayout = layout; - } - - if (plugin.isEnableLayoutWhitelist() && !plugin.getLayoutWhitelist().contains(layout.toLowerCase())) - { - color = Color.RED; - } - int combatCount = 0; - int roomCount = 0; - List iceRooms = new ArrayList<>(); - List scavRooms = new ArrayList<>(); - List scavsBeforeIceRooms = new ArrayList<>(); - boolean crabs = false; - boolean iceDemon = false; - boolean tightrope = false; - boolean thieving = false; - boolean vanguards = false; - boolean unknownCombat = false; - boolean unknownPuzzle = false; - String puzzles = ""; - String roomName; - for (Room layoutRoom : plugin.getRaid().getLayout().getRooms()) - { - int position = layoutRoom.getPosition(); - RaidRoom room = plugin.getRaid().getRoom(position); - - if (room == null) - { - continue; - } - - switch (room.getType()) - { - case COMBAT: - combatCount++; - switch (room) - { - case VANGUARDS: - vanguards = true; - break; - case UNKNOWN_COMBAT: - unknownCombat = true; - break; - } - break; - case PUZZLE: - switch (room) - { - case CRABS: - crabs = true; - break; - case ICE_DEMON: - iceDemon = true; - iceRooms.add(roomCount); - break; - case THIEVING: - thieving = true; - break; - case TIGHTROPE: - tightrope = true; - break; - case UNKNOWN_PUZZLE: - unknownPuzzle = true; - break; - } - break; - case SCAVENGERS: - scavRooms.add(roomCount); - break; - } - roomCount++; - } - if (tightrope) - { - puzzles = crabs ? "cr" : iceDemon ? "ri" : thieving ? "tr" : "?r"; - } - - if ((plugin.isHideVanguards() && vanguards) || (plugin.isHideRopeless() && !tightrope) || (plugin.isHideUnknownCombat() && unknownCombat)) - { - panelComponent.getChildren().add(TitleComponent.builder() - .text("Bad Raid!") - .color(Color.RED) - .build()); - - return panelComponent.render(graphics); - } - - scouterActive = true; - displayLayout = (plugin.isEnhanceScouterTitle() ? "" + combatCount + "c " + puzzles + " " : "") + displayLayout; - - for (Integer i : iceRooms) - { - int prev = 0; - for (Integer s : scavRooms) - { - if (s > i) - { - break; - } - prev = s; - } - scavsBeforeIceRooms.add(prev); - } - int lastScavs = scavRooms.get(scavRooms.size() - 1); - - panelComponent.getChildren().add(TitleComponent.builder() - .text(displayLayout) - .color(color) - .build()); - - if (plugin.recordRaid() != null) - { - panelComponent.getChildren().add(TitleComponent.builder() - .text("Record Raid") - .color(Color.GREEN) - .build()); - panelComponent.setBackgroundColor(new Color(0, 255, 0, 10)); - } - else - { - if (plugin.isHideBackground()) - { - panelComponent.setBackgroundColor(null); - } - else - { - panelComponent.setBackgroundColor(ComponentConstants.STANDARD_BACKGROUND_COLOR); - } - } - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - color = Color.ORANGE; - if (sharable || plugin.isAlwaysShowWorldAndCC()) - { - String clanOwner = Text.removeTags(client.getWidget(WidgetInfo.CLAN_CHAT_OWNER).getText()); - if (clanOwner.equals("None")) - { - clanOwner = "Open CC Tab"; - color = Color.RED; - } - - tableComponent.addRow(ColorUtil.prependColorTag("W" + client.getWorld(), Color.ORANGE), ColorUtil.prependColorTag("" + clanOwner, color)); - } - - int bossMatches = 0; - int bossCount = 0; - roomCount = 0; - - if (plugin.isEnableRotationWhitelist()) - { - bossMatches = plugin.getRotationMatches(); - } - - Set imageIds = new HashSet<>(); - for (Room layoutRoom : plugin.getRaid().getLayout().getRooms()) - { - int position = layoutRoom.getPosition(); - RaidRoom room = plugin.getRaid().getRoom(position); - - if (room == null) - { - continue; - } - - color = Color.WHITE; - - switch (room.getType()) - { - case COMBAT: - bossCount++; - if (plugin.getRoomWhitelist().contains(room.getName().toLowerCase())) - { - color = Color.GREEN; - } - else if (plugin.getRoomBlacklist().contains(room.getName().toLowerCase()) - || plugin.isEnableRotationWhitelist() && bossCount > bossMatches) - { - color = Color.RED; - } - - String bossName = room.getName(); - String bossNameLC = bossName.toLowerCase(); - if (plugin.isShowRecommendedItems() && plugin.getRecommendedItemsList().get(bossNameLC) != null) - { - imageIds.addAll(plugin.getRecommendedItemsList().get(bossNameLC)); - } - - if (bossNameLC.startsWith("unknown")) - { - bossName = "Unknown"; - } - tableComponent.addRow(room.getType().getName(), ColorUtil.prependColorTag(bossName, color)); - - break; - - case PUZZLE: - String puzzleName = room.getName(); - String puzzleNameLC = puzzleName.toLowerCase(); - if (plugin.getRecommendedItemsList().get(puzzleNameLC) != null) - { - imageIds.addAll(plugin.getRecommendedItemsList().get(puzzleNameLC)); - } - if (plugin.getRoomWhitelist().contains(puzzleNameLC)) - { - color = Color.GREEN; - } - else if (plugin.getRoomBlacklist().contains(puzzleNameLC)) - { - color = Color.RED; - } - if (plugin.isColorTightrope() && puzzleNameLC.equals("tightrope")) - { - color = plugin.getTightropeColor(); - } - if (plugin.isCrabHandler() && puzzleNameLC.equals("crabs")) - { - if (plugin.getGoodCrabs() == null) - { - color = Color.RED; - } - else - { - switch (plugin.getGoodCrabs()) - { - case "Good Crabs": - color = plugin.getGoodCrabColor(); - break; - case "Rare Crabs": - color = plugin.getRareCrabColor(); - break; - } - } - } - - if (puzzleNameLC.startsWith("unknown")) - { - puzzleName = "Unknown"; - } - - tableComponent.addRow(room.getType().getName(), ColorUtil.prependColorTag(puzzleName, color)); - break; - case FARMING: - if (plugin.isShowScavsFarms()) - { - tableComponent.addRow("", ColorUtil.prependColorTag(room.getType().getName(), new Color(181, 230, 29))); - } - break; - case SCAVENGERS: - if (plugin.isScavsBeforeOlm() && roomCount == lastScavs) - { - tableComponent.addRow("OlmPrep", ColorUtil.prependColorTag("Scavs", plugin.getScavPrepColor())); - } - else if (plugin.isScavsBeforeIce() && scavsBeforeIceRooms.contains(roomCount)) - { - tableComponent.addRow("IcePrep", ColorUtil.prependColorTag("Scavs", plugin.getScavPrepColor())); - } - else if (plugin.isShowScavsFarms()) - { - tableComponent.addRow("", ColorUtil.prependColorTag("Scavs", new Color(181, 230, 29))); - } - break; - } - roomCount++; - } - - panelComponent.getChildren().add(tableComponent); - - - //add recommended items - if (plugin.isShowRecommendedItems() && imageIds.size() > 0) - { - panelImages.getChildren().clear(); - - Integer[] idArray = imageIds.toArray(new Integer[0]); - boolean smallImages = false; - - panelImages.setBackgroundColor(null); - - panelImages.setOrientation(ComponentOrientation.HORIZONTAL); - panelImages.setWrapping(4); - - - for (Integer e : idArray) - { - final BufferedImage image = getImage(e, smallImages); - if (image != null) - { - panelImages.getChildren().add(new ImageComponent(image)); - } - } - panelComponent.getChildren().add(panelImages); - } - - - Dimension panelDims = panelComponent.render(graphics); - width = (int) panelDims.getWidth(); - height = (int) panelDims.getHeight(); - return panelDims; - } - - private BufferedImage getImage(int id, boolean small) - { - BufferedImage bim; - if (id != SpriteID.SPELL_ICE_BARRAGE) - { - bim = itemManager.getImage(id); - } - else - { - bim = spriteManager.getSprite(id, 0); - } - if (bim == null) - { - return null; - } - if (!small) - { - return ImageUtil.resizeCanvas(bim, ICON_SIZE, ICON_SIZE); - } - if (id != SpriteID.SPELL_ICE_BARRAGE) - { - return ImageUtil.resizeImage(bim, SMALL_ICON_SIZE, SMALL_ICON_SIZE); - } - return ImageUtil.resizeCanvas(bim, SMALL_ICON_SIZE, SMALL_ICON_SIZE); - } -} \ No newline at end of file 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 deleted file mode 100644 index 463236423f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPanel.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2018, Lyzrds - * 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.raids; - -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.PluginPanel; - -@Singleton -class RaidsPanel extends PluginPanel -{ - @Inject - private Client client; - @Inject - private RaidsPlugin raidsPlugin; - - private final JButton reloadButton = new JButton("Reload Instance"); - private final JButton reloadScouter = new JButton("Reload Raid Overlay"); - - void init() - { - setLayout(new GridLayout(2, 1)); - setBackground(ColorScheme.DARK_GRAY_COLOR); - setBorder(new EmptyBorder(10, 10, 10, 10)); - - JPanel raidsPanel = new JPanel(); - raidsPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - raidsPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); - raidsPanel.setLayout(new GridLayout(2, 1)); - - JLabel title = new JLabel(htmlLabel("
Instance Reload Helper
"), SwingConstants.CENTER); - title.setFont(FontManager.getRunescapeFont()); - - JLabel subTitle = new JLabel(htmlLabel("Reloading an instance will cause your client to disconnect temporarily.")); - subTitle.setFont(FontManager.getRunescapeSmallFont()); - - raidsPanel.add(title); - raidsPanel.add(subTitle); - - JPanel buttonPanel = new JPanel(); - buttonPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - buttonPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); - buttonPanel.setLayout(new GridLayout(2, 1, 0, 5)); - - reloadButton.addActionListener((ActionEvent e) -> - { - if ((client.getGameState() == GameState.LOGGED_IN)) - { - client.setGameState(GameState.CONNECTION_LOST); - } - }); - - reloadScouter.addActionListener((ActionEvent e) -> - { - if ((client.getGameState() == GameState.LOGGED_IN)) - { - raidsPlugin.checkRaidPresence(true); - } - }); - - buttonPanel.add(reloadButton); - buttonPanel.add(reloadScouter); - - add(raidsPanel); - add(buttonPanel); - } - - private static String htmlLabel(String text) - { - return "" + text + ""; - } -} 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 deleted file mode 100644 index 2d4d8959a5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPartyOverlay.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 2019, Bjornenalfa - * 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.raids; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.ClanMember; -import net.runelite.api.Client; -import net.runelite.api.MenuOpcode; -import net.runelite.api.VarPlayer; -import net.runelite.api.Varbits; -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; -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; -import net.runelite.client.util.ColorUtil; - -@Singleton -public class RaidsPartyOverlay extends Overlay -{ - 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; - - @Inject - private RaidsPartyOverlay(final RaidsPlugin plugin) - { - super(plugin); - setPosition(OverlayPosition.TOP_RIGHT); - setPriority(OverlayPriority.HIGH); - getMenuEntries().add(new OverlayMenuEntry(MenuOpcode.RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Raids party overlay")); - getMenuEntries().add(new OverlayMenuEntry(MenuOpcode.RUNELITE_OVERLAY, PARTY_OVERLAY_RESET, "Raids party overlay")); - getMenuEntries().add(new OverlayMenuEntry(MenuOpcode.RUNELITE_OVERLAY, PARTY_OVERLAY_REFRESH, "Raids party overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isInRaidChambers()) - { - return null; - } - - if (client.getClanChatCount() == 0) - { - // Player left clan chat - return null; - } - - boolean inLobby = client.getVar(VarPlayer.IN_RAID_PARTY) != -1; // -1 if raid started - - int partySize = client.getVar(Varbits.RAID_PARTY_SIZE); - - int playerCount = client.getPlayers().size(); - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - - String partyCountString; - - Color countColor = Color.WHITE; - if (inLobby) - { - partyCountString = String.format("%d/%d", playerCount, partySize); - // While we are in the lobby compare to players visible on the screen - if (partySize <= playerCount) - { - countColor = Color.GREEN; - } - else - { - countColor = Color.RED; - } - } - else - { - // If raid has started then we compare the current party size to what it was when we started - partyCountString = String.format("%d/%d", partySize, plugin.getStartPlayerCount()); - if (plugin.getMissingPartyMembers().size() > 0) - { - countColor = Color.RED; // Somebody is missing - } - } - - panel.getChildren().clear(); - - tableComponent.addRow("Party size:", ColorUtil.prependColorTag(partyCountString, countColor)); - - if (inLobby) - { - int world = client.getWorld(); - int wrongWorldClanMembers = 0; - int clanMemberCount = 0; - for (ClanMember clanMember : client.getClanMembers()) - { - if (clanMember != null) - { - if (clanMember.getWorld() != world) - { - wrongWorldClanMembers++; - } - else - { - clanMemberCount++; - } - } - } - - // Show amount of people on the right world but not at the raids area - Color notInPartyColor = Color.GREEN; - int notInParty = clanMemberCount - partySize; - - if (notInParty > 0) - { - notInPartyColor = Color.WHITE; - } - - tableComponent.addRow("Not at raids:", ColorUtil.prependColorTag(String.valueOf(notInParty), notInPartyColor)); - - - // Show amount of clan members that are not in the right world. - Color wrongWorldColor; - if (wrongWorldClanMembers == 0) - { - wrongWorldColor = Color.GREEN; - } - else - { - wrongWorldColor = Color.WHITE; - } - - tableComponent.addRow("Wrong world:", ColorUtil.prependColorTag(String.valueOf(wrongWorldClanMembers), wrongWorldColor)); - - } - else - { - Set missingPartyMembers = plugin.getMissingPartyMembers(); - if (missingPartyMembers.size() > 0) - { - - - tableComponent.addRow("Missing players:", ""); - - for (String member : missingPartyMembers) - { - tableComponent.addRow(ColorUtil.prependColorTag(member, Color.RED), ""); - } - } - } - - panelComponent.getChildren().add(tableComponent); - - return panel.render(graphics); - } -} 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 deleted file mode 100644 index 556560049c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java +++ /dev/null @@ -1,1390 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel - * 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.raids; - -import com.google.common.base.Joiner; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Lists; -import com.google.inject.Binder; -import com.google.inject.Provides; -import java.awt.Color; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.text.DecimalFormat; -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; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import static net.runelite.api.Perspective.SCENE_SIZE; -import static net.runelite.api.SpriteID.TAB_QUESTS_BROWN_RAIDING_PARTY; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.InstanceTemplates; -import net.runelite.api.ItemID; -import net.runelite.api.MenuOpcode; -import net.runelite.api.MessageNode; -import net.runelite.api.NullObjectID; -import net.runelite.api.Player; -import net.runelite.api.Point; -import net.runelite.api.SpriteID; -import net.runelite.api.Tile; -import net.runelite.api.VarPlayer; -import net.runelite.api.Varbits; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.ClientTick; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.events.WidgetHiddenChanged; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.chat.ChatColorType; -import net.runelite.client.chat.ChatCommandManager; -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.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ChatInput; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.events.OverlayMenuClicked; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.raids.solver.Layout; -import net.runelite.client.plugins.raids.solver.LayoutSolver; -import net.runelite.client.plugins.raids.solver.RotationSolver; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.ui.overlay.OverlayManager; -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.ws.PartyMember; -import net.runelite.client.ws.PartyService; -import net.runelite.client.ws.WSClient; -import net.runelite.http.api.chat.ChatClient; -import net.runelite.http.api.chat.LayoutRoom; -import net.runelite.http.api.ws.messages.party.PartyChatMessage; -import org.apache.commons.lang3.StringUtils; -import static net.runelite.api.util.Text.sanitize; -import static org.apache.commons.lang3.StringUtils.containsIgnoreCase; - -@PluginDescriptor( - name = "CoX Scouter", - description = "Show helpful information for the Chambers of Xeric raid", - tags = {"combat", "raid", "overlay", "pve", "pvm", "bosses", "cox", "olm", "scout"}, - type = PluginType.PVM, - enabledByDefault = false -) -@Singleton -@Slf4j -@Getter(AccessLevel.PACKAGE) -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("###.##"); - private static final Pattern ROTATION_REGEX = Pattern.compile("\\[(.*?)]"); - private static final String LAYOUT_COMMAND = "!layout"; - private static final Pattern RAID_COMPLETE_REGEX = Pattern.compile("Congratulations - your raid is complete! Duration: ([0-9:]+)"); - private static final ImmutableSet GOOD_CRABS_FIRST = ImmutableSet.of( - "FSCCP.PCSCF - #WNWSWN#ESEENW", //both good crabs - "SCSPF.CCSPF - #ESWWNW#ESENES", //both good crabs - "SPCFC.CSPCF - #WWNEEE#WSWNWS", //both good crabs - "SCFCP.CSCFS - #ENEESW#ENWWSW", //good crabs - "SCPFC.CCSSF - #NEESEN#WSWWNE", //good crabs - "SCFPC.CSPCF - #WSWWNE#WSEENE" //good crabs first rare crabs second - ); - private static final ImmutableSet GOOD_CRABS_SECOND = ImmutableSet.of( - "FSCCP.PCSCF - #WNWSWN#ESEENW", //both good crabs - "SCSPF.CCSPF - #ESWWNW#ESENES", //both good crabs - "SPCFC.CSPCF - #WWNEEE#WSWNWS", //both good crabs - "SCPFC.CSPCF - #NEEESW#WWNEEE", //rare crabs first good crabs second - "SCFCP.CCSPF - #ESEENW#ESWWNW", //bad crabs first good crabs second - "SCPFC.CSPSF - #WWSEEE#NWSWWN", //bad crabs first good crabs second - "SFCCS.PCPSF - #ENWWSW#ENESEN", //bad crabs first good crabs second - "SPCFC.SCCPF - #ESENES#WWWNEE", //bad crabs first good crabs second - "SPSFP.CCCSF - #NWSWWN#ESEENW", //bad crabs first good crabs second - "FSCCP.PCSCF - #ENWWWS#NEESEN", //bad crabs first good crabs second - "FSCCS.PCPSF - #WSEEEN#WSWNWS" //bad crabs first good crabs second - ); - private static final ImmutableSet RARE_CRABS_FIRST = ImmutableSet.of( - "SCPFC.CSPCF - #NEEESW#WWNEEE", //rare crabs first good crabs second - "SCPFC.PCSCF - #WNEEES#NWSWNW", //rare crabs first bad crabs second - "SCPFC.CCPSF - #NWWWSE#WNEESE" //both rare crabs - ); - private static final ImmutableSet RARE_CRABS_SECOND = ImmutableSet.of( - "SCPFC.CCPSF - #NWWWSE#WNEESE", //both rare crabs - "FSCPC.CSCPF - #WNWWSE#EENWWW", //bad crabs first rare crabs second - "SCFPC.PCCSF - #WSEENE#WWWSEE", //bad crabs first rare crabs second - "SCFPC.SCPCF - #NESENE#WSWWNE", //bad crabs first rare crabs second - "SFCCP.CSCPF - #WNEESE#NWSWWN", //bad crabs first rare crabs second - "SCFPC.CSPCF - #WSWWNE#WSEENE" //good crabs first rare crabs second - ); - private static final Pattern PUZZLES = Pattern.compile("Puzzle - (\\w+)"); - - @Getter(AccessLevel.NONE) - @Inject - private ChatMessageManager chatMessageManager; - - @Getter(AccessLevel.NONE) - @Inject - private InfoBoxManager infoBoxManager; - - @Getter(AccessLevel.NONE) - @Inject - private Client client; - - @Getter(AccessLevel.NONE) - @Inject - private RaidsConfig config; - - @Getter(AccessLevel.NONE) - @Inject - private OverlayManager overlayManager; - - @Getter(AccessLevel.NONE) - @Inject - private RaidsOverlay overlay; - - @Getter(AccessLevel.NONE) - @Inject - private RaidsPointsOverlay pointsOverlay; - - @Getter(AccessLevel.NONE) - @Inject - private RaidsPartyOverlay partyOverlay; - - @Getter(AccessLevel.NONE) - @Inject - private LayoutSolver layoutSolver; - - @Getter(AccessLevel.NONE) - @Inject - private SpriteManager spriteManager; - - @Getter(AccessLevel.NONE) - @Inject - private ClientThread clientThread; - - @Getter(AccessLevel.NONE) - @Inject - private TooltipManager tooltipManager; - - @Getter(AccessLevel.NONE) - @Inject - private ClientToolbar clientToolbar; - - @Getter(AccessLevel.NONE) - @Inject - private ItemManager itemManager; - - @Getter(AccessLevel.NONE) - @Inject - private EventBus eventBus; - - private boolean raidStarted; - - @Inject - private PartyService party; - - @Inject - private WSClient ws; - - @Inject - private ChatCommandManager chatCommandManager; - - @Inject - private ChatClient chatClient; - - @Inject - private ScheduledExecutorService scheduledExecutorService; - - @Getter - private final List roomWhitelist = new ArrayList<>(); - - @Getter - private final List roomBlacklist = new ArrayList<>(); - - @Getter - private final List rotationWhitelist = new ArrayList<>(); - - @Getter - private final List layoutWhitelist = new ArrayList<>(); - - @Getter - private Raid raid; - - private boolean inRaidChambers; - private boolean enhanceScouterTitle; - private boolean hideBackground; - private boolean raidsTimer; - private boolean pointsMessage; - private boolean ptsHr; - private boolean scoutOverlay; - private boolean scoutOverlayAtBank; - private boolean scoutOverlayInRaid; - private boolean displayFloorBreak; - private boolean showRecommendedItems; - private boolean alwaysShowWorldAndCC; - private boolean colorTightrope; - private boolean crabHandler; - private boolean enableRotationWhitelist; - private boolean enableLayoutWhitelist; - private boolean showScavsFarms; - private boolean scavsBeforeIce; - private boolean scavsBeforeOlm; - private boolean hideRopeless; - private boolean hideVanguards; - private boolean hideUnknownCombat; - private boolean partyDisplay; - private int startPlayerCount; - private int upperTime = -1; - private int middleTime = -1; - private int lowerTime = -1; - private int raidTime = -1; - private Color goodCrabColor; - private Color rareCrabColor; - private Color scavPrepColor; - private Color tightropeColor; - private boolean displayLayoutMessage; - private String layoutMessage; - private RaidsTimer timer; - private WidgetOverlay widgetOverlay; - private NavigationButton navButton; - private String recommendedItems; - private String whitelistedRooms; - private String whitelistedRotations; - private String whitelistedLayouts; - private String blacklistedRooms; - private String tooltip; - private String goodCrabs; - private String layoutFullCode; - private List partyMembers = new ArrayList<>(); - private List startingPartyMembers = new ArrayList<>(); - private Map> recommendedItemsList = new HashMap<>(); - private Set missingPartyMembers = new HashSet<>(); - - @Provides - RaidsConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(RaidsConfig.class); - } - - @Override - public void configure(Binder binder) - { - binder.bind(RaidsOverlay.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - overlayManager.add(pointsOverlay); - if (this.partyDisplay) - { - overlayManager.add(partyOverlay); - } - updateLists(); - clientThread.invokeLater(() -> checkRaidPresence(true)); - chatCommandManager.registerCommandAsync(LAYOUT_COMMAND, this::lookupRaid, this::submitRaid); - widgetOverlay = overlayManager.getWidgetOverlay(WidgetInfo.RAIDS_POINTS_INFOBOX); - RaidsPanel panel = injector.getInstance(RaidsPanel.class); - panel.init(); - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(this.getClass(), "instancereloadhelper.png"); - navButton = NavigationButton.builder() - .tooltip("Raids Reload") - .icon(icon) - .priority(8) - .panel(panel) - .build(); - clientToolbar.addNavigation(navButton); - } - - private void lookupRaid(ChatMessage chatMessage, String s) - { - ChatMessageType type = chatMessage.getType(); - - final String player; - if (type.equals(ChatMessageType.PRIVATECHATOUT)) - { - player = client.getLocalPlayer().getName(); - } - else - { - player = sanitize(chatMessage.getName()); - } - - LayoutRoom[] layout; - try - { - layout = chatClient.getLayout(player); - } - catch (IOException ex) - { - log.debug("unable to lookup layout", ex); - return; - } - - if (layout == null || layout.length == 0) - { - return; - } - - String layoutMessage = Joiner.on(", ").join(Arrays.stream(layout) - .map(l -> RaidRoom.valueOf(l.name())) - .filter(room -> room.getType() == RoomType.COMBAT || room.getType() == RoomType.PUZZLE) - .map(RaidRoom::getName) - .toArray()); - - String response = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append("Layout: ") - .append(ChatColorType.NORMAL) - .append(layoutMessage) - .build(); - - log.debug("Setting response {}", response); - final MessageNode messageNode = chatMessage.getMessageNode(); - messageNode.setRuneLiteFormatMessage(response); - chatMessageManager.update(messageNode); - client.refreshChat(); - } - - private boolean submitRaid(ChatInput chatInput, String s) - { - if (raid == null) - { - return false; - } - - final String playerName = client.getLocalPlayer().getName(); - List orderedRooms = raid.getOrderedRooms(); - - LayoutRoom[] layoutRooms = orderedRooms.stream() - .map(room -> LayoutRoom.valueOf(room.name())) - .toArray(LayoutRoom[]::new); - - scheduledExecutorService.execute(() -> - { - try - { - chatClient.submitLayout(playerName, layoutRooms); - } - catch (Exception ex) - { - log.warn("unable to submit layout", ex); - } - finally - { - chatInput.resume(); - } - }); - - return true; - } - - @Override - protected void shutDown() - { - chatCommandManager.unregisterCommand(LAYOUT_COMMAND); - overlayManager.remove(overlay); - overlayManager.remove(pointsOverlay); - clientToolbar.removeNavigation(navButton); - if (this.partyDisplay) - { - overlayManager.remove(partyOverlay); - } - infoBoxManager.removeInfoBox(timer); - final Widget widget = client.getWidget(WidgetInfo.RAIDS_POINTS_INFOBOX); - if (widget != null) - { - widget.setHidden(false); - } - reset(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("raids")) - { - return; - } - - updateConfig(); - updateLists(); - - if (event.getKey().equals("raidsTimer")) - { - updateInfoBoxState(); - return; - } - - if (event.getKey().equals("partyDisplay")) - { - if (this.partyDisplay) - { - overlayManager.add(partyOverlay); - } - else - { - overlayManager.remove(partyOverlay); - } - } - - clientThread.invokeLater(() -> checkRaidPresence(true)); - } - - @Subscribe - private void onWidgetHiddenChanged(WidgetHiddenChanged event) - { - if (!inRaidChambers || event.isHidden()) - { - return; - } - - Widget widget = event.getWidget(); - - if (widget == client.getWidget(WidgetInfo.RAIDS_POINTS_INFOBOX)) - { - widget.setHidden(true); - } - } - - @Subscribe - private void onVarbitChanged(VarbitChanged event) - { - checkRaidPresence(false); - if (this.partyDisplay) - { - updatePartyMembers(false); - } - } - - @Subscribe - private void onChatMessage(ChatMessage event) - { - if (inRaidChambers && event.getType() == ChatMessageType.FRIENDSCHATNOTIFICATION) - { - String message = Text.removeTags(event.getMessage()); - Matcher matcher; - - if (message.startsWith(RAID_START_MESSAGE)) - { - if (this.raidsTimer) - { - timer = new RaidsTimer(this, Instant.now()); - spriteManager.getSpriteAsync(TAB_QUESTS_BROWN_RAIDING_PARTY, 0, timer); - infoBoxManager.addInfoBox(timer); - } - if (this.partyDisplay) - { - // Base this on visible players since party size shows people outside the lobby - // and they did not get to come on the raid - List players = client.getPlayers(); - startPlayerCount = players.size(); - - partyMembers.clear(); - startingPartyMembers.clear(); - missingPartyMembers.clear(); - - startingPartyMembers.addAll(Lists.transform(players, Player::getName)); - partyMembers.addAll(startingPartyMembers); - } - } - - if (timer != null && message.contains(LEVEL_COMPLETE_MESSAGE)) - { - timer.timeFloor(); - } - - if (message.startsWith(RAID_COMPLETE_MESSAGE)) - { - if (timer != null) - { - timer.timeOlm(); - timer.setStopped(true); - } - updateTooltip(); - } - matcher = RAID_COMPLETE_REGEX.matcher(message); - if (matcher.find()) - { - raidTime = timeToSeconds(matcher.group(1)); - int timesec = timeToSeconds(matcher.group(1)); - updateTooltip(); - - if (this.pointsMessage) - { - int totalPoints = client.getVar(Varbits.TOTAL_POINTS); - int personalPoints = client.getVar(Varbits.PERSONAL_POINTS); - int partySize = client.getVar(Varbits.RAID_PARTY_SIZE); - - double percentage = personalPoints / (totalPoints / 100.0); - - String chatMessage = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Total points: ") - .append(ChatColorType.HIGHLIGHT) - .append(POINTS_FORMAT.format(totalPoints)) - .append(ChatColorType.NORMAL) - .append(", Personal points: ") - .append(ChatColorType.HIGHLIGHT) - .append(POINTS_FORMAT.format(personalPoints)) - .append(ChatColorType.NORMAL) - .append(" (") - .append(ChatColorType.HIGHLIGHT) - .append(DECIMAL_FORMAT.format(percentage)) - .append(ChatColorType.NORMAL) - .append("%)") - .build(); - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.FRIENDSCHATNOTIFICATION) - .runeLiteFormattedMessage(chatMessage) - .build()); - if (this.ptsHr) - { - String ptssolo; - { - ptssolo = POINTS_FORMAT.format(((float) personalPoints / (float) timesec) * 3600); - } - - String ptsteam; - { - ptsteam = POINTS_FORMAT.format(((float) totalPoints / (float) timesec) * 3600); - } - - String ptssplit; - { - ptssplit = POINTS_FORMAT.format(((totalPoints / (float) timesec) * 3600) / (partySize)); - } - - - String chatMessage2 = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Solo Pts/Hr: ") - .append(ChatColorType.HIGHLIGHT) - .append(ptssolo) - .append(ChatColorType.NORMAL) - .append("Team Pts/Hr: ") - .append(ChatColorType.HIGHLIGHT) - .append(ptsteam) - .build(); - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.FRIENDSCHATNOTIFICATION) - .runeLiteFormattedMessage(chatMessage2) - .build()); - - String chatMessage3 = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Split Pts/Hr: ") - .append(ChatColorType.HIGHLIGHT) - .append(ptssplit) - .build(); - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.FRIENDSCHATNOTIFICATION) - .runeLiteFormattedMessage(chatMessage3) - .build()); - } - } - } - } - } - - @Subscribe - private void onClientTick(ClientTick event) - { - if (!this.raidsTimer - || !client.getGameState().equals(GameState.LOGGED_IN) - || tooltip == null) - { - return; - } - - final Point mousePosition = client.getMouseCanvasPosition(); - if (widgetOverlay.getBounds().contains(mousePosition.getX(), mousePosition.getY())) - { - tooltipManager.add(new Tooltip(tooltip)); - } - } - - @Subscribe - private void onOverlayMenuClicked(OverlayMenuClicked event) - { - OverlayMenuEntry entry = event.getEntry(); - if (entry.getMenuOpcode() == MenuOpcode.RUNELITE_OVERLAY) - { - if (entry.getTarget().equals("Raids party overlay")) - { - switch (entry.getOption()) - { - case RaidsPartyOverlay.PARTY_OVERLAY_RESET: - startingPartyMembers.clear(); - updatePartyMembers(true); - missingPartyMembers.clear(); - break; - case RaidsPartyOverlay.PARTY_OVERLAY_REFRESH: - updatePartyMembers(true); - break; - default: - break; - } - } - else if (entry.getOption().equals(RaidsOverlay.BROADCAST_ACTION) && event.getOverlay() == overlay) - { - sendRaidLayoutMessage(); - } - } - } - - private void updatePartyMembers(boolean force) - { - int partySize = client.getVar(Varbits.RAID_PARTY_SIZE); - if (partySize <= 0) - { - return; - } - - if (startingPartyMembers.size() == partySize && !force) - { - // Skip update if the part is as big as when we started - missingPartyMembers.clear(); // Clear missing members in case someone came back - return; - } - - // Only update while in raid - if (client.getVar(VarPlayer.IN_RAID_PARTY) == -1 || force) - { - Widget[] widgets; - try - { - widgets = client.getWidget(WidgetInfo.RAIDING_PARTY).getStaticChildren()[2].getStaticChildren()[3].getDynamicChildren(); - } - catch (NullPointerException e) - { - return; // Raid widget not loaded - } - - partyMembers.clear(); - for (Widget widget : widgets) - { - if (widget == null || widget.getText() == null) - { - continue; - } - - String name = widget.getName(); - - if (name.length() > 1) - { - partyMembers.add(name.substring(name.indexOf('>') + 1, name.indexOf('<', 1))); - } - } - - // If we don't have any starting members, update starting members - if (startingPartyMembers.size() == 0 || force) - { - missingPartyMembers.clear(); - startingPartyMembers.clear(); - startingPartyMembers.addAll(partyMembers); - } - else - { - - // Check if anyone left - if (startingPartyMembers.size() > partyMembers.size()) - { - missingPartyMembers.clear(); - missingPartyMembers.addAll(startingPartyMembers); - missingPartyMembers.removeAll(partyMembers); - } - } - } - } - - void checkRaidPresence(boolean force) - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - boolean setting = client.getVar(Varbits.IN_RAID) == 1; - - if (force || inRaidChambers != setting) - { - inRaidChambers = setting; - updateInfoBoxState(); - - if (inRaidChambers) - { - raid = buildRaid(); - - if (raid == null) - { - log.debug("Failed to build raid"); - return; - } - - Layout layout = layoutSolver.findLayout(raid.toCode()); - - if (layout == null) - { - log.debug("Could not find layout match"); - return; - } - - layoutFullCode = layout.getCode(); - raid.updateLayout(layout); - RaidRoom[] rooms = raid.getCombatRooms(); - RotationSolver.solve(rooms); - raid.setCombatRooms(rooms); - setOverlayStatus(true); - if (this.displayLayoutMessage) - { - sendRaidLayoutMessage(); - } - Matcher puzzleMatch = PUZZLES.matcher(raid.getFullRotationString()); - final List puzzles = new ArrayList<>(); - while (puzzleMatch.find()) - { - puzzles.add(puzzleMatch.group()); - } - if (raid.getFullRotationString().contains("Crabs")) - { - switch (puzzles.size()) - { - case 1: - goodCrabs = handleCrabs(puzzles.get(0)); - break; - case 2: - goodCrabs = handleCrabs(puzzles.get(0), puzzles.get(1)); - break; - case 3: - goodCrabs = handleCrabs(puzzles.get(0), puzzles.get(1), puzzles.get(2)); - break; - } - } - } - else if (!this.scoutOverlayAtBank) - { - setOverlayStatus(false); - } - } - - // If we left party raid was started or we left raid - if (client.getVar(VarPlayer.IN_RAID_PARTY) == -1 && (!inRaidChambers || !this.scoutOverlayInRaid)) - { - setOverlayStatus(false); - raidStarted = false; - } - } - - private void sendRaidLayoutMessage() - { - final String layout = getRaid().getLayout().toCodeString(); - final String rooms = getRaid().toRoomString(); - final String raidData = "[" + layout + "]: " + rooms; - layoutMessage = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append("Layout: ") - .append(ChatColorType.NORMAL) - .append(raidData) - .build(); - - final PartyMember localMember = party.getLocalMember(); - if (party.getMembers().isEmpty() || localMember == null) - { - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.FRIENDSCHATNOTIFICATION) - .runeLiteFormattedMessage(layoutMessage) - .build()); - } - else - { - final PartyChatMessage message = new PartyChatMessage(layoutMessage); - message.setMemberId(localMember.getMemberId()); - ws.send(message); - } - - if (recordRaid() != null) - { - 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() - { - if (timer == null) - { - return; - } - - if (inRaidChambers && this.raidsTimer) - { - if (!infoBoxManager.getInfoBoxes().contains(timer)) - { - infoBoxManager.addInfoBox(timer); - } - } - else - { - infoBoxManager.removeInfoBox(timer); - } - - if (!inRaidChambers) - { - timer = null; - } - } - - private void updateLists() - { - updateList(roomWhitelist, this.whitelistedRooms); - updateList(roomBlacklist, this.blacklistedRooms); - updateList(rotationWhitelist, this.whitelistedRotations); - updateList(layoutWhitelist, this.whitelistedLayouts); - updateMap(recommendedItemsList, this.recommendedItems); - } - - private void updateMap(Map> map, String input) - { - map.clear(); - - Matcher m = ROTATION_REGEX.matcher(input); - while (m.find()) - { - String everything = m.group(1).toLowerCase(); - int split = everything.indexOf(','); - if (split < 0) - { - continue; - } - String key = everything.substring(0, split); - if (key.length() < 1) - { - continue; - } - List itemNames = Text.fromCSV(everything.substring(split)); - - map.computeIfAbsent(key, k -> new ArrayList<>()); - - for (String itemName : itemNames) - { - if (itemName.equals("")) - { - continue; - } - if (itemName.equals("ice barrage")) - { - map.get(key).add(SpriteID.SPELL_ICE_BARRAGE); - } - else if (itemName.startsWith("salve")) - { - map.get(key).add(ItemID.SALVE_AMULETEI); - } - else if (itemManager.search(itemName).size() > 0) - { - map.get(key).add(itemManager.search(itemName).get(0).getId()); - } - else - { - log.info("RaidsPlugin: Could not find an item ID for item: " + itemName); - } - } - } - } - - private void updateList(List list, String input) - { - list.clear(); - - if (list == this.rotationWhitelist) - { - Matcher m = ROTATION_REGEX.matcher(input); - while (m.find()) - { - String rotation = m.group(1).toLowerCase(); - - if (!list.contains(rotation)) - { - list.add(rotation); - } - } - } - else - { - list.addAll(Text.fromCSV(input.toLowerCase())); - } - } - - int getRotationMatches() - { - String rotation = raid.getRotationString().toLowerCase(); - List bosses = Text.fromCSV(rotation); - - if (rotationWhitelist.contains(rotation)) - { - return bosses.size(); - } - - for (String whitelisted : rotationWhitelist) - { - int matches = 0; - List whitelistedBosses = Text.fromCSV(whitelisted); - - for (int i = 0; i < whitelistedBosses.size(); i++) - { - if (i < bosses.size() && whitelistedBosses.get(i).equals(bosses.get(i))) - { - matches++; - } - else - { - matches = 0; - break; - } - } - - if (matches >= 2) - { - return matches; - } - } - - return 0; - } - - private Point findLobbyBase() - { - Tile[][] tiles = client.getScene().getTiles()[LOBBY_PLANE]; - - for (int x = 0; x < SCENE_SIZE; x++) - { - for (int y = 0; y < SCENE_SIZE; y++) - { - if (tiles[x][y] == null || tiles[x][y].getWallObject() == null) - { - continue; - } - - if (tiles[x][y].getWallObject().getId() == NullObjectID.NULL_12231) - { - return tiles[x][y].getSceneLocation(); - } - } - } - - return null; - } - - private Raid buildRaid() - { - Point gridBase = findLobbyBase(); - - if (gridBase == null) - { - return null; - } - - Raid raid = new Raid(); - Tile[][] tiles; - int position, x, y, offsetX; - int startX = -2; - - for (int plane = 3; plane > 1; plane--) - { - tiles = client.getScene().getTiles()[plane]; - - if (tiles[gridBase.getX() + RaidRoom.ROOM_MAX_SIZE][gridBase.getY()] == null) - { - position = 1; - } - else - { - position = 0; - } - - for (int i = 1; i > -2; i--) - { - y = gridBase.getY() + (i * RaidRoom.ROOM_MAX_SIZE); - - for (int j = startX; j < 4; j++) - { - x = gridBase.getX() + (j * RaidRoom.ROOM_MAX_SIZE); - offsetX = 0; - - if (x > SCENE_SIZE && position > 1 && position < 4) - { - position++; - } - - if (x < 0) - { - offsetX = Math.abs(x) + 1; //add 1 because the tile at x=0 will always be null - } - - if (x < SCENE_SIZE && y >= 0 && y < SCENE_SIZE) - { - if (tiles[x + offsetX][y] == null) - { - if (position == 4) - { - position++; - break; - } - - continue; - } - - if (position == 0 && startX != j) - { - startX = j; - } - - Tile base = tiles[offsetX > 0 ? 1 : x][y]; - RaidRoom room = determineRoom(base); - raid.setRoom(room, position + Math.abs((plane - 3) * 8)); - position++; - } - } - } - } - - return raid; - } - - private RaidRoom determineRoom(Tile base) - { - int chunkData = client.getInstanceTemplateChunks()[base.getPlane()][(base.getSceneLocation().getX()) / 8][base.getSceneLocation().getY() / 8]; - InstanceTemplates template = InstanceTemplates.findMatch(chunkData); - - if (template == null) - { - return RaidRoom.EMPTY; - } - - switch (template) - { - case RAIDS_LOBBY: - case RAIDS_START: - return RaidRoom.START; - - case RAIDS_END: - return RaidRoom.END; - - case RAIDS_SCAVENGERS: - case RAIDS_SCAVENGERS2: - return RaidRoom.SCAVENGERS; - - case RAIDS_SHAMANS: - return RaidRoom.SHAMANS; - - case RAIDS_VASA: - return RaidRoom.VASA; - - case RAIDS_VANGUARDS: - return RaidRoom.VANGUARDS; - - case RAIDS_ICE_DEMON: - return RaidRoom.ICE_DEMON; - - case RAIDS_THIEVING: - return RaidRoom.THIEVING; - - case RAIDS_FARMING: - case RAIDS_FARMING2: - return RaidRoom.FARMING; - - case RAIDS_MUTTADILES: - return RaidRoom.MUTTADILES; - - case RAIDS_MYSTICS: - return RaidRoom.MYSTICS; - - case RAIDS_TEKTON: - return RaidRoom.TEKTON; - - case RAIDS_TIGHTROPE: - return RaidRoom.TIGHTROPE; - - case RAIDS_GUARDIANS: - return RaidRoom.GUARDIANS; - - case RAIDS_CRABS: - return RaidRoom.CRABS; - - case RAIDS_VESPULA: - return RaidRoom.VESPULA; - - default: - return RaidRoom.EMPTY; - } - - } - - private void reset() - { - raid = null; - upperTime = -1; - middleTime = -1; - lowerTime = -1; - raidTime = -1; - tooltip = null; - inRaidChambers = false; - widgetOverlay = null; - raidStarted = false; - timer = null; - } - - private int timeToSeconds(String s) - { - int seconds = -1; - String[] split = s.split(":"); - if (split.length == 2) - { - seconds = Integer.parseInt(split[0]) * 60 + Integer.parseInt(split[1]); - } - if (split.length == 3) - { - seconds = Integer.parseInt(split[0]) * 3600 + Integer.parseInt(split[1]) * 60 + Integer.parseInt(split[2]); - } - return seconds; - } - - private String secondsToTime(int seconds) - { - StringBuilder builder = new StringBuilder(); - if (seconds >= 3600) - { - builder.append((int) Math.floor(seconds / 3600)).append(";"); - } - seconds %= 3600; - if (builder.length() == 0) - { - builder.append((int) Math.floor(seconds / 60)); - } - else - { - builder.append(StringUtils.leftPad(String.valueOf((int) Math.floor(seconds / 60)), 2, '0')); - } - builder.append(":"); - seconds %= 60; - builder.append(StringUtils.leftPad(String.valueOf(seconds), 2, '0')); - return builder.toString(); - } - - private void updateTooltip() - { - StringBuilder builder = new StringBuilder(); - if (upperTime == -1) - { - tooltip = null; - return; - } - builder.append("Upper level: ").append(secondsToTime(upperTime)); - if (middleTime == -1) - { - if (lowerTime == -1) - { - tooltip = builder.toString(); - return; - } - else - { - builder.append("
Lower level: ").append(secondsToTime(lowerTime - upperTime)); - } - } - else - { - builder.append("
Middle level: ").append(secondsToTime(middleTime - upperTime)); - if (lowerTime == -1) - { - tooltip = builder.toString(); - return; - } - else - { - builder.append("
Lower level: ").append(secondsToTime(lowerTime - middleTime)); - } - } - if (raidTime == -1) - { - tooltip = builder.toString(); - return; - } - builder.append("
Olm: ").append(secondsToTime(raidTime - lowerTime)); - tooltip = builder.toString(); - } - - private String handleCrabs(String firstGroup) - { - if (firstGroup.contains("Crabs") && GOOD_CRABS_FIRST.contains(layoutFullCode)) - { - return "Good Crabs"; - } - if (firstGroup.contains("Crabs") && RARE_CRABS_FIRST.contains(layoutFullCode)) - { - return "Rare Crabs"; - } - return null; - } - - private String handleCrabs(String firstGroup, String secondGroup) - { - if (firstGroup.contains("Crabs") && GOOD_CRABS_FIRST.contains(layoutFullCode)) - { - return "Good Crabs"; - } - if (secondGroup.contains("Crabs") && GOOD_CRABS_SECOND.contains(layoutFullCode)) - { - return "Good Crabs"; - } - if (firstGroup.contains("Crabs") && RARE_CRABS_FIRST.contains(layoutFullCode)) - { - return "Rare Crabs"; - } - if (secondGroup.contains("Crabs") && RARE_CRABS_SECOND.contains(layoutFullCode)) - { - return "Rare Crabs"; - } - return null; - } - - private String handleCrabs(String firstGroup, String secondGroup, String thirdGroup) - { - if (firstGroup.contains("Crabs")) - { - return "Good Crabs"; - } - if (secondGroup.contains("Crabs")) - { - return "Rare Crabs"; - } - if (thirdGroup.contains("Crabs")) - { - return "Rare Crabs"; - } - return null; - } - - String recordRaid() - { - if (raid.getRotationString().equalsIgnoreCase("vasa,tekton,vespula") - && containsIgnoreCase(raid.getFullRotationString(), "crabs") - && containsIgnoreCase(raid.getFullRotationString(), "tightrope") - && goodCrabs != null) - { - return goodCrabs; - } - return null; - } - - private void setOverlayStatus(boolean bool) - { - overlay.setScoutOverlayShown(bool); - } - - private void updateConfig() - { - this.enhanceScouterTitle = config.enhanceScouterTitle(); - this.hideBackground = config.hideBackground(); - this.raidsTimer = config.raidsTimer(); - this.pointsMessage = config.pointsMessage(); - this.ptsHr = config.ptsHr(); - this.scoutOverlay = config.scoutOverlay(); - this.scoutOverlayAtBank = config.scoutOverlayAtBank(); - this.scoutOverlayInRaid = config.scoutOverlayInRaid(); - this.displayFloorBreak = config.displayFloorBreak(); - this.showRecommendedItems = config.showRecommendedItems(); - this.recommendedItems = config.recommendedItems(); - this.alwaysShowWorldAndCC = config.alwaysShowWorldAndCC(); - this.displayLayoutMessage = config.displayLayoutMessage(); - this.colorTightrope = config.colorTightrope(); - this.tightropeColor = config.tightropeColor(); - this.crabHandler = config.crabHandler(); - this.goodCrabColor = config.goodCrabColor(); - this.rareCrabColor = config.rareCrabColor(); - this.enableRotationWhitelist = config.enableRotationWhitelist(); - this.whitelistedRotations = config.whitelistedRotations(); - this.enableLayoutWhitelist = config.enableLayoutWhitelist(); - this.whitelistedLayouts = config.whitelistedLayouts(); - this.showScavsFarms = config.showScavsFarms(); - this.scavsBeforeIce = config.scavsBeforeIce(); - this.scavsBeforeOlm = config.scavsBeforeOlm(); - this.scavPrepColor = config.scavPrepColor(); - this.whitelistedRooms = config.whitelistedRooms(); - this.blacklistedRooms = config.blacklistedRooms(); - this.hideRopeless = config.hideRopeless(); - this.hideVanguards = config.hideVanguards(); - this.hideUnknownCombat = config.hideUnknownCombat(); - this.partyDisplay = config.partyDisplay(); - } -} \ No newline at end of file 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 deleted file mode 100644 index ae8a43a5b2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPointsOverlay.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel - * 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.raids; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.text.NumberFormat; -import java.util.Locale; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.Varbits; -import static net.runelite.client.plugins.raids.RaidsPlugin.POINTS_FORMAT; -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; -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; - -@Singleton -public class RaidsPointsOverlay extends Overlay -{ - private static final NumberFormat UNIQUE_FORMAT = NumberFormat.getPercentInstance(Locale.ENGLISH); - - static - { - UNIQUE_FORMAT.setMaximumFractionDigits(2); - UNIQUE_FORMAT.setMinimumFractionDigits(2); - } - - private final PanelComponent panel = new PanelComponent(); - @Inject - private Client client; - @Inject - private RaidsPlugin plugin; - - @Inject - private RaidsPointsOverlay(final RaidsPlugin plugin) - { - super(plugin); - setPosition(OverlayPosition.TOP_RIGHT); - setPriority(OverlayPriority.HIGH); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Raids overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isInRaidChambers()) - { - return null; - } - - int totalPoints = client.getVar(Varbits.TOTAL_POINTS); - int personalPoints = client.getVar(Varbits.PERSONAL_POINTS); - int partySize = client.getVar(Varbits.RAID_PARTY_SIZE); - double uniqueChance = totalPoints / 867500f; - - panel.getChildren().clear(); - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - tableComponent.addRow("Total:", POINTS_FORMAT.format(totalPoints)); - tableComponent.addRow(client.getLocalPlayer().getName() + ":", POINTS_FORMAT.format(personalPoints)); - - - if (partySize > 1) - { - tableComponent.addRow("Party size:", String.valueOf(partySize)); - } - - tableComponent.addRow("Unique:", UNIQUE_FORMAT.format(uniqueChance)); - - panel.getChildren().add(tableComponent); - - return panel.render(graphics); - } -} \ No newline at end of file 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 deleted file mode 100644 index e33fd7c3c0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsTimer.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel - * 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.raids; - -import java.awt.Color; -import java.time.Duration; -import java.time.Instant; -import java.time.LocalTime; -import java.time.format.DateTimeFormatter; -import lombok.AccessLevel; -import lombok.Setter; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.ui.overlay.infobox.InfoBox; - -public class RaidsTimer extends InfoBox -{ - private final Instant startTime; - private Instant floorTime; - private LocalTime time; - private LocalTime firstFloorTime; - private LocalTime secondFloorTime; - private LocalTime thirdFloorTime; - private LocalTime olmTime; - - @Setter(AccessLevel.PACKAGE) - private boolean stopped; - - public RaidsTimer(Plugin plugin, Instant startTime) - { - super(null, plugin); - this.startTime = startTime; - floorTime = startTime; - stopped = false; - } - - void timeFloor() - { - Duration elapsed = Duration.between(floorTime, Instant.now()); - - if (firstFloorTime == null) - { - firstFloorTime = LocalTime.ofSecondOfDay(elapsed.getSeconds()); - } - else if (secondFloorTime == null) - { - secondFloorTime = LocalTime.ofSecondOfDay(elapsed.getSeconds()); - } - else if (thirdFloorTime == null) - { - thirdFloorTime = LocalTime.ofSecondOfDay(elapsed.getSeconds()); - } - - floorTime = Instant.now(); - } - - void timeOlm() - { - Duration elapsed = Duration.between(floorTime, Instant.now()); - olmTime = LocalTime.ofSecondOfDay(elapsed.getSeconds()); - } - - @Override - public String getTooltip() - { - StringBuilder builder = new StringBuilder(); - builder.append("Elapsed raid time: "); - builder.append(time.format(DateTimeFormatter.ofPattern("HH:mm:ss"))); - - if (firstFloorTime != null) - { - builder.append("
First floor: "); - builder.append(firstFloorTime.format(DateTimeFormatter.ofPattern("mm:ss"))); - } - - if (secondFloorTime != null) - { - builder.append("
Second floor: "); - builder.append(secondFloorTime.format(DateTimeFormatter.ofPattern("mm:ss"))); - } - - if (thirdFloorTime != null) - { - builder.append("
Third floor: "); - builder.append(thirdFloorTime.format(DateTimeFormatter.ofPattern("mm:ss"))); - } - - if (olmTime != null) - { - builder.append("
Olm: "); - builder.append(olmTime.format(DateTimeFormatter.ofPattern("mm:ss"))); - } - - 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/RoomType.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RoomType.java deleted file mode 100644 index a76b3cef82..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RoomType.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel - * 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.raids; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@AllArgsConstructor -@Getter -public enum RoomType -{ - START("Start", '#'), - END("End", '¤'), - SCAVENGERS("Scavengers", 'S'), - FARMING("Farming", 'F'), - EMPTY("Empty", ' '), - COMBAT("Combat", 'C'), - PUZZLE("Puzzle", 'P'); - - private final String name; - private final char code; - - RaidRoom getUnsolvedRoom() - { - switch (this) - { - case START: - return RaidRoom.START; - case END: - return RaidRoom.END; - case SCAVENGERS: - return RaidRoom.SCAVENGERS; - case FARMING: - return RaidRoom.FARMING; - case COMBAT: - return RaidRoom.UNKNOWN_COMBAT; - case PUZZLE: - return RaidRoom.UNKNOWN_PUZZLE; - case EMPTY: - default: - return RaidRoom.EMPTY; - } - } - - static RoomType fromCode(char code) - { - for (RoomType type : values()) - { - if (type.getCode() == code) - { - return type; - } - } - - return EMPTY; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutConfig.java deleted file mode 100644 index 750cc5cdf6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutConfig.java +++ /dev/null @@ -1,18 +0,0 @@ -package net.runelite.client.plugins.raids.shortcuts; - -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("shortcut") -public interface ShortcutConfig -{ - @ConfigItem( - keyName = "highlightShortcuts", - name = "Highlight shortcuts", - description = "Displays which shortcut it is" - ) - default boolean highlightShortcuts() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutOverlay.java deleted file mode 100644 index f98f739f2d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutOverlay.java +++ /dev/null @@ -1,114 +0,0 @@ -package net.runelite.client.plugins.raids.shortcuts; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Shape; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.Skill; -import net.runelite.api.TileObject; -import net.runelite.client.game.SkillIconManager; -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; - -@Singleton -public class ShortcutOverlay extends Overlay -{ - private final Client client; - private final ShortcutPlugin plugin; - private final BufferedImage treeIcon; - private final BufferedImage strengthIcon; - private final BufferedImage miningIcon; - - @Inject - ShortcutOverlay(final Client client, final ShortcutPlugin plugin, final SkillIconManager iconManager) - { - this.client = client; - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.LOW); - setLayer(OverlayLayer.ABOVE_SCENE); - - treeIcon = iconManager.getSkillImage(Skill.WOODCUTTING); - strengthIcon = iconManager.getSkillImage(Skill.STRENGTH); - miningIcon = iconManager.getSkillImage(Skill.MINING); - } - - @Override - public Dimension render(Graphics2D graphics) - { - for (TileObject shortcut : plugin.getShortcut()) - { - if (shortcut.getPlane() == client.getPlane()) - { - Shape poly; - if ((shortcut instanceof GameObject)) - { - poly = ((GameObject) shortcut).getConvexHull(); - } - else - { - poly = shortcut.getCanvasTilePoly(); - } - if (poly != null) - { - String name; - switch (shortcut.getId()) - { - case 29736: - name = "Tree"; - break; - case 29738: - name = "Rocks"; - break; - case 29740: - name = "Boulder"; - break; - case 29737: - case 29739: - default: - name = "null"; - } - if (plugin.isHighlightShortcuts()) - { - if (name.equals("Tree")) - { - Point canvasLoc = Perspective.getCanvasImageLocation(client, shortcut.getLocalLocation(), - treeIcon, 150); - if (canvasLoc != null) - { - graphics.drawImage(treeIcon, canvasLoc.getX(), canvasLoc.getY(), null); - } - } - if (name.equals("Rocks")) - { - Point canvasLoc = Perspective.getCanvasImageLocation(client, shortcut.getLocalLocation(), - miningIcon, 150); - if (canvasLoc != null) - { - graphics.drawImage(miningIcon, canvasLoc.getX(), canvasLoc.getY(), null); - } - } - if (name.equals("Boulder")) - { - Point canvasLoc = Perspective.getCanvasImageLocation(client, shortcut.getLocalLocation(), - strengthIcon, 150); - if (canvasLoc != null) - { - graphics.drawImage(strengthIcon, canvasLoc.getX(), canvasLoc.getY(), null); - } - } - } - } - } - } - return null; - } -} 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 deleted file mode 100644 index fd18868a1c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutPlugin.java +++ /dev/null @@ -1,109 +0,0 @@ -package net.runelite.client.plugins.raids.shortcuts; - -import com.google.inject.Provides; -import java.util.ArrayList; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.TileObject; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameObjectDespawned; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GameTick; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "Raids Shortcuts", - description = "Highlights Raid Shortcuts", - tags = {"boulder", "cox", "raids", "highlight"}, - type = PluginType.PVM -) -@Slf4j -@Singleton -public class ShortcutPlugin extends Plugin -{ - private final List shortcut = new ArrayList<>(); - @Inject - private Client client; - @Inject - private OverlayManager overlayManager; - @Inject - private ShortcutOverlay overlay; - @Inject - private ShortcutConfig config; - - @Getter(AccessLevel.PACKAGE) - private boolean highlightShortcuts; - - List getShortcut() - { - return shortcut; - } - - @Provides - ShortcutConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(ShortcutConfig.class); - } - - @Override - protected void startUp() - { - - this.highlightShortcuts = config.highlightShortcuts(); - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - } - - @Subscribe - private void onGameObjectSpawned(GameObjectSpawned event) - { - WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, event.getGameObject().getLocalLocation()); - if (worldPoint == null) - { - return; - } - if ((event.getGameObject().getId() == 29740) || (event.getGameObject().getId() == 29736) || (event.getGameObject().getId() == 29738)) - { - shortcut.add(event.getGameObject()); - } - } - - @Subscribe - private void onGameObjectDespawned(GameObjectDespawned event) - { - shortcut.remove(event.getGameObject()); - } - - @Subscribe - private void onGameTick(GameTick tick) - { - shortcut.removeIf(object -> object.getCanvasLocation() == null); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("shortcut")) - { - return; - } - - this.highlightShortcuts = config.highlightShortcuts(); - } -} 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 deleted file mode 100644 index 5694b2333c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/solver/Layout.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel - * 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.raids.solver; - -import java.util.ArrayList; -import java.util.List; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; - -public class Layout -{ - @Getter(AccessLevel.PUBLIC) - private final List rooms = new ArrayList<>(); - - @Getter(AccessLevel.PUBLIC) - @Setter(AccessLevel.PACKAGE) - private String code; - - public void add(Room room) - { - rooms.add(room); - } - - public Room getRoomAt(int position) - { - for (Room room : rooms) - { - if (room.getPosition() == position) - { - return room; - } - } - - return null; - } - - public String toCode() - { - StringBuilder builder = new StringBuilder(); - - for (Room room : rooms) - { - builder.append(room.getSymbol()); - } - - return builder.toString(); - } - - public String toCodeString() - { - return toCode().replaceAll("#", "").replaceAll("¤", ""); - } -} 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 deleted file mode 100644 index a189d78ca7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/solver/LayoutSolver.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel - * 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.raids.solver; - -import com.google.inject.Singleton; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; - -/* - * Implementation of https://github.com/WooxSolo/raids-layout - * Copyright (c) 2017 WooxSolo - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - */ -@Slf4j -@Singleton -public class LayoutSolver -{ - @Getter(AccessLevel.PACKAGE) - private static final List layouts = new ArrayList<>(); - private static final Pattern regex = Pattern.compile("^([A-Z]*)\\.([A-Z]*) - #([A-Z]*)#([A-Z]*)$"); - private static final String[] codes = - { - "FSCCP.PCSCF - #WNWSWN#ESEENW", - "FSCCS.PCPSF - #WSEEEN#WSWNWS", - "FSCPC.CSCPF - #WNWWSE#EENWWW", - "SCCFC.PSCSF - #EEENWW#WSEEEN", - "SCCFP.CCSPF - #NESEEN#WSWNWS", - "SCFCP.CCSPF - #ESEENW#ESWWNW", - "SCFCP.CSCFS - #ENEESW#ENWWSW", - "SCFCPC.CSPCSF - #ESWWNWS#NESENES", - "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", - "SCFCP.CSCPF - #ENESEN#WWWSEE", - "SCPFC.PCSCF - #WNEEES#NWSWNW", - "SFCCPC.PCSCPF - #WSEENES#WWWNEEE", - "FSPCC.PSCCF - #WWWSEE#ENWWSW", - "FSCCP.PCSCF - #ENWWWS#NEESEN", - "SCPFC.CCSSF - #NEESEN#WSWWNE", - }; - - public LayoutSolver() - { - build(); - } - - public Layout findLayout(String code) - { - Layout solution = null; - int matches = 0; - boolean match; - - for (Layout layout : layouts) - { - match = true; - - for (int i = 0; i < code.length(); i++) - { - Room room = layout.getRoomAt(i); - char c = code.charAt(i); - - if (room != null && c != ' ' && c != room.getSymbol()) - { - match = false; - break; - } - } - - if (match) - { - solution = layout; - matches++; - log.debug("Found matching layout: " + layout.toCode()); - } - } - - if (matches == 1) - { - return solution; - } - - return null; - } - - private int calcStart(String directions) - { - int startPos = 0; - int position = 0; - - for (int i = 0; i < directions.length(); i++) - { - char c = directions.charAt(i); - int delta = dirToPosDelta(c); - position += delta; - - if (position < 0 || position >= 8 || (position == 3 && delta == -1) || (position == 4 && delta == 1)) - { - position -= delta; - startPos -= delta; - } - } - - return startPos; - } - - private int dirToPosDelta(char direction) - { - switch (String.valueOf(direction)) - { - case "N": - return -4; - - case "E": - return 1; - - case "S": - return 4; - - case "W": - return -1; - - default: - return 0; - } - } - - private void build() - { - for (String code : codes) - { - Matcher match = regex.matcher(code); - - if (!match.find()) - { - continue; - } - - String symbols, directions; - int position = calcStart(match.group(3)); - Layout layout = new Layout(); - Room lastRoom = null; - Room room; - - for (int floor = 0; floor < 2; floor++) - { - symbols = match.group(1 + floor); - directions = match.group(3 + floor); - - for (int i = 0; i < directions.length(); i++) - { - char symbol = (i == 0 ? '#' : symbols.charAt(i - 1)); - - room = new Room(position, symbol); - - if (lastRoom != null) - { - lastRoom.setNext(room); - room.setPrevious(lastRoom); - } - - layout.add(room); - lastRoom = room; - - int delta = dirToPosDelta(directions.charAt(i)); - position += delta; - } - - room = new Room(position, '¤'); - room.setPrevious(lastRoom); - if (lastRoom != null) - { - lastRoom.setNext(room); - } - layout.add(room); - layout.setCode(code); - position += 8; - } - - layouts.add(layout); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/solver/Room.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/solver/Room.java deleted file mode 100644 index ab231774ed..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/solver/Room.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel - * 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.raids.solver; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; - -public class Room -{ - @Getter(AccessLevel.PUBLIC) - private final int position; - - @Getter(AccessLevel.PUBLIC) - private final char symbol; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private Room next; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private Room previous; - - Room(final int position, final char symbol) - { - this.position = position; - this.symbol = symbol; - } -} 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 deleted file mode 100644 index 97fad21eaf..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/solver/RotationSolver.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel - * 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.raids.solver; - -import com.google.common.collect.ImmutableList; -import net.runelite.client.plugins.raids.RaidRoom; -import net.runelite.client.plugins.raids.RoomType; -import java.util.ArrayList; -import java.util.List; -import static net.runelite.client.plugins.raids.RaidRoom.GUARDIANS; -import static net.runelite.client.plugins.raids.RaidRoom.MUTTADILES; -import static net.runelite.client.plugins.raids.RaidRoom.MYSTICS; -import static net.runelite.client.plugins.raids.RaidRoom.SHAMANS; -import static net.runelite.client.plugins.raids.RaidRoom.TEKTON; -import static net.runelite.client.plugins.raids.RaidRoom.UNKNOWN_COMBAT; -import static net.runelite.client.plugins.raids.RaidRoom.VANGUARDS; -import static net.runelite.client.plugins.raids.RaidRoom.VASA; -import static net.runelite.client.plugins.raids.RaidRoom.VESPULA; - -public class RotationSolver -{ - private static final ImmutableList> ROTATIONS = ImmutableList.of - ( - ImmutableList.of(TEKTON, VASA, GUARDIANS, MYSTICS, SHAMANS, MUTTADILES, VANGUARDS, VESPULA), - ImmutableList.of(TEKTON, MUTTADILES, GUARDIANS, VESPULA, SHAMANS, VASA, VANGUARDS, MYSTICS), - ImmutableList.of(VESPULA, VANGUARDS, MUTTADILES, SHAMANS, MYSTICS, GUARDIANS, VASA, TEKTON), - ImmutableList.of(MYSTICS, VANGUARDS, VASA, SHAMANS, VESPULA, GUARDIANS, MUTTADILES, TEKTON) - ); - - public static boolean solve(RaidRoom[] rooms) - { - if (rooms == null) - { - return false; - } - - List> matches = new ArrayList<>(); - Integer start = null; - Integer index = null; - int known = 0; - - for (int i = 0; i < rooms.length; i++) - { - if (rooms[i] == null || rooms[i].getType() != RoomType.COMBAT || rooms[i] == UNKNOWN_COMBAT) - { - continue; - } - - if (start == null) - { - start = i; - } - - known++; - } - - if (known < 2) - { - return false; - } - - if (known == rooms.length) - { - return true; - } - - //Iterate over each rotation - for (ImmutableList rotation : ROTATIONS) - { - //Determine the index of the first known combat room in this rotation - int rotationStart = rotation.indexOf(rooms[start]); - - //Iterate over each room (except the starting room) and determine whether or not the rotation still matches - int roomStep = 1; - boolean doesNotMatch = false; - while (roomStep < rooms.length && !doesNotMatch) - { - var roomIndex = (start + roomStep) % rooms.length; - var rotationRoomIndex = (rotationStart + roomStep) % rotation.size(); - if (rooms[roomIndex] != UNKNOWN_COMBAT && rooms[roomIndex] != rotation.get(rotationRoomIndex)) - { - doesNotMatch = true; - } - - ++roomStep; - } - - if (!doesNotMatch) - { - //Found a matching rotation! - matches.add(rotation); - index = rotationStart - start; - } - } - - if (matches.size() != 1) - { - //Could not find a unique match! - return false; - } - - List match = matches.get(0); - - - for (int i = 0; i < rooms.length; i++) - { - if (rooms[i].getType() != RoomType.COMBAT || rooms[i] == UNKNOWN_COMBAT) - { - rooms[i] = match.get(Math.floorMod((index + i), match.size())); - } - } - return true; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/BatSolver/BatSolver.java b/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/BatSolver/BatSolver.java deleted file mode 100644 index 4d1b16f714..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/BatSolver/BatSolver.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) 2018, Tim Lehner - * 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.raidsthieving.BatSolver; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; -import java.util.stream.Collectors; - -public class BatSolver -{ - private Map numberOfSolutionsWithPoison; - private final SolutionSet solution; - private final ThievingRoomType roomType; - private final Set grubsChests; - - public BatSolver(final ThievingRoomType roomType) - { - solution = new SolutionSet(); - grubsChests = new HashSet<>(); - this.roomType = roomType; - } - - public void addEmptyChest(int chestId) - { - // When a new empty chest is found, add it to the current solution set - solution.addEmptyChest(chestId); - calculateChanceOfPoison(); - } - - public void addGrubsChest(int chestId) - { - // When a chest with grubs is found, keep track of it to invalidate solutions - grubsChests.add(chestId); - calculateChanceOfPoison(); - } - - public Set matchSolutions() - { - Set possibleEmptyChests = new TreeSet<>(); - - List> sols = SolutionSet.SOLUTION_SETS.get(roomType).stream() - .filter(this::matchSolution) - .map(SolutionSet::getEmptyChests) - .collect(Collectors.toList()); - - for (Set sol : sols) - { - possibleEmptyChests.addAll(sol); - } - - return possibleEmptyChests; - } - - private boolean matchSolution(SolutionSet testSolution) - { - for (Integer grubsChest : grubsChests) - { - if (testSolution.containsChest(grubsChest)) - { - // If one of the chests is known to have grubs, it cannot be a solution - return false; - } - } - - boolean matchesAll = true; - boolean everMatched = false; - for (int i : solution.getEmptyChests()) - { - if (!testSolution.containsChest(i)) - { - matchesAll = false; - } - else - { - everMatched = true; - } - } - return matchesAll && everMatched; - } - - private void calculateChanceOfPoison() - { - numberOfSolutionsWithPoison = new HashMap<>(); - for (SolutionSet sol : getPosssibleSolutions()) - { - if (solution.getEmptyChests().size() == 0 || matchSolution(sol)) - { - for (Integer i : sol.getEmptyChests()) - { - if (numberOfSolutionsWithPoison.containsKey(i)) - { - numberOfSolutionsWithPoison.put(i, numberOfSolutionsWithPoison.get(i) + 1); - } - else - { - numberOfSolutionsWithPoison.put(i, 1); - } - } - } - } - } - - private List getPosssibleSolutions() - { - List possibleSolutions = new ArrayList<>(); - for (SolutionSet soln : SolutionSet.SOLUTION_SETS.get(roomType)) - { - // Check if we've found grubs in one of the chests, invalidating it as an solution - boolean foundMatch = false; - for (int i : grubsChests) - { - if (soln.containsChest(i)) - { - foundMatch = true; - } - } - if (!foundMatch) - { - possibleSolutions.add(soln); - } - } - return possibleSolutions; - } - - public double relativeLikelihoodPoison(int chestId) - { - // Returns a double between 0 and 1 of how likely the chest has poison based on the number of possible solutions - // Uses a Sigmoid like function to give good contrast in drawn opacity, - // perhaps could be changed to something more accurate quantitavely. - if (numberOfSolutionsWithPoison == null) - { - calculateChanceOfPoison(); - } - if (numberOfSolutionsWithPoison == null) - { - return 1.0; - } - int mostFrequentPoison = 0; - for (Map.Entry entry : numberOfSolutionsWithPoison.entrySet()) - { - if (entry.getValue() > mostFrequentPoison) - { - mostFrequentPoison = entry.getValue(); - } - } - int timesFound = 0; - if (numberOfSolutionsWithPoison.containsKey(chestId)) - { - timesFound = numberOfSolutionsWithPoison.get(chestId); - } - double chestChance = (double) (timesFound) / (double) (mostFrequentPoison); - return 1. / (1 + Math.exp(5 - 10 * chestChance)); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/BatSolver/ChestIdentifier.java b/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/BatSolver/ChestIdentifier.java deleted file mode 100644 index 45c2bdffd3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/BatSolver/ChestIdentifier.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (c) 2018, Tim Lehner - * 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.raidsthieving.BatSolver; - -import java.util.HashMap; -import java.util.Map; -import net.runelite.api.Point; -import net.runelite.client.plugins.raidsthieving.ThievingChest; - -public class ChestIdentifier -{ - public ChestIdentifier(final ThievingRoomType roomType) - { - chestIds = new HashMap<>(); - switch (roomType) - { - case LEFT_TURN: - chestIds.put(new Point(3283, 5379), 1); - chestIds.put(new Point(3285, 5380), 2); - chestIds.put(new Point(3279, 5381), 3); - chestIds.put(new Point(3287, 5382), 4); - chestIds.put(new Point(3281, 5382), 5); - chestIds.put(new Point(3284, 5383), 6); - chestIds.put(new Point(3283, 5384), 7); - chestIds.put(new Point(3286, 5384), 8); - chestIds.put(new Point(3288, 5384), 9); - chestIds.put(new Point(3277, 5385), 10); - chestIds.put(new Point(3280, 5385), 11); - chestIds.put(new Point(3285, 5386), 12); - chestIds.put(new Point(3290, 5386), 13); - chestIds.put(new Point(3275, 5387), 14); - chestIds.put(new Point(3287, 5387), 15); - chestIds.put(new Point(3288, 5387), 16); - chestIds.put(new Point(3281, 5388), 17); - chestIds.put(new Point(3291, 5388), 18); - chestIds.put(new Point(3280, 5389), 19); - chestIds.put(new Point(3285, 5389), 20); - chestIds.put(new Point(3289, 5389), 21); - chestIds.put(new Point(3283, 5390), 22); - chestIds.put(new Point(3285, 5390), 23); - chestIds.put(new Point(3288, 5390), 24); - chestIds.put(new Point(3290, 5390), 25); - chestIds.put(new Point(3282, 5391), 26); - chestIds.put(new Point(3289, 5391), 27); - chestIds.put(new Point(3292, 5391), 28); - chestIds.put(new Point(3279, 5392), 29); - chestIds.put(new Point(3276, 5393), 30); - chestIds.put(new Point(3279, 5393), 31); - chestIds.put(new Point(3284, 5393), 32); - chestIds.put(new Point(3285, 5393), 33); - chestIds.put(new Point(3291, 5393), 34); - chestIds.put(new Point(3275, 5394), 35); - chestIds.put(new Point(3277, 5394), 36); - chestIds.put(new Point(3288, 5394), 37); - chestIds.put(new Point(3276, 5395), 38); - chestIds.put(new Point(3281, 5395), 39); - chestIds.put(new Point(3285, 5395), 40); - chestIds.put(new Point(3287, 5395), 41); - chestIds.put(new Point(3289, 5395), 42); - chestIds.put(new Point(3274, 5396), 43); - chestIds.put(new Point(3283, 5396), 44); - chestIds.put(new Point(3285, 5396), 45); - chestIds.put(new Point(3288, 5396), 46); - chestIds.put(new Point(3272, 5397), 47); - chestIds.put(new Point(3280, 5397), 48); - chestIds.put(new Point(3277, 5398), 49); - chestIds.put(new Point(3281, 5398), 50); - chestIds.put(new Point(3284, 5398), 51); - chestIds.put(new Point(3276, 5399), 52); - chestIds.put(new Point(3278, 5399), 53); - chestIds.put(new Point(3283, 5399), 54); - chestIds.put(new Point(3285, 5399), 55); - chestIds.put(new Point(3277, 5400), 56); - chestIds.put(new Point(3284, 5400), 57); - chestIds.put(new Point(3288, 5400), 58); - chestIds.put(new Point(3281, 5401), 59); - chestIds.put(new Point(3286, 5401), 60); - chestIds.put(new Point(3279, 5402), 61); - chestIds.put(new Point(3285, 5402), 62); - chestIds.put(new Point(3280, 5403), 63); - chestIds.put(new Point(3283, 5403), 64); - break; - case RIGHT_TURN: - chestIds.put(new Point(3338, 5405), 1); - chestIds.put(new Point(3334, 5405), 2); - chestIds.put(new Point(3342, 5404), 3); - chestIds.put(new Point(3340, 5404), 4); - chestIds.put(new Point(3345, 5403), 5); - chestIds.put(new Point(3334, 5403), 6); - chestIds.put(new Point(3330, 5403), 7); - chestIds.put(new Point(3343, 5402), 8); - chestIds.put(new Point(3342, 5402), 9); - chestIds.put(new Point(3339, 5402), 10); - chestIds.put(new Point(3338, 5402), 11); - chestIds.put(new Point(3336, 5402), 12); - chestIds.put(new Point(3347, 5401), 13); - chestIds.put(new Point(3330, 5401), 14); - chestIds.put(new Point(3345, 5400), 15); - chestIds.put(new Point(3341, 5400), 16); - chestIds.put(new Point(3337, 5400), 17); - chestIds.put(new Point(3334, 5400), 18); - chestIds.put(new Point(3345, 5399), 19); - chestIds.put(new Point(3343, 5399), 20); - chestIds.put(new Point(3340, 5399), 21); - chestIds.put(new Point(3335, 5399), 22); - chestIds.put(new Point(3331, 5399), 23); - chestIds.put(new Point(3338, 5398), 24); - chestIds.put(new Point(3337, 5398), 25); - chestIds.put(new Point(3345, 5397), 26); - chestIds.put(new Point(3341, 5397), 27); - chestIds.put(new Point(3334, 5397), 28); - chestIds.put(new Point(3331, 5397), 29); - chestIds.put(new Point(3346, 5396), 30); - chestIds.put(new Point(3343, 5396), 31); - chestIds.put(new Point(3339, 5396), 32); - chestIds.put(new Point(3335, 5396), 33); - chestIds.put(new Point(3333, 5396), 34); - chestIds.put(new Point(3340, 5395), 35); - chestIds.put(new Point(3337, 5395), 36); - chestIds.put(new Point(3334, 5395), 37); - chestIds.put(new Point(3345, 5394), 38); - chestIds.put(new Point(3342, 5394), 39); - chestIds.put(new Point(3332, 5394), 40); - chestIds.put(new Point(3343, 5393), 41); - chestIds.put(new Point(3341, 5393), 42); - chestIds.put(new Point(3338, 5393), 43); - chestIds.put(new Point(3335, 5393), 44); - chestIds.put(new Point(3334, 5393), 45); - chestIds.put(new Point(3346, 5392), 46); - chestIds.put(new Point(3342, 5392), 47); - chestIds.put(new Point(3332, 5392), 48); - chestIds.put(new Point(3350, 5391), 49); - chestIds.put(new Point(3346, 5391), 50); - chestIds.put(new Point(3340, 5391), 51); - chestIds.put(new Point(3339, 5391), 52); - chestIds.put(new Point(3336, 5391), 53); - chestIds.put(new Point(3333, 5391), 54); - chestIds.put(new Point(3349, 5390), 55); - chestIds.put(new Point(3343, 5390), 56); - chestIds.put(new Point(3337, 5390), 57); - chestIds.put(new Point(3335, 5390), 58); - chestIds.put(new Point(3344, 5389), 59); - chestIds.put(new Point(3340, 5389), 60); - chestIds.put(new Point(3336, 5389), 61); - chestIds.put(new Point(3333, 5389), 62); - chestIds.put(new Point(3346, 5388), 63); - chestIds.put(new Point(3340, 5387), 64); - chestIds.put(new Point(3337, 5386), 65); - chestIds.put(new Point(3333, 5386), 66); - chestIds.put(new Point(3338, 5385), 67); - chestIds.put(new Point(3336, 5385), 68); - chestIds.put(new Point(3337, 5384), 69); - chestIds.put(new Point(3340, 5382), 70); - chestIds.put(new Point(3334, 5383), 71); - chestIds.put(new Point(3340, 5379), 72); - chestIds.put(new Point(3338, 5380), 73); - chestIds.put(new Point(3336, 5381), 74); - break; - case STRAIGHT: - chestIds.put(new Point(3308, 5378), 1); - chestIds.put(new Point(3305, 5379), 2); - chestIds.put(new Point(3307, 5379), 3); - chestIds.put(new Point(3304, 5381), 4); - chestIds.put(new Point(3310, 5381), 5); - chestIds.put(new Point(3302, 5382), 6); - chestIds.put(new Point(3307, 5382), 7); - chestIds.put(new Point(3312, 5382), 8); - chestIds.put(new Point(3317, 5382), 9); - chestIds.put(new Point(3319, 5382), 10); - chestIds.put(new Point(3304, 5383), 11); - chestIds.put(new Point(3305, 5383), 12); - chestIds.put(new Point(3307, 5383), 13); - chestIds.put(new Point(3310, 5383), 14); - chestIds.put(new Point(3315, 5383), 15); - chestIds.put(new Point(3320, 5383), 16); - chestIds.put(new Point(3300, 5384), 17); - chestIds.put(new Point(3309, 5384), 18); - chestIds.put(new Point(3311, 5384), 19); - chestIds.put(new Point(3313, 5384), 20); - chestIds.put(new Point(3317, 5384), 21); - chestIds.put(new Point(3318, 5384), 22); - chestIds.put(new Point(3302, 5385), 23); - chestIds.put(new Point(3306, 5385), 24); - chestIds.put(new Point(3310, 5385), 25); - chestIds.put(new Point(3313, 5385), 26); - chestIds.put(new Point(3320, 5385), 27); - chestIds.put(new Point(3302, 5386), 28); - chestIds.put(new Point(3305, 5386), 29); - chestIds.put(new Point(3316, 5386), 30); - chestIds.put(new Point(3321, 5386), 31); - chestIds.put(new Point(3300, 5387), 32); - chestIds.put(new Point(3308, 5387), 33); - chestIds.put(new Point(3314, 5387), 34); - chestIds.put(new Point(3317, 5387), 35); - chestIds.put(new Point(3301, 5388), 36); - chestIds.put(new Point(3306, 5388), 37); - chestIds.put(new Point(3312, 5388), 38); - chestIds.put(new Point(3322, 5388), 39); - chestIds.put(new Point(3309, 5389), 40); - chestIds.put(new Point(3311, 5389), 41); - chestIds.put(new Point(3313, 5389), 42); - chestIds.put(new Point(3316, 5389), 43); - chestIds.put(new Point(3320, 5389), 44); - chestIds.put(new Point(3300, 5390), 45); - chestIds.put(new Point(3303, 5390), 46); - chestIds.put(new Point(3304, 5390), 47); - chestIds.put(new Point(3312, 5390), 48); - chestIds.put(new Point(3320, 5390), 49); - chestIds.put(new Point(3307, 5391), 50); - chestIds.put(new Point(3310, 5391), 51); - chestIds.put(new Point(3317, 5391), 52); - chestIds.put(new Point(3318, 5391), 53); - chestIds.put(new Point(3323, 5391), 54); - chestIds.put(new Point(3301, 5392), 55); - chestIds.put(new Point(3303, 5392), 56); - chestIds.put(new Point(3309, 5392), 57); - chestIds.put(new Point(3314, 5392), 58); - chestIds.put(new Point(3322, 5392), 59); - chestIds.put(new Point(3305, 5393), 60); - chestIds.put(new Point(3307, 5393), 61); - chestIds.put(new Point(3316, 5393), 62); - chestIds.put(new Point(3309, 5394), 63); - chestIds.put(new Point(3312, 5394), 64); - chestIds.put(new Point(3322, 5394), 65); - chestIds.put(new Point(3310, 5379), 66); - break; - } - } - - public void indentifyChest(ThievingChest chest) - { - int id = chestIds.getOrDefault(chest.getInstancePoint(), -1); - chest.setChestId(id); - } - - private final Map chestIds; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/BatSolver/SolutionSet.java b/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/BatSolver/SolutionSet.java deleted file mode 100644 index 05560c1f14..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/BatSolver/SolutionSet.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2018, Tim Lehner - * 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.raidsthieving.BatSolver; - -import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.Multimap; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import lombok.AccessLevel; -import lombok.Getter; - -// Each Thieving room has 4 empty chests -// User-reported data shows these 4 come in groups, -// -// e.g. if there is an empty chest in L room chest 1, the other empty chests could be 16, 17, 38, 54, 55 -// See https://dikkenoob.github.io/ for more information - -class SolutionSet -{ - static final Multimap SOLUTION_SETS = - ImmutableMultimap.builder() - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(1, 16, 17, 55)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(1, 17, 38, 54)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(2, 7, 21, 37)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(3, 5, 19, 30)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(3, 11, 15, 40)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(4, 22, 27, 46)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(5, 9, 19, 45)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(6, 24, 26, 41)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(6, 26, 32, 52)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(7, 13, 44, 59)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(8, 14, 41, 43)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(8, 10, 28, 33)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(8, 31, 47, 50)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(10, 35, 54, 63)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(10, 30, 32, 59)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(12, 40, 53, 56)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(12, 13, 42, 54)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(13, 22, 27, 46)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(14, 18, 23, 51)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(15, 43, 44, 58)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(15, 16, 42, 45)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(20, 29, 45, 51)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(20, 25, 32, 34)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(20, 28, 51, 62)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(21, 39, 41, 58)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(22, 25, 54, 64)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(23, 31, 47, 55)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(23, 33, 37, 60)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(24, 34, 55)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(26, 50, 63, 27)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(29, 39, 41, 61)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(33, 46, 52, 57)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(34, 45, 49, 60)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(36, 40, 42, 62)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(37, 38, 51, 64)) - .put(ThievingRoomType.LEFT_TURN, new SolutionSet(48, 53, 55, 56)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(1, 6, 28, 41)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(1, 42, 55, 60)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(2, 10, 31, 44)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(2, 33, 51, 68)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(3, 31, 43, 46)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(3, 5, 21, 48)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(4, 20, 24, 33)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(4, 38, 47)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(5, 21, 48)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(5, 17, 35, 63)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(7, 17, 45, 47)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(7, 37, 41, 52)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(8, 13, 40, 42)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(8, 20, 24, 30)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(9, 15, 23, 35)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(11, 13, 21, 50)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(11, 18, 37, 39)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(12, 14, 27, 34)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(14, 45, 67, 71)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(16, 22, 29, 32)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(18, 28, 31, 64)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(19, 21, 63, 69)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(20, 51, 68, 72)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(22, 29, 56, 61)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(23, 53, 66, 74)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(26, 35, 53, 59)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(27, 30, 55, 57)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(31, 58, 60, 73)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(34, 57, 58, 70)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(38, 56, 61, 70)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(40, 54, 65, 72)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(42, 46, 65)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(47, 49, 66, 67)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(48, 62, 69)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(9, 19, 32, 41)) - .put(ThievingRoomType.RIGHT_TURN, new SolutionSet(16, 26, 36, 39)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(1, 39, 43, 51)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(2, 15, 20, 53)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(3, 10, 42, 44)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(4, 14, 38, 52)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(5, 6, 35, 41)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(7, 16, 34, 49)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(9, 12, 26, 27)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(13, 25, 30, 31)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(15, 20, 53)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(17, 24, 34, 58)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(18, 23, 35, 57)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(19, 26, 47, 65)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(21, 33, 36, 61)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(21, 54, 66)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(22, 25, 46, 55)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(24, 34, 58)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(28, 40, 52, 62)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(29, 41, 42, 63)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(30, 32, 37, 64)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(39, 43, 51)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(43, 45, 50, 60)) - .put(ThievingRoomType.STRAIGHT, new SolutionSet(51, 53, 56, 59)) - .build(); - - SolutionSet() - { - emptyChests = new HashSet<>(); - } - - private SolutionSet(final Integer... emptyChests) - { - this.emptyChests = new HashSet<>(Arrays.asList(emptyChests)); - } - - void addEmptyChest(int chestId) - { - emptyChests.add(chestId); - } - - boolean containsChest(int chestId) - { - return emptyChests.contains(chestId); - } - - @Getter(AccessLevel.PACKAGE) - private Set emptyChests; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/BatSolver/ThievingRoomType.java b/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/BatSolver/ThievingRoomType.java deleted file mode 100644 index b319f24c06..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/BatSolver/ThievingRoomType.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2018, Tim Lehner - * 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.raidsthieving.BatSolver; - -// There are three distinct Thieving rooms, distinguished by the position of the entrance relative to the exit -// e.g. If you enter the room and must turn left to get to the exit and trough, this is a LEFT_TURN - -import net.runelite.api.Point; - -public enum ThievingRoomType -{ - LEFT_TURN(3271, 5389), - RIGHT_TURN(3350, 5399), - STRAIGHT(3317, 5397); - - private final int x; - private final int y; - - ThievingRoomType(final int x, final int y) - { - this.x = x; - this.y = y; - } - - public static ThievingRoomType identifyByInstancePoint(Point point) - { - for (ThievingRoomType type : ThievingRoomType.values()) - { - if (Math.abs(type.x - point.getX()) <= 1 && - Math.abs(type.y - point.getY()) <= 1) - { - return type; - } - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/ChestOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/ChestOverlay.java deleted file mode 100644 index 9688760b69..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/ChestOverlay.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2018, Tim Lehner - * 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.raidsthieving; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.Map; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.plugins.raidsthieving.BatSolver.BatSolver; -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.components.ProgressPieComponent; - -/** - * Represents the overlay that shows timers on traps that are placed by the - * player. - */ -@Singleton -public class ChestOverlay extends Overlay -{ - - private final Client client; - private final RaidsThievingPlugin plugin; - - @Inject - ChestOverlay(final Client client, final RaidsThievingPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.plugin = plugin; - this.client = client; - } - - @Override - public Dimension render(Graphics2D graphics) - { - drawChests(graphics); - return null; - } - - /** - * Iterates over all the traps that were placed by the local player, and - * draws a circle or a timer on the trap, depending on the trap state. - * - * @param graphics - */ - private void drawChests(Graphics2D graphics) - { - for (Map.Entry entry : plugin.getChests().entrySet()) - { - ThievingChest chest = entry.getValue(); - WorldPoint pos = entry.getKey(); - - if (chest != null) - { - if (!plugin.isBatsFound() && !chest.isEverOpened() && shouldDrawChest(pos)) - { - Color drawColor = new Color(plugin.getPotentialBatColor().getRed(), - plugin.getPotentialBatColor().getGreen(), - plugin.getPotentialBatColor().getBlue(), - getChestOpacity(pos)); - drawCircleOnTrap(graphics, chest, drawColor); - } - if (chest.isPoison()) - { - drawCircleOnTrap(graphics, chest, plugin.getPoisonTrapColor()); - } - } - } - } - - private boolean shouldDrawChest(WorldPoint chestPos) - { - if (plugin.numberOfEmptyChestsFound() == 0) - { - return true; - } - int chestId = plugin.getChestId(chestPos); - BatSolver solver = plugin.getSolver(); - if (solver != null && chestId != -1) - { - Set matches = solver.matchSolutions(); - return matches.contains(chestId) || matches.size() == 0; - } - return true; - } - - /** - * Draws a timer on a given trap. - * - * @param graphics - * @param chest The chest on which the circle needs to be drawn - * @param fill The fill color of the timer - */ - private void drawCircleOnTrap(Graphics2D graphics, ThievingChest chest, Color fill) - { - if (chest.getWorldPoint().getPlane() != client.getPlane()) - { - return; - } - - LocalPoint localLoc = LocalPoint.fromWorld(client, chest.getWorldPoint()); - if (localLoc == null) - { - return; - } - - Point loc = Perspective.localToCanvas(client, localLoc, chest.getWorldPoint().getPlane()); - ProgressPieComponent pie = new ProgressPieComponent(); - pie.setFill(fill); - pie.setBorderColor(Color.BLACK); - pie.setPosition(loc); - pie.setProgress(1); - if (graphics != null && loc != null) - { - pie.render(graphics); - } - } - - private int getChestOpacity(WorldPoint chestPos) - { - int chestId = plugin.getChestId(chestPos); - BatSolver solver = plugin.getSolver(); - if (solver != null && chestId != -1) - { - return (int) (255 * solver.relativeLikelihoodPoison(chestId)); - } - return 255; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/RaidsThievingConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/RaidsThievingConfig.java deleted file mode 100644 index 9b11b7fdc9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/RaidsThievingConfig.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2017, Tim Lehner - * 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.raidsthieving; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("raidsthievingplugin") -public interface RaidsThievingConfig extends Config -{ - @ConfigItem( - position = 1, - keyName = "hexColorPotentialBat", - name = "Potential Bat", - description = "Color of marker for chests which could have bat" - ) - default Color getPotentialBatColor() - { - return Color.YELLOW; - } - - @ConfigItem( - position = 2, - keyName = "hexColorPoison", - name = "Poison trap", - description = "Color of chest with poison" - ) - default Color getPoisonTrapColor() - { - return Color.GREEN; - } - - @ConfigItem( - position = 3, - keyName = "batNotify", - name = "Notify when found", - description = "Send notification if you see bats being found." - ) - default boolean batFoundNotify() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/RaidsThievingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/RaidsThievingPlugin.java deleted file mode 100644 index 7810026c09..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/RaidsThievingPlugin.java +++ /dev/null @@ -1,324 +0,0 @@ -/* - * Copyright (c) 2017, Tim Lehner - * 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.raidsthieving; - -import com.google.inject.Provides; -import java.awt.Color; -import java.time.Instant; -import java.util.HashMap; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import static net.runelite.api.Constants.CHUNK_SIZE; -import net.runelite.api.GameObject; -import net.runelite.api.GraphicID; -import net.runelite.api.GraphicsObject; -import net.runelite.api.ObjectID; -import net.runelite.api.Point; -import net.runelite.api.Varbits; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GraphicsObjectCreated; -import net.runelite.api.events.VarbitChanged; -import net.runelite.client.Notifier; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.raidsthieving.BatSolver.BatSolver; -import net.runelite.client.plugins.raidsthieving.BatSolver.ChestIdentifier; -import net.runelite.client.plugins.raidsthieving.BatSolver.ThievingRoomType; -import net.runelite.client.ui.overlay.OverlayManager; - -@PluginDescriptor( - name = "Raids Bat Finder", - description = "Tracks which chests need to be searched for bats and which poison", - tags = {"overlay", "skilling", "raid"}, - type = PluginType.PVM, - enabledByDefault = false -) -@Singleton -public class RaidsThievingPlugin extends Plugin -{ - private static final double CHUNK_OFFSET = 3.5; - - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private ChestOverlay overlay; - - @Inject - private Notifier notifier; - - @Inject - private RaidsThievingConfig config; - - @Getter(AccessLevel.PACKAGE) - private final Map chests = new HashMap<>(); - @Getter(AccessLevel.PACKAGE) - private Instant lastActionTime = Instant.ofEpochMilli(0); - @Getter(AccessLevel.PACKAGE) - private boolean batsFound; - @Getter(AccessLevel.PACKAGE) - private BatSolver solver; - @Getter(AccessLevel.PACKAGE) - private ChestIdentifier mapper; - @Getter(AccessLevel.PACKAGE) - private Color potentialBatColor; - @Getter(AccessLevel.PACKAGE) - private Color poisonTrapColor; - private boolean batFoundNotify; - private boolean inRaidChambers; - - @Provides - RaidsThievingConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(RaidsThievingConfig.class); - } - - @Override - protected void startUp() - { - reset(); - updateConfig(); - - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - lastActionTime = Instant.ofEpochMilli(0); - chests.clear(); - - } - - @Subscribe - private void onGameObjectSpawned(GameObjectSpawned event) - { - GameObject obj = event.getGameObject(); - WorldPoint worldLoc = obj.getWorldLocation(); - Point instanceLoc = buildFromPoint(worldLoc, client); - - if (obj.getId() == ObjectID.TROUGH_29746) - { - ThievingRoomType type = ThievingRoomType.identifyByInstancePoint(instanceLoc); - - if (type != null) - { - solver = new BatSolver(type); - mapper = new ChestIdentifier(type); - for (ThievingChest chest : chests.values()) - { - mapper.indentifyChest(chest); - } - } - } - - if (obj.getId() == ObjectID.CHEST_29742) - { - if (!chests.containsKey(worldLoc)) - { - ThievingChest chest = new ThievingChest(worldLoc, instanceLoc); - - if (mapper != null) - { - mapper.indentifyChest(chest); - } - - chests.put(worldLoc, chest); - } - else - { - checkForBats(); - } - } - - if (obj.getId() == ObjectID.CHEST_29744 || obj.getId() == ObjectID.CHEST_29745) - { - ThievingChest chest = chests.get(obj.getWorldLocation()); - if (solver != null && chest != null && chest.getChestId() != -1) - { - chest.setEverOpened(true); - solver.addGrubsChest(chest.getChestId()); - } - checkForBats(); - } - - if (obj.getId() == ObjectID.CHEST_29743) - { - ThievingChest chest = chests.get(obj.getWorldLocation()); - // We found a chest that could have poison - if (solver != null && chest.getChestId() != -1) - { - chest.setEmpty(true); - chest.setEverOpened(true); - solver.addEmptyChest(chest.getChestId()); - } - } - } - - @Subscribe - private void onGraphicsObjectCreated(GraphicsObjectCreated event) - { - GraphicsObject obj = event.getGraphicsObject(); - if (obj.getId() == GraphicID.POISON_SPLAT) - { - WorldPoint loc = WorldPoint.fromLocal(client, obj.getLocation()); - - if (chests.get(loc) == null) - { - return; - } - - chests.get(loc).setPoison(true); - } - } - - @Subscribe - private void onVarbitChanged(VarbitChanged event) - { - boolean setting = client.getVar(Varbits.IN_RAID) == 1; - - if (inRaidChambers != setting) - { - inRaidChambers = setting; - reset(); - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("raidsthievingplugin")) - { - updateConfig(); - } - } - - private void reset() - { - chests.clear(); - batsFound = false; - solver = null; - mapper = null; - } - - int numberOfEmptyChestsFound() - { - int total = 0; - for (ThievingChest chest : chests.values()) - { - if (chest.isEmpty()) - { - total++; - } - } - return total; - } - - private void checkForBats() - { - for (ThievingChest chest : chests.values()) - { - if (chest.isEmpty() && !chest.isPoison()) - { - batsFound = true; - if (this.batFoundNotify) - { - notifier.notify("Bats have been found!"); - } - return; - } - } - } - - int getChestId(WorldPoint worldPoint) - { - return chests.get(worldPoint).getChestId(); - } - - private static Point buildFromPoint(WorldPoint worldPoint, Client client) - { - Point point = new Point(worldPoint.getX(), worldPoint.getY()); - Point base = new Point(client.getBaseX(), client.getBaseY()); - int plane = worldPoint.getPlane(); - - int deltaX = point.getX() - base.getX(); - int deltaY = point.getY() - base.getY(); - int chunkIndexX = deltaX / CHUNK_SIZE; - int chunkIndexY = deltaY / CHUNK_SIZE; - - int chunkData = client.getInstanceTemplateChunks()[plane][chunkIndexX][chunkIndexY]; - int rotation = chunkData >> 1 & 0x3; - int y = (chunkData >> 3 & 0x7FF) * 8; - int x = (chunkData >> 14 & 0x3FF) * 8; - - return buildFromTile(base, point, rotation, new Point(x, y)); - } - - private static Point buildFromTile(Point base, Point tile, int rot, Point chunkOrigin) - { - int deltaX = tile.getX() - base.getX(); - int deltaY = tile.getY() - base.getY(); - - double chunkOffsetX = (deltaX % CHUNK_SIZE) - CHUNK_OFFSET; - double chunkOffsetY = (deltaY % CHUNK_SIZE) - CHUNK_OFFSET; - - for (int i = 0; i < rot; i++) - { - double temp = chunkOffsetX; - chunkOffsetX = -chunkOffsetY; - chunkOffsetY = temp; - } - - chunkOffsetX += CHUNK_OFFSET; - chunkOffsetY += CHUNK_OFFSET; - - int invariantChunkOffsetX = (int) chunkOffsetX; - int invariantChunkOffsetY = (int) chunkOffsetY; - - return new Point( - chunkOrigin.getX() + invariantChunkOffsetX, - chunkOrigin.getY() + invariantChunkOffsetY); - } - - private void updateConfig() - { - this.potentialBatColor = config.getPotentialBatColor(); - this.poisonTrapColor = config.getPoisonTrapColor(); - this.batFoundNotify = config.batFoundNotify(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/ThievingChest.java b/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/ThievingChest.java deleted file mode 100644 index 41a357a08d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raidsthieving/ThievingChest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2019, Tim Lehner - * 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.raidsthieving; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.Point; -import net.runelite.api.coords.WorldPoint; - -/** - * Wrapper class for a GameObject that represents a chest in the thieving room of Chambers of Xeric. - */ -@Getter(AccessLevel.PACKAGE) -public class ThievingChest -{ - /** - * If the chest has never been opened, it could have bats. - */ - @Setter(AccessLevel.PACKAGE) - private boolean everOpened; - - /** - * If the chest is empty, it could have bats. - */ - @Setter(AccessLevel.PACKAGE) - private boolean empty; - - /** - * If the chest contains a poison trap instead. - */ - @Setter(AccessLevel.PACKAGE) - private boolean poison; - - @Setter(AccessLevel.PUBLIC) - private int chestId; - - private final WorldPoint worldPoint; - - @Getter(AccessLevel.PUBLIC) - private final Point instancePoint; - - /** - * Constructor for a ThievingChest object - * - * @param worldPoint The world location of the gameobject that corresponds with this trap. - * @param instancePoint The world location accounting for instances of the gameobject that corresponds with this trap. - */ - ThievingChest(final WorldPoint worldPoint, final Point instancePoint) - { - this.everOpened = false; - this.poison = false; - this.empty = false; - this.worldPoint = worldPoint; - this.instancePoint = instancePoint; - this.chestId = -1; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventConfig.java deleted file mode 100644 index 5d5abf8dca..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventConfig.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2018, trimbe - * 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.randomevents; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("randomevents") -public interface RandomEventConfig extends Config -{ - @ConfigItem( - keyName = "removeMenuOptions", - name = "Remove others' menu options", - description = "Remove menu options from random events for other players.", - position = 0 - ) - default boolean removeMenuOptions() - { - return true; - } - - @ConfigItem( - keyName = "notifyDunce", - name = "Notify on Surprise Exam", - description = "", - position = 1 - ) - default boolean notifyDunce() - { - return false; - } - - @ConfigItem( - keyName = "notifyGenie", - name = "Notify on Genie", - description = "", - position = 2 - ) - default boolean notifyGenie() - { - return false; - } - - @ConfigItem( - keyName = "notifyDemon", - name = "Notify on Drill Demon", - description = "", - position = 3 - ) - default boolean notifyDemon() - { - return false; - } - - @ConfigItem( - keyName = "notifyForester", - name = "Notify on Freaky Forester", - description = "", - position = 4 - ) - default boolean notifyForester() - { - return false; - } - - @ConfigItem( - keyName = "notifyFrog", - name = "Notify on Kiss the Frog", - description = "", - position = 5 - ) - default boolean notifyFrog() - { - return false; - } - - @ConfigItem( - keyName = "notifyGravedigger", - name = "Notify on Gravedigger", - description = "", - position = 6 - ) - default boolean notifyGravedigger() - { - return false; - } - - @ConfigItem( - keyName = "notifyMoM", - name = "Notify on Mysterious Old Man", - description = "", - position = 7 - ) - default boolean notifyMoM() - { - return false; - } - - @ConfigItem( - keyName = "notifyBob", - name = "Notify on Evil Bob", - description = "", - position = 8 - ) - default boolean notifyBob() - { - return false; - } - - @ConfigItem( - keyName = "notifyQuiz", - name = "Notify on Quiz Master", - description = "", - position = 9 - ) - default boolean notifyQuiz() - { - return false; - } - - @ConfigItem( - keyName = "notifyAll", - name = "Notify for all events", - description = "", - position = 10 - ) - default boolean notifyAllEvents() - { - return false; - } -} - diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventPlugin.java deleted file mode 100644 index 30af13dba8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventPlugin.java +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (c) 2018, trimbe - * 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.randomevents; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Provides; -import java.util.Arrays; -import java.util.Set; -import javax.inject.Inject; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Actor; -import net.runelite.api.Client; -import net.runelite.api.MenuOpcode; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.Player; -import net.runelite.api.events.InteractingChanged; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.NpcDespawned; -import net.runelite.client.Notifier; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Random Events", - description = "Notify when random events appear and remove talk/dismiss options on events that aren't yours.", - enabledByDefault = false, - type = PluginType.UTILITY -) -@Slf4j -public class RandomEventPlugin extends Plugin -{ - private static final Set EVENT_NPCS = ImmutableSet.of( - NpcID.DR_JEKYLL, NpcID.DR_JEKYLL_314, - NpcID.BEE_KEEPER_6747, - NpcID.CAPT_ARNAV, - NpcID.SERGEANT_DAMIEN_6743, - NpcID.DRUNKEN_DWARF, - NpcID.FREAKY_FORESTER_6748, - NpcID.GENIE, NpcID.GENIE_327, - NpcID.EVIL_BOB, NpcID.EVIL_BOB_6754, - NpcID.POSTIE_PETE_6738, - NpcID.LEO_6746, - NpcID.MYSTERIOUS_OLD_MAN_6750, NpcID.MYSTERIOUS_OLD_MAN_6751, - NpcID.MYSTERIOUS_OLD_MAN_6752, NpcID.MYSTERIOUS_OLD_MAN_6753, - NpcID.PILLORY_GUARD, - NpcID.FLIPPA_6744, - NpcID.QUIZ_MASTER_6755, - NpcID.RICK_TURPENTINE, NpcID.RICK_TURPENTINE_376, - NpcID.SANDWICH_LADY, - NpcID.DUNCE_6749, - NpcID.NILES, NpcID.NILES_5439, - NpcID.MILES, NpcID.MILES_5440, - NpcID.GILES, NpcID.GILES_5441, - NpcID.FROG_5429 - ); - private static final Set EVENT_OPTIONS = ImmutableSet.of( - "Talk-to", - "Dismiss" - ); - private static final int RANDOM_EVENT_TIMEOUT = 150; - - private NPC currentRandomEvent; - private int lastNotificationTick = -RANDOM_EVENT_TIMEOUT; // to avoid double notifications - - @Inject - private Client client; - - @Inject - private Notifier notifier; - - @Inject - private RandomEventConfig config; - - private boolean notifyAllEvents; - private boolean notifyDemon; - private boolean notifyForester; - private boolean notifyFrog; - private boolean notifyGenie; - private boolean notifyBob; - private boolean notifyGravedigger; - private boolean notifyMoM; - private boolean notifyQuiz; - private boolean notifyDunce; - - @Provides - RandomEventConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(RandomEventConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - } - - @Override - protected void shutDown() - { - lastNotificationTick = 0; - currentRandomEvent = null; - } - - @Subscribe - private void onInteractingChanged(InteractingChanged event) - { - Actor source = event.getSource(); - Actor target = event.getTarget(); - Player player = client.getLocalPlayer(); - - // Check that the npc is interacting with the player and the player isn't interacting with the npc, so - // that the notification doesn't fire from talking to other user's randoms - if (player == null - || target != player - || player.getInteracting() == source - || !(source instanceof NPC) - || !EVENT_NPCS.contains(((NPC) source).getId())) - { - return; - } - - log.debug("Random event spawn: {}", source.getName()); - - currentRandomEvent = (NPC) source; - - if (client.getTickCount() - lastNotificationTick > RANDOM_EVENT_TIMEOUT) - { - lastNotificationTick = client.getTickCount(); - - if (shouldNotify(currentRandomEvent.getId())) - { - notifier.notify("Random event spawned: " + currentRandomEvent.getName()); - } - } - } - - @Subscribe - private void onNpcDespawned(NpcDespawned npcDespawned) - { - NPC npc = npcDespawned.getNpc(); - - if (npc == currentRandomEvent) - { - currentRandomEvent = null; - } - } - - @Subscribe - private void onMenuEntryAdded(MenuEntryAdded event) - { - if (event.getOpcode() >= MenuOpcode.NPC_FIRST_OPTION.getId() - && event.getOpcode() <= MenuOpcode.NPC_FIFTH_OPTION.getId() - && EVENT_OPTIONS.contains(event.getOption())) - { - NPC npc = client.getCachedNPCs()[event.getIdentifier()]; - if (npc != null && EVENT_NPCS.contains(npc.getId()) && npc != currentRandomEvent && config.removeMenuOptions()) - { - client.setMenuEntries(Arrays.copyOf(client.getMenuEntries(), client.getMenuEntries().length - 1)); - } - } - } - - private boolean shouldNotify(int id) - { - if (this.notifyAllEvents) - { - return true; - } - - switch (id) - { - case NpcID.SERGEANT_DAMIEN_6743: - return this.notifyDemon; - case NpcID.FREAKY_FORESTER_6748: - return this.notifyForester; - case NpcID.FROG_5429: - return this.notifyFrog; - case NpcID.GENIE: - case NpcID.GENIE_327: - return this.notifyGenie; - case NpcID.EVIL_BOB: - case NpcID.EVIL_BOB_6754: - return this.notifyBob; - case NpcID.LEO_6746: - return this.notifyGravedigger; - case NpcID.MYSTERIOUS_OLD_MAN_6750: - case NpcID.MYSTERIOUS_OLD_MAN_6751: - case NpcID.MYSTERIOUS_OLD_MAN_6752: - case NpcID.MYSTERIOUS_OLD_MAN_6753: - return this.notifyMoM; - case NpcID.QUIZ_MASTER_6755: - return this.notifyQuiz; - case NpcID.DUNCE_6749: - return this.notifyDunce; - default: - return false; - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!"randomevents".equals(event.getGroup())) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.notifyAllEvents = config.notifyAllEvents(); - this.notifyDemon = config.notifyDemon(); - this.notifyForester = config.notifyForester(); - this.notifyFrog = config.notifyFrog(); - this.notifyGenie = config.notifyGenie(); - this.notifyBob = config.notifyBob(); - this.notifyGravedigger = config.notifyGravedigger(); - this.notifyMoM = config.notifyMoM(); - this.notifyQuiz = config.notifyQuiz(); - this.notifyDunce = config.notifyDunce(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/reminders/RemindersConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/reminders/RemindersConfig.java deleted file mode 100644 index 454bbf0af4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/reminders/RemindersConfig.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2019, openosrs - * Copyright (c) 2019, kyle - * 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.reminders; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("Reminders") -public interface RemindersConfig extends Config -{ - @ConfigItem( - keyName = "breakReminder", - name = "Break Reminder", - description = "Reminds you to take a 5-10 minute break every hour.", - position = 0 - ) - default boolean breakReminder() - { - return false; - } - - @ConfigItem( - keyName = "hydrationReminder", - name = "Hydration Reminder", - description = "Reminds you to drink 4oz/120ml of water every hour", - position = 1 - ) - default boolean hydrationReminder() - { - return false; - } - - @ConfigItem( - keyName = "personalReminders", - name = "Personal Reminders", - description = "Set your own personal reminders", - position = 2 - ) - default boolean personalReminders() - { - return false; - } - - @ConfigItem( - keyName = "personalReminder1", - name = "Personal Reminder #1", - description = "Set your first personal reminder", - position = 3, - hidden = true, - unhide = "personalReminders" - ) - default boolean personalReminder1() - { - return false; - } - - @ConfigItem( - keyName = "personalReminderText1", - name = "Personal Reminder Text #1", - description = "Set the text to your first personal reminder", - position = 4, - hidden = true, - unhide = "personalReminder1" - ) - default String personalReminderText1() - { - return ""; - } - - @ConfigItem( - keyName = "personalreminderTime1", - name = "Personal Reminder Time #1", - description = "Time in minutes for your first personal reminder", - position = 5, - hidden = true, - unhide = "personalReminder1" - ) - default int personalReminderTime1() - { - return 0; - } - - @ConfigItem( - keyName = "personalReminder2", - name = "Personal Reminder #2", - description = "Set your second personal reminder", - position = 6, - hidden = true, - unhide = "personalReminders" - ) - default boolean personalReminder2() - { - return false; - } - - @ConfigItem( - keyName = "personalReminderText2", - name = "Personal Reminder Text #2", - description = "Set the text to your second personal reminder", - position = 7, - hidden = true, - unhide = "personalReminder2" - ) - default String personalReminderText2() - { - return ""; - } - - @ConfigItem( - keyName = "personalreminderTime2", - name = "Personal Reminder Time #2", - description = "Time in minutes for your second personal reminder", - position = 8, - hidden = true, - unhide = "personalReminder2" - ) - default int personalReminderTime2() - { - return 0; - } - - @ConfigItem( - keyName = "personalReminder3", - name = "Personal Reminder #3", - description = "Set your third personal reminder", - position = 9, - hidden = true, - unhide = "personalReminders" - ) - default boolean personalReminder3() - { - return false; - } - - @ConfigItem( - keyName = "personalReminderText3", - name = "Personal Reminder Text #3", - description = "Set the text to your third personal reminder", - position = 10, - hidden = true, - unhide = "personalReminder3" - ) - default String personalReminderText3() - { - return ""; - } - - @ConfigItem( - keyName = "personalreminderTime3", - name = "Personal Reminder Time #3", - description = "Time in minutes for your third personal reminder", - position = 11, - hidden = true, - unhide = "personalReminder3" - ) - default int personalReminderTime3() - { - return 0; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/reminders/RemindersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/reminders/RemindersPlugin.java deleted file mode 100644 index 05983de7c4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/reminders/RemindersPlugin.java +++ /dev/null @@ -1,293 +0,0 @@ -/* - * Copyright (c) 2019, jkybtw - * Copyright (c) 2019, openosrs - * Copyright (c) 2019, kyle - * 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.reminders; - -import com.google.inject.Provides; -import static java.lang.Math.floor; -import static java.time.Duration.between; -import java.time.Instant; -import java.time.temporal.ChronoUnit; -import javax.inject.Inject; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.GameState; -import net.runelite.api.events.GameStateChanged; -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.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.task.Schedule; - -@PluginDescriptor( - name = "Reminders", - description = "various reminders", - tags = {"session", "reminder", "hydrate", "hydration"}, - enabledByDefault = false, - type = PluginType.MISCELLANEOUS -) - -@Slf4j -public class RemindersPlugin extends Plugin -{ - - @Inject - private RemindersConfig config; - - @Inject - private ChatMessageManager chatMessageManager; - - private Instant loginTime; - private boolean ready; - private int seconds; - private int minutes; - private int hours; - private int ounces; - private int millilitres; - private boolean hydrationReminder; - private boolean breakReminder; - private boolean personalReminders; - private boolean personalReminder1; - private String personalReminderText1; - private int personalReminderTime1; - private boolean personalReminder2; - private String personalReminderText2; - private int personalReminderTime2; - private boolean personalReminder3; - private String personalReminderText3; - private int personalReminderTime3; - - - @Provides - RemindersConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(RemindersConfig.class); - } - - @Override - public void startUp() - { - updateConfig(); - } - - @Override - public void shutDown() - { - loginTime = null; - } - - @Subscribe - public void onGameStateChanged(GameStateChanged event) - { - final GameState state = event.getGameState(); - - switch (state) - { - case LOGIN_SCREEN: - case LOGIN_SCREEN_AUTHENTICATOR: - case LOGGING_IN: - ready = true; - loginTime = null; - break; - case LOGGED_IN: - if (ready) - { - loginTime = Instant.now(); - ready = false; - } - break; - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("Reminders")) - { - updateConfig(); - } - } - - private void timers() - { - if (loginTime == null) - { - return; - } - seconds = 60; - minutes = (int) floor(between(loginTime, Instant.now()).getSeconds() / seconds); - hours = minutes / seconds; - ounces = 4 * hours; - millilitres = 120 * hours; - } - - private String pluralizeTime(String time, int count) - { - final StringBuilder sb = new StringBuilder(); - sb - .append(count) - .append(" ") - .append(time); - if (count != 1) - { - sb.append("s"); - } - return sb.toString(); - } - - private void breakReminders() - { - timers(); - if (!this.breakReminder) - { - log.error("breakReminder - Unexpected value: " + hours); - } - - chatMessageManager.queue(QueuedMessage.builder().type(ChatMessageType.CONSOLE).runeLiteFormattedMessage( - new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append("You have been logged in for ") - .append(pluralizeTime("hour", hours)) - .append(". You should take a 5-10 minute break.") - .build()) - .build()); - } - - private void hydrationReminders() - { - timers(); - if (!this.hydrationReminder) - { - log.error("hydrationReminder - Unexpected value: " + hours); - } - - chatMessageManager.queue(QueuedMessage.builder().type(ChatMessageType.CONSOLE).runeLiteFormattedMessage( - new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append("You have been logged in for ") - .append(pluralizeTime("hour", hours)) - .append(". By this point, you should have consumed at least " + ounces + "oz (" + millilitres + "ml) of Water to maintain optimum hydration.") - .build()) - .build()); - } - - private void personalReminder1() - { - if (!this.personalReminders && !this.personalReminder1) - { - log.error("personalReminder1 - Unexpected value: " + this.personalReminderText1 + hours); - } - chatMessageManager.queue(QueuedMessage.builder().type(ChatMessageType.CONSOLE).runeLiteFormattedMessage( - new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append(this.personalReminderText1) - .build()) - .build()); - } - - private void personalReminder2() - { - if (!this.personalReminders && !this.personalReminder2) - { - log.error("personalReminder2 - Unexpected value: " + this.personalReminderText2 + hours); - } - chatMessageManager.queue(QueuedMessage.builder().type(ChatMessageType.CONSOLE).runeLiteFormattedMessage( - new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append(this.personalReminderText2) - .build()) - .build()); - } - - private void personalReminder3() - { - if (!this.personalReminders && !this.personalReminder3) - { - log.error("personalReminder3 - Unexpected value: " + this.personalReminderText3 + hours); - } - chatMessageManager.queue(QueuedMessage.builder().type(ChatMessageType.CONSOLE).runeLiteFormattedMessage( - new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append(this.personalReminderText3) - .build()) - .build()); - } - - - @Schedule( - period = 1, - unit = ChronoUnit.MINUTES - ) - public void reminders() - { - - timers(); - if (minutes % seconds == 0 && minutes > 0) - { - if (this.breakReminder) - { - breakReminders(); - } - if (this.hydrationReminder) - { - hydrationReminders(); - } - } - if (minutes % this.personalReminderTime1 == 0 && minutes > 0 && !this.personalReminderText1.isEmpty()) - { - personalReminder1(); - } - if (minutes % this.personalReminderTime2 == 0 && minutes > 0 && !this.personalReminderText2.isEmpty()) - { - personalReminder2(); - } - if (minutes % this.personalReminderTime3 == 0 && minutes > 0 && !this.personalReminderText3.isEmpty()) - { - personalReminder3(); - } - } - - private void updateConfig() - { - this.hydrationReminder = config.hydrationReminder(); - this.breakReminder = config.breakReminder(); - this.personalReminders = config.personalReminders(); - this.personalReminder1 = config.personalReminder1(); - this.personalReminder2 = config.personalReminder2(); - this.personalReminder3 = config.personalReminder3(); - this.personalReminderText1 = config.personalReminderText1(); - this.personalReminderText2 = config.personalReminderText2(); - this.personalReminderText3 = config.personalReminderText3(); - this.personalReminderTime1 = config.personalReminderTime1(); - this.personalReminderTime2 = config.personalReminderTime2(); - this.personalReminderTime3 = config.personalReminderTime3(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/PrayerTabState.java b/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/PrayerTabState.java deleted file mode 100644 index 993a74f917..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/PrayerTabState.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2018, 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.reorderprayers; - -public enum PrayerTabState -{ - NONE, - PRAYERS, - QUICK_PRAYERS -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersConfig.java deleted file mode 100644 index 7a73dae268..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersConfig.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2018, 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.reorderprayers; - -import net.runelite.api.Prayer; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup(ReorderPrayersPlugin.CONFIG_GROUP_KEY) -public interface ReorderPrayersConfig extends Config -{ - - @ConfigItem( - keyName = ReorderPrayersPlugin.CONFIG_UNLOCK_REORDERING_KEY, - name = "Unlock Prayer Reordering", - description = "Configures whether or not you can reorder the prayers", - position = 1 - ) - default boolean unlockPrayerReordering() - { - return false; - } - - @ConfigItem( - keyName = ReorderPrayersPlugin.CONFIG_UNLOCK_REORDERING_KEY, - name = "", - description = "" - ) - void unlockPrayerReordering(boolean unlock); - - @ConfigItem( - keyName = ReorderPrayersPlugin.CONFIG_PRAYER_ORDER_KEY, - name = "Prayer Order", - description = "Configures the order of the prayers", - hidden = true, - position = 2 - ) - default String prayerOrder() - { - return ReorderPrayersPlugin.prayerOrderToString(Prayer.values()); - } - - @ConfigItem( - keyName = ReorderPrayersPlugin.CONFIG_PRAYER_ORDER_KEY, - name = "", - description = "" - ) - void prayerOrder(String prayerOrder); - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersPlugin.java deleted file mode 100644 index 074e715c1b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersPlugin.java +++ /dev/null @@ -1,458 +0,0 @@ -/* - * Copyright (c) 2018, 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.reorderprayers; - -import com.google.common.collect.ImmutableList; -import com.google.inject.Provides; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.HashTable; -import net.runelite.api.Prayer; -import net.runelite.api.WidgetNode; -import net.runelite.api.events.DraggingWidgetChanged; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.events.WidgetMenuOptionClicked; -import net.runelite.api.widgets.Widget; -import static net.runelite.api.widgets.WidgetConfig.DRAG; -import static net.runelite.api.widgets.WidgetConfig.DRAG_ON; -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.events.ConfigChanged; -import net.runelite.client.menus.MenuManager; -import net.runelite.client.menus.WidgetMenuOption; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Reorder Prayers", - description = "Reorder the prayers displayed on the Prayer panel", - type = PluginType.UTILITY -) -@Singleton -public class ReorderPrayersPlugin extends Plugin -{ - - static final String CONFIG_GROUP_KEY = "reorderprayers"; - - static final String CONFIG_UNLOCK_REORDERING_KEY = "unlockPrayerReordering"; - - static final String CONFIG_PRAYER_ORDER_KEY = "prayerOrder"; - - private static final int PRAYER_WIDTH = 34; - - private static final int PRAYER_HEIGHT = 34; - - private static final int PRAYER_X_OFFSET = 37; - - private static final int PRAYER_Y_OFFSET = 37; - - private static final int QUICK_PRAYER_SPRITE_X_OFFSET = 2; - - private static final int QUICK_PRAYER_SPRITE_Y_OFFSET = 2; - - private static final int PRAYER_COLUMN_COUNT = 5; - - private static final int PRAYER_COUNT = Prayer.values().length; - - private static final List PRAYER_WIDGET_INFO_LIST = ImmutableList.of( - WidgetInfo.PRAYER_THICK_SKIN, - WidgetInfo.PRAYER_BURST_OF_STRENGTH, - WidgetInfo.PRAYER_CLARITY_OF_THOUGHT, - WidgetInfo.PRAYER_SHARP_EYE, - WidgetInfo.PRAYER_MYSTIC_WILL, - WidgetInfo.PRAYER_ROCK_SKIN, - WidgetInfo.PRAYER_SUPERHUMAN_STRENGTH, - WidgetInfo.PRAYER_IMPROVED_REFLEXES, - WidgetInfo.PRAYER_RAPID_RESTORE, - WidgetInfo.PRAYER_RAPID_HEAL, - WidgetInfo.PRAYER_PROTECT_ITEM, - WidgetInfo.PRAYER_HAWK_EYE, - WidgetInfo.PRAYER_MYSTIC_LORE, - WidgetInfo.PRAYER_STEEL_SKIN, - WidgetInfo.PRAYER_ULTIMATE_STRENGTH, - WidgetInfo.PRAYER_INCREDIBLE_REFLEXES, - WidgetInfo.PRAYER_PROTECT_FROM_MAGIC, - WidgetInfo.PRAYER_PROTECT_FROM_MISSILES, - WidgetInfo.PRAYER_PROTECT_FROM_MELEE, - WidgetInfo.PRAYER_EAGLE_EYE, - WidgetInfo.PRAYER_MYSTIC_MIGHT, - WidgetInfo.PRAYER_RETRIBUTION, - WidgetInfo.PRAYER_REDEMPTION, - WidgetInfo.PRAYER_SMITE, - WidgetInfo.PRAYER_PRESERVE, - WidgetInfo.PRAYER_CHIVALRY, - WidgetInfo.PRAYER_PIETY, - WidgetInfo.PRAYER_RIGOUR, - WidgetInfo.PRAYER_AUGURY - ); - - private static final List QUICK_PRAYER_CHILD_IDS = ImmutableList.of( - WidgetID.QuickPrayer.THICK_SKIN_CHILD_ID, - WidgetID.QuickPrayer.BURST_OF_STRENGTH_CHILD_ID, - WidgetID.QuickPrayer.CLARITY_OF_THOUGHT_CHILD_ID, - WidgetID.QuickPrayer.SHARP_EYE_CHILD_ID, - WidgetID.QuickPrayer.MYSTIC_WILL_CHILD_ID, - WidgetID.QuickPrayer.ROCK_SKIN_CHILD_ID, - WidgetID.QuickPrayer.SUPERHUMAN_STRENGTH_CHILD_ID, - WidgetID.QuickPrayer.IMPROVED_REFLEXES_CHILD_ID, - WidgetID.QuickPrayer.RAPID_RESTORE_CHILD_ID, - WidgetID.QuickPrayer.RAPID_HEAL_CHILD_ID, - WidgetID.QuickPrayer.PROTECT_ITEM_CHILD_ID, - WidgetID.QuickPrayer.HAWK_EYE_CHILD_ID, - WidgetID.QuickPrayer.MYSTIC_LORE_CHILD_ID, - WidgetID.QuickPrayer.STEEL_SKIN_CHILD_ID, - WidgetID.QuickPrayer.ULTIMATE_STRENGTH_CHILD_ID, - WidgetID.QuickPrayer.INCREDIBLE_REFLEXES_CHILD_ID, - WidgetID.QuickPrayer.PROTECT_FROM_MAGIC_CHILD_ID, - WidgetID.QuickPrayer.PROTECT_FROM_MISSILES_CHILD_ID, - WidgetID.QuickPrayer.PROTECT_FROM_MELEE_CHILD_ID, - WidgetID.QuickPrayer.EAGLE_EYE_CHILD_ID, - WidgetID.QuickPrayer.MYSTIC_MIGHT_CHILD_ID, - WidgetID.QuickPrayer.RETRIBUTION_CHILD_ID, - WidgetID.QuickPrayer.REDEMPTION_CHILD_ID, - WidgetID.QuickPrayer.SMITE_CHILD_ID, - WidgetID.QuickPrayer.PRESERVE_CHILD_ID, - WidgetID.QuickPrayer.CHIVALRY_CHILD_ID, - WidgetID.QuickPrayer.PIETY_CHILD_ID, - WidgetID.QuickPrayer.RIGOUR_CHILD_ID, - WidgetID.QuickPrayer.AUGURY_CHILD_ID - ); - - private static final String LOCK = "Lock"; - - private static final String UNLOCK = "Unlock"; - - private static final String MENU_TARGET = "Reordering"; - - private static final WidgetMenuOption FIXED_PRAYER_TAB_LOCK = new WidgetMenuOption(LOCK, - MENU_TARGET, WidgetInfo.FIXED_VIEWPORT_PRAYER_TAB); - - private static final WidgetMenuOption FIXED_PRAYER_TAB_UNLOCK = new WidgetMenuOption(UNLOCK, - MENU_TARGET, WidgetInfo.FIXED_VIEWPORT_PRAYER_TAB); - - private static final WidgetMenuOption RESIZABLE_PRAYER_TAB_LOCK = new WidgetMenuOption(LOCK, - MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_PRAYER_TAB); - - private static final WidgetMenuOption RESIZABLE_PRAYER_TAB_UNLOCK = new WidgetMenuOption(UNLOCK, - MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_PRAYER_TAB); - - private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_PRAYER_TAB_LOCK = new WidgetMenuOption(LOCK, - MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_PRAYER_TAB); - - private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_PRAYER_TAB_UNLOCK = new WidgetMenuOption(UNLOCK, - MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_PRAYER_TAB); - - @Inject - private Client client; - - @Inject - private ReorderPrayersConfig config; - - @Inject - private MenuManager menuManager; - - private Prayer[] prayerOrder; - - static String prayerOrderToString(Prayer[] prayerOrder) - { - return Arrays.stream(prayerOrder) - .map(Prayer::name) - .collect(Collectors.joining(",")); - } - - private static Prayer[] stringToPrayerOrder(String string) - { - return Arrays.stream(string.split(",")) - .map(Prayer::valueOf) - .toArray(Prayer[]::new); - } - - private static int getPrayerIndex(Widget widget) - { - int x = widget.getOriginalX() / PRAYER_X_OFFSET; - int y = widget.getOriginalY() / PRAYER_Y_OFFSET; - return x + y * PRAYER_COLUMN_COUNT; - } - - private static void setWidgetPosition(Widget widget, int x, int y) - { - widget.setRelativeX(x); - widget.setRelativeY(y); - widget.setOriginalX(x); - widget.setOriginalY(y); - } - - @Provides - ReorderPrayersConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(ReorderPrayersConfig.class); - } - - @Override - protected void startUp() - { - - refreshPrayerTabOption(); - prayerOrder = stringToPrayerOrder(config.prayerOrder()); - reorderPrayers(); - } - - @Override - protected void shutDown() - { - clearPrayerTabMenus(); - prayerOrder = Prayer.values(); - reorderPrayers(false); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGGED_IN) - { - reorderPrayers(); - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals(CONFIG_GROUP_KEY)) - { - if (event.getKey().equals(CONFIG_PRAYER_ORDER_KEY)) - { - prayerOrder = stringToPrayerOrder(config.prayerOrder()); - } - else if (event.getKey().equals(CONFIG_UNLOCK_REORDERING_KEY)) - { - refreshPrayerTabOption(); - } - reorderPrayers(); - } - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded event) - { - if (event.getGroupId() == WidgetID.PRAYER_GROUP_ID || event.getGroupId() == WidgetID.QUICK_PRAYERS_GROUP_ID) - { - reorderPrayers(); - } - } - - @Subscribe - private void onDraggingWidgetChanged(DraggingWidgetChanged event) - { - // is dragging widget and mouse button released - if (event.isDraggingWidget() && client.getMouseCurrentButton() == 0) - { - Widget draggedWidget = client.getDraggedWidget(); - Widget draggedOnWidget = client.getDraggedOnWidget(); - if (draggedWidget != null && draggedOnWidget != null) - { - int draggedGroupId = WidgetInfo.TO_GROUP(draggedWidget.getId()); - int draggedOnGroupId = WidgetInfo.TO_GROUP(draggedOnWidget.getId()); - if (draggedGroupId != WidgetID.PRAYER_GROUP_ID || draggedOnGroupId != WidgetID.PRAYER_GROUP_ID - || draggedOnWidget.getWidth() != PRAYER_WIDTH || draggedOnWidget.getHeight() != PRAYER_HEIGHT) - { - return; - } - // reset dragged on widget to prevent sending a drag widget packet to the server - client.setDraggedOnWidget(null); - - int fromPrayerIndex = getPrayerIndex(draggedWidget); - int toPrayerIndex = getPrayerIndex(draggedOnWidget); - - Prayer tmp = prayerOrder[toPrayerIndex]; - prayerOrder[toPrayerIndex] = prayerOrder[fromPrayerIndex]; - prayerOrder[fromPrayerIndex] = tmp; - - save(); - } - } - } - - @Subscribe - private void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event) - { - if (event.getWidget() == WidgetInfo.FIXED_VIEWPORT_PRAYER_TAB - || event.getWidget() == WidgetInfo.RESIZABLE_VIEWPORT_PRAYER_TAB - || event.getWidget() == WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_PRAYER_TAB) - { - config.unlockPrayerReordering(event.getMenuOption().equals(UNLOCK)); - } - } - - private void clearPrayerTabMenus() - { - menuManager.removeManagedCustomMenu(FIXED_PRAYER_TAB_LOCK); - menuManager.removeManagedCustomMenu(RESIZABLE_PRAYER_TAB_LOCK); - menuManager.removeManagedCustomMenu(RESIZABLE_BOTTOM_LINE_PRAYER_TAB_LOCK); - menuManager.removeManagedCustomMenu(FIXED_PRAYER_TAB_UNLOCK); - menuManager.removeManagedCustomMenu(RESIZABLE_PRAYER_TAB_UNLOCK); - menuManager.removeManagedCustomMenu(RESIZABLE_BOTTOM_LINE_PRAYER_TAB_UNLOCK); - } - - private void refreshPrayerTabOption() - { - clearPrayerTabMenus(); - if (config.unlockPrayerReordering()) - { - menuManager.addManagedCustomMenu(FIXED_PRAYER_TAB_LOCK); - menuManager.addManagedCustomMenu(RESIZABLE_PRAYER_TAB_LOCK); - menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_PRAYER_TAB_LOCK); - } - else - { - menuManager.addManagedCustomMenu(FIXED_PRAYER_TAB_UNLOCK); - menuManager.addManagedCustomMenu(RESIZABLE_PRAYER_TAB_UNLOCK); - menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_PRAYER_TAB_UNLOCK); - } - } - - private PrayerTabState getPrayerTabState() - { - HashTable componentTable = client.getComponentTable(); - for (WidgetNode widgetNode : componentTable.getNodes()) - { - if (widgetNode.getId() == WidgetID.PRAYER_GROUP_ID) - { - return PrayerTabState.PRAYERS; - } - else if (widgetNode.getId() == WidgetID.QUICK_PRAYERS_GROUP_ID) - { - return PrayerTabState.QUICK_PRAYERS; - } - } - return PrayerTabState.NONE; - } - - private void save() - { - config.prayerOrder(prayerOrderToString(prayerOrder)); - } - - private void reorderPrayers() - { - reorderPrayers(config.unlockPrayerReordering()); - } - - private void reorderPrayers(boolean unlocked) - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - PrayerTabState prayerTabState = getPrayerTabState(); - - if (prayerTabState == PrayerTabState.PRAYERS) - { - List prayerWidgets = PRAYER_WIDGET_INFO_LIST.stream() - .map(client::getWidget) - .filter(Objects::nonNull) - .collect(Collectors.toList()); - - if (prayerWidgets.size() != PRAYER_WIDGET_INFO_LIST.size()) - { - return; - } - - for (int index = 0; index < prayerOrder.length; index++) - { - Prayer prayer = prayerOrder[index]; - Widget prayerWidget = prayerWidgets.get(prayer.ordinal()); - - int widgetConfig = prayerWidget.getClickMask(); - if (unlocked) - { - // allow dragging of this widget - widgetConfig |= DRAG; - // allow this widget to be dragged on - widgetConfig |= DRAG_ON; - } - else - { - // remove drag flag - widgetConfig &= ~DRAG; - // remove drag on flag - widgetConfig &= ~DRAG_ON; - } - prayerWidget.setClickMask(widgetConfig); - - int x = index % PRAYER_COLUMN_COUNT; - int y = index / PRAYER_COLUMN_COUNT; - int widgetX = x * PRAYER_X_OFFSET; - int widgetY = y * PRAYER_Y_OFFSET; - setWidgetPosition(prayerWidget, widgetX, widgetY); - } - } - else if (prayerTabState == PrayerTabState.QUICK_PRAYERS) - { - Widget prayersContainer = client.getWidget(WidgetInfo.QUICK_PRAYER_PRAYERS); - if (prayersContainer == null) - { - return; - } - Widget[] prayerWidgets = prayersContainer.getDynamicChildren(); - if (prayerWidgets == null || prayerWidgets.length != PRAYER_COUNT * 3) - { - return; - } - - for (int index = 0; index < prayerOrder.length; index++) - { - Prayer prayer = prayerOrder[index]; - - int x = index % PRAYER_COLUMN_COUNT; - int y = index / PRAYER_COLUMN_COUNT; - - Widget prayerWidget = prayerWidgets[QUICK_PRAYER_CHILD_IDS.get(prayer.ordinal())]; - setWidgetPosition(prayerWidget, x * PRAYER_X_OFFSET, y * PRAYER_Y_OFFSET); - - int childId = PRAYER_COUNT + 2 * prayer.ordinal(); - - Widget prayerSpriteWidget = prayerWidgets[childId]; - setWidgetPosition(prayerSpriteWidget, - QUICK_PRAYER_SPRITE_X_OFFSET + x * PRAYER_X_OFFSET, - QUICK_PRAYER_SPRITE_Y_OFFSET + y * PRAYER_Y_OFFSET); - - Widget prayerToggleWidget = prayerWidgets[childId + 1]; - setWidgetPosition(prayerToggleWidget, x * PRAYER_X_OFFSET, y * PRAYER_Y_OFFSET); - } - } - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/reportbutton/ReportButtonConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/reportbutton/ReportButtonConfig.java deleted file mode 100644 index 7848b20a7d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/reportbutton/ReportButtonConfig.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2018, Cameron - * 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.reportbutton; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("reportButton") -public interface ReportButtonConfig extends Config -{ - @ConfigItem( - keyName = "time", - name = "Display Options", - description = "Configures what text the report button shows." - ) - default TimeStyle time() - { - return TimeStyle.LOGIN_TIME; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/reportbutton/ReportButtonPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/reportbutton/ReportButtonPlugin.java deleted file mode 100644 index e072e76642..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/reportbutton/ReportButtonPlugin.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2018, Cameron - * 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.reportbutton; - -import com.google.inject.Provides; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.time.Duration; -import java.time.Instant; -import java.time.LocalTime; -import java.time.ZoneId; -import java.time.format.DateTimeFormatter; -import java.time.format.FormatStyle; -import java.time.temporal.ChronoUnit; -import java.util.Date; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.task.Schedule; - -@PluginDescriptor( - name = "Report Button", - description = "Replace the text on the Report button with the current time", - tags = {"time", "utc"}, - type = PluginType.MISCELLANEOUS -) -@Singleton -public class ReportButtonPlugin extends Plugin -{ - private static final ZoneId UTC = ZoneId.of("UTC"); - private static final ZoneId JAGEX = ZoneId.of("Europe/London"); - - private static final DateTimeFormatter DATE_TIME_FORMAT = DateTimeFormatter.ofLocalizedTime(FormatStyle.MEDIUM); - private static final DateFormat DATE_FORMAT = new SimpleDateFormat("MMM. dd, yyyy"); - - private Instant loginTime; - private boolean ready; - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private ReportButtonConfig config; - - private TimeStyle timeStyle; - - @Provides - ReportButtonConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(ReportButtonConfig.class); - } - - @Override - public void startUp() - { - - this.timeStyle = config.time(); - clientThread.invoke(this::updateReportButtonTime); - } - - @Override - public void shutDown() - { - clientThread.invoke(() -> - { - Widget reportButton = client.getWidget(WidgetInfo.CHATBOX_REPORT_TEXT); - if (reportButton != null) - { - reportButton.setText("Report"); - } - }); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - GameState state = event.getGameState(); - - switch (state) - { - case LOGGING_IN: - case HOPPING: - case CONNECTION_LOST: - ready = true; - break; - case LOGGED_IN: - if (ready) - { - loginTime = Instant.now(); - ready = false; - } - break; - } - } - - @Schedule( - period = 500, - unit = ChronoUnit.MILLIS - ) - public void updateSchedule() - { - updateReportButtonTime(); - } - - private void updateReportButtonTime() - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - Widget reportButton = client.getWidget(WidgetInfo.CHATBOX_REPORT_TEXT); - if (reportButton == null) - { - return; - } - - switch (this.timeStyle) - { - case UTC: - reportButton.setText(getUTCTime()); - break; - case JAGEX: - reportButton.setText(getJagexTime()); - break; - case LOCAL_TIME: - reportButton.setText(getLocalTime()); - break; - case LOGIN_TIME: - reportButton.setText(getLoginTime()); - break; - case DATE: - reportButton.setText(getDate()); - break; - case OFF: - reportButton.setText("Report"); - break; - } - } - - private String getLoginTime() - { - if (loginTime == null) - { - return "Report"; - } - - Duration duration = Duration.between(loginTime, Instant.now()); - LocalTime time = LocalTime.ofSecondOfDay(duration.getSeconds()); - return time.format(DateTimeFormatter.ofPattern("HH:mm:ss")); - } - - private static String getLocalTime() - { - return LocalTime.now().format(DATE_TIME_FORMAT); - } - - private static String getUTCTime() - { - LocalTime time = LocalTime.now(UTC); - return time.format(DATE_TIME_FORMAT); - } - - private static String getJagexTime() - { - LocalTime time = LocalTime.now(JAGEX); - return time.format(DATE_TIME_FORMAT); - } - - private static String getDate() - { - return DATE_FORMAT.format(new Date()); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("reportButton")) - { - this.timeStyle = config.time(); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/reportbutton/TimeStyle.java b/runelite-client/src/main/java/net/runelite/client/plugins/reportbutton/TimeStyle.java deleted file mode 100644 index b67549faf8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/reportbutton/TimeStyle.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2018, Cameron - * 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.reportbutton; - -public enum TimeStyle -{ - OFF("Off"), - DATE("Date"), - LOGIN_TIME("Login Timer"), - UTC("UTC Time"), - JAGEX("Jagex HQ Time"), - LOCAL_TIME("Local Time"); - - private final String name; - - TimeStyle(final String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/roguesden/Obstacles.java b/runelite-client/src/main/java/net/runelite/client/plugins/roguesden/Obstacles.java deleted file mode 100644 index c6329cdc7f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/roguesden/Obstacles.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2018, Shaun Dreclin - * 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.roguesden; - -import java.awt.Color; -import java.util.HashMap; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import static net.runelite.api.ObjectID.CONTORTION_BARS; -import static net.runelite.api.ObjectID.DOOR_7234; -import static net.runelite.api.ObjectID.DOOR_7246; -import static net.runelite.api.ObjectID.GRILL_7255; -import static net.runelite.api.ObjectID.LEDGE_7240; -import static net.runelite.api.ObjectID.PASSAGEWAY; -import static net.runelite.api.ObjectID.WALL_7249; -import static net.runelite.api.ObjectID.WALL_SAFE_7237; -import net.runelite.api.coords.WorldPoint; - -class Obstacles -{ - static final Map TILE_MAP = new HashMap<>(); - static final Obstacle[] OBSTACLES = - { - new Obstacle(3050, 4997, "Enter"), - new Obstacle(3049, 4997, CONTORTION_BARS), - new Obstacle(3039, 4999, "Stand"), - new Obstacle(3029, 5003, "Run"), - new Obstacle(3024, 5001, "Open", GRILL_7255), - new Obstacle(3011, 5005, "Run"), - new Obstacle(3004, 5003, "Run"), - - new Obstacle(2994, 5004, "Climb"), - new Obstacle(2993, 5004, LEDGE_7240), - new Obstacle(2994, 5005, "Climb"), - new Obstacle(2993, 5005, LEDGE_7240), - - new Obstacle(2969, 5016, "Stand"), - new Obstacle(2969, 5017, "Stand"), - new Obstacle(2969, 5018, "Stand"), - new Obstacle(2969, 5019, "Stand"), - - new Obstacle(2958, 5031, "Cross"), - new Obstacle(2962, 5050, "Stand"), - new Obstacle(2963, 5056, "Run"), - - new Obstacle(2957, 5068, "Enter"), - new Obstacle(2957, 5069, PASSAGEWAY), - - new Obstacle(2955, 5094, "Enter"), - new Obstacle(2955, 5095, PASSAGEWAY), - - new Obstacle(2963, 5105, "Stand"), - - new Obstacle(2972, 5098, "Enter"), - new Obstacle(2972, 5097, PASSAGEWAY), - - new Obstacle(2972, 5094, "Open"), - new Obstacle(2972, 5094, GRILL_7255), - - new Obstacle(2982, 5087, "Climb"), - new Obstacle(2983, 5087, LEDGE_7240), - - new Obstacle(2982, 5090, "Climb"), - new Obstacle(2983, 5090, LEDGE_7240), - - new Obstacle(2993, 5088, "Search"), - new Obstacle(2993, 5087, WALL_7249), - new Obstacle(2997, 5088, "Run"), - - new Obstacle(2993, 5089, "Search"), - new Obstacle(2993, 5089, WALL_7249), - new Obstacle(2997, 5089, "Run"), - - new Obstacle(3006, 5088, "Run"), - new Obstacle(3018, 5080, "Take"), - new Obstacle(3023, 5082, "Open", DOOR_7234), - - // Maze - new Obstacle(3030, 5079, GRILL_7255), - new Obstacle(3032, 5078, GRILL_7255), - new Obstacle(3036, 5076, GRILL_7255), - new Obstacle(3039, 5079, GRILL_7255), - new Obstacle(3042, 5076, GRILL_7255), - new Obstacle(3044, 5069, GRILL_7255), - new Obstacle(3041, 5068, GRILL_7255), - new Obstacle(3040, 5070, GRILL_7255), - new Obstacle(3038, 5069, GRILL_7255), - - new Obstacle(3028, 5033, "Stand"), - new Obstacle(3024, 5033, "Run"), - new Obstacle(3028, 5034, "Stand"), - new Obstacle(3024, 5034, "Run"), - - new Obstacle(3015, 5033, "Open", GRILL_7255), - new Obstacle(3010, 5033, "Run/Open", GRILL_7255), - - new Obstacle(3000, 5034, "Run"), - - new Obstacle(2992, 5045, "Stand"), - new Obstacle(2992, 5053, "Run"), - - new Obstacle(2992, 5067, "Stand"), - new Obstacle(2992, 5075, "Run"), - new Obstacle(3009, 5063, "Take"), - new Obstacle(3028, 5056, "Run"), - new Obstacle(3028, 5047, "Walk"), - - new Obstacle(3018, 5047, "Crack", WALL_SAFE_7237), - - // Start of 80+ thieving shortcut - new Obstacle(2967, 5061, "80 Thieving", DOOR_7246), - new Obstacle(2967, 5066, "80 Thieving", DOOR_7246), - new Obstacle(2974, 5061, "Enter"), - new Obstacle(2974, 5060, CONTORTION_BARS), - new Obstacle(2989, 5057, "Open", GRILL_7255), - new Obstacle(2989, 5058, "Open", GRILL_7255), - - // The 3x3 square around the spinning blade in the middle of the maze - new AvoidObstacle(2977, 5090), new AvoidObstacle(2978, 5090), new AvoidObstacle(2979, 5090), - new AvoidObstacle(2977, 5089), new AvoidObstacle(2978, 5089), new AvoidObstacle(2979, 5089), - new AvoidObstacle(2977, 5088), new AvoidObstacle(2978, 5088), new AvoidObstacle(2979, 5088), - - new TipObstacle(3014, 5063, "Stun NPC"), - new TipObstacle(2992, 5057, "Continue North"), // Hint for 80 thieving shortcut - }; - - @Getter(AccessLevel.PACKAGE) - static class Obstacle - { - private WorldPoint tile; - private String hint; - private int objectId = -1; - private final Color tileColor = Color.GREEN; - - // Highlights tile and shows a hint - private Obstacle(int x, int y, String hint) - { - tile = new WorldPoint(x, y, 1); - this.hint = hint; - } - - // Doesn't highlight tile, but instead highlights object of objectId found on tile - private Obstacle(int x, int y, int objectId) - { - this(x, y, ""); - this.objectId = objectId; - TILE_MAP.put(new WorldPoint(x, y, 1), this); - } - - // Doesn't highlight tile, but instead highlights object of objectId found on tile and shows a hint - private Obstacle(int x, int y, String hint, int objectId) - { - this(x, y, objectId); - this.hint = hint; - } - } - - private static class AvoidObstacle extends Obstacle - { - @Getter(AccessLevel.PACKAGE) - private final Color tileColor = Color.RED; - - private AvoidObstacle(int x, int y) - { - super(x, y, "AVOID"); - } - } - - private static class TipObstacle extends Obstacle - { - @Getter(AccessLevel.PACKAGE) - private final Color tileColor = Color.ORANGE; - - private TipObstacle(int x, int y, String hint) - { - super(x, y, hint); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/roguesden/RoguesDenMinimapOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/roguesden/RoguesDenMinimapOverlay.java deleted file mode 100644 index a2f31727e6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/roguesden/RoguesDenMinimapOverlay.java +++ /dev/null @@ -1,81 +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.roguesden; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.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.OverlayUtil; - -class RoguesDenMinimapOverlay extends Overlay -{ - private final Client client; - private final RoguesDenPlugin plugin; - - @Inject - public RoguesDenMinimapOverlay(Client client, RoguesDenPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isHasGem()) - { - return null; - } - - for (Obstacles.Obstacle obstacle : Obstacles.OBSTACLES) - { - final LocalPoint localPoint = LocalPoint.fromWorld(client, obstacle.getTile()); - - if (localPoint == null || obstacle.getTile().getPlane() != client.getPlane()) - { - continue; - } - - final Point minimapPoint = Perspective.localToMinimap(client, localPoint); - - if (minimapPoint != null) - { - OverlayUtil.renderMinimapLocation(graphics, minimapPoint, obstacle.getObjectId() == -1 ? Color.GREEN : Color.RED); - } - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/roguesden/RoguesDenOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/roguesden/RoguesDenOverlay.java deleted file mode 100644 index 8afa8a051a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/roguesden/RoguesDenOverlay.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2018, Shaun Dreclin - * 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.roguesden; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.Shape; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.GameObject; -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; - -@Singleton -public class RoguesDenOverlay extends Overlay -{ - private static final Color OBJECT_BORDER_COLOR = Color.RED; - private static final Color OBJECT_COLOR = new Color(OBJECT_BORDER_COLOR.getRed(), OBJECT_BORDER_COLOR.getGreen(), OBJECT_BORDER_COLOR.getBlue(), 50); - private static final Color OBJECT_BORDER_HOVER_COLOR = OBJECT_BORDER_COLOR.darker(); - - private final Client client; - private final RoguesDenPlugin plugin; - - @Inject - public RoguesDenOverlay(final Client client, final RoguesDenPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isHasGem()) - { - return null; - } - - plugin.getObstaclesHull().forEach((obstacle, tile) -> - { - if (tile.getPlane() == client.getPlane()) - { - final Shape clickBox = obstacle.getClickbox(); - if (clickBox != null) - { - final Point mouse = client.getMouseCanvasPosition(); - if (clickBox.contains(mouse.getX(), mouse.getY())) - { - graphics.setColor(OBJECT_BORDER_HOVER_COLOR); - } - else - { - graphics.setColor(OBJECT_BORDER_COLOR); - } - - graphics.draw(clickBox); - graphics.setColor(OBJECT_COLOR); - graphics.fill(clickBox); - } - else - { - Shape p; - if (obstacle instanceof GameObject) - { - p = ((GameObject) obstacle).getConvexHull(); - } - else - { - p = obstacle.getCanvasTilePoly(); - } - - if (p != null) - { - graphics.setColor(OBJECT_COLOR); - graphics.draw(p); - } - } - } - }); - - for (Obstacles.Obstacle obstacle : Obstacles.OBSTACLES) - { - final LocalPoint localPoint = LocalPoint.fromWorld(client, obstacle.getTile()); - - if (localPoint == null || obstacle.getTile().getPlane() != client.getPlane()) - { - continue; - } - - if (!obstacle.getHint().isEmpty()) - { - final Polygon polygon = Perspective.getCanvasTilePoly(client, localPoint); - if (polygon != null) - { - graphics.setColor(obstacle.getTileColor()); - graphics.drawPolygon(polygon); - } - } - - final Point textLocation = Perspective.getCanvasTextLocation(client, graphics, localPoint, obstacle.getHint(), 0); - if (textLocation != null) - { - graphics.setColor(Color.LIGHT_GRAY); - graphics.drawString(obstacle.getHint(), textLocation.getX(), textLocation.getY()); - } - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/roguesden/RoguesDenPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/roguesden/RoguesDenPlugin.java deleted file mode 100644 index 1f6969727a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/roguesden/RoguesDenPlugin.java +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright (c) 2018-2019, Shaun Dreclin - * 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.roguesden; - -import java.util.HashMap; -import javax.inject.Inject; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.InventoryID; -import static net.runelite.api.ItemID.MYSTIC_JEWEL; -import net.runelite.api.Tile; -import net.runelite.api.TileObject; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.DecorativeObjectChanged; -import net.runelite.api.events.DecorativeObjectDespawned; -import net.runelite.api.events.DecorativeObjectSpawned; -import net.runelite.api.events.GameObjectChanged; -import net.runelite.api.events.GameObjectDespawned; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GroundObjectChanged; -import net.runelite.api.events.GroundObjectDespawned; -import net.runelite.api.events.GroundObjectSpawned; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.WallObjectChanged; -import net.runelite.api.events.WallObjectDespawned; -import net.runelite.api.events.WallObjectSpawned; -import net.runelite.client.eventbus.Subscribe; -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.ItemUtil; - -@PluginDescriptor( - name = "Rogues' Den", - description = "Mark tiles and clickboxes to help traverse the maze", - tags = {"agility", "maze", "minigame", "overlay", "thieving"}, - type = PluginType.MINIGAME -) -public class RoguesDenPlugin extends Plugin -{ - @Getter(AccessLevel.PACKAGE) - private final HashMap obstaclesHull = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private final HashMap obstaclesTile = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private boolean hasGem; - - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private RoguesDenOverlay overlay; - - @Inject - private RoguesDenMinimapOverlay minimapOverlay; - - @Override - protected void startUp() - { - - overlayManager.add(overlay); - overlayManager.add(minimapOverlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - overlayManager.remove(minimapOverlay); - obstaclesHull.clear(); - obstaclesTile.clear(); - hasGem = false; - } - - @Subscribe - private void onItemContainerChanged(ItemContainerChanged event) - { - if (event.getItemContainer() != client.getItemContainer(InventoryID.INVENTORY)) - { - return; - } - - hasGem = ItemUtil.containsItemId(event.getItemContainer().getItems(), MYSTIC_JEWEL); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOADING) - { - obstaclesHull.clear(); - obstaclesTile.clear(); - } - } - - @Subscribe - private void onGameObjectSpawned(GameObjectSpawned event) - { - onTileObject(event.getTile(), null, event.getGameObject()); - } - - @Subscribe - private void onGameObjectChanged(GameObjectChanged event) - { - onTileObject(event.getTile(), event.getPrevious(), event.getGameObject()); - } - - @Subscribe - private void onGameObjectDespawned(GameObjectDespawned event) - { - onTileObject(event.getTile(), event.getGameObject(), null); - } - - @Subscribe - private void onGroundObjectSpawned(GroundObjectSpawned event) - { - onTileObject(event.getTile(), null, event.getGroundObject()); - } - - @Subscribe - private void onGroundObjectChanged(GroundObjectChanged event) - { - onTileObject(event.getTile(), event.getPrevious(), event.getGroundObject()); - } - - @Subscribe - private void onGroundObjectDespawned(GroundObjectDespawned event) - { - onTileObject(event.getTile(), event.getGroundObject(), null); - } - - @Subscribe - private void onWallObjectSpawned(WallObjectSpawned event) - { - onTileObject(event.getTile(), null, event.getWallObject()); - } - - @Subscribe - private void onWallObjectChanged(WallObjectChanged event) - { - onTileObject(event.getTile(), event.getPrevious(), event.getWallObject()); - } - - @Subscribe - private void onWallObjectDespawned(WallObjectDespawned event) - { - onTileObject(event.getTile(), event.getWallObject(), null); - } - - @Subscribe - private void onDecorativeObjectSpawned(DecorativeObjectSpawned event) - { - onTileObject(event.getTile(), null, event.getDecorativeObject()); - } - - @Subscribe - private void onDecorativeObjectChanged(DecorativeObjectChanged event) - { - onTileObject(event.getTile(), event.getPrevious(), event.getDecorativeObject()); - } - - @Subscribe - private void onDecorativeObjectDespawned(DecorativeObjectDespawned event) - { - onTileObject(event.getTile(), event.getDecorativeObject(), null); - } - - private void onTileObject(final Tile tile, final TileObject oldObject, final TileObject newObject) - { - obstaclesHull.remove(oldObject); - if (newObject != null) - { - WorldPoint point = tile.getWorldLocation(); - - Obstacles.Obstacle obstacle = Obstacles.TILE_MAP.get(point); - if (obstacle != null && obstacle.getObjectId() == newObject.getId()) - { - obstaclesHull.put(newObject, tile); - } - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/AbyssMinimapOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/AbyssMinimapOverlay.java deleted file mode 100644 index 0bed866126..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/AbyssMinimapOverlay.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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.runecraft; - -import com.google.inject.Inject; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.util.HashMap; -import java.util.Map; -import net.runelite.api.Client; -import net.runelite.api.DecorativeObject; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayPosition; - -class AbyssMinimapOverlay extends Overlay -{ - private static final Dimension IMAGE_SIZE = new Dimension(15, 14); - - private final Map abyssIcons = new HashMap<>(); - private final Client client; - private final RunecraftPlugin plugin; - private final ItemManager itemManager; - - @Inject - AbyssMinimapOverlay(Client client, RunecraftPlugin plugin, ItemManager itemManager) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - this.client = client; - this.plugin = plugin; - this.itemManager = itemManager; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isShowRifts()) - { - return null; - } - - for (DecorativeObject object : plugin.getAbyssObjects()) - { - AbyssRifts rift = AbyssRifts.getRift(object.getId()); - if (rift == null || !plugin.getRifts().contains(rift)) - { - continue; - } - - BufferedImage image = getImage(rift); - Point miniMapImage = Perspective.getMiniMapImageLocation(client, object.getLocalLocation(), image); - - if (miniMapImage != null) - { - graphics.drawImage(image, miniMapImage.getX(), miniMapImage.getY(), null); - } - } - - return null; - } - - private BufferedImage getImage(AbyssRifts rift) - { - BufferedImage image = abyssIcons.get(rift); - if (image != null) - { - return image; - } - - // Since item image is too big, we must resize it first. - image = itemManager.getImage(rift.getItemId()); - BufferedImage resizedImage = new BufferedImage(IMAGE_SIZE.width, IMAGE_SIZE.height, BufferedImage.TYPE_INT_ARGB); - Graphics2D g = resizedImage.createGraphics(); - g.drawImage(image, 0, 0, IMAGE_SIZE.width, IMAGE_SIZE.height, null); - g.dispose(); - - abyssIcons.put(rift, resizedImage); - return resizedImage; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/AbyssOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/AbyssOverlay.java deleted file mode 100644 index 6336656d6d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/AbyssOverlay.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2016-2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.runecraft; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.Shape; -import net.runelite.api.Client; -import net.runelite.api.DecorativeObject; -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.OverlayUtil; - -@Singleton -class AbyssOverlay extends Overlay -{ - private final Client client; - private final RunecraftPlugin plugin; - - @Inject - AbyssOverlay(final Client client, final RunecraftPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.isShowRifts()) - { - for (DecorativeObject object : plugin.getAbyssObjects()) - { - renderRift(graphics, object); - } - } - - if (plugin.isHightlightDarkMage()) - { - highlightDarkMage(graphics); - } - - return null; - } - - private void highlightDarkMage(Graphics2D graphics) - { - if (!plugin.isDegradedPouchInInventory()) - { - return; - } - - NPC darkMage = plugin.getDarkMage(); - if (darkMage == null) - { - return; - } - - Polygon tilePoly = darkMage.getCanvasTilePoly(); - if (tilePoly == null) - { - return; - } - - OverlayUtil.renderPolygon(graphics, tilePoly, Color.green); - } - - private void renderRift(Graphics2D graphics, DecorativeObject object) - { - AbyssRifts rift = AbyssRifts.getRift(object.getId()); - if (rift == null || !plugin.getRifts().contains(rift)) - { - return; - } - - Point mousePosition = client.getMouseCanvasPosition(); - Shape objectClickbox = object.getClickbox(); - if (objectClickbox != null) - { - if (objectClickbox.contains(mousePosition.getX(), mousePosition.getY())) - { - graphics.setColor(Color.MAGENTA.darker()); - } - else - { - graphics.setColor(Color.MAGENTA); - } - graphics.draw(objectClickbox); - graphics.setColor(new Color(255, 0, 255, 20)); - graphics.fill(objectClickbox); - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/AbyssRifts.java b/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/AbyssRifts.java deleted file mode 100644 index 20bc229b32..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/AbyssRifts.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2016-2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.runecraft; - -import java.util.HashMap; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import static net.runelite.api.ItemID.*; -import net.runelite.api.ObjectID; - -public enum AbyssRifts -{ - AIR_RIFT(ObjectID.AIR_RIFT, AIR_RUNE), - BLOOD_RIFT(ObjectID.BLOOD_RIFT, BLOOD_RUNE), - BODY_RIFT(ObjectID.BODY_RIFT, BODY_RUNE), - CHAOS_RIFT(ObjectID.CHAOS_RIFT, CHAOS_RUNE), - COSMIC_RIFT(ObjectID.COSMIC_RIFT, COSMIC_RUNE), - DEATH_RIFT(ObjectID.DEATH_RIFT, DEATH_RUNE), - EARTH_RIFT(ObjectID.EARTH_RIFT, EARTH_RUNE), - FIRE_RIFT(ObjectID.FIRE_RIFT, FIRE_RUNE), - LAW_RIFT(ObjectID.LAW_RIFT, LAW_RUNE), - MIND_RIFT(ObjectID.MIND_RIFT, MIND_RUNE), - NATURE_RIFT(ObjectID.NATURE_RIFT, NATURE_RUNE), - SOUL_RIFT(ObjectID.SOUL_RIFT, SOUL_RUNE), - WATER_RIFT(ObjectID.WATER_RIFT, WATER_RUNE); - - @Getter(AccessLevel.PACKAGE) - private final int objectId; - - @Getter(AccessLevel.PACKAGE) - private final int itemId; - - private static final Map rifts = new HashMap<>(); - - static - { - for (AbyssRifts s : values()) - { - rifts.put(s.getObjectId(), s); - } - } - - AbyssRifts(final int objectId, final int itemId) - { - this.objectId = objectId; - this.itemId = itemId; - } - - public static AbyssRifts getRift(int id) - { - return rifts.get(id); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/ClickOperation.java b/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/ClickOperation.java deleted file mode 100644 index cf56d56268..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/ClickOperation.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2019 Hydrox6 - * 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.runecraft; - -import lombok.AllArgsConstructor; - -@AllArgsConstructor -class ClickOperation -{ - Pouch pouch; - int tick; // timeout for operation - int delta; - - ClickOperation(Pouch pouch, int tick) - { - this(pouch, tick, 0); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/EssencePouchOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/EssencePouchOverlay.java deleted file mode 100644 index 8acaf71aba..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/EssencePouchOverlay.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2019 Hydrox6 - * 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.runecraft; - -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.Rectangle; -import javax.inject.Inject; -import net.runelite.api.widgets.WidgetItem; -import net.runelite.client.ui.overlay.WidgetItemOverlay; -import net.runelite.client.ui.overlay.components.TextComponent; - -class EssencePouchOverlay extends WidgetItemOverlay -{ - @Inject - EssencePouchOverlay() - { - showOnInventory(); - } - - @Override - public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget) - { - final Pouch pouch = Pouch.forItem(itemId); - if (pouch == null) - { - return; - } - - final Rectangle bounds = itemWidget.getCanvasBounds(); - final TextComponent textComponent = new TextComponent(); - textComponent.setPosition(new Point(bounds.x - 1, bounds.y + 8)); - textComponent.setColor(Color.CYAN); - if (pouch.isUnknown()) - { - textComponent.setText("?"); - } - else - { - textComponent.setText(Integer.toString(pouch.getHolding())); - } - textComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/Pouch.java b/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/Pouch.java deleted file mode 100644 index 1806071f6a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/Pouch.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2019 Hydrox6 - * 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.runecraft; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.ItemID; - -enum Pouch -{ - SMALL(3), - MEDIUM(6, 3), - LARGE(9, 7), - GIANT(12, 9); - - private final int baseHoldAmount; - private final int degradedBaseHoldAmount; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private int holding; - @Getter(AccessLevel.PACKAGE) - private boolean degraded; - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private boolean unknown = true; - - Pouch(int holdAmount) - { - this(holdAmount, -1); - } - - Pouch(int holdAmount, int degradedHoldAmount) - { - this.baseHoldAmount = holdAmount; - this.degradedBaseHoldAmount = degradedHoldAmount; - } - - static Pouch forItem(int itemId) - { - switch (itemId) - { - case ItemID.SMALL_POUCH: - return SMALL; - case ItemID.MEDIUM_POUCH: - case ItemID.MEDIUM_POUCH_5511: - return MEDIUM; - case ItemID.LARGE_POUCH: - case ItemID.LARGE_POUCH_5513: - return LARGE; - case ItemID.GIANT_POUCH: - case ItemID.GIANT_POUCH_5515: - return GIANT; - default: - return null; - } - } - - int getHoldAmount() - { - return degraded ? degradedBaseHoldAmount : baseHoldAmount; - } - - int getRemaining() - { - final int holdAmount = degraded ? degradedBaseHoldAmount : baseHoldAmount; - return holdAmount - holding; - } - - void addHolding(int delta) - { - holding += delta; - - final int holdAmount = degraded ? degradedBaseHoldAmount : baseHoldAmount; - if (holding < 0) - { - holding = 0; - } - if (holding > holdAmount) - { - holding = holdAmount; - } - } - - void degrade(boolean state) - { - if (state != degraded) - { - degraded = state; - final int holdAmount = degraded ? degradedBaseHoldAmount : baseHoldAmount; - holding = Math.min(holding, holdAmount); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/PouchOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/PouchOverlay.java deleted file mode 100644 index d4dd1b1421..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/PouchOverlay.java +++ /dev/null @@ -1,50 +0,0 @@ -package net.runelite.client.plugins.runecraft; - -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import net.runelite.api.ItemID; -import net.runelite.api.widgets.WidgetItem; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.ui.overlay.WidgetItemOverlay; - -public class PouchOverlay extends WidgetItemOverlay -{ - private final ItemManager itemManager; - private final RunecraftPlugin plugin; - - @Inject - private PouchOverlay(final ItemManager itemManager, final RunecraftPlugin plugin) - { - this.itemManager = itemManager; - this.plugin = plugin; - showOnInventory(); - } - - @Override - public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget) - { - switch (itemId) - { - case ItemID.MEDIUM_POUCH_5511: - case ItemID.LARGE_POUCH_5513: - case ItemID.GIANT_POUCH_5515: - final Rectangle bounds = itemWidget.getCanvasBounds(); - final BufferedImage outline = itemManager.getItemOutline(itemId, itemWidget.getQuantity(), Color.RED); - graphics.drawImage(outline, (int) bounds.getX(), (int) bounds.getY(), null); - break; - case ItemID.MEDIUM_POUCH: - OverlayUtil.renderTextLocation(graphics, itemWidget.getCanvasLocation(), "~" + plugin.getMediumCharges(), Color.WHITE); - break; - case ItemID.LARGE_POUCH: - OverlayUtil.renderTextLocation(graphics, itemWidget.getCanvasLocation(), "~" + plugin.getLargeCharges(), Color.WHITE); - break; - case ItemID.GIANT_POUCH: - OverlayUtil.renderTextLocation(graphics, itemWidget.getCanvasLocation(), "~" + plugin.getGiantCharges(), Color.WHITE); - break; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/RunecraftConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/RunecraftConfig.java deleted file mode 100644 index aa319eb629..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/RunecraftConfig.java +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 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.client.plugins.runecraft; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigTitleSection; -import net.runelite.client.config.Title; - -@ConfigGroup("runecraft") -public interface RunecraftConfig extends Config -{ - @ConfigTitleSection( - keyName = "utilTitle", - name = "Utility", - description = "", - position = 1 - ) - default Title utilTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "lavas", - name = "Lavas", - description = "Swaps Ring of dueling menu entry depending on location, requires fire tiara or RC cape to be worn.", - titleSection = "utilTitle", - warning = "
This config option is incompatible with menu-entry-swapper equipment swaps." + - "
Expect bugs if you use them together.
", - position = 2 - ) - default boolean lavas() - { - return false; - } - - @ConfigItem( - keyName = "essPouch", - name = "Swap essence pouch", - description = "Makes essence pouch left-click fill in bank", - titleSection = "utilTitle", - position = 3 - ) - default boolean essPouch() - { - return true; - } - - @ConfigItem( - keyName = "hightlightDarkMage", - name = "Highlight Dark Mage NPC", - description = "Configures whether to highlight the Dark Mage when pouches are degraded", - position = 4, - titleSection = "utilTitle" - ) - default boolean hightlightDarkMage() - { - return true; - } - - @ConfigItem( - keyName = "degradingNotification", - name = "Notify when pouch degrades", - description = "Send a notification when a pouch degrades", - position = 5, - titleSection = "utilTitle" - ) - default boolean degradingNotification() - { - return true; - } - - @ConfigItem( - keyName = "degradeOverlay", - name = "Show Uses until Degrade", - description = "This will show how many uses are left on a pouch until they degrade.", - position = 6, - titleSection = "utilTitle" - ) - default boolean degradeOverlay() - { - return true; - } - - @ConfigItem( - keyName = "essenceOverlay", - name = "Show essence in pouch", - description = "This will show how many essence are in your pouch.", - position = 7, - titleSection = "utilTitle" - ) - default boolean essenceOverlay() - { - return true; - } - - @ConfigTitleSection( - keyName = "riftsTitle", - name = "Rifts", - description = "", - position = 6 - ) - default Title riftsTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "showRifts", - name = "Show Rifts in Abyss", - description = "Configures whether the rifts in the abyss will be displayed", - position = 7, - titleSection = "riftsTitle" - ) - default boolean showRifts() - { - return true; - } - - @ConfigItem( - keyName = "showAir", - name = "Show Air rift", - description = "Configures whether to display the air rift", - position = 8, - titleSection = "riftsTitle", - hidden = true, - unhide = "showRifts" - ) - default boolean showAir() - { - return true; - } - - @ConfigItem( - keyName = "showBlood", - name = "Show Blood rift", - description = "Configures whether to display the Blood rift", - position = 9, - titleSection = "riftsTitle", - hidden = true, - unhide = "showRifts" - ) - default boolean showBlood() - { - return true; - } - - @ConfigItem( - keyName = "showBody", - name = "Show Body rift", - description = "Configures whether to display the Body rift", - position = 10, - titleSection = "riftsTitle", - hidden = true, - unhide = "showRifts" - ) - default boolean showBody() - { - return true; - } - - @ConfigItem( - keyName = "showChaos", - name = "Show Chaos rift", - description = "Configures whether to display the Chaos rift", - position = 11, - titleSection = "riftsTitle", - hidden = true, - unhide = "showRifts" - ) - default boolean showChaos() - { - return true; - } - - @ConfigItem( - keyName = "showCosmic", - name = "Show Cosmic rift", - description = "Configures whether to display the Cosmic rift", - position = 12, - titleSection = "riftsTitle", - hidden = true, - unhide = "showRifts" - ) - default boolean showCosmic() - { - return true; - } - - @ConfigItem( - keyName = "showDeath", - name = "Show Death rift", - description = "Configures whether to display the Death rift", - position = 13, - titleSection = "riftsTitle", - hidden = true, - unhide = "showRifts" - ) - default boolean showDeath() - { - return true; - } - - @ConfigItem( - keyName = "showEarth", - name = "Show Earth rift", - description = "Configures whether to display the Earth rift", - position = 14, - titleSection = "riftsTitle", - hidden = true, - unhide = "showRifts" - ) - default boolean showEarth() - { - return true; - } - - @ConfigItem( - keyName = "showFire", - name = "Show Fire rift", - description = "Configures whether to display the Fire rift", - position = 15, - titleSection = "riftsTitle", - hidden = true, - unhide = "showRifts" - ) - default boolean showFire() - { - return true; - } - - @ConfigItem( - keyName = "showLaw", - name = "Show Law rift", - description = "Configures whether to display the Law rift", - position = 16, - titleSection = "riftsTitle", - hidden = true, - unhide = "showRifts" - ) - default boolean showLaw() - { - return true; - } - - @ConfigItem( - keyName = "showMind", - name = "Show Mind rift", - description = "Configures whether to display the Mind rift", - position = 17, - titleSection = "riftsTitle", - hidden = true, - unhide = "showRifts" - ) - default boolean showMind() - { - return true; - } - - @ConfigItem( - keyName = "showNature", - name = "Show Nature rift", - description = "Configures whether to display the Nature rift", - position = 18, - titleSection = "riftsTitle", - hidden = true, - unhide = "showRifts" - ) - default boolean showNature() - { - return true; - } - - @ConfigItem( - keyName = "showSoul", - name = "Show Soul rift", - description = "Configures whether to display the Soul rift", - position = 19, - titleSection = "riftsTitle", - hidden = true, - unhide = "showRifts" - ) - default boolean showSoul() - { - return true; - } - - @ConfigItem( - keyName = "showWater", - name = "Show Water rift", - description = "Configures whether to display the Water rift", - position = 20, - titleSection = "riftsTitle", - hidden = true, - unhide = "showRifts" - ) - default boolean showWater() - { - return true; - } - - @ConfigItem( - keyName = "showClickBox", - name = "Show Rift click box", - description = "Configures whether to display the click box of the rift", - position = 21, - titleSection = "riftsTitle", - hidden = true, - unhide = "showRifts" - ) - default boolean showClickBox() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/RunecraftOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/RunecraftOverlay.java deleted file mode 100644 index f78880bc84..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/RunecraftOverlay.java +++ /dev/null @@ -1,46 +0,0 @@ -package net.runelite.client.plugins.runecraft; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.components.ComponentOrientation; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -@Singleton -public class RunecraftOverlay extends Overlay -{ - private final RunecraftPlugin plugin; - private final PanelComponent panel = new PanelComponent(); - - @Inject - RunecraftOverlay(final RunecraftPlugin plugin) - { - this.plugin = plugin; - setPosition(OverlayPosition.CANVAS_TOP_RIGHT); - panel.setOrientation(ComponentOrientation.VERTICAL); - } - - public Dimension render(Graphics2D graphics) - { - String text = "Pouch Has Degraded"; - panel.getChildren().clear(); - if (plugin.isDegradedPouchInInventory()) - { - panel.getChildren().add(TitleComponent.builder() - .text("Pouch Has Degraded") - .color(Color.red) - .build()); - panel.setPreferredSize(new Dimension(graphics.getFontMetrics().stringWidth(text) + 5, 5)); - return panel.render(graphics); - } - else - { - return null; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/RunecraftPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/RunecraftPlugin.java deleted file mode 100644 index 6546a54f2f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runecraft/RunecraftPlugin.java +++ /dev/null @@ -1,699 +0,0 @@ -/* - * Copyright (c) 2017, 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.runecraft; - -import static java.lang.Math.min; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.inject.Provides; -import java.util.ArrayDeque; -import java.util.Deque; -import java.util.HashSet; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.DecorativeObject; -import net.runelite.api.GameState; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemID; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.VarPlayer; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.DecorativeObjectDespawned; -import net.runelite.api.events.DecorativeObjectSpawned; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.client.Notifier; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.menus.BaseComparableEntry; -import static net.runelite.client.menus.ComparableEntries.newBaseComparableEntry; -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.plugins.menuentryswapper.comparables.BankComparableEntry; -import net.runelite.client.plugins.menuentryswapper.comparables.EquipmentComparableEntry; -import static net.runelite.client.plugins.runecraft.AbyssRifts.*; -import net.runelite.client.ui.overlay.OverlayManager; - - -@PluginDescriptor( - name = "Runecraft", - description = "Show minimap icons and clickboxes for abyssal rifts", - tags = {"abyssal", "minimap", "overlay", "rifts", "rc", "runecrafting"}, - type = PluginType.SKILLING -) -@Singleton -@Getter(AccessLevel.PACKAGE) -@Slf4j -public class RunecraftPlugin extends Plugin -{ - private static final int MEDIUM_DEGRADE = 46; - private static final int LARGE_DEGRADE = 30; - private static final int GIANT_DEGRADE = 11; - private static final Object POUCH_TICK = new Object(); - private static final BankComparableEntry POUCH = new BankComparableEntry("fill", "pouch", false); - private static final BaseComparableEntry EMPTY_SMALL = newBaseComparableEntry("empty", "small pouch"); - private static final BaseComparableEntry EMPTY_MEDIUM = newBaseComparableEntry("empty", "medium pouch"); - private static final BaseComparableEntry EMPTY_LARGE = newBaseComparableEntry("empty", "large pouch"); - private static final BaseComparableEntry EMPTY_GIANT = newBaseComparableEntry("empty", "giant pouch"); - private static final EquipmentComparableEntry CASTLE_WARS = new EquipmentComparableEntry("castle wars", "ring of dueling"); - private static final EquipmentComparableEntry DUEL_ARENA = new EquipmentComparableEntry("duel arena", "ring of dueling"); - private static final String POUCH_DECAYED_MESSAGE = "Your pouch has decayed through use."; - private static final String POUCH_DECAYED_NOTIFICATION_MESSAGE = "Your rune pouch has decayed."; - private static final int FIRE_ALTAR = 10315; - private static final Set DEGRADED_POUCHES = ImmutableSet.of( - ItemID.MEDIUM_POUCH_5511, - ItemID.LARGE_POUCH_5513, - ItemID.GIANT_POUCH_5515 - ); - private static final int INVENTORY_SIZE = 28; - private static final Pattern POUCH_CHECK_MESSAGE = Pattern.compile("^There (?:is|are) ([a-z]+)(?: pure)? essences? in this pouch\\.$"); - private static final ImmutableMap TEXT_TO_NUMBER = ImmutableMap.builder() - .put("no", 0) - .put("one", 1) - .put("two", 2) - .put("three", 3) - .put("four", 4) - .put("five", 5) - .put("six", 6) - .put("seven", 7) - .put("eight", 8) - .put("nine", 9) - .put("ten", 10) - .put("eleven", 11) - .put("twelve", 12) - .build(); - - private final Deque clickedItems = new ArrayDeque<>(); - private final Deque checkedPouches = new ArrayDeque<>(); - private final Set rifts = new HashSet<>(); - private final Set abyssObjects = new HashSet<>(); - private int lastEssence; - private int lastSpace; - @Inject - private Client client; - @Inject - private OverlayManager overlayManager; - @Inject - private AbyssOverlay abyssOverlay; - @Inject - private AbyssMinimapOverlay abyssMinimapOverlay; - @Inject - private RunecraftOverlay runecraftOverlay; - @Inject - private EssencePouchOverlay essencePouchOverlay; - @Inject - private PouchOverlay pouchOverlay; - @Inject - private RunecraftConfig config; - @Inject - private Notifier notifier; - @Inject - private MenuManager menuManager; - @Inject - private EventBus eventBus; - private boolean degradedPouchInInventory; - private boolean degradingNotification; - private boolean essPouch; - private boolean hightlightDarkMage; - private boolean lavas; - private boolean showClickBox; - private boolean showRifts; - private boolean degradeOverlay; - private boolean essenceOverlay; - private boolean medDegrade; - private boolean largeDegrade; - private boolean giantDegrade; - private int mediumCharges = MEDIUM_DEGRADE; - private int largeCharges = LARGE_DEGRADE; - private int giantCharges = GIANT_DEGRADE; - private int pouchVar = 0; - private NPC darkMage; - - @Provides - RunecraftConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(RunecraftConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - overlayManager.add(abyssOverlay); - overlayManager.add(abyssMinimapOverlay); - overlayManager.add(runecraftOverlay); - overlayManager.add(essencePouchOverlay); - handleSwaps(); - - for (Pouch pouch : Pouch.values()) - { - pouch.setHolding(0); - pouch.setUnknown(true); - pouch.degrade(false); - } - - lastEssence = lastSpace = -1; - } - - @Override - protected void shutDown() - { - abyssObjects.clear(); - darkMage = null; - degradedPouchInInventory = false; - overlayManager.remove(abyssOverlay); - overlayManager.remove(abyssMinimapOverlay); - overlayManager.remove(runecraftOverlay); - overlayManager.remove(essencePouchOverlay); - removeSwaps(); - } - - private void onGameTick(GameTick event) - { - final int before = pouchVar; - pouchVar = client.getVar(VarPlayer.POUCH_STATUS); - - if (pouchVar == before) - { - return; - } - - if ((pouchVar & 0x8) > 0 && (before & 0x8) <= 0) - { - if (giantCharges > 0) - { - giantCharges--; - } - } - if ((pouchVar & 0x4) > 0 && (before & 0x4) <= 0) - { - if (largeCharges > 0) - { - largeCharges--; - } - } - if ((pouchVar & 0x2) > 0 && (before & 0x2) <= 0) - { - if (mediumCharges > 0) - { - mediumCharges--; - } - } - } - - @Subscribe - private void onItemContainerChanged(ItemContainerChanged event) - { - final ItemContainer container = event.getItemContainer(); - - if (container == client.getItemContainer(InventoryID.INVENTORY)) - { - degradedPouchInInventory = false; - - for (Item item : container.getItems()) - { - if (!medDegrade && item.getId() == ItemID.MEDIUM_POUCH_5511) - { - medDegrade = true; - mediumCharges = 0; - degradedPouchInInventory = true; - } - else if (!largeDegrade && item.getId() == ItemID.LARGE_POUCH_5513) - { - largeDegrade = true; - largeCharges = 0; - degradedPouchInInventory = true; - } - else if (!giantDegrade && item.getId() == ItemID.GIANT_POUCH_5515) - { - giantDegrade = true; - giantCharges = 0; - degradedPouchInInventory = true; - } - else if (medDegrade && item.getId() == ItemID.MEDIUM_POUCH) - { - medDegrade = false; - mediumCharges = MEDIUM_DEGRADE; - } - else if (largeDegrade && item.getId() == ItemID.LARGE_POUCH) - { - largeDegrade = false; - largeCharges = LARGE_DEGRADE; - } - else if (giantDegrade && item.getId() == ItemID.GIANT_POUCH) - { - giantDegrade = false; - giantCharges = GIANT_DEGRADE; - } - } - } - - if (InventoryID.INVENTORY.getId() != event.getContainerId()) - { - return; - } - - final Item[] items = event.getItemContainer().getItems(); - - int newEss = 0; - int newSpace = 0; - - // Count ess/space, and change pouch states - for (Item item : items) - { - switch (item.getId()) - { - case ItemID.PURE_ESSENCE: - newEss += 1; - break; - case -1: - newSpace += 1; - break; - case ItemID.MEDIUM_POUCH: - case ItemID.LARGE_POUCH: - case ItemID.GIANT_POUCH: - Pouch pouch = Pouch.forItem(item.getId()); - pouch.degrade(false); - break; - case ItemID.MEDIUM_POUCH_5511: - case ItemID.LARGE_POUCH_5513: - case ItemID.GIANT_POUCH_5515: - pouch = Pouch.forItem(item.getId()); - pouch.degrade(true); - break; - } - } - if (items.length < INVENTORY_SIZE) - { - // Pad newSpace for unallocated inventory slots - newSpace += INVENTORY_SIZE - items.length; - } - - if (clickedItems.isEmpty()) - { - lastSpace = newSpace; - lastEssence = newEss; - return; - } - - if (lastEssence == -1 || lastSpace == -1) - { - lastSpace = newSpace; - lastEssence = newEss; - clickedItems.clear(); - return; - } - - final int tick = client.getTickCount(); - - int essence = lastEssence; - int space = lastSpace; - - - while (essence != newEss) - { - ClickOperation op = clickedItems.poll(); - if (op == null) - { - break; - } - - if (tick > op.tick) - { - continue; - } - - Pouch pouch = op.pouch; - - final boolean fill = op.delta > 0; - // How much ess can either be deposited or withdrawn - final int required = fill ? pouch.getRemaining() : pouch.getHolding(); - // Bound to how much ess or free space we actually have, and optionally negate - final int essenceGot = op.delta * min(required, fill ? essence : space); - - // if we have enough essence or space to fill or empty the entire pouch, it no - // longer becomes unknown - if (pouch.isUnknown() && (fill ? essence : space) >= pouch.getHoldAmount()) - { - pouch.setUnknown(false); - } - - - essence -= essenceGot; - space += essenceGot; - - pouch.addHolding(essenceGot); - } - - if (!clickedItems.isEmpty()) - { - return; - } - - lastSpace = newSpace; - lastEssence = newEss; - } - - @Subscribe - public void onMenuOptionClicked(MenuOptionClicked event) - { - switch (event.getMenuOpcode()) - { - case ITEM_FIRST_OPTION: - case ITEM_SECOND_OPTION: - case ITEM_THIRD_OPTION: - case ITEM_FOURTH_OPTION: - case ITEM_FIFTH_OPTION: - case GROUND_ITEM_THIRD_OPTION: // Take - break; - default: - return; - } - - final int id = event.getIdentifier(); - final Pouch pouch = Pouch.forItem(id); - if (pouch == null) - { - return; - } - - final int tick = client.getTickCount() + 3; - switch (event.getOption()) - { - case "Fill": - clickedItems.add(new ClickOperation(pouch, tick, 1)); - break; - case "Empty": - clickedItems.add(new ClickOperation(pouch, tick, -1)); - break; - case "Check": - checkedPouches.add(new ClickOperation(pouch, tick)); - break; - case "Take": - // Dropping pouches clears them, so clear when picked up - pouch.setHolding(0); - break; - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("runecraft")) - { - return; - } - - updateConfig(); - - if (event.getKey().equals("essPouch") || event.getKey().equals("Lavas")) - { - removeSwaps(); - handleSwaps(); - } - } - - @Subscribe - private void onChatMessage(ChatMessage event) - { - if (event.getType() != ChatMessageType.GAMEMESSAGE) - { - return; - } - - if (this.degradingNotification && event.getMessage().contains(POUCH_DECAYED_MESSAGE)) - { - notifier.notify(POUCH_DECAYED_NOTIFICATION_MESSAGE); - } - - if (!checkedPouches.isEmpty()) - { - Matcher matcher = POUCH_CHECK_MESSAGE.matcher(event.getMessage()); - if (matcher.matches()) - { - final int num = TEXT_TO_NUMBER.get(matcher.group(1)); - // Keep getting operations until we get a valid one - do - { - final ClickOperation op = checkedPouches.pop(); - if (op.tick >= client.getTickCount()) - { - Pouch pouch = op.pouch; - pouch.setHolding(num); - pouch.setUnknown(false); - break; - } - } - while (!checkedPouches.isEmpty()); - } - } - } - - @Subscribe - private void onDecorativeObjectSpawned(DecorativeObjectSpawned event) - { - final DecorativeObject decorativeObject = event.getDecorativeObject(); - if (AbyssRifts.getRift(decorativeObject.getId()) != null) - { - abyssObjects.add(decorativeObject); - } - } - - @Subscribe - private void onDecorativeObjectDespawned(DecorativeObjectDespawned event) - { - final DecorativeObject decorativeObject = event.getDecorativeObject(); - abyssObjects.remove(decorativeObject); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - final GameState gameState = event.getGameState(); - - switch (gameState) - { - case LOADING: - abyssObjects.clear(); - break; - case CONNECTION_LOST: - case HOPPING: - case LOGIN_SCREEN: - darkMage = null; - break; - case LOGGED_IN: - removeSwaps(); - handleSwaps(); - break; - } - } - - @Subscribe - private void onNpcSpawned(NpcSpawned event) - { - final NPC npc = event.getNpc(); - - if (npc.getId() == NpcID.DARK_MAGE) - { - darkMage = npc; - } - } - - @Subscribe - private void onNpcDespawned(NpcDespawned event) - { - final NPC npc = event.getNpc(); - - if (npc != null && npc == darkMage) - { - darkMage = null; - } - } - - private void handleSwaps() - { - if (this.essPouch) - { - menuManager.addPriorityEntry(POUCH).setPriority(100); - menuManager.addPriorityEntry(EMPTY_SMALL).setPriority(10); - menuManager.addPriorityEntry(EMPTY_MEDIUM).setPriority(10); - menuManager.addPriorityEntry(EMPTY_LARGE).setPriority(10); - menuManager.addPriorityEntry(EMPTY_GIANT).setPriority(10); - } - else - { - menuManager.removePriorityEntry(POUCH); - menuManager.removePriorityEntry(EMPTY_SMALL); - menuManager.removePriorityEntry(EMPTY_MEDIUM); - menuManager.removePriorityEntry(EMPTY_LARGE); - menuManager.removePriorityEntry(EMPTY_GIANT); - } - - if (client.getLocalPlayer() == null || !this.lavas) - { - menuManager.removeHiddenEntry("craft", "altar", false, false); - menuManager.removeHiddenEntry("use", "pure essence", false, true); - return; - } - - if (client.getLocalPlayer().getWorldLocation().getRegionID() != FIRE_ALTAR) - { - menuManager.removeHiddenEntry("craft", "altar", false, false); - menuManager.removeHiddenEntry("use", "Pure essence", false, true); - menuManager.addPriorityEntry(DUEL_ARENA).setPriority(100); - menuManager.removePriorityEntry(CASTLE_WARS); - } - else if (client.getLocalPlayer().getWorldLocation().getRegionID() == FIRE_ALTAR) - { - menuManager.addHiddenEntry("craft", "altar", false, false); - menuManager.addHiddenEntry("use", "Pure essence", false, true); - menuManager.addPriorityEntry(CASTLE_WARS).setPriority(100); - menuManager.removePriorityEntry(DUEL_ARENA); - } - } - - private void removeSwaps() - { - menuManager.removeHiddenEntry("craft", "altar", false, false); - menuManager.removeHiddenEntry("use", "Pure essence", false, true); - menuManager.removePriorityEntry(POUCH); - menuManager.removePriorityEntry(EMPTY_SMALL); - menuManager.removePriorityEntry(EMPTY_MEDIUM); - menuManager.removePriorityEntry(EMPTY_LARGE); - menuManager.removePriorityEntry(EMPTY_GIANT); - menuManager.removePriorityEntry(CASTLE_WARS); - menuManager.removePriorityEntry(DUEL_ARENA); - } - - private void updateConfig() - { - this.lavas = config.lavas(); - this.essPouch = config.essPouch(); - this.hightlightDarkMage = config.hightlightDarkMage(); - this.degradingNotification = config.degradingNotification(); - this.showRifts = config.showRifts(); - this.showClickBox = config.showClickBox(); - this.degradeOverlay = config.degradeOverlay(); - this.essenceOverlay = config.essenceOverlay(); - - if (this.essenceOverlay) - { - overlayManager.add(essencePouchOverlay); - } - else - { - overlayManager.remove(essencePouchOverlay); - } - - if (this.degradeOverlay) - { - overlayManager.add(pouchOverlay); - eventBus.subscribe(GameTick.class, POUCH_TICK, this::onGameTick); - } - else - { - overlayManager.remove(pouchOverlay); - eventBus.unregister(POUCH_TICK); - } - - updateRifts(); - } - - private void updateRifts() - { - rifts.clear(); - if (config.showAir()) - { - rifts.add(AIR_RIFT); - } - if (config.showBlood()) - { - rifts.add(BLOOD_RIFT); - } - if (config.showBody()) - { - rifts.add(BODY_RIFT); - } - if (config.showChaos()) - { - rifts.add(CHAOS_RIFT); - } - if (config.showCosmic()) - { - rifts.add(COSMIC_RIFT); - } - if (config.showDeath()) - { - rifts.add(DEATH_RIFT); - } - if (config.showEarth()) - { - rifts.add(EARTH_RIFT); - } - if (config.showFire()) - { - rifts.add(FIRE_RIFT); - } - if (config.showLaw()) - { - rifts.add(LAW_RIFT); - } - if (config.showMind()) - { - rifts.add(MIND_RIFT); - } - if (config.showNature()) - { - rifts.add(NATURE_RIFT); - } - if (config.showSoul()) - { - rifts.add(SOUL_RIFT); - } - if (config.showWater()) - { - rifts.add(WATER_RIFT); - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuConfig.java deleted file mode 100644 index 876fe20b4a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuConfig.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * 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.runedoku; - -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.ConfigTitleSection; -import net.runelite.client.config.Title; - -@ConfigGroup("runedoku") -public interface RunedokuConfig extends Config -{ - - @ConfigTitleSection( - keyName = "colorTitle", - position = 0, - name = "Colors", - description = "" //stubs don't show descriptions when hovered over - ) - default Title colorTitle() - { - return new Title(); - } - - @ConfigItem( - position = 1, - keyName = "mindRuneColor", - name = "Mind Rune Color", - description = "Color used to highlight Mind runes.", - titleSection = "colorTitle" - ) - default Color mindRuneColor() - { - return Color.PINK; - } - - @ConfigItem( - position = 2, - keyName = "fireRuneColor", - name = "Fire Rune Color", - description = "Color used to highlight Fire runes.", - titleSection = "colorTitle" - ) - default Color fireRuneColor() - { - return Color.RED; - } - - @ConfigItem( - position = 3, - keyName = "bodyRuneColor", - name = "Body Rune Color", - description = "Color used to highlight Body runes.", - titleSection = "colorTitle" - ) - default Color bodyRuneColor() - { - return Color.MAGENTA; - } - - @ConfigItem( - position = 4, - keyName = "airRuneColor", - name = "Air Rune Color", - description = "Color used to highlight Air runes.", - titleSection = "colorTitle" - ) - default Color airRuneColor() - { - return Color.WHITE; - } - - @ConfigItem( - position = 5, - keyName = "deathRuneColor", - name = "Death Rune Color", - description = "Color used to highlight Death runes.", - titleSection = "colorTitle" - ) - default Color deathRuneColor() - { - return Color.BLACK; - } - - @ConfigItem( - position = 6, - keyName = "waterRuneColor", - name = "Water Rune Color", - description = "Color used to highlight Water runes.", - titleSection = "colorTitle" - ) - default Color waterRuneColor() - { - return Color.BLUE; - } - - @ConfigItem( - position = 7, - keyName = "chaosRuneColor", - name = "Chaos Rune Color", - description = "Color used to highlight Chaos runes.", - titleSection = "colorTitle" - ) - default Color chaosRuneColor() - { - return Color.YELLOW; - } - - @ConfigItem( - position = 8, - keyName = "earthRuneColor", - name = "Earth Rune Color", - description = "Color used to highlight Earth runes.", - titleSection = "colorTitle" - ) - default Color earthRuneColor() - { - return Color.GREEN; - } - - @ConfigItem( - position = 9, - keyName = "lawRuneColor", - name = "Law Rune Color", - description = "Color used to highlight Law runes.", - titleSection = "colorTitle" - ) - default Color lawRuneColor() - { - return Color.CYAN; - } - - @ConfigTitleSection( - keyName = "miscFeature", - position = 10, - name = "Miscellaneous Features", - description = "" - ) - default Title miscFeature() - { - return new Title(); - } - - @ConfigItem( - position = 11, - keyName = "onlyHighlightSelectedPiece", - name = "Only Highlight Selected Piece", - description = "Instead of showing all, this option only show what rune you have selected.", - titleSection = "miscFeature" - ) - default boolean onlyHighlightSelectedPiece() - { - return false; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuOverlay.java deleted file mode 100644 index 593151484a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuOverlay.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * 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.runedoku; - -import java.awt.Color; -import static java.awt.Color.RED; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.widgets.Widget; -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; - -/** - * @author gazivodag - */ -@Singleton -class RunedokuOverlay extends Overlay -{ - - private final RunedokuPlugin plugin; - private final Client client; - private final RunedokuUtil util; - - - @Inject - private RunedokuOverlay(final RunedokuPlugin plugin, final Client client, final RunedokuUtil util) - { - super(plugin); - this.plugin = plugin; - this.client = client; - this.util = util; - - setPosition(OverlayPosition.DETACHED); - setLayer(OverlayLayer.ALWAYS_ON_TOP); - setPriority(OverlayPriority.MED); - } - - @Override - public Dimension render(Graphics2D graphics) - { - - final Widget sudokuScreen = client.getWidget(288, 131); - - if (sudokuScreen != null && !sudokuScreen.isHidden()) - { - Sudoku sudoku = new Sudoku(util.createTable(client)); - boolean solved = sudoku.solve(); - - renderReferenceRunes(graphics, solved); - renderSolvedPuzzle(graphics, sudoku, solved); - } - - return null; - } - - /** - * highlights the runes on the left handside so you know which runes to place on the board - * - * @param graphics - * @param solved - */ - private void renderReferenceRunes(Graphics2D graphics, boolean solved) - { - //reference runes on the left handside - for (int i = 121; i < 130; i++) - { - Widget widget = client.getWidget(288, i); - if (solved) - { - if (!util.makeSimple(util.createTable(client)).contains(0)) - { - OverlayUtil.renderPolygon(graphics, RunedokuUtil.rectangleToPolygon(widget.getBounds()), Color.GREEN); - } - else - { - OverlayUtil.renderPolygon(graphics, RunedokuUtil.rectangleToPolygon(widget.getBounds()), util.referenceColors(i)); - } - } - else - { - OverlayUtil.renderPolygon(graphics, RunedokuUtil.rectangleToPolygon(widget.getBounds()), RED); - } - - } - } - - /** - * goes through each 9x9 cell and tells you which piece to place in there - * - * @param graphics - * @param sudoku - * @param solved - */ - private void renderSolvedPuzzle(Graphics2D graphics, Sudoku sudoku, boolean solved) - { - List simpleArr = util.makeSimple(sudoku.getBoard()); - //highlight each cell to tell you which piece to place - int iteration = 0; - for (int i = 10; i < 91; i++) - { - Widget squareToHighlight = client.getWidget(288, i); - if (solved) - { - if (!util.makeSimple(util.createTable(client)).contains(0)) - { - OverlayUtil.renderPolygon(graphics, RunedokuUtil.rectangleToPolygon(squareToHighlight.getBounds()), Color.GREEN); - } - else - { - if (!plugin.isOnlyHighlightSelectedPiece() ^ (plugin.isOnlyHighlightSelectedPiece() && util.getSelectedPiece(client) == simpleArr.get(iteration))) - { - OverlayUtil.renderPolygon(graphics, RunedokuUtil.rectangleToPolygon(squareToHighlight.getBounds()), util.sudokuPieceToColor(simpleArr.get(iteration))); - } - } - iteration++; - } - else - { - OverlayUtil.renderPolygon(graphics, RunedokuUtil.rectangleToPolygon(squareToHighlight.getBounds()), RED); - } - - } - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuPiece.java b/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuPiece.java deleted file mode 100644 index d19b5845b1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuPiece.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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.runedoku; - -public enum RunedokuPiece -{ - - NPC_PLACED_MIND_RUNE(6436, 1), //1 - NPC_PLACED_FIRE_RUNE(6428, 2), //2 - NPC_PLACED_BODY_RUNE(6438, 3), //3 - NPC_PLACED_AIR_RUNE(6422, 4), //4 - NPC_PLACED_DEATH_RUNE(6432, 5), //5 - NPC_PLACED_WATER_RUNE(6424, 6), //6 - NPC_PLACED_CHAOS_RUNE(6430, 7), //7 - NPC_PLACED_EARTH_RUNE(6426, 8), //8 - NPC_PLACED_LAW_RUNE(6434, 9), //9 - - PLAYER_PLACED_MIND_RUNE(558, 1), //1 - PLAYER_PLACED_FIRE_RUNE(554, 2), //2 - PLAYER_PLACED_BODY_RUNE(559, 3), //3 - PLAYER_PLACED_AIR_RUNE(556, 4), //4 - PLAYER_PLACED_DEATH_RUNE(560, 5), //5 - PLAYER_PLACED_WATER_RUNE(555, 6), //6 - PLAYER_PLACED_CHAOS_RUNE(562, 7), //7 - PLAYER_PLACED_EARTH_RUNE(557, 8), //8 - PLAYER_PLACED_LAW_RUNE(563, 9), //9 - ; - - private final int pieceID; - private final int pieceForSudoku; - - RunedokuPiece(final int pieceID, final int pieceForSudoku) - { - this.pieceID = pieceID; - this.pieceForSudoku = pieceForSudoku; - } - - private int getId() - { - return pieceID; - } - - int getPieceForSudoku() - { - return pieceForSudoku; - } - - static RunedokuPiece getById(int pieceID) - { - for (RunedokuPiece e : RunedokuPiece.values()) - { - if (e.getId() == pieceID) - { - return e; - } - } - return null; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuPlugin.java deleted file mode 100644 index d454722b84..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuPlugin.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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.runedoku; - -import com.google.inject.Provides; -import java.awt.Color; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "Runedoku Solver", - description = "Show solutions for current Runedoku puzzle.", - tags = {"overlay", "runedoku", "sudoku", "puzzle", "solving"}, - type = PluginType.MINIGAME, - enabledByDefault = false -) - -@Slf4j -@Singleton -public class RunedokuPlugin extends Plugin -{ - @Inject - private OverlayManager overlayManager; - - @Inject - private RunedokuOverlay runedokuOverlay; - - @Inject - private RunedokuConfig config; - - @Getter(AccessLevel.PACKAGE) - private Color mindRuneColor; - @Getter(AccessLevel.PACKAGE) - private Color fireRuneColor; - @Getter(AccessLevel.PACKAGE) - private Color bodyRuneColor; - @Getter(AccessLevel.PACKAGE) - private Color airRuneColor; - @Getter(AccessLevel.PACKAGE) - private Color deathRuneColor; - @Getter(AccessLevel.PACKAGE) - private Color waterRuneColor; - @Getter(AccessLevel.PACKAGE) - private Color chaosRuneColor; - @Getter(AccessLevel.PACKAGE) - private Color earthRuneColor; - @Getter(AccessLevel.PACKAGE) - private Color lawRuneColor; - @Getter(AccessLevel.PACKAGE) - private boolean onlyHighlightSelectedPiece; - - @Provides - RunedokuConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(RunedokuConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(runedokuOverlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(runedokuOverlay); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("runedoku")) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.mindRuneColor = config.mindRuneColor(); - this.fireRuneColor = config.fireRuneColor(); - this.bodyRuneColor = config.bodyRuneColor(); - this.airRuneColor = config.airRuneColor(); - this.deathRuneColor = config.deathRuneColor(); - this.waterRuneColor = config.waterRuneColor(); - this.chaosRuneColor = config.chaosRuneColor(); - this.earthRuneColor = config.earthRuneColor(); - this.lawRuneColor = config.lawRuneColor(); - this.onlyHighlightSelectedPiece = config.onlyHighlightSelectedPiece(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuUtil.java b/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuUtil.java deleted file mode 100644 index 1687eb5a05..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/RunedokuUtil.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * 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.runedoku; - -import java.awt.Color; -import java.awt.Polygon; -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetItem; - -class RunedokuUtil -{ - - private final RunedokuPlugin plugin; - - @Inject - RunedokuUtil(final RunedokuPlugin plugin) - { - this.plugin = plugin; - } - - Color sudokuPieceToColor(int i) - { - switch (i) - { - case 1: - return plugin.getMindRuneColor(); - case 2: - return plugin.getFireRuneColor(); - case 3: - return plugin.getBodyRuneColor(); - case 4: - return plugin.getAirRuneColor(); - case 5: - return plugin.getDeathRuneColor(); - case 6: - return plugin.getWaterRuneColor(); - case 7: - return plugin.getChaosRuneColor(); - case 8: - return plugin.getEarthRuneColor(); - case 9: - return plugin.getLawRuneColor(); - default: - return Color.RED; - } - } - - Color referenceColors(int i) - { - switch (i) - { - case 121: //earth - return plugin.getEarthRuneColor(); - case 122: //water - return plugin.getWaterRuneColor(); - case 123: //air - return plugin.getAirRuneColor(); - case 124: //mind - return plugin.getMindRuneColor(); - case 125: //fire - return plugin.getFireRuneColor(); - case 126: //body - return plugin.getBodyRuneColor(); - case 127: //death - return plugin.getDeathRuneColor(); - case 128: //chaos - return plugin.getChaosRuneColor(); - case 129: //plugin - return plugin.getLawRuneColor(); - default: - return Color.RED; - } - } - - /** - * Make the 2d array into an arraylist - * - * @param board - * @return - */ - List makeSimple(int[][] board) - { - List list = new ArrayList<>(); - for (int i = 0; i < 9; i++) - { - for (int ii = 0; ii < 9; ii++) - { - list.add(board[i][ii]); - } - } - return list; - } - - /** - * utility method - * - * @param rect - * @return - */ - static Polygon rectangleToPolygon(Rectangle rect) - { - int[] xpoints = {rect.x, rect.x + rect.width, rect.x + rect.width, rect.x}; - int[] ypoints = {rect.y, rect.y, rect.y + rect.height, rect.y + rect.height}; - return new Polygon(xpoints, ypoints, 4); - } - - /** - * Pulls data from what's on the Runedoku interface and creates a 2dimensional array for it - * - * @param client - * @return sudoku table that the client currently sees in a 2d array - * @author gazivodag - */ - int[][] createTable(Client client) - { - int[][] myArr = new int[9][9]; - Widget sudokuScreen = client.getWidget(288, 131); - for (int i = 0; i < 9; i++) - { - for (int ii = 0; ii < 9; ii++) - { - WidgetItem item; - int myIndex; - if (i > 0) - { - myIndex = ((i * 10) + ii) - i; - } - else - { - myIndex = ii; - } - if (myIndex == 81) - { - break; - } - item = sudokuScreen.getWidgetItem(myIndex); - if (item != null) - { - if (item.getId() != -1) - { - myArr[i][ii] = Objects.requireNonNull(RunedokuPiece.getById(item.getId())).getPieceForSudoku(); - } - else - { - myArr[i][ii] = 0; - } - } - else - { - myArr[i][ii] = 0; - } - } - } - return myArr; - } - - /** - * @param client - * @return - */ - int getSelectedPiece(Client client) - { - for (int i = 91; i < 100; i++) - { - Widget selectedPieceWidget = client.getWidget(288, i); - if (!selectedPieceWidget.isHidden()) - { - switch (i) - { - case 91: - return 8; - case 92: - return 6; - case 93: - return 4; - case 94: - return 2; - case 95: - return 1; - case 96: - return 3; - case 97: - return 5; - case 98: - return 7; - case 99: - return 9; - } - } - } - return -1; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/Sudoku.java b/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/Sudoku.java deleted file mode 100644 index 53711c8dc4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runedoku/Sudoku.java +++ /dev/null @@ -1,110 +0,0 @@ -package net.runelite.client.plugins.runedoku; - -/** - * Credits to whoever wrote this sudoku class. - * - * @author ? - */ -class Sudoku -{ - - private final int[][] board; - private static final int EMPTY = 0; - private static final int SIZE = 9; - - Sudoku(final int[][] board) - { - this.board = new int[SIZE][SIZE]; - for (int i = 0; i < SIZE; i++) - { - System.arraycopy(board[i], 0, this.board[i], 0, SIZE); - } - } - - private boolean isInRow(int row, int number) - { - for (int i = 0; i < SIZE; i++) - { - if (board[row][i] == number) - { - return true; - } - } - - return false; - } - - private boolean isInCol(int col, int number) - { - for (int i = 0; i < SIZE; i++) - { - if (board[i][col] == number) - { - return true; - } - } - - return false; - } - - private boolean isInBox(int row, int col, int number) - { - int r = row - row % 3; - int c = col - col % 3; - - for (int i = r; i < r + 3; i++) - { - for (int j = c; j < c + 3; j++) - { - if (board[i][j] == number) - { - return true; - } - } - } - - return false; - } - - private boolean isOk(int row, int col, int number) - { - return !isInRow(row, number) && !isInCol(col, number) && !isInBox(row, col, number); - } - - boolean solve() - { - for (int row = 0; row < SIZE; row++) - { - for (int col = 0; col < SIZE; col++) - { - if (board[row][col] == EMPTY) - { - for (int number = 1; number <= SIZE; number++) - { - if (isOk(row, col, number)) - { - board[row][col] = number; - if (solve()) - { - return true; - } - else - { - board[row][col] = EMPTY; - } - } - } - return false; - } - } - } - - return true; - } - - int[][] getBoard() - { - return board; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchConfig.java deleted file mode 100644 index 4ca92fc4b5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchConfig.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2017, Tyler - * 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.runepouch; - -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.plugins.runepouch.config.RunePouchOverlayMode; - -@ConfigGroup("runepouch") -public interface RunepouchConfig extends Config -{ - @ConfigItem( - keyName = "fontcolor", - name = "Font Color", - description = "Color of the font for the number of runes in pouch", - position = 1 - ) - default Color fontColor() - { - return Color.yellow; - } - - @ConfigItem( - keyName = "runeicons", - name = "Show Rune Icons", - description = "Show the rune icons next to the number of runes in pouch", - position = 2 - ) - default boolean showIcons() - { - return true; - } - - @ConfigItem( - keyName = "runePouchOverlayMode", - name = "Display mode", - description = "Configures where rune pouch overlay is displayed", - position = 3 - ) - default RunePouchOverlayMode runePouchOverlayMode() - { - return RunePouchOverlayMode.BOTH; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchOverlay.java deleted file mode 100644 index 093df0a42e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchOverlay.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2017, Tyler - * 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.runepouch; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.ItemID; -import net.runelite.api.Point; -import net.runelite.api.Varbits; -import net.runelite.api.widgets.WidgetItem; -import net.runelite.client.game.ItemManager; -import static net.runelite.client.plugins.runepouch.config.RunePouchOverlayMode.BOTH; -import static net.runelite.client.plugins.runepouch.config.RunePouchOverlayMode.MOUSE_HOVER; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.ui.overlay.WidgetItemOverlay; -import net.runelite.client.ui.overlay.tooltip.Tooltip; -import net.runelite.client.ui.overlay.tooltip.TooltipManager; -import net.runelite.client.util.ColorUtil; - -@Singleton -public class RunepouchOverlay extends WidgetItemOverlay -{ - private static final Varbits[] AMOUNT_VARBITS = - { - Varbits.RUNE_POUCH_AMOUNT1, Varbits.RUNE_POUCH_AMOUNT2, Varbits.RUNE_POUCH_AMOUNT3 - }; - private static final Varbits[] RUNE_VARBITS = - { - Varbits.RUNE_POUCH_RUNE1, Varbits.RUNE_POUCH_RUNE2, Varbits.RUNE_POUCH_RUNE3 - }; - private static final Dimension IMAGE_SIZE = new Dimension(11, 11); - - private final Client client; - private final RunepouchPlugin plugin; - private final TooltipManager tooltipManager; - - @Inject - private ItemManager itemManager; - - @Inject - RunepouchOverlay(final Client client, final RunepouchPlugin plugin, final TooltipManager tooltipManager) - { - this.tooltipManager = tooltipManager; - this.client = client; - this.plugin = plugin; - showOnInventory(); - showOnBank(); - } - - @Override - public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget) - { - if (itemId != ItemID.RUNE_POUCH && itemId != ItemID.RUNE_POUCH_L) - { - return; - } - - assert AMOUNT_VARBITS.length == RUNE_VARBITS.length; - - graphics.setFont(FontManager.getRunescapeSmallFont()); - - Point location = itemWidget.getCanvasLocation(); - StringBuilder tooltipBuilder = new StringBuilder(); - - for (int i = 0; i < AMOUNT_VARBITS.length; i++) - { - Varbits amountVarbit = AMOUNT_VARBITS[i]; - - int amount = client.getVar(amountVarbit); - if (amount <= 0) - { - continue; - } - - Varbits runeVarbit = RUNE_VARBITS[i]; - int runeId = client.getVar(runeVarbit); - Runes rune = Runes.getRune(runeId); - if (rune == null) - { - continue; - } - - tooltipBuilder - .append(amount) - .append(" ") - .append(ColorUtil.wrapWithColorTag(rune.getName(), Color.YELLOW)) - .append("
"); - - if (plugin.getRunePouchOverlayMode() == MOUSE_HOVER) - { - continue; - } - - // the reason this is not split up in maxascent and maxdescent to equal the height of the text like it should - // be is because numbers (afaik) dont use font descent so a 1 pixel seperator should be good and give - // consistent results across fonts - int yOffset = (1 + (graphics.getFontMetrics().getMaxAscent()) * i); - - graphics.setColor(Color.black); - - graphics.drawString("" + formatNumber(amount), location.getX() + (plugin.isShowIcons() ? 12 : 5), - location.getY() + 13 + (graphics.getFontMetrics().getHeight() - 1) * i); - - graphics.setColor(plugin.getFontColor()); - graphics.drawString("" + formatNumber(amount), location.getX() + (plugin.isShowIcons() ? 11 : 4), - location.getY() + 12 + (graphics.getFontMetrics().getHeight() - 1) * i); - - if (!plugin.isShowIcons()) - { - continue; - } - - BufferedImage image = getRuneImage(rune); - if (image != null) - { - OverlayUtil.renderImageLocation(graphics, - new Point(location.getX() - 1, location.getY() + graphics.getFontMetrics().getHeight() * i - 1), - image); - } - } - - String tooltip = tooltipBuilder.toString(); - - if (!tooltip.isEmpty() - && itemWidget.getCanvasBounds().contains(client.getMouseCanvasPosition().getX(), client.getMouseCanvasPosition().getY()) - && (plugin.getRunePouchOverlayMode() == MOUSE_HOVER || plugin.getRunePouchOverlayMode() == BOTH)) - { - tooltipManager.add(new Tooltip(tooltip)); - } - } - - private BufferedImage getRuneImage(Runes rune) - { - BufferedImage runeImg = rune.getImage(); - if (runeImg != null) - { - return runeImg; - } - - runeImg = itemManager.getImage(rune.getItemId()); - if (runeImg == null) - { - return null; - } - - BufferedImage resizedImg = new BufferedImage(IMAGE_SIZE.width, IMAGE_SIZE.height, BufferedImage.TYPE_INT_ARGB); - Graphics2D g = resizedImg.createGraphics(); - g.drawImage(runeImg, 0, 0, IMAGE_SIZE.width, IMAGE_SIZE.height, null); - g.dispose(); - - rune.setImage(resizedImg); - return resizedImg; - } - - private static String formatNumber(int amount) - { - return amount < 1000 ? String.valueOf(amount) : amount / 1000 + "K"; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchPlugin.java deleted file mode 100644 index b753a5ecb9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchPlugin.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2017, Tyler - * 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.runepouch; - -import com.google.inject.Provides; -import java.awt.Color; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.runepouch.config.RunePouchOverlayMode; -import net.runelite.client.ui.overlay.OverlayManager; - -@PluginDescriptor( - name = "Rune Pouch", - description = "Show the contents of your rune pouch", - tags = {"combat", "magic", "overlay"}, - type = PluginType.UTILITY -) -@Singleton -public class RunepouchPlugin extends Plugin -{ - @Inject - private OverlayManager overlayManager; - - @Inject - private RunepouchOverlay overlay; - - @Inject - private RunepouchConfig config; - - @Getter(AccessLevel.PACKAGE) - private Color fontColor; - @Getter(AccessLevel.PACKAGE) - private boolean showIcons; - @Getter(AccessLevel.PACKAGE) - private RunePouchOverlayMode runePouchOverlayMode; - - @Provides - RunepouchConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(RunepouchConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - } - - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("runepouch")) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.fontColor = config.fontColor(); - this.showIcons = config.showIcons(); - this.runePouchOverlayMode = config.runePouchOverlayMode(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/Runes.java b/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/Runes.java deleted file mode 100644 index d67517663e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/Runes.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2017, Tyler - * 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.runepouch; - -import com.google.common.collect.ImmutableMap; -import java.awt.image.BufferedImage; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import static net.runelite.api.ItemID.*; - -public enum Runes -{ - AIR(1, AIR_RUNE), - WATER(2, WATER_RUNE), - EARTH(3, EARTH_RUNE), - FIRE(4, FIRE_RUNE), - MIND(5, MIND_RUNE), - CHAOS(6, CHAOS_RUNE), - DEATH(7, DEATH_RUNE), - BLOOD(8, BLOOD_RUNE), - COSMIC(9, COSMIC_RUNE), - NATURE(10, NATURE_RUNE), - LAW(11, LAW_RUNE), - BODY(12, BODY_RUNE), - SOUL(13, SOUL_RUNE), - ASTRAL(14, ASTRAL_RUNE), - MIST(15, MIST_RUNE), - MUD(16, MUD_RUNE), - DUST(17, DUST_RUNE), - LAVA(18, LAVA_RUNE), - STEAM(19, STEAM_RUNE), - SMOKE(20, SMOKE_RUNE), - WRATH(21, WRATH_RUNE); - - @Getter(AccessLevel.PACKAGE) - private final int id; - @Getter(AccessLevel.PUBLIC) - private final int itemId; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private BufferedImage image; - - private static final Map runes; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - for (Runes rune : values()) - { - builder.put(rune.getId(), rune); - } - runes = builder.build(); - } - - Runes(final int id, final int itemId) - { - this.id = id; - this.itemId = itemId; - } - - public static Runes getRune(int varbit) - { - return runes.get(varbit); - } - - public String getName() - { - String name = this.name(); - name = name.substring(0, 1) + name.substring(1).toLowerCase(); - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/config/RunePouchOverlayMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/config/RunePouchOverlayMode.java deleted file mode 100644 index 70d2564f26..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/config/RunePouchOverlayMode.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2018, Lars - * 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.runepouch.config; - -public enum RunePouchOverlayMode -{ - INVENTORY, - MOUSE_HOVER, - BOTH -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarker.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarker.java deleted file mode 100644 index aa164d780c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarker.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel, - * Copyright (c) 2018, 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.screenmarkers; - -import java.awt.Color; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class ScreenMarker -{ - private long id; - private String name; - private int borderThickness; - private Color color; - private Color fill; - private boolean visible; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerCreationOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerCreationOverlay.java deleted file mode 100644 index 4bb242a575..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerCreationOverlay.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel, - * 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.screenmarkers; - -import java.awt.BasicStroke; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Stroke; -import javax.inject.Inject; -import javax.inject.Singleton; -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; - -@Singleton -public class ScreenMarkerCreationOverlay extends Overlay -{ - private final ScreenMarkerPlugin plugin; - - @Inject - private ScreenMarkerCreationOverlay(final ScreenMarkerPlugin plugin) - { - this.plugin = plugin; - setPosition(OverlayPosition.DETACHED); - setLayer(OverlayLayer.ALWAYS_ON_TOP); - setPriority(OverlayPriority.HIGH); - } - - @Override - public Dimension render(Graphics2D graphics) - { - ScreenMarker marker = plugin.getCurrentMarker(); - - if (marker == null) - { - return null; - } - - int thickness = marker.getBorderThickness(); - int offset = thickness / 2; - int width = getBounds().width - thickness; - int height = getBounds().height - thickness; - - graphics.setStroke(createStripedStroke(thickness)); - graphics.setColor(marker.getColor()); - graphics.drawRect(offset, offset, width, height); - - return getBounds().getSize(); - } - - private Stroke createStripedStroke(int thickness) - { - return new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[]{9}, 0); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerMouseListener.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerMouseListener.java deleted file mode 100644 index 3bb1d8e28e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerMouseListener.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel, - * 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.screenmarkers; - -import java.awt.event.MouseEvent; -import javax.inject.Singleton; -import javax.swing.SwingUtilities; -import net.runelite.client.input.MouseAdapter; - -@Singleton -class ScreenMarkerMouseListener extends MouseAdapter -{ - private final ScreenMarkerPlugin plugin; - - ScreenMarkerMouseListener(final ScreenMarkerPlugin plugin) - { - this.plugin = plugin; - } - - @Override - public MouseEvent mouseClicked(MouseEvent event) - { - if (SwingUtilities.isMiddleMouseButton(event)) - { - return event; - } - - event.consume(); - return event; - } - - @Override - public MouseEvent mousePressed(MouseEvent event) - { - if (SwingUtilities.isMiddleMouseButton(event)) - { - return event; - } - - if (SwingUtilities.isLeftMouseButton(event)) - { - plugin.startCreation(event.getPoint()); - } - else if (plugin.isCreatingScreenMarker()) - { - plugin.finishCreation(true); - } - - event.consume(); - return event; - } - - @Override - public MouseEvent mouseReleased(MouseEvent event) - { - if (SwingUtilities.isMiddleMouseButton(event)) - { - return event; - } - - if (SwingUtilities.isLeftMouseButton(event) && plugin.isCreatingScreenMarker()) - { - /* Set the creation panel as "ready" (because the marker area as been drawn) */ - plugin.completeSelection(); - } - - event.consume(); - return event; - } - - @Override - public MouseEvent mouseDragged(MouseEvent event) - { - if (!plugin.isCreatingScreenMarker()) - { - return event; - } - - if (SwingUtilities.isLeftMouseButton(event)) - { - plugin.resizeMarker(event.getPoint()); - } - - return event; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerOverlay.java deleted file mode 100644 index 408ded39f3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerOverlay.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel, - * Copyright (c) 2018, 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.screenmarkers; - -import java.awt.BasicStroke; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -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; - -@Singleton -public class ScreenMarkerOverlay extends Overlay -{ - @Getter(AccessLevel.PUBLIC) - private final ScreenMarker marker; - private final ScreenMarkerRenderable screenMarkerRenderable; - - ScreenMarkerOverlay(final ScreenMarker marker) - { - this.marker = marker; - this.screenMarkerRenderable = new ScreenMarkerRenderable(); - setPosition(OverlayPosition.DETACHED); - setLayer(OverlayLayer.ALWAYS_ON_TOP); - setPriority(OverlayPriority.HIGH); - } - - @Override - public String getName() - { - return "marker" + marker.getId(); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!marker.isVisible()) - { - return null; - } - - Dimension preferredSize = getPreferredSize(); - if (preferredSize == null) - { - // overlay has no preferred size in the renderer configuration! - return null; - } - - screenMarkerRenderable.setBorderThickness(marker.getBorderThickness()); - screenMarkerRenderable.setColor(marker.getColor()); - screenMarkerRenderable.setFill(marker.getFill()); - screenMarkerRenderable.setStroke(new BasicStroke(marker.getBorderThickness())); - screenMarkerRenderable.setPreferredSize(preferredSize); - return screenMarkerRenderable.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerPlugin.java deleted file mode 100644 index 3e50540ee2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerPlugin.java +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel, - * Copyright (c) 2018, Adam - * Copyright (c) 2018, Psikoi - * 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.screenmarkers; - -import com.google.common.base.Strings; -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; -import java.awt.Dimension; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.image.BufferedImage; -import java.time.Instant; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.input.MouseManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.screenmarkers.ui.ScreenMarkerPluginPanel; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.ui.components.colorpicker.ColorPickerManager; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.util.ImageUtil; - -@PluginDescriptor( - name = "Screen Markers", - description = "Enable drawing of screen markers on top of the client", - tags = {"boxes", "overlay", "panel"}, - type = PluginType.UTILITY -) -@Singleton -public class ScreenMarkerPlugin extends Plugin -{ - private static final String PLUGIN_NAME = "Screen Markers"; - private static final String CONFIG_GROUP = "screenmarkers"; - private static final String CONFIG_KEY = "markers"; - private static final String ICON_FILE = "panel_icon.png"; - private static final String DEFAULT_MARKER_NAME = "Marker"; - private static final Dimension DEFAULT_SIZE = new Dimension(2, 2); - - @Getter(AccessLevel.PUBLIC) - private final List screenMarkers = new ArrayList<>(); - - @Inject - private ConfigManager configManager; - - @Inject - private MouseManager mouseManager; - - @Inject - private ClientToolbar clientToolbar; - - @Inject - private OverlayManager overlayManager; - - @Inject - private ScreenMarkerCreationOverlay overlay; - - @Getter(AccessLevel.PUBLIC) - @Inject - private ColorPickerManager colorPickerManager; - - private ScreenMarkerMouseListener mouseListener; - private ScreenMarkerPluginPanel pluginPanel; - private NavigationButton navigationButton; - - @Getter(AccessLevel.PACKAGE) - private ScreenMarker currentMarker; - - @Getter(AccessLevel.PACKAGE) - private boolean creatingScreenMarker = false; - private Point startLocation = null; - - @Override - protected void startUp() - { - overlayManager.add(overlay); - loadConfig(configManager.getConfiguration(CONFIG_GROUP, CONFIG_KEY)).forEach(screenMarkers::add); - screenMarkers.forEach(overlayManager::add); - - pluginPanel = new ScreenMarkerPluginPanel(this); - pluginPanel.rebuild(); - - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), ICON_FILE); - - navigationButton = NavigationButton.builder() - .tooltip(PLUGIN_NAME) - .icon(icon) - .priority(5) - .panel(pluginPanel) - .build(); - - clientToolbar.addNavigation(navigationButton); - - mouseListener = new ScreenMarkerMouseListener(this); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - overlayManager.removeIf(ScreenMarkerOverlay.class::isInstance); - screenMarkers.clear(); - clientToolbar.removeNavigation(navigationButton); - setMouseListenerEnabled(false); - creatingScreenMarker = false; - - pluginPanel = null; - currentMarker = null; - mouseListener = null; - navigationButton = null; - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (screenMarkers.isEmpty() && event.getGroup().equals(CONFIG_GROUP) && event.getKey().equals(CONFIG_KEY)) - { - loadConfig(event.getNewValue()).forEach(screenMarkers::add); - overlayManager.removeIf(ScreenMarkerOverlay.class::isInstance); - screenMarkers.forEach(overlayManager::add); - } - } - - public void setMouseListenerEnabled(boolean enabled) - { - if (enabled) - { - mouseManager.registerMouseListener(mouseListener); - } - else - { - mouseManager.unregisterMouseListener(mouseListener); - } - } - - void startCreation(Point location) - { - currentMarker = new ScreenMarker( - Instant.now().toEpochMilli(), - DEFAULT_MARKER_NAME + " " + (screenMarkers.size() + 1), - pluginPanel.getSelectedBorderThickness(), - pluginPanel.getSelectedColor(), - pluginPanel.getSelectedFillColor(), - true - ); - - // Set overlay creator bounds to current position and default size - startLocation = location; - overlay.setPreferredLocation(location); - overlay.setPreferredSize(DEFAULT_SIZE); - creatingScreenMarker = true; - } - - public void finishCreation(boolean aborted) - { - if (!aborted && currentMarker != null) - { - final ScreenMarkerOverlay screenMarkerOverlay = new ScreenMarkerOverlay(currentMarker); - screenMarkerOverlay.setPreferredLocation(overlay.getBounds().getLocation()); - screenMarkerOverlay.setPreferredSize(overlay.getBounds().getSize()); - - screenMarkers.add(screenMarkerOverlay); - overlayManager.saveOverlay(screenMarkerOverlay); - overlayManager.add(screenMarkerOverlay); - pluginPanel.rebuild(); - updateConfig(); - } - - creatingScreenMarker = false; - startLocation = null; - currentMarker = null; - setMouseListenerEnabled(false); - - pluginPanel.setCreation(false); - } - - /* The marker area has been drawn, inform the user and unlock the confirm button */ - void completeSelection() - { - pluginPanel.getCreationPanel().unlockConfirm(); - } - - public void deleteMarker(final ScreenMarkerOverlay marker) - { - screenMarkers.remove(marker); - overlayManager.remove(marker); - overlayManager.resetOverlay(marker); - pluginPanel.rebuild(); - updateConfig(); - } - - void resizeMarker(Point point) - { - Rectangle bounds = new Rectangle(startLocation); - bounds.add(point); - overlay.setPreferredLocation(bounds.getLocation()); - overlay.setPreferredSize(bounds.getSize()); - } - - public void updateConfig() - { - if (screenMarkers.isEmpty()) - { - configManager.unsetConfiguration(CONFIG_GROUP, CONFIG_KEY); - return; - } - - final Gson gson = new Gson(); - final String json = gson - .toJson(screenMarkers.stream().map(ScreenMarkerOverlay::getMarker).collect(Collectors.toList())); - configManager.setConfiguration(CONFIG_GROUP, CONFIG_KEY, json); - } - - private Stream loadConfig(String json) - { - if (Strings.isNullOrEmpty(json)) - { - return Stream.empty(); - } - - final Gson gson = new Gson(); - final List screenMarkerData = gson.fromJson(json, new TypeToken>() - { - }.getType()); - - return screenMarkerData.stream().map(ScreenMarkerOverlay::new); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerRenderable.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerRenderable.java deleted file mode 100644 index af91bb7590..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ScreenMarkerRenderable.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel, - * 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.screenmarkers; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.Stroke; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.client.ui.overlay.components.LayoutableRenderableEntity; - -public class ScreenMarkerRenderable implements LayoutableRenderableEntity -{ - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PUBLIC) - private Point preferredLocation; - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PUBLIC) - private Dimension preferredSize; - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private int borderThickness; - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private Color color; - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private Color fill; - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private Stroke stroke; - - @Getter(AccessLevel.PUBLIC) - private final Rectangle bounds = new Rectangle(); - - @Override - public Dimension render(Graphics2D graphics) - { - int thickness = borderThickness; - int width = preferredSize.width; - int height = preferredSize.height; - - //draw the fill - graphics.setColor(fill); - graphics.fillRect(thickness, thickness, width - thickness * 2, height - thickness * 2); - - //because the stroke is centered on the rectangle we draw, we need to translate where we draw the rectangle - //this is to ensure that the rectangle we draw is our preferred size - int offset = thickness / 2; - graphics.setColor(color); - graphics.setStroke(stroke); - graphics.drawRect(offset, offset, width - thickness, height - thickness); - bounds.setSize(preferredSize); - return preferredSize; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerCreationPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerCreationPanel.java deleted file mode 100644 index d3c61ff5a8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerCreationPanel.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2018, Psikoi - * 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.screenmarkers.ui; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.GridLayout; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; -import javax.inject.Singleton; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; -import net.runelite.client.plugins.screenmarkers.ScreenMarkerPlugin; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.components.shadowlabel.JShadowedLabel; -import net.runelite.client.util.ImageUtil; - -@Singleton -public class ScreenMarkerCreationPanel extends JPanel -{ - private static final ImageIcon CONFIRM_ICON; - private static final ImageIcon CONFIRM_HOVER_ICON; - private static final ImageIcon CONFIRM_LOCKED_ICON; - private static final ImageIcon CANCEL_ICON; - private static final ImageIcon CANCEL_HOVER_ICON; - - private final JShadowedLabel instructionsLabel = new JShadowedLabel(); - private final JLabel confirmLabel = new JLabel(); - private boolean lockedConfirm = true; - - static - { - CONFIRM_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "confirm_icon.png")); - CANCEL_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "cancel_icon.png")); - - final BufferedImage confirmIcon = ImageUtil.bufferedImageFromImage(CONFIRM_ICON.getImage()); - CONFIRM_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(confirmIcon, 0.54f)); - CONFIRM_LOCKED_ICON = new ImageIcon(ImageUtil.grayscaleImage(confirmIcon)); - CANCEL_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(ImageUtil.bufferedImageFromImage(CANCEL_ICON.getImage()), 0.6f)); - } - - ScreenMarkerCreationPanel(final ScreenMarkerPlugin plugin) - { - setBackground(ColorScheme.DARKER_GRAY_COLOR); - setBorder(new EmptyBorder(8, 8, 8, 8)); - setLayout(new BorderLayout()); - - instructionsLabel.setFont(FontManager.getRunescapeSmallFont()); - instructionsLabel.setForeground(Color.WHITE); - - JPanel actionsContainer = new JPanel(new GridLayout(1, 2, 8, 0)); - actionsContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - confirmLabel.setIcon(CONFIRM_LOCKED_ICON); - confirmLabel.setToolTipText("Confirm and save"); - confirmLabel.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - /* If the confirm button is not locked */ - if (!lockedConfirm) - { - plugin.finishCreation(false); - } - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - confirmLabel.setIcon(lockedConfirm ? CONFIRM_LOCKED_ICON : CONFIRM_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - confirmLabel.setIcon(lockedConfirm ? CONFIRM_LOCKED_ICON : CONFIRM_ICON); - } - }); - - JLabel cancelLabel = new JLabel(CANCEL_ICON); - cancelLabel.setToolTipText("Cancel"); - cancelLabel.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - plugin.finishCreation(true); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - cancelLabel.setIcon(CANCEL_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - cancelLabel.setIcon(CANCEL_ICON); - } - }); - - actionsContainer.add(confirmLabel); - actionsContainer.add(cancelLabel); - - add(instructionsLabel, BorderLayout.CENTER); - add(actionsContainer, BorderLayout.EAST); - } - - /* Unlocks the confirm button */ - public void unlockConfirm() - { - this.confirmLabel.setIcon(CONFIRM_ICON); - this.lockedConfirm = false; - instructionsLabel.setText("Confirm or cancel to finish."); - } - - /* Locks the confirm button */ - public void lockConfirm() - { - this.confirmLabel.setIcon(CONFIRM_LOCKED_ICON); - this.lockedConfirm = true; - instructionsLabel.setText("Drag in-game to draw"); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerPanel.java deleted file mode 100644 index 8c9fee3cde..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerPanel.java +++ /dev/null @@ -1,523 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel, - * Copyright (c) 2018, Psikoi - * 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.screenmarkers.ui; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; -import javax.inject.Singleton; -import javax.swing.BorderFactory; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JSpinner; -import javax.swing.SpinnerModel; -import javax.swing.SpinnerNumberModel; -import javax.swing.SwingUtilities; -import javax.swing.border.Border; -import javax.swing.border.CompoundBorder; -import javax.swing.border.EmptyBorder; -import javax.swing.border.MatteBorder; -import net.runelite.client.plugins.screenmarkers.ScreenMarkerOverlay; -import net.runelite.client.plugins.screenmarkers.ScreenMarkerPlugin; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.components.FlatTextField; -import net.runelite.client.ui.components.colorpicker.RuneliteColorPicker; -import net.runelite.client.util.ImageUtil; - -@Singleton -class ScreenMarkerPanel extends JPanel -{ - private static final int DEFAULT_FILL_OPACITY = 75; - - private static final Border NAME_BOTTOM_BORDER = new CompoundBorder( - BorderFactory.createMatteBorder(0, 0, 1, 0, ColorScheme.DARK_GRAY_COLOR), - BorderFactory.createLineBorder(ColorScheme.DARKER_GRAY_COLOR)); - - private static final ImageIcon BORDER_COLOR_ICON; - private static final ImageIcon BORDER_COLOR_HOVER_ICON; - private static final ImageIcon NO_BORDER_COLOR_ICON; - private static final ImageIcon NO_BORDER_COLOR_HOVER_ICON; - - private static final ImageIcon FILL_COLOR_ICON; - private static final ImageIcon FILL_COLOR_HOVER_ICON; - private static final ImageIcon NO_FILL_COLOR_ICON; - private static final ImageIcon NO_FILL_COLOR_HOVER_ICON; - - private static final ImageIcon FULL_OPACITY_ICON; - private static final ImageIcon FULL_OPACITY_HOVER_ICON; - private static final ImageIcon NO_OPACITY_ICON; - private static final ImageIcon NO_OPACITY_HOVER_ICON; - - private static final ImageIcon VISIBLE_ICON; - private static final ImageIcon VISIBLE_HOVER_ICON; - private static final ImageIcon INVISIBLE_ICON; - private static final ImageIcon INVISIBLE_HOVER_ICON; - - private static final ImageIcon DELETE_ICON; - private static final ImageIcon DELETE_HOVER_ICON; - - private final ScreenMarkerPlugin plugin; - private final ScreenMarkerOverlay marker; - - private final JLabel borderColorIndicator = new JLabel(); - private final JLabel fillColorIndicator = new JLabel(); - private final JLabel opacityIndicator = new JLabel(); - private final JLabel visibilityLabel = new JLabel(); - private final JLabel deleteLabel = new JLabel(); - - private final FlatTextField nameInput = new FlatTextField(); - private final JLabel save = new JLabel("Save"); - private final JLabel cancel = new JLabel("Cancel"); - private final JLabel rename = new JLabel("Rename"); - - private final SpinnerModel spinnerModel = new SpinnerNumberModel(5, 0, Integer.MAX_VALUE, 1); - private final JSpinner thicknessSpinner = new JSpinner(spinnerModel); - - private boolean visible; - - static - { - final BufferedImage borderImg = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "border_color_icon.png"); - final BufferedImage borderImgHover = ImageUtil.luminanceOffset(borderImg, -150); - BORDER_COLOR_ICON = new ImageIcon(borderImg); - BORDER_COLOR_HOVER_ICON = new ImageIcon(borderImgHover); - - NO_BORDER_COLOR_ICON = new ImageIcon(borderImgHover); - NO_BORDER_COLOR_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(borderImgHover, -100)); - - final BufferedImage fillImg = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "fill_color_icon.png"); - final BufferedImage fillImgHover = ImageUtil.luminanceOffset(fillImg, -150); - FILL_COLOR_ICON = new ImageIcon(fillImg); - FILL_COLOR_HOVER_ICON = new ImageIcon(fillImgHover); - - NO_FILL_COLOR_ICON = new ImageIcon(fillImgHover); - NO_FILL_COLOR_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(fillImgHover, -100)); - - final BufferedImage opacityImg = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "opacity_icon.png"); - final BufferedImage opacityImgHover = ImageUtil.luminanceOffset(opacityImg, -150); - FULL_OPACITY_ICON = new ImageIcon(opacityImg); - FULL_OPACITY_HOVER_ICON = new ImageIcon(opacityImgHover); - - NO_OPACITY_ICON = new ImageIcon(opacityImgHover); - NO_OPACITY_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(opacityImgHover, -100)); - - final BufferedImage visibleImg = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "visible_icon.png"); - VISIBLE_ICON = new ImageIcon(visibleImg); - VISIBLE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(visibleImg, -100)); - - final BufferedImage invisibleImg = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "invisible_icon.png"); - INVISIBLE_ICON = new ImageIcon(invisibleImg); - INVISIBLE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(invisibleImg, -100)); - - final BufferedImage deleteImg = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "delete_icon.png"); - DELETE_ICON = new ImageIcon(deleteImg); - DELETE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(deleteImg, -100)); - } - - ScreenMarkerPanel(final ScreenMarkerPlugin plugin, final ScreenMarkerOverlay marker) - { - this.plugin = plugin; - this.marker = marker; - this.visible = marker.getMarker().isVisible(); - - setLayout(new BorderLayout()); - setBackground(ColorScheme.DARKER_GRAY_COLOR); - - JPanel nameWrapper = new JPanel(new BorderLayout()); - nameWrapper.setBackground(ColorScheme.DARKER_GRAY_COLOR); - nameWrapper.setBorder(NAME_BOTTOM_BORDER); - - JPanel nameActions = new JPanel(new BorderLayout(3, 0)); - nameActions.setBorder(new EmptyBorder(0, 0, 0, 8)); - nameActions.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - save.setVisible(false); - save.setFont(FontManager.getRunescapeSmallFont()); - save.setForeground(ColorScheme.PROGRESS_COMPLETE_COLOR); - save.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - marker.getMarker().setName(nameInput.getText()); - plugin.updateConfig(); - - nameInput.setEditable(false); - updateNameActions(false); - requestFocusInWindow(); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - save.setForeground(ColorScheme.PROGRESS_COMPLETE_COLOR.darker()); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - save.setForeground(ColorScheme.PROGRESS_COMPLETE_COLOR); - } - }); - - cancel.setVisible(false); - cancel.setFont(FontManager.getRunescapeSmallFont()); - cancel.setForeground(ColorScheme.PROGRESS_ERROR_COLOR); - cancel.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - nameInput.setEditable(false); - nameInput.setText(marker.getMarker().getName()); - updateNameActions(false); - requestFocusInWindow(); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - cancel.setForeground(ColorScheme.PROGRESS_ERROR_COLOR.darker()); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - cancel.setForeground(ColorScheme.PROGRESS_ERROR_COLOR); - } - }); - - rename.setFont(FontManager.getRunescapeSmallFont()); - rename.setForeground(ColorScheme.LIGHT_GRAY_COLOR.darker()); - rename.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - nameInput.setEditable(true); - updateNameActions(true); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - rename.setForeground(ColorScheme.LIGHT_GRAY_COLOR.darker().darker()); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - rename.setForeground(ColorScheme.LIGHT_GRAY_COLOR.darker()); - } - }); - - nameActions.add(save, BorderLayout.EAST); - nameActions.add(cancel, BorderLayout.WEST); - nameActions.add(rename, BorderLayout.CENTER); - - nameInput.setText(marker.getMarker().getName()); - nameInput.setBorder(null); - nameInput.setEditable(false); - nameInput.setBackground(ColorScheme.DARKER_GRAY_COLOR); - nameInput.setPreferredSize(new Dimension(0, 24)); - nameInput.getTextField().setForeground(Color.WHITE); - nameInput.getTextField().setBorder(new EmptyBorder(0, 8, 0, 0)); - - nameWrapper.add(nameInput, BorderLayout.CENTER); - nameWrapper.add(nameActions, BorderLayout.EAST); - - JPanel bottomContainer = new JPanel(new BorderLayout()); - bottomContainer.setBorder(new EmptyBorder(8, 0, 8, 0)); - bottomContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - JPanel leftActions = new JPanel(new FlowLayout(FlowLayout.LEFT, 8, 0)); - leftActions.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - borderColorIndicator.setToolTipText("Edit border color"); - borderColorIndicator.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - openBorderColorPicker(); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - borderColorIndicator.setIcon(marker.getMarker().getBorderThickness() == 0 ? NO_BORDER_COLOR_HOVER_ICON : BORDER_COLOR_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - borderColorIndicator.setIcon(marker.getMarker().getBorderThickness() == 0 ? NO_BORDER_COLOR_ICON : BORDER_COLOR_ICON); - } - }); - - fillColorIndicator.setToolTipText("Edit fill color"); - fillColorIndicator.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - openFillColorPicker(); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - fillColorIndicator.setIcon(marker.getMarker().getFill().getAlpha() == 0 ? NO_FILL_COLOR_HOVER_ICON : FILL_COLOR_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - fillColorIndicator.setIcon(marker.getMarker().getFill().getAlpha() == 0 ? NO_FILL_COLOR_ICON : FILL_COLOR_ICON); - } - }); - - thicknessSpinner.setValue(marker.getMarker().getBorderThickness()); - thicknessSpinner.setPreferredSize(new Dimension(50, 20)); - thicknessSpinner.addChangeListener(ce -> updateThickness(true)); - - opacityIndicator.setToolTipText("Toggle background transparency"); - opacityIndicator.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - final Color fill = marker.getMarker().getFill(); - - if (fill.getAlpha() == 0) - { - marker.getMarker().setFill(new Color(fill.getRed(), fill.getGreen(), fill.getBlue(), DEFAULT_FILL_OPACITY)); - } - else - { - marker.getMarker().setFill(new Color(fill.getRed(), fill.getGreen(), fill.getBlue(), 0)); - } - - updateFill(); - plugin.updateConfig(); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - opacityIndicator.setIcon(marker.getMarker().getFill().getAlpha() == 0 ? NO_OPACITY_HOVER_ICON : FULL_OPACITY_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - opacityIndicator.setIcon(marker.getMarker().getFill().getAlpha() == 0 ? NO_OPACITY_ICON : FULL_OPACITY_ICON); - } - }); - - leftActions.add(borderColorIndicator); - leftActions.add(fillColorIndicator); - leftActions.add(opacityIndicator); - leftActions.add(thicknessSpinner); - - JPanel rightActions = new JPanel(new FlowLayout(FlowLayout.RIGHT, 8, 0)); - rightActions.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - visibilityLabel.setToolTipText(visible ? "Hide screen marker" : "Show screen marker"); - visibilityLabel.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - visible = !visible; - marker.getMarker().setVisible(visible); - plugin.updateConfig(); - updateVisibility(); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - visibilityLabel.setIcon(visible ? VISIBLE_HOVER_ICON : INVISIBLE_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - updateVisibility(); - } - }); - - deleteLabel.setIcon(DELETE_ICON); - deleteLabel.setToolTipText("Delete screen marker"); - deleteLabel.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - int confirm = JOptionPane.showConfirmDialog(ScreenMarkerPanel.this, - "Are you sure you want to permanently delete this screen marker?", - "Warning", JOptionPane.OK_CANCEL_OPTION); - - if (confirm == 0) - { - plugin.deleteMarker(marker); - } - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - deleteLabel.setIcon(DELETE_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - deleteLabel.setIcon(DELETE_ICON); - } - }); - - rightActions.add(visibilityLabel); - rightActions.add(deleteLabel); - - bottomContainer.add(leftActions, BorderLayout.WEST); - bottomContainer.add(rightActions, BorderLayout.EAST); - - add(nameWrapper, BorderLayout.NORTH); - add(bottomContainer, BorderLayout.CENTER); - - updateVisibility(); - updateFill(); - updateBorder(); - updateBorder(); - - } - - private void updateNameActions(boolean saveAndCancel) - { - save.setVisible(saveAndCancel); - cancel.setVisible(saveAndCancel); - rename.setVisible(!saveAndCancel); - - if (saveAndCancel) - { - nameInput.getTextField().requestFocusInWindow(); - nameInput.getTextField().selectAll(); - } - } - - /* Updates the thickness without saving on config */ - private void updateThickness(boolean save) - { - marker.getMarker().setBorderThickness((Integer) thicknessSpinner.getValue()); - updateBorder(); - if (save) - { - plugin.updateConfig(); - } - } - - private void updateVisibility() - { - visibilityLabel.setIcon(visible ? VISIBLE_ICON : INVISIBLE_ICON); - } - - private void updateFill() - { - final boolean isFullyTransparent = marker.getMarker().getFill().getAlpha() == 0; - - if (isFullyTransparent) - { - fillColorIndicator.setBorder(null); - } - else - { - Color color = marker.getMarker().getFill(); - Color fullColor = new Color(color.getRed(), color.getGreen(), color.getBlue()); - fillColorIndicator.setBorder(new MatteBorder(0, 0, 3, 0, fullColor)); - } - - fillColorIndicator.setIcon(isFullyTransparent ? NO_FILL_COLOR_ICON : FILL_COLOR_ICON); - opacityIndicator.setIcon(isFullyTransparent ? NO_OPACITY_ICON : FULL_OPACITY_ICON); - } - - private void updateBorder() - { - if (marker.getMarker().getBorderThickness() == 0) - { - borderColorIndicator.setBorder(null); - } - else - { - Color color = marker.getMarker().getColor(); - borderColorIndicator.setBorder(new MatteBorder(0, 0, 3, 0, color)); - } - - borderColorIndicator.setIcon(marker.getMarker().getBorderThickness() == 0 ? NO_BORDER_COLOR_ICON : BORDER_COLOR_ICON); - } - - private void openFillColorPicker() - { - RuneliteColorPicker colorPicker = plugin.getColorPickerManager().create( - SwingUtilities.windowForComponent(this), - marker.getMarker().getFill(), - marker.getMarker().getName() + " Fill", - false); - colorPicker.setLocation(getLocationOnScreen()); - colorPicker.setOnColorChange(c -> - { - marker.getMarker().setFill(c); - updateFill(); - }); - colorPicker.setOnClose(c -> plugin.updateConfig()); - colorPicker.setVisible(true); - } - - private void openBorderColorPicker() - { - RuneliteColorPicker colorPicker = plugin.getColorPickerManager().create( - SwingUtilities.windowForComponent(this), - marker.getMarker().getColor(), - marker.getMarker().getName() + " Border", - false); - colorPicker.setLocation(getLocationOnScreen()); - colorPicker.setOnColorChange(c -> - { - marker.getMarker().setColor(c); - updateBorder(); - }); - colorPicker.setOnClose(c -> plugin.updateConfig()); - colorPicker.setVisible(true); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerPluginPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerPluginPanel.java deleted file mode 100644 index ab73c4de4e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenmarkers/ui/ScreenMarkerPluginPanel.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright (c) 2018, Kamiel, - * Copyright (c) 2018, Psikoi - * 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.screenmarkers.ui; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; -import javax.swing.Box; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.plugins.screenmarkers.ScreenMarkerOverlay; -import net.runelite.client.plugins.screenmarkers.ScreenMarkerPlugin; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.ui.components.PluginErrorPanel; -import net.runelite.client.util.ImageUtil; - -public class ScreenMarkerPluginPanel extends PluginPanel -{ - private static final ImageIcon ADD_ICON; - private static final ImageIcon ADD_HOVER_ICON; - - private static final Color DEFAULT_BORDER_COLOR = Color.GREEN; - private static final Color DEFAULT_FILL_COLOR = new Color(0, 255, 0, 0); - - private static final int DEFAULT_BORDER_THICKNESS = 3; - - private final JLabel addMarker = new JLabel(ADD_ICON); - private final JLabel title = new JLabel(); - private final PluginErrorPanel noMarkersPanel = new PluginErrorPanel(); - private final JPanel markerView = new JPanel(new GridBagLayout()); - - private final ScreenMarkerPlugin plugin; - - @Getter(AccessLevel.PUBLIC) - private Color selectedColor = DEFAULT_BORDER_COLOR; - - @Getter(AccessLevel.PUBLIC) - private Color selectedFillColor = DEFAULT_FILL_COLOR; - - @Getter(AccessLevel.PUBLIC) - private int selectedBorderThickness = DEFAULT_BORDER_THICKNESS; - - @Getter(AccessLevel.PUBLIC) - private ScreenMarkerCreationPanel creationPanel; - - static - { - final BufferedImage addIcon = ImageUtil.getResourceStreamFromClass(ScreenMarkerPlugin.class, "add_icon.png"); - ADD_ICON = new ImageIcon(addIcon); - ADD_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(addIcon, 0.53f)); - } - - public ScreenMarkerPluginPanel(ScreenMarkerPlugin screenMarkerPlugin) - { - this.plugin = screenMarkerPlugin; - - setLayout(new BorderLayout()); - setBorder(new EmptyBorder(10, 10, 10, 10)); - - JPanel northPanel = new JPanel(new BorderLayout()); - northPanel.setBorder(new EmptyBorder(1, 0, 10, 0)); - - title.setText("Screen Markers"); - title.setForeground(Color.WHITE); - - northPanel.add(title, BorderLayout.WEST); - northPanel.add(addMarker, BorderLayout.EAST); - - JPanel centerPanel = new JPanel(new BorderLayout()); - centerPanel.setBackground(ColorScheme.DARK_GRAY_COLOR); - - markerView.setBackground(ColorScheme.DARK_GRAY_COLOR); - - GridBagConstraints constraints = new GridBagConstraints(); - constraints.fill = GridBagConstraints.HORIZONTAL; - constraints.weightx = 1; - constraints.gridx = 0; - constraints.gridy = 0; - - noMarkersPanel.setContent("Screen Markers", "Highlight a region on your screen."); - noMarkersPanel.setVisible(false); - - markerView.add(noMarkersPanel, constraints); - constraints.gridy++; - - creationPanel = new ScreenMarkerCreationPanel(plugin); - creationPanel.setVisible(false); - - markerView.add(creationPanel, constraints); - constraints.gridy++; - - addMarker.setToolTipText("Add new screen marker"); - addMarker.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - setCreation(true); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - addMarker.setIcon(ADD_HOVER_ICON); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - addMarker.setIcon(ADD_ICON); - } - }); - - centerPanel.add(markerView, BorderLayout.CENTER); - - add(northPanel, BorderLayout.NORTH); - add(centerPanel, BorderLayout.CENTER); - } - - public void rebuild() - { - GridBagConstraints constraints = new GridBagConstraints(); - constraints.fill = GridBagConstraints.HORIZONTAL; - constraints.weightx = 1; - constraints.gridx = 0; - constraints.gridy = 0; - - markerView.removeAll(); - - for (final ScreenMarkerOverlay marker : plugin.getScreenMarkers()) - { - markerView.add(new ScreenMarkerPanel(plugin, marker), constraints); - constraints.gridy++; - - markerView.add(Box.createRigidArea(new Dimension(0, 10)), constraints); - constraints.gridy++; - } - - boolean empty = constraints.gridy == 0; - noMarkersPanel.setVisible(empty); - title.setVisible(!empty); - - markerView.add(noMarkersPanel, constraints); - constraints.gridy++; - - markerView.add(creationPanel, constraints); - constraints.gridy++; - - repaint(); - revalidate(); - } - - /* Enables/Disables new marker creation mode */ - public void setCreation(boolean on) - { - if (on) - { - noMarkersPanel.setVisible(false); - title.setVisible(true); - } - else - { - boolean empty = plugin.getScreenMarkers().isEmpty(); - noMarkersPanel.setVisible(empty); - title.setVisible(!empty); - } - - creationPanel.setVisible(on); - addMarker.setVisible(!on); - - if (on) - { - creationPanel.lockConfirm(); - plugin.setMouseListenerEnabled(true); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotConfig.java deleted file mode 100644 index 1f03b2aa81..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotConfig.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.screenshot; - -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("screenshot") -public interface ScreenshotConfig extends Config -{ - @ConfigItem( - keyName = "includeFrame", - name = "Include Client Frame", - description = "Configures whether or not the client frame is included in screenshots", - position = 0 - ) - default boolean includeFrame() - { - return true; - } - - @ConfigItem( - keyName = "displayDate", - name = "Display Date", - description = "Configures whether or not the report button shows the date the screenshot was taken", - position = 1 - ) - default boolean displayDate() - { - return true; - } - - @ConfigItem( - keyName = "notifyWhenTaken", - name = "Notify When Taken", - description = "Configures whether or not you are notified when a screenshot has been taken", - position = 2 - ) - default boolean notifyWhenTaken() - { - return true; - } - - @ConfigItem( - keyName = "rewards", - name = "Screenshot Rewards", - description = "Configures whether screenshots are taken of clues, barrows, and quest completion", - position = 3 - ) - default boolean screenshotRewards() - { - return true; - } - - @ConfigItem( - keyName = "levels", - name = "Screenshot Levels", - description = "Configures whether screenshots are taken of level ups", - position = 4 - ) - default boolean screenshotLevels() - { - return true; - } - - @ConfigItem( - keyName = "kingdom", - name = "Screenshot Kingdom Reward", - description = "Configures whether screenshots are taken of Kingdom Reward", - position = 5 - ) - default boolean screenshotKingdom() - { - return true; - } - - @ConfigItem( - keyName = "pets", - name = "Screenshot Pet", - description = "Configures whether screenshots are taken of receiving pets", - position = 6 - ) - default boolean screenshotPet() - { - return true; - } - - @ConfigItem( - keyName = "uploadScreenshot", - name = "Upload", - description = "Configures whether or not screenshots are uploaded to Imgur, or placed on your clipboard", - position = 7 - ) - default UploadStyle uploadScreenshot() - { - return UploadStyle.NEITHER; - } - - @ConfigItem( - keyName = "kills", - name = "Screenshot PvP Kills", - description = "Configures whether or not screenshots are automatically taken of PvP kills", - position = 8 - ) - default boolean screenshotKills() - { - return false; - } - - @ConfigItem( - keyName = "boss", - name = "Screenshot Boss Kills", - description = "Configures whether or not screenshots are automatically taken of boss kills", - position = 9 - ) - default boolean screenshotBossKills() - { - return false; - } - - @ConfigItem( - keyName = "friendDeath", - name = "Friend Deaths", - description = "Configures whether or not screenshots are automatically taken when a clanmate or a friend near you dies.", - position = 10 - ) - default boolean screenshotFriendDeath() - { - return false; - } - - @ConfigItem( - keyName = "playerDeath", - name = "Screenshot Deaths", - description = "Configures whether or not screenshots are automatically taken when you die.", - position = 11 - ) - default boolean screenshotPlayerDeath() - { - return false; - } - - @ConfigItem( - keyName = "duels", - name = "Screenshot Duels", - description = "Configures whether or not screenshots are automatically taken of the duel end screen.", - position = 12 - ) - default boolean screenshotDuels() - { - return false; - } - - @ConfigItem( - keyName = "valuableDrop", - name = "Screenshot Valuable drops", - description = "Configures whether or not screenshots are automatically taken when you receive a valuable drop.", - position = 13 - ) - default boolean screenshotValuableDrop() - { - return false; - } - - @ConfigItem( - keyName = "untradeableDrop", - name = "Screenshot Untradeable drops", - description = "Configures whether or not screenshots are automatically taken when you receive an untradeable drop.", - position = 14 - ) - default boolean screenshotUntradeableDrop() - { - return false; - } - - @ConfigItem( - keyName = "hotkey", - name = "Screenshot hotkey", - description = "When you press this key a screenshot will be taken", - position = 15 - ) - default Keybind hotkey() - { - return Keybind.NOT_SET; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotOverlay.java deleted file mode 100644 index 27b4d9b392..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotOverlay.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.screenshot; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FontMetrics; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.image.BufferedImage; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Queue; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.function.Consumer; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.MainBufferProvider; -import net.runelite.client.ui.DrawManager; -import net.runelite.client.ui.FontManager; -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; - -@Singleton -class ScreenshotOverlay extends Overlay -{ - private static final DateFormat DATE_FORMAT = new SimpleDateFormat("MMM. dd, yyyy"); - private static final int REPORT_BUTTON_X_OFFSET = 404; - - private final Client client; - private final DrawManager drawManager; - private final ScreenshotPlugin plugin; - - private final Queue> consumers = new ConcurrentLinkedQueue<>(); - - @Inject - private ScreenshotOverlay(final Client client, final DrawManager drawManager, final ScreenshotPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGH); - setLayer(OverlayLayer.ABOVE_WIDGETS); - this.client = client; - this.drawManager = drawManager; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (consumers.isEmpty()) - { - return null; - } - - final MainBufferProvider bufferProvider = (MainBufferProvider) client.getBufferProvider(); - final int imageHeight = ((BufferedImage) bufferProvider.getImage()).getHeight(); - final int y = imageHeight - plugin.getReportButton().getHeight() - 1; - - graphics.drawImage(plugin.getReportButton(), REPORT_BUTTON_X_OFFSET, y, null); - - graphics.setFont(FontManager.getRunescapeSmallFont()); - FontMetrics fontMetrics = graphics.getFontMetrics(); - - String date = DATE_FORMAT.format(new Date()); - final int dateWidth = fontMetrics.stringWidth(date); - final int dateHeight = fontMetrics.getHeight(); - - final int textX = REPORT_BUTTON_X_OFFSET + plugin.getReportButton().getWidth() / 2 - dateWidth / 2; - final int textY = y + plugin.getReportButton().getHeight() / 2 + dateHeight / 2; - - graphics.setColor(Color.BLACK); - graphics.drawString(date, textX + 1, textY + 1); - - graphics.setColor(Color.WHITE); - graphics.drawString(date, textX, textY); - - // Request the queued screenshots to be taken, - // now that the timestamp is visible. - Consumer consumer; - while ((consumer = consumers.poll()) != null) - { - drawManager.requestNextFrameListener(consumer); - } - - return null; - } - - void queueForTimestamp(Consumer screenshotConsumer) - { - if (plugin.getReportButton() == null) - { - return; - } - - consumers.add(screenshotConsumer); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java deleted file mode 100644 index 2aacbcd7d3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java +++ /dev/null @@ -1,903 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * Modified by Jason - * 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.screenshot; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.inject.Provides; -import java.awt.Desktop; -import java.awt.Graphics; -import java.awt.Image; -import java.awt.Toolkit; -import java.awt.TrayIcon; -import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.StringSelection; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.lang.reflect.InvocationTargetException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.time.LocalDate; -import java.util.Date; -import java.util.EnumSet; -import java.util.concurrent.ScheduledExecutorService; -import java.util.function.Consumer; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.imageio.ImageIO; -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.swing.SwingUtilities; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.Player; -import net.runelite.api.Point; -import net.runelite.api.SpriteID; -import net.runelite.api.Varbits; -import net.runelite.api.WorldType; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.PlayerDeath; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.Widget; -import static net.runelite.api.widgets.WidgetID.BARROWS_REWARD_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.CHAMBERS_OF_XERIC_REWARD_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.CHATBOX_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.CLUE_SCROLL_REWARD_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.DIALOG_SPRITE_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.KINGDOM_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.LEVEL_UP_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.QUEST_COMPLETED_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.THEATRE_OF_BLOOD_REWARD_GROUP_ID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.Notifier; -import static net.runelite.client.RuneLite.SCREENSHOT_DIR; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.config.Keybind; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.events.PlayerLootReceived; -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.PluginType; -import net.runelite.client.plugins.screenshot.imgur.ImageUploadRequest; -import net.runelite.client.plugins.screenshot.imgur.ImageUploadResponse; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.ClientUI; -import net.runelite.client.ui.DrawManager; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.util.HotkeyListener; -import net.runelite.client.util.ImageUtil; -import net.runelite.http.api.RuneLiteAPI; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -@PluginDescriptor( - name = "Screenshot", - description = "Enable the manual and automatic taking of screenshots", - tags = {"external", "images", "imgur", "integration", "notifications"}, - type = PluginType.MISCELLANEOUS -) -@Slf4j -@Singleton -public class ScreenshotPlugin extends Plugin -{ - private static final String IMGUR_CLIENT_ID = "30d71e5f6860809"; - private static final HttpUrl IMGUR_IMAGE_UPLOAD_URL = HttpUrl.parse("https://api.imgur.com/3/image"); - private static final MediaType JSON = MediaType.parse("application/json"); - - private static final DateFormat TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"); - - private static final Pattern NUMBER_PATTERN = Pattern.compile("([0-9]+)"); - private static final Pattern LEVEL_UP_PATTERN = Pattern.compile(".*Your ([a-zA-Z]+) (?:level is|are)? now (\\d+)\\."); - private static final Pattern BOSSKILL_MESSAGE_PATTERN = Pattern.compile("Your (.+) kill count is: (\\d+)."); - private static final Pattern VALUABLE_DROP_PATTERN = Pattern.compile(".*Valuable drop: ([^<>]+)(?:)?"); - private static final Pattern UNTRADEABLE_DROP_PATTERN = Pattern.compile(".*Untradeable drop: ([^<>]+)(?:)?"); - private static final Pattern DUEL_END_PATTERN = Pattern.compile("You have now (won|lost) ([0-9]+) duels?\\."); - private static final ImmutableList PET_MESSAGES = ImmutableList.of("You have a funny feeling like you're being followed", - "You feel something weird sneaking into your backpack", - "You have a funny feeling like you would have been followed"); - - private static String format(Date date) - { - synchronized (TIME_FORMAT) - { - return TIME_FORMAT.format(date); - } - } - - private String clueType; - private Integer clueNumber; - - private Integer barrowsNumber; - - private Integer chambersOfXericNumber; - - private Integer chambersOfXericChallengeNumber; - - private Integer theatreOfBloodNumber; - - private boolean shouldTakeScreenshot; - - @Inject - private ScreenshotConfig config; - - @Inject - private OverlayManager overlayManager; - - @Inject - private ScreenshotOverlay screenshotOverlay; - - @Inject - private Notifier notifier; - - @Inject - private Client client; - - @Inject - private ClientUI clientUi; - - @Inject - private ClientToolbar clientToolbar; - - @Inject - private DrawManager drawManager; - - @Inject - private ScheduledExecutorService executor; - - @Inject - private KeyManager keyManager; - - @Inject - private SpriteManager spriteManager; - - @Getter(AccessLevel.PACKAGE) - private BufferedImage reportButton; - - private NavigationButton titleBarButton; - - private final HotkeyListener hotkeyListener = new HotkeyListener(() -> this.hotkey) - { - @Override - public void hotkeyPressed() - { - takeScreenshot(format(new Date())); - } - }; - - private boolean includeFrame; - @Setter(AccessLevel.PACKAGE) - private boolean displayDate; - private boolean notifyWhenTaken; - @Setter(AccessLevel.PACKAGE) - private boolean screenshotRewards; - @Setter(AccessLevel.PACKAGE) - private boolean screenshotLevels; - private boolean screenshotKingdom; - private boolean screenshotPet; - private UploadStyle uploadScreenshot; - private boolean screenshotKills; - private boolean screenshotBossKills; - private boolean screenshotFriendDeath; - private boolean screenshotPlayerDeath; - private boolean screenshotDuels; - @Setter(AccessLevel.PACKAGE) - private boolean screenshotValuableDrop; - @Setter(AccessLevel.PACKAGE) - private boolean screenshotUntradeableDrop; - private Keybind hotkey; - - @Provides - ScreenshotConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(ScreenshotConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(screenshotOverlay); - SCREENSHOT_DIR.mkdirs(); - keyManager.registerKeyListener(hotkeyListener); - - final BufferedImage iconImage = ImageUtil.getResourceStreamFromClass(getClass(), "screenshot.png"); - - titleBarButton = NavigationButton.builder() - .tab(false) - .tooltip("Take screenshot") - .icon(iconImage) - .onClick(() -> takeScreenshot(format(new Date()))) - .popup(ImmutableMap - .builder() - .put("Open screenshot folder...", () -> - { - try - { - Desktop.getDesktop().open(SCREENSHOT_DIR); - } - catch (IOException ex) - { - log.warn("Error opening screenshot dir", ex); - } - }) - .build()) - .build(); - - clientToolbar.addNavigation(titleBarButton); - - spriteManager.getSpriteAsync(SpriteID.CHATBOX_REPORT_BUTTON, 0, s -> reportButton = s); - } - - @Override - protected void shutDown() - { - overlayManager.remove(screenshotOverlay); - clientToolbar.removeNavigation(titleBarButton); - keyManager.unregisterKeyListener(hotkeyListener); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGGED_IN - && reportButton == null) - { - reportButton = spriteManager.getSprite(SpriteID.CHATBOX_REPORT_BUTTON, 0); - } - } - - @Subscribe - void onGameTick(GameTick event) - { - if (!shouldTakeScreenshot) - { - return; - } - - shouldTakeScreenshot = false; - - String fileName = null; - if (client.getWidget(WidgetInfo.LEVEL_UP_LEVEL) != null) - { - fileName = parseLevelUpWidget(client.getWidget(WidgetInfo.LEVEL_UP_LEVEL)); - } - else if (client.getWidget(WidgetInfo.DIALOG_SPRITE_TEXT) != null) - { - fileName = parseLevelUpWidget(client.getWidget(WidgetInfo.DIALOG_SPRITE_TEXT)); - } - else if (client.getWidget(WidgetInfo.QUEST_COMPLETED_NAME_TEXT) != null) - { - // "You have completed The Corsair Curse!" - String text = client.getWidget(WidgetInfo.QUEST_COMPLETED_NAME_TEXT).getText(); - fileName = "Quest(" + text.substring(19, text.length() - 1) + ")"; - } - else if (client.getWidget(WidgetInfo.CHATBOX_CONTAINER).getChild(1) != null) - { - fileName = parseLevelUpWidget(client.getWidget(WidgetInfo.CHATBOX_CONTAINER).getChild(1)); - } - - if (fileName != null) - { - takeScreenshot(fileName); - } - } - - @Subscribe - private void onPlayerDeath(PlayerDeath event) - { - if (event.getPlayer() == client.getLocalPlayer() && config.screenshotPlayerDeath()) - { - takeScreenshot(client.getLocalPlayer().getName() + " dead " + format(new Date()), "Deaths"); - } - - int tob = client.getVar(Varbits.THEATRE_OF_BLOOD); - if (this.screenshotFriendDeath && event.getPlayer().getName() != null - && (event.getPlayer().isFriend() || event.getPlayer().isClanMember() - || (client.getVar(Varbits.IN_RAID) == 1 || tob == 2 || tob == 3))) - { - takeScreenshot(event.getPlayer().getName() + " dead " + format(new Date()), "Deaths"); - } - } - - @Subscribe - private void onPlayerLootReceived(final PlayerLootReceived playerLootReceived) - { - if (this.screenshotKills) - { - final Player player = playerLootReceived.getPlayer(); - final String name = player.getName(); - String fileName = "Kill " + name + " " + format(new Date()); - takeScreenshot(fileName); - } - } - - @Subscribe - void onChatMessage(ChatMessage event) - { - if (event.getType() != ChatMessageType.GAMEMESSAGE && event.getType() != ChatMessageType.SPAM && event.getType() != ChatMessageType.TRADE) - { - return; - } - - String chatMessage = event.getMessage(); - - if (chatMessage.contains("You have completed") && chatMessage.contains("Treasure")) - { - Matcher m = NUMBER_PATTERN.matcher(Text.removeTags(chatMessage)); - if (m.find()) - { - clueNumber = Integer.valueOf(m.group()); - clueType = chatMessage.substring(chatMessage.lastIndexOf(m.group()) + m.group().length() + 1, chatMessage.indexOf("Treasure") - 1); - return; - } - } - - if (chatMessage.startsWith("Your Barrows chest count is")) - { - Matcher m = NUMBER_PATTERN.matcher(Text.removeTags(chatMessage)); - if (m.find()) - { - barrowsNumber = Integer.valueOf(m.group()); - return; - } - } - - if (chatMessage.startsWith("Your completed Chambers of Xeric count is:")) - { - Matcher m = NUMBER_PATTERN.matcher(Text.removeTags(chatMessage)); - if (m.find()) - { - chambersOfXericNumber = Integer.valueOf(m.group()); - return; - } - } - - if (chatMessage.startsWith("Your completed Chambers of Xeric Challenge Mode count is:")) - { - Matcher m = NUMBER_PATTERN.matcher(Text.removeTags(chatMessage)); - if (m.find()) - { - chambersOfXericChallengeNumber = Integer.valueOf(m.group()); - return; - } - } - - if (chatMessage.startsWith("Your completed Theatre of Blood count is:")) - { - Matcher m = NUMBER_PATTERN.matcher(Text.removeTags(chatMessage)); - if (m.find()) - { - theatreOfBloodNumber = Integer.valueOf(m.group()); - return; - } - } - - if (this.screenshotPet && PET_MESSAGES.stream().anyMatch(chatMessage::contains)) - { - String fileName = "Pet " + format(new Date()); - takeScreenshot(fileName); - } - - if (this.screenshotBossKills) - { - Matcher m = BOSSKILL_MESSAGE_PATTERN.matcher(chatMessage); - if (m.matches()) - { - String bossName = m.group(1); - String bossKillcount = m.group(2); - String fileName = bossName + "(" + bossKillcount + ")"; - takeScreenshot(fileName); - } - } - - if (this.screenshotValuableDrop) - { - Matcher m = VALUABLE_DROP_PATTERN.matcher(chatMessage); - if (m.matches()) - { - String valuableDropName = m.group(1); - String fileName = "Valuable drop " + valuableDropName + " " + format(new Date()); - takeScreenshot(fileName); - } - } - - if (this.screenshotUntradeableDrop) - { - Matcher m = UNTRADEABLE_DROP_PATTERN.matcher(chatMessage); - if (m.matches()) - { - String untradeableDropName = m.group(1); - String fileName = "Untradeable drop " + untradeableDropName + " " + format(new Date()); - takeScreenshot(fileName); - } - } - - if (this.screenshotDuels) - { - Matcher m = DUEL_END_PATTERN.matcher(chatMessage); - if (m.find()) - { - String result = m.group(1); - String count = m.group(2); - String fileName = "Duel " + result + " (" + count + ")"; - takeScreenshot(fileName); - } - } - } - - @Subscribe - void onWidgetLoaded(WidgetLoaded event) - { - String fileName; - int groupId = event.getGroupId(); - - switch (groupId) - { - case QUEST_COMPLETED_GROUP_ID: - case CLUE_SCROLL_REWARD_GROUP_ID: - case CHAMBERS_OF_XERIC_REWARD_GROUP_ID: - case THEATRE_OF_BLOOD_REWARD_GROUP_ID: - case BARROWS_REWARD_GROUP_ID: - if (!this.screenshotRewards) - { - return; - } - break; - case LEVEL_UP_GROUP_ID: - case DIALOG_SPRITE_GROUP_ID: - case CHATBOX_GROUP_ID: - if (!this.screenshotLevels) - { - return; - } - break; - case KINGDOM_GROUP_ID: - if (!this.screenshotKingdom) - { - return; - } - break; - } - - switch (groupId) - { - case KINGDOM_GROUP_ID: - { - fileName = "Kingdom " + LocalDate.now(); - break; - } - case CHAMBERS_OF_XERIC_REWARD_GROUP_ID: - { - if (chambersOfXericNumber != null) - { - fileName = "Chambers of Xeric(" + chambersOfXericNumber + ")"; - chambersOfXericNumber = null; - break; - } - else if (chambersOfXericChallengeNumber != null) - { - fileName = "Chambers of Xeric Challenge Mode(" + chambersOfXericChallengeNumber + ")"; - chambersOfXericChallengeNumber = null; - break; - } - else - { - return; - } - } - case THEATRE_OF_BLOOD_REWARD_GROUP_ID: - { - if (theatreOfBloodNumber == null) - { - return; - } - - fileName = "Theatre of Blood(" + theatreOfBloodNumber + ")"; - theatreOfBloodNumber = null; - break; - } - case BARROWS_REWARD_GROUP_ID: - { - if (barrowsNumber == null) - { - return; - } - - fileName = "Barrows(" + barrowsNumber + ")"; - barrowsNumber = null; - break; - } - case LEVEL_UP_GROUP_ID: - case DIALOG_SPRITE_GROUP_ID: - case QUEST_COMPLETED_GROUP_ID: - case CHATBOX_GROUP_ID: - { - // level up widget gets loaded prior to the text being set, so wait until the next tick - shouldTakeScreenshot = true; - return; - } - case CLUE_SCROLL_REWARD_GROUP_ID: - { - if (clueType == null || clueNumber == null) - { - return; - } - - fileName = Character.toUpperCase(clueType.charAt(0)) + clueType.substring(1) + "(" + clueNumber + ")"; - clueType = null; - clueNumber = null; - break; - } - default: - return; - } - - takeScreenshot(fileName); - } - - /** - * Receives a Widget containing the level-up dialog, - * and parses it into a shortened string for filename usage. - * - * @param levelUpWidget Widget containing the level-up text, - * with the format "Your Skill (level is/are) now 99." - * @return Shortened string in the format "Skill(99)" - */ - String parseLevelUpWidget(Widget levelUpWidget) - { - if (levelUpWidget == null) - { - return null; - } - - Matcher m = LEVEL_UP_PATTERN.matcher(levelUpWidget.getText()); - if (!m.matches()) - { - return null; - } - - String skillName = m.group(1); - String skillLevel = m.group(2); - return skillName + "(" + skillLevel + ")"; - } - - /** - * Saves a screenshot of the client window to the screenshot folder as a PNG, - * and optionally uploads it to an image-hosting service. - * - * @param fileName Filename to use, without file extension. - */ - private void takeScreenshot(String fileName) - { - if (client.getGameState() == GameState.LOGIN_SCREEN) - { - // Prevent the screenshot from being captured - log.info("Login screenshot prevented"); - return; - } - - Consumer imageCallback = (img) -> - { - // This callback is on the game thread, move to executor thread - executor.submit(() -> takeScreenshot(fileName, img, null)); - }; - - if (this.displayDate) - { - screenshotOverlay.queueForTimestamp(imageCallback); - } - else - { - drawManager.requestNextFrameListener(imageCallback); - } - } - - /** - * Saves a screenshot of the client window to the screenshot folder as a PNG, - * and optionally uploads it to an image-hosting service. - * - * @param fileName Filename to use, without file extension. - * @param subdirectory The subdirectory to save it in - */ - private void takeScreenshot(String fileName, String subdirectory) - { - if (client.getGameState() == GameState.LOGIN_SCREEN) - { - // Prevent the screenshot from being captured - log.info("Login screenshot prevented"); - return; - } - - Consumer imageCallback = (img) -> - { - // This callback is on the game thread, move to executor thread - executor.submit(() -> takeScreenshot(fileName, img, subdirectory)); - - }; - - if (this.displayDate) - { - screenshotOverlay.queueForTimestamp(imageCallback); - } - else - { - drawManager.requestNextFrameListener(imageCallback); - } - } - - private void takeScreenshot(String fileName, Image image, @Nullable String subdirectory) - { - BufferedImage screenshot = this.includeFrame - ? new BufferedImage(clientUi.getWidth(), clientUi.getHeight(), BufferedImage.TYPE_INT_ARGB) - : new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB); - - Graphics graphics = screenshot.getGraphics(); - - int gameOffsetX = 0; - int gameOffsetY = 0; - - if (this.includeFrame) - { - // Draw the client frame onto the screenshot - try - { - SwingUtilities.invokeAndWait(() -> clientUi.paint(graphics)); - } - catch (InterruptedException | InvocationTargetException e) - { - log.warn("unable to paint client UI on screenshot", e); - } - - // Evaluate the position of the game inside the frame - final Point canvasOffset = clientUi.getCanvasOffset(); - gameOffsetX = canvasOffset.getX(); - gameOffsetY = canvasOffset.getY(); - } - - // Draw the game onto the screenshot - graphics.drawImage(image, gameOffsetX, gameOffsetY, null); - - File playerFolder; - if (client.getLocalPlayer() != null && client.getLocalPlayer().getName() != null) - { - final EnumSet worldTypes = client.getWorldType(); - - String playerDir = client.getLocalPlayer().getName(); - if (worldTypes.contains(WorldType.DEADMAN)) - { - playerDir += "-Deadman"; - } - else if (worldTypes.contains(WorldType.LEAGUE)) - { - playerDir += "-League"; - } - playerFolder = new File(SCREENSHOT_DIR, playerDir); - } - else - { - playerFolder = SCREENSHOT_DIR; - } - - playerFolder.mkdirs(); - - if (subdirectory != null) - { - //uhh just tried to do this as workaround, not sure if it's the best idea tho - File actualplayerFolder = new File(playerFolder, subdirectory); - actualplayerFolder.mkdir(); - playerFolder = actualplayerFolder; - } - - try - { - File screenshotFile = new File(playerFolder, fileName + ".png"); - - // To make sure that screenshots don't get overwritten, check if file exists, - // and if it does create file with same name and suffix. - int i = 1; - while (screenshotFile.exists()) - { - screenshotFile = new File(playerFolder, fileName + String.format("(%d)", i++) + ".png"); - } - - ImageIO.write(screenshot, "PNG", screenshotFile); - UploadStyle uploadStyle = this.uploadScreenshot; - - if (uploadStyle == UploadStyle.IMGUR) - { - uploadScreenshot(screenshotFile); - } - else if (uploadStyle == UploadStyle.CLIPBOARD) - { - Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); - TransferableBufferedImage transferableBufferedImage = new TransferableBufferedImage(screenshot); - clipboard.setContents(transferableBufferedImage, null); - - if (this.notifyWhenTaken) - { - notifier.notify("A screenshot was saved and inserted into your clipboard!", TrayIcon.MessageType.INFO); - } - } - else if (this.notifyWhenTaken) - { - notifier.notify("A screenshot was saved to " + screenshotFile, TrayIcon.MessageType.INFO); - } - } - catch (IOException ex) - { - log.warn("error writing screenshot", ex); - } - } - - /** - * Uploads a screenshot to the Imgur image-hosting service, - * and copies the image link to the clipboard. - * - * @param screenshotFile Image file to upload. - * @throws IOException Thrown if the file cannot be read. - */ - /** - * Uploads a screenshot to the Imgur image-hosting service, - * and copies the image link to the clipboard. - * - * @param screenshotFile Image file to upload. - * @throws IOException Thrown if the file cannot be read. - */ - private void uploadScreenshot(File screenshotFile) throws IOException - { - String json = RuneLiteAPI.GSON.toJson(new ImageUploadRequest(screenshotFile)); - - Request request = new Request.Builder() - .url(IMGUR_IMAGE_UPLOAD_URL) - .addHeader("Authorization", "Client-ID " + IMGUR_CLIENT_ID) - .post(RequestBody.create(JSON, json)) - .build(); - - RuneLiteAPI.CLIENT.newCall(request).enqueue(new Callback() - { - @Override - public void onFailure(@NotNull Call call, @NotNull IOException ex) - { - log.warn("error uploading screenshot", ex); - } - - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException - { - try (InputStream in = response.body().byteStream()) - { - ImageUploadResponse imageUploadResponse = RuneLiteAPI.GSON - .fromJson(new InputStreamReader(in), ImageUploadResponse.class); - - if (imageUploadResponse.isSuccess()) - { - String link = imageUploadResponse.getData().getLink(); - - StringSelection selection = new StringSelection(link); - Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); - clipboard.setContents(selection, selection); - - if (notifyWhenTaken) - { - notifier.notify("A screenshot was uploaded and inserted into your clipboard!", TrayIcon.MessageType.INFO); - } - } - } - } - }); - } - - @VisibleForTesting - int getClueNumber() - { - return clueNumber; - } - - @VisibleForTesting - String getClueType() - { - return clueType; - } - - @VisibleForTesting - int getBarrowsNumber() - { - return barrowsNumber; - } - - @VisibleForTesting - int getChambersOfXericNumber() - { - return chambersOfXericNumber; - } - - @VisibleForTesting - int getChambersOfXericChallengeNumber() - { - return chambersOfXericChallengeNumber; - } - - @VisibleForTesting - int gettheatreOfBloodNumber() - { - return theatreOfBloodNumber; - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("screenshot")) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.includeFrame = config.includeFrame(); - this.displayDate = config.displayDate(); - this.notifyWhenTaken = config.notifyWhenTaken(); - this.screenshotRewards = config.screenshotRewards(); - this.screenshotLevels = config.screenshotLevels(); - this.screenshotKingdom = config.screenshotKingdom(); - this.screenshotPet = config.screenshotPet(); - this.uploadScreenshot = config.uploadScreenshot(); - this.screenshotKills = config.screenshotKills(); - this.screenshotBossKills = config.screenshotBossKills(); - this.screenshotFriendDeath = config.screenshotFriendDeath(); - this.screenshotPlayerDeath = config.screenshotPlayerDeath(); - this.screenshotDuels = config.screenshotDuels(); - this.screenshotValuableDrop = config.screenshotValuableDrop(); - this.screenshotUntradeableDrop = config.screenshotUntradeableDrop(); - this.hotkey = config.hotkey(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/TransferableBufferedImage.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/TransferableBufferedImage.java deleted file mode 100644 index 88499fd77b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/TransferableBufferedImage.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2019, Alexsuperfly - * 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 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.client.plugins.screenshot; - -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.Transferable; -import java.awt.datatransfer.UnsupportedFlavorException; -import java.awt.image.BufferedImage; -import lombok.AllArgsConstructor; -import lombok.NonNull; -import org.jetbrains.annotations.NotNull; - -@AllArgsConstructor -class TransferableBufferedImage implements Transferable -{ - @NonNull - private final BufferedImage image; - - @NotNull - @Override - public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException - { - if (flavor.equals(DataFlavor.imageFlavor)) - { - return image; - } - else - { - throw new UnsupportedFlavorException(flavor); - } - } - - @Override - public DataFlavor[] getTransferDataFlavors() - { - return new DataFlavor[]{DataFlavor.imageFlavor}; - } - - @Override - public boolean isDataFlavorSupported(DataFlavor flavor) - { - return flavor.equals(DataFlavor.imageFlavor); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/UploadStyle.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/UploadStyle.java deleted file mode 100644 index cf3e964c56..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/UploadStyle.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2019, Alexsuperfly - * 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.screenshot; - -import lombok.RequiredArgsConstructor; - -@RequiredArgsConstructor -public enum UploadStyle -{ - NEITHER("Neither"), - IMGUR("Imgur"), - CLIPBOARD("Clipboard"); - - private final String name; - - @Override - public String toString() - { - return name; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/imgur/ImageUploadRequest.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/imgur/ImageUploadRequest.java deleted file mode 100644 index 28c8d4f2f3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/imgur/ImageUploadRequest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.screenshot.imgur; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.util.Base64; -import lombok.Data; - -@Data -public class ImageUploadRequest -{ - private final String image; - private final String type; - - public ImageUploadRequest(File imageFile) throws IOException - { - this.image = Base64.getEncoder().encodeToString(Files.readAllBytes(imageFile.toPath())); - this.type = "base64"; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/imgur/ImageUploadResponse.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/imgur/ImageUploadResponse.java deleted file mode 100644 index 820ed2aded..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/imgur/ImageUploadResponse.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.screenshot.imgur; - -import lombok.Data; - -@Data -public class ImageUploadResponse -{ - private Data data; - private boolean success; - - @lombok.Data - public static class Data - { - private String link; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/shayzieninfirmary/ShayzienInfirmaryOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/shayzieninfirmary/ShayzienInfirmaryOverlay.java deleted file mode 100644 index bd975ef502..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/shayzieninfirmary/ShayzienInfirmaryOverlay.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2019, Yani - * 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.shayzieninfirmary; - -import java.awt.AlphaComposite; -import java.awt.Color; -import java.awt.Composite; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.ItemID; -import net.runelite.api.NPC; -import net.runelite.api.Point; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayUtil; - -@Singleton -public class ShayzienInfirmaryOverlay extends Overlay -{ - private final ShayzienInfirmaryPlugin plugin; - - private final BufferedImage medPackImage; - - @Inject - public ShayzienInfirmaryOverlay(final ShayzienInfirmaryPlugin plugin, final ItemManager itemManager) - { - setPosition(OverlayPosition.DYNAMIC); - this.plugin = plugin; - - medPackImage = itemManager.getImage(ItemID.SHAYZIEN_MEDPACK); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.isNotAtInfirmary()) - { - return null; - } - - for (NPC npc : plugin.getUnhealedSoldiers()) - { - - Polygon tilePoly = npc.getCanvasTilePoly(); - - if (tilePoly == null) - { - continue; - } - - OverlayUtil.renderPolygon(graphics, npc.getCanvasTilePoly(), Color.ORANGE); - - Point imageLocation = npc.getCanvasImageLocation(medPackImage, 25); - - if (imageLocation == null) - { - continue; - } - - Composite originalComposite = graphics.getComposite(); - Composite translucentComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f); - - graphics.setComposite(translucentComposite); - - OverlayUtil.renderImageLocation(graphics, imageLocation, medPackImage); - - graphics.setComposite(originalComposite); - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/shayzieninfirmary/ShayzienInfirmaryPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/shayzieninfirmary/ShayzienInfirmaryPlugin.java deleted file mode 100644 index 545020d524..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/shayzieninfirmary/ShayzienInfirmaryPlugin.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2019, Yani - * 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.shayzieninfirmary; - -import java.util.ArrayList; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.events.GameTick; -import net.runelite.client.eventbus.Subscribe; -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; - -@Slf4j -@PluginDescriptor( - name = "Shayzien Infirmary", - description = "Shows the status of wounded soldiers", - tags = {"shayzien", "infirmary", "soldiers"}, - type = PluginType.UTILITY, - enabledByDefault = false -) -@Singleton -public class ShayzienInfirmaryPlugin extends Plugin -{ - @Getter(AccessLevel.PACKAGE) - private List unhealedSoldiers = new ArrayList<>(); - - @Inject - private OverlayManager overlayManager; - - @Inject - private Client client; - - @Inject - private ShayzienInfirmaryOverlay overlay; - - @Override - protected void startUp() - { - - loadPlugin(); - } - - @Override - protected void shutDown() - { - unloadPlugin(); - } - - private void loadPlugin() - { - overlayManager.add(overlay); - } - - private void unloadPlugin() - { - overlayManager.remove(overlay); - } - - @Subscribe - private void onGameTick(GameTick event) - { - if (isNotAtInfirmary()) - { - return; - } - - unhealedSoldiers.clear(); - - for (NPC npc : client.getNpcs()) - { - if (isUnhealedSoldierId(npc.getId())) - { - unhealedSoldiers.add(npc); - } - } - } - - private boolean isSoldierId(int npcId) - { - return (npcId >= 6826 && npcId <= 6857); - } - - private boolean isUnhealedSoldierId(int npcId) - { - return (isSoldierId(npcId) && npcId % 2 == 0); - } - - boolean isNotAtInfirmary() - { - return client.getLocalPlayer().getWorldLocation().getRegionID() != 6200; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/CacheSkillData.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/CacheSkillData.java deleted file mode 100644 index f4f54e0f52..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/CacheSkillData.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2018, Kruithne - * 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.skillcalculator; - -import com.google.gson.Gson; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.HashMap; -import java.util.Map; -import net.runelite.client.plugins.skillcalculator.beans.SkillData; - -class CacheSkillData -{ - private final Map cache = new HashMap<>(); - - SkillData getSkillData(String dataFile) - { - if (cache.containsKey(dataFile)) - { - return cache.get(dataFile); - } - - InputStream skillDataFile = SkillCalculatorPlugin.class.getResourceAsStream(dataFile); - SkillData skillData = new Gson().fromJson(new InputStreamReader(skillDataFile), SkillData.class); - - cache.put(dataFile, skillData); - return skillData; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/CalculatorType.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/CalculatorType.java deleted file mode 100644 index fef979bcfd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/CalculatorType.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2018, Kruithne - * 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.skillcalculator; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.Skill; - -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -enum CalculatorType -{ - MINING(Skill.MINING, "skill_mining.json"), - AGILITY(Skill.AGILITY, "skill_agility.json"), - SMITHING(Skill.SMITHING, "skill_smithing.json"), - HERBLORE(Skill.HERBLORE, "skill_herblore.json"), - FISHING(Skill.FISHING, "skill_fishing.json"), - THIEVING(Skill.THIEVING, "skill_thieving.json"), - COOKING(Skill.COOKING, "skill_cooking.json"), - PRAYER(Skill.PRAYER, "skill_prayer.json"), - CRAFTING(Skill.CRAFTING, "skill_crafting.json"), - FIREMAKING(Skill.FIREMAKING, "skill_firemaking.json"), - MAGIC(Skill.MAGIC, "skill_magic.json"), - FLETCHING(Skill.FLETCHING, "skill_fletching.json"), - WOODCUTTING(Skill.WOODCUTTING, "skill_woodcutting.json"), - RUNECRAFT(Skill.RUNECRAFT, "skill_runecraft.json"), - FARMING(Skill.FARMING, "skill_farming.json"), - CONSTRUCTION(Skill.CONSTRUCTION, "skill_construction.json"), - HUNTER(Skill.HUNTER, "skill_hunter.json"); - - private final Skill skill; - private final String dataFile; -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java deleted file mode 100644 index 1293407c5e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java +++ /dev/null @@ -1,527 +0,0 @@ -/** - * Copyright (c) 2018, Kruithne - * Copyright (c) 2018, Psikoi - * 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.skillcalculator; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.event.FocusAdapter; -import java.awt.event.FocusEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.text.DecimalFormat; -import java.text.NumberFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.function.Consumer; -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import net.runelite.api.Client; -import net.runelite.api.Experience; -import net.runelite.api.Skill; -import net.runelite.api.VarPlayer; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.plugins.skillcalculator.beans.SkillData; -import net.runelite.client.plugins.skillcalculator.beans.SkillDataBonus; -import net.runelite.client.plugins.skillcalculator.beans.SkillDataEntry; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.DynamicGridLayout; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.ui.components.IconTextField; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; - -class SkillCalculator extends JPanel -{ - private static final int MAX_XP = 200_000_000; - private static final DecimalFormat XP_FORMAT = new DecimalFormat("#.#"); - - private final UICalculatorInputArea uiInput; - private final Client client; - private final SpriteManager spriteManager; - private final ItemManager itemManager; - private final List uiActionSlots = new ArrayList<>(); - private final CacheSkillData cacheSkillData = new CacheSkillData(); - private final UICombinedActionSlot combinedActionSlot; - private final List combinedActionSlots = new ArrayList<>(); - private final List bonusCheckBoxes = new ArrayList<>(); - private final IconTextField searchBar = new IconTextField(); - - private SkillData skillData; - private int currentLevel = 1; - private int currentXP = Experience.getXpForLevel(currentLevel); - private int targetLevel = currentLevel + 1; - private int targetXP = Experience.getXpForLevel(targetLevel); - private float xpFactor = 1.0f; - private float lastBonus = 0.0f; - - SkillCalculator(Client client, UICalculatorInputArea uiInput, SpriteManager spriteManager, ItemManager itemManager) - { - this.client = client; - this.uiInput = uiInput; - this.spriteManager = spriteManager; - this.itemManager = itemManager; - - combinedActionSlot = new UICombinedActionSlot(spriteManager); - - searchBar.setIcon(IconTextField.Icon.SEARCH); - searchBar.setPreferredSize(new Dimension(PluginPanel.PANEL_WIDTH - 20, 30)); - searchBar.setBackground(ColorScheme.DARKER_GRAY_COLOR); - searchBar.setHoverBackgroundColor(ColorScheme.DARK_GRAY_HOVER_COLOR); - searchBar.addClearListener(e -> onSearch()); - searchBar.addKeyListener(e -> onSearch()); - - setLayout(new DynamicGridLayout(0, 1, 0, 5)); - - // Register listeners on the input fields and then move on to the next related text field - uiInput.getUiFieldCurrentLevel().addActionListener(e -> - { - onFieldCurrentLevelUpdated(); - uiInput.getUiFieldTargetLevel().requestFocusInWindow(); - }); - - uiInput.getUiFieldCurrentXP().addActionListener(e -> - { - onFieldCurrentXPUpdated(); - uiInput.getUiFieldTargetXP().requestFocusInWindow(); - }); - - uiInput.getUiFieldTargetLevel().addActionListener(e -> onFieldTargetLevelUpdated()); - uiInput.getUiFieldTargetXP().addActionListener(e -> onFieldTargetXPUpdated()); - - // Register focus listeners to calculate xp when exiting a text field - uiInput.getUiFieldCurrentLevel().addFocusListener(buildFocusAdapter(e -> onFieldCurrentLevelUpdated())); - uiInput.getUiFieldCurrentXP().addFocusListener(buildFocusAdapter(e -> onFieldCurrentXPUpdated())); - uiInput.getUiFieldTargetLevel().addFocusListener(buildFocusAdapter(e -> onFieldTargetLevelUpdated())); - uiInput.getUiFieldTargetXP().addFocusListener(buildFocusAdapter(e -> onFieldTargetXPUpdated())); - } - - void openCalculator(CalculatorType calculatorType) - { - // Load the skill data. - skillData = cacheSkillData.getSkillData(calculatorType.getDataFile()); - - // Reset the XP factor, removing bonuses. - xpFactor = 1.0f; - - // Update internal skill/XP values. - currentXP = client.getSkillExperience(calculatorType.getSkill()); - currentLevel = Experience.getLevelForXp(currentXP); - VarPlayer endGoalVarp = endGoalVarpForSkill(calculatorType.getSkill()); - int endGoal = client.getVar(endGoalVarp); - if (endGoal != -1) - { - targetLevel = Experience.getLevelForXp(endGoal); - targetXP = endGoal; - } - else - { - targetLevel = enforceSkillBounds(currentLevel + 1); - targetXP = Experience.getXpForLevel(targetLevel); - } - - // Remove all components (action slots) from this panel. - removeAll(); - - // Clear the search bar - searchBar.setText(null); - - // Clear the combined action slots - clearCombinedSlots(); - - // Add in checkboxes for available skill bonuses. - renderBonusOptions(); - - // Add the combined action slot. - add(combinedActionSlot); - - // Add the search bar - add(searchBar); - - // Create action slots for the skill actions. - renderActionSlots(); - - // Update the input fields. - updateInputFields(); - } - - private void updateCombinedAction() - { - int size = combinedActionSlots.size(); - if (size > 1) - { - combinedActionSlot.setTitle(size + " actions selected"); - } - else if (size == 1) - { - combinedActionSlot.setTitle("1 action selected"); - } - else - { - combinedActionSlot.setTitle("No action selected"); - combinedActionSlot.setText("Shift-click to select multiple"); - return; - } - - int actionCount = 0; - int neededXP = targetXP - currentXP; - double xp = 0; - - for (UIActionSlot slot : combinedActionSlots) - { - xp += slot.getValue(); - } - - if (neededXP > 0) - { - assert xp != 0; - actionCount = (int) Math.ceil(neededXP / xp); - } - - combinedActionSlot.setText(formatXPActionString(xp, actionCount, "exp - ")); - } - - private void clearCombinedSlots() - { - for (UIActionSlot slot : combinedActionSlots) - { - slot.setSelected(false); - } - - combinedActionSlots.clear(); - } - - private void renderBonusOptions() - { - if (skillData.getBonuses() != null) - { - List uiCheckBoxList = new ArrayList<>(); - lastBonus = 0.0f; - - for (SkillDataBonus bonus : skillData.getBonuses()) - { - Pair> combinedCheckboxPanel = buildCheckboxPanel(bonus, uiCheckBoxList); - JPanel checkboxPanel = combinedCheckboxPanel.getKey(); - uiCheckBoxList = combinedCheckboxPanel.getValue(); - - add(checkboxPanel); - } - - add(Box.createRigidArea(new Dimension(0, 5))); - } - } - - private Pair> buildCheckboxPanel(SkillDataBonus bonus, List uiCheckBoxList) - { - JPanel uiOption = new JPanel(new BorderLayout()); - JLabel uiLabel = new JLabel(bonus.getName()); - JCheckBox uiCheckbox = new JCheckBox(); - - uiLabel.setForeground(Color.WHITE); - uiLabel.setFont(FontManager.getRunescapeSmallFont()); - - uiOption.setBorder(BorderFactory.createEmptyBorder(3, 7, 3, 0)); - uiOption.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - JCheckBox uiCheckBox = new JCheckBox(); - uiCheckBox.setBackground(ColorScheme.MEDIUM_GRAY_COLOR); - uiCheckBox.addActionListener(e -> - { - if (uiCheckBox.isSelected()) - { - adjustXPBonus(uiCheckBox.isSelected(), bonus.getValue()); - lastBonus = bonus.getValue(); - - for (JCheckBox checkBox : uiCheckBoxList) - { - if (checkBox != uiCheckBox) - { - checkBox.setSelected(false); - } - } - } - else if (xpFactor > 1.0) - { - xpFactor = 1.0f; - lastBonus = 0.0f; - calculate(); - } - - updateCombinedAction(); - }); - - uiCheckBoxList.add(uiCheckBox); - - uiOption.add(uiCheckBox, BorderLayout.EAST); - - uiOption.add(uiLabel, BorderLayout.WEST); - bonusCheckBoxes.add(uiCheckbox); - - return new ImmutablePair<>(uiOption, uiCheckBoxList); - } - - private void renderActionSlots() - { - // Wipe the list of references to the slot components. - uiActionSlots.clear(); - - // Create new components for the action slots. - for (SkillDataEntry action : skillData.getActions()) - { - JLabel uiIcon = new JLabel(); - - if (action.getIcon() != null) - { - itemManager.getImage(action.getIcon()).addTo(uiIcon); - } - else if (action.getSprite() != null) - { - spriteManager.addSpriteTo(uiIcon, action.getSprite(), 0); - } - - UIActionSlot slot = new UIActionSlot(action, uiIcon); - uiActionSlots.add(slot); // Keep our own reference. - add(slot); // Add component to the panel. - - slot.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent e) - { - if (!e.isShiftDown()) - { - clearCombinedSlots(); - } - - if (slot.isSelected()) - { - combinedActionSlots.remove(slot); - } - else - { - combinedActionSlots.add(slot); - } - - slot.setSelected(!slot.isSelected()); - updateCombinedAction(); - } - }); - } - - // Refresh the rendering of this panel. - revalidate(); - repaint(); - } - - private void calculate() - { - for (UIActionSlot slot : uiActionSlots) - { - int actionCount = 0; - int neededXP = targetXP - currentXP; - SkillDataEntry action = slot.getAction(); - double xp = (action.isIgnoreBonus()) ? action.getXp() : action.getXp() * xpFactor; - - if (neededXP > 0) - { - actionCount = (int) Math.ceil(neededXP / xp); - } - - slot.setText("Lvl. " + action.getLevel() + " (" + formatXPActionString(xp, actionCount, "exp) - ")); - slot.setAvailable(currentLevel >= action.getLevel()); - slot.setOverlapping(action.getLevel() < targetLevel); - slot.setValue(xp); - } - - updateCombinedAction(); - } - - private String formatXPActionString(double xp, int actionCount, String expExpression) - { - return XP_FORMAT.format(xp) + expExpression + NumberFormat.getIntegerInstance().format(actionCount) + (actionCount > 1 ? " actions" : " action"); - } - - private void updateInputFields() - { - if (targetXP < currentXP) - { - targetLevel = enforceSkillBounds(currentLevel + 1); - targetXP = Experience.getXpForLevel(targetLevel); - } - - uiInput.setCurrentLevelInput(currentLevel); - uiInput.setCurrentXPInput(currentXP); - uiInput.setTargetLevelInput(targetLevel); - uiInput.setTargetXPInput(targetXP); - calculate(); - } - - private void adjustXPBonus(boolean addBonus, float value) - { - clearLastBonus(); - xpFactor += addBonus ? value : -value; - calculate(); - } - - private void clearLastBonus() - { - xpFactor -= lastBonus; - calculate(); - } - - private void onFieldCurrentLevelUpdated() - { - currentLevel = enforceSkillBounds(uiInput.getCurrentLevelInput()); - currentXP = Experience.getXpForLevel(currentLevel); - updateInputFields(); - } - - private void onFieldCurrentXPUpdated() - { - currentXP = enforceXPBounds(uiInput.getCurrentXPInput()); - currentLevel = Experience.getLevelForXp(currentXP); - updateInputFields(); - } - - private void onFieldTargetLevelUpdated() - { - targetLevel = enforceSkillBounds(uiInput.getTargetLevelInput()); - targetXP = Experience.getXpForLevel(targetLevel); - updateInputFields(); - } - - private void onFieldTargetXPUpdated() - { - targetXP = enforceXPBounds(uiInput.getTargetXPInput()); - targetLevel = Experience.getLevelForXp(targetXP); - updateInputFields(); - } - - private static int enforceSkillBounds(int input) - { - return Math.min(Experience.MAX_VIRT_LEVEL, Math.max(1, input)); - } - - private static int enforceXPBounds(int input) - { - return Math.min(MAX_XP, Math.max(0, input)); - } - - private void onSearch() - { - //only show slots that match our search text - uiActionSlots.forEach(slot -> - { - if (slotContainsText(slot, searchBar.getText())) - { - super.add(slot); - } - else - { - super.remove(slot); - } - - revalidate(); - }); - } - - private boolean slotContainsText(UIActionSlot slot, String text) - { - return slot.getAction().getName().toLowerCase().contains(text.toLowerCase()); - } - - private FocusAdapter buildFocusAdapter(Consumer focusLostConsumer) - { - return new FocusAdapter() - { - @Override - public void focusLost(FocusEvent e) - { - focusLostConsumer.accept(e); - } - }; - } - - private static VarPlayer endGoalVarpForSkill(final Skill skill) - { - switch (skill) - { - case ATTACK: - return VarPlayer.ATTACK_GOAL_END; - case MINING: - return VarPlayer.MINING_GOAL_END; - case WOODCUTTING: - return VarPlayer.WOODCUTTING_GOAL_END; - case DEFENCE: - return VarPlayer.DEFENCE_GOAL_END; - case MAGIC: - return VarPlayer.MAGIC_GOAL_END; - case RANGED: - return VarPlayer.RANGED_GOAL_END; - case HITPOINTS: - return VarPlayer.HITPOINTS_GOAL_END; - case AGILITY: - return VarPlayer.AGILITY_GOAL_END; - case STRENGTH: - return VarPlayer.STRENGTH_GOAL_END; - case PRAYER: - return VarPlayer.PRAYER_GOAL_END; - case SLAYER: - return VarPlayer.SLAYER_GOAL_END; - case FISHING: - return VarPlayer.FISHING_GOAL_END; - case RUNECRAFT: - return VarPlayer.RUNECRAFT_GOAL_END; - case HERBLORE: - return VarPlayer.HERBLORE_GOAL_END; - case FIREMAKING: - return VarPlayer.FIREMAKING_GOAL_END; - case CONSTRUCTION: - return VarPlayer.CONSTRUCTION_GOAL_END; - case HUNTER: - return VarPlayer.HUNTER_GOAL_END; - case COOKING: - return VarPlayer.COOKING_GOAL_END; - case FARMING: - return VarPlayer.FARMING_GOAL_END; - case CRAFTING: - return VarPlayer.CRAFTING_GOAL_END; - case SMITHING: - return VarPlayer.SMITHING_GOAL_END; - case THIEVING: - return VarPlayer.THIEVING_GOAL_END; - case FLETCHING: - return VarPlayer.FLETCHING_GOAL_END; - default: - throw new IllegalArgumentException(); - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculatorConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculatorConfig.java deleted file mode 100644 index 53e7fffc34..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculatorConfig.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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.skillcalculator; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("skillCalculator") -public interface SkillCalculatorConfig extends Config -{ - @ConfigItem( - keyName = "enabledBankedXp", - name = "Add Banked XP Panel", - description = "Adds the Banked XP Panel to the side bar", - position = 0 - ) - default boolean showBankedXp() - { - return false; - } - - @ConfigItem( - keyName = "cascadeBankedXp", - name = "Include output items", - description = "Includes output items in the item quantity calculations", - position = 1 - ) - default boolean cascadeBankedXp() - { - return true; - } - - @ConfigItem( - keyName = "showSecondaries", - name = "Show required secondaries", - description = "Toggles whether the Secondaries will be displayed for the selected item", - position = 2 - ) - default boolean showSecondaries() - { - return false; - } - - @ConfigItem( - keyName = "limitToCurrentLevel", - name = "Respect level requirements", - description = "Toggles whether the exp calculation will limit to your current skill level", - position = 3 - ) - default boolean limitToCurrentLevel() - { - return true; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculatorPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculatorPanel.java deleted file mode 100644 index b6abe4577f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculatorPanel.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2018, Kruithne - * Copyright (c) 2018, Psikoi - * 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.skillcalculator; - -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.GridLayout; -import javax.swing.ImageIcon; -import javax.swing.JScrollPane; -import javax.swing.border.EmptyBorder; -import net.runelite.api.Client; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.SkillIconManager; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.ui.components.materialtabs.MaterialTab; -import net.runelite.client.ui.components.materialtabs.MaterialTabGroup; - -class SkillCalculatorPanel extends PluginPanel -{ - private final SkillCalculator uiCalculator; - private final SkillIconManager iconManager; - private final MaterialTabGroup tabGroup; - - SkillCalculatorPanel(SkillIconManager iconManager, Client client, SpriteManager spriteManager, ItemManager itemManager) - { - super(); - getScrollPane().setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); - - this.iconManager = iconManager; - - setBorder(new EmptyBorder(10, 10, 10, 10)); - setLayout(new GridBagLayout()); - - GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.HORIZONTAL; - c.weightx = 1; - c.gridx = 0; - c.gridy = 0; - - tabGroup = new MaterialTabGroup(); - tabGroup.setLayout(new GridLayout(0, 6, 7, 7)); - - addCalculatorButtons(); - - final UICalculatorInputArea uiInput = new UICalculatorInputArea(); - uiInput.setBorder(new EmptyBorder(15, 0, 15, 0)); - uiInput.setBackground(ColorScheme.DARK_GRAY_COLOR); - uiCalculator = new SkillCalculator(client, uiInput, spriteManager, itemManager); - - add(tabGroup, c); - c.gridy++; - - add(uiInput, c); - c.gridy++; - - add(uiCalculator, c); - c.gridy++; - } - - private void addCalculatorButtons() - { - for (CalculatorType calculatorType : CalculatorType.values()) - { - ImageIcon icon = new ImageIcon(iconManager.getSkillImage(calculatorType.getSkill(), true)); - MaterialTab tab = new MaterialTab(icon, tabGroup, null); - tab.setOnSelectEvent(() -> - { - uiCalculator.openCalculator(calculatorType); - return true; - }); - - tabGroup.addTab(tab); - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculatorPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculatorPlugin.java deleted file mode 100644 index 50bffc6dd6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculatorPlugin.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) 2018, Kruithne - * 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.skillcalculator; - -import com.google.inject.Provides; -import java.awt.image.BufferedImage; -import java.util.HashMap; -import java.util.Map; -import javax.inject.Inject; -import javax.swing.SwingUtilities; -import net.runelite.api.Client; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.SkillIconManager; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.skillcalculator.banked.BankedCalculatorPanel; -import net.runelite.client.plugins.skillcalculator.banked.beans.Activity; -import net.runelite.client.plugins.skillcalculator.banked.beans.CriticalItem; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.util.ImageUtil; - -@PluginDescriptor( - name = "Skill Calculator", - description = "Enable the Skill Calculator panel", - tags = {"panel", "skilling"}, - type = PluginType.MISCELLANEOUS -) -public class SkillCalculatorPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private SkillIconManager skillIconManager; - - @Inject - private ItemManager itemManager; - - @Inject - private SpriteManager spriteManager; - - @Inject - private ClientToolbar clientToolbar; - - @Inject - private SkillCalculatorConfig skillCalculatorConfig; - - private NavigationButton uiNavigationButton; - private NavigationButton bankedUiNavigationButton; - - private BankedCalculatorPanel bankedUiPanel; - private int bankHash = -1; - - @Provides - SkillCalculatorConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(SkillCalculatorConfig.class); - } - - @Override - protected void startUp() - { - - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "calc.png"); - final SkillCalculatorPanel uiPanel = new SkillCalculatorPanel(skillIconManager, client, spriteManager, itemManager); - - uiNavigationButton = NavigationButton.builder() - .tooltip("Skill Calculator") - .icon(icon) - .priority(6) - .panel(uiPanel) - .build(); - - clientToolbar.addNavigation(uiNavigationButton); - - toggleBankedXpPanel(); - } - - @Override - protected void shutDown() - { - clientToolbar.removeNavigation(uiNavigationButton); - if (bankedUiNavigationButton != null) - { - clientToolbar.removeNavigation(bankedUiNavigationButton); - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("skillCalculator") && event.getKey().equals("enabledBankedXp")) - { - toggleBankedXpPanel(); - } - } - - @Subscribe - public void onScriptCallbackEvent(ScriptCallbackEvent event) - { - if (!event.getEventName().equals("setBankTitle") || !skillCalculatorConfig.showBankedXp()) - { - return; - } - - updateBankItems(); - } - - private void toggleBankedXpPanel() - { - if (skillCalculatorConfig.showBankedXp()) - { - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "banked.png"); - - bankedUiPanel = new BankedCalculatorPanel(client, skillCalculatorConfig, skillIconManager, itemManager); - bankedUiNavigationButton = NavigationButton.builder() - .tooltip("Banked XP") - .icon(icon) - .priority(6) - .panel(bankedUiPanel) - .build(); - - clientToolbar.addNavigation(bankedUiNavigationButton); - - clientThread.invoke(() -> - { - switch (client.getGameState()) - { - case LOGIN_SCREEN: - case LOGIN_SCREEN_AUTHENTICATOR: - case LOGGING_IN: - case LOADING: - case LOGGED_IN: - case CONNECTION_LOST: - case HOPPING: - CriticalItem.prepareItemDefinitions(itemManager); - Activity.prepareItemDefinitions(itemManager); - return true; - default: - return false; - } - }); - } - else - { - if (bankedUiNavigationButton == null) - { - return; - } - - clientToolbar.removeNavigation(bankedUiNavigationButton); - - bankedUiNavigationButton = null; - } - } - - // Check if bank contents changed and if so send to UI - private void updateBankItems() - { - final ItemContainer c = client.getItemContainer(InventoryID.BANK); - if (c == null) - { - return; - } - - final Item[] widgetItems = c.getItems(); - if (widgetItems == null || widgetItems.length == 0) - { - return; - } - - final Map m = new HashMap<>(); - for (Item widgetItem : widgetItems) - { - m.put(widgetItem.getId(), widgetItem.getQuantity()); - } - - final int curHash = m.hashCode(); - if (bankHash != curHash) - { - bankHash = curHash; - SwingUtilities.invokeLater(() -> bankedUiPanel.setBankMap(m)); - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UIActionSlot.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UIActionSlot.java deleted file mode 100644 index 2051a0ddcd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UIActionSlot.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (c) 2018, Kruithne - * Copyright (c) 2018, Psikoi - * 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.skillcalculator; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import javax.swing.BorderFactory; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.border.Border; -import javax.swing.border.CompoundBorder; -import javax.swing.border.EmptyBorder; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.client.plugins.skillcalculator.beans.SkillDataEntry; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.components.shadowlabel.JShadowedLabel; - -class UIActionSlot extends JPanel -{ - private static final Border GREEN_BORDER = new CompoundBorder( - BorderFactory.createMatteBorder(0, 4, 0, 0, (ColorScheme.PROGRESS_COMPLETE_COLOR).darker()), - BorderFactory.createEmptyBorder(7, 12, 7, 7)); - - private static final Border RED_BORDER = new CompoundBorder( - BorderFactory.createMatteBorder(0, 4, 0, 0, (ColorScheme.PROGRESS_ERROR_COLOR).darker()), - BorderFactory.createEmptyBorder(7, 12, 7, 7)); - - private static final Border ORANGE_BORDER = new CompoundBorder( - BorderFactory.createMatteBorder(0, 4, 0, 0, (ColorScheme.PROGRESS_INPROGRESS_COLOR).darker()), - BorderFactory.createEmptyBorder(7, 12, 7, 7)); - - private static final Dimension ICON_SIZE = new Dimension(32, 32); - - @Getter(AccessLevel.PACKAGE) - private final SkillDataEntry action; - private final JShadowedLabel uiLabelActions; - - private final JPanel uiInfo; - - @Getter(AccessLevel.PACKAGE) - private boolean isAvailable; - - @Getter(AccessLevel.PACKAGE) - private boolean isSelected; - - @Getter(AccessLevel.PACKAGE) - private boolean isOverlapping; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private double value = 0; - - UIActionSlot(SkillDataEntry action, JLabel uiIcon) - { - this.action = action; - - setLayout(new BorderLayout()); - setBorder(RED_BORDER); - setBackground(ColorScheme.DARKER_GRAY_COLOR); - - MouseListener hoverListener = new MouseAdapter() - { - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - if (!isSelected) - { - setBackground(ColorScheme.DARKER_GRAY_HOVER_COLOR); - } - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - if (!isSelected) - { - updateBackground(); - } - } - }; - - addMouseListener(hoverListener); - uiIcon.setMinimumSize(ICON_SIZE); - uiIcon.setMaximumSize(ICON_SIZE); - uiIcon.setPreferredSize(ICON_SIZE); - uiIcon.setHorizontalAlignment(JLabel.CENTER); - - uiInfo = new JPanel(new GridLayout(2, 1)); - uiInfo.setBackground(ColorScheme.DARKER_GRAY_COLOR); - uiInfo.setBorder(new EmptyBorder(0, 5, 0, 0)); - - JShadowedLabel uiLabelName = new JShadowedLabel(action.getName()); - uiLabelName.setForeground(Color.WHITE); - - uiLabelActions = new JShadowedLabel("Unknown"); - uiLabelActions.setFont(FontManager.getRunescapeSmallFont()); - uiLabelActions.setForeground(ColorScheme.LIGHT_GRAY_COLOR); - - uiInfo.add(uiLabelName); - uiInfo.add(uiLabelActions); - - add(uiIcon, BorderLayout.LINE_START); - add(uiInfo, BorderLayout.CENTER); - } - - void setSelected(boolean selected) - { - isSelected = selected; - this.updateBackground(); - } - - void setAvailable(boolean available) - { - isAvailable = available; - this.updateBackground(); - } - - void setOverlapping(boolean overlapping) - { - isOverlapping = overlapping; - this.updateBackground(); - } - - void setText(String text) - { - uiLabelActions.setText(text); - } - - private void updateBackground() - { - if (isAvailable) - { - this.setBorder(GREEN_BORDER); - } - else if (isOverlapping) - { - this.setBorder(ORANGE_BORDER); - } - else - { - this.setBorder(RED_BORDER); - } - - setBackground(this.isSelected() ? ColorScheme.DARKER_GRAY_HOVER_COLOR.brighter() : ColorScheme.DARKER_GRAY_COLOR); - } - - @Override - public void setBackground(Color color) - { - super.setBackground(color); - if (uiInfo != null) - { - uiInfo.setBackground(color); - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UICalculatorInputArea.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UICalculatorInputArea.java deleted file mode 100644 index 22c726deda..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UICalculatorInputArea.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2018, Kruithne - * Copyright (c) 2018, Psikoi - * 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.skillcalculator; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.GridLayout; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.border.EmptyBorder; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.components.FlatTextField; - -@Getter(AccessLevel.PUBLIC) -public class UICalculatorInputArea extends JPanel -{ - private final JTextField uiFieldCurrentLevel; - private final JTextField uiFieldCurrentXP; - private final JTextField uiFieldTargetLevel; - private final JTextField uiFieldTargetXP; - - public UICalculatorInputArea() - { - setLayout(new GridLayout(2, 2, 7, 7)); - uiFieldCurrentLevel = addComponent("Current Level"); - uiFieldCurrentXP = addComponent("Current Experience"); - uiFieldTargetLevel = addComponent("Target Level"); - uiFieldTargetXP = addComponent("Target Experience"); - } - - int getCurrentLevelInput() - { - return getInput(uiFieldCurrentLevel); - } - - public void setCurrentLevelInput(int value) - { - setInput(uiFieldCurrentLevel, value); - } - - int getCurrentXPInput() - { - return getInput(uiFieldCurrentXP); - } - - public void setCurrentXPInput(Object value) - { - setInput(uiFieldCurrentXP, value); - } - - int getTargetLevelInput() - { - return getInput(uiFieldTargetLevel); - } - - public void setTargetLevelInput(Object value) - { - setInput(uiFieldTargetLevel, value); - } - - int getTargetXPInput() - { - return getInput(uiFieldTargetXP); - } - - public void setTargetXPInput(Object value) - { - setInput(uiFieldTargetXP, value); - } - - private int getInput(JTextField field) - { - try - { - return Integer.parseInt(field.getText()); - } - catch (NumberFormatException e) - { - return 0; - } - } - - private void setInput(JTextField field, Object value) - { - field.setText(String.valueOf(value)); - } - - private JTextField addComponent(String label) - { - final JPanel container = new JPanel(); - container.setLayout(new BorderLayout()); - - final JLabel uiLabel = new JLabel(label); - final FlatTextField uiInput = new FlatTextField(); - - uiInput.setBackground(ColorScheme.DARKER_GRAY_COLOR); - uiInput.setHoverBackgroundColor(ColorScheme.DARK_GRAY_HOVER_COLOR); - uiInput.setBorder(new EmptyBorder(5, 7, 5, 7)); - - uiLabel.setFont(FontManager.getRunescapeSmallFont()); - uiLabel.setBorder(new EmptyBorder(0, 0, 4, 0)); - uiLabel.setForeground(Color.WHITE); - - container.add(uiLabel, BorderLayout.NORTH); - container.add(uiInput, BorderLayout.CENTER); - - add(container); - - return uiInput.getTextField(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UICombinedActionSlot.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UICombinedActionSlot.java deleted file mode 100644 index fa1614c91b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UICombinedActionSlot.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2018, Kruithne - * Copyright (c) 2018, Psikoi - * 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.skillcalculator; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridLayout; -import javax.swing.BorderFactory; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.components.shadowlabel.JShadowedLabel; - -class UICombinedActionSlot extends JPanel -{ - private static final Dimension ICON_SIZE = new Dimension(32, 32); - private final JShadowedLabel uiLabelActions; - private final JShadowedLabel uiLabelTitle; - - UICombinedActionSlot(SpriteManager spriteManager) - { - setLayout(new BorderLayout()); - setBackground(ColorScheme.DARKER_GRAY_COLOR); - setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7)); - - JLabel uiIcon = new JLabel(); - uiIcon.setBorder(new EmptyBorder(0, 0, 0, 5)); - spriteManager.addSpriteTo(uiIcon, 582, 0); - - uiIcon.setMinimumSize(ICON_SIZE); - uiIcon.setMaximumSize(ICON_SIZE); - uiIcon.setPreferredSize(ICON_SIZE); - uiIcon.setHorizontalAlignment(JLabel.CENTER); - add(uiIcon, BorderLayout.LINE_START); - - JPanel uiInfo = new JPanel(new GridLayout(2, 1)); - uiInfo.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - uiLabelTitle = new JShadowedLabel("No Action Selected"); - uiLabelTitle.setForeground(Color.WHITE); - - uiLabelActions = new JShadowedLabel("Shift-click to select multiple"); - uiLabelActions.setFont(FontManager.getRunescapeSmallFont()); - uiLabelActions.setForeground(ColorScheme.LIGHT_GRAY_COLOR); - - uiInfo.add(uiLabelTitle); - uiInfo.add(uiLabelActions); - - add(uiInfo, BorderLayout.CENTER); - } - - void setText(String text) - { - uiLabelActions.setText(text); - } - - void setTitle(String text) - { - uiLabelTitle.setText(text); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/BankedCalculator.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/BankedCalculator.java deleted file mode 100644 index 566426e5dd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/BankedCalculator.java +++ /dev/null @@ -1,465 +0,0 @@ -/* - * 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.skillcalculator.banked; - -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.Multimap; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.event.ItemEvent; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import javax.swing.BorderFactory; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingConstants; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.Experience; -import net.runelite.api.Skill; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.skillcalculator.SkillCalculatorConfig; -import net.runelite.client.plugins.skillcalculator.UICalculatorInputArea; -import net.runelite.client.plugins.skillcalculator.banked.beans.Activity; -import net.runelite.client.plugins.skillcalculator.banked.beans.BankedItem; -import net.runelite.client.plugins.skillcalculator.banked.beans.CriticalItem; -import net.runelite.client.plugins.skillcalculator.banked.beans.XpModifiers; -import net.runelite.client.plugins.skillcalculator.banked.components.GridItem; -import net.runelite.client.plugins.skillcalculator.banked.components.ModifyPanel; -import net.runelite.client.plugins.skillcalculator.banked.components.SelectionGrid; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.DynamicGridLayout; -import net.runelite.client.ui.FontManager; -import net.runelite.client.util.AsyncBufferedImage; - -@Slf4j -public class BankedCalculator extends JPanel -{ - public static final DecimalFormat XP_FORMAT_COMMA = new DecimalFormat("#,###.#"); - - private final Client client; - @Getter(AccessLevel.PUBLIC) - private final SkillCalculatorConfig config; - private final UICalculatorInputArea uiInput; - private final ItemManager itemManager; - - // Some activities output a CriticalItem and may need to be included in the calculable qty - // Using multimap for cases where there are multiple items linked directly to one item, use recursion for otherwise - private final Multimap linkedMap = ArrayListMultimap.create(); - - private final Map bankedItemMap = new LinkedHashMap<>(); - private final JLabel totalXpLabel = new JLabel(); - private final ModifyPanel modifyPanel; - private final Collection xpModifierButtons = new ArrayList<>(); - private SelectionGrid itemGrid; - @Setter(AccessLevel.PACKAGE) - private Map bankMap = new HashMap<>(); - @Getter(AccessLevel.PACKAGE) - private Skill currentSkill; - @Getter(AccessLevel.PUBLIC) - private int skillLevel, skillExp, endLevel, endExp; - @Getter(AccessLevel.PUBLIC) - private float xpFactor = 1.0f; - - BankedCalculator(UICalculatorInputArea uiInput, Client client, SkillCalculatorConfig config, ItemManager itemManager) - { - this.uiInput = uiInput; - this.client = client; - this.config = config; - this.itemManager = itemManager; - - setLayout(new DynamicGridLayout(0, 1, 0, 5)); - - // Panel used to modify banked item values - this.modifyPanel = new ModifyPanel(this, itemManager); - } - - /** - * opens the Banked Calculator for this skill - */ - void open(final Skill newSkill) - { - if (newSkill.equals(currentSkill)) - { - return; - } - - this.currentSkill = newSkill; - removeAll(); - xpFactor = 1.0f; - - if (bankMap.size() <= 0) - { - add(new JLabel("Please visit a bank!", JLabel.CENTER)); - revalidate(); - repaint(); - return; - } - - skillLevel = client.getRealSkillLevel(currentSkill); - skillExp = client.getSkillExperience(currentSkill); - endLevel = skillLevel; - endExp = skillExp; - - uiInput.setCurrentLevelInput(skillLevel); - uiInput.setCurrentXPInput(skillExp); - uiInput.setTargetLevelInput(endLevel); - uiInput.setTargetXPInput(endExp); - - recreateBankedItemMap(); - - final Collection modifiers = XpModifiers.getModifiersBySkill(this.currentSkill); - for (final XpModifiers modifier : modifiers) - { - JPanel uiOption = new JPanel(new BorderLayout()); - JLabel uiLabel = new JLabel(modifier.getName()); - JCheckBox btn = new JCheckBox(); - - uiLabel.setForeground(Color.WHITE); - uiLabel.setFont(FontManager.getRunescapeSmallFont()); - uiLabel.setHorizontalAlignment(SwingConstants.CENTER); - - uiOption.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 0)); - uiOption.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - btn.addItemListener((event) -> - { - switch (event.getStateChange()) - { - case ItemEvent.DESELECTED: - xpFactor = 1.0f; - break; - case ItemEvent.SELECTED: - // Deselects all but the current item - final JCheckBox box = (JCheckBox) event.getItem(); - xpModifierButtons.forEach(b -> b.setSelected(b == box)); - - xpFactor = modifier.getModifier(); - break; - default: - return; - - } - - modifierUpdated(); - }); - xpModifierButtons.add(btn); - - uiOption.add(uiLabel, BorderLayout.WEST); - uiOption.add(btn, BorderLayout.EAST); - add(uiOption); - } - - recreateItemGrid(); - - // This should only be null if there are no items in their bank for this skill - if (itemGrid.getSelectedItem() == null) - { - add(new JLabel("Couldn't find any items for this skill.", JLabel.CENTER)); - } - else - { - add(totalXpLabel); - add(modifyPanel); - add(itemGrid); - } - - revalidate(); - repaint(); - } - - private void recreateBankedItemMap() - { - bankedItemMap.clear(); - linkedMap.clear(); - - final Collection items = CriticalItem.getBySkill(currentSkill); - log.debug("Critical Items for the {} Skill: {}", currentSkill.getName(), items); - - for (final CriticalItem item : items) - { - final BankedItem banked = new BankedItem(item, bankMap.getOrDefault(item.getItemID(), 0)); - bankedItemMap.put(item, banked); - - Activity a = item.getSelectedActivity(); - final int level = config.limitToCurrentLevel() ? skillLevel : -1; - if (a == null || (level > 0 && level < a.getLevel())) - { - final List activities = Activity.getByCriticalItem(item, level); - if (activities.size() == 0) - { - item.setSelectedActivity(null); - continue; - } - item.setSelectedActivity(activities.get(0)); - a = activities.get(0); - } - - if (a.getLinkedItem() != null) - { - linkedMap.put(a.getLinkedItem(), banked); - } - } - log.debug("Banked Item Map: {}", bankedItemMap); - log.debug("Linked Map: {}", linkedMap); - } - - /** - * Populates the detailContainer with the necessary BankedItemPanels - */ - private void recreateItemGrid() - { - // Selection grid will only display values with > 0 items - itemGrid = new SelectionGrid(this, bankedItemMap.values(), itemManager); - itemGrid.setOnSelectEvent(() -> - { - modifyPanel.setBankedItem(itemGrid.getSelectedItem()); - return true; - }); - - itemGrid.setOnIgnoreEvent(() -> - { - CriticalItem item = itemGrid.getLastIgnoredItem().getItem(); - updateLinkedItems(item.getSelectedActivity()); - calculateBankedXpTotal(); - return true; - }); - - // Select the first item in the list - modifyPanel.setBankedItem(itemGrid.getSelectedItem()); - - calculateBankedXpTotal(); - } - - public double getItemXpRate(final BankedItem bankedItem) - { - return bankedItem.getXpRate() * (bankedItem.getItem().isIgnoreBonus() ? 1.0f : xpFactor); - } - - /** - * Calculates total item quantity accounting for backwards linked items - * - * @param item starting item - * @return item qty including linked items - */ - public int getItemQty(final BankedItem item) - { - int qty = item.getQty(); - - if (!config.cascadeBankedXp()) - { - return qty; - } - - final Map linked = createLinksMap(item); - final int linkedQty = linked.values().stream().mapToInt(Integer::intValue).sum(); - - return qty + linkedQty; - } - - private void calculateBankedXpTotal() - { - double total = 0.0; - for (final GridItem i : itemGrid.getPanelMap().values()) - { - if (i.isIgnored()) - { - continue; - } - - final BankedItem bi = i.getBankedItem(); - total += getItemQty(bi) * getItemXpRate(bi); - } - - endExp = (int) (skillExp + total); - endLevel = Experience.getLevelForXp(endExp); - - totalXpLabel.setText("Total Banked xp: " + XP_FORMAT_COMMA.format(total)); - uiInput.setTargetLevelInput(endLevel); - uiInput.setTargetXPInput(Math.min(Experience.MAX_SKILL_XP, endExp)); - - revalidate(); - repaint(); - } - - /** - * Used to select an Activity for an item - * - * @param i BankedItem item the activity is tied to - * @param a Activity the selected activity - */ - public void activitySelected(final BankedItem i, final Activity a) - { - final CriticalItem item = i.getItem(); - final Activity old = item.getSelectedActivity(); - if (a.equals(old)) - { - return; - } - - item.setSelectedActivity(a); - - // Cascade activity changes if necessary. - if (config.cascadeBankedXp() && (old.getLinkedItem() != a.getLinkedItem())) - { - // Update Linked Map - linkedMap.remove(old.getLinkedItem(), i); - linkedMap.put(a.getLinkedItem(), i); - // Update all items the old activity effects - updateLinkedItems(old); - // Update all the items the new activity effects - updateLinkedItems(a); - } - - modifyPanel.setBankedItem(i); - itemGrid.getPanelMap().get(i).updateToolTip(); - - // recalculate total xp - calculateBankedXpTotal(); - } - - /** - * Updates the item quantities of all forward linked items - * - * @param activity the starting {@link Activity} to start the cascade from - */ - private void updateLinkedItems(final Activity activity) - { - if (activity == null) - { - return; - } - - boolean foundSelected = false; - boolean panelAmountChange = false; - - CriticalItem i = activity.getLinkedItem(); - while (i != null) - { - final BankedItem bi = bankedItemMap.get(i); - if (bi == null) - { - break; - } - - final int qty = getItemQty(bi); - final boolean stackable = bi.getItem().getItemInfo().isStackable() || qty > 1; - final AsyncBufferedImage img = itemManager.getImage(bi.getItem().getItemID(), qty, stackable); - - final GridItem gridItem = itemGrid.getPanelMap().get(bi); - final int oldQty = gridItem.getAmount(); - panelAmountChange = panelAmountChange || ((oldQty == 0 && qty > 0) || (oldQty > 0 && qty == 0)); - gridItem.updateIcon(img, qty); - gridItem.updateToolTip(); - - foundSelected = foundSelected || itemGrid.getSelectedItem().equals(bi); - - final Activity a = bi.getItem().getSelectedActivity(); - if (a == null) - { - break; - } - - i = a.getLinkedItem(); - } - - if (panelAmountChange) - { - itemGrid.refreshGridDisplay(); - } - - if (foundSelected) - { - // Refresh current modify panel if the cascade effects it - modifyPanel.setBankedItem(itemGrid.getSelectedItem()); - } - } - - /** - * Creates a Map of CriticalItem to bank qty for all items that are being linked to this one - * - * @param item starting item - * @return Map of CriticalItem to bank qty - */ - public Map createLinksMap(final BankedItem item) - { - final Map qtyMap = new HashMap<>(); - - final Activity a = item.getItem().getSelectedActivity(); - if (a == null) - { - return qtyMap; - } - - final Collection linkedBank = linkedMap.get(item.getItem()); - if (linkedBank == null || linkedBank.size() == 0) - { - return qtyMap; - } - - for (final BankedItem linked : linkedBank) - { - // Check if the item is ignored in the grid - if (itemGrid != null) - { - final GridItem grid = itemGrid.getPanelMap().get(linked); - if (grid != null && grid.isIgnored()) - { - continue; - } - } - - final int qty = linked.getQty(); - if (qty > 0) - { - qtyMap.put(linked.getItem(), qty); - } - qtyMap.putAll(createLinksMap(linked)); - } - - return qtyMap; - } - - private void modifierUpdated() - { - itemGrid.getPanelMap().values().forEach(GridItem::updateToolTip); - modifyPanel.setBankedItem(modifyPanel.getBankedItem()); - calculateBankedXpTotal(); - } - - public int getItemQtyFromBank(final int id) - { - return bankMap.getOrDefault(id, 0); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/BankedCalculatorPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/BankedCalculatorPanel.java deleted file mode 100644 index d86809d8af..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/BankedCalculatorPanel.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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.skillcalculator.banked; - -import com.google.common.collect.ImmutableSet; -import java.awt.Color; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.event.ItemEvent; -import java.awt.image.BufferedImage; -import java.util.Map; -import javax.swing.ImageIcon; -import javax.swing.JComboBox; -import javax.swing.border.EmptyBorder; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.Skill; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.SkillIconManager; -import net.runelite.client.plugins.skillcalculator.SkillCalculatorConfig; -import net.runelite.client.plugins.skillcalculator.UICalculatorInputArea; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.ui.components.ComboBoxIconEntry; -import net.runelite.client.ui.components.ComboBoxListRenderer; - -@Slf4j -public class BankedCalculatorPanel extends PluginPanel -{ - private final static ImmutableSet BANKABLE_SKILLS = ImmutableSet.of( - Skill.CONSTRUCTION, Skill.COOKING, Skill.CRAFTING, Skill.FARMING, Skill.FIREMAKING, Skill.FLETCHING, Skill.HERBLORE, Skill.PRAYER, Skill.SMITHING - ); - - private final BankedCalculator calculator; - - public BankedCalculatorPanel(Client client, SkillCalculatorConfig config, SkillIconManager skillIconManager, ItemManager itemManager) - { - super(); - - setBorder(new EmptyBorder(10, 10, 10, 10)); - setLayout(new GridBagLayout()); - - final UICalculatorInputArea inputs = new UICalculatorInputArea(); - inputs.setBorder(new EmptyBorder(15, 0, 15, 0)); - inputs.setBackground(ColorScheme.DARK_GRAY_COLOR); - - inputs.getUiFieldTargetXP().setEditable(false); - inputs.getUiFieldTargetLevel().setEditable(false); - - calculator = new BankedCalculator(inputs, client, config, itemManager); - - // Create the Skill dropdown with icons - final JComboBox dropdown = new JComboBox<>(); - dropdown.setFocusable(false); // To prevent an annoying "focus paint" effect - dropdown.setForeground(Color.WHITE); - - final ComboBoxListRenderer renderer = new ComboBoxListRenderer(); - renderer.setDefaultText("Select a Skill..."); - //noinspection unchecked - dropdown.setRenderer(renderer); - - for (final Skill skill : BANKABLE_SKILLS) - { - final BufferedImage img = skillIconManager.getSkillImage(skill, true); - final ComboBoxIconEntry entry = new ComboBoxIconEntry(new ImageIcon(img), skill.getName(), skill); - dropdown.addItem(entry); - } - - // Add click event handler now to prevent above code from triggering it. - dropdown.addItemListener(e -> - { - if (e.getStateChange() == ItemEvent.SELECTED) - { - final ComboBoxIconEntry source = (ComboBoxIconEntry) e.getItem(); - if (source.getData() instanceof Skill) - { - final Skill skill = (Skill) source.getData(); - this.calculator.open(skill); - } - } - }); - - dropdown.setSelectedIndex(-1); - - GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.HORIZONTAL; - c.weightx = 1; - c.gridx = 0; - c.gridy = 0; - - add(dropdown, c); - c.gridy++; - add(inputs, c); - c.gridy++; - add(calculator, c); - } - - public void setBankMap(final Map bankMap) - { - calculator.setBankMap(bankMap); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/Activity.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/Activity.java deleted file mode 100644 index 4b164ea9c3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/Activity.java +++ /dev/null @@ -1,955 +0,0 @@ -/* - * 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.skillcalculator.banked.beans; - -import com.google.common.collect.ImmutableMultimap; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; -import javax.annotation.Nullable; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ItemDefinition; -import net.runelite.api.ItemID; -import net.runelite.api.Skill; -import net.runelite.client.game.ItemManager; - -@Getter(AccessLevel.PUBLIC) -public enum Activity -{ - /** - * Herblore Activities - */ - // Creating Potions - // Guam - GUAM_POTION_UNF(ItemID.GUAM_POTION_UNF, "Unfinished Potion", Skill.HERBLORE, 1, 0, - CriticalItem.GUAM_LEAF, Secondaries.UNFINISHED_POTION, new ItemStack(ItemID.GUAM_POTION_UNF, 1)), - GUAM_TAR(ItemID.GUAM_TAR, "Guam tar", Skill.HERBLORE, 19, 30, - CriticalItem.GUAM_LEAF, Secondaries.SWAMP_TAR, new ItemStack(ItemID.GUAM_TAR, 15)), - - ATTACK_POTION(ItemID.ATTACK_POTION3, "Attack potion", Skill.HERBLORE, 3, 25, - CriticalItem.GUAM_LEAF_POTION_UNF, Secondaries.ATTACK_POTION, new ItemStack(ItemID.ATTACK_POTION3, 1)), - // Marrentil - MARRENTILL_POTION_UNF(ItemID.MARRENTILL_POTION_UNF, "Unfinished potion", Skill.HERBLORE, 1, 0, - CriticalItem.MARRENTILL, Secondaries.UNFINISHED_POTION, new ItemStack(ItemID.MARRENTILL_POTION_UNF, 1)), - MARRENTILL_TAR(ItemID.MARRENTILL_TAR, "Marrentill tar", Skill.HERBLORE, 31, 42.5, - CriticalItem.MARRENTILL, Secondaries.SWAMP_TAR, new ItemStack(ItemID.MARRENTILL_TAR, 15)), - - ANTIPOISON(ItemID.ANTIPOISON3, "Antipoison", Skill.HERBLORE, 5, 37.5, - CriticalItem.MARRENTILL_POTION_UNF, Secondaries.ANTIPOISON, new ItemStack(ItemID.ANTIPOISON3, 1)), - // Tarromin - TARROMIN_POTION_UNF(ItemID.TARROMIN_POTION_UNF, "Unfinished potion", Skill.HERBLORE, 1, 0, - CriticalItem.TARROMIN, Secondaries.UNFINISHED_POTION, new ItemStack(ItemID.TARROMIN_POTION_UNF, 1)), - TARROMIN_TAR(ItemID.TARROMIN_TAR, "Tarromin tar", Skill.HERBLORE, 39, 55, - CriticalItem.TARROMIN, Secondaries.SWAMP_TAR, new ItemStack(ItemID.TARROMIN_TAR, 15)), - - STRENGTH_POTION(ItemID.STRENGTH_POTION3, "Strength potion", Skill.HERBLORE, 12, 50, - CriticalItem.TARROMIN_POTION_UNF, Secondaries.STRENGTH_POTION, new ItemStack(ItemID.STRENGTH_POTION3, 1)), - SERUM_207(ItemID.SERUM_207_3, "Serum 207", Skill.HERBLORE, 15, 50, - CriticalItem.TARROMIN_POTION_UNF, Secondaries.SERUM_207, new ItemStack(ItemID.SERUM_207_3, 1)), - // Harralander - HARRALANDER_POTION_UNF(ItemID.HARRALANDER_POTION_UNF, "Unfinished potion", Skill.HERBLORE, 1, 0, - CriticalItem.HARRALANDER, Secondaries.UNFINISHED_POTION, new ItemStack(ItemID.HARRALANDER_POTION_UNF, 1)), - HARRALANDER_TAR(ItemID.HARRALANDER_TAR, "Harralander tar", Skill.HERBLORE, 44, 72.5, - CriticalItem.HARRALANDER, Secondaries.SWAMP_TAR, new ItemStack(ItemID.HARRALANDER_TAR, 15)), - - COMPOST_POTION(ItemID.COMPOST_POTION3, "Compost potion", Skill.HERBLORE, 21, 60, - CriticalItem.HARRALANDER_POTION_UNF, Secondaries.COMPOST_POTION, new ItemStack(ItemID.COMPOST_POTION3, 1)), - RESTORE_POTION(ItemID.RESTORE_POTION3, "Restore potion", Skill.HERBLORE, 22, 62.5, - CriticalItem.HARRALANDER_POTION_UNF, Secondaries.RESTORE_POTION, new ItemStack(ItemID.RESTORE_POTION3, 1)), - ENERGY_POTION(ItemID.ENERGY_POTION3, "Energy potion", Skill.HERBLORE, 26, 67.5, - CriticalItem.HARRALANDER_POTION_UNF, Secondaries.ENERGY_POTION, new ItemStack(ItemID.ENERGY_POTION3, 1)), - COMBAT_POTION(ItemID.COMBAT_POTION3, "Combat potion", Skill.HERBLORE, 36, 84, - CriticalItem.HARRALANDER_POTION_UNF, Secondaries.COMBAT_POTION, new ItemStack(ItemID.COMBAT_POTION3, 1)), - // Ranarr Weed - RANARR_POTION_UNF(ItemID.RANARR_POTION_UNF, "Unfinished potion", Skill.HERBLORE, 30, 0, - CriticalItem.RANARR_WEED, Secondaries.UNFINISHED_POTION, new ItemStack(ItemID.RANARR_POTION_UNF, 1)), - DEFENCE_POTION(ItemID.DEFENCE_POTION3, "Defence potion", Skill.HERBLORE, 30, 75, - CriticalItem.RANARR_POTION_UNF, Secondaries.DEFENCE_POTION, new ItemStack(ItemID.DEFENCE_POTION3, 1)), - PRAYER_POTION(ItemID.PRAYER_POTION3, "Prayer potion", Skill.HERBLORE, 38, 87.5, - CriticalItem.RANARR_POTION_UNF, Secondaries.PRAYER_POTION, new ItemStack(ItemID.PRAYER_POTION3, 1)), - // Toadflax - TOADFLAX_POTION_UNF(ItemID.TOADFLAX_POTION_UNF, "Unfinished potion", Skill.HERBLORE, 34, 0, - CriticalItem.TOADFLAX, Secondaries.UNFINISHED_POTION, new ItemStack(ItemID.TOADFLAX_POTION_UNF, 1)), - AGILITY_POTION(ItemID.AGILITY_POTION3, "Agility potion", Skill.HERBLORE, 34, 80, - CriticalItem.TOADFLAX_POTION_UNF, Secondaries.AGILITY_POTION, new ItemStack(ItemID.AGILITY_POTION3, 1)), - SARADOMIN_BREW(ItemID.SARADOMIN_BREW3, "Saradomin brew", Skill.HERBLORE, 81, 180, - CriticalItem.TOADFLAX_POTION_UNF, Secondaries.SARADOMIN_BREW, new ItemStack(ItemID.SARADOMIN_BREW3, 1)), - // Irit - IRIT_POTION_UNF(ItemID.IRIT_POTION_UNF, "Unfinished potion", Skill.HERBLORE, 45, 0, - CriticalItem.IRIT_LEAF, Secondaries.UNFINISHED_POTION, new ItemStack(ItemID.IRIT_POTION_UNF, 1)), - SUPER_ATTACK(ItemID.SUPER_ATTACK3, "Super attack", Skill.HERBLORE, 45, 100, - CriticalItem.IRIT_POTION_UNF, Secondaries.SUPER_ATTACK, new ItemStack(ItemID.SUPER_ATTACK3, 1)), - SUPERANTIPOISON(ItemID.SUPERANTIPOISON3, "Superantipoison", Skill.HERBLORE, 48, 106.3, - CriticalItem.IRIT_POTION_UNF, Secondaries.SUPERANTIPOISON, new ItemStack(ItemID.SUPERANTIPOISON3, 1)), - // Avantoe - AVANTOE_POTION_UNF(ItemID.AVANTOE_POTION_UNF, "Unfinished potion", Skill.HERBLORE, 50, 0, - CriticalItem.AVANTOE, Secondaries.UNFINISHED_POTION, new ItemStack(ItemID.AVANTOE_POTION_UNF, 1)), - FISHING_POTION(ItemID.FISHING_POTION3, "Fishing potion", Skill.HERBLORE, 50, 112.5, - CriticalItem.AVANTOE_POTION_UNF, Secondaries.FISHING_POTION, new ItemStack(ItemID.FISHING_POTION3, 1)), - SUPER_ENERGY_POTION(ItemID.SUPER_ENERGY3_20549, "Super energy potion", Skill.HERBLORE, 52, 117.5, - CriticalItem.AVANTOE_POTION_UNF, Secondaries.SUPER_ENERGY_POTION, new ItemStack(ItemID.SUPER_ENERGY3_20549, 1)), - HUNTER_POTION(ItemID.HUNTER_POTION3, "Hunter potion", Skill.HERBLORE, 53, 120, - CriticalItem.AVANTOE_POTION_UNF, Secondaries.HUNTER_POTION, new ItemStack(ItemID.HUNTER_POTION3, 1)), - // Kwuarm - KWUARM_POTION_UNF(ItemID.KWUARM_POTION_UNF, "Unfinished potion", Skill.HERBLORE, 55, 0, - CriticalItem.KWUARM, Secondaries.UNFINISHED_POTION, new ItemStack(ItemID.KWUARM_POTION_UNF, 1)), - SUPER_STRENGTH(ItemID.SUPER_STRENGTH3, "Super strength", Skill.HERBLORE, 55, 125, - CriticalItem.KWUARM_POTION_UNF, Secondaries.SUPER_STRENGTH, new ItemStack(ItemID.SUPER_STRENGTH3, 1)), - // Snapdragon - SNAPDRAGON_POTION_UNF(ItemID.SNAPDRAGON_POTION_UNF, "Unfinished potion", Skill.HERBLORE, 63, 0, - CriticalItem.SNAPDRAGON, Secondaries.UNFINISHED_POTION, new ItemStack(ItemID.SNAPDRAGON_POTION_UNF, 1)), - SUPER_RESTORE(ItemID.SUPER_RESTORE3, "Super restore", Skill.HERBLORE, 63, 142.5, - CriticalItem.SNAPDRAGON_POTION_UNF, Secondaries.SUPER_RESTORE, new ItemStack(ItemID.SUPER_RESTORE3, 1)), - SANFEW_SERUM(ItemID.SANFEW_SERUM3, "Sanfew serum", Skill.HERBLORE, 65, 160, - CriticalItem.SNAPDRAGON_POTION_UNF, Secondaries.SANFEW_SERUM, new ItemStack(ItemID.SANFEW_SERUM3, 1)), - // Cadantine - CADANTINE_POTION_UNF(ItemID.CADANTINE_POTION_UNF, "Unfinished potion", Skill.HERBLORE, 66, 0, - CriticalItem.CADANTINE, Secondaries.UNFINISHED_POTION, new ItemStack(ItemID.CADANTINE_POTION_UNF, 1)), - SUPER_DEFENCE_POTION(ItemID.SUPER_DEFENCE3, "Super defence", Skill.HERBLORE, 66, 150, - CriticalItem.CADANTINE_POTION_UNF, Secondaries.SUPER_DEFENCE_POTION, new ItemStack(ItemID.SUPER_DEFENCE3, 1)), - // Lantadyme - LANTADYME_POTION_UNF(ItemID.LANTADYME_POTION_UNF, "Unfinished potion", Skill.HERBLORE, 69, 0, - CriticalItem.LANTADYME, Secondaries.UNFINISHED_POTION, new ItemStack(ItemID.LANTADYME_POTION_UNF, 1)), - ANTIFIRE_POTION(ItemID.ANTIFIRE_POTION3, "Anti-fire potion", Skill.HERBLORE, 69, 157.5, - CriticalItem.LANTADYME_POTION_UNF, Secondaries.ANTIFIRE_POTION, new ItemStack(ItemID.ANTIFIRE_POTION3, 1)), - MAGIC_POTION(ItemID.MAGIC_POTION3, "Magic potion", Skill.HERBLORE, 76, 172.5, - CriticalItem.LANTADYME_POTION_UNF, Secondaries.MAGIC_POTION, new ItemStack(ItemID.MAGIC_POTION3, 1)), - // Dwarf Weed - DWARF_WEED_POTION_UNF(ItemID.DWARF_WEED_POTION_UNF, "Unfinished potion", Skill.HERBLORE, 72, 0, - CriticalItem.DWARF_WEED, Secondaries.UNFINISHED_POTION, new ItemStack(ItemID.DWARF_WEED_POTION_UNF, 1)), - RANGING_POTION(ItemID.RANGING_POTION3, "Ranging potion", Skill.HERBLORE, 72, 162.5, - CriticalItem.DWARF_WEED_POTION_UNF, Secondaries.RANGING_POTION, new ItemStack(ItemID.RANGING_POTION3, 1)), - // Torstol - TORSTOL_POTION_UNF(ItemID.TORSTOL_POTION_UNF, "Unfinished potion", Skill.HERBLORE, 78, 0, - CriticalItem.TORSTOL, Secondaries.UNFINISHED_POTION, new ItemStack(ItemID.TORSTOL_POTION_UNF, 1)), - SUPER_COMBAT_POTION(ItemID.SUPER_COMBAT_POTION4, "Super combat", Skill.HERBLORE, 90, 150, - CriticalItem.TORSTOL, Secondaries.SUPER_COMBAT_POTION, new ItemStack(ItemID.SUPER_COMBAT_POTION4, 1)), - ANTIVENOM_PLUS(ItemID.ANTIVENOM3_12915, "Anti-venom+", Skill.HERBLORE, 94, 125, - CriticalItem.TORSTOL, Secondaries.ANTIVENOM_PLUS, new ItemStack(ItemID.ANTIVENOM3_12915, 1)), - - ZAMORAK_BREW(ItemID.ZAMORAK_BREW3, "Zamorak brew", Skill.HERBLORE, 78, 175, - CriticalItem.TORSTOL_POTION_UNF, Secondaries.ZAMORAK_BREW, new ItemStack(ItemID.ZAMORAK_BREW3, 1)), - - // Cleaning Grimy Herbs - CLEAN_GUAM(ItemID.GUAM_LEAF, "Clean guam", Skill.HERBLORE, 3, 2.5, - CriticalItem.GRIMY_GUAM_LEAF, null, new ItemStack(ItemID.GUAM_LEAF, 1)), - CLEAN_MARRENTILL(ItemID.MARRENTILL, "Clean marrentill", Skill.HERBLORE, 5, 3.8, - CriticalItem.GRIMY_MARRENTILL, null, new ItemStack(ItemID.MARRENTILL, 1)), - CLEAN_TARROMIN(ItemID.TARROMIN, "Clean tarromin", Skill.HERBLORE, 11, 5, - CriticalItem.GRIMY_TARROMIN, null, new ItemStack(ItemID.TARROMIN, 1)), - CLEAN_HARRALANDER(ItemID.HARRALANDER, "Clean harralander", Skill.HERBLORE, 20, 6.3, - CriticalItem.GRIMY_HARRALANDER, null, new ItemStack(ItemID.HARRALANDER, 1)), - CLEAN_RANARR_WEED(ItemID.RANARR_WEED, "Clean ranarr weed", Skill.HERBLORE, 25, 7.5, - CriticalItem.GRIMY_RANARR_WEED, null, new ItemStack(ItemID.RANARR_WEED, 1)), - CLEAN_TOADFLAX(ItemID.TOADFLAX, "Clean toadflax", Skill.HERBLORE, 30, 8, - CriticalItem.GRIMY_TOADFLAX, null, new ItemStack(ItemID.TOADFLAX, 1)), - CLEAN_IRIT_LEAF(ItemID.IRIT_LEAF, "Clean irit leaf", Skill.HERBLORE, 40, 8.8, - CriticalItem.GRIMY_IRIT_LEAF, null, new ItemStack(ItemID.IRIT_LEAF, 1)), - CLEAN_AVANTOE(ItemID.AVANTOE, "Clean avantoe", Skill.HERBLORE, 48, 10, - CriticalItem.GRIMY_AVANTOE, null, new ItemStack(ItemID.AVANTOE, 1)), - CLEAN_KWUARM(ItemID.KWUARM, "Clean kwuarm", Skill.HERBLORE, 54, 11.3, - CriticalItem.GRIMY_KWUARM, null, new ItemStack(ItemID.KWUARM, 1)), - CLEAN_SNAPDRAGON(ItemID.SNAPDRAGON, "Clean snapdragon", Skill.HERBLORE, 59, 11.8, - CriticalItem.GRIMY_SNAPDRAGON, null, new ItemStack(ItemID.SNAPDRAGON, 1)), - CLEAN_CADANTINE(ItemID.CADANTINE, "Clean cadantine", Skill.HERBLORE, 65, 12.5, - CriticalItem.GRIMY_CADANTINE, null, new ItemStack(ItemID.CADANTINE, 1)), - CLEAN_LANTADYME(ItemID.LANTADYME, "Clean lantadyme", Skill.HERBLORE, 67, 13.1, - CriticalItem.GRIMY_LANTADYME, null, new ItemStack(ItemID.LANTADYME, 1)), - CLEAN_DWARF_WEED(ItemID.DWARF_WEED, "Clean dwarf weed", Skill.HERBLORE, 70, 13.8, - CriticalItem.GRIMY_DWARF_WEED, null, new ItemStack(ItemID.DWARF_WEED, 1)), - CLEAN_TORSTOL(ItemID.TORSTOL, "Clean torstol", Skill.HERBLORE, 75, 15, - CriticalItem.GRIMY_TORSTOL, null, new ItemStack(ItemID.TORSTOL, 1)), - - /** - * Construction Options - */ - PLANK(ItemID.PLANK, "Regular Plank", Skill.CONSTRUCTION, 1, 0, - CriticalItem.CON_LOGS, Secondaries.COINS_100, new ItemStack(ItemID.PLANK, 1)), - PLANKS(ItemID.PLANK, "Regular plank products", Skill.CONSTRUCTION, 1, 29, - CriticalItem.PLANK, null, null), - OAK_PLANK(ItemID.OAK_PLANK, "Oak Plank", Skill.CONSTRUCTION, 1, 0, - CriticalItem.CON_OAK_LOGS, Secondaries.COINS_250, new ItemStack(ItemID.OAK_PLANK, 1)), - OAK_PLANKS(ItemID.OAK_PLANK, "Oak products", Skill.CONSTRUCTION, 1, 60, - CriticalItem.OAK_PLANK, null, null), - TEAK_PLANK(ItemID.TEAK_PLANK, "Teak Plank", Skill.CONSTRUCTION, 1, 0, - CriticalItem.CON_TEAK_LOGS, Secondaries.COINS_500, new ItemStack(ItemID.TEAK_PLANK, 1)), - TEAK_PLANKS(ItemID.TEAK_PLANK, "Teak products", Skill.CONSTRUCTION, 1, 90, - CriticalItem.TEAK_PLANK, null, null), - MYTHICAL_CAPE(ItemID.MYTHICAL_CAPE, "Mythical cape rakes", Skill.CONSTRUCTION, 1, 123.33, - CriticalItem.TEAK_PLANK, null, null), - MAHOGANY_PLANK(ItemID.MAHOGANY_PLANK, "Mahogany Plank", Skill.CONSTRUCTION, 1, 0, - CriticalItem.CON_MAHOGANY_LOGS, Secondaries.COINS_1500, new ItemStack(ItemID.MAHOGANY_PLANK, 1)), - MAHOGANY_PLANKS(ItemID.MAHOGANY_PLANK, "Mahogany products", Skill.CONSTRUCTION, 1, 140, - CriticalItem.MAHOGANY_PLANK, null, null), - - /** - * Prayer Options - */ - BONES(ItemID.BONES, "Bones", Skill.PRAYER, 1, 4.5, - CriticalItem.BONES, null, null), - WOLF_BONES(ItemID.WOLF_BONES, "Wolf bones", Skill.PRAYER, 1, 4.5, - CriticalItem.WOLF_BONES, null, null), - BURNT_BONES(ItemID.BURNT_BONES, "Burnt bones", Skill.PRAYER, 1, 4.5, - CriticalItem.BURNT_BONES, null, null), - MONKEY_BONES(ItemID.MONKEY_BONES, "Monkey bones", Skill.PRAYER, 1, 5.0, - CriticalItem.MONKEY_BONES, null, null), - BAT_BONES(ItemID.BAT_BONES, "Bat bones", Skill.PRAYER, 1, 5.3, - CriticalItem.BAT_BONES, null, null), - JOGRE_BONES(ItemID.JOGRE_BONES, "Jogre bones", Skill.PRAYER, 1, 15.0, - CriticalItem.JOGRE_BONES, null, null), - BIG_BONES(ItemID.BIG_BONES, "Big bones", Skill.PRAYER, 1, 15.0, - CriticalItem.BIG_BONES, null, null), - ZOGRE_BONES(ItemID.ZOGRE_BONES, "Zogre bones", Skill.PRAYER, 1, 22.5, - CriticalItem.ZOGRE_BONES, null, null), - SHAIKAHAN_BONES(ItemID.SHAIKAHAN_BONES, "Shaikahan bones", Skill.PRAYER, 1, 25.0, - CriticalItem.SHAIKAHAN_BONES, null, null), - BABYDRAGON_BONES(ItemID.BABYDRAGON_BONES, "Babydragon bones", Skill.PRAYER, 1, 30.0, - CriticalItem.BABYDRAGON_BONES, null, null), - WYRM_BONES(ItemID.WYRM_BONES, "Wyrm bones", Skill.PRAYER, 1, 50, - CriticalItem.WYRM_BONES, null, null), - WYVERN_BONES(ItemID.WYVERN_BONES, "Wyvern bones", Skill.PRAYER, 1, 72.0, - CriticalItem.WYVERN_BONES, null, null), - DRAGON_BONES(ItemID.DRAGON_BONES, "Dragon bones", Skill.PRAYER, 1, 72.0, - CriticalItem.DRAGON_BONES, null, null), - DRAKE_BONES(ItemID.DRAKE_BONES, "Drake bones", Skill.PRAYER, 1, 80, - CriticalItem.DRAKE_BONES, null, null), - FAYRG_BONES(ItemID.FAYRG_BONES, "Fayrg bones", Skill.PRAYER, 1, 84.0, - CriticalItem.FAYRG_BONES, null, null), - LAVA_DRAGON_BONES(ItemID.LAVA_DRAGON_BONES, "Lava dragon bones", Skill.PRAYER, 1, 85.0, - CriticalItem.LAVA_DRAGON_BONES, null, null), - RAURG_BONES(ItemID.RAURG_BONES, "Raurg bones", Skill.PRAYER, 1, 96.0, - CriticalItem.RAURG_BONES, null, null), - HYDRA_BONES(ItemID.HYDRA_BONES, "Hydra bones", Skill.PRAYER, 1, 110, - CriticalItem.HYDRA_BONES, null, null), - DAGANNOTH_BONES(ItemID.DAGANNOTH_BONES, "Dagannoth bones", Skill.PRAYER, 1, 125.0, - CriticalItem.DAGANNOTH_BONES, null, null), - OURG_BONES(ItemID.OURG_BONES, "Ourg bones", Skill.PRAYER, 1, 140.0, - CriticalItem.OURG_BONES, null, null), - SUPERIOR_DRAGON_BONES(ItemID.SUPERIOR_DRAGON_BONES, "Superior dragon bones", Skill.PRAYER, 1, 150.0, - CriticalItem.SUPERIOR_DRAGON_BONES, null, null), - // Shade Remains (Pyre Logs) - LOAR_REMAINS(ItemID.LOAR_REMAINS, "Loar remains", Skill.PRAYER, 1, 33.0, - CriticalItem.LOAR_REMAINS, null, null), - PHRIN_REMAINS(ItemID.PHRIN_REMAINS, "Phrin remains", Skill.PRAYER, 1, 46.5, - CriticalItem.PHRIN_REMAINS, null, null), - RIYL_REMAINS(ItemID.RIYL_REMAINS, "Riyl remains", Skill.PRAYER, 1, 59.5, - CriticalItem.RIYL_REMAINS, null, null), - ASYN_REMAINS(ItemID.ASYN_REMAINS, "Asyn remains", Skill.PRAYER, 1, 82.5, - CriticalItem.ASYN_REMAINS, null, null), - FIYR_REMAINS(ItemID.FIYR_REMAINS, "Fiyre remains", Skill.PRAYER, 1, 84.0, - CriticalItem.FIYR_REMAINS, null, null), - // Ensouled Heads - ENSOULED_GOBLIN_HEAD(ItemID.ENSOULED_GOBLIN_HEAD_13448, "Ensouled goblin head", Skill.PRAYER, 1, 130.0, - CriticalItem.ENSOULED_GOBLIN_HEAD, null, null), - ENSOULED_MONKEY_HEAD(ItemID.ENSOULED_MONKEY_HEAD_13451, "Ensouled monkey head", Skill.PRAYER, 1, 182.0, - CriticalItem.ENSOULED_MONKEY_HEAD, null, null), - ENSOULED_IMP_HEAD(ItemID.ENSOULED_IMP_HEAD_13454, "Ensouled imp head", Skill.PRAYER, 1, 286.0, - CriticalItem.ENSOULED_IMP_HEAD, null, null), - ENSOULED_MINOTAUR_HEAD(ItemID.ENSOULED_MINOTAUR_HEAD_13457, "Ensouled minotaur head", Skill.PRAYER, 1, 364.0, - CriticalItem.ENSOULED_MINOTAUR_HEAD, null, null), - ENSOULED_SCORPION_HEAD(ItemID.ENSOULED_SCORPION_HEAD_13460, "Ensouled scorpion head", Skill.PRAYER, 1, 454.0, - CriticalItem.ENSOULED_SCORPION_HEAD, null, null), - ENSOULED_BEAR_HEAD(ItemID.ENSOULED_BEAR_HEAD_13463, "Ensouled bear head", Skill.PRAYER, 1, 480.0, - CriticalItem.ENSOULED_BEAR_HEAD, null, null), - ENSOULED_UNICORN_HEAD(ItemID.ENSOULED_UNICORN_HEAD_13466, "Ensouled unicorn head", Skill.PRAYER, 1, 494.0, - CriticalItem.ENSOULED_UNICORN_HEAD, null, null), - ENSOULED_DOG_HEAD(ItemID.ENSOULED_DOG_HEAD_13469, "Ensouled dog head", Skill.PRAYER, 1, 520.0, - CriticalItem.ENSOULED_DOG_HEAD, null, null), - ENSOULED_CHAOS_DRUID_HEAD(ItemID.ENSOULED_CHAOS_DRUID_HEAD_13472, "Ensouled druid head", Skill.PRAYER, 1, 584.0, - CriticalItem.ENSOULED_CHAOS_DRUID_HEAD, null, null), - ENSOULED_GIANT_HEAD(ItemID.ENSOULED_GIANT_HEAD_13475, "Ensouled giant head", Skill.PRAYER, 1, 650.0, - CriticalItem.ENSOULED_GIANT_HEAD, null, null), - ENSOULED_OGRE_HEAD(ItemID.ENSOULED_OGRE_HEAD_13478, "Ensouled ogre head", Skill.PRAYER, 1, 716.0, - CriticalItem.ENSOULED_OGRE_HEAD, null, null), - ENSOULED_ELF_HEAD(ItemID.ENSOULED_ELF_HEAD_13481, "Ensouled elf head", Skill.PRAYER, 1, 754.0, - CriticalItem.ENSOULED_ELF_HEAD, null, null), - ENSOULED_TROLL_HEAD(ItemID.ENSOULED_TROLL_HEAD_13484, "Ensouled troll head", Skill.PRAYER, 1, 780.0, - CriticalItem.ENSOULED_TROLL_HEAD, null, null), - ENSOULED_HORROR_HEAD(ItemID.ENSOULED_HORROR_HEAD_13487, "Ensouled horror head", Skill.PRAYER, 1, 832.0, - CriticalItem.ENSOULED_HORROR_HEAD, null, null), - ENSOULED_KALPHITE_HEAD(ItemID.ENSOULED_KALPHITE_HEAD_13490, "Ensouled kalphite head", Skill.PRAYER, 1, 884.0, - CriticalItem.ENSOULED_KALPHITE_HEAD, null, null), - ENSOULED_DAGANNOTH_HEAD(ItemID.ENSOULED_DAGANNOTH_HEAD_13493, "Ensouled dagannoth head", Skill.PRAYER, 1, 936.0, - CriticalItem.ENSOULED_DAGANNOTH_HEAD, null, null), - ENSOULED_BLOODVELD_HEAD(ItemID.ENSOULED_BLOODVELD_HEAD_13496, "Ensouled bloodveld head", Skill.PRAYER, 1, 1040.0, - CriticalItem.ENSOULED_BLOODVELD_HEAD, null, null), - ENSOULED_TZHAAR_HEAD(ItemID.ENSOULED_TZHAAR_HEAD_13499, "Ensouled tzhaar head", Skill.PRAYER, 1, 1104.0, - CriticalItem.ENSOULED_TZHAAR_HEAD, null, null), - ENSOULED_DEMON_HEAD(ItemID.ENSOULED_DEMON_HEAD_13502, "Ensouled demon head", Skill.PRAYER, 1, 1170.0, - CriticalItem.ENSOULED_DEMON_HEAD, null, null), - ENSOULED_AVIANSIE_HEAD(ItemID.ENSOULED_AVIANSIE_HEAD_13505, "Ensouled aviansie head", Skill.PRAYER, 1, 1234.0, - CriticalItem.ENSOULED_AVIANSIE_HEAD, null, null), - ENSOULED_ABYSSAL_HEAD(ItemID.ENSOULED_ABYSSAL_HEAD_13508, "Ensouled abyssal head", Skill.PRAYER, 1, 1300.0, - CriticalItem.ENSOULED_ABYSSAL_HEAD, null, null), - ENSOULED_DRAGON_HEAD(ItemID.ENSOULED_DRAGON_HEAD_13511, "Ensouled dragon head", Skill.PRAYER, 1, 1560.0, - CriticalItem.ENSOULED_DRAGON_HEAD, null, null), - - /* - * Cooking Items - */ - COOK_HERRING(ItemID.HERRING, "Herring", Skill.COOKING, 5, 50.0, - CriticalItem.RAW_HERRING, null, new ItemStack(ItemID.HERRING, 1)), - COOK_MACKEREL(ItemID.MACKEREL, "Mackerel", Skill.COOKING, 10, 60.0, - CriticalItem.RAW_MACKEREL, null, new ItemStack(ItemID.MACKEREL, 1)), - COOK_TROUT(ItemID.TROUT, "Trout", Skill.COOKING, 15, 70.0, - CriticalItem.RAW_TROUT, null, new ItemStack(ItemID.TROUT, 1)), - COOK_COD(ItemID.COD, "Cod", Skill.COOKING, 18, 75.0, - CriticalItem.RAW_COD, null, new ItemStack(ItemID.COD, 1)), - COOK_PIKE(ItemID.PIKE, "Pike", Skill.COOKING, 20, 80.0, - CriticalItem.RAW_PIKE, null, new ItemStack(ItemID.PIKE, 1)), - COOK_SALMON(ItemID.SALMON, "Salmon", Skill.COOKING, 25, 90.0, - CriticalItem.RAW_SALMON, null, new ItemStack(ItemID.SALMON, 1)), - COOK_TUNA(ItemID.TUNA, "Tuna", Skill.COOKING, 30, 100.0, - CriticalItem.RAW_TUNA, null, new ItemStack(ItemID.TUNA, 1)), - COOK_KARAMBWAN(ItemID.COOKED_KARAMBWAN, "Cooked Karambwan", Skill.COOKING, 30, 190.0, - CriticalItem.RAW_KARAMBWAN, null, new ItemStack(ItemID.COOKED_KARAMBWAN, 1)), - COOK_LOBSTER(ItemID.LOBSTER, "Lobster", Skill.COOKING, 40, 120.0, - CriticalItem.RAW_LOBSTER, null, new ItemStack(ItemID.LOBSTER, 1)), - COOK_BASS(ItemID.BASS, "Bass", Skill.COOKING, 43, 130.0, - CriticalItem.RAW_BASS, null, new ItemStack(ItemID.BASS, 1)), - COOK_SWORDFISH(ItemID.SWORDFISH, "Swordfish", Skill.COOKING, 45, 140.0, - CriticalItem.RAW_SWORDFISH, null, new ItemStack(ItemID.SWORDFISH, 1)), - COOK_MONKFISH(ItemID.MONKFISH, "Monkfish", Skill.COOKING, 62, 150.0, - CriticalItem.RAW_MONKFISH, null, new ItemStack(ItemID.MONKFISH, 1)), - COOK_SHARK(ItemID.SHARK, "Shark", Skill.COOKING, 80, 210.0, - CriticalItem.RAW_SHARK, null, new ItemStack(ItemID.SHARK, 1)), - COOK_SEA_TURTLE(ItemID.SEA_TURTLE, "Sea turtle", Skill.COOKING, 82, 211.3, - CriticalItem.RAW_SEA_TURTLE, null, new ItemStack(ItemID.SEA_TURTLE, 1)), - COOK_ANGLERFISH(ItemID.ANGLERFISH, "Anglerfish", Skill.COOKING, 84, 230.0, - CriticalItem.RAW_ANGLERFISH, null, new ItemStack(ItemID.ANGLERFISH, 1)), - COOK_DARK_CRAB(ItemID.DARK_CRAB, "Dark crab", Skill.COOKING, 90, 215.0, - CriticalItem.RAW_DARK_CRAB, null, new ItemStack(ItemID.DARK_CRAB, 1)), - COOK_MANTA_RAY(ItemID.MANTA_RAY, "Manta ray", Skill.COOKING, 91, 216.2, - CriticalItem.RAW_MANTA_RAY, null, new ItemStack(ItemID.MANTA_RAY, 1)), - WINE(ItemID.JUG_OF_WINE, "Jug of wine", Skill.COOKING, 35, 200, - CriticalItem.GRAPES, Secondaries.JUG_OF_WATER, new ItemStack(ItemID.JUG_OF_WINE, 1)), - - /* - * Crafting Items - */ - // Spinning - BALL_OF_WOOL(ItemID.BALL_OF_WOOL, "Ball of wool", Skill.CRAFTING, 1, 2.5, - CriticalItem.WOOL, null, new ItemStack(ItemID.BALL_OF_WOOL, 1)), - BOW_STRING(ItemID.BOW_STRING, "Bow string", Skill.CRAFTING, 1, 15, - CriticalItem.FLAX, null, new ItemStack(ItemID.BOW_STRING, 1)), - // Glass Blowing - BEER_GLASS(ItemID.BEER_GLASS, "Beer glass", Skill.CRAFTING, 1, 17.5, - CriticalItem.MOLTEN_GLASS, null, new ItemStack(ItemID.BEER_GLASS, 1)), - CANDLE_LANTERN(ItemID.CANDLE_LANTERN, "Candle lantern", Skill.CRAFTING, 4, 19, - CriticalItem.MOLTEN_GLASS, null, new ItemStack(ItemID.CANDLE_LANTERN, 1)), - OIL_LAMP(ItemID.OIL_LAMP, "Oil lamp", Skill.CRAFTING, 12, 25, - CriticalItem.MOLTEN_GLASS, null, new ItemStack(ItemID.OIL_LAMP, 1)), - VIAL(ItemID.VIAL, "Vial", Skill.CRAFTING, 33, 35, - CriticalItem.MOLTEN_GLASS, null, new ItemStack(ItemID.VIAL, 1)), - EMPTY_FISHBOWL(ItemID.EMPTY_FISHBOWL, "Empty fishbowl", Skill.CRAFTING, 42, 42.5, - CriticalItem.MOLTEN_GLASS, null, new ItemStack(ItemID.EMPTY_FISHBOWL, 1)), - UNPOWERED_ORB(ItemID.UNPOWERED_ORB, "Unpowered orb", Skill.CRAFTING, 46, 52.5, - CriticalItem.MOLTEN_GLASS, null, new ItemStack(ItemID.UNPOWERED_ORB, 1)), - LANTERN_LENS(ItemID.LANTERN_LENS, "Lantern lens", Skill.CRAFTING, 49, 55, - CriticalItem.MOLTEN_GLASS, null, new ItemStack(ItemID.LANTERN_LENS, 1)), - LIGHT_ORB(ItemID.LIGHT_ORB, "Light orb", Skill.CRAFTING, 87, 70, - CriticalItem.MOLTEN_GLASS, null, new ItemStack(ItemID.LIGHT_ORB, 1)), - - // D'hide/Dragon Leather - GREEN_DRAGONHIDE(ItemID.GREEN_DRAGON_LEATHER, "Tan Green D'hide", Skill.CRAFTING, 57, 0, - CriticalItem.GREEN_DRAGONHIDE, null, new ItemStack(ItemID.GREEN_DRAGON_LEATHER, 1)), - BLUE_DRAGONHIDE(ItemID.BLUE_DRAGON_LEATHER, "Tan Blue D'hide", Skill.CRAFTING, 66, 0, - CriticalItem.BLUE_DRAGONHIDE, null, new ItemStack(ItemID.BLUE_DRAGON_LEATHER, 1)), - RED_DRAGONHIDE(ItemID.RED_DRAGON_LEATHER, "Tan Red D'hide", Skill.CRAFTING, 73, 0, - CriticalItem.RED_DRAGONHIDE, null, new ItemStack(ItemID.RED_DRAGON_LEATHER, 1)), - BLACK_DRAGONHIDE(ItemID.BLACK_DRAGON_LEATHER, "Tan Black D'hide", Skill.CRAFTING, 79, 0, - CriticalItem.BLACK_DRAGONHIDE, null, new ItemStack(ItemID.BLACK_DRAGON_LEATHER, 1)), - - GREEN_DRAGON_LEATHER(ItemID.GREEN_DHIDE_VAMB, "Green D'hide product", Skill.CRAFTING, 57, 62.0, - CriticalItem.GREEN_DRAGON_LEATHER, null, null), - BLUE_DRAGON_LEATHER(ItemID.BLUE_DHIDE_VAMB, "Blue D'hide product", Skill.CRAFTING, 66, 70.0, - CriticalItem.BLUE_DRAGON_LEATHER, null, null), - RED_DRAGON_LEATHER(ItemID.RED_DHIDE_VAMB, "Red D'hide product", Skill.CRAFTING, 73, 78.0, - CriticalItem.RED_DRAGON_LEATHER, null, null), - BLACK_DRAGON_LEATHER(ItemID.BLACK_DHIDE_VAMB, "Black D'hide product", Skill.CRAFTING, 79, 86.0, - CriticalItem.BLACK_DRAGON_LEATHER, null, null), - - // Uncut Gems - UNCUT_OPAL(ItemID.OPAL, "Cut opal", Skill.CRAFTING, 1, 15.0, - CriticalItem.UNCUT_OPAL, null, new ItemStack(ItemID.OPAL, 1)), - UNCUT_JADE(ItemID.JADE, "Cut jade", Skill.CRAFTING, 13, 20.0, - CriticalItem.UNCUT_JADE, null, new ItemStack(ItemID.JADE, 1)), - UNCUT_RED_TOPAZ(ItemID.RED_TOPAZ, "Cut red topaz", Skill.CRAFTING, 16, 25.0, - CriticalItem.UNCUT_RED_TOPAZ, null, new ItemStack(ItemID.RED_TOPAZ, 1)), - UNCUT_SAPPHIRE(ItemID.SAPPHIRE, "Cut sapphire", Skill.CRAFTING, 20, 50.0, - CriticalItem.UNCUT_SAPPHIRE, null, new ItemStack(ItemID.SAPPHIRE, 1)), - UNCUT_EMERALD(ItemID.EMERALD, "Cut emerald", Skill.CRAFTING, 27, 67.5, - CriticalItem.UNCUT_EMERALD, null, new ItemStack(ItemID.EMERALD, 1)), - UNCUT_RUBY(ItemID.RUBY, "Cut ruby", Skill.CRAFTING, 34, 85, - CriticalItem.UNCUT_RUBY, null, new ItemStack(ItemID.RUBY, 1)), - UNCUT_DIAMOND(ItemID.DIAMOND, "Cut diamond", Skill.CRAFTING, 43, 107.5, - CriticalItem.UNCUT_DIAMOND, null, new ItemStack(ItemID.DIAMOND, 1)), - UNCUT_DRAGONSTONE(ItemID.DRAGONSTONE, "Cut dragonstone", Skill.CRAFTING, 55, 137.5, - CriticalItem.UNCUT_DRAGONSTONE, null, new ItemStack(ItemID.DRAGONSTONE, 1)), - UNCUT_ONYX(ItemID.ONYX, "Cut onyx", Skill.CRAFTING, 67, 167.5, - CriticalItem.UNCUT_ONYX, null, new ItemStack(ItemID.ONYX, 1)), - UNCUT_ZENYTE(ItemID.ZENYTE, "Cut zenyte", Skill.CRAFTING, 89, 200.0, - CriticalItem.UNCUT_ZENYTE, null, new ItemStack(ItemID.ZENYTE, 1)), - // Silver Jewelery - OPAL_RING(ItemID.OPAL_RING, "Opal ring", Skill.CRAFTING, 1, 10, - CriticalItem.OPAL, Secondaries.SILVER_BAR, new ItemStack(ItemID.OPAL_RING, 1)), - OPAL_NECKLACE(ItemID.OPAL_NECKLACE, "Opal necklace", Skill.CRAFTING, 16, 35, - CriticalItem.OPAL, Secondaries.SILVER_BAR, new ItemStack(ItemID.OPAL_NECKLACE, 1)), - OPAL_BRACELET(ItemID.OPAL_BRACELET, "Opal bracelet", Skill.CRAFTING, 22, 45, - CriticalItem.OPAL, Secondaries.SILVER_BAR, new ItemStack(ItemID.OPAL_BRACELET, 1)), - OPAL_AMULET(ItemID.OPAL_AMULET, "Opal amulet", Skill.CRAFTING, 27, 55, - CriticalItem.OPAL, Secondaries.SILVER_BAR, new ItemStack(ItemID.OPAL_AMULET, 1)), - JADE_RING(ItemID.JADE_RING, "Jade ring", Skill.CRAFTING, 13, 32, - CriticalItem.JADE, Secondaries.SILVER_BAR, new ItemStack(ItemID.JADE_RING, 1)), - JADE_NECKLACE(ItemID.JADE_NECKLACE, "Jade necklace", Skill.CRAFTING, 25, 54, - CriticalItem.JADE, Secondaries.SILVER_BAR, new ItemStack(ItemID.JADE_NECKLACE, 1)), - JADE_BRACELET(ItemID.JADE_BRACELET, "Jade bracelet", Skill.CRAFTING, 29, 60, - CriticalItem.JADE, Secondaries.SILVER_BAR, new ItemStack(ItemID.JADE_BRACELET, 1)), - JADE_AMULET(ItemID.JADE_AMULET, "Jade amulet", Skill.CRAFTING, 34, 70, - CriticalItem.JADE, Secondaries.SILVER_BAR, new ItemStack(ItemID.JADE_AMULET, 1)), - TOPAZ_RING(ItemID.TOPAZ_RING, "Topaz ring", Skill.CRAFTING, 16, 35, - CriticalItem.RED_TOPAZ, Secondaries.SILVER_BAR, new ItemStack(ItemID.TOPAZ_RING, 1)), - TOPAZ_NECKLACE(ItemID.TOPAZ_NECKLACE, "Topaz necklace", Skill.CRAFTING, 32, 70, - CriticalItem.RED_TOPAZ, Secondaries.SILVER_BAR, new ItemStack(ItemID.TOPAZ_NECKLACE, 1)), - TOPAZ_BRACELET(ItemID.TOPAZ_BRACELET, "Topaz bracelet", Skill.CRAFTING, 38, 75, - CriticalItem.RED_TOPAZ, Secondaries.SILVER_BAR, new ItemStack(ItemID.TOPAZ_BRACELET, 1)), - TOPAZ_AMULET(ItemID.TOPAZ_AMULET, "Topaz amulet", Skill.CRAFTING, 45, 80, - CriticalItem.RED_TOPAZ, Secondaries.SILVER_BAR, new ItemStack(ItemID.TOPAZ_AMULET, 1)), - // Gold Jewelery - SAPPHIRE_RING(ItemID.SAPPHIRE_RING, "Sapphire ring", Skill.CRAFTING, 20, 40, - CriticalItem.SAPPHIRE, Secondaries.GOLD_BAR, new ItemStack(ItemID.SAPPHIRE_RING, 1)), - SAPPHIRE_NECKLACE(ItemID.SAPPHIRE_NECKLACE, "Sapphire necklace", Skill.CRAFTING, 22, 55, - CriticalItem.SAPPHIRE, Secondaries.GOLD_BAR, new ItemStack(ItemID.SAPPHIRE_NECKLACE, 1)), - SAPPHIRE_BRACELET(ItemID.SAPPHIRE_BRACELET, "Sapphire bracelet", Skill.CRAFTING, 23, 60, - CriticalItem.SAPPHIRE, Secondaries.GOLD_BAR, new ItemStack(ItemID.SAPPHIRE_BRACELET, 1)), - SAPPHIRE_AMULET(ItemID.SAPPHIRE_AMULET, "Sapphire amulet", Skill.CRAFTING, 24, 65, - CriticalItem.SAPPHIRE, Secondaries.GOLD_BAR, new ItemStack(ItemID.SAPPHIRE_AMULET, 1)), - EMERALD_RING(ItemID.EMERALD_RING, "Emerald ring", Skill.CRAFTING, 27, 55, - CriticalItem.EMERALD, Secondaries.GOLD_BAR, new ItemStack(ItemID.EMERALD_RING, 1)), - EMERALD_NECKLACE(ItemID.EMERALD_NECKLACE, "Emerald necklace", Skill.CRAFTING, 29, 60, - CriticalItem.EMERALD, Secondaries.GOLD_BAR, new ItemStack(ItemID.EMERALD_NECKLACE, 1)), - EMERALD_BRACELET(ItemID.EMERALD_BRACELET, "Emerald bracelet", Skill.CRAFTING, 30, 65, - CriticalItem.EMERALD, Secondaries.GOLD_BAR, new ItemStack(ItemID.EMERALD_BRACELET, 1)), - EMERALD_AMULET(ItemID.EMERALD_AMULET, "Emerald amulet", Skill.CRAFTING, 31, 70, - CriticalItem.EMERALD, Secondaries.GOLD_BAR, new ItemStack(ItemID.EMERALD_AMULET, 1)), - RUBY_RING(ItemID.RUBY_RING, "Ruby ring", Skill.CRAFTING, 34, 70, - CriticalItem.RUBY, Secondaries.GOLD_BAR, new ItemStack(ItemID.RUBY_RING, 1)), - RUBY_NECKLACE(ItemID.RUBY_NECKLACE, "Ruby necklace", Skill.CRAFTING, 40, 75, - CriticalItem.RUBY, Secondaries.GOLD_BAR, new ItemStack(ItemID.RUBY_NECKLACE, 1)), - RUBY_BRACELET(ItemID.RUBY_BRACELET, "Ruby bracelet", Skill.CRAFTING, 42, 80, - CriticalItem.RUBY, Secondaries.GOLD_BAR, new ItemStack(ItemID.RUBY_BRACELET, 1)), - RUBY_AMULET(ItemID.RUBY_AMULET, "Ruby amulet", Skill.CRAFTING, 50, 85, - CriticalItem.RUBY, Secondaries.GOLD_BAR, new ItemStack(ItemID.RUBY_AMULET, 1)), - DIAMOND_RING(ItemID.DIAMOND_RING, "Diamond ring", Skill.CRAFTING, 43, 85, - CriticalItem.DIAMOND, Secondaries.GOLD_BAR, new ItemStack(ItemID.DIAMOND_RING, 1)), - DIAMOND_NECKLACE(ItemID.DIAMOND_NECKLACE, "Diamond necklace", Skill.CRAFTING, 56, 90, - CriticalItem.DIAMOND, Secondaries.GOLD_BAR, new ItemStack(ItemID.DIAMOND_NECKLACE, 1)), - DIAMOND_BRACELET(ItemID.DIAMOND_BRACELET, "Diamond bracelet", Skill.CRAFTING, 58, 95, - CriticalItem.DIAMOND, Secondaries.GOLD_BAR, new ItemStack(ItemID.DIAMOND_BRACELET, 1)), - DIAMOND_AMULET(ItemID.DIAMOND_AMULET, "Diamond amulet", Skill.CRAFTING, 70, 100, - CriticalItem.DIAMOND, Secondaries.GOLD_BAR, new ItemStack(ItemID.DIAMOND_AMULET, 1)), - DRAGONSTONE_RING(ItemID.DRAGONSTONE_RING, "Dragonstone ring", Skill.CRAFTING, 55, 100, - CriticalItem.DRAGONSTONE, Secondaries.GOLD_BAR, new ItemStack(ItemID.DRAGONSTONE_RING, 1)), - DRAGON_NECKLACE(ItemID.DRAGON_NECKLACE, "Dragon necklace", Skill.CRAFTING, 72, 105, - CriticalItem.DRAGONSTONE, Secondaries.GOLD_BAR, new ItemStack(ItemID.DRAGON_NECKLACE, 1)), - DRAGONSTONE_BRACELET(ItemID.DRAGONSTONE_BRACELET, "Dragonstone bracelet", Skill.CRAFTING, 74, 110, - CriticalItem.DRAGONSTONE, Secondaries.GOLD_BAR, new ItemStack(ItemID.DRAGONSTONE_BRACELET, 1)), - DRAGONSTONE_AMULET(ItemID.DRAGONSTONE_AMULET, "Dragonstone amulet", Skill.CRAFTING, 80, 150, - CriticalItem.DRAGONSTONE, Secondaries.GOLD_BAR, new ItemStack(ItemID.DRAGONSTONE_AMULET, 1)), - ONYX_RING(ItemID.ONYX_RING, "Onyx ring", Skill.CRAFTING, 67, 115, - CriticalItem.ONYX, Secondaries.GOLD_BAR, new ItemStack(ItemID.ONYX_RING, 1)), - ONYX_NECKLACE(ItemID.ONYX_NECKLACE, "Onyx necklace", Skill.CRAFTING, 82, 120, - CriticalItem.ONYX, Secondaries.GOLD_BAR, new ItemStack(ItemID.ONYX_NECKLACE, 1)), - REGEN_BRACELET(ItemID.REGEN_BRACELET, "Regen bracelet", Skill.CRAFTING, 84, 125, - CriticalItem.ONYX, Secondaries.GOLD_BAR, new ItemStack(ItemID.REGEN_BRACELET, 1)), - ONYX_AMULET(ItemID.ONYX_AMULET, "Onyx amulet", Skill.CRAFTING, 90, 165, - CriticalItem.ONYX, Secondaries.GOLD_BAR, new ItemStack(ItemID.ONYX_AMULET, 1)), - ZENYTE_RING(ItemID.ZENYTE_RING, "Zenyte ring", Skill.CRAFTING, 89, 150, - CriticalItem.ZENYTE, Secondaries.GOLD_BAR, new ItemStack(ItemID.ZENYTE_RING, 1)), - ZENYTE_NECKLACE(ItemID.ZENYTE_NECKLACE, "Zenyte necklace", Skill.CRAFTING, 92, 165, - CriticalItem.ZENYTE, Secondaries.GOLD_BAR, new ItemStack(ItemID.ZENYTE_NECKLACE, 1)), - ZENYTE_BRACELET(ItemID.ZENYTE_BRACELET, "Zenyte bracelet", Skill.CRAFTING, 95, 180, - CriticalItem.ZENYTE, Secondaries.GOLD_BAR, new ItemStack(ItemID.ZENYTE_BRACELET, 1)), - ZENYTE_AMULET(ItemID.ZENYTE_AMULET, "Zenyte amulet", Skill.CRAFTING, 98, 200, - CriticalItem.ZENYTE, Secondaries.GOLD_BAR, new ItemStack(ItemID.ZENYTE_AMULET, 1)), - // Battle Staves - WATER_BATTLESTAFF(ItemID.WATER_BATTLESTAFF, "Water battlestaff", Skill.CRAFTING, 54, 100, - CriticalItem.BATTLESTAFF, Secondaries.WATER_ORB, new ItemStack(ItemID.WATER_BATTLESTAFF, 1)), - EARTH_BATTLESTAFF(ItemID.EARTH_BATTLESTAFF, "Earth battlestaff", Skill.CRAFTING, 58, 112.5, - CriticalItem.BATTLESTAFF, Secondaries.EARTH_ORB, new ItemStack(ItemID.EARTH_BATTLESTAFF, 1)), - FIRE_BATTLESTAFF(ItemID.FIRE_BATTLESTAFF, "Fire battlestaff", Skill.CRAFTING, 62, 125, - CriticalItem.BATTLESTAFF, Secondaries.FIRE_ORB, new ItemStack(ItemID.FIRE_BATTLESTAFF, 1)), - AIR_BATTLESTAFF(ItemID.AIR_BATTLESTAFF, "Air battlestaff", Skill.CRAFTING, 66, 137.5, - CriticalItem.BATTLESTAFF, Secondaries.AIR_ORB, new ItemStack(ItemID.AIR_BATTLESTAFF, 1)), - - /* - * Smithing Items - */ - - // Smelting ores (Furnace) - IRON_ORE(ItemID.IRON_BAR, "Iron bar", Skill.SMITHING, 15, 12.5, - CriticalItem.IRON_ORE, Secondaries.COAL_ORE, new ItemStack(ItemID.IRON_BAR, 1)), - STEEL_ORE(ItemID.STEEL_BAR, "Steel bar", Skill.SMITHING, 30, 17.5, - CriticalItem.IRON_ORE, Secondaries.COAL_ORE_2, new ItemStack(ItemID.STEEL_BAR, 1)), - SILVER_ORE(ItemID.SILVER_BAR, "Silver Bar", Skill.SMITHING, 20, 13.67, - CriticalItem.SILVER_ORE, null, new ItemStack(ItemID.SILVER_BAR, 1)), - GOLD_ORE(ItemID.GOLD_BAR, "Gold bar", Skill.SMITHING, 40, 22.5, - CriticalItem.GOLD_ORE, null, new ItemStack(ItemID.GOLD_BAR, 1)), - GOLD_ORE_GAUNTLETS(ItemID.GOLDSMITH_GAUNTLETS, "Goldsmith gauntlets", Skill.SMITHING, 40, 56.2, - CriticalItem.GOLD_ORE, null, new ItemStack(ItemID.GOLD_BAR, 1)), - MITHRIL_ORE(ItemID.MITHRIL_BAR, "Mithril bar", Skill.SMITHING, 50, 30, - CriticalItem.MITHRIL_ORE, Secondaries.COAL_ORE_4, new ItemStack(ItemID.MITHRIL_BAR, 1)), - ADAMANTITE_ORE(ItemID.ADAMANTITE_BAR, "Adamantite bar", Skill.SMITHING, 70, 37.5, - CriticalItem.ADAMANTITE_ORE, Secondaries.COAL_ORE_6, new ItemStack(ItemID.ADAMANTITE_BAR, 1)), - RUNITE_ORE(ItemID.RUNITE_BAR, "Runite bar", Skill.SMITHING, 85, 50, - CriticalItem.RUNITE_ORE, Secondaries.COAL_ORE_8, new ItemStack(ItemID.RUNITE_BAR, 1)), - - // Smelting bars (Anvil) - BRONZE_BAR(ItemID.BRONZE_BAR, "Bronze products", Skill.SMITHING, 1, 12.5, - CriticalItem.BRONZE_BAR, null, null), - IRON_BAR(ItemID.IRON_BAR, "Iron products", Skill.SMITHING, 15, 25.0, - CriticalItem.IRON_BAR, null, null), - STEEL_BAR(ItemID.STEEL_BAR, "Steel products", Skill.SMITHING, 30, 37.5, - CriticalItem.STEEL_BAR, null, null), - CANNONBALLS(ItemID.CANNONBALL, "Cannonballs", Skill.SMITHING, 35, 25.5, - CriticalItem.STEEL_BAR, null, new ItemStack(ItemID.CANNONBALL, 4)), - MITHRIL_BAR(ItemID.MITHRIL_BAR, "Mithril products", Skill.SMITHING, 50, 50.0, - CriticalItem.MITHRIL_BAR, null, null), - ADAMANTITE_BAR(ItemID.ADAMANTITE_BAR, "Adamantite products", Skill.SMITHING, 70, 62.5, - CriticalItem.ADAMANTITE_BAR, null, null), - RUNITE_BAR(ItemID.RUNITE_BAR, "Runite products", Skill.SMITHING, 85, 75.0, - CriticalItem.RUNITE_BAR, null, null), - - /** - * Farming Items - */ - ACORN(ItemID.OAK_SAPLING, "Oak sapling", Skill.FARMING, 15, 0, - CriticalItem.ACORN, null, new ItemStack(ItemID.OAK_SAPLING, 1)), - WILLOW_SEED(ItemID.WILLOW_SAPLING, "Willow sapling", Skill.FARMING, 30, 0, - CriticalItem.WILLOW_SEED, null, new ItemStack(ItemID.WILLOW_SAPLING, 1)), - MAPLE_SEED(ItemID.MAPLE_SAPLING, "Maple sapling", Skill.FARMING, 45, 0, - CriticalItem.MAPLE_SEED, null, new ItemStack(ItemID.MAPLE_SAPLING, 1)), - YEW_SEED(ItemID.YEW_SAPLING, "Yew sapling", Skill.FARMING, 60, 0, - CriticalItem.YEW_SEED, null, new ItemStack(ItemID.YEW_SAPLING, 1)), - MAGIC_SEED(ItemID.MAGIC_SAPLING, "Magic sapling", Skill.FARMING, 75, 0, - CriticalItem.MAGIC_SEED, null, new ItemStack(ItemID.MAGIC_SAPLING, 1)), - APPLE_TREE_SEED(ItemID.APPLE_SAPLING, "Apple sapling", Skill.FARMING, 27, 0, - CriticalItem.APPLE_TREE_SEED, null, new ItemStack(ItemID.APPLE_SAPLING, 1)), - BANANA_TREE_SEED(ItemID.BANANA_SAPLING, "Banana sapling", Skill.FARMING, 33, 0, - CriticalItem.BANANA_TREE_SEED, null, new ItemStack(ItemID.BANANA_SAPLING, 1)), - ORANGE_TREE_SEED(ItemID.ORANGE_SAPLING, "Orange sapling", Skill.FARMING, 39, 0, - CriticalItem.ORANGE_TREE_SEED, null, new ItemStack(ItemID.ORANGE_SAPLING, 1)), - CURRY_TREE_SEED(ItemID.CURRY_SAPLING, "Curry sapling", Skill.FARMING, 42, 0, - CriticalItem.CURRY_TREE_SEED, null, new ItemStack(ItemID.CURRY_SAPLING, 1)), - PINEAPPLE_SEED(ItemID.PINEAPPLE_SAPLING, "Pineapple sapling", Skill.FARMING, 51, 0, - CriticalItem.PINEAPPLE_SEED, null, new ItemStack(ItemID.PINEAPPLE_SAPLING, 1)), - PAPAYA_TREE_SEED(ItemID.PAPAYA_SAPLING, "Papaya sapling", Skill.FARMING, 57, 0, - CriticalItem.PAPAYA_TREE_SEED, null, new ItemStack(ItemID.PAPAYA_SAPLING, 1)), - PALM_TREE_SEED(ItemID.PALM_SAPLING, "Palm sapling", Skill.FARMING, 68, 0, - CriticalItem.PALM_TREE_SEED, null, new ItemStack(ItemID.PALM_SAPLING, 1)), - CALQUAT_TREE_SEED(ItemID.CALQUAT_SAPLING, "Calquat sapling", Skill.FARMING, 72, 0, - CriticalItem.CALQUAT_TREE_SEED, null, new ItemStack(ItemID.CALQUAT_SAPLING, 1)), - TEAK_SEED(ItemID.TEAK_SAPLING, "Teak sapling", Skill.FARMING, 35, 0, - CriticalItem.TEAK_SEED, null, new ItemStack(ItemID.TEAK_SAPLING, 1)), - MAHOGANY_SEED(ItemID.MAHOGANY_SAPLING, "Mahogany sapling", Skill.FARMING, 55, 0, - CriticalItem.MAHOGANY_SEED, null, new ItemStack(ItemID.MAHOGANY_SAPLING, 1)), - SPIRIT_SEED(ItemID.SPIRIT_SAPLING, "Spirit sapling", Skill.FARMING, 83, 0, - CriticalItem.SPIRIT_SEED, null, new ItemStack(ItemID.SPIRIT_SAPLING, 1)), - - OAK_SAPPLING(ItemID.OAK_SAPLING, "Oak tree", Skill.FARMING, 15, 481.3, - CriticalItem.OAK_SAPLING, null, null), - WILLOW_SAPLING(ItemID.WILLOW_SAPLING, "Willow tree", Skill.FARMING, 30, 1481.5, - CriticalItem.WILLOW_SAPLING, null, null), - MAPLE_SAPLING(ItemID.MAPLE_SAPLING, "Maple tree", Skill.FARMING, 45, 3448.4, - CriticalItem.MAPLE_SAPLING, null, null), - YEW_SAPLING(ItemID.YEW_SAPLING, "Yew tree", Skill.FARMING, 60, 7150.9, - CriticalItem.YEW_SAPLING, null, null), - MAGIC_SAPLING(ItemID.MAGIC_SAPLING, "Magic tree", Skill.FARMING, 75, 13913.8, - CriticalItem.MAGIC_SAPLING, null, null), - APPLE_TREE_SAPLING(ItemID.APPLE_SAPLING, "Apple tree", Skill.FARMING, 27, 1272.5, - CriticalItem.APPLE_TREE_SAPLING, null, null), - BANANA_TREE_SAPLING(ItemID.BANANA_SAPLING, "Banana tree", Skill.FARMING, 33, 1841.5, - CriticalItem.BANANA_TREE_SAPLING, null, null), - ORANGE_TREE_SAPLING(ItemID.ORANGE_SAPLING, "Orange tree", Skill.FARMING, 39, 2586.7, - CriticalItem.ORANGE_TREE_SAPLING, null, null), - CURRY_TREE_SAPLING(ItemID.CURRY_SAPLING, "Curry tree", Skill.FARMING, 42, 3036.9, - CriticalItem.CURRY_TREE_SAPLING, null, null), - PINEAPPLE_SAPLING(ItemID.PINEAPPLE_SAPLING, "Pineapple tree", Skill.FARMING, 51, 4791.7, - CriticalItem.PINEAPPLE_SAPLING, null, null), - PAPAYA_TREE_SAPLING(ItemID.PAPAYA_SAPLING, "Papaya tree", Skill.FARMING, 57, 6380.4, - CriticalItem.PAPAYA_TREE_SAPLING, null, null), - PALM_TREE_SAPLING(ItemID.PALM_SAPLING, "Palm tree", Skill.FARMING, 68, 10509.6, - CriticalItem.PALM_TREE_SAPLING, null, null), - CALQUAT_TREE_SAPLING(ItemID.CALQUAT_SAPLING, "Calquat tree", Skill.FARMING, 72, 12516.5, - CriticalItem.CALQUAT_TREE_SAPLING, null, null), - TEAK_SAPLING(ItemID.TEAK_SAPLING, "Teak tree", Skill.FARMING, 35, 7325, - CriticalItem.TEAK_SAPLING, null, null), - MAHOGANY_SAPLING(ItemID.MAHOGANY_SAPLING, "Mahogany tree", Skill.FARMING, 55, 15783, - CriticalItem.MAHOGANY_SAPLING, null, null), - SPIRIT_SAPLING(ItemID.SPIRIT_SAPLING, "Spirit tree", Skill.FARMING, 83, 19500, - CriticalItem.SPIRIT_SAPLING, null, null), - - /** - * Fletching - */ - // Logs - FLETCH_HEADLESS_ARROWS(ItemID.ARROW_SHAFT, "Arrow shaft", Skill.FLETCHING, 1, 5, - CriticalItem.FLETCH_LOGS, null, new ItemStack(ItemID.ARROW_SHAFT, 15)), - FLETCH_SHORTBOW_U(ItemID.SHORTBOW_U, "Shortbow (u)", Skill.FLETCHING, 5, 5, - CriticalItem.FLETCH_LOGS, null, new ItemStack(ItemID.SHORTBOW_U, 1)), - FLETCH_LONGBOW_U(ItemID.LONGBOW_U, "Longbow (u)", Skill.FLETCHING, 10, 10, - CriticalItem.FLETCH_LOGS, null, new ItemStack(ItemID.LONGBOW_U, 1)), - // Oak Logs - FLETCH_OAK_HEADLESS_ARROWS(ItemID.ARROW_SHAFT, "Arrow shaft", Skill.FLETCHING, 15, 10, - CriticalItem.FLETCH_OAK_LOGS, null, new ItemStack(ItemID.ARROW_SHAFT, 30)), - FLETCH_OAK_SHORTBOW_U(ItemID.OAK_SHORTBOW_U, "Oak shortbow (u)", Skill.FLETCHING, 25, 16.5, - CriticalItem.FLETCH_OAK_LOGS, null, new ItemStack(ItemID.OAK_SHORTBOW_U, 1)), - FLETCH_OAK_LONGBOW_U(ItemID.OAK_LONGBOW_U, "Oak longbow (u)", Skill.FLETCHING, 25, 25, - CriticalItem.FLETCH_OAK_LOGS, null, new ItemStack(ItemID.OAK_LONGBOW_U, 1)), - // Willow Logs - FLETCH_WILLOW_HEADLESS_ARROWS(ItemID.ARROW_SHAFT, "Arrow shaft", Skill.FLETCHING, 30, 15, - CriticalItem.FLETCH_WILLOW_LOGS, null, new ItemStack(ItemID.ARROW_SHAFT, 45)), - FLETCH_WILLOW_SHORTBOW_U(ItemID.WILLOW_SHORTBOW_U, "Willow shortbow (u)", Skill.FLETCHING, 35, 33.3, - CriticalItem.FLETCH_WILLOW_LOGS, null, new ItemStack(ItemID.WILLOW_SHORTBOW_U, 1)), - FLETCH_WILLOW_LONGBOW_U(ItemID.WILLOW_LONGBOW_U, "Willow longbow (u)", Skill.FLETCHING, 40, 41.5, - CriticalItem.FLETCH_WILLOW_LOGS, null, new ItemStack(ItemID.WILLOW_LONGBOW_U, 1)), - // Maple Logs - FLETCH_MAPLE_HEADLESS_ARROWS(ItemID.ARROW_SHAFT, "Arrow shaft", Skill.FLETCHING, 45, 20, - CriticalItem.FLETCH_MAPLE_LOGS, null, new ItemStack(ItemID.ARROW_SHAFT, 60)), - FLETCH_MAPLE_SHORTBOW_U(ItemID.MAPLE_SHORTBOW_U, "Maple shortbow (u)", Skill.FLETCHING, 50, 50, - CriticalItem.FLETCH_MAPLE_LOGS, null, new ItemStack(ItemID.MAPLE_SHORTBOW_U, 1)), - FLETCH_MAPLE_LONGBOW_U(ItemID.MAPLE_LONGBOW_U, "Maple longbow (u)", Skill.FLETCHING, 55, 58.3, - CriticalItem.FLETCH_MAPLE_LOGS, null, new ItemStack(ItemID.MAPLE_LONGBOW_U, 1)), - // Yew Logs - FLETCH_YEW_HEADLESS_ARROWS(ItemID.ARROW_SHAFT, "Arrow shaft", Skill.FLETCHING, 60, 25, - CriticalItem.FLETCH_YEW_LOGS, null, new ItemStack(ItemID.ARROW_SHAFT, 75)), - FLETCH_YEW_SHORTBOW_U(ItemID.YEW_SHORTBOW_U, "Yew shortbow (u)", Skill.FLETCHING, 65, 67.5, - CriticalItem.FLETCH_YEW_LOGS, null, new ItemStack(ItemID.YEW_SHORTBOW_U, 1)), - FLETCH_YEW_LONGBOW_U(ItemID.YEW_LONGBOW_U, "Yew longbow (u)", Skill.FLETCHING, 70, 75, - CriticalItem.FLETCH_YEW_LOGS, null, new ItemStack(ItemID.YEW_LONGBOW_U, 1)), - // Magic Logs - FLETCH_MAGIC_HEADLESS_ARROWS(ItemID.ARROW_SHAFT, "Arrow shaft", Skill.FLETCHING, 75, 30, - CriticalItem.FLETCH_MAGIC_LOGS, null, new ItemStack(ItemID.ARROW_SHAFT, 90)), - FLETCH_MAGIC_SHORTBOW_U(ItemID.MAGIC_SHORTBOW_U, "Magic shortbow (u)", Skill.FLETCHING, 80, 83.3, - CriticalItem.FLETCH_MAGIC_LOGS, null, new ItemStack(ItemID.MAGIC_SHORTBOW_U, 1)), - FLETCH_MAGIC_LONGBOW_U(ItemID.MAGIC_LONGBOW_U, "Magic longbow (u)", Skill.FLETCHING, 85, 91.5, - CriticalItem.FLETCH_MAGIC_LOGS, null, new ItemStack(ItemID.MAGIC_LONGBOW_U, 1)), - // Strung Bows - FLETCH_SHORTBOW(ItemID.SHORTBOW, "Shortbow", Skill.FLETCHING, 5, 5, - CriticalItem.FLETCH_SHORTBOW_U, Secondaries.BOW_STRING, new ItemStack(ItemID.SHORTBOW, 1)), - FLETCH_LONGBOW(ItemID.LONGBOW, "Longbow", Skill.FLETCHING, 10, 10, - CriticalItem.FLETCH_LONGBOW_U, Secondaries.BOW_STRING, new ItemStack(ItemID.LONGBOW, 1)), - FLETCH_OAK_SHORTBOW(ItemID.OAK_SHORTBOW, "Oak shortbow", Skill.FLETCHING, 20, 16.5, - CriticalItem.FLETCH_OAK_SHORTBOW_U, Secondaries.BOW_STRING, new ItemStack(ItemID.OAK_SHORTBOW, 1)), - FLETCH_OAK_LONGBOW(ItemID.OAK_LONGBOW, "Oak longbow", Skill.FLETCHING, 25, 25, - CriticalItem.FLETCH_OAK_LONGBOW_U, Secondaries.BOW_STRING, new ItemStack(ItemID.OAK_LONGBOW, 1)), - FLETCH_WILLOW_SHORTBOW(ItemID.WILLOW_SHORTBOW, "Willow shortbow", Skill.FLETCHING, 35, 33.2, - CriticalItem.FLETCH_WILLOW_SHORTBOW_U, Secondaries.BOW_STRING, new ItemStack(ItemID.WILLOW_SHORTBOW, 1)), - FLETCH_WILLOW_LONGBOW(ItemID.WILLOW_LONGBOW, "Willow longbow", Skill.FLETCHING, 40, 41.5, - CriticalItem.FLETCH_WILLOW_LONGBOW_U, Secondaries.BOW_STRING, new ItemStack(ItemID.WILLOW_LONGBOW, 1)), - FLETCH_MAPLE_SHORTBOW(ItemID.MAPLE_SHORTBOW, "Maple shortbow", Skill.FLETCHING, 50, 50, - CriticalItem.FLETCH_MAPLE_SHORTBOW_U, Secondaries.BOW_STRING, new ItemStack(ItemID.MAPLE_SHORTBOW, 1)), - FLETCH_MAPLE_LONGBOW(ItemID.MAPLE_LONGBOW, "Maple longbow", Skill.FLETCHING, 55, 58.2, - CriticalItem.FLETCH_MAPLE_LONGBOW_U, Secondaries.BOW_STRING, new ItemStack(ItemID.MAPLE_LONGBOW, 1)), - FLETCH_YEW_SHORTBOW(ItemID.YEW_SHORTBOW, "Yew shortbow", Skill.FLETCHING, 65, 67.5, - CriticalItem.FLETCH_YEW_SHORTBOW_U, Secondaries.BOW_STRING, new ItemStack(ItemID.YEW_SHORTBOW, 1)), - FLETCH_YEW_LONGBOW(ItemID.YEW_LONGBOW, "Yew longbow", Skill.FLETCHING, 70, 75, - CriticalItem.FLETCH_YEW_LONGBOW_U, Secondaries.BOW_STRING, new ItemStack(ItemID.YEW_LONGBOW, 1)), - FLETCH_MAGIC_SHORTBOW(ItemID.MAGIC_SHORTBOW, "Magic shortbow", Skill.FLETCHING, 80, 83.2, - CriticalItem.FLETCH_MAGIC_SHORTBOW_U, Secondaries.BOW_STRING, new ItemStack(ItemID.MAGIC_SHORTBOW, 1)), - FLETCH_MAGIC_LONGBOW(ItemID.MAGIC_LONGBOW, "Magic longbow", Skill.FLETCHING, 85, 91.5, - CriticalItem.FLETCH_MAGIC_LONGBOW_U, Secondaries.BOW_STRING, new ItemStack(ItemID.MAGIC_LONGBOW, 1)), - // Darts - FLETCH_BRONZE_DARTS(ItemID.BRONZE_DART, "Bronze dart", Skill.FLETCHING, 10, 1.8, - CriticalItem.FLETCH_BRONZE_DART_TIP, Secondaries.FEATHER, new ItemStack(ItemID.BRONZE_DART, 1)), - FLETCH_IRON_DARTS(ItemID.IRON_DART, "Iron dart", Skill.FLETCHING, 22, 3.8, - CriticalItem.FLETCH_IRON_DART_TIP, Secondaries.FEATHER, new ItemStack(ItemID.IRON_DART, 1)), - FLETCH_STEEL_DARTS(ItemID.STEEL_DART, "Steel dart", Skill.FLETCHING, 37, 7.5, - CriticalItem.FLETCH_STEEL_DART_TIP, Secondaries.FEATHER, new ItemStack(ItemID.STEEL_DART, 1)), - FLETCH_MITHRIL_DARTS(ItemID.MITHRIL_DART, "Mithril dart", Skill.FLETCHING, 52, 11.2, - CriticalItem.FLETCH_MITHRIL_DART_TIP, Secondaries.FEATHER, new ItemStack(ItemID.MITHRIL_DART, 1)), - FLETCH_ADAMANT_DARTS(ItemID.ADAMANT_DART, "Adamant dart", Skill.FLETCHING, 67, 15, - CriticalItem.FLETCH_ADAMANT_DART_TIP, Secondaries.FEATHER, new ItemStack(ItemID.ADAMANT_DART, 1)), - FLETCH_RUNE_DARTS(ItemID.RUNE_DART, "Rune dart", Skill.FLETCHING, 81, 18.8, - CriticalItem.FLETCH_RUNE_DART_TIP, Secondaries.FEATHER, new ItemStack(ItemID.RUNE_DART, 1)), - FLETCH_DRAGON_DARTS(ItemID.DRAGON_DART, "Dragon dart", Skill.FLETCHING, 95, 25, - CriticalItem.FLETCH_DRAGON_DART_TIP, Secondaries.FEATHER, new ItemStack(ItemID.DRAGON_DART, 1)), - // Arrows - FLETCH_BRONZE_ARROW(ItemID.BRONZE_ARROW, "Bronze arrow", Skill.FLETCHING, 1, 1, - CriticalItem.FLETCH_BRONZE_ARROWTIPS, Secondaries.HEADLESS_ARROW, new ItemStack(ItemID.BRONZE_ARROW, 1)), - FLETCH_IRON_ARROW(ItemID.IRON_ARROW, "Iron arrow", Skill.FLETCHING, 1, 1.3, - CriticalItem.FLETCH_IRON_ARROWTIPS, Secondaries.HEADLESS_ARROW, new ItemStack(ItemID.IRON_ARROW, 1)), - FLETCH_STEEL_ARROW(ItemID.STEEL_ARROW, "Steel arrow", Skill.FLETCHING, 30, 2.5, - CriticalItem.FLETCH_STEEL_ARROWTIPS, Secondaries.HEADLESS_ARROW, new ItemStack(ItemID.STEEL_ARROW, 1)), - FLETCH_MITHRIL_ARROW(ItemID.MITHRIL_ARROW, "Mithril arrow", Skill.FLETCHING, 45, 5, - CriticalItem.FLETCH_MITHRIL_ARROWTIPS, Secondaries.HEADLESS_ARROW, new ItemStack(ItemID.MITHRIL_ARROW, 1)), - FLETCH_BROAD_ARROW(ItemID.BROAD_ARROWS, "Broad arrow", Skill.FLETCHING, 52, 7.5, - CriticalItem.FLETCH_BROAD_ARROWHEADS, Secondaries.HEADLESS_ARROW, new ItemStack(ItemID.BROAD_ARROWS, 1)), - FLETCH_ADAMANT_ARROW(ItemID.ADAMANT_ARROW, "Adamant arrow", Skill.FLETCHING, 60, 10, - CriticalItem.FLETCH_ADAMANT_ARROWTIPS, Secondaries.HEADLESS_ARROW, new ItemStack(ItemID.ADAMANT_ARROW, 1)), - FLETCH_RUNE_ARROW(ItemID.RUNE_ARROW, "Rune arrow", Skill.FLETCHING, 75, 12.5, - CriticalItem.FLETCH_RUNE_ARROWTIPS, Secondaries.HEADLESS_ARROW, new ItemStack(ItemID.RUNE_ARROW, 1)), - FLETCH_AMETHYST_ARROW(ItemID.AMETHYST_ARROW, "Amethyst arrow", Skill.FLETCHING, 82, 13.5, - CriticalItem.FLETCH_AMETHYST_ARROWTIPS, Secondaries.HEADLESS_ARROW, new ItemStack(ItemID.AMETHYST_ARROW, 1)), - FLETCH_DRAGON_ARROW(ItemID.DRAGON_ARROW, "Dragon arrow", Skill.FLETCHING, 90, 15, - CriticalItem.FLETCH_DRAGON_ARROWTIPS, Secondaries.HEADLESS_ARROW, new ItemStack(ItemID.DRAGON_ARROW, 1)), - //Javelin - FLETCH_BRONZE_JAVELIN(ItemID.BRONZE_JAVELIN, "Bronze javelin", Skill.FLETCHING, 3, 1, - CriticalItem.FLETCH_BRONZE_JAVELINHEAD, Secondaries.JAVELIN_SHAFT, new ItemStack(ItemID.BRONZE_JAVELIN, 1)), - FLETCH_IRON_JAVELIN(ItemID.IRON_JAVELIN, "Iron javelin", Skill.FLETCHING, 17, 2, - CriticalItem.FLETCH_IRON_JAVELINHEAD, Secondaries.JAVELIN_SHAFT, new ItemStack(ItemID.IRON_JAVELIN, 1)), - FLETCH_STEEL_JAVELIN(ItemID.STEEL_JAVELIN, "Steel javelin", Skill.FLETCHING, 32, 5, - CriticalItem.FLETCH_STEEL_JAVELINHEAD, Secondaries.JAVELIN_SHAFT, new ItemStack(ItemID.STEEL_JAVELIN, 1)), - FLETCH_MITHRIL_JAVELIN(ItemID.MITHRIL_JAVELIN, "Mithril javelin", Skill.FLETCHING, 47, 8, - CriticalItem.FLETCH_MITHRIL_JAVELINHEAD, Secondaries.JAVELIN_SHAFT, new ItemStack(ItemID.MITHRIL_JAVELIN, 1)), - FLETCH_ADAMANT_JAVELIN(ItemID.ADAMANT_JAVELIN, "Adamant javelin", Skill.FLETCHING, 62, 10, - CriticalItem.FLETCH_ADAMANT_JAVELINHEAD, Secondaries.JAVELIN_SHAFT, new ItemStack(ItemID.ADAMANT_JAVELIN, 1)), - FLETCH_RUNE_JAVELIN(ItemID.RUNE_JAVELIN, "Rune javelin", Skill.FLETCHING, 77, 12.4, - CriticalItem.FLETCH_RUNE_JAVELINHEAD, Secondaries.JAVELIN_SHAFT, new ItemStack(ItemID.RUNE_JAVELIN, 1)), - FLETCH_AMETHYST_JAVELIN(ItemID.AMETHYST_JAVELIN, "Amethyst javelin", Skill.FLETCHING, 84, 13.5, - CriticalItem.FLETCH_AMETHYST_JAVELINHEAD, Secondaries.JAVELIN_SHAFT, new ItemStack(ItemID.AMETHYST_JAVELIN, 1)), - FLETCH_DRAGON_JAVELIN(ItemID.DRAGON_JAVELIN, "Dragon javelin", Skill.FLETCHING, 92, 15, - CriticalItem.FLETCH_DRAGON_JAVELINHEAD, Secondaries.JAVELIN_SHAFT, new ItemStack(ItemID.DRAGON_JAVELIN, 1)), - //Bolts - FLETCH_BRONZE_BOLT(ItemID.BRONZE_BOLTS, "Bronze bolt", Skill.FLETCHING, 9, 0.5, - CriticalItem.FLETCH_BRONZE_BOLT, Secondaries.FEATHER, new ItemStack(ItemID.BRONZE_BOLTS, 1)), - FLETCH_BLURITE_BOLT(ItemID.BLURITE_BOLTS_UNF, "Blurite bolt", Skill.FLETCHING, 24, 1, - CriticalItem.FLETCH_BLURITE_BOLT, Secondaries.FEATHER, new ItemStack(ItemID.BLURITE_BOLTS, 1)), - FLETCH_IRON_BOLT(ItemID.IRON_BOLTS, "Iron bolt", Skill.FLETCHING, 39, 1.5, - CriticalItem.FLETCH_IRON_BOLT, Secondaries.FEATHER, new ItemStack(ItemID.IRON_BOLTS, 1)), - FLETCH_SILVER_BOLT(ItemID.SILVER_BOLTS, "Silver bolt", Skill.FLETCHING, 43, 2.5, - CriticalItem.FLETCH_SILVER_BOLT, Secondaries.FEATHER, new ItemStack(ItemID.SILVER_BOLTS, 1)), - FLETCH_STEEL_BOLT(ItemID.STEEL_BOLTS, "Steel bolt", Skill.FLETCHING, 46, 3.5, - CriticalItem.FLETCH_STEEL_BOLT, Secondaries.FEATHER, new ItemStack(ItemID.STEEL_BOLTS, 1)), - FLETCH_MITHRIL_BOLT(ItemID.MITHRIL_BOLTS, "Mithril bolt", Skill.FLETCHING, 54, 5, - CriticalItem.FLETCH_MITHRIL_BOLT, Secondaries.FEATHER, new ItemStack(ItemID.MITHRIL_BOLTS, 1)), - FLETCH_BROAD_BOLT(ItemID.BROAD_BOLTS, "Broad bolt", Skill.FLETCHING, 55, 3, - CriticalItem.FLETCH_BROAD_BOLT, Secondaries.FEATHER, new ItemStack(ItemID.BROAD_BOLTS, 1)), - FLETCH_ADAMANT_BOLT(ItemID.ADAMANT_BOLTS, "Adamant bolt", Skill.FLETCHING, 61, 7, - CriticalItem.FLETCH_ADAMANT_BOLT, Secondaries.FEATHER, new ItemStack(ItemID.ADAMANT_BOLTS, 1)), - FLETCH_RUNE_BOLT(ItemID.RUNITE_BOLTS, "Rune bolt", Skill.FLETCHING, 69, 10, - CriticalItem.FLETCH_RUNE_BOLT, Secondaries.FEATHER, new ItemStack(ItemID.RUNITE_BOLTS, 1)), - FLETCH_DRAGON_BOLT(ItemID.DRAGON_BOLTS, "Dragon bolt", Skill.FLETCHING, 84, 12, - CriticalItem.FLETCH_DRAGON_BOLT, Secondaries.FEATHER, new ItemStack(ItemID.DRAGON_BOLTS, 1)), - //Bolt tips - FLETCH_OPAL_TIPS(ItemID.OPAL_BOLT_TIPS, "Opal bolt tips", Skill.FLETCHING, 11, 1.6, - CriticalItem.FLETCH_OPAL_TIPS, null, new ItemStack(ItemID.OPAL_BOLT_TIPS, 1)), - FLETCH_JADE_TIPS(ItemID.JADE_BOLT_TIPS, "Jade bolt tips", Skill.FLETCHING, 26, 2.4, - CriticalItem.FLETCH_JADE_TIPS, null, new ItemStack(ItemID.JADE_BOLT_TIPS, 1)), - FLETCH_RED_TOPAZ_TIPS(ItemID.TOPAZ_BOLT_TIPS, "Topaz bolt tips", Skill.FLETCHING, 48, 3.9, - CriticalItem.FLETCH_RED_TOPAZ_TIPS, null, new ItemStack(ItemID.TOPAZ_BOLT_TIPS, 1)), - FLETCH_SAPPHIRE_TIPS(ItemID.SAPPHIRE_BOLT_TIPS, "Sapphire bolt tips", Skill.FLETCHING, 56, 4.7, - CriticalItem.FLETCH_SAPPHIRE_TIPS, null, new ItemStack(ItemID.SAPPHIRE_BOLT_TIPS, 1)), - FLETCH_EMERALD_TIPS(ItemID.EMERALD_BOLT_TIPS, "Emerald bolt tips", Skill.FLETCHING, 58, 5.5, - CriticalItem.FLETCH_EMERALD_TIPS, null, new ItemStack(ItemID.EMERALD_BOLT_TIPS, 1)), - FLETCH_RUBY_TIPS(ItemID.RUBY_BOLT_TIPS, "Ruby bolt tips", Skill.FLETCHING, 63, 6.3, - CriticalItem.FLETCH_RUBY_TIPS, null, new ItemStack(ItemID.RUBY_BOLT_TIPS, 1)), - FLETCH_DIAMOND_TIPS(ItemID.DIAMOND_BOLT_TIPS, "Diamond bolt tips", Skill.FLETCHING, 65, 7, - CriticalItem.FLETCH_DIAMOND_TIPS, null, new ItemStack(ItemID.DIAMOND_BOLT_TIPS, 1)), - FLETCH_DRAGONSTONE_TIPS(ItemID.DRAGONSTONE_BOLT_TIPS, "Dragonstone bolt tips", Skill.FLETCHING, 71, 8.2, - CriticalItem.FLETCH_DRAGONSTONE_TIPS, null, new ItemStack(ItemID.DRAGONSTONE_BOLT_TIPS, 1)), - FLETCH_ONYX_TIPS(ItemID.ONYX_BOLT_TIPS, "Onyx bolt tips", Skill.FLETCHING, 73, 9.4, - CriticalItem.FLETCH_ONYX_TIPS, null, new ItemStack(ItemID.ONYX_BOLT_TIPS, 1)), - //Tipped bolts - FLETCH_TIPPED_OPAL_BOLT(ItemID.OPAL_BOLT_TIPS, "Opal bolt", Skill.FLETCHING, 11, 1.6, - CriticalItem.FLETCH_TIPPED_OPAL_BOLT, Secondaries.BRONZE_BOLT, new ItemStack(ItemID.OPAL_BOLTS, 1)), - FLETCH_TIPPED_JADE_BOLT(ItemID.JADE_BOLT_TIPS, "Jade bolt", Skill.FLETCHING, 26, 2.4, - CriticalItem.FLETCH_TIPPED_JADE_BOLT, Secondaries.BLURITE_BOLT, new ItemStack(ItemID.JADE_BOLTS, 1)), - FLETCH_TIPPED_PEARL_BOLT(ItemID.PEARL_BOLT_TIPS, "Pearl bolt", Skill.FLETCHING, 41, 3.2, - CriticalItem.FLETCH_TIPPED_PEARL_BOLT, Secondaries.IRON_BOLT, new ItemStack(ItemID.PEARL_BOLTS, 1)), - FLETCH_TIPPED_TOPAZ_BOLT(ItemID.TOPAZ_BOLT_TIPS, "Red topaz bolt", Skill.FLETCHING, 48, 4, - CriticalItem.FLETCH_TIPPED_TOPAZ_BOLT, Secondaries.STEEL_BOLT, new ItemStack(ItemID.TOPAZ_BOLTS, 1)), - FLETCH_TIPPED_SAPPHIRE_BOLT(ItemID.SAPPHIRE_BOLT_TIPS, "Sapphire bolt", Skill.FLETCHING, 56, 4.7, - CriticalItem.FLETCH_TIPPED_SAPPHIRE_BOLT, Secondaries.MITHRIL_BOLT, new ItemStack(ItemID.SAPPHIRE_BOLTS, 1)), - FLETCH_TIPPED_EMERALD_BOLT(ItemID.EMERALD_BOLT_TIPS, "Emerald bolt", Skill.FLETCHING, 58, 5.5, - CriticalItem.FLETCH_TIPPED_EMERALD_BOLT, Secondaries.MITHRIL_BOLT, new ItemStack(ItemID.EMERALD_BOLTS, 1)), - FLETCH_TIPPED_RUBY_BOLT(ItemID.RUBY_BOLT_TIPS, "Ruby bolt", Skill.FLETCHING, 63, 6.3, - CriticalItem.FLETCH_TIPPED_RUBY_BOLT, Secondaries.ADAMANT_BOLT, new ItemStack(ItemID.RUBY_BOLTS, 1)), - FLETCH_TIPPED_DIAMOND_BOLT(ItemID.DIAMOND_BOLT_TIPS, "Diamond bolt", Skill.FLETCHING, 65, 7, - CriticalItem.FLETCH_TIPPED_DIAMOND_BOLT, Secondaries.ADAMANT_BOLT, new ItemStack(ItemID.DIAMOND_BOLTS, 1)), - FLETCH_TIPPED_DRAGONSTONE_BOLT(ItemID.DRAGONSTONE_BOLT_TIPS, "Dragonstone bolt", Skill.FLETCHING, 71, 8.2, - CriticalItem.FLETCH_TIPPED_DRAGONSTONE_BOLT, Secondaries.RUNE_BOLT, new ItemStack(ItemID.DRAGONSTONE_BOLTS, 1)), - FLETCH_TIPPED_ONYX_BOLT(ItemID.ONYX_BOLT_TIPS, "Onyx bolt", Skill.FLETCHING, 73, 9.4, - CriticalItem.FLETCH_TIPPED_ONYX_BOLT, Secondaries.RUNE_BOLT, new ItemStack(ItemID.ONYX_BOLTS, 1)), - FLETCH_TIPPED_AMETHYST_BOLT(ItemID.AMETHYST_BOLT_TIPS, "Amethyst broad bolt", Skill.FLETCHING, 76, 10.6, - CriticalItem.FLETCH_TIPPED_AMETHYST_BOLT, Secondaries.BROAD_BOLT, new ItemStack(ItemID.AMETHYST_BROAD_BOLTS, 1)), - FLETCH_TIPPED_DRAGON_OPAL_BOLT(ItemID.OPAL_BOLT_TIPS, "Dragon opal bolt", Skill.FLETCHING, 84, 1.6, - CriticalItem.OPAL, Secondaries.DRAGON_BOLT, new ItemStack(ItemID.OPAL_DRAGON_BOLTS, 1)), - FLETCH_TIPPED_DRAGON_JADE_BOLT(ItemID.JADE_BOLT_TIPS, "Dragon jade bolt", Skill.FLETCHING, 84, 2.4, - CriticalItem.FLETCH_TIPPED_JADE_BOLT, Secondaries.DRAGON_BOLT, new ItemStack(ItemID.JADE_DRAGON_BOLTS, 1)), - FLETCH_TIPPED_DRAGON_PEARL_BOLT(ItemID.PEARL_BOLT_TIPS, "Dragon pearl bolt", Skill.FLETCHING, 84, 3.2, - CriticalItem.FLETCH_TIPPED_PEARL_BOLT, Secondaries.DRAGON_BOLT, new ItemStack(ItemID.PEARL_DRAGON_BOLTS, 1)), - FLETCH_TIPPED_DRAGON_TOPAZ_BOLT(ItemID.TOPAZ_BOLT_TIPS, "Dragon topaz bolt", Skill.FLETCHING, 84, 4, - CriticalItem.FLETCH_TIPPED_TOPAZ_BOLT, Secondaries.DRAGON_BOLT, new ItemStack(ItemID.TOPAZ_DRAGON_BOLTS, 1)), - FLETCH_TIPPED_DRAGON_SAPPHIRE_BOLT(ItemID.SAPPHIRE_BOLT_TIPS, "Dragon sapphire bolt", Skill.FLETCHING, 84, 4.7, - CriticalItem.FLETCH_TIPPED_SAPPHIRE_BOLT, Secondaries.DRAGON_BOLT, new ItemStack(ItemID.SAPPHIRE_DRAGON_BOLTS, 1)), - FLETCH_TIPPED_DRAGON_EMERALD_BOLT(ItemID.EMERALD_BOLT_TIPS, "Dragon emerald bolt", Skill.FLETCHING, 84, 5.5, - CriticalItem.FLETCH_TIPPED_EMERALD_BOLT, Secondaries.DRAGON_BOLT, new ItemStack(ItemID.EMERALD_DRAGON_BOLTS, 1)), - FLETCH_TIPPED_DRAGON_RUBY_BOLT(ItemID.RUBY_BOLT_TIPS, "Dragon ruby bolt", Skill.FLETCHING, 84, 6.3, - CriticalItem.FLETCH_TIPPED_RUBY_BOLT, Secondaries.DRAGON_BOLT, new ItemStack(ItemID.RUBY_DRAGON_BOLTS, 1)), - FLETCH_TIPPED_DRAGON_DIAMOND_BOLT(ItemID.DIAMOND_BOLT_TIPS, "Dragon diamond bolt", Skill.FLETCHING, 84, 7, - CriticalItem.FLETCH_TIPPED_DIAMOND_BOLT, Secondaries.DRAGON_BOLT, new ItemStack(ItemID.DIAMOND_DRAGON_BOLTS, 1)), - FLETCH_TIPPED_DRAGON_DRAGONSTONE_BOLT(ItemID.DRAGONSTONE_BOLT_TIPS, "Dragon dragonstone bolt", Skill.FLETCHING, 84, 8.2, - CriticalItem.FLETCH_TIPPED_DRAGONSTONE_BOLT, Secondaries.DRAGON_BOLT, new ItemStack(ItemID.DRAGONSTONE_DRAGON_BOLTS, 1)), - FLETCH_TIPPED_DRAGON_ONYX_BOLT(ItemID.ONYX_BOLT_TIPS, "Dragon onyx bolt", Skill.FLETCHING, 84, 9.4, - CriticalItem.FLETCH_TIPPED_ONYX_BOLT, Secondaries.DRAGON_BOLT, new ItemStack(ItemID.ONYX_DRAGON_BOLTS, 1)), - - /** - * Firemaking - */ - FM_LOGS(ItemID.LOGS, "Logs", Skill.FIREMAKING, 1, 40, - CriticalItem.FM_LOGS, null, null), - FM_ACHEY_LOGS(ItemID.ACHEY_TREE_LOGS, "Logs", Skill.FIREMAKING, 1, 40, - CriticalItem.FM_ACHEY_LOGS, null, null), - FM_OAK_LOGS(ItemID.OAK_LOGS, "Logs", Skill.FIREMAKING, 15, 60, - CriticalItem.FM_OAK_LOGS, null, null), - FM_WILLOW_LOGS(ItemID.WILLOW_LOGS, "Logs", Skill.FIREMAKING, 30, 90, - CriticalItem.FM_WILLOW_LOGS, null, null), - FM_TEAK_LOGS(ItemID.TEAK_LOGS, "Logs", Skill.FIREMAKING, 35, 105, - CriticalItem.FM_TEAK_LOGS, null, null), - FM_ARTIC_PINE_LOGS(ItemID.ARCTIC_PINE_LOGS, "Logs", Skill.FIREMAKING, 1, 40, - CriticalItem.FM_ARTIC_PINE_LOGS, null, null), - FM_MAPLE_LOGS(ItemID.MAPLE_LOGS, "Logs", Skill.FIREMAKING, 45, 135, - CriticalItem.FM_MAPLE_LOGS, null, null), - FM_MAHOGANY_LOGS(ItemID.MAHOGANY_LOGS, "Logs", Skill.FIREMAKING, 50, 157.5, - CriticalItem.FM_MAHOGANY_LOGS, null, null), - FM_YEW_LOGS(ItemID.YEW_LOGS, "Logs", Skill.FIREMAKING, 60, 202.5, - CriticalItem.FM_YEW_LOGS, null, null), - FM_MAGIC_LOGS(ItemID.MAGIC_LOGS, "Logs", Skill.FIREMAKING, 75, 303.8, - CriticalItem.FM_MAGIC_LOGS, null, null), - FM_REDWOOD_LOGS(ItemID.REDWOOD_LOGS, "Logs", Skill.FIREMAKING, 90, 350, - CriticalItem.FM_REDWOOD_LOGS, null, null), - ; - - // Store activity by CriticalItem - private static final ImmutableMultimap CRITICAL_MAP; - - static - { - final ImmutableMultimap.Builder map = ImmutableMultimap.builder(); - for (final Activity item : values()) - { - map.put(item.getCriticalItem(), item); - } - CRITICAL_MAP = map.build(); - } - - private final int icon; - private final String name; - private final CriticalItem criticalItem; - private final Skill skill; - private final int level; - private final double xp; - private final ItemStack[] secondaries; - @Nullable - private final ItemStack output; - @Nullable - private final CriticalItem linkedItem; - private ItemInfo outputItemInfo = null; - - Activity( - final int icon, - final String name, - final Skill skill, - final int level, - final double xp, - final CriticalItem criticalItem, - @Nullable final Secondaries secondaries, - @Nullable final ItemStack output) - { - this.icon = icon; - this.name = name; - this.skill = skill; - this.level = level; - this.xp = xp; - this.criticalItem = criticalItem; - this.secondaries = secondaries == null ? new ItemStack[0] : secondaries.getItems(); - this.output = output; - this.linkedItem = output == null ? null : CriticalItem.getByItemId(output.getId()); - } - - /** - * Get all Activities for this CriticalItem - * - * @param item CriticalItem to check for - * @return an empty Collection if no activities - */ - public static List getByCriticalItem(CriticalItem item) - { - final Collection activities = CRITICAL_MAP.get(item); - if (activities == null) - { - return new ArrayList<>(); - } - - return new ArrayList<>(activities); - } - - /** - * Get all Activities for this CriticalItem limited to level - * - * @param item CriticalItem to check for - * @param limitLevel Level to check Activitiy requirements against. -1/0 value disables limits - * @return an empty Collection if no activities - */ - public static List getByCriticalItem(final CriticalItem item, final int limitLevel) - { - // Return as list to allow getting by index - final List l = getByCriticalItem(item); - if (limitLevel <= 0) - { - return l; - } - - return l.stream().filter(a -> a.getLevel() <= limitLevel).collect(Collectors.toList()); - } - - /** - * Attaches the Item Composition to each CriticalItem on client initial load - * - * @param m ItemManager - */ - public static void prepareItemDefinitions(ItemManager m) - { - for (Activity a : values()) - { - final ItemStack output = a.getOutput(); - if (output == null) - { - continue; - } - - if (a.getOutputItemInfo() != null) - { - return; - } - - final ItemDefinition c = m.getItemDefinition(output.getId()); - a.outputItemInfo = new ItemInfo(c.getName(), c.isStackable()); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/BankedItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/BankedItem.java deleted file mode 100644 index 483e6e0f8d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/BankedItem.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.skillcalculator.banked.beans; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@AllArgsConstructor -@Getter(AccessLevel.PUBLIC) -public class BankedItem -{ - private final CriticalItem item; - private final int qty; - - public double getXpRate() - { - final Activity selectedActivity = item.getSelectedActivity(); - if (selectedActivity == null) - { - return 0; - } - - return selectedActivity.getXp(); - } - - @Override - public String toString() - { - return item.name() + " x " + qty; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/CriticalItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/CriticalItem.java deleted file mode 100644 index 57037873e4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/CriticalItem.java +++ /dev/null @@ -1,459 +0,0 @@ -/* - * 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.skillcalculator.banked.beans; - -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.Multimap; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.ItemDefinition; -import net.runelite.api.ItemID; -import net.runelite.api.Skill; -import net.runelite.client.game.ItemManager; - -@Getter(AccessLevel.PUBLIC) -public enum CriticalItem -{ - /** - * Construction Items - */ - // Logs - CON_LOGS(ItemID.LOGS, Skill.CONSTRUCTION, "Logs"), - CON_OAK_LOGS(ItemID.OAK_LOGS, Skill.CONSTRUCTION, "Logs"), - CON_TEAK_LOGS(ItemID.TEAK_LOGS, Skill.CONSTRUCTION, "Logs"), - CON_MAHOGANY_LOGS(ItemID.MAHOGANY_LOGS, Skill.CONSTRUCTION, "Logs"), - // Planks - PLANK(ItemID.PLANK, Skill.CONSTRUCTION, "Planks"), - OAK_PLANK(ItemID.OAK_PLANK, Skill.CONSTRUCTION, "Planks"), - TEAK_PLANK(ItemID.TEAK_PLANK, Skill.CONSTRUCTION, "Planks"), - MAHOGANY_PLANK(ItemID.MAHOGANY_PLANK, Skill.CONSTRUCTION, "Planks"), - - /** - * Herblore Items - */ - // Grimy Herbs - GRIMY_GUAM_LEAF(ItemID.GRIMY_GUAM_LEAF, Skill.HERBLORE, "Grimy Herbs"), - GRIMY_MARRENTILL(ItemID.GRIMY_MARRENTILL, Skill.HERBLORE, "Grimy Herbs"), - GRIMY_TARROMIN(ItemID.GRIMY_TARROMIN, Skill.HERBLORE, "Grimy Herbs"), - GRIMY_HARRALANDER(ItemID.GRIMY_HARRALANDER, Skill.HERBLORE, "Grimy Herbs"), - GRIMY_RANARR_WEED(ItemID.GRIMY_RANARR_WEED, Skill.HERBLORE, "Grimy Herbs"), - GRIMY_TOADFLAX(ItemID.GRIMY_TOADFLAX, Skill.HERBLORE, "Grimy Herbs"), - GRIMY_IRIT_LEAF(ItemID.GRIMY_IRIT_LEAF, Skill.HERBLORE, "Grimy Herbs"), - GRIMY_AVANTOE(ItemID.GRIMY_AVANTOE, Skill.HERBLORE, "Grimy Herbs"), - GRIMY_KWUARM(ItemID.GRIMY_KWUARM, Skill.HERBLORE, "Grimy Herbs"), - GRIMY_SNAPDRAGON(ItemID.GRIMY_SNAPDRAGON, Skill.HERBLORE, "Grimy Herbs"), - GRIMY_CADANTINE(ItemID.GRIMY_CADANTINE, Skill.HERBLORE, "Grimy Herbs"), - GRIMY_LANTADYME(ItemID.GRIMY_LANTADYME, Skill.HERBLORE, "Grimy Herbs"), - GRIMY_DWARF_WEED(ItemID.GRIMY_DWARF_WEED, Skill.HERBLORE, "Grimy Herbs"), - GRIMY_TORSTOL(ItemID.GRIMY_TORSTOL, Skill.HERBLORE, "Grimy Herbs"), - // Clean Herbs - GUAM_LEAF(ItemID.GUAM_LEAF, Skill.HERBLORE, "Cleaned Herbs"), - MARRENTILL(ItemID.MARRENTILL, Skill.HERBLORE, "Cleaned Herbs"), - TARROMIN(ItemID.TARROMIN, Skill.HERBLORE, "Cleaned Herbs"), - HARRALANDER(ItemID.HARRALANDER, Skill.HERBLORE, "Cleaned Herbs"), - RANARR_WEED(ItemID.RANARR_WEED, Skill.HERBLORE, "Cleaned Herbs"), - TOADFLAX(ItemID.TOADFLAX, Skill.HERBLORE, "Cleaned Herbs"), - IRIT_LEAF(ItemID.IRIT_LEAF, Skill.HERBLORE, "Cleaned Herbs"), - AVANTOE(ItemID.AVANTOE, Skill.HERBLORE, "Cleaned Herbs"), - KWUARM(ItemID.KWUARM, Skill.HERBLORE, "Cleaned Herbs"), - SNAPDRAGON(ItemID.SNAPDRAGON, Skill.HERBLORE, "Cleaned Herbs"), - CADANTINE(ItemID.CADANTINE, Skill.HERBLORE, "Cleaned Herbs"), - LANTADYME(ItemID.LANTADYME, Skill.HERBLORE, "Cleaned Herbs"), - DWARF_WEED(ItemID.DWARF_WEED, Skill.HERBLORE, "Cleaned Herbs"), - TORSTOL(ItemID.TORSTOL, Skill.HERBLORE, "Cleaned Herbs"), - // Unfinished Potions - GUAM_LEAF_POTION_UNF(ItemID.GUAM_POTION_UNF, Skill.HERBLORE, "Unfinished Potions"), - MARRENTILL_POTION_UNF(ItemID.MARRENTILL_POTION_UNF, Skill.HERBLORE, "Unfinished Potions"), - TARROMIN_POTION_UNF(ItemID.TARROMIN_POTION_UNF, Skill.HERBLORE, "Unfinished Potions"), - HARRALANDER_POTION_UNF(ItemID.HARRALANDER_POTION_UNF, Skill.HERBLORE, "Unfinished Potions"), - RANARR_POTION_UNF(ItemID.RANARR_POTION_UNF, Skill.HERBLORE, "Unfinished Potions"), - TOADFLAX_POTION_UNF(ItemID.TOADFLAX_POTION_UNF, Skill.HERBLORE, "Unfinished Potions"), - IRIT_POTION_UNF(ItemID.IRIT_POTION_UNF, Skill.HERBLORE, "Unfinished Potions"), - AVANTOE_POTION_UNF(ItemID.AVANTOE_POTION_UNF, Skill.HERBLORE, "Unfinished Potions"), - KWUARM_POTION_UNF(ItemID.KWUARM_POTION_UNF, Skill.HERBLORE, "Unfinished Potions"), - SNAPDRAGON_POTION_UNF(ItemID.SNAPDRAGON_POTION_UNF, Skill.HERBLORE, "Unfinished Potions"), - CADANTINE_POTION_UNF(ItemID.CADANTINE_POTION_UNF, Skill.HERBLORE, "Unfinished Potions"), - LANTADYME_POTION_UNF(ItemID.LANTADYME_POTION_UNF, Skill.HERBLORE, "Unfinished Potions"), - DWARF_WEED_POTION_UNF(ItemID.DWARF_WEED_POTION_UNF, Skill.HERBLORE, "Unfinished Potions"), - TORSTOL_POTION_UNF(ItemID.TORSTOL_POTION_UNF, Skill.HERBLORE, "Unfinished Potions"), - - /** - * Prayer Items - */ - // Bones - BONES(ItemID.BONES, Skill.PRAYER, "Bones"), - WOLF_BONES(ItemID.WOLF_BONES, Skill.PRAYER, "Bones"), - BURNT_BONES(ItemID.BURNT_BONES, Skill.PRAYER, "Bones"), - MONKEY_BONES(ItemID.MONKEY_BONES, Skill.PRAYER, "Bones"), - BAT_BONES(ItemID.BAT_BONES, Skill.PRAYER, "Bones"), - JOGRE_BONES(ItemID.JOGRE_BONES, Skill.PRAYER, "Bones"), - BIG_BONES(ItemID.BIG_BONES, Skill.PRAYER, "Bones"), - ZOGRE_BONES(ItemID.ZOGRE_BONES, Skill.PRAYER, "Bones"), - SHAIKAHAN_BONES(ItemID.SHAIKAHAN_BONES, Skill.PRAYER, "Bones"), - BABYDRAGON_BONES(ItemID.BABYDRAGON_BONES, Skill.PRAYER, "Bones"), - WYRM_BONES(ItemID.WYRM_BONES, Skill.PRAYER, "Bones"), - WYVERN_BONES(ItemID.WYVERN_BONES, Skill.PRAYER, "Bones"), - DRAGON_BONES(ItemID.DRAGON_BONES, Skill.PRAYER, "Bones"), - DRAKE_BONES(ItemID.DRAKE_BONES, Skill.PRAYER, "Bones"), - FAYRG_BONES(ItemID.FAYRG_BONES, Skill.PRAYER, "Bones"), - LAVA_DRAGON_BONES(ItemID.LAVA_DRAGON_BONES, Skill.PRAYER, "Bones"), - RAURG_BONES(ItemID.RAURG_BONES, Skill.PRAYER, "Bones"), - HYDRA_BONES(ItemID.HYDRA_BONES, Skill.PRAYER, "Bones"), - DAGANNOTH_BONES(ItemID.DAGANNOTH_BONES, Skill.PRAYER, "Bones"), - OURG_BONES(ItemID.OURG_BONES, Skill.PRAYER, "Bones"), - SUPERIOR_DRAGON_BONES(ItemID.SUPERIOR_DRAGON_BONES, Skill.PRAYER, "Bones"), - // Shade Remains (Pyre Logs) - LOAR_REMAINS(ItemID.LOAR_REMAINS, Skill.PRAYER, "Shades", true), - PHRIN_REMAINS(ItemID.PHRIN_REMAINS, Skill.PRAYER, "Shades", true), - RIYL_REMAINS(ItemID.RIYL_REMAINS, Skill.PRAYER, "Shades", true), - ASYN_REMAINS(ItemID.ASYN_REMAINS, Skill.PRAYER, "Shades", true), - FIYR_REMAINS(ItemID.FIYR_REMAINS, Skill.PRAYER, "Shades", true), - // Ensouled Heads - ENSOULED_GOBLIN_HEAD(ItemID.ENSOULED_GOBLIN_HEAD_13448, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_MONKEY_HEAD(ItemID.ENSOULED_MONKEY_HEAD_13451, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_IMP_HEAD(ItemID.ENSOULED_IMP_HEAD_13454, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_MINOTAUR_HEAD(ItemID.ENSOULED_MINOTAUR_HEAD_13457, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_SCORPION_HEAD(ItemID.ENSOULED_SCORPION_HEAD_13460, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_BEAR_HEAD(ItemID.ENSOULED_BEAR_HEAD_13463, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_UNICORN_HEAD(ItemID.ENSOULED_UNICORN_HEAD_13466, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_DOG_HEAD(ItemID.ENSOULED_DOG_HEAD_13469, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_CHAOS_DRUID_HEAD(ItemID.ENSOULED_CHAOS_DRUID_HEAD_13472, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_GIANT_HEAD(ItemID.ENSOULED_GIANT_HEAD_13475, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_OGRE_HEAD(ItemID.ENSOULED_OGRE_HEAD_13478, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_ELF_HEAD(ItemID.ENSOULED_ELF_HEAD_13481, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_TROLL_HEAD(ItemID.ENSOULED_TROLL_HEAD_13484, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_HORROR_HEAD(ItemID.ENSOULED_HORROR_HEAD_13487, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_KALPHITE_HEAD(ItemID.ENSOULED_KALPHITE_HEAD_13490, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_DAGANNOTH_HEAD(ItemID.ENSOULED_DAGANNOTH_HEAD_13493, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_BLOODVELD_HEAD(ItemID.ENSOULED_BLOODVELD_HEAD_13496, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_TZHAAR_HEAD(ItemID.ENSOULED_TZHAAR_HEAD_13499, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_DEMON_HEAD(ItemID.ENSOULED_DEMON_HEAD_13502, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_AVIANSIE_HEAD(ItemID.ENSOULED_AVIANSIE_HEAD_13505, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_ABYSSAL_HEAD(ItemID.ENSOULED_ABYSSAL_HEAD_13508, Skill.PRAYER, "Ensouled Heads", true), - ENSOULED_DRAGON_HEAD(ItemID.ENSOULED_DRAGON_HEAD_13511, Skill.PRAYER, "Ensouled Heads", true), - - /** - * Cooking Items - */ - RAW_HERRING(ItemID.RAW_HERRING, Skill.COOKING, "Fish"), - RAW_MACKEREL(ItemID.RAW_MACKEREL, Skill.COOKING, "Fish"), - RAW_TROUT(ItemID.RAW_TROUT, Skill.COOKING, "Fish"), - RAW_COD(ItemID.RAW_COD, Skill.COOKING, "Fish"), - RAW_PIKE(ItemID.RAW_PIKE, Skill.COOKING, "Fish"), - RAW_SALMON(ItemID.RAW_SALMON, Skill.COOKING, "Fish"), - RAW_TUNA(ItemID.RAW_TUNA, Skill.COOKING, "Fish"), - RAW_KARAMBWAN(ItemID.RAW_KARAMBWAN, Skill.COOKING, "Fish"), - RAW_LOBSTER(ItemID.RAW_LOBSTER, Skill.COOKING, "Fish"), - RAW_BASS(ItemID.RAW_BASS, Skill.COOKING, "Fish"), - RAW_SWORDFISH(ItemID.RAW_SWORDFISH, Skill.COOKING, "Fish"), - RAW_MONKFISH(ItemID.RAW_MONKFISH, Skill.COOKING, "Fish"), - RAW_SHARK(ItemID.RAW_SHARK, Skill.COOKING, "Fish"), - RAW_SEA_TURTLE(ItemID.RAW_SEA_TURTLE, Skill.COOKING, "Fish"), - RAW_ANGLERFISH(ItemID.RAW_ANGLERFISH, Skill.COOKING, "Fish"), - RAW_DARK_CRAB(ItemID.RAW_DARK_CRAB, Skill.COOKING, "Fish"), - RAW_MANTA_RAY(ItemID.RAW_MANTA_RAY, Skill.COOKING, "Fish"), - - GRAPES(ItemID.GRAPES, Skill.COOKING, "Other"), - - /** - * Crafting Items - */ - WOOL(ItemID.WOOL, Skill.CRAFTING, "Misc"), - FLAX(ItemID.FLAX, Skill.CRAFTING, "Misc"), - MOLTEN_GLASS(ItemID.MOLTEN_GLASS, Skill.CRAFTING, "Misc"), - BATTLESTAFF(ItemID.BATTLESTAFF, Skill.CRAFTING, "Misc"), - - // D'hide/Dragon Leather - GREEN_DRAGONHIDE(ItemID.GREEN_DRAGONHIDE, Skill.CRAFTING, "D'hide"), - GREEN_DRAGON_LEATHER(ItemID.GREEN_DRAGON_LEATHER, Skill.CRAFTING, "D'hide"), - BLUE_DRAGONHIDE(ItemID.BLUE_DRAGONHIDE, Skill.CRAFTING, "D'hide"), - BLUE_DRAGON_LEATHER(ItemID.BLUE_DRAGON_LEATHER, Skill.CRAFTING, "D'hide"), - RED_DRAGONHIDE(ItemID.RED_DRAGONHIDE, Skill.CRAFTING, "D'hide"), - RED_DRAGON_LEATHER(ItemID.RED_DRAGON_LEATHER, Skill.CRAFTING, "D'hide"), - BLACK_DRAGONHIDE(ItemID.BLACK_DRAGONHIDE, Skill.CRAFTING, "D'hide"), - BLACK_DRAGON_LEATHER(ItemID.BLACK_DRAGON_LEATHER, Skill.CRAFTING, "D'hide"), - - // Uncut Gems - UNCUT_OPAL(ItemID.UNCUT_OPAL, Skill.CRAFTING, "Gems"), - UNCUT_JADE(ItemID.UNCUT_JADE, Skill.CRAFTING, "Gems"), - UNCUT_RED_TOPAZ(ItemID.UNCUT_RED_TOPAZ, Skill.CRAFTING, "Gems"), - UNCUT_SAPPHIRE(ItemID.UNCUT_SAPPHIRE, Skill.CRAFTING, "Gems"), - UNCUT_EMERALD(ItemID.UNCUT_EMERALD, Skill.CRAFTING, "Gems"), - UNCUT_RUBY(ItemID.UNCUT_RUBY, Skill.CRAFTING, "Gems"), - UNCUT_DIAMOND(ItemID.UNCUT_DIAMOND, Skill.CRAFTING, "Gems"), - UNCUT_DRAGONSTONE(ItemID.UNCUT_DRAGONSTONE, Skill.CRAFTING, "Gems"), - UNCUT_ONYX(ItemID.UNCUT_ONYX, Skill.CRAFTING, "Gems"), - UNCUT_ZENYTE(ItemID.UNCUT_ZENYTE, Skill.CRAFTING, "Gems"), - - // Cut Gems - OPAL(ItemID.OPAL, Skill.CRAFTING, "Gems"), - JADE(ItemID.JADE, Skill.CRAFTING, "Gems"), - RED_TOPAZ(ItemID.RED_TOPAZ, Skill.CRAFTING, "Gems"), - SAPPHIRE(ItemID.SAPPHIRE, Skill.CRAFTING, "Gems"), - EMERALD(ItemID.EMERALD, Skill.CRAFTING, "Gems"), - RUBY(ItemID.RUBY, Skill.CRAFTING, "Gems"), - DIAMOND(ItemID.DIAMOND, Skill.CRAFTING, "Gems"), - DRAGONSTONE(ItemID.DRAGONSTONE, Skill.CRAFTING, "Gems"), - ONYX(ItemID.ONYX, Skill.CRAFTING, "Gems"), - ZENYTE(ItemID.ZENYTE, Skill.CRAFTING, "Gems"), - - /** - * Smithing Items - */ - - // Ores - IRON_ORE(ItemID.IRON_ORE, Skill.SMITHING, "Ore"), - SILVER_ORE(ItemID.SILVER_ORE, Skill.SMITHING, "Ore"), - GOLD_ORE(ItemID.GOLD_ORE, Skill.SMITHING, "Ore"), - MITHRIL_ORE(ItemID.MITHRIL_ORE, Skill.SMITHING, "Ore"), - ADAMANTITE_ORE(ItemID.ADAMANTITE_ORE, Skill.SMITHING, "Ore"), - RUNITE_ORE(ItemID.RUNITE_ORE, Skill.SMITHING, "Ore"), - - // Bars - BRONZE_BAR(ItemID.BRONZE_BAR, Skill.SMITHING, "Bars"), - IRON_BAR(ItemID.IRON_BAR, Skill.SMITHING, "Bars"), - STEEL_BAR(ItemID.STEEL_BAR, Skill.SMITHING, "Bars"), - MITHRIL_BAR(ItemID.MITHRIL_BAR, Skill.SMITHING, "Bars"), - ADAMANTITE_BAR(ItemID.ADAMANTITE_BAR, Skill.SMITHING, "Bars"), - RUNITE_BAR(ItemID.RUNITE_BAR, Skill.SMITHING, "Bars"), - - /** - * Farming Items - */ - // Seeds - ACORN(ItemID.ACORN, Skill.FARMING, "Seeds"), - WILLOW_SEED(ItemID.WILLOW_SEED, Skill.FARMING, "Seeds"), - MAPLE_SEED(ItemID.MAPLE_SEED, Skill.FARMING, "Seeds"), - YEW_SEED(ItemID.YEW_SEED, Skill.FARMING, "Seeds"), - MAGIC_SEED(ItemID.MAGIC_SEED, Skill.FARMING, "Seeds"), - APPLE_TREE_SEED(ItemID.APPLE_TREE_SEED, Skill.FARMING, "Seeds"), - BANANA_TREE_SEED(ItemID.BANANA_TREE_SEED, Skill.FARMING, "Seeds"), - ORANGE_TREE_SEED(ItemID.ORANGE_TREE_SEED, Skill.FARMING, "Seeds"), - CURRY_TREE_SEED(ItemID.CURRY_TREE_SEED, Skill.FARMING, "Seeds"), - PINEAPPLE_SEED(ItemID.PINEAPPLE_SEED, Skill.FARMING, "Seeds"), - PAPAYA_TREE_SEED(ItemID.PAPAYA_TREE_SEED, Skill.FARMING, "Seeds"), - PALM_TREE_SEED(ItemID.PALM_TREE_SEED, Skill.FARMING, "Seeds"), - CALQUAT_TREE_SEED(ItemID.CALQUAT_TREE_SEED, Skill.FARMING, "Seeds"), - TEAK_SEED(ItemID.TEAK_SEED, Skill.FARMING, "Seeds"), - MAHOGANY_SEED(ItemID.MAHOGANY_SEED, Skill.FARMING, "Seeds"), - SPIRIT_SEED(ItemID.SPIRIT_SEED, Skill.FARMING, "Seeds"), - - // Saplings - OAK_SAPLING(ItemID.OAK_SAPLING, Skill.FARMING, "Saplings"), - WILLOW_SAPLING(ItemID.WILLOW_SAPLING, Skill.FARMING, "Saplings"), - MAPLE_SAPLING(ItemID.MAPLE_SAPLING, Skill.FARMING, "Saplings"), - YEW_SAPLING(ItemID.YEW_SAPLING, Skill.FARMING, "Saplings"), - MAGIC_SAPLING(ItemID.MAGIC_SAPLING, Skill.FARMING, "Saplings"), - APPLE_TREE_SAPLING(ItemID.APPLE_SAPLING, Skill.FARMING, "Saplings"), - BANANA_TREE_SAPLING(ItemID.BANANA_SAPLING, Skill.FARMING, "Saplings"), - ORANGE_TREE_SAPLING(ItemID.ORANGE_SAPLING, Skill.FARMING, "Saplings"), - CURRY_TREE_SAPLING(ItemID.CURRY_SAPLING, Skill.FARMING, "Saplings"), - PINEAPPLE_SAPLING(ItemID.PINEAPPLE_SAPLING, Skill.FARMING, "Saplings"), - PAPAYA_TREE_SAPLING(ItemID.PAPAYA_SAPLING, Skill.FARMING, "Saplings"), - PALM_TREE_SAPLING(ItemID.PALM_SAPLING, Skill.FARMING, "Saplings"), - CALQUAT_TREE_SAPLING(ItemID.CALQUAT_SAPLING, Skill.FARMING, "Saplings"), - TEAK_SAPLING(ItemID.TEAK_SAPLING, Skill.FARMING, "Saplings"), - MAHOGANY_SAPLING(ItemID.MAHOGANY_SAPLING, Skill.FARMING, "Saplings"), - SPIRIT_SAPLING(ItemID.SPIRIT_SAPLING, Skill.FARMING, "Saplings"), - - /** - * Fletching - */ - // Logs - FLETCH_LOGS(ItemID.LOGS, Skill.FLETCHING, "Logs"), - FLETCH_OAK_LOGS(ItemID.OAK_LOGS, Skill.FLETCHING, "Logs"), - FLETCH_WILLOW_LOGS(ItemID.WILLOW_LOGS, Skill.FLETCHING, "Logs"), - FLETCH_MAPLE_LOGS(ItemID.MAPLE_LOGS, Skill.FLETCHING, "Logs"), - FLETCH_YEW_LOGS(ItemID.YEW_LOGS, Skill.FLETCHING, "Logs"), - FLETCH_MAGIC_LOGS(ItemID.MAGIC_LOGS, Skill.FLETCHING, "Logs"), - FLETCH_REDWOOD_LOGS(ItemID.REDWOOD_LOGS, Skill.FLETCHING, "Logs"), - // Unstrung - FLETCH_SHORTBOW_U(ItemID.SHORTBOW_U, Skill.FLETCHING, "Unstrung"), - FLETCH_LONGBOW_U(ItemID.LONGBOW_U, Skill.FLETCHING, "Unstrung"), - FLETCH_OAK_SHORTBOW_U(ItemID.OAK_SHORTBOW_U, Skill.FLETCHING, "Unstrung"), - FLETCH_OAK_LONGBOW_U(ItemID.OAK_LONGBOW_U, Skill.FLETCHING, "Unstrung"), - FLETCH_WILLOW_SHORTBOW_U(ItemID.WILLOW_SHORTBOW_U, Skill.FLETCHING, "Unstrung"), - FLETCH_WILLOW_LONGBOW_U(ItemID.WILLOW_LONGBOW_U, Skill.FLETCHING, "Unstrung"), - FLETCH_MAPLE_SHORTBOW_U(ItemID.MAPLE_SHORTBOW_U, Skill.FLETCHING, "Unstrung"), - FLETCH_MAPLE_LONGBOW_U(ItemID.MAPLE_LONGBOW_U, Skill.FLETCHING, "Unstrung"), - FLETCH_YEW_SHORTBOW_U(ItemID.YEW_SHORTBOW_U, Skill.FLETCHING, "Unstrung"), - FLETCH_YEW_LONGBOW_U(ItemID.YEW_LONGBOW_U, Skill.FLETCHING, "Unstrung"), - FLETCH_MAGIC_SHORTBOW_U(ItemID.MAGIC_SHORTBOW_U, Skill.FLETCHING, "Unstrung"), - FLETCH_MAGIC_LONGBOW_U(ItemID.MAGIC_LONGBOW_U, Skill.FLETCHING, "Unstrung"), - // Darts - FLETCH_BRONZE_DART_TIP(ItemID.BRONZE_DART_TIP, Skill.FLETCHING, "Dart tip"), - FLETCH_IRON_DART_TIP(ItemID.IRON_DART_TIP, Skill.FLETCHING, "Dart tip"), - FLETCH_STEEL_DART_TIP(ItemID.STEEL_DART_TIP, Skill.FLETCHING, "Dart tip"), - FLETCH_MITHRIL_DART_TIP(ItemID.MITHRIL_DART_TIP, Skill.FLETCHING, "Dart tip"), - FLETCH_ADAMANT_DART_TIP(ItemID.ADAMANT_DART_TIP, Skill.FLETCHING, "Dart tip"), - FLETCH_RUNE_DART_TIP(ItemID.RUNE_DART_TIP, Skill.FLETCHING, "Dart tip"), - FLETCH_DRAGON_DART_TIP(ItemID.DRAGON_DART_TIP, Skill.FLETCHING, "Dart tip"), - // Arrows - FLETCH_BRONZE_ARROWTIPS(ItemID.BRONZE_ARROWTIPS, Skill.FLETCHING, "Arrow"), - FLETCH_IRON_ARROWTIPS(ItemID.IRON_ARROWTIPS, Skill.FLETCHING, "Arrow"), - FLETCH_STEEL_ARROWTIPS(ItemID.STEEL_ARROWTIPS, Skill.FLETCHING, "Arrow"), - FLETCH_MITHRIL_ARROWTIPS(ItemID.MITHRIL_ARROWTIPS, Skill.FLETCHING, "Arrow"), - FLETCH_BROAD_ARROWHEADS(ItemID.BROAD_ARROWHEADS, Skill.FLETCHING, "Arrow"), - FLETCH_ADAMANT_ARROWTIPS(ItemID.ADAMANT_ARROWTIPS, Skill.FLETCHING, "Arrow"), - FLETCH_RUNE_ARROWTIPS(ItemID.RUNE_ARROWTIPS, Skill.FLETCHING, "Arrow"), - FLETCH_AMETHYST_ARROWTIPS(ItemID.AMETHYST_ARROWTIPS, Skill.FLETCHING, "Arrow"), - FLETCH_DRAGON_ARROWTIPS(ItemID.DRAGON_ARROWTIPS, Skill.FLETCHING, "Arrow"), - //Javelins - FLETCH_BRONZE_JAVELINHEAD(ItemID.BRONZE_JAVELIN_HEADS, Skill.FLETCHING, "Javelin"), - FLETCH_IRON_JAVELINHEAD(ItemID.IRON_JAVELIN_HEADS, Skill.FLETCHING, "Javelin"), - FLETCH_STEEL_JAVELINHEAD(ItemID.STEEL_JAVELIN_HEADS, Skill.FLETCHING, "Javelin"), - FLETCH_MITHRIL_JAVELINHEAD(ItemID.MITHRIL_JAVELIN_HEADS, Skill.FLETCHING, "Javelin"), - FLETCH_ADAMANT_JAVELINHEAD(ItemID.ADAMANT_JAVELIN_HEADS, Skill.FLETCHING, "Javelin"), - FLETCH_RUNE_JAVELINHEAD(ItemID.RUNE_JAVELIN_HEADS, Skill.FLETCHING, "Javelin"), - FLETCH_AMETHYST_JAVELINHEAD(ItemID.AMETHYST_JAVELIN_HEADS, Skill.FLETCHING, "Javelin"), - FLETCH_DRAGON_JAVELINHEAD(ItemID.DRAGON_JAVELIN_HEADS, Skill.FLETCHING, "Javelin"), - //Bolts - FLETCH_BRONZE_BOLT(ItemID.BRONZE_BOLTS_UNF, Skill.FLETCHING, "Bolt"), - FLETCH_BLURITE_BOLT(ItemID.BLURITE_BOLTS_UNF, Skill.FLETCHING, "Bolt"), - FLETCH_IRON_BOLT(ItemID.IRON_BOLTS_UNF, Skill.FLETCHING, "Bolt"), - FLETCH_SILVER_BOLT(ItemID.SILVER_BOLTS_UNF, Skill.FLETCHING, "Bolt"), - FLETCH_STEEL_BOLT(ItemID.STEEL_BOLTS_UNF, Skill.FLETCHING, "Bolt"), - FLETCH_MITHRIL_BOLT(ItemID.MITHRIL_BOLTS_UNF, Skill.FLETCHING, "Bolt"), - FLETCH_BROAD_BOLT(ItemID.UNFINISHED_BROAD_BOLTS, Skill.FLETCHING, "Bolt"), - FLETCH_ADAMANT_BOLT(ItemID.ADAMANT_BOLTSUNF, Skill.FLETCHING, "Bolt"), - FLETCH_RUNE_BOLT(ItemID.RUNITE_BOLTS_UNF, Skill.FLETCHING, "Bolt"), - FLETCH_DRAGON_BOLT(ItemID.DRAGON_BOLTS_UNF, Skill.FLETCHING, "Bolt"), - //Bolt Tips - FLETCH_OPAL_TIPS(ItemID.OPAL, Skill.FLETCHING, "Bolt tips"), - FLETCH_JADE_TIPS(ItemID.JADE, Skill.FLETCHING, "Bolt tips"), - FLETCH_RED_TOPAZ_TIPS(ItemID.RED_TOPAZ, Skill.FLETCHING, "Bolt tips"), - FLETCH_SAPPHIRE_TIPS(ItemID.SAPPHIRE, Skill.FLETCHING, "Bolt tips"), - FLETCH_EMERALD_TIPS(ItemID.EMERALD, Skill.FLETCHING, "Bolt tips"), - FLETCH_RUBY_TIPS(ItemID.RUBY, Skill.FLETCHING, "Bolt tips"), - FLETCH_DIAMOND_TIPS(ItemID.DIAMOND, Skill.FLETCHING, "Bolt tips"), - FLETCH_DRAGONSTONE_TIPS(ItemID.DRAGONSTONE, Skill.FLETCHING, "Bolt tips"), - FLETCH_ONYX_TIPS(ItemID.ONYX, Skill.FLETCHING, "Bolt tips"), - //Tipped Bolts - FLETCH_TIPPED_OPAL_BOLT(ItemID.OPAL_BOLT_TIPS, Skill.FLETCHING, "Tipped bolts"), - FLETCH_TIPPED_JADE_BOLT(ItemID.JADE_BOLT_TIPS, Skill.FLETCHING, "Tipped bolts"), - FLETCH_TIPPED_PEARL_BOLT(ItemID.PEARL_BOLT_TIPS, Skill.FLETCHING, "Tipped bolts"), - FLETCH_TIPPED_TOPAZ_BOLT(ItemID.TOPAZ_BOLT_TIPS, Skill.FLETCHING, "Tipped bolts"), - FLETCH_TIPPED_SAPPHIRE_BOLT(ItemID.SAPPHIRE_BOLT_TIPS, Skill.FLETCHING, "Tipped bolts"), - FLETCH_TIPPED_EMERALD_BOLT(ItemID.EMERALD_BOLT_TIPS, Skill.FLETCHING, "Tipped bolts"), - FLETCH_TIPPED_RUBY_BOLT(ItemID.RUBY_BOLT_TIPS, Skill.FLETCHING, "Tipped bolts"), - FLETCH_TIPPED_DIAMOND_BOLT(ItemID.DIAMOND_BOLT_TIPS, Skill.FLETCHING, "Tipped bolts"), - FLETCH_TIPPED_DRAGONSTONE_BOLT(ItemID.DRAGONSTONE_BOLT_TIPS, Skill.FLETCHING, "Tipped bolts"), - FLETCH_TIPPED_ONYX_BOLT(ItemID.ONYX_BOLT_TIPS, Skill.FLETCHING, "Tipped bolts"), - FLETCH_TIPPED_AMETHYST_BOLT(ItemID.AMETHYST_BOLT_TIPS, Skill.FLETCHING, "Tipped bolts"), - - /** - * FireMaking - */ - //Logs - FM_LOGS(ItemID.LOGS, Skill.FIREMAKING, "Logs"), - FM_ACHEY_LOGS(ItemID.ACHEY_TREE_LOGS, Skill.FIREMAKING, "Logs"), - FM_OAK_LOGS(ItemID.OAK_LOGS, Skill.FIREMAKING, "Logs"), - FM_WILLOW_LOGS(ItemID.WILLOW_LOGS, Skill.FIREMAKING, "Logs"), - FM_TEAK_LOGS(ItemID.TEAK_LOGS, Skill.FIREMAKING, "Logs"), - FM_ARTIC_PINE_LOGS(ItemID.ARCTIC_PINE_LOGS, Skill.FIREMAKING, "Logs"), - FM_MAPLE_LOGS(ItemID.MAPLE_LOGS, Skill.FIREMAKING, "Logs"), - FM_MAHOGANY_LOGS(ItemID.MAHOGANY_LOGS, Skill.FIREMAKING, "Logs"), - FM_YEW_LOGS(ItemID.YEW_LOGS, Skill.FIREMAKING, "Logs"), - FM_MAGIC_LOGS(ItemID.MAGIC_LOGS, Skill.FIREMAKING, "Logs"), - FM_REDWOOD_LOGS(ItemID.REDWOOD_LOGS, Skill.FIREMAKING, "Logs"), - - ; - - private static final Multimap SKILL_MAP = ArrayListMultimap.create(); - private static final Map ITEM_ID_MAP = new HashMap<>(); - - static - { - for (CriticalItem i : values()) - { - Skill s = i.getSkill(); - SKILL_MAP.put(s, i); - ITEM_ID_MAP.put(i.getItemID(), i); - } - } - - private final int itemID; - private final Skill skill; - private final String category; - private boolean ignoreBonus; - @Setter - // Stores the item composition info we use since we don't operate on the game thread - private ItemInfo itemInfo = null; - @Setter - private Activity selectedActivity; - - CriticalItem(int itemID, Skill skill, String category, boolean ignoreBonus) - { - this.itemID = itemID; - this.category = category; - this.skill = skill; - this.ignoreBonus = ignoreBonus; - } - - CriticalItem(int itemID, Skill skill, String category) - { - this(itemID, skill, category, false); - } - - public static Collection getBySkill(Skill skill) - { - Collection items = SKILL_MAP.get(skill); - if (items == null) - { - items = new ArrayList<>(); - } - - return items; - } - - public static CriticalItem getByItemId(int id) - { - return ITEM_ID_MAP.get(id); - } - - /** - * Attaches the Item Composition to each CriticalItem on client initial load - * - * @param m ItemManager - */ - public static void prepareItemDefinitions(ItemManager m) - { - for (CriticalItem i : values()) - { - if (i.itemInfo != null) - { - return; - } - - final ItemDefinition c = m.getItemDefinition(i.getItemID()); - i.itemInfo = new ItemInfo(c.getName(), c.isStackable()); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/ItemInfo.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/ItemInfo.java deleted file mode 100644 index 8bc3651ed9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/ItemInfo.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.skillcalculator.banked.beans; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class ItemInfo -{ - private String name; - private boolean stackable; -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/ItemStack.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/ItemStack.java deleted file mode 100644 index 44ea6808c7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/ItemStack.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.skillcalculator.banked.beans; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class ItemStack -{ - private int id; - private int qty; -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/Secondaries.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/Secondaries.java deleted file mode 100644 index f578ea14c7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/Secondaries.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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.skillcalculator.banked.beans; - -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ItemID; - -@Getter(AccessLevel.PACKAGE) -public enum Secondaries -{ - /** - * Herblore - */ - UNFINISHED_POTION(new ItemStack(ItemID.VIAL_OF_WATER, 1)), - SWAMP_TAR(new ItemStack(ItemID.SWAMP_TAR, 15)), - // Guam - ATTACK_POTION(new ItemStack(ItemID.EYE_OF_NEWT, 1)), - // Marrentil - ANTIPOISON(new ItemStack(ItemID.UNICORN_HORN_DUST, 1)), - // Tarromin - STRENGTH_POTION(new ItemStack(ItemID.LIMPWURT_ROOT, 1)), - SERUM_207(new ItemStack(ItemID.ASHES, 1)), - // Harralander - COMPOST_POTION(new ItemStack(ItemID.VOLCANIC_ASH, 1)), - RESTORE_POTION(new ItemStack(ItemID.RED_SPIDERS_EGGS, 1)), - ENERGY_POTION(new ItemStack(ItemID.CHOCOLATE_DUST, 1)), - COMBAT_POTION(new ItemStack(ItemID.GOAT_HORN_DUST, 1)), - // Ranarr Weed - DEFENCE_POTION(new ItemStack(ItemID.WHITE_BERRIES, 1)), - PRAYER_POTION(new ItemStack(ItemID.SNAPE_GRASS, 1)), - // Toadflax - AGILITY_POTION(new ItemStack(ItemID.TOADS_LEGS, 1)), - SARADOMIN_BREW(new ItemStack(ItemID.CRUSHED_NEST, 1)), - // Irit - SUPER_ATTACK(new ItemStack(ItemID.EYE_OF_NEWT, 1)), - SUPERANTIPOISON(new ItemStack(ItemID.UNICORN_HORN_DUST, 1)), - // Avantoe - FISHING_POTION(new ItemStack(ItemID.SNAPE_GRASS, 1)), - SUPER_ENERGY_POTION(new ItemStack(ItemID.MORT_MYRE_FUNGUS, 1)), - HUNTER_POTION(new ItemStack(ItemID.KEBBIT_TEETH_DUST, 1)), - // Kwuarm - SUPER_STRENGTH(new ItemStack(ItemID.LIMPWURT_ROOT, 1)), - // Snapdragon - SUPER_RESTORE(new ItemStack(ItemID.RED_SPIDERS_EGGS, 1)), - SANFEW_SERUM(new ItemStack(ItemID.SNAKE_WEED, 1), new ItemStack(ItemID.UNICORN_HORN_DUST, 1), new ItemStack(ItemID.SUPER_RESTORE4, 1), new ItemStack(ItemID.NAIL_BEAST_NAILS, 1)), - // Cadantine - SUPER_DEFENCE_POTION(new ItemStack(ItemID.WHITE_BERRIES, 1)), - // Lantadyme - ANTIFIRE_POTION(new ItemStack(ItemID.DRAGON_SCALE_DUST, 1)), - MAGIC_POTION(new ItemStack(ItemID.POTATO_CACTUS, 1)), - // Dwarf Weed - RANGING_POTION(new ItemStack(ItemID.WINE_OF_ZAMORAK, 1)), - // Torstol - ZAMORAK_BREW(new ItemStack(ItemID.JANGERBERRIES, 1)), - SUPER_COMBAT_POTION(new ItemStack(ItemID.SUPER_ATTACK4, 1), new ItemStack(ItemID.SUPER_STRENGTH4, 1), new ItemStack(ItemID.SUPER_DEFENCE4, 1)), - ANTIVENOM_PLUS(new ItemStack(ItemID.ANTIVENOM4, 1)), - - /** - * Smithing - */ - COAL_ORE(new ItemStack(ItemID.COAL, 1)), - COAL_ORE_2(new ItemStack(ItemID.COAL, 2)), - COAL_ORE_4(new ItemStack(ItemID.COAL, 4)), - COAL_ORE_6(new ItemStack(ItemID.COAL, 6)), - COAL_ORE_8(new ItemStack(ItemID.COAL, 8)), - - /** - * Crafting - */ - GOLD_BAR(new ItemStack(ItemID.GOLD_BAR, 1)), - SILVER_BAR(new ItemStack(ItemID.SILVER_BAR, 1)), - WATER_ORB(new ItemStack(ItemID.WATER_ORB, 1)), - EARTH_ORB(new ItemStack(ItemID.EARTH_ORB, 1)), - FIRE_ORB(new ItemStack(ItemID.FIRE_ORB, 1)), - AIR_ORB(new ItemStack(ItemID.AIR_ORB, 1)), - - /** - * Construction - */ - COINS_100(new ItemStack(ItemID.COINS_995, 100)), - COINS_250(new ItemStack(ItemID.COINS_995, 250)), - COINS_500(new ItemStack(ItemID.COINS_995, 500)), - COINS_1500(new ItemStack(ItemID.COINS_995, 1500)), - - /** - * Cooking - */ - JUG_OF_WATER(new ItemStack(ItemID.JUG_OF_WATER, 1)), - - /** - * Fletching - */ - BOW_STRING(new ItemStack(ItemID.BOW_STRING, 1)), - FEATHER(new ItemStack(ItemID.FEATHER, 1)), - HEADLESS_ARROW(new ItemStack(ItemID.HEADLESS_ARROW, 1)), - JAVELIN_SHAFT(new ItemStack(ItemID.JAVELIN_SHAFT, 1)), - BRONZE_BOLT(new ItemStack(ItemID.BRONZE_BOLTS, 1)), - BLURITE_BOLT(new ItemStack(ItemID.BLURITE_BOLTS, 1)), - IRON_BOLT(new ItemStack(ItemID.IRON_BOLTS, 1)), - STEEL_BOLT(new ItemStack(ItemID.STEEL_BOLTS, 1)), - MITHRIL_BOLT(new ItemStack(ItemID.MITHRIL_BOLTS, 1)), - BROAD_BOLT(new ItemStack(ItemID.BROAD_BOLTS, 1)), - ADAMANT_BOLT(new ItemStack(ItemID.ADAMANT_BOLTS, 1)), - RUNE_BOLT(new ItemStack(ItemID.RUNITE_BOLTS, 1)), - DRAGON_BOLT(new ItemStack(ItemID.DRAGON_BOLTS, 1)), - ; - private final ItemStack[] items; - - Secondaries(ItemStack... items) - { - this.items = items; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/XpModifiers.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/XpModifiers.java deleted file mode 100644 index 06c850ceef..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/beans/XpModifiers.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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.skillcalculator.banked.beans; - -import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.Multimap; -import java.util.Collection; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.Skill; - -@AllArgsConstructor -@Getter(AccessLevel.PUBLIC) -public enum XpModifiers -{ - LIT_GILDER_ALTAR(Skill.PRAYER, "Lit Gilded Altar (350%)", 3.5f), - ECTOFUNTUS(Skill.PRAYER, "Ectofuntus (400%)", 4), - WILDY_ALTAR(Skill.PRAYER, "Wildy Altar (700%)", 7), - - FARMERS_OUTFIT(Skill.FARMING, "Farmer's Outfit (+2.5%)", 1.025f); - - private final Skill skill; - private final String name; - private final float modifier; - - private final static Multimap MODIFIERS_MAP; - - static - { - final ImmutableMultimap.Builder map = ImmutableMultimap.builder(); - for (final XpModifiers m : values()) - { - map.put(m.skill, m); - } - MODIFIERS_MAP = map.build(); - } - - public static Collection getModifiersBySkill(final Skill skill) - { - return MODIFIERS_MAP.get(skill); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/components/GridItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/components/GridItem.java deleted file mode 100644 index a7670bab53..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/components/GridItem.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * 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.skillcalculator.banked.components; - -import java.awt.Color; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.function.BooleanSupplier; -import javax.swing.BorderFactory; -import javax.swing.JLabel; -import javax.swing.JMenuItem; -import javax.swing.JPopupMenu; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.client.plugins.skillcalculator.banked.BankedCalculator; -import net.runelite.client.plugins.skillcalculator.banked.beans.Activity; -import net.runelite.client.plugins.skillcalculator.banked.beans.BankedItem; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.util.AsyncBufferedImage; - -@Getter(AccessLevel.PUBLIC) -public class GridItem extends JLabel -{ - private final static String IGNORE = "Ignore Item"; - private final static String INCLUDE = "Include Item"; - - private static final Color UNSELECTED_BACKGROUND = ColorScheme.DARKER_GRAY_COLOR; - private static final Color UNSELECTED_HOVER_BACKGROUND = ColorScheme.DARKER_GRAY_HOVER_COLOR; - - private static final Color SELECTED_BACKGROUND = new Color(0, 70, 0); - private static final Color SELECTED_HOVER_BACKGROUND = new Color(0, 100, 0); - - private static final Color IGNORED_BACKGROUND = new Color(90, 0, 0); - private static final Color IGNORED_HOVER_BACKGROUND = new Color(120, 0, 0); - private final SelectionGrid parent; - private final BankedItem bankedItem; - private final JMenuItem IGNORE_OPTION = new JMenuItem(IGNORE); - /* To be executed when this element is clicked */ - @Setter(AccessLevel.PUBLIC) - private BooleanSupplier onSelectEvent; - /* To be executed when this element is ignored */ - @Setter(AccessLevel.PUBLIC) - private BooleanSupplier onIgnoreEvent; - private int amount; - private boolean selected = false; - private boolean ignored = false; - - GridItem(final SelectionGrid parent, final BankedItem item, final AsyncBufferedImage icon, final int amount) - { - super(""); - - this.parent = parent; - this.bankedItem = item; - - this.setOpaque(true); - this.setBackground(ColorScheme.DARKER_GRAY_COLOR); - this.setBorder(BorderFactory.createEmptyBorder(5, 0, 2, 0)); - - this.setVerticalAlignment(SwingConstants.CENTER); - this.setHorizontalAlignment(SwingConstants.CENTER); - - updateIcon(icon, amount); - updateToolTip(); - - this.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - if (mouseEvent.getButton() == MouseEvent.BUTTON1) - { - select(); - } - } - - @Override - public void mouseEntered(MouseEvent e) - { - final GridItem item = (GridItem) e.getSource(); - item.setBackground(getHoverBackgroundColor()); - } - - @Override - public void mouseExited(MouseEvent e) - { - final GridItem item = (GridItem) e.getSource(); - item.setBackground(getBackgroundColor()); - } - }); - - IGNORE_OPTION.addActionListener(e -> - { - // Update ignored flag now so event knows new state - this.ignored = !this.ignored; - - if (onIgnoreEvent != null && !onIgnoreEvent.getAsBoolean()) - { - // Reset state - this.ignored = !this.ignored; - return; - } - - IGNORE_OPTION.setText(this.ignored ? INCLUDE : IGNORE); - this.setBackground(getBackgroundColor()); - }); - - final JPopupMenu popupMenu = new JPopupMenu(); - popupMenu.setBorder(new EmptyBorder(5, 5, 5, 5)); - popupMenu.add(IGNORE_OPTION); - - this.setComponentPopupMenu(popupMenu); - } - - private Color getBackgroundColor() - { - return ignored ? IGNORED_BACKGROUND : (selected ? SELECTED_BACKGROUND : UNSELECTED_BACKGROUND); - } - - private Color getHoverBackgroundColor() - { - return ignored ? IGNORED_HOVER_BACKGROUND : (selected ? SELECTED_HOVER_BACKGROUND : UNSELECTED_HOVER_BACKGROUND); - } - - public void select() - { - if (onSelectEvent != null && !onSelectEvent.getAsBoolean()) - { - return; - } - - selected = true; - setBackground(getBackgroundColor()); - } - - void unselect() - { - selected = false; - setBackground(getBackgroundColor()); - } - - public void updateIcon(final AsyncBufferedImage icon, final int amount) - { - icon.addTo(this); - this.amount = amount; - } - - public void updateToolTip() - { - this.setToolTipText(buildToolTip()); - } - - private String buildToolTip() - { - String tip = "" + bankedItem.getItem().getItemInfo().getName(); - - final Activity a = bankedItem.getItem().getSelectedActivity(); - if (a != null) - { - final double xp = parent.getCalc().getItemXpRate(bankedItem); - tip += "
Activity: " + a.getName(); - tip += "
Xp/Action: " + BankedCalculator.XP_FORMAT_COMMA.format(xp); - tip += "
Total Xp: " + BankedCalculator.XP_FORMAT_COMMA.format(xp * amount); - } - else - { - tip += "
Unusable at current level"; - } - - - return tip + ""; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/components/ModifyPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/components/ModifyPanel.java deleted file mode 100644 index 0e93edc09c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/components/ModifyPanel.java +++ /dev/null @@ -1,416 +0,0 @@ -/* - * 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.skillcalculator.banked.components; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.GridLayout; -import java.awt.Image; -import java.awt.event.ItemEvent; -import java.text.DecimalFormat; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.swing.ImageIcon; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingConstants; -import javax.swing.SwingUtilities; -import javax.swing.border.Border; -import javax.swing.border.EmptyBorder; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Constants; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.skillcalculator.banked.BankedCalculator; -import net.runelite.client.plugins.skillcalculator.banked.beans.Activity; -import net.runelite.client.plugins.skillcalculator.banked.beans.BankedItem; -import net.runelite.client.plugins.skillcalculator.banked.beans.CriticalItem; -import net.runelite.client.plugins.skillcalculator.banked.beans.ItemStack; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.ui.components.ComboBoxIconEntry; -import net.runelite.client.ui.components.ComboBoxListRenderer; -import net.runelite.client.ui.components.shadowlabel.JShadowedLabel; -import net.runelite.client.util.AsyncBufferedImage; - -public class ModifyPanel extends JPanel -{ - private static final Dimension ICON_SIZE = new Dimension(Constants.ITEM_SPRITE_WIDTH, Constants.ITEM_SPRITE_HEIGHT); - private static final DecimalFormat FORMAT_COMMA = new DecimalFormat("#,###.#"); - - private static final Border PANEL_BORDER = new EmptyBorder(3, 0, 3, 0); - private static final Color BACKGROUND_COLOR = ColorScheme.DARKER_GRAY_COLOR; - - private final BankedCalculator calc; - private final ItemManager itemManager; - // Banked item information display - private final JPanel labelContainer; - private final JLabel image; - private final JShadowedLabel labelName; - private final JShadowedLabel labelValue; - // Elements used to adjust banked item - private final JPanel adjustContainer; - @Getter(AccessLevel.PUBLIC) - private BankedItem bankedItem; - private Map linkedMap; - @Getter(AccessLevel.PUBLIC) - private int amount = 0; - @Getter(AccessLevel.PUBLIC) - private double total = 0; - - public ModifyPanel(final BankedCalculator calc, final ItemManager itemManager) - { - this.calc = calc; - this.itemManager = itemManager; - - this.setLayout(new GridBagLayout()); - this.setBorder(PANEL_BORDER); - this.setBackground(ColorScheme.DARK_GRAY_COLOR); - - // Banked item information display - labelContainer = new JPanel(); - labelContainer.setLayout(new BorderLayout()); - labelContainer.setBackground(BACKGROUND_COLOR); - labelContainer.setBorder(new EmptyBorder(5, 0, 5, 0)); - - // Icon - image = new JLabel(); - image.setMinimumSize(ICON_SIZE); - image.setMaximumSize(ICON_SIZE); - image.setPreferredSize(ICON_SIZE); - image.setHorizontalAlignment(SwingConstants.CENTER); - image.setBorder(new EmptyBorder(0, 8, 0, 0)); - - // Wrapper panel for the shadowed labels - final JPanel uiInfo = new JPanel(new GridLayout(2, 1)); - uiInfo.setBorder(new EmptyBorder(0, 5, 0, 0)); - uiInfo.setBackground(BACKGROUND_COLOR); - - labelName = new JShadowedLabel(); - labelName.setForeground(Color.WHITE); - labelName.setVerticalAlignment(SwingUtilities.BOTTOM); - - labelValue = new JShadowedLabel(); - labelValue.setFont(FontManager.getRunescapeSmallFont()); - labelValue.setVerticalAlignment(SwingUtilities.TOP); - - uiInfo.add(labelName); - uiInfo.add(labelValue); - - // Append elements to item info panel - labelContainer.add(image, BorderLayout.LINE_START); - labelContainer.add(uiInfo, BorderLayout.CENTER); - - // Container for tools to adjust banked calculation for this item - adjustContainer = new JPanel(); - adjustContainer.setLayout(new GridBagLayout()); - adjustContainer.setBackground(BACKGROUND_COLOR); - - GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.BOTH; - c.weightx = 1; - c.gridx = 0; - c.gridy = 0; - c.ipady = 0; - - this.add(labelContainer, c); - c.gridy++; - this.add(adjustContainer, c); - } - - // Updates the UI for the selected item - public void setBankedItem(final BankedItem bankedItem) - { - if (bankedItem == null) - { - return; - } - - this.bankedItem = bankedItem; - if (this.calc.getConfig().cascadeBankedXp()) - { - this.linkedMap = this.calc.createLinksMap(bankedItem); - - this.amount = bankedItem.getQty(); - for (int i : linkedMap.values()) - { - this.amount += i; - } - } - else - { - this.linkedMap = new HashMap<>(); - this.amount = this.calc.getItemQty(bankedItem); - } - - updateImageTooltip(); - updateLabelContainer(); - updateAdjustContainer(); - } - - private void updateImageTooltip() - { - final StringBuilder b = new StringBuilder(""); - b.append(bankedItem.getQty()).append(" x ").append(bankedItem.getItem().getItemInfo().getName()); - - for (final Map.Entry e : this.linkedMap.entrySet()) - { - b.append("
").append(e.getValue()).append(" x ").append(e.getKey().getItemInfo().getName()); - } - - b.append(""); - this.image.setToolTipText(b.toString()); - } - - private void updateLabelContainer() - { - final CriticalItem item = bankedItem.getItem(); - - // Update image icon - final boolean stackable = item.getItemInfo().isStackable() || amount > 1; - final AsyncBufferedImage icon = itemManager.getImage(item.getItemID(), amount, stackable); - final Runnable resize = () -> image.setIcon(new ImageIcon(icon.getScaledInstance(ICON_SIZE.width, ICON_SIZE.height, Image.SCALE_SMOOTH))); - icon.onLoaded(resize); - resize.run(); - - final String itemName = item.getItemInfo().getName(); - labelName.setText(itemName); - - double xp = calc.getItemXpRate(bankedItem); - total = amount * xp; - - final String value = FORMAT_COMMA.format(total) + "xp"; - labelValue.setText(value); - - labelContainer.setToolTipText("" + itemName - + "
xp: " + xp - + "
Total: " + total + " activities = Activity.getByCriticalItem(bankedItem.getItem(), level); - if (activities == null || activities.size() == 0) - { - final JLabel unusable = new JLabel("Unusable at current level"); - unusable.setVerticalAlignment(JLabel.CENTER); - unusable.setHorizontalAlignment(JLabel.CENTER); - - adjustContainer.removeAll(); - adjustContainer.add(unusable, c); - } - else if (activities.size() == 1) - { - final Activity a = activities.get(0); - - final AsyncBufferedImage img = itemManager.getImage(a.getIcon()); - final ImageIcon icon = new ImageIcon(img); - final double xp = a.getXp() * xpFactor; - final JPanel container = createShadowedLabel(icon, a.getName(), FORMAT_COMMA.format(xp) + "xp"); - - img.onLoaded(() -> - { - icon.setImage(img); - container.repaint(); - }); - - adjustContainer.add(container, c); - c.gridy++; - } - else - { - final JComboBox dropdown = new JComboBox<>(); - dropdown.setFocusable(false); // To prevent an annoying "focus paint" effect - dropdown.setForeground(Color.WHITE); - dropdown.setBorder(new EmptyBorder(2, 0, 0, 0)); - - final ComboBoxListRenderer renderer = new ComboBoxListRenderer(); - renderer.setPreferredSize(new Dimension(PluginPanel.PANEL_WIDTH, 40)); - dropdown.setRenderer(renderer); - - for (final Activity option : activities) - { - final double xp = option.getXp() * xpFactor; - String name = option.getName(); - if (xp > 0) - { - name += " (" + FORMAT_COMMA.format(xp) + "xp)"; - } - - final AsyncBufferedImage img = itemManager.getImage(option.getIcon()); - final ImageIcon icon = new ImageIcon(img); - final ComboBoxIconEntry entry = new ComboBoxIconEntry(icon, name, option); - dropdown.addItem(entry); - - img.onLoaded(() -> - { - icon.setImage(img); - dropdown.revalidate(); - dropdown.repaint(); - }); - - final Activity selected = bankedItem.getItem().getSelectedActivity(); - if (option.equals(selected)) - { - dropdown.setSelectedItem(entry); - } - } - - // Add click event handler now to prevent above code from triggering it. - dropdown.addItemListener(e -> - { - if (e.getStateChange() == ItemEvent.SELECTED && e.getItem() instanceof ComboBoxIconEntry) - { - final ComboBoxIconEntry source = (ComboBoxIconEntry) e.getItem(); - if (source.getData() instanceof Activity) - { - final Activity selectedActivity = ((Activity) source.getData()); - calc.activitySelected(bankedItem, selectedActivity); - updateLabelContainer(); - } - } - }); - - adjustContainer.add(dropdown, c); - c.gridy++; - } - final Activity a = bankedItem.getItem().getSelectedActivity(); - if (a == null) - { - return; - } - final ItemStack[] secondaries = a.getSecondaries(); - if (secondaries.length > 0 && this.calc.getConfig().showSecondaries()) - { - final JLabel secondaryLabel = new JLabel("Secondaries:"); - secondaryLabel.setVerticalAlignment(JLabel.CENTER); - secondaryLabel.setHorizontalAlignment(JLabel.CENTER); - - adjustContainer.add(secondaryLabel, c); - c.gridy++; - - final JPanel container = new JPanel(); - container.setLayout(new GridLayout(1, 6, 1, 1)); - container.setBackground(BACKGROUND_COLOR); - - for (final ItemStack s : secondaries) - { - final JLabel l = new JLabel(); - final int required = s.getQty() * amount; - - final AsyncBufferedImage img = itemManager.getImage(s.getId(), required, required > 1); - final ImageIcon icon = new ImageIcon(img); - img.onLoaded(() -> - { - icon.setImage(img); - l.repaint(); - }); - - l.setIcon(icon); - l.setHorizontalAlignment(JLabel.CENTER); - - final int available = this.calc.getItemQtyFromBank(s.getId()); - final int result = (available - required); - - final String toolTip = "" + - "Banked: " + FORMAT_COMMA.format(available) + - "
Needed: " + FORMAT_COMMA.format(required) + - "
Result: " + (result > 0 ? "+" : "") + FORMAT_COMMA.format(result) + - ""; - l.setToolTipText(toolTip); - container.add(l); - } - adjustContainer.add(container, c); - c.gridy++; - } - } - - private JPanel createShadowedLabel(final ImageIcon icon, final String name, final String value) - { - // Wrapper panel for the shadowed labels - final JPanel wrapper = new JPanel(new GridLayout(2, 1)); - wrapper.setBorder(new EmptyBorder(0, 5, 0, 0)); - wrapper.setBackground(BACKGROUND_COLOR); - - final JShadowedLabel nameLabel = new JShadowedLabel(name); - nameLabel.setForeground(Color.WHITE); - nameLabel.setVerticalAlignment(SwingUtilities.BOTTOM); - - final JShadowedLabel valueLabel = new JShadowedLabel(value); - valueLabel.setFont(FontManager.getRunescapeSmallFont()); - valueLabel.setVerticalAlignment(SwingUtilities.TOP); - - wrapper.add(nameLabel); - wrapper.add(valueLabel); - - final JPanel container = new JPanel(); - container.setLayout(new BorderLayout()); - container.setBackground(BACKGROUND_COLOR); - container.setBorder(new EmptyBorder(5, 0, 5, 0)); - - final JLabel image = new JLabel(); - image.setMinimumSize(ICON_SIZE); - image.setMaximumSize(ICON_SIZE); - image.setPreferredSize(ICON_SIZE); - image.setHorizontalAlignment(SwingConstants.CENTER); - image.setBorder(new EmptyBorder(0, 8, 0, 0)); - - image.setIcon(icon); - - container.add(image, BorderLayout.LINE_START); - container.add(wrapper, BorderLayout.CENTER); - - return container; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/components/SelectionGrid.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/components/SelectionGrid.java deleted file mode 100644 index 26d71a1176..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/components/SelectionGrid.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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.skillcalculator.banked.components; - -import java.awt.GridLayout; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.function.BooleanSupplier; -import java.util.stream.Collectors; -import javax.swing.JPanel; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.skillcalculator.banked.BankedCalculator; -import net.runelite.client.plugins.skillcalculator.banked.beans.BankedItem; -import net.runelite.client.util.AsyncBufferedImage; - -/** - * A grid that supports mouse events - */ -public class SelectionGrid extends JPanel -{ - private static final int ITEMS_PER_ROW = 5; - - @Getter(AccessLevel.PUBLIC) - private final Map panelMap = new LinkedHashMap<>(); - - @Getter(AccessLevel.PUBLIC) - private BankedItem selectedItem; - - @Getter(AccessLevel.PUBLIC) - private BankedItem lastIgnoredItem; - - /* To be executed when this element is clicked */ - @Setter(AccessLevel.PUBLIC) - private BooleanSupplier onSelectEvent; - - /* To be executed when this element is ignored */ - @Setter(AccessLevel.PUBLIC) - private BooleanSupplier onIgnoreEvent; - - @Getter(AccessLevel.PUBLIC) - private final BankedCalculator calc; - - public SelectionGrid(final BankedCalculator calc, final Collection items, final ItemManager itemManager) - { - this.calc = calc; - // Create a panel for every item - for (final BankedItem item : items) - { - final int qty = calc.getItemQty(item); - final boolean stackable = item.getItem().getItemInfo().isStackable() || qty > 1; - final AsyncBufferedImage img = itemManager.getImage(item.getItem().getItemID(), qty, stackable); - - final GridItem gridItem = new GridItem(this, item, img, qty); - - gridItem.setOnSelectEvent(() -> selected(item)); - gridItem.setOnIgnoreEvent(() -> ignore(item)); - panelMap.put(item, gridItem); - } - - refreshGridDisplay(); - } - - public void refreshGridDisplay() - { - this.removeAll(); - - final List items = panelMap.values().stream().filter(gi -> gi.getAmount() > 0).collect(Collectors.toList()); - - // Calculates how many rows need to be display to fit all items - final int rowSize = ((items.size() % ITEMS_PER_ROW == 0) ? 0 : 1) + items.size() / ITEMS_PER_ROW; - setLayout(new GridLayout(rowSize, ITEMS_PER_ROW, 1, 1)); - - for (final GridItem gridItem : items) - { - // Select the first option - if (selectedItem == null) - { - gridItem.select(); - } - - this.add(gridItem); - } - } - - private boolean selected(final BankedItem item) - { - final BankedItem old = this.selectedItem; - if (item.equals(old)) - { - return false; - } - - // Set selected item now so the boolean can see what was just clicked - this.selectedItem = item; - if (onSelectEvent != null && !onSelectEvent.getAsBoolean()) - { - this.selectedItem = old; - return false; - } - - final GridItem gridItem = panelMap.get(old); - if (gridItem != null) - { - gridItem.unselect(); - } - - return true; - } - - private boolean ignore(final BankedItem item) - { - this.lastIgnoredItem = item; - return onIgnoreEvent.getAsBoolean(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/beans/SkillData.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/beans/SkillData.java deleted file mode 100644 index 0d5b1cad40..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/beans/SkillData.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2018, Kruithne - * 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.skillcalculator.beans; - -import lombok.AccessLevel; -import lombok.Getter; - -@Getter(AccessLevel.PUBLIC) -public class SkillData -{ - private SkillDataEntry[] actions; - private SkillDataBonus[] bonuses; -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/beans/SkillDataBonus.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/beans/SkillDataBonus.java deleted file mode 100644 index 6cce75a62e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/beans/SkillDataBonus.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2018, Kruithne - * 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.skillcalculator.beans; - -import lombok.AccessLevel; -import lombok.Getter; - -@Getter(AccessLevel.PUBLIC) -public class SkillDataBonus -{ - private String name; - private float value; -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/beans/SkillDataEntry.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/beans/SkillDataEntry.java deleted file mode 100644 index 05ec9c878a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/beans/SkillDataEntry.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2018, Kruithne - * 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.skillcalculator.beans; - -import lombok.AccessLevel; -import lombok.Getter; - -@Getter(AccessLevel.PUBLIC) -public class SkillDataEntry -{ - private String name; - private int level; - private double xp; - private Integer icon; - private Integer sprite; - private boolean ignoreBonus; -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skybox/Skybox.java b/runelite-client/src/main/java/net/runelite/client/plugins/skybox/Skybox.java deleted file mode 100644 index 93bad30b36..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skybox/Skybox.java +++ /dev/null @@ -1,517 +0,0 @@ -/* - * Copyright (c) 2019 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.skybox; - -import java.awt.Color; -import java.awt.image.BufferedImage; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.util.Arrays; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -class Skybox -{ - @FunctionalInterface - public interface ChunkMapper - { - /** - * Gets the instance template chunk data for the specified point - */ - int getTemplateChunk(int cx, int cy, int plane); - } - - private static final double SQRT2 = Math.sqrt(2); - - // How many stddev per direction we need to stay visibly continuous - // 511/512 accuracy - private static final double BLEND_DISTRIBUTION = 3.075; - - // This has a worst case complexity of O((BLEND_RADUS*2)^2) - // BLEND_RADIUS is in chunks (8 tiles) - private static final int BLEND_RADIUS = 5; - - // The maximum number of tiles that can be blended before becoming visibly discontinuous - private static final int MAX_BLEND = (int) ((BLEND_RADIUS * 8) / BLEND_DISTRIBUTION); - - private static final int PLANE_ALL = 0b1111; - - private static final Pattern PATTERN = Pattern.compile("^[ \\t]*(?" + - "//.*$|" + // //comment - "m[ \\t]*(?[0-9]+)[ \\t]+(?[0-9]+)|" + // m - "r[ \\t]*(?[0-9]+)[ \\t]+(?[0-9]+)|" + // r - "R[ \\t]*(?[0-9]+)[ \\t]+(?[0-9]+)[ \\t]+(?[0-9]+)[ \\t]+(?[0-9]+)|" + // R - "c[ \\t]*(?[0-9-]+)[ \\t]+(?[0-9-]+)|" + // c - "C[ \\t]*(?[0-9-]+)[ \\t]+(?[0-9-]+)[ \\t]+(?[0-9-]+)[ \\t]+(?[0-9-]+)|" + // C - "#[ \\t]*(?[0-9a-fA-F]{6}|[0-9a-fA-F]{3})|" + // # or # - "p[ \\t]*(?all|0?[ \\t]*1?[ \\t]*2?[ \\t]*3?)|" + // p all or p<1><2><3><4> - "b[ \\t]*(?[0-9]+)|" + // b - "bounds[ \\t]+(?[0-9]+)[ \\t]+(?[0-9]+)[ \\t]+(?[0-9]+)[ \\t]+(?[0-9]+)" + // bounds - ")[ \\t]*"); - - private final int[] chunks; - private final int[] planeOverrides; - - private final int x1; - private final int y1; - private final int x2; - private final int y2; - private final int stride; - - public Skybox(InputStream is, String filename) throws IOException - { - this(new InputStreamReader(is), filename); - } - - public Skybox(Reader reader, String filename) throws IOException - { - int[] chunks = null; - int[] planeOverrides = new int[64]; - int planeOverrideEnd = 0; - int x1 = 0, y1 = 0, x2 = 0, y2 = 0, stride = 0; - BufferedReader br = new BufferedReader(reader); - int lineNo = 1; - int color = 0; - int plane = PLANE_ALL; - int rx1 = 0, ry1 = 0, rx2 = 0, ry2 = 0; - try - { - Matcher m = PATTERN.matcher(""); - for (String line; (line = br.readLine()) != null; lineNo++) - { - m.reset(line); - int end = 0; - for (; end < line.length(); ) - { - m.region(end, line.length()); - if (!m.find()) - { - throw new IllegalArgumentException("Unexpected: \"" + line.substring(end) + "\" (" + filename + ":" + lineNo + ")"); - } - end = m.end(); - - String expr = m.group("expr"); - if (expr == null || expr.length() <= 0 || expr.startsWith("//")) - { - continue; - } - - if (chunks == null) - { - if (!expr.startsWith("bounds")) - { - throw new IllegalArgumentException("Expected bounds (" + filename + ":" + lineNo + ")"); - } - x1 = Integer.parseInt(m.group("bx1")) * 8; - y1 = Integer.parseInt(m.group("by1")) * 8; - x2 = (Integer.parseInt(m.group("bx2")) + 1) * 8; - y2 = (Integer.parseInt(m.group("by2")) + 1) * 8; - stride = (x2 - x1); - chunks = new int[stride * (y2 - y1)]; - Arrays.fill(chunks, -1); - continue; - } - - char cha = expr.charAt(0); - switch (cha) - { - case '#': - String sColor = m.group("color"); - int scolor = Integer.parseInt(sColor, 16); - int cr, cg, cb; - if (sColor.length() == 3) - { - // Expand #RGB to #RRGGBB - cr = scolor >> 8 & 0xF; - cr |= cr << 4; - cg = scolor >> 4 & 0xF; - cg |= cg << 4; - cb = scolor & 0xF; - cb |= cb << 4; - } - else - { - cr = scolor >> 16 & 0xFF; - cg = scolor >> 8 & 0xFF; - cb = scolor & 0xFF; - } - - // Convert to YCoCg24 because it produces less blending artifacts due - // to mismatched skew rates - // See: https://stackoverflow.com/questions/10566668/lossless-rgb-to-ycbcr-transformation - byte cco = (byte) (cb - cr); - byte tmp = (byte) (cr + (cco >> 1)); - byte ccg = (byte) (tmp - cg); - byte cy = (byte) (cg + (ccg >> 1)); - - color = color & 0xFF000000 | (cy & 0xFF) << 16 | (cco & 0xFF) << 8 | (ccg & 0xFF); - break; - case 'b': - int iblend = Integer.parseInt(m.group("blend")); - if (iblend < 0) - { - throw new IllegalArgumentException("Blend must be >=0 (" + filename + ":" + lineNo + ")"); - } - if (iblend > MAX_BLEND) - { - throw new IllegalArgumentException("Blend must be <= " + MAX_BLEND + " (" + filename + ":" + lineNo + ")"); - } - color = color & 0x00FFFFFF | iblend << 24; - break; - case 'm': - rx2 = rx1 = Integer.parseInt(m.group("mrx")); - ry2 = ry1 = Integer.parseInt(m.group("mry")); - break; - case 'p': - String planes = m.group("plane"); - if ("all".equals(planes)) - { - plane = PLANE_ALL; - } - else - { - plane = 0; - for (int i = 0; i < planes.length(); i++) - { - plane |= 1 << (planes.charAt(i) - '0'); - } - } - break; - case 'r': - case 'R': - if (cha == 'r') - { - rx2 = rx1 = Integer.parseInt(m.group("rx")); - ry2 = ry1 = Integer.parseInt(m.group("ry")); - } - else - { - rx1 = Integer.parseInt(m.group("rx1")); - ry1 = Integer.parseInt(m.group("ry1")); - rx2 = Integer.parseInt(m.group("rx2")); - ry2 = Integer.parseInt(m.group("ry2")); - } - // fallthrough - case 'c': - case 'C': - int cx1 = rx1 * 8; - int cy1 = ry1 * 8; - int cx2 = rx2 * 8 + 7; - int cy2 = ry2 * 8 + 7; - if (cha == 'c') - { - cx2 = cx1 = cx1 + Integer.parseInt(m.group("cx")); - cy2 = cy1 = cy1 + Integer.parseInt(m.group("cy")); - } - else if (cha == 'C') - { - cx2 = cx1 + Integer.parseInt(m.group("cx2")); - cy2 = cy1 + Integer.parseInt(m.group("cy2")); - cx1 = cx1 + Integer.parseInt(m.group("cx1")); - cy1 = cy1 + Integer.parseInt(m.group("cy1")); - } - - if (cx1 < x1 || cy1 < y1 || cx2 >= x2 || cy2 >= y2) - { - throw new IllegalArgumentException("Coordinate out of bounds (" + filename + ":" + lineNo + ")"); - } - if (cx1 > cx2 || cy1 > cy2) - { - throw new IllegalArgumentException("First coord must be before second (" + filename + ":" + lineNo + ")"); - } - - for (int y = cy1; y <= cy2; y++) - { - int yoffset = stride * (y - y1); - for (int x = cx1; x <= cx2; x++) - { - int offset = (x - x1) + yoffset; - - if (plane == PLANE_ALL) - { - chunks[offset] = color; - } - else - { - // We are not setting all planes in this chunk, so allocate a plane override section - // and add a pointer to it in the normal chunk's space. We do this because most chunks - // do not have plane-specific data - int ocv = chunks[offset]; - int poptr; - if ((ocv & 0x8000_0000) != 0 && ocv != -1) - { - // Existing plane override - poptr = ocv & 0x7FFF_FFFF; - } - else - { - poptr = planeOverrideEnd; - planeOverrideEnd += 4; - if (planeOverrideEnd > planeOverrides.length) - { - planeOverrides = Arrays.copyOf(planeOverrides, planeOverrideEnd + 64); - } - chunks[offset] = poptr | 0x8000_0000; - for (int i = 0; i < 4; i++) - { - planeOverrides[poptr + i] = ocv; - } - } - - for (int i = 0; i < 4; i++) - { - if ((plane & (1 << i)) != 0) - { - planeOverrides[poptr + i] = color; - } - } - } - } - } - break; - } - } - } - } - catch (NumberFormatException ex) - { - throw new IllegalArgumentException("Expected number (" + filename + ":" + lineNo + ")", ex); - } - if (chunks == null) - { - throw new IllegalArgumentException(filename + ": no data"); - } - - this.chunks = chunks; - this.planeOverrides = planeOverrides; - this.stride = stride; - this.x1 = x1; - this.y1 = y1; - this.x2 = x2; - this.y2 = y2; - } - - private int chunkData(int cx, int cy, int plane, ChunkMapper chunkMapper) - { - if (chunkMapper != null) - { - int itp = chunkMapper.getTemplateChunk(cx, cy, plane); - if (itp == -1) - { - return -1; - } - - cy = itp >> 3 & 0x7FF; - cx = itp >> 14 & 0x3FF; - plane = itp >> 24 & 0x3; - } - - if (cx < x1) - { - cx = x1; - } - if (cx >= x2) - { - cx = x2 - 1; - } - if (cy < y1) - { - cy = y1; - } - if (cy >= y2) - { - cy = y2 - 1; - } - - int cv = chunks[(stride * (cy - y1)) + (cx - x1)]; - - if (cv == -1) - { - return -1; - } - - if ((cv & 0x8000_0000) != 0) - { - cv = planeOverrides[(cv & 0x7FFF_FFFF) | plane]; - } - - return cv; - } - - /** - * Calculates the RGB color for a specific world coordinate. Arguments are floats for sub-tile accuracy. - * - * @param x Sample X coordinate in tiles - * @param y Samlpe Y coordinate in tiles - * @param x Player X coordinate in tiles - * @param y Player Y coordinate in tiles - * @param chunkMapper maps chunks to their instance templates, or null if not in an instance - */ - public int getColorForPoint(double x, double y, int px, int py, int plane, double brightness, ChunkMapper chunkMapper) - { - x /= 8.d; - y /= 8.d; - - int cx = (int) x; - int cy = (int) y; - - int centerChunkData = chunkData(px / 8, py / 8, plane, chunkMapper); - if (centerChunkData == -1) - { - // No data in the center chunk? - return 0; - } - - double t = 0; - double ty = 0; - double tco = 0; - double tcg = 0; - - int xmin = (int) (x - BLEND_RADIUS); - int xmax = (int) Math.ceil(x + BLEND_RADIUS); - int ymin = (int) (y - BLEND_RADIUS); - int ymax = (int) Math.ceil(y + BLEND_RADIUS); - - for (int ucx = xmin; ucx < xmax; ucx++) - { - for (int ucy = ymin; ucy <= ymax; ucy++) - { - int val = chunkData(ucx, ucy, plane, chunkMapper); - if (val == -1) - { - continue; - } - - // Get the blend value, add 1/8 tile to make sure we don't div/0, convert to chunks - double sigma = ((val >>> 24) + .125) / 8.d; - - // Calculate how far we have to be away before we can discard this value without - // becoming visibly discontinuous - double minDist = 1 + (sigma * BLEND_DISTRIBUTION); - - // Try to fast-fail - double dxl = ucx - x; - double dxh = dxl + 1.d; - if (dxl < -minDist || dxl > minDist) - { - continue; - } - - double dyl = ucy - y; - double dyh = dyl + 1.d; - if (dyl < -minDist || dyh > minDist) - { - continue; - } - - // Calculate integrate a gaussian distribution in each dimension for - // this chunk relative to the requested point - double erfdivc = sigma * SQRT2; - double m = (erf(dxl / erfdivc) - erf(dxh / erfdivc)) * (erf(dyl / erfdivc) - erf(dyh / erfdivc)); - - // Load our YCoCg24 values into floats - double vy = (val >>> 16 & 0xFF) / 255.d; - double vco = (byte) (val >>> 8) / 128.d; - double vcg = (byte) val / 128.d; - - // And multiply by the weight - ty += vy * m; - tco += vco * m; - tcg += vcg * m; - t += m; - } - } - - // Convert back to int range values, and bounds check while we are at it - byte ay = (byte) Math.min(Math.max(Math.round(ty / t * 255.d), 0), 255); - byte aco = (byte) Math.min(Math.max(Math.round(tco * 128.d / t), -128), 127); - byte acg = (byte) Math.min(Math.max(Math.round(tcg * 128.d / t), -128), 127); - - // convert back to rgb from YCoCg24 - int g = (ay - (acg >> 1)) & 0xFF; - int tmp = (g + acg) & 0xFF; - int r = (tmp - (aco >> 1)) & 0xFF; - int b = (r + aco) & 0xFF; - - // increase brightness with HSB - float[] hsb = Color.RGBtoHSB(r, g, b, null); - hsb[2] = (float) Math.pow(hsb[2], brightness); - - return 0xFFFFFF & Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]); - } - - /** - * Approximation of erf 'Gauss error function' which is used to calculate - * the cumulative distribution of a gaussian distribution. - * This is used to simulate a large kernel gaussian blur without having - * to sample the same chunk multiple times. - */ - private double erf(double x) - { - double ax = Math.abs(x); - double t = 1.d / (1.d + (ax * .3275911d)); - double y = 1.d - ((((((1.061405429d * t) - 1.453152027d) * t) + 1.421413741d) * t - 0.284496736d) * t + 0.254829592d) * t * Math.exp(-ax * ax); - return Math.copySign(y, x); - } - - /** - * Draws the skybox map to an image - * - * @param resolution The number of pixels per tile - * @param line How many tiles to put a line - * @param plane the plane (0-4) to render - */ - BufferedImage render(double resolution, int line, int plane, ChunkMapper chunkMapper) - { - int w = (int) (((x2 - x1) * 8) * resolution); - int h = (int) (((y2 - y1) * 8) * resolution); - BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); - int lineEvery = line <= 0 ? Integer.MAX_VALUE : (int) (line * resolution); - - for (int y = 0; y < h; y++) - { - for (int x = 0; x < w; x++) - { - int color; - if (x % lineEvery == 0 || y % lineEvery == 0) - { - color = 0x00FFFFFF; - } - else - { - double fx = (x1 * 8) + (x / resolution); - double fy = (y1 * 8) + (y / resolution); - color = getColorForPoint(fx, fy, (int) fx, (int) fy, plane, .8, chunkMapper); - } - img.setRGB(x, h - 1 - y, color | 0xFF000000); - } - } - - return img; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPlugin.java deleted file mode 100644 index 96357ae7b4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPlugin.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2019 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.skybox; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import com.google.inject.Provides; -import java.io.IOException; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.Player; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.events.BeforeRender; -import net.runelite.api.events.GameStateChanged; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.skybox.config.SkyOverrideMode; - -@PluginDescriptor( - name = "Skybox", - description = "Draws an oldschool styled skybox", - enabledByDefault = false, - tags = {"sky"}, - type = PluginType.MISCELLANEOUS -) -@Singleton -public class SkyboxPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private SkyboxPluginConfig config; - - private Skybox skybox; - - @Override - public void startUp() throws IOException - { - - skybox = new Skybox(SkyboxPlugin.class.getResourceAsStream("skybox.txt"), "skybox.txt"); - } - - @Override - public void shutDown() - { - client.setSkyboxColor(0); - skybox = null; - } - - @Provides - SkyboxPluginConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(SkyboxPluginConfig.class); - } - - private int mapChunk(int cx, int cy, int plane) - { - cx -= client.getBaseX() / 8; - cy -= client.getBaseY() / 8; - - int[][] instanceTemplateChunks = client.getInstanceTemplateChunks()[plane]; - // Blending can access this out of bounds, so do a range check - if (cx < 0 || cx >= instanceTemplateChunks.length || cy < 0 || cy >= instanceTemplateChunks[cx].length) - { - return -1; - } - - return instanceTemplateChunks[cx][cy]; - } - - @Subscribe - private void onBeforeRender(BeforeRender r) - { - if (skybox == null || client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - Player player = client.getLocalPlayer(); - if (player == null) - { - return; - } - - if - ( - config.overrideMode() == SkyOverrideMode.ALL || - (config.overrideMode() == SkyOverrideMode.OVERWORLD && client.getLocalPlayer().getWorldLocation().getY() < 4200) - ) - { - client.setSkyboxColor(config.customColor().getRGB()); - return; - } - - - int px, py; - if (client.getOculusOrbState() == 1) - { - px = client.getOculusOrbFocalPointX(); - py = client.getOculusOrbFocalPointY(); - } - else - { - LocalPoint p = client.getLocalPlayer().getLocalLocation(); - px = p.getX(); - py = p.getY(); - } - - // Inverse of camera location / 2 - int spx = -((client.getCameraX() - px) >> 1); - int spy = -((client.getCameraY() - py) >> 1); - - int baseX = client.getBaseX(); - int baseY = client.getBaseY(); - - client.setSkyboxColor(skybox.getColorForPoint( - baseX + ((px + spx) / 128.f), - baseY + ((py + spy) / 128.f), - baseX + (px / 128), - baseY + (py / 128), - client.getPlane(), - client.getTextureProvider().getBrightness(), - client.isInInstancedRegion() ? this::mapChunk : null - )); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged gameStateChanged) - { - if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN) - { - client.setSkyboxColor(0); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPluginConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPluginConfig.java deleted file mode 100644 index 966b3f1578..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skybox/SkyboxPluginConfig.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2019 logarrhytmic - * 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.skybox; - -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.plugins.skybox.config.SkyOverrideMode; - -@ConfigGroup("skybox") -public interface SkyboxPluginConfig extends Config -{ - @ConfigItem( - keyName = "customColor", - name = "Custom sky color", - description = "Set a color here to use for the sky", - position = 1 - ) - default Color customColor() - { - return Color.BLACK; - } - - @ConfigItem( - keyName = "skyOverrideMode", - name = "Mode", - description = "Replace the sky color in just the overworld, or everywhere", - position = 2 - ) - default SkyOverrideMode overrideMode() - { - return SkyOverrideMode.NONE; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skybox/config/SkyOverrideMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/skybox/config/SkyOverrideMode.java deleted file mode 100644 index b2599bb243..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skybox/config/SkyOverrideMode.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2019 logarrhytmic - * 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.skybox.config; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor -public enum SkyOverrideMode -{ - NONE("None"), - OVERWORLD("Overworld"), - ALL("Everywhere"); - - private final String name; - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/KnapsackSolver.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/KnapsackSolver.java deleted file mode 100644 index 5cd41a1132..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/KnapsackSolver.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2018, Davis Cook - * 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.slayer; - -import java.util.ArrayList; -import java.util.List; -import javax.inject.Singleton; - -@Singleton -class KnapsackSolver -{ - - private List reconstructItemsInSack(int[][] sackMatrix, List items, int i, int w) - { - if (i == 0) - { - return new ArrayList<>(); - } - if (sackMatrix[i][w] > sackMatrix[i - 1][w]) - { - List list = reconstructItemsInSack(sackMatrix, items, - i - 1, w - items.get(i - 1)); - list.add(items.get(i - 1)); - return list; - } - else - { - return reconstructItemsInSack(sackMatrix, items, i - 1, w); - } - } - - int howMuchFitsInSack(List items, int maxWeight) - { - int itemCount = items.size(); - - int[][] sackMatrix = new int[itemCount + 1][maxWeight + 1]; - for (int i = 1; i <= itemCount; i++) - { - for (int j = 0; j <= maxWeight; j++) - { - if (items.get(i - 1) > j) - { - sackMatrix[i][j] = sackMatrix[i - 1][j]; - } - else - { - sackMatrix[i][j] = Math.max( - sackMatrix[i - 1][j], - sackMatrix[i - 1][j - items.get(i - 1)] + items.get(i - 1) - ); - } - } - } - - return reconstructItemsInSack(sackMatrix, items, itemCount, maxWeight).size(); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/NPCPresence.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/NPCPresence.java deleted file mode 100644 index 2877a4ad8f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/NPCPresence.java +++ /dev/null @@ -1,48 +0,0 @@ -package net.runelite.client.plugins.slayer; - -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.NPC; - -public class NPCPresence -{ - - private static final int FADE_TIMER_START = 20; - - @Getter(AccessLevel.PACKAGE) - private String name; - - @Getter(AccessLevel.PACKAGE) - private int combatLevel; - - private int fadeTimer; - - private NPCPresence(final String name, final int combatLevel) - { - this.name = name; - this.combatLevel = combatLevel; - this.fadeTimer = FADE_TIMER_START; - } - - @Override - public String toString() - { - return name + "[" + combatLevel + "]"; - } - - boolean shouldExist() - { - return fadeTimer > 0; - } - - void tickExistence() - { - fadeTimer--; - } - - static NPCPresence buildPresence(NPC npc) - { - return new NPCPresence(npc.getName(), npc.getCombatLevel()); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/RenderStyle.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/RenderStyle.java deleted file mode 100644 index c3c0f372a2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/RenderStyle.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.runelite.client.plugins.slayer; - -public enum RenderStyle -{ - TILE("Tile"), - HULL("Hull"), - SOUTH_WEST_TILE("South West Tile"), - THIN_OUTLINE("Thin outline"), - OUTLINE("Outline"), - THIN_GLOW("Thin glow"), - GLOW("Glow"), - TRUE_LOCATIONS("True Location"); - - private final String name; - - RenderStyle(final String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerConfig.java deleted file mode 100644 index 1eb825f4ec..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerConfig.java +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * Copyright (c) 2018, Shaun Dreclin - * 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.slayer; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("slayer") -public interface SlayerConfig extends Config -{ - - @ConfigItem( - position = 1, - keyName = "infobox", - name = "Task InfoBox", - description = "Display task information in an InfoBox" - ) - default boolean showInfobox() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "itemoverlay", - name = "Count on Items", - description = "Display task count remaining on slayer items" - ) - default boolean showItemOverlay() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "superiornotification", - name = "Superior foe notification", - description = "Toggles notifications on superior foe encounters" - ) - default boolean showSuperiorNotification() - { - return true; - } - - @ConfigItem( - position = 4, - keyName = "statTimeout", - name = "InfoBox Expiry (minutes)", - description = "Set the time until the InfoBox expires" - ) - default int statTimeout() - { - return 5; - } - - @ConfigItem( - position = 5, - keyName = "highlightTargets", - name = "Highlight Targets", - description = "Highlight monsters you can kill for your current slayer assignment" - ) - default boolean highlightTargets() - { - return false; - } - - @ConfigItem( - position = 7, - keyName = "highlightStyle", - name = "Highlight Style", - description = "Highlight setting" - ) - default RenderStyle renderStyle() - { - return RenderStyle.THIN_OUTLINE; - } - - @ConfigItem( - position = 7, - keyName = "targetColor", - name = "Target Color", - description = "Color of the highlighted targets" - ) - default Color getTargetColor() - { - return Color.RED; - } - - @ConfigItem( - position = 8, - keyName = "superiorColor", - name = "Superior Color", - description = "Color of the highlighted superior slayer creatures" - ) - default Color getSuperiorColor() - { - return Color.MAGENTA; - } - - @ConfigItem( - position = 9, - keyName = "drawNames", - name = "Draw names above NPC", - description = "Configures whether or not NPC names should be drawn above the NPC" - ) - default boolean drawNames() - { - return false; - } - - @ConfigItem( - position = 10, - keyName = "drawMinimapNames", - name = "Draw names on minimap", - description = "Configures whether or not NPC names should be drawn on the minimap" - ) - default boolean drawMinimapNames() - { - return false; - } - - @ConfigItem( - position = 12, - keyName = "weaknessPrompt", - name = "Show Monster Weakness", - description = "Show an overlay on a monster when it is weak enough to finish off (Only Lizards, Gargoyles & Rockslugs)" - ) - default boolean weaknessPrompt() - { - return true; - } - - @ConfigItem( - position = 13, - keyName = "taskCommand", - name = "Task Command", - description = "Configures whether the slayer task command is enabled
!task" - ) - default boolean taskCommand() - { - return true; - } - - @ConfigItem( - position = 14, - keyName = "pointsCommand", - name = "Points Command", - description = "Configures whether the slayer points command is enabled
!points" - ) - default boolean pointsCommand() - { - return true; - } - - // Stored data - @ConfigItem( - keyName = "taskName", - name = "", - description = "", - hidden = true - ) - default String taskName() - { - return ""; - } - - @ConfigItem( - keyName = "taskName", - name = "", - description = "" - ) - void taskName(String key); - - @ConfigItem( - keyName = "amount", - name = "", - description = "", - hidden = true - ) - default int amount() - { - return -1; - } - - @ConfigItem( - keyName = "amount", - name = "", - description = "" - ) - void amount(int amt); - - @ConfigItem( - keyName = "initialAmount", - name = "", - description = "", - hidden = true - ) - default int initialAmount() - { - return -1; - } - - @ConfigItem( - keyName = "initialAmount", - name = "", - description = "" - ) - void initialAmount(int initialAmount); - - @ConfigItem( - keyName = "taskLocation", - name = "", - description = "", - hidden = true - ) - default String taskLocation() - { - return ""; - } - - @ConfigItem( - keyName = "taskLocation", - name = "", - description = "" - ) - void taskLocation(String key); - - @ConfigItem( - keyName = "lastCertainAmount", - name = "", - description = "", - hidden = true - ) - default int lastCertainAmount() - { - return -1; - } - - @ConfigItem( - keyName = "lastCertainAmount", - name = "", - description = "" - ) - void lastCertainAmount(int lastCertainAmount); - - @ConfigItem( - keyName = "streak", - name = "", - description = "", - hidden = true - ) - default int streak() - { - return -1; - } - - @ConfigItem( - keyName = "streak", - name = "", - description = "" - ) - void streak(int streak); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerOverlay.java deleted file mode 100644 index 1697ec7597..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerOverlay.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.slayer; - -import com.google.common.collect.ImmutableSet; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.Rectangle; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.ItemID; -import net.runelite.api.widgets.WidgetItem; -import net.runelite.client.ui.overlay.WidgetItemOverlay; -import net.runelite.client.ui.overlay.components.TextComponent; - -@Singleton -class SlayerOverlay extends WidgetItemOverlay -{ - private final static Set SLAYER_JEWELRY = ImmutableSet.of( - ItemID.SLAYER_RING_1, - ItemID.SLAYER_RING_2, - ItemID.SLAYER_RING_3, - ItemID.SLAYER_RING_4, - ItemID.SLAYER_RING_5, - ItemID.SLAYER_RING_6, - ItemID.SLAYER_RING_7, - ItemID.SLAYER_RING_8, - ItemID.BRACELET_OF_SLAUGHTER, - ItemID.EXPEDITIOUS_BRACELET - ); - - private final static Set ALL_SLAYER_ITEMS = ImmutableSet.of( - ItemID.SLAYER_HELMET, - ItemID.SLAYER_HELMET_I, - ItemID.BLACK_SLAYER_HELMET, - ItemID.BLACK_SLAYER_HELMET_I, - ItemID.GREEN_SLAYER_HELMET, - ItemID.GREEN_SLAYER_HELMET_I, - ItemID.PURPLE_SLAYER_HELMET, - ItemID.PURPLE_SLAYER_HELMET_I, - ItemID.RED_SLAYER_HELMET, - ItemID.RED_SLAYER_HELMET_I, - ItemID.TURQUOISE_SLAYER_HELMET, - ItemID.TURQUOISE_SLAYER_HELMET_I, - ItemID.HYDRA_SLAYER_HELMET, - ItemID.HYDRA_SLAYER_HELMET_I, - ItemID.SLAYER_RING_ETERNAL, - ItemID.ENCHANTED_GEM, - ItemID.ETERNAL_GEM, - ItemID.BRACELET_OF_SLAUGHTER, - ItemID.EXPEDITIOUS_BRACELET, - ItemID.SLAYER_RING_1, - ItemID.SLAYER_RING_2, - ItemID.SLAYER_RING_3, - ItemID.SLAYER_RING_4, - ItemID.SLAYER_RING_5, - ItemID.SLAYER_RING_6, - ItemID.SLAYER_RING_7, - ItemID.SLAYER_RING_8 - ); - - private final SlayerPlugin plugin; - - @Inject - private SlayerOverlay(final SlayerPlugin plugin) - { - this.plugin = plugin; - showOnInventory(); - showOnEquipment(); - } - - @Override - public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget) - { - if (!ALL_SLAYER_ITEMS.contains(itemId)) - { - return; - } - - if (!plugin.isShowItemOverlay()) - { - return; - } - - if (plugin.getCurrentTask() == null) - { - return; - } - - int amount = plugin.getCurrentTask().getAmount(); - if (amount <= 0) - { - return; - } - - final Rectangle bounds = itemWidget.getCanvasBounds(); - final TextComponent textComponent = new TextComponent(); - - textComponent.setText(String.valueOf(amount)); - - // Draw the counter in the bottom left for equipment, and top left for jewelry - textComponent.setPosition(new Point(bounds.x - 1, bounds.y - 1 + (SLAYER_JEWELRY.contains(itemId) - ? bounds.height - : graphics.getFontMetrics().getHeight()))); - textComponent.render(graphics); - } -} 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 deleted file mode 100644 index 57f9e44b83..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java +++ /dev/null @@ -1,1324 +0,0 @@ -/* - * Copyright (c) 2017, Tyler - * Copyright (c) 2018, Shaun Dreclin - * 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.slayer; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.collect.ImmutableSet; -import com.google.inject.Provides; -import java.awt.Color; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.time.Duration; -import java.time.Instant; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.concurrent.ScheduledExecutorService; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import javax.inject.Inject; -import javax.inject.Singleton; -import joptsimple.internal.Strings; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Actor; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.ItemID; -import net.runelite.api.MessageNode; -import net.runelite.api.NPC; -import net.runelite.api.NPCDefinition; -import static net.runelite.api.Skill.SLAYER; -import net.runelite.api.SpriteID; -import net.runelite.api.Varbits; -import net.runelite.api.WorldType; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.InteractingChanged; -import net.runelite.api.events.NpcDefinitionChanged; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.events.StatChanged; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.util.Text; -import net.runelite.api.vars.SlayerUnlock; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.Notifier; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.chat.ChatColorType; -import net.runelite.client.chat.ChatCommandManager; -import net.runelite.client.chat.ChatMessageBuilder; -import net.runelite.client.chat.ChatMessageManager; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ChatInput; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDependency; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.xptracker.XpTrackerPlugin; -import net.runelite.client.task.Schedule; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; -import net.runelite.client.util.AsyncBufferedImage; -import net.runelite.client.util.ColorUtil; -import net.runelite.client.util.ImageUtil; -import net.runelite.http.api.chat.ChatClient; - -@PluginDescriptor( - name = "Slayer", - description = "Show additional slayer task related information", - tags = {"combat", "notifications", "overlay", "tasks"}, - type = PluginType.SKILLING -) -@PluginDependency(XpTrackerPlugin.class) -@Slf4j -@Singleton -public class SlayerPlugin extends Plugin -{ - //Chat messages - private static final Pattern CHAT_GEM_PROGRESS_MESSAGE = Pattern.compile("^(?:You're assigned to kill|You have received a new Slayer assignment from .*:) (?:[Tt]he )?(?.+?)(?: (?:in|on|south of) (?:the )?(?[^;]+))?(?:; only | \\()(?\\d+)(?: more to go\\.|\\))$"); - private static final String CHAT_GEM_COMPLETE_MESSAGE = "You need something new to hunt."; - private static final Pattern CHAT_COMPLETE_MESSAGE = Pattern.compile("(?:\\d+,)*\\d+"); - private static final String CHAT_CANCEL_MESSAGE = "Your task has been cancelled."; - private static final String CHAT_CANCEL_MESSAGE_JAD = "You no longer have a slayer task as you left the fight cave."; - private static final String CHAT_SUPERIOR_MESSAGE = "A superior foe has appeared..."; - private static final Pattern COMBAT_BRACELET_TASK_UPDATE_MESSAGE = Pattern.compile("^You still need to kill (\\d+) monsters to complete your current Slayer assignment"); - - private static final String CHAT_BRACELET_SLAUGHTER = "Your bracelet of slaughter prevents your slayer"; - private static final String CHAT_BRACELET_EXPEDITIOUS = "Your expeditious bracelet helps you progress your"; - - - //NPC messages - private static final Pattern NPC_ASSIGN_MESSAGE = Pattern.compile(".*(?:Your new task is to kill|You are to bring balance to)\\s*(?\\d+) (?.+?)(?: (?:in|on|south of) (?:the )?(?.+))?\\."); - private static final Pattern NPC_ASSIGN_BOSS_MESSAGE = Pattern.compile("^Excellent. You're now assigned to kill (?:the )?(.*) (\\d+) times.*Your reward point tally is (.*)\\.$"); - private static final Pattern NPC_ASSIGN_FIRST_MESSAGE = Pattern.compile("^We'll start you off (?:hunting|bringing balance to) (.*), you'll need to kill (\\d*) of them\\.$"); - private static final Pattern NPC_CURRENT_MESSAGE = Pattern.compile("^You're still (?:hunting|bringing balance to) (?.+)(?: (?:in|on|south of) (?:the )?(?.+), with|; you have) (?\\d+) to go\\..*"); - - private static final int GROTESQUE_GUARDIANS_REGION = 6727; - - private static final Set weaknessTasks = ImmutableSet.of(Task.LIZARDS, Task.GARGOYLES, - Task.GROTESQUE_GUARDIANS, Task.GROTESQUE_GUARDIANS, Task.MUTATED_ZYGOMITES, Task.ROCKSLUGS); - - // Chat Command - private static final String TASK_COMMAND_STRING = "!task"; - private static final Pattern TASK_STRING_VALIDATION = Pattern.compile("[^a-zA-Z0-9' -]"); - private static final int TASK_STRING_MAX_LENGTH = 50; - private static final String POINTS_COMMAND_STRING = "!points"; - - private static final double DMM_MULTIPLIER_RATIO = 5; - - // Superiors - @VisibleForTesting - static final List SUPERIOR_SLAYER_MONSTERS = Arrays.asList( - "crushing hand", - "chasm crawler", - "screaming banshee", - "screaming twisted banshee", - "giant rockslug", - "cockathrice", - "flaming pyrelord", - "monstrous basilisk", - "malevolent mage", - "insatiable bloodveld", - "insatiable mutated bloodveld", - "vitreous jelly", - "vitreous warped jelly", - "cave abomination", - "abhorrent spectre", - "repugnant spectre", - "choke devil", - "king kurask", - "marble gargoyle", - "nechryarch", - "greater abyssal demon", - "night beast", - "nuclear smoke devil"); - - @Inject - private ClientToolbar clientToolbar; - - @Inject - private SpriteManager spriteManager; - - @Inject - private Client client; - - @Inject - private SlayerConfig config; - - @Inject - private OverlayManager overlayManager; - - @Inject - private SlayerOverlay overlay; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private ItemManager itemManager; - - @Inject - private Notifier notifier; - - @Inject - private ClientThread clientThread; - - @Inject - private TargetClickboxOverlay targetClickboxOverlay; - - @Inject - private TargetWeaknessOverlay targetWeaknessOverlay; - - @Inject - private TargetMinimapOverlay targetMinimapOverlay; - - @Inject - private ChatMessageManager chatMessageManager; - - @Inject - private ChatCommandManager chatCommandManager; - - @Inject - private ScheduledExecutorService executor; - - @Inject - private ChatClient chatClient; - - @Getter(AccessLevel.PACKAGE) - private final Set highlightedTargets = new HashSet<>(); - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private TaskData currentTask = new TaskData(0, 0, 0, 0, 0, 0, null, null, true); - - @Getter(AccessLevel.PACKAGE) - private int streak; - - @Getter(AccessLevel.PACKAGE) - private int points; - - @Getter(AccessLevel.PACKAGE) - private Task weaknessTask = null; - - private TaskCounter counter; - private int cachedXp = -1; - private int cachedPoints; - private Instant infoTimer; - private List targetNames = new ArrayList<>(); - private final List targetIds = new ArrayList<>(); - private boolean checkAsTokens = true; - - private final List lingeringPresences = new ArrayList<>(); - private SlayerXpDropLookup slayerXpDropLookup = null; - - private SlayerTaskPanel panel; - private NavigationButton navButton; - private long lastTickMillis = 0; - private boolean loginTick = false; - - private void clearTrackedNPCs() - { - highlightedTargets.clear(); - lingeringPresences.clear(); - } - - private boolean showInfobox; - @Getter(AccessLevel.PACKAGE) - private boolean showItemOverlay; - @Setter(AccessLevel.PACKAGE) - private boolean showSuperiorNotification; - private int statTimeout; - @Getter(AccessLevel.PACKAGE) - private boolean highlightTargets; - @Getter(AccessLevel.PACKAGE) - private RenderStyle renderStyle; - @Getter(AccessLevel.PACKAGE) - private Color getTargetColor; - @Getter(AccessLevel.PACKAGE) - private Color getSuperiorColor; - @Getter(AccessLevel.PACKAGE) - private boolean drawNames; - @Getter(AccessLevel.PACKAGE) - private boolean drawMinimapNames; - @Getter(AccessLevel.PACKAGE) - private boolean weaknessPrompt; - @Setter(AccessLevel.PACKAGE) - private boolean taskCommand; - private String taskName; - private String taskLocation; - @Setter(AccessLevel.PACKAGE) - private boolean pointsCommand; - private int amount; - private int initialAmount; - private int lastCertainAmount; - - private boolean weaknessOverlayAttached; - - @Override - protected void startUp() - { - updateConfig(); - - weaknessOverlayAttached = false; - - overlayManager.add(overlay); - overlayManager.add(targetClickboxOverlay); - overlayManager.add(targetMinimapOverlay); - - if (slayerXpDropLookup == null) - { - // create this in startup since it needs to pull files during creation - slayerXpDropLookup = new SlayerXpDropLookup(); - } - - panel = new SlayerTaskPanel(this); - - spriteManager.getSpriteAsync(SpriteID.SKILL_SLAYER, 0, panel::loadHeaderIcon); - - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "panel_icon.png"); - - navButton = NavigationButton.builder() - .tooltip("Slayer Tracker") - .icon(icon) - .priority(6) - .panel(panel) - .build(); - - clientToolbar.addNavigation(navButton); - - if (client.getGameState() == GameState.LOGGED_IN) - { - cachedXp = client.getSkillExperience(SLAYER); - } - - chatCommandManager.registerCommandAsync(TASK_COMMAND_STRING, this::taskLookup, this::taskSubmit); - - chatCommandManager.registerCommandAsync(POINTS_COMMAND_STRING, this::pointsLookup); //here - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - overlayManager.remove(targetClickboxOverlay); - overlayManager.remove(targetWeaknessOverlay); - overlayManager.remove(targetMinimapOverlay); - removeCounter(); - clearTrackedNPCs(); - - chatCommandManager.unregisterCommand(TASK_COMMAND_STRING); - chatCommandManager.unregisterCommand(POINTS_COMMAND_STRING); - clientToolbar.removeNavigation(navButton); - - cachedXp = -1; - } - - @Provides - SlayerConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(SlayerConfig.class); - } - - @Subscribe - void onGameStateChanged(GameStateChanged event) - { - switch (event.getGameState()) - { - case HOPPING: - case LOGGING_IN: - cachedXp = -1; - cachedPoints = 0; - clearTrackedNPCs(); - break; - case LOGIN_SCREEN: - loginTick = true; - currentTask.setPaused(true); - break; - case LOGGED_IN: - if (loginTick && this.amount != -1 && !this.taskName.isEmpty() && currentTask.getTaskName() == null) - { - setTask(this.taskName, this.amount, this.initialAmount, true, this.taskLocation, this.lastCertainAmount, false); - } - } - } - - private void save() - { - config.amount(currentTask.getAmount()); - this.amount = currentTask.getAmount(); - - config.initialAmount(currentTask.getInitialAmount()); - this.initialAmount = currentTask.getInitialAmount(); - - config.taskName(currentTask.getTaskName()); - this.taskName = currentTask.getTaskName(); - - config.taskLocation(currentTask.getTaskLocation()); - this.taskLocation = currentTask.getTaskLocation(); - - config.lastCertainAmount(currentTask.getLastCertainAmount()); - this.lastCertainAmount = currentTask.getLastCertainAmount(); - - config.streak(streak); - } - - @Subscribe - private void onNpcSpawned(NpcSpawned npcSpawned) - { - NPC npc = npcSpawned.getNpc(); - if (isTarget(npc, targetNames)) - { - highlightedTargets.add(npc); - } - } - - @Subscribe - private void onNpcDefinitionChanged(NpcDefinitionChanged event) - { - NPC npc = event.getNpc(); - - if (isTarget(npc, targetNames)) - { - highlightedTargets.add(npc); - } - } - - @Subscribe - private void onNpcDespawned(NpcDespawned npcDespawned) - { - NPC npc = npcDespawned.getNpc(); - boolean contained = highlightedTargets.remove(npc); - if (contained) - { - NPCPresence lingeringPresence = NPCPresence.buildPresence(npc); - lingeringPresences.add(lingeringPresence); - } - } - - @Subscribe - public void onVarbitChanged(VarbitChanged event) - { - if (client.getVar(Varbits.SLAYER_REWARD_POINTS) == cachedPoints) - { - return; - } - - setPoints(client.getVar(Varbits.SLAYER_REWARD_POINTS)); - - if (!this.showInfobox) - { - return; - } - - addCounter(); - - if (counter != null) - { - counter.setCount(currentTask.getAmount()); - } - } - - private int estimateKillCount(List potentialKills, int gains) - { - // failsafe to avoid calculating kill count if there were no slayer monsters around that could be killed on task - // this failsafe *WILL FAIL* if someone decides to lamp their slayer in the middle of a task next to on task creatures - // but will prevent any other kind of slayer xp from triggering the kill count going down - // the main problem this causes is a genie random event during a slayer task and the player pops the lamp - // this will think that some of the monsters around were slain - e.g. lvl 50 slayer pops lamp for 500 xp around a - // 70 xp per kill slayer monster and now the slayer plugin thinks that 7 more kill count were completed (at 99 slayer - // the 990 xp drop would really mess with the kc tracker in a noticeable way) - if (potentialKills.size() < 1) - { - return 0; - } - - //StringBuilder debugString = new StringBuilder(); - //for (NPCPresence presence : potentialKills) - //{ - // debugString.append(presence.toString()); - // debugString.append(", "); - //} - // log.debug("Estimating kc of xp drop " + gains + " for presences {" + debugString.toString() + "}"); - - // first determine potential xp drops given by all npcs that died this tick by grabbing the slayer xp - // info from the map made out of the data in slayer_xp.json - List potentialXpDrops = new ArrayList<>(); - for (NPCPresence potentialDead : potentialKills) - { - double xp = slayerXpDropLookup.findXpForNpc(potentialDead); - - // DeadMan mode has an XP modifier - if (client.getWorldType().contains(WorldType.DEADMAN)) - { - xp = xp * DMM_MULTIPLIER_RATIO; - } - - if (xp > 0) - { - potentialXpDrops.add(xp); - } - } - - //debugString = new StringBuilder(); - //for (Double drop : potentialXpDrops) - //{ - // debugString.append(drop); - // debugString.append(", "); - //} - // log.debug("Determined xp drop " + gains + " can be made of {" + debugString.toString() + "}"); - - // we can attempt to determine exactly how many npcs died to give this amount of xp - // by using a solver for the knapsack problem - - // add one to max gains allowed for knapsack optimization - // since xp is only sent to us as integers but is stored on servers - // (and therefore gained as) a double - int fudgedGains = gains + 1; - - // scale the problem up by a factor of 10 since knapsack problem is solved better with integers - // and xp drops can have a single number after the decimal point - int tenFudgedGains = fudgedGains * 10; - List potentialXpDropsAsInts = potentialXpDrops.stream() - .map(xpDrop -> (int) (xpDrop * 10)) - .collect(Collectors.toCollection(ArrayList::new)); - - KnapsackSolver solver = new KnapsackSolver(); - - int estimatedCount = solver.howMuchFitsInSack(potentialXpDropsAsInts, tenFudgedGains); - - if (estimatedCount > potentialXpDrops.size()) - { - estimatedCount = potentialXpDrops.size(); - } - if (estimatedCount < 1) - { - estimatedCount = 1; - } - return estimatedCount; - } - - // b/c dialog can stay up on screen for multiple ticks in a row we want to make sure we only set a task once - // for the dialog that appears so we need to basically do a rising edge detection that only allows for a dialog - // check to be performed if in the previous ticks there was a period of no dialog - // i.e. once a dialog has been matched dialog cannot be matched again until npc dialog goes away for a tick - // this will work because in order for a new slayer task to happen the player either has to go complete the assignment - // (and close npc dialog) or go into the rewards screen which also closes npc dialog - private boolean canMatchDialog = true; - - // rising edge detection isn't enough for some reason (don't know why) so in addition to a rising edge rather than - // instantly allowing for another assignment we'll do a 2 tick refractory period - private static final int FORCED_WAIT = 2; - private int forcedWait = -1; - - @Subscribe - public void onGameTick(GameTick tick) - { - loginTick = false; - - // update the lingering presence of npcs in the slayer xp consideration list - Iterator presenceIterator = lingeringPresences.iterator(); - while (presenceIterator.hasNext()) - { - NPCPresence presence = presenceIterator.next(); - presence.tickExistence(); - if (!presence.shouldExist()) - { - // log.debug("Lingering presence of " + presence.toString() + " expired"); - presenceIterator.remove(); - } - } - - Widget npcDialog = client.getWidget(WidgetInfo.DIALOG_NPC_TEXT); - if (npcDialog != null && canMatchDialog) - { - String npcText = Text.sanitizeMultilineText(npcDialog.getText()); //remove color and linebreaks - final Matcher mAssign = NPC_ASSIGN_MESSAGE.matcher(npcText); // amount, name, (location) - final Matcher mAssignFirst = NPC_ASSIGN_FIRST_MESSAGE.matcher(npcText); // name, number - final Matcher mAssignBoss = NPC_ASSIGN_BOSS_MESSAGE.matcher(npcText); // name, number, points - final Matcher mCurrent = NPC_CURRENT_MESSAGE.matcher(npcText); // name, (location), amount - - if (mAssign.find()) - { - String name = mAssign.group("name"); - int amount = Integer.parseInt(mAssign.group("amount")); - String location = mAssign.group("location"); - setTask(name, amount, amount, true, location, 0); - canMatchDialog = false; - forcedWait = FORCED_WAIT; - } - else if (mAssignFirst.find()) - { - int amount = Integer.parseInt(mAssignFirst.group(2)); - setTask(mAssignFirst.group(1), amount, amount, true, 0); - canMatchDialog = false; - forcedWait = FORCED_WAIT; - } - else if (mAssignBoss.find()) - { - int amount = Integer.parseInt(mAssignBoss.group(2)); - setTask(mAssignBoss.group(1), amount, amount, true, 0); - canMatchDialog = false; - forcedWait = FORCED_WAIT; - points = Integer.parseInt(mAssignBoss.group(3).replaceAll(",", "")); - } - else if (mCurrent.find()) - { - String name = mCurrent.group("name"); - int amount = Integer.parseInt(mCurrent.group("amount")); - String location = mCurrent.group("location"); - setTask(name, amount, currentTask.getInitialAmount(), false, location, 0); - canMatchDialog = false; - forcedWait = FORCED_WAIT; - } - } - else if (npcDialog == null) - { - if (forcedWait <= 0) - { - canMatchDialog = true; - } - forcedWait--; - } - - if (infoTimer != null && config.statTimeout() != 0) - { - Duration timeSinceInfobox = Duration.between(infoTimer, Instant.now()); - Duration statTimeout = Duration.ofMinutes(this.statTimeout); - - if (timeSinceInfobox.compareTo(statTimeout) >= 0) - { - removeCounter(); - } - } - } - - @Subscribe - public void onChatMessage(ChatMessage event) - { - if (event.getType() != ChatMessageType.GAMEMESSAGE && event.getType() != ChatMessageType.SPAM) - { - return; - } - - String chatMsg = Text.removeTags(event.getMessage()); //remove color and linebreaks - - if (chatMsg.endsWith("; return to a Slayer master.")) - { - Matcher mComplete = CHAT_COMPLETE_MESSAGE.matcher(chatMsg); - - List matches = new ArrayList<>(); - while (mComplete.find()) - { - matches.add(mComplete.group(0).replaceAll(",", "")); - } - - switch (matches.size()) - { - case 0: - streak = 1; - break; - case 1: - case 3: - streak = Integer.parseInt(matches.get(0)); - break; - default: - log.warn("Unreachable default case for message ending in '; return to Slayer master'"); - } - - log.debug("Slayer task completed with " + currentTask.getAmount() + " remaining"); - log.debug("Last certain amount was " + currentTask.getLastCertainAmount() + - " so error rate is " + currentTask.getAmount() + " in " + currentTask.getLastCertainAmount()); - - setTask("", 0, 0, true, 0); - return; - } - - if (chatMsg.equals(CHAT_GEM_COMPLETE_MESSAGE) || chatMsg.equals(CHAT_CANCEL_MESSAGE) || chatMsg.equals(CHAT_CANCEL_MESSAGE_JAD)) - { - setTask("", 0, 0, true, 0); - return; - } - - if (this.showSuperiorNotification && chatMsg.equals(CHAT_SUPERIOR_MESSAGE)) - { - notifier.notify(CHAT_SUPERIOR_MESSAGE); - return; - } - - Matcher mProgress = CHAT_GEM_PROGRESS_MESSAGE.matcher(chatMsg); - - if (mProgress.find()) - { - String name = mProgress.group("name"); - int gemAmount = Integer.parseInt(mProgress.group("amount")); - String location = mProgress.group("location"); - setTask(name, gemAmount, currentTask.getInitialAmount(), false, location, gemAmount); - return; - } - - final Matcher bracerProgress = COMBAT_BRACELET_TASK_UPDATE_MESSAGE.matcher(chatMsg); - - if (bracerProgress.find()) - { - final int taskAmount = Integer.parseInt(bracerProgress.group(1)); - setTask(currentTask.getTaskName(), taskAmount, currentTask.getInitialAmount(), false, taskAmount); - - // Avoid race condition (combat brace message goes through first before XP drop) - currentTask.setAmount(currentTask.getAmount() + 1); - } - - if (chatMsg.startsWith(CHAT_BRACELET_SLAUGHTER)) - { - currentTask.setAmount(currentTask.getAmount() + 1); - } - - if (chatMsg.startsWith(CHAT_BRACELET_EXPEDITIOUS)) - { - currentTask.setAmount(currentTask.getAmount() - 1); - } - } - - @Subscribe - public void onStatChanged(StatChanged statChanged) - { - if (statChanged.getSkill() != SLAYER) - { - return; - } - - int slayerExp = statChanged.getXp(); - - if (slayerExp <= cachedXp) - { - return; - } - - if (cachedXp == -1) - { - // this is the initial xp sent on login - cachedXp = slayerExp; - return; - } - - final Task task = Task.getTask(taskName); - int delta = slayerExp - cachedXp; - - // null tasks are technically valid, it only means they arent explicitly defined in the Task enum - // allow them through so that if there is a task capture failure the counter will still work - final int taskKillExp = task != null ? task.getExpectedKillExp() : 0; - - // Only count exp gain as a kill if the task either has no expected exp for a kill, or if the exp gain is equal - // to the expected exp gain for the task. - if (taskKillExp == 0 || taskKillExp == slayerExp - cachedXp) - { - killedOne(delta); - } - else - { - // this is not the initial xp sent on login so these are new xp gains - int gains = slayerExp - cachedXp; - - // potential npcs to give xp drop are current highlighted npcs and the lingering presences - List potentialNPCs = new ArrayList<>(lingeringPresences); - for (NPC npc : highlightedTargets) - { - NPCPresence currentPresence = NPCPresence.buildPresence(npc); - potentialNPCs.add(currentPresence); - } - - int killCount = estimateKillCount(potentialNPCs, gains); - for (int i = 0; i < killCount; i++) - { - killedOne(delta); - } - } - - cachedXp = slayerExp; - } - - @Subscribe - private void onInteractingChanged(InteractingChanged event) - { - if (client.getLocalPlayer() == null) - { - return; - } - final Actor interacting = client.getLocalPlayer().getInteracting(); - weaknessTask = null; - - if (!(interacting instanceof NPC)) - { - return; - } - - final NPC npc = (NPC) interacting; - - for (Task task : weaknessTasks) - { - if (isTarget(npc, buildTargetNames(task))) - { - weaknessTask = task; - return; - } - } - } - - boolean isSuperior(String name) - { - return SUPERIOR_SLAYER_MONSTERS.contains(name.toLowerCase()); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("slayer")) - { - return; - } - - updateConfig(); - - if (event.getKey().equals("infobox")) - { - if (this.showInfobox) - { - clientThread.invoke(this::addCounter); - } - else - { - removeCounter(); - } - } - } - - @VisibleForTesting - private void killedOne(int delta) - { - if (currentTask == null || currentTask.getAmount() == 0) - { - return; - } - - currentTask.setAmount(currentTask.getAmount() - 1); - currentTask.setElapsedKills(currentTask.getElapsedKills() + 1); - currentTask.setElapsedXp(currentTask.getElapsedXp() + delta); - if (doubleTroubleExtraKill()) - { - currentTask.setAmount(currentTask.getAmount() - 1); - currentTask.setElapsedKills(currentTask.getElapsedKills() + 1); - } - - config.amount(currentTask.getAmount()); // save changed value - currentTask.setPaused(false); // no longer paused since xp is gained - if (panel != null) - { - panel.updateCurrentTask(true, currentTask.isPaused(), currentTask, false); - } - - if (!this.showInfobox) - { - return; - } - - // add and update counter, set timer - addCounter(); - counter.setCount(currentTask.getAmount()); - infoTimer = Instant.now(); - } - - private boolean doubleTroubleExtraKill() - { - if (client.getLocalPlayer() == null) - { - return false; - } - final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, client.getLocalPlayer().getLocalLocation()); - final int playerRegionID = worldPoint == null ? 0 : worldPoint.getRegionID(); - return playerRegionID == GROTESQUE_GUARDIANS_REGION && SlayerUnlock.GROTESQUE_GUARDIAN_DOUBLE_COUNT.isEnabled(client); - } - - // checks if any contiguous subsequence of seq0 exactly matches the String toMatch - private boolean contiguousSubsequenceMatches(String[] seq0, String toMatch) - { - for (int i = 0; i < seq0.length; i++) - { - for (int j = i; j < seq0.length; j++) - { - StringBuilder sub0Builder = new StringBuilder(); - for (int k = i; k <= j; k++) - { - sub0Builder.append(seq0[k]).append(" "); - } - String sub0 = sub0Builder.toString(); - sub0 = sub0.substring(0, sub0.length() - 1); // remove extra space - if (sub0.equals(toMatch)) - { - return true; - } - } - } - return false; - } - - private boolean isValidComposition(NPCDefinition composition) - { - if (composition != null) - { - List actions = Arrays.asList(composition.getActions()); - //Pick action is for zygomite-fungi - return actions.contains("Attack") || actions.contains("Pick") || actions.contains("Poke"); - } - - return false; - } - - private boolean isTarget(NPC npc, List names) - { - if (names.isEmpty() && targetIds.isEmpty()) - { - return false; - } - - String name = npc.getName(); - if (name == null) - { - return false; - } - - name = name.toLowerCase(); - - // in order to avoid issues like pirates being highlighted on a rats task - // rather than checking if the name contains any of the targets we do a complete - // token check which is where we tokenize the name on the space character - // then we check if any contiguous subsequence (of at least length 1) from the name matches - // the target. - - // we have a boolean flag that also allows the behavior of just doing a contains check to happen - // this is done specifically for the tzhaar task because it's much easier to just check if the enemy - // contains "Tz-" then listing the many many many types of tzhaar. - - for (String target : names) - { - if (!checkAsTokens) - { - if (name.contains(target) && isValidComposition(npc.getTransformedDefinition())) - { - return true; - } - } - else - { - String[] nameTokens = name.split(" "); - if (contiguousSubsequenceMatches(nameTokens, target) && isValidComposition(npc.getTransformedDefinition())) - { - return true; - } - } - } - - int id = npc.getId(); - if (id <= 0) - { - return false; - } - - for (int target : targetIds) - { - if (id == target && isValidComposition(npc.getTransformedDefinition())) - { - return true; - } - } - - return false; - } - - private List buildTargetNames(Task task) - { - List names = new ArrayList<>(); - - if (task != null) - { - task.getTargetNames().stream() - .map(String::toLowerCase) - .forEach(names::add); - - //TODO - names.add(task.getName().toLowerCase().replaceAll("s$", "")); - } - - return names; - } - - private void rebuildTargetIds(Task task) - { - targetIds.clear(); - - if (task != null) - { - targetIds.addAll(task.getNpcIds()); - } - } - - private void rebuildCheckAsTokens(Task task) - { - if (task != null) - { - checkAsTokens = task.isCheckAsTokens(); - } - } - - private void rebuildTargetList() - { - highlightedTargets.clear(); - - for (NPC npc : client.getNpcs()) - { - if (isTarget(npc, targetNames)) - { - highlightedTargets.add(npc); - } - } - } - - public void setTask(String name, int amt, int initAmt, boolean isNewAssignment, int lastCertainAmt) - { - setTask(name, amt, initAmt, isNewAssignment, null, lastCertainAmt); - } - - private void setTask(String name, int amt, int initAmt, boolean isNewAssignment, String location, int lastCertainAmt) - { - setTask(name, amt, initAmt, isNewAssignment, location, lastCertainAmt, true); - } - - private void setTask(String name, int amt, int initAmt, boolean isNewAssignment, String location, int lastCertainAmt, boolean addCounter) - { - currentTask = new TaskData(isNewAssignment ? 0 : currentTask.getElapsedTime(), - isNewAssignment ? 0 : currentTask.getElapsedKills(), - isNewAssignment ? 0 : currentTask.getElapsedXp(), - amt, initAmt, lastCertainAmt, location, name, - isNewAssignment || currentTask.isPaused()); - if (panel != null) - { - panel.updateCurrentTask(true, currentTask.isPaused(), currentTask, isNewAssignment); - } - - save(); - removeCounter(); - - if (addCounter) - { - infoTimer = Instant.now(); - addCounter(); - } - - Task task = Task.getTask(name); - targetNames.clear(); - targetNames = buildTargetNames(task); - rebuildTargetIds(task); - rebuildCheckAsTokens(task); - rebuildTargetList(); - - if (task == null) - { - return; - } - - if (!weaknessOverlayAttached && task.getWeaknessItem() != -1 && task.getWeaknessThreshold() != -1) - { - overlayManager.add(targetWeaknessOverlay); - weaknessOverlayAttached = true; - } - else if (weaknessOverlayAttached && task.getWeaknessItem() == -1 && task.getWeaknessThreshold() == -1) - { - overlayManager.remove(targetWeaknessOverlay); - weaknessOverlayAttached = false; - } - } - - AsyncBufferedImage getImageForTask(Task task) - { - int itemSpriteId = ItemID.ENCHANTED_GEM; - if (task != null) - { - itemSpriteId = task.getItemSpriteId(); - } - return itemManager.getImage(itemSpriteId); - } - - private void addCounter() - { - if (!this.showInfobox || counter != null || currentTask == null || Strings.isNullOrEmpty(currentTask.getTaskName())) - { - return; - } - - Task task = Task.getTask(currentTask.getTaskName()); - AsyncBufferedImage taskImg = getImageForTask(task); - String taskTooltip = ColorUtil.wrapWithColorTag("%s", new Color(255, 119, 0)) + "
"; - - if (currentTask.getTaskLocation() != null && !currentTask.getTaskLocation().isEmpty()) - { - taskTooltip += currentTask.getTaskLocation() + "
"; - } - - taskTooltip += ColorUtil.wrapWithColorTag("Pts:", Color.YELLOW) - + " %s
" - + ColorUtil.wrapWithColorTag("Streak:", Color.YELLOW) - + " %s"; - - if (currentTask.getInitialAmount() > 0) - { - taskTooltip += "
" - + ColorUtil.wrapWithColorTag("Start:", Color.YELLOW) - + " " + currentTask.getInitialAmount(); - } - - counter = new TaskCounter(taskImg, this, currentTask.getAmount()); - counter.setTooltip(String.format(taskTooltip, capsString(currentTask.getTaskName()), points, streak)); - - infoBoxManager.addInfoBox(counter); - } - - private void removeCounter() - { - if (counter == null) - { - return; - } - - infoBoxManager.removeInfoBox(counter); - counter = null; - } - - void taskLookup(ChatMessage chatMessage, String message) - { - if (!this.taskCommand) - { - return; - } - - ChatMessageType type = chatMessage.getType(); - - final String player; - if (type.equals(ChatMessageType.PRIVATECHATOUT)) - { - player = client.getLocalPlayer().getName(); - } - else - { - player = Text.removeTags(chatMessage.getName()) - .replace('\u00A0', ' '); - } - - net.runelite.http.api.chat.Task task; - try - { - task = chatClient.getTask(player); - } - catch (IOException ex) - { - log.debug("unable to lookup slayer task", ex); - return; - } - - if (task == null) - { - return; - } - - if (TASK_STRING_VALIDATION.matcher(task.getTask()).find() || task.getTask().length() > TASK_STRING_MAX_LENGTH || - TASK_STRING_VALIDATION.matcher(task.getLocation()).find() || task.getLocation().length() > TASK_STRING_MAX_LENGTH || - Task.getTask(task.getTask()) == null || !Task.LOCATIONS.contains(task.getLocation())) - { - log.debug("Validation failed for task name or location: {}", task); - return; - } - - int killed = task.getInitialAmount() - task.getAmount(); - - StringBuilder sb = new StringBuilder(); - sb.append(task.getTask()); - if (!Strings.isNullOrEmpty(task.getLocation())) - { - sb.append(" (").append(task.getLocation()).append(")"); - } - sb.append(": "); - if (killed < 0) - { - sb.append(task.getAmount()).append(" left"); - } - else - { - sb.append(killed).append('/').append(task.getInitialAmount()).append(" killed"); - } - - String response = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Slayer Task: ") - .append(ChatColorType.HIGHLIGHT) - .append(sb.toString()) - .build(); - - final MessageNode messageNode = chatMessage.getMessageNode(); - messageNode.setRuneLiteFormatMessage(response); - chatMessageManager.update(messageNode); - client.refreshChat(); - } - - private void pointsLookup(ChatMessage chatMessage, String message) - { - if (!this.pointsCommand) - { - return; - } - - String response = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Slayer Points: ") - .append(ChatColorType.HIGHLIGHT) - .append(Integer.toString(getPoints())) - .build(); - - final MessageNode messageNode = chatMessage.getMessageNode(); - messageNode.setRuneLiteFormatMessage(response); - chatMessageManager.update(messageNode); - client.refreshChat(); - } - - /* package access method for changing the pause state of the time tracker for the current task */ - void setPaused(boolean paused) - { - currentTask.setPaused(paused); - panel.updateCurrentTask(false, currentTask.isPaused(), currentTask, false); - } - - @Schedule( - period = 1, - unit = ChronoUnit.SECONDS - ) - public void tickTaskTimes() - { - if (lastTickMillis == 0) - { - lastTickMillis = System.currentTimeMillis(); - return; - } - - final long nowMillis = System.currentTimeMillis(); - final long tickDelta = nowMillis - lastTickMillis; - lastTickMillis = nowMillis; - - - if (currentTask == null) - { - return; - } - currentTask.tick(tickDelta); - - panel.updateCurrentTask(false, currentTask.isPaused(), currentTask, false); - } - - private boolean taskSubmit(ChatInput chatInput, String value) - { - if (Strings.isNullOrEmpty(currentTask.getTaskName())) - { - return false; - } - - final String playerName = client.getLocalPlayer().getName(); - - executor.execute(() -> - { - try - { - chatClient.submitTask(playerName, capsString(currentTask.getTaskName()), currentTask.getAmount(), currentTask.getInitialAmount(), currentTask.getTaskLocation()); - } - catch (Exception ex) - { - log.warn("unable to submit slayer task", ex); - } - finally - { - chatInput.resume(); - } - }); - - return true; - } - - //Utils - private static String capsString(String str) - { - return str.substring(0, 1).toUpperCase() + str.substring(1); - } - - private void setPoints(int points) - { - this.points = points; - this.cachedPoints = points; - } - - private void updateConfig() - { - this.showInfobox = config.showInfobox(); - this.showItemOverlay = config.showItemOverlay(); - this.showSuperiorNotification = config.showSuperiorNotification(); - this.statTimeout = config.statTimeout(); - this.highlightTargets = config.highlightTargets(); - this.renderStyle = config.renderStyle(); - this.getTargetColor = config.getTargetColor(); - this.getSuperiorColor = config.getSuperiorColor(); - this.drawNames = config.drawNames(); - this.drawMinimapNames = config.drawMinimapNames(); - this.weaknessPrompt = config.weaknessPrompt(); - this.taskCommand = config.taskCommand(); - this.pointsCommand = config.pointsCommand(); - this.taskName = config.taskName(); - this.amount = config.amount(); - this.initialAmount = config.initialAmount(); - this.lastCertainAmount = config.lastCertainAmount(); - this.taskLocation = config.taskLocation(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerTaskPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerTaskPanel.java deleted file mode 100644 index 4512bd502e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerTaskPanel.java +++ /dev/null @@ -1,375 +0,0 @@ -package net.runelite.client.plugins.slayer; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; -import java.util.ArrayList; -import java.util.List; -import javax.inject.Singleton; -import javax.swing.Box; -import javax.swing.BoxLayout; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import javax.swing.border.EmptyBorder; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.ui.components.PluginErrorPanel; -import net.runelite.client.util.ColorUtil; -import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.QuantityFormatter; - -@Singleton -class SlayerTaskPanel extends PluginPanel -{ - private static final long MILLIS_PER_SECOND = 1000; - private static final long SECONDS_PER_MINUTE = 60; - private static final long MINUTES_PER_HOUR = 60; - - // Templates - private static final String HTML_LABEL_TEMPLATE = - "%s%s"; - private static final String HTML_TIME_LABEL_TEMPLATE = - "%s%02d:%02d:%02d"; - - - private static final ImageIcon PAUSE, PAUSE_FADED, PAUSE_HOVER; - private static final ImageIcon PLAY, PLAY_FADED, PLAY_HOVER; - - // TODO: set some kind of maximum for the amount of tasks to be tracked in a session - private static final int MAX_TASK_BOXES = 50; - - // When there are no tasks, display this - private final PluginErrorPanel errorPanel = new PluginErrorPanel(); - - // Handle task boxes - private final JPanel tasksContainer = new JPanel(); - - // Handle overall slayer session data - private final JPanel overallPanel = new JPanel(); - private final JLabel overallKillsLabel = new JLabel(); - private final JLabel overallTimeLabel = new JLabel(); - private final JLabel overallIcon = new JLabel(); - - // Actions - private final JPanel actionsContainer = new JPanel(); - private final JLabel playBtn = new JLabel(); - private final JLabel pauseBtn = new JLabel(); - - // Log tasks - private final List tasks = new ArrayList<>(); - - private SlayerPlugin slayerPlugin; - - static - { - final BufferedImage pauseImg = ImageUtil.getResourceStreamFromClass(SlayerPlugin.class, "pause_icon.png"); - final BufferedImage playImg = ImageUtil.getResourceStreamFromClass(SlayerPlugin.class, "play_icon.png"); - - PAUSE = new ImageIcon(pauseImg); - PAUSE_FADED = new ImageIcon(ImageUtil.alphaOffset(pauseImg, -180)); - PAUSE_HOVER = new ImageIcon(ImageUtil.alphaOffset(pauseImg, -220)); - - PLAY = new ImageIcon(playImg); - PLAY_FADED = new ImageIcon(ImageUtil.alphaOffset(playImg, -180)); - PLAY_HOVER = new ImageIcon(ImageUtil.alphaOffset(playImg, -220)); - } - - public SlayerTaskPanel(SlayerPlugin slayerPlugin) - { - this.slayerPlugin = slayerPlugin; - - setBorder(new EmptyBorder(6, 6, 6, 6)); - setBackground(ColorScheme.DARK_GRAY_COLOR); - setLayout(new BorderLayout()); - - // Create layout panel for wrapping - final JPanel layoutPanel = new JPanel(); - layoutPanel.setLayout(new BoxLayout(layoutPanel, BoxLayout.Y_AXIS)); - add(layoutPanel, BorderLayout.NORTH); - - actionsContainer.setLayout(new BorderLayout()); - actionsContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR); - actionsContainer.setPreferredSize(new Dimension(0, 30)); - actionsContainer.setBorder(new EmptyBorder(5, 5, 5, 10)); - actionsContainer.setVisible(false); - - final JPanel controlsPanel = new JPanel(new GridLayout(1, 2, 10, 0)); - controlsPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - playBtn.setIcon(PLAY); - playBtn.setToolTipText("Resume the current slayer task"); - playBtn.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - slayerPlugin.setPaused(false); - changePauseState(false); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - boolean paused = true; - TaskData currentTask = slayerPlugin.getCurrentTask(); - if (currentTask != null) - { - paused = currentTask.isPaused(); - } - playBtn.setIcon(paused ? PLAY_FADED : PLAY); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - boolean paused = true; - TaskData currentTask = slayerPlugin.getCurrentTask(); - if (currentTask != null) - { - paused = currentTask.isPaused(); - } - playBtn.setIcon(paused ? PLAY_HOVER : PLAY); - } - }); - - pauseBtn.setIcon(PAUSE); - pauseBtn.setToolTipText("Pause the current slayer task"); - pauseBtn.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - slayerPlugin.setPaused(true); - changePauseState(true); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - boolean paused = true; - TaskData currentTask = slayerPlugin.getCurrentTask(); - if (currentTask != null) - { - paused = currentTask.isPaused(); - } - pauseBtn.setIcon(paused ? PAUSE : PAUSE_FADED); - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - boolean paused = true; - TaskData currentTask = slayerPlugin.getCurrentTask(); - if (currentTask != null) - { - paused = currentTask.isPaused(); - } - pauseBtn.setIcon(paused ? PAUSE : PAUSE_HOVER); - } - }); - - controlsPanel.add(playBtn); - controlsPanel.add(pauseBtn); - - actionsContainer.add(controlsPanel, BorderLayout.EAST); - changePauseState(true); - if (slayerPlugin.getCurrentTask() != null) - { - changePauseState(slayerPlugin.getCurrentTask().isPaused()); - } - - // Create panel that will contain overall data - overallPanel.setBorder(new EmptyBorder(8, 10, 8, 10)); - overallPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - overallPanel.setLayout(new BorderLayout()); - overallPanel.setVisible(false); - - // Add contents - final JPanel overallInfo = new JPanel(); - overallInfo.setBackground(ColorScheme.DARKER_GRAY_COLOR); - overallInfo.setLayout(new GridLayout(2, 1)); - overallInfo.setBorder(new EmptyBorder(2, 10, 2, 0)); - overallKillsLabel.setFont(FontManager.getRunescapeSmallFont()); - overallTimeLabel.setFont(FontManager.getRunescapeSmallFont()); - overallInfo.add(overallKillsLabel); - overallInfo.add(overallTimeLabel); - overallPanel.add(overallIcon, BorderLayout.WEST); - overallPanel.add(overallInfo, BorderLayout.CENTER); - - tasksContainer.setLayout(new BoxLayout(tasksContainer, BoxLayout.Y_AXIS)); - layoutPanel.add(actionsContainer); - layoutPanel.add(Box.createRigidArea(new Dimension(0, 5))); - layoutPanel.add(overallPanel); - layoutPanel.add(tasksContainer); - - // Add error pane - errorPanel.setContent("Task trackers", "You have not received any slayer tasks yet."); - add(errorPanel); - } - - void loadHeaderIcon(BufferedImage img) - { - overallIcon.setIcon(new ImageIcon(img)); - } - - private void changePauseState(boolean paused) - { - playBtn.setIcon(paused ? PLAY_FADED : PLAY); - pauseBtn.setIcon(paused ? PAUSE : PAUSE_FADED); - } - - private void updateOverall() - { - int overallKills = 0; - long overallTime = 0; - for (TaskBox box : tasks) - { - overallKills += box.getTaskData().getElapsedKills(); - overallTime += box.getTaskData().getElapsedTime(); - } - - overallKillsLabel.setText(htmlLabel("Total kills: ", overallKills)); - overallTimeLabel.setText(htmlLabel("Total time: ", overallTime)); - } - - private static boolean isEmptyTask(TaskData taskData) - { - return (taskData.getTaskName() == null || taskData.getTaskName().equals("")) && taskData.getAmount() == 0 && taskData.getInitialAmount() == 0; - } - - private void showMainView() - { - remove(errorPanel); - actionsContainer.setVisible(true); - overallPanel.setVisible(true); - } - - private TaskBox buildBox(SlayerPlugin plugin, JPanel container, TaskData data) - { - TaskBox newBox = new TaskBox(plugin, container, data.toBuilder().build()); - tasks.add(0, newBox); - showMainView(); - return newBox; - } - - private boolean stringsEqualIncludeNull(String str0, String str1) - { - if (str0 == null && str1 == null) - { - return true; // both are null - } - else if (str0 == null || str1 == null) - { - return false; // only 1 is null - } - else - { - // none are null so equals check is safe - return str0.equals(str1); - } - } - - void updateCurrentTask(boolean updated, boolean paused, TaskData newData, boolean isNewAssignment) - { - // important case for if the current task is completed so the update will show the empty task - if (isEmptyTask(newData)) - { - if (tasks.isEmpty()) // if there is no current task an empty task doesn't do anything - { - return; - } - TaskBox current = tasks.get(0); - // current task has ended even though it should still have 1 amount remaining b/c the ending chat message - // pops before the slayer xp drop so we need to force the remaining kc to zero and add the last kc to - // the elapsed kc - if (current.getTaskData().getAmount() != 0) // must check not equal zero b/c otherwise this would constantly tick - { - int amountDelta = current.getTaskData().getAmount(); - current.getTaskData().setAmount(0); - current.getTaskData().setElapsedKills(current.getTaskData().getElapsedKills() + amountDelta); - // current task has ended so it should be paused - current.update(true, true, current.getTaskData()); - updateOverall(); - } - return; - } - - if (tasks.isEmpty() || isNewAssignment) - { - // new task so append it to the front of the list - SwingUtilities.invokeLater(() -> - { - TaskBox newBox = buildBox(slayerPlugin, tasksContainer, newData); - newBox.update(true, newData.isPaused(), newData); - }); - return; - } - else - { - // if here there is a current task so check if the current task matches - // the update being sent - TaskBox current = tasks.get(0); - if (!stringsEqualIncludeNull(current.getTaskData().getTaskName(), newData.getTaskName()) || - !stringsEqualIncludeNull(current.getTaskData().getTaskLocation(), newData.getTaskLocation()) || - current.getTaskData().getInitialAmount() != newData.getInitialAmount()) - { - // current task does not match the update being sent so the current task - // must have been outdated - this is necessarily true because if a true - // new task was sent it would have set the isNewAssignment flag - - // so this previous task is invalid so delete it then add in the new actually - // correct task - SwingUtilities.invokeLater(() -> - { - tasksContainer.remove(tasks.get(0)); - tasks.remove(0); - TaskBox newBox = buildBox(slayerPlugin, tasksContainer, newData); - newBox.update(true, newData.isPaused(), newData); - }); - return; - } - } - - // not an empty assignment or a new assignment so just update the current assignment - TaskBox current = tasks.get(0); - current.update(updated, paused, newData); - - // update the overall stats once this task stats are updated - updateOverall(); - changePauseState(paused); - } - - private static String htmlLabel(String key, long timeMillis) - { - if (timeMillis == Long.MAX_VALUE) - { - String valueStr = "N/A"; - return String.format(HTML_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR), - key, valueStr); - } - else - { - long seconds = timeMillis / MILLIS_PER_SECOND; - long minutes = seconds / SECONDS_PER_MINUTE; - seconds %= 60; - long hours = minutes / MINUTES_PER_HOUR; - minutes %= 60; - return String.format(HTML_TIME_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR), - key, (int) hours, (int) minutes, (int) seconds); - } - } - - private static String htmlLabel(String key, int value) - { - String valueStr = QuantityFormatter.quantityToRSDecimalStack(value); - return String.format(HTML_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR), - key, valueStr); - } - -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerXpDropLookup.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerXpDropLookup.java deleted file mode 100644 index 0c7ec6e4d2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerXpDropLookup.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2018, Davis Cook - * 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.slayer; - -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.List; -import java.util.Map; - -class SlayerXpDropLookup -{ - private Map> xpMap; - - // floating point math equality - private static final double EPSILON = 1e-6; - - private void loadXpJson() throws IOException - { - try (final InputStream xpFile = getClass().getResourceAsStream("/slayer_xp.json")) - { - Gson gson = new Gson(); - xpMap = gson.fromJson(new InputStreamReader(xpFile), new TypeToken>>() {}.getType()); - } - } - - /** - * Finds the xp for a given npc using the xp + combat level data provided - * from the JSON - since scrapping from the wiki isn't perfectly accurate - * we make some estimations - *

- * precondition is that xpCombatLevel array is non-null - if it is null - * we can simply return -1 to indicate no slayer xp because this npc - * has no associated xpCombatLevel array - *

- * 1. first check to see if anywhere in the xp + combat level data this - * creature name give slayer xp - if it doesn't just return -1 and - * be done with this - if it does give slayer xp then continue - * 2. now check to see if we can find the xp for this combat level where - * that xp is greater than 0. note that we don't just find the xp for - * this combat level - this is because for some monsters the wiki - * only has slayer xp data for some combat levels and has it unknown - * for the other combat levels. this way we only return the combat level - * related xp data for a monster if it is know - * 3. finally if the slayer xp data for the monster was unknown for the given - * level we estimate the slayer xp by using one of the slayer xps for a level - * that does have xp given - * 4. note that if a monster gives no slayer xp for any level it will return - * -1 so we don't accidentally misscount non-slayer targets dying as giving - * slayer xp - * - * @param npc the npc we are estimating slayer xp for - * @return our best guess for the slayer xp for this npc - */ - double findXpForNpc(NPCPresence npc) - { - List xpCombatLevel = xpMap.get(npc.getName()); - if (xpCombatLevel == null) - { - return -1; - } - boolean givesSlayerXp = false; - for (int i = 0; i < xpCombatLevel.size() - 1; i += 2) - { - if (xpCombatLevel.get(i) > 0) - { - givesSlayerXp = true; - break; - } - } - if (!givesSlayerXp) - { - return -1; - } - boolean foundCombatLevel = false; - for (int i = 0; i < xpCombatLevel.size() - 1; i += 2) - { - if (Math.abs(xpCombatLevel.get(i + 1) - npc.getCombatLevel()) < EPSILON - && xpCombatLevel.get(i) > 0) - { - foundCombatLevel = true; - break; - } - } - if (foundCombatLevel) - { - for (int i = 0; i < xpCombatLevel.size() - 1; i += 2) - { - if (Math.abs(xpCombatLevel.get(i + 1) - npc.getCombatLevel()) < EPSILON) - { - return xpCombatLevel.get(i); - } - } - } - else - { - for (int i = 0; i < xpCombatLevel.size() - 1; i += 2) - { - if (xpCombatLevel.get(i) > 0) - { - return xpCombatLevel.get(i); - } - } - } - return -1; - } - - SlayerXpDropLookup() - { - try - { - loadXpJson(); - } - catch (IOException e) - { - throw new RuntimeException(e); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetClickboxOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetClickboxOverlay.java deleted file mode 100644 index 5bf16d3edc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetClickboxOverlay.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2018, James Swindle - * Copyright (c) 2018, Adam - * Copyright (c) 2018, Shaun Dreclin - * 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.slayer; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.Shape; -import java.util.List; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.NPCDefinition; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldArea; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.util.Text; -import net.runelite.client.graphics.ModelOutlineRenderer; -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; - -@Singleton -public class TargetClickboxOverlay extends Overlay -{ - private static final Color TRANSPARENT = new Color(0, 0, 0, 0); - - private final Client client; - private final SlayerPlugin plugin; - private final ModelOutlineRenderer modelOutliner; - - @Inject - TargetClickboxOverlay(final Client client, final SlayerPlugin plugin, final ModelOutlineRenderer modelOutlineRenderer) - { - this.client = client; - this.plugin = plugin; - this.modelOutliner = modelOutlineRenderer; - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.isHighlightTargets()) - { - Set targets = plugin.getHighlightedTargets(); - for (NPC target : targets) - { - if (target == null || target.getName() == null) - { - continue; - } - - Color coloration = plugin.getGetTargetColor(); - - if (plugin.isSuperior(target.getName())) - { - coloration = plugin.getGetSuperiorColor(); - } - - renderNpcOverlay(graphics, target, coloration); - } - } - - return null; - } - - private void renderNpcOverlay(Graphics2D graphics, NPC actor, Color color) - { - switch (plugin.getRenderStyle()) - { - case SOUTH_WEST_TILE: - LocalPoint lp1 = LocalPoint.fromWorld(client, actor.getWorldLocation()); - - if (lp1 == null) - { - return; - } - - Polygon tilePoly1 = Perspective.getCanvasTilePoly(client, lp1); - - OverlayUtil.renderPolygon(graphics, tilePoly1, color); - break; - - case TILE: - int size = 1; - NPCDefinition composition = actor.getTransformedDefinition(); - - if (composition != null) - { - size = composition.getSize(); - } - - LocalPoint lp = actor.getLocalLocation(); - Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size); - - OverlayUtil.renderPolygon(graphics, tilePoly, color); - break; - - case HULL: - Shape objectClickbox = actor.getConvexHull(); - - if (objectClickbox == null) - { - return; - } - - OverlayUtil.renderPolygon(graphics, objectClickbox, color); - break; - case THIN_OUTLINE: - modelOutliner.drawOutline(actor, 1, color); - break; - - case OUTLINE: - modelOutliner.drawOutline(actor, 2, color); - break; - - case THIN_GLOW: - modelOutliner.drawOutline(actor, 4, color, TRANSPARENT); - break; - - case GLOW: - modelOutliner.drawOutline(actor, 8, color, TRANSPARENT); - break; - case TRUE_LOCATIONS: - size = 1; - composition = actor.getTransformedDefinition(); - - if (composition != null) - { - size = composition.getSize(); - } - - WorldPoint wp = actor.getWorldLocation(); - getSquare(wp, size).forEach(square -> - drawTile(graphics, square, color, 1, 255, 50)); - break; - } - - if (plugin.isDrawNames()) - { - String npcName = Text.removeTags(actor.getName()); - Point textLocation = actor.getCanvasTextLocation(graphics, npcName, actor.getLogicalHeight() + 40); - - if (textLocation != null) - { - OverlayUtil.renderTextLocation(graphics, textLocation, npcName, color); - } - } - } - - private List getSquare(WorldPoint npcLoc, int npcSize) - { - return new WorldArea(npcLoc.getX(), npcLoc.getY(), npcSize, npcSize, npcLoc.getPlane()).toWorldPointList(); - } - - private void drawTile(Graphics2D graphics, WorldPoint point, Color color, int strokeWidth, int outlineAlpha, int fillAlpha) - { - WorldPoint playerLocation = client.getLocalPlayer().getWorldLocation(); - - if (point.distanceTo(playerLocation) >= 32) - { - return; - } - - LocalPoint lp = LocalPoint.fromWorld(client, point); - - if (lp == null) - { - return; - } - - Polygon poly = Perspective.getCanvasTilePoly(client, lp); - - if (poly == null) - { - return; - } - - 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); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetMinimapOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetMinimapOverlay.java deleted file mode 100644 index 6799c49674..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetMinimapOverlay.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2018, James Swindle - * Copyright (c) 2018, Adam - * Copyright (c) 2018, Shaun Dreclin - * 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.slayer; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -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.OverlayUtil; - -@Singleton -public class TargetMinimapOverlay extends Overlay -{ - private final SlayerPlugin plugin; - - @Inject - TargetMinimapOverlay(final SlayerPlugin plugin) - { - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isHighlightTargets()) - { - return null; - } - - Set targets = plugin.getHighlightedTargets(); - for (NPC target : targets) - { - if (target == null || target.getName() == null) - { - continue; - } - - Color coloration = plugin.getGetTargetColor(); - - if (plugin.isSuperior(target.getName())) - { - coloration = plugin.getGetSuperiorColor(); - } - - renderTargetOverlay(graphics, target, target.getName(), coloration); - } - - return null; - } - - private void renderTargetOverlay(Graphics2D graphics, NPC actor, String name, Color color) - { - Point minimapLocation = actor.getMinimapLocation(); - if (minimapLocation != null) - { - OverlayUtil.renderMinimapLocation(graphics, minimapLocation, color); - - if (plugin.isDrawMinimapNames()) - { - OverlayUtil.renderTextLocation(graphics, minimapLocation, name, color); - } - } - } -} 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 deleted file mode 100644 index cdc86c6992..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetWeaknessOverlay.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2018, Sam "Berry" Beresford - * 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.slayer; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.coords.LocalPoint; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.NPCManager; -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; - -@Singleton -class TargetWeaknessOverlay extends Overlay -{ - private final Client client; - private final SlayerPlugin plugin; - private final ItemManager itemManager; - private final NPCManager npcManager; - - @Inject - private TargetWeaknessOverlay(final Client client, final SlayerPlugin plugin, final ItemManager itemManager, final NPCManager npcManager) - { - this.client = client; - this.plugin = plugin; - this.itemManager = itemManager; - this.npcManager = npcManager; - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.UNDER_WIDGETS); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isWeaknessPrompt()) - { - return null; - } - - final Task npcTask = plugin.getWeaknessTask(); - - if (npcTask == null) - { - return null; - } - - final NPC npc = (NPC) client.getLocalPlayer().getInteracting(); - final int threshold = npcTask.getWeaknessThreshold(); - final BufferedImage image = itemManager.getImage(npcTask.getWeaknessItem()); - final int currentHealth = calculateHealth(npc); - - if (currentHealth >= 0 && currentHealth <= threshold) - { - renderTargetItem(graphics, npc, image); - } - - return null; - } - - private int calculateHealth(NPC target) - { - // Based on OpponentInfoOverlay HP calculation - if (target == null || target.getName() == null) - { - return -1; - } - - final int healthScale = target.getHealth(); - final int healthRatio = target.getHealthRatio(); - final int maxHealth = npcManager.getHealth(target.getId()); - - if (healthRatio < 0 || healthScale <= 0 || maxHealth == -1) - { - return -1; - } - - return (int) ((maxHealth * healthRatio / healthScale) + 0.5f); - } - - private void renderTargetItem(Graphics2D graphics, NPC actor, BufferedImage image) - { - final LocalPoint actorPosition = actor.getLocalLocation(); - final int offset = actor.getLogicalHeight() + 40; - - if (actorPosition == null || image == null) - { - return; - } - - final Point imageLoc = Perspective.getCanvasImageLocation(client, actorPosition, image, offset); - - if (imageLoc != null) - { - OverlayUtil.renderImageLocation(graphics, imageLoc, image); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java deleted file mode 100644 index 6ab3de8f8d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/Task.java +++ /dev/null @@ -1,411 +0,0 @@ -/* - * Copyright (c) 2017, Tyler - * Copyright (c) 2018, Shaun Dreclin - * 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.slayer; - -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import java.util.ArrayList; -import static java.util.Arrays.asList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import javax.annotation.Nullable; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ItemID; -import net.runelite.api.NpcID; - -@Getter(AccessLevel.PACKAGE) -enum Task -{ - - /* - * format for enum is that the name of the task is first - * second is the item id image we use to represent the task graphically - * third is the list of names of monsters that can be killed on task (note that he task name is already handled - * so that is why for a task like ankou there is no need to include this list) - * fourth is the list of ids of monsters that can be killed on task (main reason for this is weird cases like baby dragons and the elf mourner) - */ - - // - ABERRANT_SPECTRES("Aberrant spectres", ItemID.ABERRANT_SPECTRE, - asList("Abhorrent spectre", "Deviant spectre", "Repugnant spectre"), Collections.emptyList()), - ABYSSAL_DEMONS("Abyssal demons", ItemID.ABYSSAL_DEMON, - Collections.singletonList("Abyssal Sire"), Collections.emptyList()), - ABYSSAL_SIRE("Abyssal Sire", ItemID.ABYSSAL_ORPHAN), - ADAMANT_DRAGONS("Adamant dragons", ItemID.ADAMANT_DRAGON_MASK), - ALCHEMICAL_HYDRA("Alchemical Hydra", ItemID.IKKLE_HYDRA), - ANKOU("Ankou", ItemID.ANKOU_MASK), - AVIANSIES("Aviansies", ItemID.ENSOULED_AVIANSIE_HEAD, - Collections.singletonList("Kree'arra"), Collections.emptyList()), - BANSHEES("Banshees", ItemID.BANSHEE), - BARROWS_BROTHERS("Barrows Brothers", ItemID.KARILS_COIF, - asList("Ahrim the blighted", "Dharok the wretched", "Guthan the infested", "Karil the tainted", "Torag the corrupted", "Verac the defiled"), Collections.emptyList()), - BASILISKS("Basilisks", ItemID.BASILISK), - BATS("Bats", ItemID.GIRAL_BAT_2), - BEARS("Bears", ItemID.ENSOULED_BEAR_HEAD, - Collections.singletonList("Callisto"), Collections.emptyList()), - ENTS("Ents", ItemID.ENTS_ROOTS), - LAVA_DRAGONS("Lava Dragons", ItemID.LAVA_SCALE), - BANDITS("Bandits", ItemID.BANDIT), - BIRDS("Birds", ItemID.FEATHER, - asList("Chicken", "Rooster", "Terrorbird", "Seagull", "Chompy bird", "Jubbly bird", "Oomlie bird", "Vulture"), Collections.emptyList()), - BLACK_DEMONS("Black demons", ItemID.BLACK_DEMON_MASK, - asList("Demonic gorilla", "Balfrug kreeyath", "Skotizo"), Collections.emptyList()), - BLACK_DRAGONS("Black dragons", ItemID.BLACK_DRAGON_MASK, - Collections.emptyList(), asList(NpcID.BABY_BLACK_DRAGON, NpcID.BABY_BLACK_DRAGON_1872 , NpcID.BABY_BLACK_DRAGON_7955)), - BLOODVELD("Bloodveld", ItemID.BLOODVELD), - BLUE_DRAGONS("Blue dragons", ItemID.BLUE_DRAGON_MASK, - Collections.singletonList("Vorkath"), asList(NpcID.BABY_BLUE_DRAGON, NpcID.BABY_BLUE_DRAGON_242, NpcID.BABY_BLUE_DRAGON_243)), - BRINE_RATS("Brine rats", ItemID.BRINE_RAT), - BRONZE_DRAGONS("Bronze dragons", ItemID.BRONZE_DRAGON_MASK), - CALLISTO("Callisto", ItemID.CALLISTO_CUB), - CATABLEPON("Catablepon", ItemID.LEFT_SKULL_HALF), - CAVE_BUGS("Cave bugs", ItemID.SWAMP_CAVE_BUG), - CAVE_CRAWLERS("Cave crawlers", ItemID.CAVE_CRAWLER, - Collections.singletonList("Chasm crawler"), Collections.emptyList()), - CAVE_HORRORS("Cave horrors", ItemID.CAVE_HORROR, - Collections.singletonList("Cave abomination"), Collections.emptyList()), - CAVE_KRAKEN("Cave kraken", ItemID.CAVE_KRAKEN, - Collections.singletonList("Kraken"), Collections.emptyList()), - CAVE_SLIMES("Cave slimes", ItemID.SWAMP_CAVE_SLIME), - CERBERUS("Cerberus", ItemID.HELLPUPPY), - CHAOS_DRUIDS("Chaos druids", ItemID.ELDER_CHAOS_HOOD), - CHAOS_ELEMENTAL("Chaos Elemental", ItemID.PET_CHAOS_ELEMENTAL), - CHAOS_FANATIC("Chaos Fanatic", ItemID.ANCIENT_STAFF), - COCKATRICE("Cockatrice", ItemID.COCKATRICE, - Collections.singletonList("Cockathrice"), Collections.emptyList()), - COWS("Cows", ItemID.COW_MASK), - CRAWLING_HANDS("Crawling hands", ItemID.CRAWLING_HAND, - Collections.singletonList("Crushing hand"), Collections.emptyList()), - CRAZY_ARCHAEOLOGIST("Crazy Archaeologist", ItemID.FEDORA), - CROCODILES("Crocodiles", ItemID.SWAMP_LIZARD), - DAGANNOTH("Dagannoth", ItemID.DAGANNOTH, - asList("Dagannoth Rex", "Dagannoth Prime", "Dagannoth Supreme"), Collections.emptyList()), - DAGANNOTH_KINGS("Dagannoth Kings", ItemID.PET_DAGANNOTH_PRIME, - asList("Dagannoth Rex", "Dagannoth Prime", "Dagannoth Supreme"), Collections.emptyList()), - DARK_BEASTS("Dark beasts", ItemID.DARK_BEAST, - Collections.singletonList("Night beast"), Collections.emptyList()), - DARK_WARRIORS("Dark warriors", ItemID.BLACK_MED_HELM), - DERANGED_ARCHAEOLOGIST("Deranged Archaeologist", ItemID.ARCHAEOLOGISTS_DIARY), - DOGS("Dogs", ItemID.GUARD_DOG, Collections.singletonList("Jackal"), Collections.emptyList()), - DRAKES("Drakes", ItemID.DRAKE), - DUST_DEVILS("Dust devils", ItemID.DUST_DEVIL, - Collections.singletonList("Choke devil"), Collections.emptyList()), - DWARVES("Dwarves", ItemID.DWARVEN_HELMET, - asList("Dwarf", "Black guard"), Collections.emptyList()), - EARTH_WARRIORS("Earth warriors", ItemID.BRONZE_FULL_HELM_T), - ELVES("Elves", ItemID.ELF, - Collections.singletonList("Elf"), Collections.emptyList()), - FEVER_SPIDERS("Fever spiders", ItemID.FEVER_SPIDER), - FIRE_GIANTS("Fire giants", ItemID.FIRE_BATTLESTAFF), - REVENANTS("Revenants", ItemID.REVENANT_ETHER, - asList("Revenant imp", "Revenant goblin", "Revenant pyrefiend", "Revenant hobgoblin", "Revenant cyclops", "Revenant hellhound", "Revenant demon", "Revenant ork", "Revenant dark beast", "Revenant knight", "Revenant dragon"), Collections.emptyList()), - FLESH_CRAWLERS("Flesh crawlers", ItemID.ENSOULED_SCORPION_HEAD), - FOSSIL_ISLAND_WYVERNS("Fossil island wyverns", ItemID.FOSSIL_ISLAND_WYVERN, - asList("Ancient wyvern", "Long-tailed wyvern", "Spitting wyvern", "Taloned wyvern"), Collections.emptyList()), - GARGOYLES("Gargoyles", ItemID.GARGOYLE, - asList("Dusk", "Dawn"), Collections.emptyList(), 9, ItemID.ROCK_HAMMER), - GENERAL_GRAARDOR("General Graardor", ItemID.PET_GENERAL_GRAARDOR), - GHOSTS("Ghosts", ItemID.GHOSTSPEAK_AMULET, - Collections.singletonList("Tortured soul"), Collections.emptyList()), - GIANT_MOLE("Giant Mole", ItemID.BABY_MOLE), - GHOULS("Ghouls", ItemID.ZOMBIE_HEAD), - GOBLINS("Goblins", ItemID.ENSOULED_GOBLIN_HEAD), - GREATER_DEMONS("Greater demons", ItemID.GREATER_DEMON_MASK, - asList("K'ril Tsutsaroth", "Tstanon Karlak", "Skotizo"), Collections.emptyList()), - GREEN_DRAGONS("Green dragons", ItemID.GREEN_DRAGON_MASK, - Collections.emptyList(), asList(NpcID.BABY_GREEN_DRAGON, NpcID.BABY_GREEN_DRAGON_5872, NpcID.BABY_GREEN_DRAGON_5873)), - GROTESQUE_GUARDIANS("Grotesque Guardians", ItemID.MIDNIGHT, - asList("Dusk", "Dawn"), Collections.emptyList(), 0, ItemID.ROCK_HAMMER), - HARPIE_BUG_SWARMS("Harpie bug swarms", ItemID.SWARM), - HELLHOUNDS("Hellhounds", ItemID.HELLHOUND, - Collections.singletonList("Cerberus"), Collections.emptyList()), - HILL_GIANTS("Hill giants", ItemID.ENSOULED_GIANT_HEAD, - Collections.singletonList("Cyclops"), Collections.emptyList()), - HOBGOBLINS("Hobgoblins", ItemID.HOBGOBLIN_GUARD), - HYDRAS("Hydras", ItemID.HYDRA), - ICEFIENDS("Icefiends", ItemID.ICE_DIAMOND), - ICE_GIANTS("Ice giants", ItemID.ICE_DIAMOND), - ICE_WARRIORS("Ice warriors", ItemID.MITHRIL_FULL_HELM_T), - INFERNAL_MAGES("Infernal mages", ItemID.INFERNAL_MAGE, - Collections.singletonList("Malevolent mage"), Collections.emptyList()), - IRON_DRAGONS("Iron dragons", ItemID.IRON_DRAGON_MASK), - JAD("TzTok-Jad", ItemID.TZREKJAD, 25250), - JELLIES("Jellies", ItemID.JELLY, - Collections.singletonList("Jelly"), Collections.emptyList()), - JUNGLE_HORROR("Jungle horrors", ItemID.ENSOULED_HORROR_HEAD), - KALPHITE("Kalphite", ItemID.KALPHITE_SOLDIER), - KALPHITE_QUEEN("Kalphite Queen", ItemID.KALPHITE_PRINCESS), - KILLERWATTS("Killerwatts", ItemID.KILLERWATT), - KING_BLACK_DRAGON("King Black Dragon", ItemID.PRINCE_BLACK_DRAGON), - KRAKEN("Cave Kraken Boss", ItemID.PET_KRAKEN, - Collections.singletonList("Kraken"), Collections.emptyList()), - KREEARRA("Kree'arra", ItemID.PET_KREEARRA), - KRIL_TSUTSAROTH("K'ril Tsutsaroth", ItemID.PET_KRIL_TSUTSAROTH), - KURASK("Kurask", ItemID.KURASK), - ROGUES("Rogues", ItemID.ROGUE_MASK, Collections.singletonList("Rogue"), Collections.emptyList()), - LESSER_DEMONS("Lesser demons", ItemID.LESSER_DEMON_MASK), - LIZARDMEN("Lizardmen", ItemID.LIZARDMAN_FANG, - Collections.singletonList("Lizardman"), Collections.emptyList()), - LIZARDS("Lizards", ItemID.DESERT_LIZARD, - asList("Desert lizard", "Sulphur lizard", "Small lizard", "Lizard"), Collections.emptyList(), 4, ItemID.ICE_COOLER), - MAGIC_AXES("Magic axes", ItemID.IRON_BATTLEAXE), - MAMMOTHS("Mammoths", ItemID.ATTACKER_HORN, - Collections.singletonList("Mammoth"), Collections.emptyList()), - MINIONS_OF_SCABARAS("Minions of scabaras", ItemID.GOLDEN_SCARAB, - asList("Scarab swarm", "Locust rider", "Scarab mage"), Collections.emptyList()), - MINOTAURS("Minotaurs", ItemID.ENSOULED_MINOTAUR_HEAD), - MITHRIL_DRAGONS("Mithril dragons", ItemID.MITHRIL_DRAGON_MASK), - MOGRES("Mogres", ItemID.MOGRE), - MOLANISKS("Molanisks", ItemID.MOLANISK), - MONKEYS("Monkeys", ItemID.ENSOULED_MONKEY_HEAD), - MOSS_GIANTS("Moss giants", ItemID.HILL_GIANT_CLUB, - Collections.singletonList("Bryophyta"), Collections.emptyList()), - MUTATED_ZYGOMITES("Mutated zygomites", ItemID.MUTATED_ZYGOMITE, - Collections.singletonList("Zygomite"), Collections.emptyList(), 7, ItemID.FUNGICIDE_SPRAY_0), - NECHRYAEL("Nechryael", ItemID.NECHRYAEL, - Collections.singletonList("Nechryarch"), Collections.emptyList()), - OGRES("Ogres", ItemID.ENSOULED_OGRE_HEAD, - Collections.singletonList("Enclave guard"), Collections.emptyList()), - OTHERWORLDLY_BEING("Otherworldly beings", ItemID.GHOSTLY_HOOD), - PYREFIENDS("Pyrefiends", ItemID.PYREFIEND, - Collections.singletonList("Flaming pyrelord"), Collections.emptyList()), - RATS("Rats", ItemID.RATS_TAIL), - RED_DRAGONS("Red dragons", ItemID.BABY_RED_DRAGON, - Collections.emptyList(), asList(NpcID.BABY_RED_DRAGON_244, NpcID.BABY_RED_DRAGON_245, NpcID.BABY_RED_DRAGON_246)), - ROCKSLUGS("Rockslugs", ItemID.ROCKSLUG, 4, ItemID.BAG_OF_SALT), - RUNE_DRAGONS("Rune dragons", ItemID.RUNE_DRAGON_MASK), - SCORPIA("Scorpia", ItemID.SCORPIAS_OFFSPRING), - SCORPIONS("Scorpions", ItemID.ENSOULED_SCORPION_HEAD, - Collections.singletonList("Scorpia"), Collections.emptyList()), - SARACHNIS("Sarachnis", ItemID.SRARACHA), - SEA_SNAKES("Sea snakes", ItemID.SNAKE_CORPSE), - SHADES("Shades", ItemID.SHADE_ROBE_TOP, - asList("Loar Shadow", "Loar Shade", "Phrin Shadow", "Phrin Shade", "Riyl Shadow", "Riyl Shade", "Asyn Shadow", "Asyn Shade", "Fiyr Shadow", "Fiyr Shade"), Collections.emptyList()), - SHADOW_WARRIORS("Shadow warriors", ItemID.BLACK_FULL_HELM), - SKELETAL_WYVERNS("Skeletal wyverns", ItemID.SKELETAL_WYVERN), - SKELETONS("Skeletons", ItemID.SKELETON_GUARD), - SMOKE_DEVILS("Smoke devils", ItemID.SMOKE_DEVIL), - SPIDERS("Spiders", ItemID.HUGE_SPIDER, - Collections.singletonList("Venenatis"), Collections.emptyList()), - SPIRITUAL_CREATURES("Spiritual creatures", ItemID.DRAGON_BOOTS, - asList("Spiritual ranger", "Spiritual mage", "Spiritual warrior"), Collections.emptyList()), - STEEL_DRAGONS("Steel dragons", ItemID.STEEL_DRAGON), - SULPHUR_LIZARDS("Sulphur Lizards", ItemID.SULPHUR_LIZARD), - SUQAHS("Suqahs", ItemID.SUQAH_TOOTH), - TEMPLE_SPIDERS("Temple Spiders", ItemID.RED_SPIDERS_EGGS), - TERROR_DOGS("Terror dogs", ItemID.TERROR_DOG), - THERMONUCLEAR_SMOKE_DEVIL("Thermonuclear Smoke Devil", ItemID.PET_SMOKE_DEVIL), - TROLLS("Trolls", ItemID.TROLL_GUARD), - TUROTH("Turoth", ItemID.TUROTH), - TZHAAR("Tzhaar", ItemID.ENSOULED_TZHAAR_HEAD, - Collections.singletonList("Tz-"), Collections.emptyList(), false), - UNDEAD_DRUIDS("Undead Druids", ItemID.MASK_OF_RANUL), - VAMPIRES("Vampires", ItemID.STAKE, - asList("Vampyre", "Vyrewatch", "Vampire"), Collections.emptyList()), - VENENATIS("Venenatis", ItemID.VENENATIS_SPIDERLING), - VETION("Vet'ion", ItemID.VETION_JR), - VORKATH("Vorkath", ItemID.VORKI), - WALL_BEASTS("Wall beasts", ItemID.SWAMP_WALLBEAST), - WATERFIENDS("Waterfiends", ItemID.WATER_ORB), - WEREWOLVES("Werewolves", ItemID.WOLFBANE, - Collections.singletonList("Werewolf"), Collections.emptyList()), - WOLVES("Wolves", ItemID.GREY_WOLF_FUR, - Collections.singletonList("Wolf"), Collections.emptyList()), - WYRMS("Wyrms", ItemID.WYRM), - ZILYANA("Zilyana", ItemID.PET_ZILYANA), - ZOMBIES("Zombies", ItemID.ZOMBIE_HEAD, - Collections.singletonList("Undead"), Collections.emptyList()), - ZULRAH("Zulrah", ItemID.PET_SNAKELING), - ZUK("TzKal-Zuk", ItemID.TZREKZUK, 101890); - // - - private static final Map tasks; - static final List LOCATIONS = ImmutableList.of( - "", // no location is a valid location - "Abyss", - "Ancient Cavern", - "Asgarnian Ice Dungeon", - "Brimhaven Dungeon", - "Brine Rat Cavern", - "Catacombs of Kourend", - "Chasm of Fire", - "Clan Wars", - "Death Plateau", - "Evil Chicken's Lair", - "Fossil Island", - "Forthos Dungeon", - "Fremennik Slayer Dungeon", - "God Wars Dungeon", - "Iorwerth Dungeon", - "Kalphite Lair", - "Karuulm Slayer Dungeon", - "Keldagrim", - "Kraken Cove", - "Lighthouse", - "Lithkren Vault", - "Lizardman Canyon", - "Lizardman Settlement", - "Molch", - "Mount Quidamortem", - "Mourner Tunnels", - "Ogre Enclave", - "Slayer Tower", - "Smoke Devil Dungeon", - "Smoke Dungeon", - "Stronghold of Security", - "Stronghold Slayer Dungeon", - "task-only Kalphite Cave", - "Taverley Dungeon", - "Troll Stronghold", - "Waterbirth Island", - "Waterfall Dungeon", - "Wilderness", - "Witchaven Dungeon", - "Zanaris" - ); - - private final String name; - private final int itemSpriteId; - - private final List targetNames; - private final List npcIds; - private final boolean checkAsTokens; - private final int weaknessThreshold; - private final int weaknessItem; - private final int expectedKillExp; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (Task task : values()) - { - builder.put(task.getName().toLowerCase(), task); - } - - tasks = builder.build(); - } - - Task(String name, int itemSpriteId) - { - Preconditions.checkArgument(itemSpriteId >= 0); - this.name = name; - this.itemSpriteId = itemSpriteId; - this.weaknessThreshold = -1; - this.weaknessItem = -1; - this.targetNames = new ArrayList<>(); - this.npcIds = new ArrayList<>(); - this.checkAsTokens = true; - this.expectedKillExp = 0; - } - - Task(String name, int itemSpriteId, int weaknessThreshold, int weaknessItem) - { - Preconditions.checkArgument(itemSpriteId >= 0); - this.name = name; - this.itemSpriteId = itemSpriteId; - this.weaknessThreshold = weaknessThreshold; - this.weaknessItem = weaknessItem; - this.targetNames = new ArrayList<>(); - this.npcIds = new ArrayList<>(); - this.checkAsTokens = true; - this.expectedKillExp = 0; - } - - Task(String name, int itemSpriteId, boolean checkAsTokens) - { - Preconditions.checkArgument(itemSpriteId >= 0); - this.name = name; - this.itemSpriteId = itemSpriteId; - this.weaknessThreshold = -1; - this.weaknessItem = -1; - this.targetNames = new ArrayList<>(); - this.npcIds = new ArrayList<>(); - this.checkAsTokens = checkAsTokens; - this.expectedKillExp = 0; - } - - Task(String name, int itemSpriteId, int expectedKillExp) - { - Preconditions.checkArgument(itemSpriteId >= 0); - this.name = name; - this.itemSpriteId = itemSpriteId; - this.weaknessThreshold = -1; - this.weaknessItem = -1; - this.targetNames = new ArrayList<>(); - this.npcIds = new ArrayList<>(); - this.checkAsTokens = true; - this.expectedKillExp = expectedKillExp; - } - - Task(String name, int itemSpriteId, List targetNames, List npcIds) - { - Preconditions.checkArgument(itemSpriteId >= 0); - this.name = name; - this.itemSpriteId = itemSpriteId; - this.weaknessThreshold = -1; - this.weaknessItem = -1; - this.targetNames = targetNames; - this.npcIds = npcIds; - this.checkAsTokens = true; - this.expectedKillExp = 0; - } - - Task(String name, int itemSpriteId, List targetNames, List npcIds, int weaknessThreshold, int weaknessItem) - { - Preconditions.checkArgument(itemSpriteId >= 0); - this.name = name; - this.itemSpriteId = itemSpriteId; - this.weaknessThreshold = weaknessThreshold; - this.weaknessItem = weaknessItem; - this.targetNames = targetNames; - this.npcIds = npcIds; - this.checkAsTokens = true; - this.expectedKillExp = 0; - } - - Task(String name, int itemSpriteId, List targetNames, List npcIds, boolean checkAsTokens) - { - Preconditions.checkArgument(itemSpriteId >= 0); - this.name = name; - this.itemSpriteId = itemSpriteId; - this.weaknessThreshold = -1; - this.weaknessItem = -1; - this.targetNames = targetNames; - this.npcIds = npcIds; - this.checkAsTokens = checkAsTokens; - this.expectedKillExp = 0; - } - - @Nullable - static Task getTask(String taskName) - { - return tasks.get(taskName.toLowerCase()); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TaskBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TaskBox.java deleted file mode 100644 index 80a595ef40..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TaskBox.java +++ /dev/null @@ -1,307 +0,0 @@ -package net.runelite.client.plugins.slayer; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.image.BufferedImage; -import java.text.DecimalFormat; -import java.util.Collections; -import javax.inject.Singleton; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingConstants; -import javax.swing.SwingUtilities; -import javax.swing.border.EmptyBorder; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.DynamicGridLayout; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.components.ProgressBar; -import net.runelite.client.util.QuantityFormatter; - -@Singleton -class TaskBox extends JPanel -{ - private static final long MILLIS_PER_SECOND = 1000; - private static final long SECONDS_PER_MINUTE = 60; - private static final long MINUTES_PER_HOUR = 60; - private static final long MILLIS_PER_HOUR = MILLIS_PER_SECOND * SECONDS_PER_MINUTE * MINUTES_PER_HOUR; - - private static final DecimalFormat TWO_DECIMAL_FORMAT = new DecimalFormat("0.00"); - - - // Templates - private static final String HTML_TOOL_TIP_TEMPLATE = - "%.1f Kills/hr
" + - "%02d:%02d:%02d per kill"; - private static final String HTML_LABEL_TEMPLATE = - "%s"; - private static final String HTML_TIME_LABEL_TEMPLATE = - "%02d:%02d:%02d"; - - // Instance members - private final JPanel panel; - - @Getter(AccessLevel.PACKAGE) - private final TaskData taskData; - - /* Contains the task icon and the stats panel */ - private final JPanel headerPanel = new JPanel(); - - /* Contains the overall stats of the slayer task */ - private final JPanel statsPanel = new JPanel(); - - private final ProgressBar progressBar = new ProgressBar(); - - private final JLabel elapsed = new JLabel("Elapsed:"); - private final JLabel remaining = new JLabel("Remaining:"); - private final JLabel duration = new JLabel("Time:"); - private final JLabel currentDuration = new JLabel(); - private final JLabel remainingDuration = new JLabel(); - private final JLabel kills = new JLabel("Kills:"); - private final JLabel currentKills = new JLabel(); - private final JLabel remainingKills = new JLabel(); - private final JLabel xp = new JLabel("XP:"); - private final JLabel currentXp = new JLabel(); - private final JLabel remainingXp = new JLabel(); - - private boolean paused = false; - - TaskBox(SlayerPlugin slayerPlugin, JPanel panel, TaskData taskData) - { - this.panel = panel; - this.taskData = taskData; - - setLayout(new BorderLayout()); - setBorder(new EmptyBorder(5, 0, 0, 0)); - - /* This task's wrapping container */ - JPanel container = new JPanel(); - container.setLayout(new BorderLayout()); - container.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - SwingUtilities.invokeLater(() -> - { - BufferedImage taskImg = slayerPlugin.getImageForTask(Task.getTask(taskData.getTaskName())); - JLabel taskIcon = new JLabel(new ImageIcon(taskImg)); - taskIcon.setHorizontalAlignment(SwingConstants.CENTER); - taskIcon.setVerticalAlignment(SwingConstants.CENTER); - taskIcon.setPreferredSize(new Dimension(35, 35)); - - statsPanel.setLayout(new DynamicGridLayout(4, 3)); - statsPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - statsPanel.setBorder(new EmptyBorder(9, 2, 9, 2)); - - elapsed.setFont(FontManager.getRunescapeSmallFont()); - remaining.setFont(FontManager.getRunescapeSmallFont()); - duration.setFont(FontManager.getRunescapeSmallFont()); - currentDuration.setFont(FontManager.getRunescapeSmallFont()); - remainingDuration.setFont(FontManager.getRunescapeSmallFont()); - kills.setFont(FontManager.getRunescapeSmallFont()); - currentKills.setFont(FontManager.getRunescapeSmallFont()); - remainingKills.setFont(FontManager.getRunescapeSmallFont()); - xp.setFont(FontManager.getRunescapeSmallFont()); - currentXp.setFont(FontManager.getRunescapeSmallFont()); - remainingXp.setFont(FontManager.getRunescapeSmallFont()); - - statsPanel.add(new JLabel()); - statsPanel.add(elapsed); - statsPanel.add(remaining); - statsPanel.add(duration); - statsPanel.add(currentDuration); - statsPanel.add(remainingDuration); - statsPanel.add(kills); - statsPanel.add(currentKills); - statsPanel.add(remainingKills); - statsPanel.add(xp); - statsPanel.add(currentXp); - statsPanel.add(remainingXp); - - headerPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - headerPanel.setLayout(new BorderLayout()); - - headerPanel.add(statsPanel, BorderLayout.CENTER); - headerPanel.add(taskIcon, BorderLayout.WEST); - }); - - JPanel progressWrapper = new JPanel(); - progressWrapper.setBackground(ColorScheme.DARKER_GRAY_COLOR); - progressWrapper.setLayout(new BorderLayout()); - progressWrapper.setBorder(new EmptyBorder(0, 7, 7, 7)); - - progressBar.setMaximumValue(100); - progressBar.setBackground(new Color(61, 56, 49)); - - progressWrapper.add(progressBar, BorderLayout.NORTH); - - final JPanel logTitle = new JPanel(new BorderLayout(5, 0)); - logTitle.setBorder(new EmptyBorder(7, 7, 7, 7)); - logTitle.setBackground(ColorScheme.DARKER_GRAY_COLOR.darker()); - - String taskName = taskData.getTaskName(); - taskName = taskName.substring(0, 1).toUpperCase() + taskName.substring(1); - final JLabel titleLabel = new JLabel(taskName); - titleLabel.setFont(FontManager.getRunescapeSmallFont()); - titleLabel.setForeground(Color.WHITE); - - logTitle.add(titleLabel, BorderLayout.WEST); - - final JLabel subTitleLabel = new JLabel("x " + taskData.getInitialAmount()); - subTitleLabel.setFont(FontManager.getRunescapeSmallFont()); - subTitleLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR); - - logTitle.add(subTitleLabel, BorderLayout.CENTER); - - if (taskData.getTaskLocation() != null && !taskData.getTaskLocation().equals("")) - { - final JLabel locationLabel = new JLabel(taskData.getTaskLocation()); - locationLabel.setFont(FontManager.getRunescapeSmallFont()); - locationLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR); - - logTitle.add(locationLabel, BorderLayout.EAST); - } - - container.add(logTitle, BorderLayout.NORTH); - container.add(headerPanel, BorderLayout.CENTER); - container.add(progressWrapper, BorderLayout.SOUTH); - - add(container, BorderLayout.NORTH); - } - - void update(boolean updated, boolean paused, TaskData newData) - { - SwingUtilities.invokeLater(() -> rebuildAsync(updated, paused, newData)); - } - - private void rebuildAsync(boolean updated, boolean taskPaused, TaskData newData) - { - if (updated) - { - if (getParent() != panel) - { - panel.add(this, 0); - panel.revalidate(); - } - - // Update data - taskData.setElapsedKills(newData.getElapsedKills()); - taskData.setAmount(newData.getAmount()); - taskData.setElapsedXp(newData.getElapsedXp()); - - // Update information labels - int kills = taskData.getInitialAmount() - taskData.getAmount(); - currentKills.setText(htmlLabel(taskData.getElapsedKills())); - remainingKills.setText(htmlLabel(taskData.getAmount())); - - currentXp.setText(htmlLabel(taskData.getElapsedXp())); - double xpPerKill = ((double) taskData.getElapsedXp()) / ((double) taskData.getElapsedKills()); - double xpLeft = xpPerKill * taskData.getAmount(); - remainingXp.setText(htmlLabel((int) xpLeft)); - - // Update progress bar - double percentComplete = ((double) kills) / ((double) taskData.getInitialAmount()); - progressBar.setForeground(new Color(98, 70, 70)); - progressBar.setValue((int) (percentComplete * 100)); - progressBar.setCenterLabel(TWO_DECIMAL_FORMAT.format(percentComplete * 100) + "%"); - progressBar.setLeftLabel("0 Kc"); - progressBar.setRightLabel(taskData.getInitialAmount() + " Kc"); - progressBar.setPositions(Collections.emptyList()); - - double killsPerMillis = ((double) taskData.getElapsedKills() - 1) / ((double) taskData.getElapsedTime()); - if (killsPerMillis > 0) - { - double killsPerHour = killsPerMillis * MILLIS_PER_HOUR; - double millisPerKill = 1.0 / killsPerMillis; - long seconds = ((long) millisPerKill) / MILLIS_PER_SECOND; - long minutes = seconds / SECONDS_PER_MINUTE; - seconds %= 60; - long hours = minutes / MINUTES_PER_HOUR; - minutes %= 60; - progressBar.setToolTipText(String.format( - HTML_TOOL_TIP_TEMPLATE, - killsPerHour, - hours, - minutes, - seconds - )); - } - - if (taskData.getAmount() == 0 && taskData.getElapsedXp() == 0) - { - progressBar.setDimmedText("Skipped"); - progressBar.setForeground(new Color(128, 0, 0)); - } - else if ((taskData.getAmount() == 0 && taskData.getElapsedXp() > 0) || (int) (percentComplete * 100) >= 100) - { - progressBar.setDimmedText("Finished"); - progressBar.setForeground(new Color(0, 128, 0)); - } - else - { - progressBar.setDimmedText("Paused"); - } - - progressBar.setDimmed(taskPaused); - progressBar.repaint(); - } - else if (!paused && taskPaused) - { - progressBar.setDimmedText("Paused"); - progressBar.setDimmed(true); - progressBar.repaint(); - paused = true; - } - else if (paused && !taskPaused) - { - progressBar.setDimmed(false); - progressBar.repaint(); - paused = false; - } - - // Update duration separately, every time (not only when there's an update) - taskData.setElapsedTime(newData.getElapsedTime()); - currentDuration.setText(htmlLabel(taskData.getElapsedTime())); - remainingDuration.setText(htmlLabel(estimateRemainingTime(taskData))); - - repaint(); - } - - private static long estimateRemainingTime(TaskData taskData) - { - int kills = taskData.getElapsedKills(); - int killsInElapsedTime = kills - 1; // b/c time only elapses after 1st slayer drop - if (killsInElapsedTime < 1) - { - return Long.MAX_VALUE; - } - double timePerKill = ((double) taskData.getElapsedTime()) / ((double) killsInElapsedTime); - - return (long) timePerKill * taskData.getAmount(); - } - - private static String htmlLabel(long timeMillis) - { - if (timeMillis == Long.MAX_VALUE) - { - String valueStr = "N/A"; - return String.format(HTML_LABEL_TEMPLATE, valueStr); - } - else - { - long seconds = timeMillis / MILLIS_PER_SECOND; - long minutes = seconds / SECONDS_PER_MINUTE; - seconds %= 60; - long hours = minutes / MINUTES_PER_HOUR; - minutes %= 60; - return String.format(HTML_TIME_LABEL_TEMPLATE, (int) hours, (int) minutes, (int) seconds); - } - } - - private static String htmlLabel(int value) - { - String valueStr = QuantityFormatter.quantityToRSDecimalStack(value); - return String.format(HTML_LABEL_TEMPLATE, valueStr); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TaskCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TaskCounter.java deleted file mode 100644 index ae7c2c67e4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TaskCounter.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2017, Tyler - * 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.slayer; - -import java.awt.image.BufferedImage; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.ui.overlay.infobox.Counter; - -class TaskCounter extends Counter -{ - TaskCounter(final BufferedImage img, final Plugin plugin, final int amount) - { - super(img, plugin, amount); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TaskData.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TaskData.java deleted file mode 100644 index 9a641a7a87..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TaskData.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.runelite.client.plugins.slayer; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; - -@Data -@AllArgsConstructor -@Builder(toBuilder = true) -public class TaskData -{ - private long elapsedTime; - private int elapsedKills; - private int elapsedXp; - private int amount, initialAmount, lastCertainAmount; - private String taskLocation; - private String taskName; - private boolean paused; - - public void tick(long delta) - { - if (!paused) - { - elapsedTime += delta; - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayermusiq/QuestGuideLinks.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayermusiq/QuestGuideLinks.java deleted file mode 100644 index 65527b4659..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayermusiq/QuestGuideLinks.java +++ /dev/null @@ -1,229 +0,0 @@ -package net.runelite.client.plugins.slayermusiq; - -import net.runelite.api.ChatMessageType; -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.util.LinkBrowser; - -class QuestGuideLinks -{ - private static final Link[] QUEST_GUIDE_LINKS = { - // Free Quests - new Link("Cook's Assistant", "https://www.youtube.com/watch?v=ehmtDRelj3c"), - new Link("Romeo & Juliet", "https://www.youtube.com/watch?v=rH_biWSNWVY"), - new Link("Demon Slayer", "https://www.youtube.com/watch?v=hgACrzJSiQk"), - new Link("Shield of Arrav", "https://www.youtube.com/watch?v=a_imLDKUdzg"), - new Link("Sheep Shearer", "https://www.youtube.com/watch?v=XFG3aNwK68s"), - new Link("The Restless Ghost", "https://www.youtube.com/watch?v=UkWNcsG_pXM"), - new Link("Ernest the Chicken", "https://www.youtube.com/watch?v=cq8NIVhSqh4"), - new Link("Vampire Slayer", "https://www.youtube.com/watch?v=FcEuxsDJWCU"), - new Link("Imp Catcher", "https://www.youtube.com/watch?v=LHgnl0FbOzk"), - new Link("Prince Ali Rescue", "https://www.youtube.com/watch?v=hrSPl1GfFaw"), - new Link("Doric's Quest", "https://www.youtube.com/watch?v=5TYyxHU27a4"), - new Link("Black Knights' Fortress", "https://www.youtube.com/watch?v=aekoZi3f9cU"), - new Link("Witch's Potion", "https://www.youtube.com/watch?v=XV4i5sPUvXo"), - new Link("The Knight's Sword", "https://www.youtube.com/watch?v=UkBWaI0rOqE"), - new Link("Goblin Diplomacy", "https://www.youtube.com/watch?v=P9BKOb_dLoY"), - new Link("Pirate's Treasure", "https://www.youtube.com/watch?v=zcD87PQW8Qk"), - new Link("Dragon Slayer", "https://www.youtube.com/watch?v=bMtCjlFOaBI"), - new Link("Rune Mysteries", "https://www.youtube.com/watch?v=l8ZhaN8uoS0"), - new Link("Misthalin Mystery", "https://www.youtube.com/watch?v=QlFqVAobAlQ"), - new Link("The Corsair Curse", "https://www.youtube.com/watch?v=wi7mUAHExz4"), - new Link("X Marks the Spot", "https://www.youtube.com/watch?v=GhRgvEG5jxQ"), - // Members Quests - new Link("Druidic Ritual", "https://www.youtube.com/watch?v=QIfU6HSmH4w"), - new Link("Lost City", "https://www.youtube.com/watch?v=T-kQNUSjFZI"), - new Link("Witch's House", "https://www.youtube.com/watch?v=TLsg7Wa-LUA"), - new Link("Merlin's Crystal", "https://www.youtube.com/watch?v=ESX-qriNtCE"), - new Link("Heroes' Quest", "https://www.youtube.com/watch?v=hK2N0WLKviE"), - new Link("Scorpion Catcher", "https://www.youtube.com/watch?v=xpqdec7_ZWg"), - new Link("Family Crest", "https://www.youtube.com/watch?v=0mk_Cgjr738"), - new Link("Monk's Friend", "https://www.youtube.com/watch?v=avi4y4G3Hcw"), - new Link("Temple of Ikov", "https://www.youtube.com/watch?v=5K7jDgr_4Z4"), - new Link("Clock Tower", "https://www.youtube.com/watch?v=GUCkkQFzyDw"), - new Link("Holy Grail", "https://www.youtube.com/watch?v=cgXoV1QlYco"), - new Link("Tree Gnome Village", "https://www.youtube.com/watch?v=T6Su__yuyRI"), - new Link("Fight Arena", "https://www.youtube.com/watch?v=4Nqjep2E5pw"), - new Link("Hazeel Cult", "https://www.youtube.com/watch?v=2_fhFJW6cNY"), - new Link("Sheep Herder", "https://www.youtube.com/watch?v=akC9FeYCG1Q"), - new Link("Plague City", "https://www.youtube.com/watch?v=Hf2wQQZL5CU"), - new Link("Waterfall Quest", "https://www.youtube.com/watch?v=xWBSnGkQTi4"), - new Link("Jungle Potion", "https://www.youtube.com/watch?v=xqLKsFz08As"), - new Link("The Grand Tree", "https://www.youtube.com/watch?v=N5e_Jus_E-Y"), - new Link("Underground Pass", "https://www.youtube.com/watch?v=5klGJg1wY8k"), - new Link("Observatory Quest", "https://www.youtube.com/watch?v=yxa9B6svv44"), - new Link("Watchtower", "https://www.youtube.com/watch?v=Vb10GoYP7FE"), - new Link("Dwarf Cannon", "https://www.youtube.com/watch?v=pROFg5jcCR0"), - new Link("Murder Mystery", "https://www.youtube.com/watch?v=P1IDGCA2f9o"), - new Link("The Dig Site", "https://www.youtube.com/watch?v=TOdcWV4MzuU"), - new Link("Gertrude's Cat", "https://www.youtube.com/watch?v=g7S09wA8EAY"), - new Link("Legends' Quest", "https://www.youtube.com/watch?v=Lid8enDEF_U"), - new Link("Death Plateau", "https://www.youtube.com/watch?v=SIQFmTvnb6w"), - new Link("Big Chompy Bird Hunting", "https://www.youtube.com/watch?v=s2fytMOHJXI"), - new Link("Elemental Workshop I", "https://www.youtube.com/watch?v=tbZD2RDqvfQ"), - new Link("Nature Spirit", "https://www.youtube.com/watch?v=Enf8vUWb5o0"), - new Link("Priest in Peril", "https://www.youtube.com/watch?v=fyYri6wUQIU"), - new Link("Regicide", "https://www.youtube.com/watch?v=KkWM-ok3C4Y"), - new Link("Tai Bwo Wannai Trio", "https://www.youtube.com/watch?v=Mdair5mvZL0"), - new Link("Troll Stronghold", "https://www.youtube.com/watch?v=zqmUs-f3AKA"), - new Link("Horror from the Deep", "https://www.youtube.com/watch?v=9htK8kb6DR8"), - new Link("Throne of Miscellania", "https://www.youtube.com/watch?v=fzGMnv2skBE"), - new Link("Monkey Madness I", "https://www.youtube.com/watch?v=VnoRfeBnPFA"), - new Link("Haunted Mine", "https://www.youtube.com/watch?v=cIc6loJHm9Q"), - new Link("Troll Romance", "https://www.youtube.com/watch?v=j2zifZVu7Gc"), - new Link("In Search of the Myreque", "https://www.youtube.com/watch?v=5nmYFHdAXAQ"), - new Link("Creature of Fenkenstrain", "https://www.youtube.com/watch?v=swqUVIs7B7M"), - new Link("Roving Elves", "https://www.youtube.com/watch?v=J3qf9DnT9cA"), - new Link("One Small Favour", "https://www.youtube.com/watch?v=ix_0-W3e9ps"), - new Link("Mountain Daughter", "https://www.youtube.com/watch?v=HETx_LX7aiY"), - new Link("Between a Rock...", "https://www.youtube.com/watch?v=cB11I45EGgA"), - new Link("The Golem", "https://www.youtube.com/watch?v=qpEHpiO6lLw"), - new Link("Desert Treasure", "https://www.youtube.com/watch?v=BuIqulIsICo"), - new Link("Icthlarin's Little Helper", "https://www.youtube.com/watch?v=wpNKm8_vUOM"), - new Link("Tears of Guthix", "https://www.youtube.com/watch?v=EMonDNI0uPk"), - new Link("The Lost Tribe", "https://www.youtube.com/watch?v=spZErjRnCdc"), - new Link("The Giant Dwarf", "https://www.youtube.com/watch?v=Z7PsGpOYgxY"), - new Link("Recruitment Drive", "https://www.youtube.com/watch?v=sOuzMpA_xtw"), - new Link("Mourning's End Part I", "https://www.youtube.com/watch?v=vuzAdk-h3c0"), - new Link("Garden of Tranquillity", "https://www.youtube.com/watch?v=7hbCzYnLCsQ"), - new Link("A Tail of Two Cats", "https://www.youtube.com/watch?v=SgN9Yw_YqHk"), - new Link("Wanted!", "https://www.youtube.com/watch?v=ZHZAKDCfXGs"), - new Link("Mourning's End Part II", "https://www.youtube.com/watch?v=FK5sLogGbU8"), - new Link("Rum Deal", "https://www.youtube.com/watch?v=I14CIu5x2S8"), - new Link("Shadow of the Storm", "https://www.youtube.com/watch?v=5ZvWd3XCQjI"), - new Link("Ratcatchers", "https://www.youtube.com/watch?v=s7G22fEuhTc"), - new Link("Spirits of the Elid", "https://www.youtube.com/watch?v=A1zAX55hZC0"), - new Link("Devious Minds", "https://www.youtube.com/watch?v=_UtlFmrWt1w"), - new Link("Enakhra's Lament", "https://www.youtube.com/watch?v=Y3kEIPYVaVE"), - new Link("Cabin Fever", "https://www.youtube.com/watch?v=k5DtxNXhOaw"), - new Link("Fairytale I - Growing Pains", "https://www.youtube.com/watch?v=cfGI9qFOmsg"), - new Link("Recipe for Disaster", "https://www.youtube.com/watch?v=hrAyyInJaTA"), - new Link("In Aid of the Myreque", "https://www.youtube.com/watch?v=O2Ru2NmuTaA"), - new Link("A Soul's Bane", "https://www.youtube.com/watch?v=dp8dp79qp6I"), - new Link("Rag and Bone Man", "https://www.youtube.com/watch?v=3owXSeN56W8"), - new Link("Swan Song", "https://www.youtube.com/watch?v=IpmERThXv2g"), - new Link("Royal Trouble", "https://www.youtube.com/watch?v=bVWUlKzNXEg"), - new Link("Death to the Dorgeshuun", "https://www.youtube.com/watch?v=2XJHuLhig98"), - new Link("Fairytale II - Cure a Queen", "https://www.youtube.com/watch?v=P6KkRk4_e3U"), - new Link("Lunar Diplomacy", "https://www.youtube.com/watch?v=vmeSKb7IBgQ"), - new Link("The Eyes of Glouphrie", "https://www.youtube.com/watch?v=0YCPwmZcxKA"), - new Link("Darkness of Hallowvale", "https://www.youtube.com/watch?v=QziKl99qdtU"), - new Link("Elemental Workshop II", "https://www.youtube.com/watch?v=Bb4E7ecIgv0"), - new Link("My Arm's Big Adventure", "https://www.youtube.com/watch?v=xa1KWOewgYA"), - new Link("Enlightened Journey", "https://www.youtube.com/watch?v=XAPthC8d7k0"), - new Link("Eagles' Peak", "https://www.youtube.com/watch?v=KDxIrrwXp7U"), - new Link("Animal Magnetism", "https://www.youtube.com/watch?v=_JldgJTnc7I"), - new Link("Contact!", "https://www.youtube.com/watch?v=czn-yWABBWs"), - new Link("Cold War", "https://www.youtube.com/watch?v=0m1KpP-qKWI"), - new Link("The Fremennik Isles", "https://www.youtube.com/watch?v=EvxhiOWmraY"), - new Link("The Great Brain Robbery", "https://www.youtube.com/watch?v=ImHFASuNUN8"), - new Link("What Lies Below", "https://www.youtube.com/watch?v=f_9nVMGTtuo"), - new Link("Olaf's Quest", "https://www.youtube.com/watch?v=mXV5bM1NFMM"), - new Link("Dream Mentor", "https://www.youtube.com/watch?v=XDLUu0Kf0sE"), - new Link("Grim Tales", "https://www.youtube.com/watch?v=dFB0Q6v8Apw"), - new Link("King's Ransom", "https://www.youtube.com/watch?v=UJz9ZfF3uCY"), - new Link("Shilo Village", "https://www.youtube.com/watch?v=bDvBi8FT-QI"), - new Link("Biohazard", "https://www.youtube.com/watch?v=n9k87LwOGMk"), - new Link("Tower of Life", "https://www.youtube.com/watch?v=KReMcWpeY3k"), - new Link("Rag and Bone Man II", "https://www.youtube.com/watch?v=KGdHiDDUX_U"), - new Link("Zogre Flesh Eaters", "https://www.youtube.com/watch?v=vzm4949kXP4"), - new Link("Monkey Madness II", "https://www.youtube.com/watch?v=ykE5LbjABaI"), - new Link("Client of Kourend", "https://www.youtube.com/watch?v=Y-KIHF-cL9w"), - new Link("The Queen of Thieves", "https://www.youtube.com/watch?v=W94zFZVrHkQ"), - new Link("Bone Voyage", "https://www.youtube.com/watch?v=-VTR4p8kPmI"), - new Link("Dragon Slayer II", "https://www.youtube.com/watch?v=4BMb3Zwzk_U"), - new Link("The Depths of Despair", "https://www.youtube.com/watch?v=CaVUk2eAsKs"), - new Link("A Taste of Hope", "https://www.youtube.com/watch?v=VjdgEIizdSc"), - new Link("Tale of the Righteous", "https://www.youtube.com/watch?v=99yiv0tPl58"), - new Link("Making Friends with My Arm", "https://www.youtube.com/watch?v=DltzzhIsM_Q"), - new Link("The Ascent of Arceuus", "https://www.youtube.com/watch?v=4VQnfrv6S18"), - new Link("The Forsaken Tower", "https://www.youtube.com/watch?v=con0sXl5NBY"), - new Link("Fishing Contest", "https://www.youtube.com/watch?v=XYSv37A_l5w"), - new Link("Tribal Totem", "https://www.youtube.com/watch?v=XkUEIjr886M"), - new Link("Sea Slug", "https://www.youtube.com/watch?v=oOZVfa5SkVQ"), - new Link("The Tourist Trap", "https://www.youtube.com/watch?v=0bmSCCepMvo"), - new Link("Eadgar's Ruse", "https://www.youtube.com/watch?v=aVQ3DjTElXg"), - new Link("Shades of Mort'ton", "https://www.youtube.com/watch?v=eF05R8OMxgg"), - new Link("The Fremennik Trials", "https://www.youtube.com/watch?v=YUIvEgcvl5c"), - new Link("Ghosts Ahoy", "https://www.youtube.com/watch?v=aNBkLOywDfM"), - new Link("The Feud", "https://www.youtube.com/watch?v=nlBSc9IUklA"), - new Link("Forgettable Tale...", "https://www.youtube.com/watch?v=3HvFd6AxNU0"), - new Link("Making History", "https://www.youtube.com/watch?v=bOTGi2zAuhs"), - new Link("The Hand in the Sand", "https://www.youtube.com/watch?v=gdNLcZ-l1Lw"), - new Link("The Slug Menace", "https://www.youtube.com/watch?v=BRQbdr3JEZ8"), - new Link("Another Slice of H.A.M.", "https://www.youtube.com/watch?v=Yq3db7827Lk"), - new Link("Song of the Elves", "https://www.youtube.com/watch?v=oMGvdBCuxoY"), - new Link("The Fremennik Exiles", "https://www.youtube.com/watch?v=1Vz2rXYhi4E"), - //Miniquests - new Link("Alfred Grimhand's Barcrawl", "https://www.youtube.com/watch?v=hE2dmiDaoK4"), - new Link("Bear your Soul", "https://www.youtube.com/watch?v=Pb6N-_6HJNc"), - new Link("Curse of the Empty Lord", "https://www.youtube.com/watch?v=efv9mlHdeK0"), - new Link("Enter the Abyss", "https://www.youtube.com/watch?v=0rDADV0GKN8"), - new Link("Family Pest", "https://www.youtube.com/watch?v=Iie2_Si8iDg"), - new Link("The General's Shadow", "https://www.youtube.com/watch?v=4bIYZpRvewA"), - new Link("Lair of Tarn Razorlor", "https://www.youtube.com/watch?v=rEhSkhviK5E"), - new Link("The Mage Arena", "https://www.youtube.com/watch?v=UyncI4hgmtY"), - new Link("Skippy and the Mogres", "https://www.youtube.com/watch?v=cU0H6QVXcG0") - }; - - private static class Link - { - - private final String questName; - private final String url; - - Link(String questName, String url) - { - this.questName = questName; - this.url = url; - } - - String getQuestName() - { - return questName; - } - - void openURL() - { - LinkBrowser.browse(this.url); - } - - } - - private static boolean openGuide(String questName) - { - for (Link link : QUEST_GUIDE_LINKS) - { - if (link.getQuestName().equals(questName)) - { - link.openURL(); - return true; - } - } - return false; - } - - private static void logQuestNotFoundError(String questName, ChatMessageManager chatMessageManager) - { - String chatMessage = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append("Could not find Slayermusiq1 guide for " + questName) - .build(); - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.GAMEMESSAGE) - .runeLiteFormattedMessage(chatMessage) - .build()); - } - - static void tryOpenGuide(String questName, ChatMessageManager chatMessageManager) - { - boolean success = openGuide(questName); - if (!success) - { - logQuestNotFoundError(questName, chatMessageManager); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayermusiq/SlayermusiqPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayermusiq/SlayermusiqPlugin.java deleted file mode 100644 index f6b89039df..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayermusiq/SlayermusiqPlugin.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2018, Jeremy Berchtold - * 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. - */ - - -// Based off RuneLite's Wiki Plugin -/* - * 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.slayermusiq; - -import com.google.common.primitives.Ints; -import java.util.Arrays; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.MenuEntry; -import net.runelite.api.MenuOpcode; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.chat.ChatMessageManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Slayermusiq1 Guides", - description = "Adds a right-click option to go to Slayermusiq1's guides from the quest tab", - tags = {"quest", "guide", "slayermusiq"}, - type = PluginType.MISCELLANEOUS, - enabledByDefault = false -) -@Singleton -@Slf4j -public class SlayermusiqPlugin extends Plugin -{ - - private static final int[] QUESTLIST_WIDGET_IDS = new int[] - { - WidgetInfo.QUESTLIST_FREE_CONTAINER.getId(), - WidgetInfo.QUESTLIST_MEMBERS_CONTAINER.getId(), - WidgetInfo.QUESTLIST_MINIQUEST_CONTAINER.getId(), - }; - - private static final String MENUOP_SLAYERMUSIQ = "Slayermusiq"; - - @Inject - private Client client; - - @Inject - private ChatMessageManager chatMessageManager; - - @Subscribe - private void onMenuEntryAdded(MenuEntryAdded event) - { - int widgetID = event.getParam1(); - if (Ints.contains(QUESTLIST_WIDGET_IDS, widgetID) && "Read Journal:".equals(event.getOption())) - { - MenuEntry[] menuEntries = client.getMenuEntries(); - - MenuEntry newMenuEntry = createSlayermusiqOptionMenuEntry(event); - menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1); - menuEntries[menuEntries.length - 1] = newMenuEntry; - - client.setMenuEntries(menuEntries); - } - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked ev) - { - if (ev.getMenuOpcode() == MenuOpcode.RUNELITE && ev.getOption().equals(MENUOP_SLAYERMUSIQ)) - { - ev.consume(); - String quest = Text.removeTags(ev.getTarget()); - QuestGuideLinks.tryOpenGuide(quest, chatMessageManager); - } - } - - private MenuEntry createSlayermusiqOptionMenuEntry(MenuEntryAdded event) - { - int widgetIndex = event.getParam0(); - int widgetID = event.getParam1(); - - MenuEntry menuEntry = new MenuEntry(); - menuEntry.setTarget(event.getTarget()); - menuEntry.setOption(MENUOP_SLAYERMUSIQ); - menuEntry.setParam0(widgetIndex); - menuEntry.setParam1(widgetID); - menuEntry.setOpcode(MenuOpcode.RUNELITE.getId()); - - return menuEntry; - } - -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/smelting/SmeltingConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/smelting/SmeltingConfig.java deleted file mode 100644 index 9671f29e1a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/smelting/SmeltingConfig.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2019, Stephen - * 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.smelting; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("smelting") -public interface SmeltingConfig extends Config -{ - @ConfigItem( - position = 1, - keyName = "statTimeout", - name = "Reset stats (minutes)", - description = "The time it takes for the current smelting session to be reset" - ) - default int statTimeout() - { - return 5; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/smelting/SmeltingOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/smelting/SmeltingOverlay.java deleted file mode 100644 index 7686af235d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/smelting/SmeltingOverlay.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2019, Stephen - * 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.smelting; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.time.Duration; -import java.time.Instant; -import javax.inject.Inject; -import javax.inject.Singleton; -import static net.runelite.api.AnimationID.SMITHING_CANNONBALL; -import static net.runelite.api.AnimationID.SMITHING_SMELTING; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.Skill; -import net.runelite.client.plugins.xptracker.XpTrackerService; -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.TableAlignment; -import net.runelite.client.ui.overlay.components.table.TableComponent; - -@Singleton -class SmeltingOverlay extends Overlay -{ - private static final int SMELT_TIMEOUT = 7; - static final String SMELTING_RESET = "Reset"; - - private final Client client; - private final SmeltingPlugin plugin; - private final XpTrackerService xpTrackerService; - - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - SmeltingOverlay(final Client client, final SmeltingPlugin plugin, final XpTrackerService xpTrackerService) - { - super(plugin); - this.client = client; - this.plugin = plugin; - this.xpTrackerService = xpTrackerService; - setPosition(OverlayPosition.TOP_LEFT); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Smelting overlay")); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY, SMELTING_RESET, "Smelting overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - SmeltingSession session = plugin.getSession(); - if (session == null) - { - return null; - } - - panelComponent.getChildren().clear(); - - if (isSmelting() || Duration.between(session.getLastItemSmelted(), Instant.now()).getSeconds() < SMELT_TIMEOUT) - { - panelComponent.getChildren().add(TitleComponent.builder() - .text("Smelting") - .color(Color.GREEN) - .build()); - } - else - { - panelComponent.getChildren().add(TitleComponent.builder() - .text("NOT smelting") - .color(Color.RED) - .build()); - } - - int actions = xpTrackerService.getActions(Skill.SMITHING); - if (actions > 0) - { - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - if (plugin.getSession().getBarsSmelted() > 0) - { - tableComponent.addRow("Bars:", Integer.toString(session.getBarsSmelted())); - } - if (plugin.getSession().getCannonBallsSmelted() > 0) - { - tableComponent.addRow("Cannonballs:", Integer.toString(session.getCannonBallsSmelted())); - } - if (actions > 2) - { - tableComponent.addRow("Actions/hr:", Integer.toString(xpTrackerService.getActionsHr(Skill.SMITHING))); - } - - panelComponent.getChildren().add(tableComponent); - } - - return panelComponent.render(graphics); - - } - - private boolean isSmelting() - { - switch (client.getLocalPlayer().getAnimation()) - { - case SMITHING_SMELTING: - case SMITHING_CANNONBALL: - return true; - default: - return false; - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/smelting/SmeltingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/smelting/SmeltingPlugin.java deleted file mode 100644 index a2ef5cf6ff..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/smelting/SmeltingPlugin.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2019, Stephen - * 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.smelting; - -import com.google.inject.Provides; -import java.time.Duration; -import java.time.Instant; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ChatMessageType; -import net.runelite.api.MenuOpcode; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameTick; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.events.OverlayMenuClicked; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDependency; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.xptracker.XpTrackerPlugin; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.ui.overlay.OverlayMenuEntry; - -@PluginDescriptor( - name = "Smelting", - description = "Show Smelting stats", - tags = {"overlay", "skilling"}, - type = PluginType.SKILLING -) -@Singleton -@PluginDependency(XpTrackerPlugin.class) -public class SmeltingPlugin extends Plugin -{ - @Inject - private SmeltingConfig config; - - @Inject - private SmeltingOverlay overlay; - - @Inject - private OverlayManager overlayManager; - - @Getter(AccessLevel.PACKAGE) - private SmeltingSession session; - - private int statTimeout; - - @Provides - SmeltingConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(SmeltingConfig.class); - } - - @Override - protected void startUp() - { - - this.statTimeout = config.statTimeout(); - session = null; - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - session = null; - } - - @Subscribe - public void onOverlayMenuClicked(OverlayMenuClicked overlayMenuClicked) - { - OverlayMenuEntry overlayMenuEntry = overlayMenuClicked.getEntry(); - if (overlayMenuEntry.getMenuOpcode() == MenuOpcode.RUNELITE_OVERLAY - && overlayMenuClicked.getEntry().getOption().equals(SmeltingOverlay.SMELTING_RESET) - && overlayMenuClicked.getOverlay() == overlay) - { - session = null; - } - } - - @Subscribe - void onChatMessage(ChatMessage event) - { - if (event.getType() != ChatMessageType.SPAM) - { - return; - } - - if (event.getMessage().startsWith("You retrieve a bar of")) - { - if (session == null) - { - session = new SmeltingSession(); - } - session.increaseBarsSmelted(); - } - else if (event.getMessage().startsWith("You remove the cannonballs from the mould")) - { - if (session == null) - { - session = new SmeltingSession(); - } - session.increaseCannonBallsSmelted(); - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - if (session != null) - { - final Duration statTimeout = Duration.ofMinutes(this.statTimeout); - final Duration sinceCaught = Duration.between(session.getLastItemSmelted(), Instant.now()); - - if (sinceCaught.compareTo(statTimeout) >= 0) - { - session = null; - } - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("smelting")) - { - return; - } - - this.statTimeout = config.statTimeout(); - } -} - diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/smelting/SmeltingSession.java b/runelite-client/src/main/java/net/runelite/client/plugins/smelting/SmeltingSession.java deleted file mode 100644 index b49cfff6c0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/smelting/SmeltingSession.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2019, Stephen - * 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.smelting; - -import java.time.Instant; -import lombok.AccessLevel; -import lombok.Getter; - -class SmeltingSession -{ - @Getter(AccessLevel.PACKAGE) - private int barsSmelted; - - @Getter(AccessLevel.PACKAGE) - private int cannonBallsSmelted; - - @Getter(AccessLevel.PACKAGE) - private Instant lastItemSmelted; - - void increaseBarsSmelted() - { - barsSmelted++; - lastItemSmelted = Instant.now(); - } - - void increaseCannonBallsSmelted() - { - cannonBallsSmelted += 4; - lastItemSmelted = Instant.now(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/sounds/SoundsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/sounds/SoundsPlugin.java deleted file mode 100644 index 248d6a056e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/sounds/SoundsPlugin.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2017, 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.sounds; - -import java.io.IOException; -import java.util.HashMap; -import javax.inject.Inject; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.events.SoundEffectPlayed; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.http.api.sounds.SoundsClient; -import org.apache.commons.lang3.ArrayUtils; - -@PluginDescriptor( - name = "Sounds", - hidden = true -) -@Slf4j -public class SoundsPlugin extends Plugin -{ - private final SoundsClient soundsClient = new SoundsClient(); - - private HashMap sounds; - @Inject - private Client client; - - { - try - { - sounds = soundsClient.get(); - } - catch (IOException e) - { - e.printStackTrace(); - } - } - - @Subscribe - private void onSoundEffectPlayed(SoundEffectPlayed event) - { - if (event.getNpcid() != -1) - { - if (ArrayUtils.contains(sounds.get(event.getNpcid()), event.getSoundId())) - { - return; - } - int[] newSounds = ArrayUtils.add(sounds.get(event.getNpcid()), event.getSoundId()); - sounds.put(event.getNpcid(), newSounds); - soundsClient.submit(event.getNpcid(), event.getSoundId()); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/spawntimer/SpawnTimerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/spawntimer/SpawnTimerConfig.java deleted file mode 100644 index 52f8330b8c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/spawntimer/SpawnTimerConfig.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.runelite.client.plugins.spawntimer; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("spawntimer") -public interface SpawnTimerConfig extends Config -{ - @ConfigItem( - position = 1, - keyName = "npcToHighlight", - name = "NPCs to show timer for", - description = "List of NPC names to show timer for" - ) - default String getNpcToHighlight() - { - return ""; - } - - @ConfigItem( - position = 2, - keyName = "npcColor", - name = "Text Color", - description = "Color of the NPC timer" - ) - default Color getHighlightColor() - { - return Color.RED; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/spawntimer/SpawnTimerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/spawntimer/SpawnTimerOverlay.java deleted file mode 100644 index fe00ea22af..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/spawntimer/SpawnTimerOverlay.java +++ /dev/null @@ -1,71 +0,0 @@ -package net.runelite.client.plugins.spawntimer; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -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.OverlayUtil; -import net.runelite.client.util.WildcardMatcher; - -@Singleton -public class SpawnTimerOverlay extends Overlay -{ - private final SpawnTimerPlugin plugin; - - @Inject - SpawnTimerOverlay(final SpawnTimerPlugin plugin) - { - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D graphics) - { - List highlights = plugin.getHighlights(); - for (thing npc : plugin.getTicks()) - { - if (npc == null) - { - continue; - } - if (npc.getNpc() == null) - { - continue; - } - if (npc.getNpc().getName() == null) - { - continue; - } - for (String highlight : highlights) - { - - if (WildcardMatcher.matches(highlight, npc.getNpc().getName())) - { - int tick = plugin.getCurrentTick() - npc.getTick(); - String tickString = "" + tick; - renderNpcOverlay(graphics, npc.getNpc(), tickString, plugin.getGetHighlightColor()); - } - } - } - return null; - } - - private void renderNpcOverlay(Graphics2D graphics, NPC actor, String name, Color color) - { - Point textLocation = actor.getCanvasTextLocation(graphics, name, actor.getLogicalHeight() - 40); - - if (textLocation != null) - { - OverlayUtil.renderTextLocation(graphics, textLocation, name, color); - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/spawntimer/SpawnTimerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/spawntimer/SpawnTimerPlugin.java deleted file mode 100644 index 6f76c0cef9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/spawntimer/SpawnTimerPlugin.java +++ /dev/null @@ -1,154 +0,0 @@ -package net.runelite.client.plugins.spawntimer; - -import com.google.common.annotations.VisibleForTesting; -import com.google.inject.Provides; -import java.awt.Color; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.GameState; -import net.runelite.api.NPC; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.util.Text; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "Spawn Timer", - description = "Shows NPC'S time since spawned", - tags = {"highlight", "minimap", "npcs", "overlay", "spawn", "tags", "lyzrd"}, - type = PluginType.PVM, - enabledByDefault = false -) -@Singleton -public class SpawnTimerPlugin extends Plugin -{ - @Inject - private OverlayManager overlayManager; - - @Getter(AccessLevel.PACKAGE) - private final Set highlightedNpcs = new HashSet<>(); - - @Getter(AccessLevel.PACKAGE) - Set ticks = new HashSet<>(); - - @Inject - private SpawnTimerOverlay SpawnTimerOverlay; - - @Inject - private SpawnTimerConfig config; - - @Provides - SpawnTimerConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(SpawnTimerConfig.class); - } - - @Getter(AccessLevel.PACKAGE) - public int currentTick; - - private String getNpcToHighlight; - @Getter(AccessLevel.PACKAGE) - private Color getHighlightColor; - - @Override - protected void startUp() - { - - this.getNpcToHighlight = config.getNpcToHighlight(); - this.getHighlightColor = config.getHighlightColor(); - - currentTick = 0; - overlayManager.add(SpawnTimerOverlay); - } - - - @Override - protected void shutDown() - { - ticks.clear(); - highlightedNpcs.clear(); - overlayManager.remove(SpawnTimerOverlay); - } - - @Subscribe - private void onGameTick(GameTick g) - { - currentTick++; - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGIN_SCREEN || - event.getGameState() == GameState.HOPPING) - { - highlightedNpcs.clear(); - ticks.clear(); - } - } - - @Subscribe - private void onNpcSpawned(NpcSpawned n) - { - if (n.getNpc() != null) - { - final NPC npc = n.getNpc(); - highlightedNpcs.add(npc); - thing temp = new thing(); - temp.setNpc(npc); - temp.setTick(currentTick); - ticks.add(temp); - } - } - - @Subscribe - private void onNpcDespawned(NpcDespawned n) - { - final NPC npc = n.getNpc(); - if (highlightedNpcs.contains(npc)) - { - highlightedNpcs.remove(npc); - //currentTick = 0; - ticks.removeIf(t -> t.getNpc() == npc); - } - } - - @VisibleForTesting - public List getHighlights() - { - final String configNpcs = this.getNpcToHighlight.toLowerCase(); - - if (configNpcs.isEmpty()) - { - return Collections.emptyList(); - } - - return Text.fromCSV(configNpcs); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("spawntimer")) - { - return; - } - - this.getNpcToHighlight = config.getNpcToHighlight(); - this.getHighlightColor = config.getHighlightColor(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/spawntimer/thing.java b/runelite-client/src/main/java/net/runelite/client/plugins/spawntimer/thing.java deleted file mode 100644 index ba549b479c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/spawntimer/thing.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.runelite.client.plugins.spawntimer; - -import net.runelite.api.NPC; - -class thing -{ - private NPC npc; - private int tick; - - public void setNpc(NPC n) - { - npc = n; - } - - NPC getNpc() - { - return npc; - } - - public void setTick(int n) - { - tick = n; - } - - int getTick() - { - return tick; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/specbar/SpecBarPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/specbar/SpecBarPlugin.java deleted file mode 100644 index 2e4009407e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/specbar/SpecBarPlugin.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2019, Lucas - * 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.specbar; - -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Spec Bar", - description = "Adds a spec bar to every weapon", - tags = {"spec bar", "special attack", "spec", "bar", "pklite"}, - type = PluginType.PVP, - enabledByDefault = false -) -@Singleton -public class SpecBarPlugin extends Plugin -{ - - @Inject - private Client client; - - @Subscribe - private void onScriptCallbackEvent(ScriptCallbackEvent event) - { - if (!"drawSpecbarAnyway".equals(event.getEventName())) - { - return; - } - - int[] iStack = client.getIntStack(); - int iStackSize = client.getIntStackSize(); - iStack[iStackSize - 1] = 1; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/Boss.java b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/Boss.java deleted file mode 100644 index 347e349b18..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/Boss.java +++ /dev/null @@ -1,82 +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.specialcounter; - -import com.google.common.collect.Sets; -import java.util.Set; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.ToString; -import net.runelite.api.NpcID; - -@Getter(AccessLevel.PACKAGE) -@ToString -enum Boss -{ - ABYSSAL_SIRE(1.25d, 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.225d, NpcID.CALLISTO, NpcID.CALLISTO_6609), - CERBERUS(1.15d, NpcID.CERBERUS, NpcID.CERBERUS_5863, NpcID.CERBERUS_5866), - CHAOS_ELEMENTAL(1.075d, NpcID.CHAOS_ELEMENTAL, NpcID.CHAOS_ELEMENTAL_6505), - CORPOREAL_BEAST(1.55d, NpcID.CORPOREAL_BEAST), - GENERAL_GRAARDOR(1.325d, NpcID.GENERAL_GRAARDOR, NpcID.GENERAL_GRAARDOR_6494), - GIANT_MOLE(1.075d, NpcID.GIANT_MOLE, NpcID.GIANT_MOLE_6499), - KALPHITE_QUEEN(1.05d, 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.075d, NpcID.KING_BLACK_DRAGON, NpcID.KING_BLACK_DRAGON_2642, NpcID.KING_BLACK_DRAGON_6502), - KRIL_TSUROTH(1.375d, NpcID.KRIL_TSUTSAROTH, NpcID.KRIL_TSUTSAROTH_6495), - VENETENATIS(1.4d, NpcID.VENENATIS, NpcID.VENENATIS_6610), - VETION(1.225d, NpcID.VETION, NpcID.VETION_REBORN), - SOTETSEG_5_MAN(1.675d, NpcID.SOTETSEG_8388), - SOTETSEG_4_MAN(1.60d, NpcID.SOTETSEG_8388), - SOTETSEG_3_MAN(1.525d, NpcID.SOTETSEG_8388), - NYLOCAS_VASILIAS_5_MAN(1.2250d, NpcID.NYLOCAS_VASILIAS, NpcID.NYLOCAS_VASILIAS_8355, NpcID.NYLOCAS_VASILIAS_8356, NpcID.NYLOCAS_VASILIAS_8357), - NYLOCAS_VASILIAS_4_MAN(1.20d, NpcID.NYLOCAS_VASILIAS, NpcID.NYLOCAS_VASILIAS_8355, NpcID.NYLOCAS_VASILIAS_8356, NpcID.NYLOCAS_VASILIAS_8357), - NYLOCAS_VASILIAS_3_MAN(1.175d, NpcID.NYLOCAS_VASILIAS, NpcID.NYLOCAS_VASILIAS_8355, NpcID.NYLOCAS_VASILIAS_8356, NpcID.NYLOCAS_VASILIAS_8357), - PESTILENT_BLOAT_5_MAN(1.85d, NpcID.PESTILENT_BLOAT), - PESTILENT_BLOAT_4_MAN(1.7750d, NpcID.PESTILENT_BLOAT), - PESTILENT_BLOAT_3_MAN(1.70d, NpcID.PESTILENT_BLOAT); - - private final Set ids; - private final double modifier; // Some NPCs have a modifier to the experience a player receives. - - Boss(double modifier, Integer... ids) - { - this.modifier = modifier; - this.ids = Sets.newHashSet(ids); - } - - static Boss getBoss(int id) - { - for (Boss boss : values()) - { - if (boss.ids.contains(id)) - { - return boss; - } - } - - return null; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounter.java deleted file mode 100644 index 03e2b9329a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounter.java +++ /dev/null @@ -1,93 +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.specialcounter; - -import java.awt.image.BufferedImage; -import java.util.HashMap; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.ui.overlay.infobox.Counter; - -class SpecialCounter extends Counter -{ - private final SpecialWeapon weapon; - @Getter(AccessLevel.PACKAGE) - private final Map partySpecs = new HashMap<>(); - - SpecialCounter(final BufferedImage image, final SpecialCounterPlugin plugin, final int hitValue, final SpecialWeapon weapon) - { - super(image, plugin, hitValue); - this.weapon = weapon; - } - - void addHits(double hit) - { - int count = getCount(); - setCount(count + (int) hit); - } - - @Override - public String getTooltip() - { - int hitValue = getCount(); - - if (partySpecs.isEmpty()) - { - return buildTooltip(hitValue); - } - - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(buildTooltip(hitValue)); - - for (Map.Entry entry : partySpecs.entrySet()) - { - stringBuilder.append("
") - .append(entry.getKey() == null ? "You" : entry.getKey()).append(": ") - .append(buildTooltip(entry.getValue())); - } - - return stringBuilder.toString(); - } - - private String buildTooltip(int hitValue) - { - if (!weapon.isDamage()) - { - if (hitValue == 1) - { - return weapon.getName() + " special has hit " + hitValue + " time."; - } - else - { - return weapon.getName() + " special has hit " + hitValue + " times."; - } - } - else - { - return weapon.getName() + " special has hit " + hitValue + " total."; - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterPlugin.java deleted file mode 100644 index 44303cf512..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterPlugin.java +++ /dev/null @@ -1,435 +0,0 @@ -/* - * Copyright (c) 2018, Raqes - * Copyright (c) 2018, https://openosrs.com - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.specialcounter; - -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Actor; -import net.runelite.api.Client; -import net.runelite.api.EquipmentInventorySlot; -import net.runelite.api.GameState; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.NPC; -import net.runelite.api.NPCDefinition; -import net.runelite.api.Player; -import net.runelite.api.Skill; -import net.runelite.api.VarPlayer; -import net.runelite.api.events.FakeXpDrop; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.StatChanged; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.api.widgets.Widget; -import net.runelite.client.callback.ClientThread; -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.plugins.PluginType; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; -import net.runelite.client.ws.PartyService; -import net.runelite.client.ws.WSClient; -import org.apache.commons.lang3.ArrayUtils; -import lombok.extern.slf4j.Slf4j; - -@PluginDescriptor( - name = "Special Attack Counter", - description = "Track DWH, Arclight, Darklight, and BGS special attacks used on NPCs", - tags = {"combat", "npcs", "overlay"}, - enabledByDefault = false, - type = PluginType.UTILITY -) -@Singleton -@Slf4j -public class SpecialCounterPlugin extends Plugin -{ - private int currentWorld = -1; - private int specialPercentage = -1; - private int specialHitpointsExperience = -1; - private int specialHitpointsGained = -1; - private boolean specialUsed; - private double modifier = 1d; - - private SpecialWeapon specialWeapon; - private final Set interactedNpcIds = new HashSet<>(); - private final SpecialCounter[] specialCounter = new SpecialCounter[SpecialWeapon.values().length]; - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private WSClient wsClient; - - @Inject - private PartyService party; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private ItemManager itemManager; - - @Override - protected void startUp() - { - - wsClient.registerMessage(SpecialCounterUpdate.class); - } - - @Override - protected void shutDown() - { - removeCounters(); - wsClient.unregisterMessage(SpecialCounterUpdate.class); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGGED_IN) - { - if (currentWorld == -1) - { - currentWorld = client.getWorld(); - } - else if (currentWorld != client.getWorld()) - { - currentWorld = client.getWorld(); - removeCounters(); - } - } - } - - @Subscribe - private void onVarbitChanged(VarbitChanged event) - { - int specialPercentage = client.getVar(VarPlayer.SPECIAL_ATTACK_PERCENT); - - if (this.specialPercentage == -1 || specialPercentage >= this.specialPercentage) - { - this.specialPercentage = specialPercentage; - return; - } - - this.specialPercentage = specialPercentage; - this.specialWeapon = usedSpecialWeapon(); - - checkInteracting(); - - specialUsed = true; - specialHitpointsExperience = client.getSkillExperience(Skill.HITPOINTS); - specialHitpointsGained = -1; - } - - @Subscribe - private void onStatChanged(StatChanged statChanged) - { - if (specialUsed && statChanged.getSkill() == Skill.HITPOINTS) - { - specialHitpointsGained = statChanged.getXp() - specialHitpointsExperience; - } - } - - @Subscribe - private void onFakeXpDrop(FakeXpDrop fakeXpDrop) - { - if (specialUsed && fakeXpDrop.getSkill() == Skill.HITPOINTS) - { - specialHitpointsGained = fakeXpDrop.getXp(); - } - } - - @Subscribe - private void onGameTick(GameTick tick) - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - int interactingId = checkInteracting(); - if (interactingId > -1 && specialUsed) - { - int deltaExperience = specialHitpointsGained; - - specialUsed = false; - - if (deltaExperience > 0 && specialWeapon != null) - { - int hit = getHit(specialWeapon, deltaExperience); - - updateCounter(specialWeapon, null, hit); - - if (!party.getMembers().isEmpty()) - { - final SpecialCounterUpdate specialCounterUpdate = new SpecialCounterUpdate(interactingId, specialWeapon, hit); - specialCounterUpdate.setMemberId(party.getLocalMember().getMemberId()); - wsClient.send(specialCounterUpdate); - } - } - } - } - - private int checkInteracting() - { - Player localPlayer = client.getLocalPlayer(); - Actor interacting = localPlayer.getInteracting(); - - if (interacting instanceof NPC) - { - NPC npc = (NPC) interacting; - NPCDefinition composition = npc.getDefinition(); - int interactingId = npc.getId(); - - if (!ArrayUtils.contains(composition.getActions(), "Attack")) - { - // Skip over non attackable npcs so that eg. talking to bankers doesn't reset - // the counters. - return -1; - } - - if (!interactedNpcIds.contains(interactingId)) - { - removeCounters(); - addInteracting(interactingId); - } - - return interactingId; - } - - return -1; - } - - private void addInteracting(int npcId) - { - modifier = 1d; - interactedNpcIds.add(npcId); - - if (client.getWidget(WidgetInfo.THEATRE_OF_BLOOD_PARTY) != null) - { - Boss boss = Boss.getBoss(npcId); - if (boss != null) - { - int teamSize = 0; - Widget x = client.getWidget(WidgetInfo.THEATRE_OF_BLOOD_PARTY); - for (Widget y : x.getStaticChildren()) - { - if (!y.isHidden()) - { - teamSize++; - } - } - if (boss == Boss.SOTETSEG_5_MAN) - { - if (teamSize > 0 && teamSize <= 3) - { - boss = Boss.SOTETSEG_3_MAN; - } - else if (teamSize == 4) - { - boss = Boss.SOTETSEG_4_MAN; - } - - } - if (boss == Boss.NYLOCAS_VASILIAS_5_MAN) - { - if (teamSize > 0 && teamSize <= 3) - { - boss = Boss.NYLOCAS_VASILIAS_3_MAN; - } - else if (teamSize == 4) - { - boss = Boss.NYLOCAS_VASILIAS_4_MAN; - } - - } - if (boss == Boss.PESTILENT_BLOAT_5_MAN) - { - if (teamSize > 0 && teamSize <= 3) - { - boss = Boss.PESTILENT_BLOAT_3_MAN; - } - else if (teamSize == 4) - { - boss = Boss.PESTILENT_BLOAT_4_MAN; - } - - } - modifier = boss.getModifier(); - interactedNpcIds.addAll(boss.getIds()); - } - return; - } - // Add alternate forms of bosses - final Boss boss = Boss.getBoss(npcId); - if (boss != null) - { - modifier = boss.getModifier(); - interactedNpcIds.addAll(boss.getIds()); - } - } - - @Subscribe - private void onNpcDespawned(NpcDespawned npcDespawned) - { - NPC actor = npcDespawned.getNpc(); - - if (actor.isDead() && interactedNpcIds.contains(actor.getId())) - { - removeCounters(); - } - } - - @Subscribe - private void onSpecialCounterUpdate(SpecialCounterUpdate event) - { - if (party.getLocalMember().getMemberId().equals(event.getMemberId())) - { - return; - } - - String name = party.getMemberById(event.getMemberId()).getName(); - if (name == null) - { - return; - } - - clientThread.invoke(() -> - { - // If not interacting with any npcs currently, add to interacting list - if (interactedNpcIds.isEmpty()) - { - addInteracting(event.getNpcId()); - } - - // Otherwise we only add the count if it is against a npc we are already tracking - if (interactedNpcIds.contains(event.getNpcId())) - { - updateCounter(event.getWeapon(), name, event.getHit()); - } - }); - } - - private SpecialWeapon usedSpecialWeapon() - { - ItemContainer equipment = client.getItemContainer(InventoryID.EQUIPMENT); - if (equipment == null) - { - return null; - } - - Item[] items = equipment.getItems(); - int weaponIdx = EquipmentInventorySlot.WEAPON.getSlotIdx(); - - if (items == null || weaponIdx >= items.length) - { - return null; - } - - Item weapon = items[weaponIdx]; - - for (SpecialWeapon specialWeapon : SpecialWeapon.values()) - { - if (specialWeapon.getItemID() == weapon.getId()) - { - return specialWeapon; - } - } - return null; - } - - private void updateCounter(SpecialWeapon specialWeapon, String name, int hit) - { - SpecialCounter counter = specialCounter[specialWeapon.ordinal()]; - - if (counter == null) - { - counter = new SpecialCounter(itemManager.getImage(specialWeapon.getItemID()), this, - hit, specialWeapon); - infoBoxManager.addInfoBox(counter); - specialCounter[specialWeapon.ordinal()] = counter; - } - else - { - counter.addHits(hit); - } - - // If in a party, add hit to partySpecs for the infobox tooltip - Map partySpecs = counter.getPartySpecs(); - if (!party.getMembers().isEmpty()) - { - if (partySpecs.containsKey(name)) - { - partySpecs.put(name, hit + partySpecs.get(name)); - } - else - { - partySpecs.put(name, hit); - } - } - } - - private void removeCounters() - { - interactedNpcIds.clear(); - - for (int i = 0; i < specialCounter.length; ++i) - { - SpecialCounter counter = specialCounter[i]; - - if (counter != null) - { - infoBoxManager.removeInfoBox(counter); - specialCounter[i] = null; - } - } - } - - private int getHit(SpecialWeapon specialWeapon, int deltaExperience) - { - double modifierBase = 1d / modifier; - double damageOutput = (deltaExperience * modifierBase) / 1.3333d; - - if (!specialWeapon.isDamage()) - { - return 1; - } - else - { - return (int) Math.round(damageOutput); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterUpdate.java b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterUpdate.java deleted file mode 100644 index 46cb32e134..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterUpdate.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2019, Trevor - * 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.specialcounter; - -import lombok.EqualsAndHashCode; -import lombok.Value; -import net.runelite.api.events.Event; -import net.runelite.http.api.ws.messages.party.PartyMemberMessage; - -@Value -@EqualsAndHashCode(callSuper = true) -class SpecialCounterUpdate extends PartyMemberMessage implements Event -{ - private final int npcId; - private final SpecialWeapon weapon; - private final int hit; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialWeapon.java b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialWeapon.java deleted file mode 100644 index ec581fe9e3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialWeapon.java +++ /dev/null @@ -1,45 +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.specialcounter; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.ItemID; - -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -enum SpecialWeapon -{ - DRAGON_WARHAMMER("Dragon Warhammer", ItemID.DRAGON_WARHAMMER, false), - ARCLIGHT("Arclight", ItemID.ARCLIGHT, false), - DARKLIGHT("Darklight", ItemID.DARKLIGHT, false), - BANDOS_GODSWORD("Bandos Godsword", ItemID.BANDOS_GODSWORD, true), - BANDOS_GODSWORD_OR("Bandos Godsword", ItemID.BANDOS_GODSWORD_OR, true); - - private final String name; - private final int itemID; - private final boolean damage; -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/spellbook/Spell.java b/runelite-client/src/main/java/net/runelite/client/plugins/spellbook/Spell.java deleted file mode 100644 index f3626d3d1e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/spellbook/Spell.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2019, Lucas - * 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.spellbook; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode -class Spell -{ - private int widget; - private int x; - private int y; - private int size; - private String name; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/spellbook/Spellbook.java b/runelite-client/src/main/java/net/runelite/client/plugins/spellbook/Spellbook.java deleted file mode 100644 index eebfff8426..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/spellbook/Spellbook.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2019, Lucas - * 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.spellbook; - -import com.google.common.collect.ImmutableMap; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@AllArgsConstructor -public enum Spellbook -{ - STANDARD(0, "standard"), - ANCIENT(1, "ancient"), - LUNAR(2, "lunar"), - ARCEUUS(3, "arceuus"); - - @Getter(AccessLevel.PACKAGE) - private final int id; - - @Getter(AccessLevel.PACKAGE) - private final String configKey; - - private static final ImmutableMap map; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - for (Spellbook s : values()) - { - builder.put(s.id, s); - } - map = builder.build(); - } - - public static Spellbook getByID(int id) - { - return map.get(id); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/spellbook/SpellbookConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/spellbook/SpellbookConfig.java deleted file mode 100644 index cee8dd2c47..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/spellbook/SpellbookConfig.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2019, Lucas - * 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.spellbook; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("spellbook") -public interface SpellbookConfig extends Config -{ - @ConfigItem( - keyName = "enableMobile", - name = "Mobile spellbook", - description = "Show the mobile spellbook with filtered spells enabled", - position = 1 - ) - default boolean enableMobile() - { - return true; - } - - @ConfigItem( - keyName = "dragSpells", - name = "Change spell location", - description = "Add menu entry to spellbook which toggles moving spells by dragging. Only works with spells filtered", - position = 2 - ) - default boolean dragSpells() - { - return true; - } - - @ConfigItem( - keyName = "scroll", - name = "Scrollwheel resizing", - description = "Resize spells by scrolling your scrollwheel over them, reset with scrollwheel click", - position = 3 - ) - default boolean scroll() - { - return true; - } - - @ConfigItem( - keyName = "size", - name = "Spell size", - description = "Size (in px) of spells. Normal mobile size is 40px, use common sense for this setting", - position = 4 - ) - default int size() - { - return 40; - } - - @ConfigItem( - keyName = "filter", - name = "Unfiltered spells", - description = "Spells you don't want to filter, seperated by a comma.
\"'s can be used in front and behind spells (eg: '\"c' matches all spells starting with a c" - ) // ^ JAJAJJAJAJAJAJA BRAZIL - default String filter() - { - return ""; - } - - @ConfigItem( - keyName = "canDrag", - name = "", - description = "", - hidden = true - ) - default boolean canDrag() - { - return false; - } - - @ConfigItem( - keyName = "canDrag", - name = "", - description = "", - hidden = true - ) - void canDrag(boolean canDrag); - - // Next 4 methods have to be here, or the reset configuration - // button won't reset em like it should. - - @ConfigItem( - keyName = "standard", - name = "", - description = "", - hidden = true - ) - default String standard() - { - return ""; - } - - @ConfigItem( - keyName = "ancient", - name = "", - description = "", - hidden = true - ) - default String ancient() - { - return ""; - } - - @ConfigItem( - keyName = "lunar", - name = "", - description = "", - hidden = true - ) - default String lunar() - { - return ""; - } - - @ConfigItem( - keyName = "arceuus", - name = "", - description = "", - hidden = true - ) - default String arceuus() - { - return ""; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/spellbook/SpellbookDragOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/spellbook/SpellbookDragOverlay.java deleted file mode 100644 index cf3a6b194c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/spellbook/SpellbookDragOverlay.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2019, Lucas - * 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.spellbook; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Point; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Sprite; -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; - -@Singleton -public class SpellbookDragOverlay extends Overlay -{ - private final SpellbookPlugin plugin; - private final Client client; - - @Inject - private SpellbookDragOverlay(final SpellbookPlugin plugin, final Client client) - { - this.plugin = plugin; - this.client = client; - setPosition(OverlayPosition.TOOLTIP); - setPriority(OverlayPriority.HIGH); - setLayer(OverlayLayer.ALWAYS_ON_TOP); - } - - @Override - public Dimension render(final Graphics2D g) - { - if (!plugin.isDragging()) - { - return null; - } - - final net.runelite.api.Point mouseCanvasPosition = client.getMouseCanvasPosition(); - final net.runelite.api.Point draggingLocation = plugin.getDraggingLocation(); - final Sprite sprite = plugin.getDraggingWidget().getSprite(); - final Point drawPos = new Point(mouseCanvasPosition.getX() - draggingLocation.getX(), mouseCanvasPosition.getY() - draggingLocation.getY()); - - if (sprite != null) - { - sprite.drawAt(drawPos.x, drawPos.y); - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/spellbook/SpellbookMouseListener.java b/runelite-client/src/main/java/net/runelite/client/plugins/spellbook/SpellbookMouseListener.java deleted file mode 100644 index 12a2fb13eb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/spellbook/SpellbookMouseListener.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2019, Lucas - * 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.spellbook; - -import java.awt.event.MouseEvent; -import java.awt.event.MouseWheelEvent; -import javax.inject.Singleton; -import javax.swing.SwingUtilities; -import net.runelite.client.input.MouseAdapter; -import net.runelite.client.input.MouseWheelListener; - -@Singleton -class SpellbookMouseListener extends MouseAdapter implements MouseWheelListener -{ - private final SpellbookPlugin plugin; - - SpellbookMouseListener(final SpellbookPlugin plugin) - { - this.plugin = plugin; - } - - @Override - public MouseEvent mouseClicked(final MouseEvent event) - { - if (plugin.isNotOnSpellWidget()) - { - return event; - } - - if (SwingUtilities.isMiddleMouseButton(event)) - { - plugin.resetSize(); - } - - event.consume(); - return event; - } - - @Override - public MouseEvent mousePressed(final MouseEvent event) - { - if (SwingUtilities.isRightMouseButton(event)) - { - plugin.resetLocation(); - return event; - } - else if (SwingUtilities.isLeftMouseButton(event) && !plugin.isNotOnSpellWidget() && !plugin.isDragging()) - { - plugin.startDragging(event.getPoint()); - event.consume(); - } - - return event; - } - - @Override - public MouseEvent mouseReleased(final MouseEvent event) - { - if (!SwingUtilities.isLeftMouseButton(event) || !plugin.isDragging()) - { - return event; - } - - plugin.completeDragging(event.getPoint()); - - event.consume(); - return event; - } - - @Override - public MouseWheelEvent mouseWheelMoved(final MouseWheelEvent event) - { - if (plugin.isNotOnSpellWidget()) - { - return event; - } - - final int direction = event.getWheelRotation(); - - if (direction > 0) - { - plugin.increaseSize(); - } - else - { - plugin.decreaseSize(); - } - - event.consume(); - return event; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/spellbook/SpellbookPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/spellbook/SpellbookPlugin.java deleted file mode 100644 index 1efefeeffe..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/spellbook/SpellbookPlugin.java +++ /dev/null @@ -1,750 +0,0 @@ -/* - * Copyright (c) 2019, Lucas - * 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.spellbook; - -import com.google.common.base.Strings; -import com.google.common.collect.ImmutableSet; -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; -import com.google.inject.Provides; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.Point; -import net.runelite.api.VarClientInt; -import net.runelite.api.Varbits; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.api.events.VarClientIntChanged; -import net.runelite.api.events.WidgetMenuOptionClicked; -import net.runelite.api.util.Text; -import net.runelite.api.vars.InterfaceTab; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import static net.runelite.api.widgets.WidgetInfo.SPELLBOOK; -import static net.runelite.api.widgets.WidgetInfo.SPELLBOOK_FILTERED_BOUNDS; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.input.MouseManager; -import net.runelite.client.menus.MenuManager; -import net.runelite.client.menus.WidgetMenuOption; -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 static net.runelite.client.util.MiscUtils.clamp; -import org.apache.commons.lang3.StringUtils; - -@PluginDescriptor( - name = "Spellbook", - description = "Modifications to the spellbook", - tags = {"resize", "spell", "mobile", "lowers", "pvp", "skill", "level"}, - type = PluginType.UTILITY, - enabledByDefault = false -) -@Singleton -@Slf4j -public class SpellbookPlugin extends Plugin -{ - private static final int FULL_WIDTH = 184; - private static final int FULL_HEIGHT = 240; - private static final Gson GSON = new Gson(); - private static final String LOCK = "Disable"; - private static final String UNLOCK = "Enable"; - private static final String MENU_TARGET = "Reordering"; - private static final WidgetMenuOption FIXED_MAGIC_TAB_LOCK = new WidgetMenuOption(LOCK, MENU_TARGET, WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB); - private static final WidgetMenuOption FIXED_MAGIC_TAB_UNLOCK = new WidgetMenuOption(UNLOCK, MENU_TARGET, WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB); - private static final WidgetMenuOption RESIZABLE_MAGIC_TAB_LOCK = new WidgetMenuOption(LOCK, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_MAGIC_TAB); - private static final WidgetMenuOption RESIZABLE_MAGIC_TAB_UNLOCK = new WidgetMenuOption(UNLOCK, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_MAGIC_TAB); - private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_MAGIC_TAB_LOCK = new WidgetMenuOption(LOCK, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_MAGIC_TAB); - private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_MAGIC_TAB_UNLOCK = new WidgetMenuOption(UNLOCK, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_MAGIC_TAB); - private final Map spells = new HashMap<>(); - private final SpellbookMouseListener mouseListener = new SpellbookMouseListener(this); - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private ConfigManager configManager; - - @Inject - private SpellbookConfig config; - - @Inject - private MenuManager menuManager; - - @Inject - private MouseManager mouseManager; - - @Inject - private OverlayManager overlayManager; - - @Inject - private SpellbookDragOverlay overlay; - - @Getter(AccessLevel.PACKAGE) - private boolean dragging; - - @Getter(AccessLevel.PACKAGE) - private Widget draggingWidget; - - @Getter(AccessLevel.PACKAGE) - private Point draggingLocation; - - private ImmutableSet notFilteredSpells; - private Spellbook spellbook; - private boolean mageTabOpen; - private boolean enableMobile; - private boolean dragSpells; - private boolean scroll; - private int size; - - @Provides - SpellbookConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(SpellbookConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - refreshMagicTabOption(); - } - - @Override - protected void shutDown() - { - clearMagicTabMenus(); - saveSpells(); - config.canDrag(false); - mouseManager.unregisterMouseListener(mouseListener); - mouseManager.unregisterMouseWheelListener(mouseListener); - } - - private void updateConfig() - { - loadFilter(); - this.enableMobile = config.enableMobile(); - this.dragSpells = config.dragSpells(); - this.scroll = config.scroll(); - this.size = config.size(); - } - - @Subscribe - private void onConfigChanged(final ConfigChanged event) - { - if (!"spellbook".equals(event.getGroup())) - { - return; - } - - switch (event.getKey()) - { - case "filter": - loadFilter(); - break; - case "enableMobile": - enableMobile = config.enableMobile(); - break; - case "dragSpells": - dragSpells = config.dragSpells(); - break; - case "scroll": - scroll = config.scroll(); - break; - case "size": - size = config.size(); - break; - default: - return; - } - - runRebuild(); - refreshMagicTabOption(); - } - - private void loadFilter() - { - notFilteredSpells = ImmutableSet.copyOf(Text.fromCSV(config.filter().toLowerCase())); - saveSpells(); - loadSpells(); - } - - @Subscribe - private void onGameStateChanged(final GameStateChanged event) - { - if (event.getGameState() == GameState.LOGGED_IN) - { - mageTabOpen = client.getVar(VarClientInt.INTERFACE_TAB) == InterfaceTab.SPELLBOOK.getId(); - refreshMagicTabOption(); - } - } - - @Subscribe - private void onVarCIntChanged(final VarClientIntChanged event) - { - if (event.getIndex() != VarClientInt.INTERFACE_TAB.getIndex()) - { - return; - } - - final boolean intfTab = client.getVar(VarClientInt.INTERFACE_TAB) == InterfaceTab.SPELLBOOK.getId(); - if (intfTab != mageTabOpen) - { - mageTabOpen = intfTab; - refreshMagicTabOption(); - } - - if (!config.canDrag() || client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - final boolean shouldBeAbleToDrag = mageTabOpen && client.getVar(Varbits.FILTER_SPELLBOOK) == 0; - if (shouldBeAbleToDrag) - { - return; - } - - mouseManager.unregisterMouseListener(mouseListener); - mouseManager.unregisterMouseWheelListener(mouseListener); - config.canDrag(false); - } - - @Subscribe - private void onWidgetMenuOptionClicked(final WidgetMenuOptionClicked event) - { - if (event.getWidget() != WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB - && event.getWidget() != WidgetInfo.RESIZABLE_VIEWPORT_MAGIC_TAB - && event.getWidget() != WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_MAGIC_TAB) - { - return; - } - - saveSpells(); - loadSpells(); - - if (event.getMenuOption().equals(UNLOCK)) - { - config.canDrag(true); - - overlayManager.add(overlay); - - mouseManager.registerMouseListener(mouseListener); - - if (this.scroll) - { - mouseManager.registerMouseWheelListener(mouseListener); - } - } - else if (event.getMenuOption().equals(LOCK)) - { - config.canDrag(false); - - overlayManager.remove(overlay); - - mouseManager.unregisterMouseListener(mouseListener); - mouseManager.unregisterMouseWheelListener(mouseListener); - } - - refreshMagicTabOption(); - } - - private void clearMagicTabMenus() - { - menuManager.removeManagedCustomMenu(FIXED_MAGIC_TAB_LOCK); - menuManager.removeManagedCustomMenu(RESIZABLE_MAGIC_TAB_LOCK); - menuManager.removeManagedCustomMenu(RESIZABLE_BOTTOM_LINE_MAGIC_TAB_LOCK); - menuManager.removeManagedCustomMenu(FIXED_MAGIC_TAB_UNLOCK); - menuManager.removeManagedCustomMenu(RESIZABLE_MAGIC_TAB_UNLOCK); - menuManager.removeManagedCustomMenu(RESIZABLE_BOTTOM_LINE_MAGIC_TAB_UNLOCK); - } - - private void refreshMagicTabOption() - { - clearMagicTabMenus(); - - if (!this.dragSpells || !mageTabOpen) - { - return; - } - - if (config.canDrag()) - { - menuManager.addManagedCustomMenu(FIXED_MAGIC_TAB_LOCK); - menuManager.addManagedCustomMenu(RESIZABLE_MAGIC_TAB_LOCK); - menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_MAGIC_TAB_LOCK); - } - else - { - menuManager.addManagedCustomMenu(FIXED_MAGIC_TAB_UNLOCK); - menuManager.addManagedCustomMenu(RESIZABLE_MAGIC_TAB_UNLOCK); - menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_MAGIC_TAB_UNLOCK); - } - } - - @Subscribe - private void onScriptCallbackEvent(final ScriptCallbackEvent event) - { - if (client.getVar(Varbits.FILTER_SPELLBOOK) != 0 - || !this.enableMobile - || !event.getEventName().toLowerCase().contains("spell")) - { - return; - } - - final int[] iStack = client.getIntStack(); - final int iStackSize = client.getIntStackSize(); - - final String[] sStack = client.getStringStack(); - final int sStackSize = client.getStringStackSize(); - - switch (event.getEventName()) - { - case "startSpellRedraw": - final Spellbook pook = Spellbook.getByID(client.getVar(Varbits.SPELLBOOK)); - - if (pook != spellbook) - { - saveSpells(); - spellbook = pook; - loadSpells(); - } - - break; - case "shouldFilterSpell": - { - final String spell = sStack[sStackSize - 1].toLowerCase(); - final int widget = iStack[iStackSize - 1]; - - if (!spells.containsKey(widget)) - { - final Spell s = new Spell(); - s.setWidget(widget); - s.setX(-1); - s.setY(-1); - s.setSize(0); - s.setName(spell); - - spells.put(widget, s); - } - - if (notFilteredSpells.isEmpty()) - { - return; - } - - iStack[iStackSize - 2] = isUnfiltered(spell, notFilteredSpells) ? 1 : 0; - break; - } - case "isMobileSpellbookEnabled": - iStack[iStackSize - 1] = 1; - break; - case "resizeSpell": - final int size = this.size; - - if (size == 0) - { - return; - } - - final int columns = clamp(FULL_WIDTH / size, 2, 3); - - iStack[iStackSize - 2] = size; - iStack[iStackSize - 1] = columns; - break; - case "setSpellAreaSize": - if (!this.dragSpells) - { - return; - } - - iStack[iStackSize - 2] = FULL_WIDTH; - iStack[iStackSize - 1] = FULL_HEIGHT; - break; - case "resizeIndividualSpells": - { - final int widget = iStack[iStackSize - 1]; - - int visibleCount = 0; - for (Spell spell : spells.values()) - { - final String s = spell.getName(); - if (isUnfiltered(s, notFilteredSpells)) - { - visibleCount++; - } - } - - if (visibleCount > 20 || visibleCount == 0) - { - return; - } - - final Spell spell = spells.get(widget); - final int newSize = clamp(trueSize(spell), 0, FULL_WIDTH); - - iStack[iStackSize - 3] = newSize; - iStack[iStackSize - 2] = newSize; - break; - } - case "setSpellPosition": - { - if (!this.dragSpells) - { - return; - } - - final int widget = iStack[iStackSize - 1]; - final Spell s = spells.get(widget); - final int x = s.getX(); - final int y = s.getY(); - - if (x == -1 || y == -1) - { - return; - } - - iStack[iStackSize - 5] = x; - iStack[iStackSize - 4] = y; - break; - } - } - } - - private void loadSpells() - { - spells.clear(); - - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - if (spellbook == null) - { - log.debug("Spellbook is null?"); - return; - } - - final String cfg = configManager.getConfiguration("spellbook", spellbook.getConfigKey()); - - if (Strings.isNullOrEmpty(cfg)) - { - return; - } - - final Collection gson = GSON.fromJson(cfg, new TypeToken>() {}.getType()); - - for (final Spell s : gson) - { - spells.put(s.getWidget(), s); - } - } - - private void saveSpells() - { - if (spells.isEmpty()) - { - return; - } - - configManager.setConfiguration("spellbook", spellbook.getConfigKey(), GSON.toJson(spells.values())); - } - - private void runRebuild() - { - if (client.getGameState() != GameState.LOGGED_IN || !mageTabOpen) - { - return; - } - - // Runs magic_spellbook_rebuild - // The magic numbers probably are mobile specific widgetids - // openosrs mobile when? - clientThread.invoke(() -> - { - final Widget spellWidget = client.getWidget(SPELLBOOK); - if (spellWidget != null) - { - final Object[] args = spellWidget.getOnInvTransmit(); - if (args != null) - { - client.runScript(args); - } - } - }); - } - - boolean isNotOnSpellWidget() - { - if (client.isMenuOpen() || !mageTabOpen) - { - return true; - } - - return currentWidget() == null; - } - - private Widget currentWidget() - { - final Widget parent = client.getWidget(SPELLBOOK_FILTERED_BOUNDS); - if (parent == null) - { - return null; - } - - for (final Widget w : parent.getStaticChildren()) - { - if (w.containsMouse()) - { - return w; - } - } - - return null; - } - - void startDragging(final java.awt.Point point) - { - draggingWidget = currentWidget(); - - if (draggingWidget == null) - { - return; - } - - final Point widgetPos = draggingWidget.getCanvasLocation(); - - final int x = point.x - widgetPos.getX(); - final int y = point.y - widgetPos.getY(); - - draggingLocation = new Point(x, y); - draggingWidget.setHidden(true); - dragging = true; - } - - void completeDragging(final java.awt.Point point) - { - final Point parentPos = client.getWidget(SPELLBOOK_FILTERED_BOUNDS).getCanvasLocation(); - - int x = point.x - draggingLocation.getX() - parentPos.getX(); - int y = point.y - draggingLocation.getY() - parentPos.getY(); - final int size = draggingWidget.getWidth(); - - x = clamp(x, 0, FULL_WIDTH - size); - y = clamp(y, 0, FULL_HEIGHT - size); - - final int draggedID = draggingWidget.getId(); - final Spell n = spells.get(draggedID); - - n.setX(x); - n.setY(y); - - draggingWidget.setHidden(false); - dragging = false; - - runRebuild(); - } - - void increaseSize() - { - final Widget scrolledWidget = currentWidget(); - - if (scrolledWidget == null || dragging) - { - return; - } - - final int scrolledWidgetId = scrolledWidget.getId(); - final Spell scrolledSpell = spells.get(scrolledWidgetId); - - if (scrolledSpell.getX() == -1 || scrolledSpell.getY() == -1) - { - scrolledSpell.setX(scrolledWidget.getRelativeX()); - scrolledSpell.setY(scrolledWidget.getRelativeY()); - } - - if (trueSize(scrolledSpell) > FULL_WIDTH - 2) - { - scrolledSpell.setX(0); - scrolledSpell.setY(clamp(scrolledSpell.getY(), 0, FULL_HEIGHT - FULL_WIDTH)); - return; - } - - scrolledSpell.setSize(scrolledSpell.getSize() + 1); - - scrolledSpell.setX(clamp(scrolledSpell.getX() - 1, 0, FULL_WIDTH - trueSize(scrolledSpell))); - scrolledSpell.setY(clamp(scrolledSpell.getY() - 1, 0, FULL_HEIGHT - trueSize(scrolledSpell))); - - runRebuild(); - } - - void decreaseSize() - { - final Widget scrolledWidget = currentWidget(); - - if (scrolledWidget == null || dragging) - { - return; - } - - final int scrolledWidgetId = scrolledWidget.getId(); - final Spell scrolledSpell = spells.get(scrolledWidgetId); - - // People probably don't want to scroll on a single pixel - if (trueSize(scrolledSpell) <= 5) - { - return; - } - - scrolledSpell.setSize(scrolledSpell.getSize() - 1); - - if (scrolledSpell.getX() == -1 || scrolledSpell.getY() == -1) - { - scrolledSpell.setX(scrolledWidget.getRelativeX()); - scrolledSpell.setY(scrolledWidget.getRelativeY()); - } - - scrolledSpell.setX(scrolledSpell.getX() + 1); - scrolledSpell.setY(scrolledSpell.getY() + 1); - - runRebuild(); - } - - void resetSize() - { - final Widget clickedWidget = currentWidget(); - - if (clickedWidget == null || dragging || !this.scroll) - { - return; - } - - final int clickedWidgetId = clickedWidget.getId(); - final Spell clickedSpell = spells.get(clickedWidgetId); - - final int oldSize = clickedSpell.getSize(); - - if (oldSize == 0) - { - return; - } - - if (clickedSpell.getX() == -1 || clickedSpell.getY() == -1) - { - clickedSpell.setX(clickedWidget.getRelativeX()); - clickedSpell.setY(clickedWidget.getRelativeY()); - } - - clickedSpell.setX(clickedSpell.getX() + oldSize); - clickedSpell.setY(clickedSpell.getY() + oldSize); - - clickedSpell.setSize(0); - - runRebuild(); - } - - // I know this still opens menu but else you - // wouldn't be able to get out of the spellbook - // mode thing lol - void resetLocation() - { - final Widget clickedWidget = currentWidget(); - - if (clickedWidget == null || dragging) - { - return; - } - - final int clickedWidgetId = clickedWidget.getId(); - final Spell clickedSpell = spells.get(clickedWidgetId); - - clickedSpell.setX(-1); - clickedSpell.setY(-1); - - runRebuild(); - } - - private int trueSize(final Spell s) - { - return s.getSize() * 2 + this.size; - } - - private static boolean isUnfiltered(final String spell, final Set unfiltereds) - { - for (final String str : unfiltereds) - { - boolean b; - - if (str.length() == 0) - { - continue; - } - - if (str.charAt(0) == '\"') - { - if (str.charAt(str.length() - 1) == '\"') - { - b = spell.equalsIgnoreCase(str.substring(1, str.length() - 1)); - } - else - { - b = StringUtils.startsWithIgnoreCase(spell, str.substring(1)); - } - } - else if (str.charAt(str.length() - 1) == '\"') - { - b = StringUtils.endsWithIgnoreCase(spell, StringUtils.chop(str)); - } - else - { - b = StringUtils.containsIgnoreCase(spell, str); - } - - if (b) - { - return true; - } - } - - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsConfig.java deleted file mode 100644 index b458140527..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsConfig.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2018, Jos - * 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.statusbars; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.plugins.statusbars.config.BarMode; - -@ConfigGroup("statusbars") -public interface StatusBarsConfig extends Config -{ - @ConfigItem( - position = 1, - keyName = "enableCounter", - name = "Show counters", - description = "Shows the numeric value of HP and Prayer on the status bar" - ) - default boolean enableCounter() - { - return false; - } - - @ConfigItem( - position = 2, - keyName = "enableSkillIcon", - name = "Show icons", - description = "Adds skill icons at the top of the bars." - ) - default boolean enableSkillIcon() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "enableRestorationBars", - name = "Show restores", - description = "Visually shows how much will be restored to your status bar." - ) - default boolean enableRestorationBars() - { - return true; - } - - @ConfigItem( - position = 4, - keyName = "leftBarMode", - name = "Left Status Bar", - description = "Configures the left status bar" - ) - default BarMode leftBarMode() - { - return BarMode.HITPOINTS; - } - - @ConfigItem( - position = 5, - keyName = "rightBarMode", - name = "Right Status Bar", - description = "Configures the right status bar" - ) - default BarMode rightBarMode() - { - return BarMode.PRAYER; - } - - @ConfigItem( - position = 6, - keyName = "toggleRestorationBars", - name = "Toggle to hide when not in combat", - description = "Visually hides the Status Bars when player is out of combat." - ) - default boolean toggleRestorationBars() - { - return false; - } - - @ConfigItem( - position = 7, - keyName = "hideStatusBarDelay", - name = "Delay (seconds)", - description = "Number of seconds after combat to hide the status bars." - ) - default int hideStatusBarDelay() - { - return 3; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsOverlay.java deleted file mode 100644 index d2ec9f7094..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsOverlay.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) 2018, Jos - * 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.statusbars; - -import com.google.common.base.Strings; -import com.google.common.primitives.Ints; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.MenuEntry; -import net.runelite.api.Point; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.plugins.itemstats.Effect; -import net.runelite.client.plugins.itemstats.ItemStatChangesService; -import net.runelite.client.plugins.itemstats.StatChange; -import net.runelite.client.plugins.itemstats.StatsChanges; -import net.runelite.client.plugins.statusbars.renderer.BarRenderer; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayPosition; - -@Singleton -public class StatusBarsOverlay extends Overlay -{ - private static final int HEIGHT = 252; - private static final int RESIZED_BOTTOM_HEIGHT = 272; - private static final int RESIZED_BOTTOM_OFFSET_Y = 12; - private static final int RESIZED_BOTTOM_OFFSET_X = 10; - - private final Client client; - private final StatusBarsPlugin plugin; - private final ItemStatChangesService itemStatService; - - @Inject - private StatusBarsOverlay(final Client client, final StatusBarsPlugin plugin, final ItemStatChangesService itemstatservice) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - this.client = client; - this.plugin = plugin; - this.itemStatService = itemstatservice; - } - - @Override - public Dimension render(Graphics2D g) - { - final Widget widgetBankTitleBar = client.getWidget(WidgetInfo.BANK_TITLE_BAR); - if (widgetBankTitleBar != null && !widgetBankTitleBar.isHidden()) - { - return null; - } - - Viewport curViewport = null; - Widget curWidget = null; - - for (Viewport viewport : Viewport.values()) - { - final Widget viewportWidget = client.getWidget(viewport.getViewport()); - if (viewportWidget != null && !viewportWidget.isHidden()) - { - curViewport = viewport; - curWidget = viewportWidget; - break; - } - } - - if (curViewport == null) - { - return null; - } - else - { - curWidget.isHidden(); - } - - final Point offsetLeft = curViewport.getOffsetLeft(); - final Point offsetRight = curViewport.getOffsetRight(); - final Point location = curWidget.getCanvasLocation(); - final int height, offsetLeftBarX, offsetLeftBarY, offsetRightBarX, offsetRightBarY; - - if (curViewport == Viewport.RESIZED_BOTTOM) - { - height = RESIZED_BOTTOM_HEIGHT; - offsetLeftBarX = (location.getX() + RESIZED_BOTTOM_OFFSET_X - offsetLeft.getX()); - offsetLeftBarY = (location.getY() - RESIZED_BOTTOM_OFFSET_Y - offsetRight.getY()); - offsetRightBarX = (location.getX() + RESIZED_BOTTOM_OFFSET_X - offsetRight.getX()); - offsetRightBarY = (location.getY() - RESIZED_BOTTOM_OFFSET_Y - offsetRight.getY()); - } - else - { - height = HEIGHT; - offsetLeftBarX = (location.getX() - offsetLeft.getX()); - offsetLeftBarY = (location.getY() - offsetLeft.getY()); - offsetRightBarX = (location.getX() - offsetRight.getX()) + curWidget.getWidth(); - offsetRightBarY = (location.getY() - offsetRight.getY()); - } - - BarRenderer left = plugin.getBarRenderers().get(plugin.getLeftBarMode()); - BarRenderer right = plugin.getBarRenderers().get(plugin.getRightBarMode()); - - if (left != null) - { - left.draw(client, this, g, offsetLeftBarX, offsetLeftBarY, height); - } - - if (right != null) - { - right.draw(client, this, g, offsetRightBarX, offsetRightBarY, height); - } - - return null; - } - - public int getRestoreValue(String skill) - { - final MenuEntry[] menu = client.getMenuEntries(); - final int menuSize = menu.length; - final MenuEntry entry = menuSize > 0 ? menu[menuSize - 1] : null; - int restoreValue = 0; - - if (entry != null && entry.getParam1() == WidgetInfo.INVENTORY.getId()) - { - final Effect change = itemStatService.getItemStatChanges(entry.getIdentifier()); - - if (change != null) - { - final StatsChanges statsChanges = change.calculate(client); - - for (final StatChange c : statsChanges.getStatChanges()) - { - //final String strVar = c.getTheoretical(); this was erroring - final String strVar = String.valueOf(c.getTheoretical()); - - if (Strings.isNullOrEmpty(strVar)) - { - continue; - } - - final Integer value = Ints.tryParse(strVar.startsWith("+") ? strVar.substring(1) : strVar); - - if (value == null) - { - continue; - } - - if (c.getStat().getName().equals(skill)) - { - restoreValue = value; - } - - if (restoreValue != 0) - { - break; - } - } - } - } - - return restoreValue; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsPlugin.java deleted file mode 100644 index 79fa1c5b1e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsPlugin.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (c) 2018, Jos - * 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.statusbars; - -import com.google.common.collect.Maps; -import com.google.inject.Provides; -import java.time.Duration; -import java.time.Instant; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -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.NPCDefinition; -import net.runelite.api.events.GameTick; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDependency; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.itemstats.ItemStatPlugin; -import net.runelite.client.plugins.statusbars.config.BarMode; -import net.runelite.client.plugins.statusbars.renderer.BarRenderer; -import net.runelite.client.plugins.statusbars.renderer.EnergyRenderer; -import net.runelite.client.plugins.statusbars.renderer.HitPointsRenderer; -import net.runelite.client.plugins.statusbars.renderer.PrayerRenderer; -import net.runelite.client.plugins.statusbars.renderer.SpecialAttackRenderer; -import net.runelite.client.ui.overlay.OverlayManager; - -@PluginDescriptor( - name = "Status Bars", - description = "Draws status bars next to players inventory showing currentValue and restore amounts", - enabledByDefault = false, - type = PluginType.UTILITY -) -@Singleton -@PluginDependency(ItemStatPlugin.class) -public class StatusBarsPlugin extends Plugin -{ - @Inject - private StatusBarsOverlay overlay; - - @Inject - private OverlayManager overlayManager; - - @Inject - private HitPointsRenderer hitPointsRenderer; - - @Inject - private PrayerRenderer prayerRenderer; - - @Inject - private EnergyRenderer energyRenderer; - - @Inject - private SpecialAttackRenderer specialAttackRenderer; - - @Getter(AccessLevel.PACKAGE) - private final Map barRenderers = Maps.newEnumMap(BarMode.class); - - @Inject - private Client client; - - @Inject - private StatusBarsConfig config; - - @Getter(AccessLevel.PACKAGE) - private Instant lastCombatAction; - - @Getter(AccessLevel.PUBLIC) - private boolean enableCounter; - @Getter(AccessLevel.PUBLIC) - private boolean enableSkillIcon; - @Getter(AccessLevel.PUBLIC) - private boolean enableRestorationBars; - @Getter(AccessLevel.PACKAGE) - private BarMode leftBarMode; - @Getter(AccessLevel.PACKAGE) - private BarMode rightBarMode; - private boolean toggleRestorationBars; - private int hideStatusBarDelay; - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - barRenderers.put(BarMode.DISABLED, null); - barRenderers.put(BarMode.HITPOINTS, hitPointsRenderer); - barRenderers.put(BarMode.PRAYER, prayerRenderer); - barRenderers.put(BarMode.RUN_ENERGY, energyRenderer); - barRenderers.put(BarMode.SPECIAL_ATTACK, specialAttackRenderer); - } - - private void updateLastCombatAction() - { - this.lastCombatAction = Instant.now(); - } - - @Subscribe - private void onGameTick(GameTick gameTick) - { - if (!this.toggleRestorationBars) - { - overlayManager.add(overlay); - } - else - { - hideStatusBar(); - } - } - - private void hideStatusBar() - { - final Actor interacting = client.getLocalPlayer().getInteracting(); - final boolean isNpc = interacting instanceof NPC; - final int combatTimeout = this.hideStatusBarDelay; - - if (isNpc) - { - final NPC npc = (NPC) interacting; - final NPCDefinition npcComposition = npc.getDefinition(); - final List npcMenuActions = Arrays.asList(npcComposition.getActions()); - if (npcMenuActions.contains("Attack") && this.toggleRestorationBars) - { - updateLastCombatAction(); - overlayManager.add(overlay); - } - } - else if (lastCombatAction == null - || (lastCombatAction != null && Duration.between(getLastCombatAction(), Instant.now()).getSeconds() > combatTimeout)) - { - overlayManager.remove(overlay); - } - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - barRenderers.clear(); - } - - @Provides - StatusBarsConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(StatusBarsConfig.class); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!"statusbars".equals(event.getGroup())) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.enableCounter = config.enableCounter(); - this.enableSkillIcon = config.enableSkillIcon(); - this.enableRestorationBars = config.enableRestorationBars(); - this.leftBarMode = config.leftBarMode(); - this.rightBarMode = config.rightBarMode(); - this.toggleRestorationBars = config.toggleRestorationBars(); - this.hideStatusBarDelay = config.hideStatusBarDelay(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/Viewport.java b/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/Viewport.java deleted file mode 100644 index ff1703e93a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/Viewport.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, Jos - * 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.statusbars; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.Point; -import net.runelite.api.widgets.WidgetInfo; - -@Getter(AccessLevel.PACKAGE) -@AllArgsConstructor -enum Viewport -{ - RESIZED_BOX(WidgetInfo.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX, WidgetInfo.RESIZABLE_VIEWPORT_INTERFACE_CONTAINER, - new Point(20, -4), new Point(0, -4)), - RESIZED_BOTTOM(WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INTERFACE_CONTAINER, - new Point(61, 8), new Point(35, -12)), - FIXED(WidgetInfo.FIXED_VIEWPORT, WidgetInfo.FIXED_VIEWPORT_INTERFACE_CONTAINER, - new Point(20, -4), new Point(0, -4)); - - private WidgetInfo container; - private WidgetInfo viewport; - private Point offsetLeft; - private Point offsetRight; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/config/BarMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/config/BarMode.java deleted file mode 100644 index 0716177fe9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/config/BarMode.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.statusbars.config; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter(AccessLevel.PACKAGE) -@RequiredArgsConstructor -public enum BarMode -{ - DISABLED("Disabled"), - HITPOINTS("Hitpoints"), - PRAYER("Prayer"), - RUN_ENERGY("Run Energy"), - SPECIAL_ATTACK("Special Attack"); - - private final String name; - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/renderer/BarRenderer.java b/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/renderer/BarRenderer.java deleted file mode 100644 index 7dc607c57b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/renderer/BarRenderer.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2018, Rheon - * 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.client.plugins.statusbars.renderer; - -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.Point; -import lombok.AccessLevel; -import lombok.RequiredArgsConstructor; -import net.runelite.api.Client; -import net.runelite.client.plugins.statusbars.StatusBarsOverlay; -import net.runelite.client.plugins.statusbars.StatusBarsPlugin; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.overlay.components.TextComponent; - -@RequiredArgsConstructor(access = AccessLevel.PROTECTED) -public abstract class BarRenderer -{ - private static final TextComponent TEXT = new TextComponent(); - private static final Color COLOR_BAR_BG = new Color(0, 0, 0, 150); - private static final Color COLOR_OVERHEAL = new Color(216, 255, 139, 150); - private static final int BAR_WIDTH = 20; - private static final int COUNTER_ICON_HEIGHT = 18; - private static final int SKILL_ICON_HEIGHT = 35; - private static final int PADDING = 1; - private static final int OVERHEAL_OFFSET = 2; - private static final int HEAL_OFFSET = 3; - private static final int ICON_AND_COUNTER_OFFSET_X = 1; - private static final int ICON_AND_COUNTER_OFFSET_Y = 21; - private static final int OFFSET = 2; - - protected final StatusBarsPlugin plugin; - int maximumValue; - int currentValue; - int restore; - Color standardColor; - Color restoreColor; - Image icon; - - protected abstract void update(Client client, StatusBarsOverlay overlay); - - private void renderBar(Graphics2D graphics, int x, int y, int height) - { - graphics.setColor(COLOR_BAR_BG); - graphics.drawRect(x, y, BAR_WIDTH - PADDING, height - PADDING); - graphics.fillRect(x, y, BAR_WIDTH, height); - - final int filledHeight = getBarHeight(maximumValue, currentValue, height); - graphics.setColor(standardColor); - graphics.fillRect(x + PADDING, - y + PADDING + (height - filledHeight), - BAR_WIDTH - PADDING * OFFSET, - filledHeight - PADDING * OFFSET); - } - - private void renderIconsAndCounters(Graphics2D graphics, int x, int y) - { - final String counterText = Integer.toString(currentValue); - final int widthOfCounter = graphics.getFontMetrics().stringWidth(counterText); - final int centerText = (BAR_WIDTH - PADDING) / 2 - (widthOfCounter / 2); - - if (plugin.isEnableCounter()) - { - graphics.setFont(FontManager.getRunescapeSmallFont()); - TEXT.setText(counterText); - TEXT.setPosition(new Point(x + centerText + 1, y + COUNTER_ICON_HEIGHT)); - } - else - { - TEXT.setText(""); - } - - if (plugin.isEnableSkillIcon()) - { - graphics.drawImage(icon, x + ICON_AND_COUNTER_OFFSET_X + PADDING, y + ICON_AND_COUNTER_OFFSET_Y - icon.getWidth(null), null); - TEXT.setPosition(new Point(x + centerText + 1, y + SKILL_ICON_HEIGHT)); - } - - TEXT.render(graphics); - } - - private void renderRestore(Graphics2D graphics, int x, int y, int height) - { - if (restore <= 0) - { - return; - } - - final int filledCurrentHeight = getBarHeight(maximumValue, currentValue, height); - int filledHeight = getBarHeight(maximumValue, restore, height); - graphics.setColor(restoreColor); - - if (filledHeight + filledCurrentHeight > height) - { - final int overHeal = filledHeight + filledCurrentHeight - height; - filledHeight = filledHeight - overHeal + OVERHEAL_OFFSET; - graphics.setColor(COLOR_OVERHEAL); - graphics.fillRect(x + PADDING, - y - filledCurrentHeight + (height - filledHeight) + HEAL_OFFSET, - BAR_WIDTH - PADDING * OVERHEAL_OFFSET, - filledHeight - PADDING * OVERHEAL_OFFSET); - } - else - { - graphics.fillRect(x + PADDING, - y - OVERHEAL_OFFSET - filledCurrentHeight + (height - filledHeight) + HEAL_OFFSET, - BAR_WIDTH - PADDING * OVERHEAL_OFFSET, - filledHeight + OVERHEAL_OFFSET - PADDING * OVERHEAL_OFFSET); - } - } - - private static int getBarHeight(int base, int current, int size) - { - final double ratio = (double) current / base; - - if (ratio >= 1) - { - return size; - } - - return (int) Math.round(ratio * size); - } - - public void draw(Client client, StatusBarsOverlay overlay, Graphics2D graphics, int x, int y, int height) - { - update(client, overlay); - renderBar(graphics, x, y, height); - if (plugin.isEnableRestorationBars()) - { - renderRestore(graphics, x, y, height); - } - if (plugin.isEnableSkillIcon() || plugin.isEnableCounter()) - { - renderIconsAndCounters(graphics, x, y); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/renderer/EnergyRenderer.java b/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/renderer/EnergyRenderer.java deleted file mode 100644 index b3a1cd5141..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/renderer/EnergyRenderer.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2018, Rheon - * 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.client.plugins.statusbars.renderer; - -import java.awt.Color; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.SpriteID; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.plugins.statusbars.StatusBarsOverlay; -import net.runelite.client.plugins.statusbars.StatusBarsPlugin; - -@Singleton -public class EnergyRenderer extends BarRenderer -{ - private final SpriteManager spriteManager; - - @Inject - public EnergyRenderer(final StatusBarsPlugin plugin, final SpriteManager spriteManager) - { - super(plugin); - maximumValue = 100; - this.spriteManager = spriteManager; - standardColor = new Color(199, 174, 0, 220); - restoreColor = new Color(199, 118, 0, 218); - } - - @Override - protected void update(Client client, StatusBarsOverlay overlay) - { - icon = spriteManager.getSprite(SpriteID.MINIMAP_ORB_RUN_ICON, 0); - currentValue = client.getEnergy(); - restore = overlay.getRestoreValue("Run Energy"); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/renderer/HitPointsRenderer.java b/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/renderer/HitPointsRenderer.java deleted file mode 100644 index f9976ebe27..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/renderer/HitPointsRenderer.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2018, Rheon - * 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.client.plugins.statusbars.renderer; - -import java.awt.Color; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Skill; -import net.runelite.api.VarPlayer; -import net.runelite.client.game.SkillIconManager; -import net.runelite.client.plugins.statusbars.StatusBarsOverlay; -import net.runelite.client.plugins.statusbars.StatusBarsPlugin; - -@Singleton -public class HitPointsRenderer extends BarRenderer -{ - private static final Color COLOR_STANDARD = new Color(225, 35, 0, 125); - private static final Color COLOR_POISON = new Color(0, 145, 0, 150); - private static final Color COLOR_VENOM = new Color(0, 65, 0, 150); - - @Inject - public HitPointsRenderer(final StatusBarsPlugin plugin, final SkillIconManager iconManager) - { - super(plugin); - icon = iconManager.getSkillImage(Skill.HITPOINTS, true); - restoreColor = new Color(255, 112, 6, 150); - } - - @Override - protected void update(Client client, StatusBarsOverlay overlay) - { - maximumValue = client.getRealSkillLevel(Skill.HITPOINTS); - currentValue = client.getBoostedSkillLevel(Skill.HITPOINTS); - restore = overlay.getRestoreValue(Skill.HITPOINTS.getName()); - - final int poisonState = client.getVar(VarPlayer.IS_POISONED); - - if (poisonState > 0 && poisonState < 50) - { - standardColor = COLOR_POISON; - } - else if (poisonState >= 1000000) - { - standardColor = COLOR_VENOM; - } - else - { - standardColor = COLOR_STANDARD; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/renderer/PrayerRenderer.java b/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/renderer/PrayerRenderer.java deleted file mode 100644 index bf5eed9cf1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/renderer/PrayerRenderer.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2018, Rheon - * 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.client.plugins.statusbars.renderer; - -import java.awt.Color; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Skill; -import net.runelite.api.Varbits; -import net.runelite.client.game.SkillIconManager; -import net.runelite.client.plugins.statusbars.StatusBarsOverlay; -import net.runelite.client.plugins.statusbars.StatusBarsPlugin; -import net.runelite.client.util.ImageUtil; - -@Singleton -public class PrayerRenderer extends BarRenderer -{ - private static final Color COLOR_STANDARD = new Color(50, 200, 200, 175); - private static final Color COLOR_ACTIVE = new Color(57, 255, 186, 225); - private static final int SIZE = 17; - - @Inject - public PrayerRenderer(final StatusBarsPlugin plugin, final SkillIconManager iconManager) - { - super(plugin); - icon = ImageUtil.resizeImage(iconManager.getSkillImage(Skill.PRAYER, true), SIZE, SIZE); - restoreColor = new Color(57, 255, 186, 75); - } - - @Override - protected void update(Client client, StatusBarsOverlay overlay) - { - maximumValue = client.getRealSkillLevel(Skill.PRAYER); - currentValue = client.getBoostedSkillLevel(Skill.PRAYER); - standardColor = client.getVar(Varbits.QUICK_PRAYER) == 1 ? COLOR_ACTIVE : COLOR_STANDARD; - restore = overlay.getRestoreValue(Skill.PRAYER.getName()); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/renderer/SpecialAttackRenderer.java b/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/renderer/SpecialAttackRenderer.java deleted file mode 100644 index 7ffeb06d2c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/renderer/SpecialAttackRenderer.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2018, Rheon - * 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.client.plugins.statusbars.renderer; - -import java.awt.Color; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.SpriteID; -import net.runelite.api.VarPlayer; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.plugins.statusbars.StatusBarsOverlay; -import net.runelite.client.plugins.statusbars.StatusBarsPlugin; - -@Singleton -public class SpecialAttackRenderer extends BarRenderer -{ - private final SpriteManager spriteManager; - - @Inject - public SpecialAttackRenderer(final StatusBarsPlugin plugin, final SpriteManager spriteManager) - { - super(plugin); - maximumValue = 100; - this.spriteManager = spriteManager; - standardColor = restoreColor = new Color(3, 153, 0, 195); - } - - @Override - protected void update(Client client, StatusBarsOverlay overlay) - { - icon = spriteManager.getSprite(SpriteID.MINIMAP_ORB_SPECIAL_ICON, 0); - currentValue = client.getVar(VarPlayer.SPECIAL_ATTACK_PERCENT) / 10; - restore = 0; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/statusorbs/StatusOrbsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/statusorbs/StatusOrbsConfig.java deleted file mode 100644 index 6968024f2f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/statusorbs/StatusOrbsConfig.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2018 Abex - * Copyright (c) 2018, Sean Dewar - * 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.statusorbs; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigTitleSection; -import net.runelite.client.config.Title; - -@ConfigGroup("statusorbs") -public interface StatusOrbsConfig extends Config -{ - @ConfigTitleSection( - keyName = "hp", - name = "Hitpoints", - description = "", - position = 0 - ) - default Title hp() - { - return new Title(); - } - - @ConfigItem( - keyName = "dynamicHpHeart", - name = "Dynamic hitpoints heart", - description = "Changes the HP heart color to match players current affliction", - titleSection = "hp", - position = 1 - ) - default boolean dynamicHpHeart() - { - return true; - } - - @ConfigItem( - keyName = "showHitpoints", - name = "Show hitpoints regen", - description = "Show a ring around the hitpoints orb", - titleSection = "hp", - position = 2 - ) - default boolean showHitpoints() - { - return true; - } - - @ConfigItem( - keyName = "showWhenNoChange", - name = "Show hitpoints regen at full hitpoints", - description = "Always show the hitpoints regen orb, even if there will be no stat change", - titleSection = "hp", - position = 3 - ) - default boolean showWhenNoChange() - { - return false; - } - - @ConfigItem( - keyName = "notifyBeforeHpRegenDuration", - name = "Hitpoint Regen Notification (seconds)", - description = "Notify approximately when your next hitpoint is about to regen. A value of 0 will disable notification.", - titleSection = "hp", - position = 4 - ) - default int getNotifyBeforeHpRegenSeconds() - { - return 0; - } - - @ConfigTitleSection( - keyName = "spec", - name = "Special attack", - description = "", - position = 5 - ) - default Title spec() - { - return new Title(); - } - - @ConfigItem( - keyName = "showSpecial", - name = "Show Spec. Attack regen", - description = "Show a ring around the Special Attack orb", - titleSection = "spec", - position = 6 - ) - default boolean showSpecial() - { - return true; - } - - @ConfigTitleSection( - keyName = "run", - name = "Run energy", - description = "", - position = 7 - ) - default Title run() - { - return new Title(); - } - - @ConfigItem( - keyName = "showRun", - name = "Show run energy regen", - description = "Show a ring around the run regen orb", - position = 8, - titleSection = "run" - ) - default boolean showRun() - { - return true; - } - - @ConfigItem( - keyName = "replaceOrbText", - name = "Replace run orb text with run time left", - description = "Show the remaining run time (in seconds) next in the energy orb", - position = 9, - titleSection = "run" - ) - default boolean replaceOrbText() - { - return false; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/statusorbs/StatusOrbsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/statusorbs/StatusOrbsOverlay.java deleted file mode 100644 index 986b07e081..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/statusorbs/StatusOrbsOverlay.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (c) 2018 Abex - * Copyright (c) 2018, Sean Dewar - * 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.statusorbs; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.RenderingHints; -import java.awt.Stroke; -import java.awt.geom.Arc2D; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.Point; -import net.runelite.api.Skill; -import net.runelite.api.VarPlayer; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -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.tooltip.Tooltip; -import net.runelite.client.ui.overlay.tooltip.TooltipManager; -import org.apache.commons.lang3.StringUtils; - -public class StatusOrbsOverlay extends Overlay -{ - private static final Color HITPOINTS_COLOR = brighter(0x9B0703); - private static final Color SPECIAL_COLOR = brighter(0x1E95B0); - private static final Color RUN_COLOR = new Color(255, 215, 0); - private static final Color OVERLAY_COLOR = new Color(255, 255, 255, 60); - private static final double DIAMETER = 26D; - private static final int OFFSET = 27; - - private final Client client; - private final StatusOrbsPlugin plugin; - private final TooltipManager tooltipManager; - - private long last = System.nanoTime(); - private double percentHp; - private double lastHp; - private double percentSpec; - private double lastSpec; - private double percentRun; - private double lastRun; - - private static Color brighter(int color) - { - float[] hsv = new float[3]; - Color.RGBtoHSB(color >>> 16, (color >> 8) & 0xFF, color & 0xFF, hsv); - return Color.getHSBColor(hsv[0], 1.f, 1.f); - } - - @Inject - public StatusOrbsOverlay(Client client, StatusOrbsPlugin plugin, TooltipManager tooltipManager) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - this.client = client; - this.plugin = plugin; - this.tooltipManager = tooltipManager; - } - - @Override - public Dimension render(Graphics2D g) - { - g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); - - long current = System.nanoTime(); - double ms = (current - last) / (double) 1000000; - - if (plugin.isShowHitpoints()) - { - if (lastHp == plugin.getHitpointsPercentage() && plugin.getHitpointsPercentage() != 0) - { - percentHp += ms * plugin.getHpPerMs(); - } - else - { - percentHp = plugin.getHitpointsPercentage(); - lastHp = plugin.getHitpointsPercentage(); - } - renderRegen(g, WidgetInfo.MINIMAP_HEALTH_ORB, percentHp, HITPOINTS_COLOR); - } - - if (plugin.isShowSpecial()) - { - if (client.getVar(VarPlayer.SPECIAL_ATTACK_ENABLED) == 1) - { - final Widget widget = client.getWidget(WidgetInfo.MINIMAP_SPEC_ORB); - - if (widget != null && !widget.isHidden()) - { - final Rectangle bounds = widget.getBounds(); - g.setColor(OVERLAY_COLOR); - g.fillOval( - bounds.x + OFFSET, - bounds.y + (int) (bounds.height / 2 - (DIAMETER) / 2), - (int) DIAMETER, (int) DIAMETER); - } - } - - if (lastSpec == plugin.getSpecialPercentage() && plugin.getSpecialPercentage() != 0) - { - percentSpec += ms * plugin.getSpecPerMs(); - } - else - { - percentSpec = plugin.getSpecialPercentage(); - lastSpec = plugin.getSpecialPercentage(); - } - - renderRegen(g, WidgetInfo.MINIMAP_SPEC_ORB, percentSpec, SPECIAL_COLOR); - } - - final Widget runOrb = client.getWidget(WidgetInfo.MINIMAP_TOGGLE_RUN_ORB); - - if (runOrb == null || runOrb.isHidden()) - { - return null; - } - - final Rectangle bounds = runOrb.getBounds(); - - if (bounds.getX() <= 0) - { - return null; - } - - final Point mousePosition = client.getMouseCanvasPosition(); - - if (bounds.contains(mousePosition.getX(), mousePosition.getY())) - { - StringBuilder sb = new StringBuilder(); - sb.append("Weight: ").append(client.getWeight()).append(" kg
"); - - if (plugin.isReplaceOrbText()) - { - sb.append("Run Energy: ").append(client.getEnergy()).append("%"); - } - else - { - sb.append("Run Time Remaining: ").append(plugin.getEstimatedRunTimeRemaining(false)); - } - - int secondsUntil100 = plugin.getEstimatedRecoverTimeRemaining(); - if (secondsUntil100 > 0) - { - final int minutes = (int) Math.floor(secondsUntil100 / 60.0); - final int seconds = (int) Math.floor(secondsUntil100 - (minutes * 60.0)); - - sb.append("
").append("100% Energy In: ").append(minutes).append(':').append(StringUtils.leftPad(Integer.toString(seconds), 2, "0")); - } - - tooltipManager.add(new Tooltip(sb.toString())); - } - - if (plugin.isShowRun()) - { - if (lastRun == plugin.getRunPercentage() && plugin.getRunPercentage() != 0) - { - double recoverRate = (48 + client.getBoostedSkillLevel(Skill.AGILITY)) / 360000.0; - - recoverRate *= plugin.getRecoverRate(); - - percentRun += ms * recoverRate; - } - else - { - percentRun = plugin.getRunPercentage(); - lastRun = plugin.getRunPercentage(); - } - renderRegen(g, WidgetInfo.MINIMAP_RUN_ORB, percentRun, RUN_COLOR); - } - - last = current; - - return null; - } - - private void renderRegen(Graphics2D g, WidgetInfo widgetInfo, double percent, Color color) - { - Widget widget = client.getWidget(widgetInfo); - if (widget == null || widget.isHidden()) - { - return; - } - Rectangle bounds = widget.getBounds(); - - Arc2D.Double arc = new Arc2D.Double(bounds.x + OFFSET, bounds.y + (bounds.height / 2 - DIAMETER / 2), DIAMETER, DIAMETER, 90.d, -360.d * percent, Arc2D.OPEN); - final Stroke STROKE = new BasicStroke(2f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); - g.setStroke(STROKE); - g.setColor(color); - g.draw(arc); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/statusorbs/StatusOrbsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/statusorbs/StatusOrbsPlugin.java deleted file mode 100644 index f9063adcd9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/statusorbs/StatusOrbsPlugin.java +++ /dev/null @@ -1,452 +0,0 @@ -/* - * Copyright (c) 2019, Owain van Brakel - * Copyright (c) 2018, TheStonedTurtle - * Copyright (c) 2018 Abex - * Copyright (c) 2018, Zimaya - * Copyright (c) 2017, 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.statusorbs; - -import com.google.inject.Provides; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.Constants; -import net.runelite.api.GameState; -import net.runelite.api.InventoryID; -import net.runelite.api.Prayer; -import net.runelite.api.Skill; -import net.runelite.api.SpriteID; -import net.runelite.api.VarPlayer; -import net.runelite.api.Varbits; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.Notifier; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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.Graceful; -import net.runelite.client.util.ImageUtil; -import org.apache.commons.lang3.StringUtils; - -@PluginDescriptor( - name = "Status Orbs", - description = "Configure settings for the Minimap orbs", - tags = {"minimap", "orb", "regen", "energy", "special"}, - type = PluginType.UTILITY -) -public class StatusOrbsPlugin extends Plugin -{ - private static final BufferedImage HEART_DISEASE; - private static final BufferedImage HEART_POISON; - private static final BufferedImage HEART_VENOM; - - static - { - HEART_DISEASE = ImageUtil.resizeCanvas(ImageUtil.getResourceStreamFromClass(StatusOrbsPlugin.class, "1067-DISEASE.png"), 26, 26); - HEART_POISON = ImageUtil.resizeCanvas(ImageUtil.getResourceStreamFromClass(StatusOrbsPlugin.class, "1067-POISON.png"), 26, 26); - HEART_VENOM = ImageUtil.resizeCanvas(ImageUtil.getResourceStreamFromClass(StatusOrbsPlugin.class, "1067-VENOM.png"), 26, 26); - } - - private static final int SPEC_REGEN_TICKS = 50; - private static final int NORMAL_HP_REGEN_TICKS = 100; - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private StatusOrbsConfig config; - - @Inject - private StatusOrbsOverlay overlay; - - @Inject - private OverlayManager overlayManager; - - @Inject - private Notifier notifier; - - @Getter(AccessLevel.PACKAGE) - private double hitpointsPercentage; - - @Getter(AccessLevel.PACKAGE) - private double specialPercentage; - - @Getter(AccessLevel.PACKAGE) - private double runPercentage; - - @Getter(AccessLevel.PACKAGE) - private double hpPerMs; - - @Getter(AccessLevel.PACKAGE) - private double specPerMs = (double) 1 / (SPEC_REGEN_TICKS * 600); - - // RegenMeter - private int ticksSinceSpecRegen; - private int ticksSinceHPRegen; - private boolean wasRapidHeal; - private double ticksSinceRunRegen; - - // Run Energy - private int lastEnergy = 0; - private boolean localPlayerRunningToDestination; - private WorldPoint prevLocalPlayerLocation; - @Getter(AccessLevel.PACKAGE) - private double recoverRate = 1; - - private BufferedImage heart; - - private boolean dynamicHpHeart; - @Getter(AccessLevel.PACKAGE) - private boolean showHitpoints; - private boolean showWhenNoChange; - private int getNotifyBeforeHpRegenSeconds; - @Getter(AccessLevel.PACKAGE) - private boolean showSpecial; - @Getter(AccessLevel.PACKAGE) - private boolean showRun; - @Getter(AccessLevel.PACKAGE) - private boolean replaceOrbText; - - @Provides - StatusOrbsConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(StatusOrbsConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - if (this.dynamicHpHeart && client.getGameState().equals(GameState.LOGGED_IN)) - { - clientThread.invoke(this::checkHealthIcon); - } - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - localPlayerRunningToDestination = false; - prevLocalPlayerLocation = null; - resetRunOrbText(); - if (this.dynamicHpHeart) - { - clientThread.invoke(this::resetHealthIcon); - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("statusorbs")) - { - updateConfig(); - switch (event.getKey()) - { - case "replaceOrbText": - if (!this.replaceOrbText) - { - resetRunOrbText(); - } - break; - case "dynamicHpHeart": - if (this.dynamicHpHeart) - { - checkHealthIcon(); - } - else - { - resetHealthIcon(); - } - break; - } - } - } - - @Subscribe - private void onVarbitChanged(VarbitChanged e) - { - if (this.dynamicHpHeart) - { - checkHealthIcon(); - } - - boolean isRapidHeal = client.isPrayerActive(Prayer.RAPID_HEAL); - if (wasRapidHeal != isRapidHeal) - { - ticksSinceHPRegen = 0; - } - wasRapidHeal = isRapidHeal; - } - - @Subscribe - private void onGameStateChanged(GameStateChanged ev) - { - if (ev.getGameState() == GameState.HOPPING || ev.getGameState() == GameState.LOGIN_SCREEN) - { - ticksSinceHPRegen = -2; // For some reason this makes this accurate - ticksSinceSpecRegen = 0; - ticksSinceRunRegen = -1; - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - if (client.getVar(VarPlayer.SPECIAL_ATTACK_PERCENT) == 1000) - { - // The recharge doesn't tick when at 100% - ticksSinceSpecRegen = 0; - } - else - { - ticksSinceSpecRegen = (ticksSinceSpecRegen + 1) % SPEC_REGEN_TICKS; - } - specialPercentage = ticksSinceSpecRegen / (double) SPEC_REGEN_TICKS; - - int ticksPerHPRegen = NORMAL_HP_REGEN_TICKS; - hpPerMs = ticksPerHPRegen / (double) 6000000; - if (client.isPrayerActive(Prayer.RAPID_HEAL)) - { - ticksPerHPRegen /= 2; - hpPerMs *= 2; - } - - ticksSinceHPRegen = (ticksSinceHPRegen + 1) % ticksPerHPRegen; - hitpointsPercentage = ticksSinceHPRegen / (double) ticksPerHPRegen; - - int currentHP = client.getBoostedSkillLevel(Skill.HITPOINTS); - int maxHP = client.getRealSkillLevel(Skill.HITPOINTS); - if (currentHP == maxHP && !this.showWhenNoChange) - { - hitpointsPercentage = 0; - } - else if (currentHP > maxHP) - { - // Show it going down - hitpointsPercentage = 1 - hitpointsPercentage; - } - - // Run Energy - localPlayerRunningToDestination = - prevLocalPlayerLocation != null && - client.getLocalDestinationLocation() != null && - prevLocalPlayerLocation.distanceTo(client.getLocalPlayer().getWorldLocation()) > 1; - - if (this.getNotifyBeforeHpRegenSeconds > 0 && currentHP < maxHP && shouldNotifyHpRegenThisTick(ticksPerHPRegen)) - { - notifier.notify("[" + client.getLocalPlayer().getName() + "] regenerates their next hitpoint soon!"); - } - - localPlayerRunningToDestination = - prevLocalPlayerLocation != null && - client.getLocalDestinationLocation() != null && - prevLocalPlayerLocation.distanceTo(client.getLocalPlayer().getWorldLocation()) > 1; - - prevLocalPlayerLocation = client.getLocalPlayer().getWorldLocation(); - - recoverRate = Graceful.calculateRecoveryRate(client.getItemContainer(InventoryID.EQUIPMENT)); - - if (this.replaceOrbText) - { - setRunOrbText(getEstimatedRunTimeRemaining(true)); - } - - int currEnergy = client.getEnergy(); - WorldPoint currPoint = client.getLocalPlayer().getWorldLocation(); - if (currEnergy == 100 || (prevLocalPlayerLocation != null && currPoint.distanceTo(prevLocalPlayerLocation) > 1) || currEnergy < lastEnergy) - { - ticksSinceRunRegen = 0; - } - else if (currEnergy > lastEnergy) - { - if (runPercentage < 1) - { - ticksSinceRunRegen = (1 - runPercentage) / runRegenPerTick(); - ticksSinceRunRegen = ticksSinceRunRegen > 1 ? 1 : ticksSinceRunRegen; - } - else - { - ticksSinceRunRegen = (runPercentage - 1) / runRegenPerTick(); - } - } - else - { - ticksSinceRunRegen += 1; - } - runPercentage = ticksSinceRunRegen * runRegenPerTick(); - prevLocalPlayerLocation = currPoint; - lastEnergy = currEnergy; - } - - private boolean shouldNotifyHpRegenThisTick(int ticksPerHPRegen) - { - // if the configured duration lies between two ticks, choose the earlier tick - final int ticksBeforeHPRegen = ticksPerHPRegen - ticksSinceHPRegen; - final int notifyTick = (int) Math.ceil(this.getNotifyBeforeHpRegenSeconds * 1000d / Constants.GAME_TICK_LENGTH); - return ticksBeforeHPRegen == notifyTick; - } - - private void setRunOrbText(String text) - { - Widget runOrbText = client.getWidget(WidgetInfo.MINIMAP_RUN_ORB_TEXT); - - if (runOrbText != null) - { - runOrbText.setText(text); - } - } - - private void resetRunOrbText() - { - setRunOrbText(Integer.toString(client.getEnergy())); - } - - String getEstimatedRunTimeRemaining(boolean inSeconds) - { - // Calculate the amount of energy lost every 2 ticks (0.6 seconds). - // Negative weight has the same depletion effect as 0 kg. - final int effectiveWeight = Math.max(client.getWeight(), 0); - double lossRate = (Math.min(effectiveWeight, 64) / 100.0) + 0.64; - - if (client.getVar(Varbits.RUN_SLOWED_DEPLETION_ACTIVE) != 0) - { - lossRate *= 0.3; // Stamina effect reduces energy depletion to 30% - } - - // Calculate the number of seconds left - final double secondsLeft = (client.getEnergy() * 0.6) / lossRate; - - // Return the text - if (inSeconds) - { - return (int) Math.floor(secondsLeft) + "s"; - } - else - { - final int minutes = (int) Math.floor(secondsLeft / 60.0); - final int seconds = (int) Math.floor(secondsLeft - (minutes * 60.0)); - - return minutes + ":" + StringUtils.leftPad(Integer.toString(seconds), 2, "0"); - } - } - - int getEstimatedRecoverTimeRemaining() - { - if (localPlayerRunningToDestination) - { - return -1; - } - - // Calculate the amount of energy recovered every second - double recoverRate = (48 + client.getBoostedSkillLevel(Skill.AGILITY)) / 360.0; - recoverRate *= Graceful.calculateRecoveryRate(client.getItemContainer(InventoryID.EQUIPMENT)); - - // Calculate the number of seconds left - final double secondsLeft = (100 - client.getEnergy()) / recoverRate; - return (int) secondsLeft; - } - - /** - * Check player afflictions to determine health icon - */ - private void checkHealthIcon() - { - BufferedImage newHeart; - - int poison = client.getVar(VarPlayer.IS_POISONED); - if (poison >= 1000000) - { - newHeart = HEART_VENOM; - } - else if (poison > 0) - { - newHeart = HEART_POISON; - } - else if (client.getVar(VarPlayer.DISEASE_VALUE) > 0) - { - newHeart = HEART_DISEASE; - } - else - { - heart = null; - resetHealthIcon(); - return; - } - - // Only update sprites when the heart icon actually changes - if (newHeart != heart) - { - heart = newHeart; - client.getWidgetSpriteCache().reset(); - client.getSpriteOverrides().put(SpriteID.MINIMAP_ORB_HITPOINTS_ICON, ImageUtil.getImageSprite(heart, client)); - } - } - - private double runRegenPerTick() - { - double recoverRate = (client.getBoostedSkillLevel(Skill.AGILITY) / 6d + 8) / 100; - recoverRate *= Graceful.calculateRecoveryRate(client.getItemContainer(InventoryID.EQUIPMENT)); - - return recoverRate; - } - - /** - * Ensure the HP Heart is the default Sprite - */ - private void resetHealthIcon() - { - client.getWidgetSpriteCache().reset(); - client.getSpriteOverrides().remove(SpriteID.MINIMAP_ORB_HITPOINTS_ICON); - } - - private void updateConfig() - { - this.dynamicHpHeart = config.dynamicHpHeart(); - this.showHitpoints = config.showHitpoints(); - this.showWhenNoChange = config.showWhenNoChange(); - this.getNotifyBeforeHpRegenSeconds = config.getNotifyBeforeHpRegenSeconds(); - this.showSpecial = config.showSpecial(); - this.showRun = config.showRun(); - this.replaceOrbText = config.replaceOrbText(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/stealingartefacts/StealingArtefactsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/stealingartefacts/StealingArtefactsConfig.java deleted file mode 100644 index c8dfe66336..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/stealingartefacts/StealingArtefactsConfig.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2020, Dutta64 - * 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.stealingartefacts; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("stealingartefacts") -public interface StealingArtefactsConfig extends Config -{ - @ConfigItem( - keyName = "houseInfoBox", - name = "Display InfoBox", - description = "Shows the artefact house cardinal location.
See RuneLite plugin for generic InfoBox " + - "settings.", - position = 0 - ) - default boolean displayHouseInfoBox() - { - return true; - } - - @ConfigItem( - keyName = "displayHintArrow", - name = "Display Hint Arrow", - description = "Hint arrow pointing to the artefact house.", - position = 1 - ) - default boolean displayHintArrow() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/stealingartefacts/StealingArtefactsHouse.java b/runelite-client/src/main/java/net/runelite/client/plugins/stealingartefacts/StealingArtefactsHouse.java deleted file mode 100644 index e649fc2c94..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/stealingartefacts/StealingArtefactsHouse.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2020, Dutta64 - * 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.stealingartefacts; - -import java.util.Objects; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.api.coords.WorldPoint; - -@RequiredArgsConstructor -enum StealingArtefactsHouse -{ - NORTH("Northern", "North", new WorldPoint(1767, 3751, 0)), - NORTH_WESTERN("North-Western", "N.West", new WorldPoint(1750, 3763, 1)), - SOUTH("Southern", "South", new WorldPoint(1764, 3735, 1)), - SOUTH_EASTERN("South-Eastern", "S.East", new WorldPoint(1774, 3730, 1)), - SOUTH_WESTERN("South-Western", "S.West", new WorldPoint(1749, 3735, 1)), - WEST("Western", "West", new WorldPoint(1747, 3749, 1)), - CAPTAIN_KHALED("Captain Khaled", "N/A", new WorldPoint(1845, 3752, 0)); - - private final String name; - - @Getter(AccessLevel.PACKAGE) - private final String shortName; - - @Getter(AccessLevel.PACKAGE) - private final WorldPoint worldPoint; - - @Override - public String toString() - { - return this.name; - } - - public static StealingArtefactsHouse fromName(String name) - { - StealingArtefactsHouse stealingArtefactsHouse = null; - - for (StealingArtefactsHouse house : StealingArtefactsHouse.values()) - { - if (Objects.equals(house.name, name)) - { - stealingArtefactsHouse = house; - break; - } - } - - if (stealingArtefactsHouse == null) - { - throw new IllegalArgumentException(); - } - - return stealingArtefactsHouse; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/stealingartefacts/StealingArtefactsInfoBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/stealingartefacts/StealingArtefactsInfoBox.java deleted file mode 100644 index 6488669283..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/stealingartefacts/StealingArtefactsInfoBox.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2020, Dutta64 - * 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.stealingartefacts; - -import java.awt.Color; -import java.awt.image.BufferedImage; -import net.runelite.client.ui.overlay.infobox.InfoBox; -import net.runelite.client.ui.overlay.infobox.InfoBoxPriority; - -class StealingArtefactsInfoBox extends InfoBox -{ - private final StealingArtefactsPlugin stealingArtefactsPlugin; - - StealingArtefactsInfoBox(BufferedImage image, StealingArtefactsPlugin stealingArtefactsPlugin) - { - super(image, stealingArtefactsPlugin); - this.stealingArtefactsPlugin = stealingArtefactsPlugin; - setTooltip("Stealing Artefacts"); - setPriority(InfoBoxPriority.NONE); - } - - @Override - public String getText() - { - return stealingArtefactsPlugin.getStealingArtefactsHouse().getShortName(); - } - - @Override - public Color getTextColor() - { - return Color.CYAN; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/stealingartefacts/StealingArtefactsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/stealingartefacts/StealingArtefactsPlugin.java deleted file mode 100644 index 6fcff6bcee..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/stealingartefacts/StealingArtefactsPlugin.java +++ /dev/null @@ -1,468 +0,0 @@ -/* - * Copyright (c) 2020, Dutta64 - * 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.stealingartefacts; - -import com.google.inject.Provides; -import java.util.Objects; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.HintArrowType; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemID; -import net.runelite.api.NPC; -import net.runelite.api.Player; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; -import net.runelite.client.ui.overlay.worldmap.WorldMapPointManager; - -@PluginDescriptor( - name = "Stealing Artefacts", - description = "A plugin for the Stealing Artefacts minigame.", - tags = {"stealing", "artefacts", "artifacts", "thieving", "minigame", "zeah"}, - type = PluginType.MINIGAME, - enabledByDefault = false -) -@Slf4j -@Singleton -public class StealingArtefactsPlugin extends Plugin -{ - private static final String HOUSE_TEXT = "^You need to recover an artefact for me\\. It can be found in the " + - "([a-zA-Z\\-]+) house in the residential district over on the west side of town\\.$"; - - private static final String HOUSE_TEXT_PREFIX = HOUSE_TEXT.substring(1, 31); - - private static final Pattern HOUSE_TEXT_PATTERN = Pattern.compile(HOUSE_TEXT); - - private static final String CONFIG_GROUP_NAME = "stealingartefacts"; - - private static final String CONFIG_ITEM_NAME_INFOBOX = "houseInfoBox"; - - private static final String CONFIG_ITEM_NAME_HINT_ARROW = "displayHintArrow"; - - private static final String NPC_NAME_CAPTAIN_KHALED = "Captain Khaled"; - - private static final Set REGION_IDS = Set.of( - 6970, 6971, 7226, 7227 - ); - - private static final int REGION_ID_HOUSE = 6970; - - private static final int REGION_ID_CAPTAIN_KHALED = 7226; - - private static final Set ARTEFACTS = Set.of( - ItemID.STOLEN_PENDANT, - ItemID.STOLEN_GARNET_RING, - ItemID.STOLEN_CIRCLET, - ItemID.STOLEN_FAMILY_HEIRLOOM, - ItemID.STOLEN_JEWELRY_BOX - ); - - private boolean displayHouseInfoBox = false; - - private boolean displayHintArrow = false; - - @Getter(AccessLevel.PACKAGE) - private StealingArtefactsHouse stealingArtefactsHouse = StealingArtefactsHouse.CAPTAIN_KHALED; - - private StealingArtefactsInfoBox stealingArtefactsInfoBox; - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private ItemManager itemManager; - - @Inject - private WorldMapPointManager worldMapPointManager; - - @Inject - private StealingArtefactsConfig stealingArtefactsConfig; - - @Provides - StealingArtefactsConfig getStealingArtefactsConfig(ConfigManager configManager) - { - return configManager.getConfig(StealingArtefactsConfig.class); - } - - @Override - protected void startUp() - { - initConfig(); - - if (displayHouseInfoBox) - { - addHouseInfoBox(); - } - else - { - removeHouseInfoBox(); - } - - removeWorldMapPoint(); - removeHintArrow(); - - if (displayHintArrow) - { - addWorldMapPoint(); - addHintArrow(); - } - } - - @Override - protected void shutDown() - { - resetHouse(); - removeHouseInfoBox(); - removeWorldMapPoint(); - removeHintArrow(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals(CONFIG_GROUP_NAME)) - { - initConfig(); - - switch (event.getKey()) - { - case CONFIG_ITEM_NAME_INFOBOX: - if (displayHouseInfoBox) - { - addHouseInfoBox(); - } - else - { - removeHouseInfoBox(); - } - break; - case CONFIG_ITEM_NAME_HINT_ARROW: - removeWorldMapPoint(); - removeHintArrow(); - - if (displayHintArrow) - { - addWorldMapPoint(); - addHintArrow(); - } - break; - default: - break; - } - } - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded widgetLoaded) - { - if (isConfigSettingEnabled() && - widgetLoaded.getGroupId() == WidgetID.DIALOG_NPC_GROUP_ID && - isPlayerInRegion(REGION_ID_CAPTAIN_KHALED)) - { - clientThread.invokeLater(this::updateStealingArtefactsHouse); - } - } - - @Subscribe - private void onItemContainerChanged(ItemContainerChanged event) - { - if (isConfigSettingEnabled() && - !stealingArtefactsHouse.equals(StealingArtefactsHouse.CAPTAIN_KHALED) && - event.getContainerId() == InventoryID.INVENTORY.getId() && - isPlayerInRegion(REGION_ID_HOUSE) && - containsArtefact(event.getItemContainer())) - { - resetHouse(); - removeWorldMapPoint(); - removeHintArrow(); - - if (displayHintArrow) - { - addWorldMapPoint(); - addHintArrow(); - } - } - } - - @Subscribe - private void onNpcSpawned(NpcSpawned event) - { - NPC npc = event.getNpc(); - - if (displayHintArrow && - Objects.equals(npc.getName(), NPC_NAME_CAPTAIN_KHALED) && - stealingArtefactsHouse.equals(StealingArtefactsHouse.CAPTAIN_KHALED) && - !client.getHintArrowType().equals(HintArrowType.NPC)) - { - removeHintArrow(); - client.setHintArrow(npc); - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (displayHintArrow && event.getGameState().equals(GameState.LOGGED_IN)) - { - removeWorldMapPoint(); - removeHintArrow(); - addWorldMapPoint(); - addHintArrow(); - } - } - - private void initConfig() - { - displayHouseInfoBox = stealingArtefactsConfig.displayHouseInfoBox(); - displayHintArrow = stealingArtefactsConfig.displayHintArrow(); - } - - /** - * Parses any existing npc dialog widget text and updates the artefact house and hint arrows if applicable. - */ - private void updateStealingArtefactsHouse() - { - Widget widgetDialogNpcText = client.getWidget(WidgetInfo.DIALOG_NPC_TEXT); - - if (widgetDialogNpcText == null) - { - return; - } - - String text = widgetDialogNpcText.getText(); - - if (!text.startsWith(HOUSE_TEXT_PREFIX)) - { - return; - } - - StealingArtefactsHouse stealingArtefactsHouse = - getStealingArtefactsHouseFromNpcDialogText(Text.sanitizeMultilineText(text)); - - if (stealingArtefactsHouse == null) - { - return; - } - - this.stealingArtefactsHouse = stealingArtefactsHouse; - - removeWorldMapPoint(); - removeHintArrow(); - - if (displayHintArrow) - { - addWorldMapPoint(); - addHintArrow(); - } - } - - private StealingArtefactsHouse getStealingArtefactsHouseFromNpcDialogText(String text) - { - StealingArtefactsHouse stealingArtefactsHouse = null; - - Matcher matcher = HOUSE_TEXT_PATTERN.matcher(text); - - if (matcher.find()) - { - String houseName = matcher.group(1); - - try - { - stealingArtefactsHouse = StealingArtefactsHouse.fromName(houseName); - } - catch (IllegalArgumentException e) - { - log.debug("Unsupported StealingArtefactsHouse name: {}", houseName); - } - } - - return stealingArtefactsHouse; - } - - private boolean containsArtefact(ItemContainer itemContainer) - { - boolean containsArtefact = false; - - for (Item item : itemContainer.getItems()) - { - int itemId = item.getId(); - - if (ARTEFACTS.contains(itemId)) - { - containsArtefact = true; - break; - } - } - - return containsArtefact; - } - - private void addHouseInfoBox() - { - if (stealingArtefactsInfoBox == null) - { - stealingArtefactsInfoBox = new StealingArtefactsInfoBox(itemManager.getImage(ItemID.HAIR_CLIP), this); - infoBoxManager.addInfoBox(stealingArtefactsInfoBox); - } - } - - private void removeHouseInfoBox() - { - if (stealingArtefactsInfoBox != null) - { - infoBoxManager.removeInfoBox(stealingArtefactsInfoBox); - stealingArtefactsInfoBox = null; - } - } - - private void addHintArrow() - { - if (stealingArtefactsHouse == StealingArtefactsHouse.CAPTAIN_KHALED) - { - for (NPC npc : client.getCachedNPCs()) - { - if (npc == null) - { - continue; - } - - if (Objects.equals(npc.getName(), NPC_NAME_CAPTAIN_KHALED)) - { - client.setHintArrow(npc); - return; - } - } - } - - client.setHintArrow(stealingArtefactsHouse.getWorldPoint()); - } - - private void removeHintArrow() - { - if (client.hasHintArrow()) - { - client.clearHintArrow(); - } - } - - private void addWorldMapPoint() - { - if (isPlayerInStealingArtefactsRegion()) - { - StealingArtefactsWorldMapPoint stealingArtefactsWorldMapPoint = - new StealingArtefactsWorldMapPoint(stealingArtefactsHouse.getWorldPoint(), - itemManager.getImage(ItemID.HAIR_CLIP)); - - stealingArtefactsWorldMapPoint.setTooltip(stealingArtefactsHouse.toString()); - - worldMapPointManager.add(stealingArtefactsWorldMapPoint); - } - } - - private void removeWorldMapPoint() - { - worldMapPointManager.removeIf(StealingArtefactsWorldMapPoint.class::isInstance); - } - - private boolean isPlayerInStealingArtefactsRegion() - { - Player player = client.getLocalPlayer(); - - if (player == null) - { - return false; - } - - WorldPoint worldPoint = player.getWorldLocation(); - - if (worldPoint == null) - { - return false; - } - - return REGION_IDS.contains(worldPoint.getRegionID()); - } - - private boolean isPlayerInRegion(int regionId) - { - Player player = client.getLocalPlayer(); - - if (player == null) - { - return false; - } - - WorldPoint worldPoint = player.getWorldLocation(); - - if (worldPoint == null) - { - return false; - } - - return worldPoint.getRegionID() == regionId; - } - - private boolean isConfigSettingEnabled() - { - return displayHouseInfoBox || displayHintArrow; - } - - private void resetHouse() - { - stealingArtefactsHouse = StealingArtefactsHouse.CAPTAIN_KHALED; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/stealingartefacts/StealingArtefactsWorldMapPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/stealingartefacts/StealingArtefactsWorldMapPoint.java deleted file mode 100644 index 203674aeb5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/stealingartefacts/StealingArtefactsWorldMapPoint.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2020, Dutta64 - * 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.stealingartefacts; - -import java.awt.Graphics; -import java.awt.image.BufferedImage; -import net.runelite.api.Point; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; -import net.runelite.client.util.ImageUtil; - -class StealingArtefactsWorldMapPoint extends WorldMapPoint -{ - private static BufferedImage cachedMapArrowImage; - - private final BufferedImage hairClipImage; - private final BufferedImage artefactWorldMapImage; - - private final Point artefactWorldMapPoint; - - StealingArtefactsWorldMapPoint(WorldPoint worldPoint, BufferedImage bufferedImage) - { - super(worldPoint, null); - - hairClipImage = bufferedImage; - - BufferedImage mapArrowImage = getCachedMapArrowImage(); - - artefactWorldMapImage = new BufferedImage(mapArrowImage.getWidth(), mapArrowImage.getHeight(), - BufferedImage.TYPE_INT_ARGB); - - Graphics graphics = artefactWorldMapImage.getGraphics(); - graphics.drawImage(mapArrowImage, 0, 0, null); - graphics.drawImage(hairClipImage, 0, 0, null); - - artefactWorldMapPoint = new Point(artefactWorldMapImage.getWidth() / 2, artefactWorldMapImage.getHeight()); - - this.setSnapToEdge(true); - this.setJumpOnClick(true); - this.setImage(artefactWorldMapImage); - this.setImagePoint(artefactWorldMapPoint); - } - - @Override - public void onEdgeSnap() - { - this.setImage(hairClipImage); - this.setImagePoint(null); - } - - @Override - public void onEdgeUnsnap() - { - this.setImage(artefactWorldMapImage); - this.setImagePoint(artefactWorldMapPoint); - } - - private static BufferedImage getCachedMapArrowImage() - { - if (cachedMapArrowImage == null) - { - cachedMapArrowImage = ImageUtil.getResourceStreamFromClass(StealingArtefactsWorldMapPoint.class, "/util" + - "/clue_arrow.png"); - } - - return cachedMapArrowImage; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ItemSortTypes.java b/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ItemSortTypes.java deleted file mode 100644 index e57b69e66f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ItemSortTypes.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.runelite.client.plugins.stonedtracker; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter(AccessLevel.PACKAGE) -@RequiredArgsConstructor -public enum ItemSortTypes -{ - ALPHABETICAL("Alphabetical"), - ITEM_ID("Item ID"), - VALUE("Value"), - PRICE("Price"); - - private final String name; - - @Override - public String toString() - { - return name; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/StonedTrackerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/StonedTrackerConfig.java deleted file mode 100644 index cd2df32b82..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/StonedTrackerConfig.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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.stonedtracker; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("stonedtracker") -public interface StonedTrackerConfig extends Config -{ - @ConfigItem( - position = 0, - keyName = "hideUniques", - name = "Hide uniques", - description = "Hides unique items from the item breakdown" - ) - default boolean hideUniques() - { - return true; - } - - @ConfigItem( - position = 1, - keyName = "itemSortType", - name = "Sort Items by", - description = "Sorts items by the requested value inside the UI. (Doesn't effect session/box view)" - ) - default ItemSortTypes itemSortType() - { - return ItemSortTypes.ALPHABETICAL; - } - - @ConfigItem( - position = 2, - keyName = "itemBreakdown", - name = "Breakdown individual items", - description = "Toggles whether the Individual item UI should be used inside npc-specific tabs" - ) - default boolean itemBreakdown() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "bossButtons", - name = "Show boss icons", - description = "Toggles whether the selection screen will use the boss icons" - ) - default boolean bossButtons() - { - return true; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/StonedTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/StonedTrackerPlugin.java deleted file mode 100644 index b6246f1b02..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/StonedTrackerPlugin.java +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (c) 2018, Psikoi - * Copyright (c) 2018, 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.stonedtracker; - -import com.google.inject.Provides; -import java.awt.image.BufferedImage; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; -import javax.inject.Inject; -import javax.swing.SwingUtilities; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.ItemDefinition; -import net.runelite.api.NpcID; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.loottracker.localstorage.LTItemEntry; -import net.runelite.client.plugins.loottracker.localstorage.LTRecord; -import net.runelite.client.plugins.loottracker.localstorage.LootRecordWriter; -import net.runelite.client.plugins.loottracker.localstorage.events.LTNameChange; -import net.runelite.client.plugins.loottracker.localstorage.events.LTRecordStored; -import net.runelite.client.plugins.stonedtracker.data.BossTab; -import net.runelite.client.plugins.stonedtracker.data.UniqueItem; -import net.runelite.client.plugins.stonedtracker.ui.LootTrackerPanel; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.util.ImageUtil; - -@PluginDescriptor( - name = "Stoned Tracker", - description = "Local data persistence and unique UI for the Loot Tracker.", - tags = {"Stoned", "Loot", "Tracker"}, - type = PluginType.MISCELLANEOUS -) -@Slf4j -public class StonedTrackerPlugin extends Plugin -{ - private static final String SIRE_FONT_TEXT = "you place the unsired into the font of consumption..."; - private static final String SIRE_REWARD_TEXT = "the font consumes the unsired"; - - @Inject - private ClientToolbar clientToolbar; - - @Inject - public StonedTrackerConfig config; - - @Inject - private Client client; - - @Inject - private ItemManager itemManager; - - @Inject - private ClientThread clientThread; - - @Inject - private LootRecordWriter writer; - - @Inject - private EventBus eventBus; - - private LootTrackerPanel panel; - private NavigationButton navButton; - @Getter - private Set lootNames = new TreeSet<>(); - - private boolean loaded = false; - private boolean unsiredReclaiming = false; - - @Provides - StonedTrackerConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(StonedTrackerConfig.class); - } - - private void onLTRecordStored(final LTRecordStored s) - { - final LTRecord record = s.getRecord(); - lootNames.add(record.getName()); - SwingUtilities.invokeLater(() -> panel.addLog(record)); - } - - private void onLTNameChange(final LTNameChange c) - { - lootNames = new TreeSet<>(writer.getKnownFileNames()); - SwingUtilities.invokeLater(() -> panel.showSelectionView()); - } - - @Subscribe - private void onConfigChanged(final ConfigChanged event) - { - if (event.getGroup().equals("stonedtracker")) - { - panel.refreshUI(); - } - } - - @Override - protected void startUp() - { - - panel = new LootTrackerPanel(itemManager, this); - - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "panel-icon.png"); - - navButton = NavigationButton.builder() - .tooltip("Stoned Tracker") - .icon(icon) - .priority(5) - .panel(panel) - .build(); - - clientToolbar.addNavigation(navButton); - - // Attach necessary info from item manager on load - if (!loaded) - { - loaded = true; - clientThread.invokeLater(() -> - { - switch (client.getGameState()) - { - case UNKNOWN: - case STARTING: - loaded = false; - return false; - } - - UniqueItem.prepareUniqueItems(itemManager); - return true; - }); - } - } - - @Override - protected void shutDown() - { - clientToolbar.removeNavigation(navButton); - } - - private void addSubscriptions() - { - this.eventBus.subscribe(LTRecordStored.class, this, this::onLTRecordStored); - this.eventBus.subscribe(LTNameChange.class, this, this::onLTNameChange); - this.eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded); - this.eventBus.subscribe(GameTick.class, this, this::onGameTick); - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded event) - { - if (event.getGroupId() != WidgetID.DIALOG_SPRITE_GROUP_ID) - { - return; - } - - Widget text = client.getWidget(WidgetInfo.DIALOG_SPRITE_TEXT); - if (SIRE_FONT_TEXT.equals(text.getText().toLowerCase())) - { - unsiredReclaiming = true; - } - } - - @Subscribe - private void onGameTick(GameTick t) - { - if (unsiredReclaiming) - { - checkUnsiredWidget(); - } - } - - // Handles checking for unsired loot reclamation - private void checkUnsiredWidget() - { - log.info("Checking for text widget change..."); - Widget text = client.getWidget(WidgetInfo.DIALOG_SPRITE_TEXT); - if (text.getText().toLowerCase().contains(SIRE_REWARD_TEXT)) - { - unsiredReclaiming = false; - log.info("Text widget changed, reclaimed an item"); - Widget sprite = client.getWidget(WidgetInfo.DIALOG_SPRITE); - log.info("Sprite Item ID: {}", sprite.getItemId()); - receivedUnsiredLoot(sprite.getItemId()); - } - else - { - log.info("Old text still..."); - } - } - - // Handles adding the unsired loot to the tracker - private void receivedUnsiredLoot(int itemID) - { - clientThread.invokeLater(() -> - { - Collection data = getDataByName("Abyssal sire"); - ItemDefinition c = itemManager.getItemDefinition(itemID); - LTItemEntry itemEntry = new LTItemEntry(c.getName(), itemID, 1, 0); - - log.debug("Received Unsired item: {}", c.getName()); - - // Don't have data for sire, create a new record with just this data. - if (data == null) - { - log.debug("No previous Abyssal sire loot, creating new loot record"); - LTRecord r = new LTRecord(NpcID.ABYSSAL_SIRE, "Abyssal sire", 350, -1, Collections.singletonList(itemEntry)); - writer.addLootTrackerRecord(r); - return; - } - - log.debug("Adding drop to last abyssal sire loot record"); - // Add data to last kill count - List items = new ArrayList<>(data); - LTRecord r = items.get(items.size() - 1); - r.addDropEntry(itemEntry); - writer.writeLootTrackerFile("Abyssal sire", items); - // Write will trigger event this plugin is subscribed too - }); - } - - public Collection getDataByName(String name) - { - final BossTab tab = BossTab.getByName(name); - if (tab != null) - { - name = tab.getName(); - } - - return writer.loadLootTrackerRecords(name); - } - - public boolean clearStoredDataByName(final String name) - { - lootNames.remove(name); - return writer.deleteLootTrackerRecords(name); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/data/BossTab.java b/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/data/BossTab.java deleted file mode 100644 index 5f8313ed16..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/data/BossTab.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * 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.stonedtracker.data; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.Multimap; -import java.util.Collection; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; -import javax.annotation.Nullable; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.ItemID; - -@Getter(AccessLevel.PUBLIC) -@AllArgsConstructor -public enum BossTab -{ - // Chest Rewards - BARROWS("Barrows", ItemID.BARROWS_TELEPORT, "Other"), - CHAMBERS_OF_XERIC("Chambers of Xeric", ItemID.OLMLET, "Other"), - THEATRE_OF_BLOOD("Theatre of Blood", ItemID.LIL_ZIK, "Other"), - - // Loot received on NPC death - ZULRAH("Zulrah", ItemID.PET_SNAKELING, "Other"), - VORKATH("Vorkath", ItemID.VORKI, "Other"), - - // God wars dungeon - KREEARRA("Kree'arra", ItemID.PET_KREEARRA, "God Wars Dungeon"), - GENERAL_GRAARDOR("General Graardor", ItemID.PET_GENERAL_GRAARDOR, "God Wars Dungeon"), - COMMANDER_ZILYANA("Commander Zilyana", ItemID.PET_ZILYANA, "God Wars Dungeon"), - KRIL_TSUTSAROTH("K'ril Tsutsaroth", ItemID.PET_KRIL_TSUTSAROTH, "God Wars Dungeon"), - - // Wildy Bosses - VETION("Vet'ion Reborn", ItemID.VETION_JR, "Wilderness"), - VENENATIS("Venenatis", ItemID.VENENATIS_SPIDERLING, "Wilderness"), - CALLISTO("Callisto", ItemID.CALLISTO_CUB, "Wilderness"), - CHAOS_ELEMENTAL("Chaos Elemental", ItemID.PET_CHAOS_ELEMENTAL, "Wilderness"), - // Wildy Demi-Bosses - SCORPIA("Scorpia", ItemID.SCORPIAS_OFFSPRING, "Wilderness"), - CHAOS_FANATIC("Chaos Fanatic", ItemID.ANCIENT_STAFF, "Wilderness"), - CRAZY_ARCHAEOLOGIST("Crazy Archaeologist", ItemID.FEDORA, "Wilderness"), - // Wildy Other - KING_BLACK_DRAGON("King Black Dragon", ItemID.PRINCE_BLACK_DRAGON, "Wilderness"), - - // Slayer Bosses - KALPHITE_QUEEN("Kalphite Queen", ItemID.KALPHITE_PRINCESS, "Other"), - SKOTIZO("Skotizo", ItemID.SKOTOS, "Slayer"), - GROTESQUE_GUARDIANS("Dusk", ItemID.NOON, "Slayer"), - ABYSSAL_SIRE("Abyssal Sire", ItemID.ABYSSAL_ORPHAN, "Slayer"), - KRAKEN("Kraken", ItemID.PET_KRAKEN, "Slayer"), - CERBERUS("Cerberus", ItemID.HELLPUPPY, "Slayer"), - THERMONUCLEAR_SMOKE_DEVIL("Thermonuclear smoke devil", ItemID.PET_SMOKE_DEVIL, "Slayer"), - ALCHEMICAL_HYDRA("Alchemical Hydra", ItemID.IKKLE_HYDRA, "Slayer"), - - // Other Bosses - GIANT_MOLE("Giant Mole", ItemID.BABY_MOLE, "Other"), - CORPOREAL_BEAST("Corporeal Beast", ItemID.PET_CORPOREAL_CRITTER, "Other"), - SARACHNIS("Sarachnis", ItemID.SRARACHA, "Other"), - THE_GAUNTLET("The Gauntlet", ItemID.YOUNGLLEF, "Other"), - ZALCANO("Zalcano", ItemID.SMOLCANO, "Other"), - - // Skilling - WINTERTODT("Wintertodt", ItemID.PHOENIX, "Skilling"), - HERBIBOAR("Herbiboar", ItemID.HERBI, "Skilling"), - - // Chests - BRIMSTONE_CHEST("Brimstone Chest", ItemID.BRIMSTONE_KEY, "Chests"), - CRYSTAL_CHEST("Crystal Chest", ItemID.CRYSTAL_KEY, "Chests"), - LARRANS_BIG_CHEST("Larran's big chest", ItemID.LARRANS_KEY, "Chests"), - LARRENS_SMALL_CHEST("Larran's small chest", ItemID.LARRANS_KEY, "Chests"), - ELVEN_CRYSTAL_CHEST("Elven Crystal Chest", ItemID.ENHANCED_CRYSTAL_KEY, "Chests"), - - // Dagannoth Kings - DAGANNOTH_REX("Dagannoth Rex", ItemID.PET_DAGANNOTH_REX, "Dagannoth Kings"), - DAGANNOTH_PRIME("Dagannoth Prime", ItemID.PET_DAGANNOTH_PRIME, "Dagannoth Kings"), - DAGANNOTH_SUPREME("Dagannoth Supreme", ItemID.PET_DAGANNOTH_SUPREME, "Dagannoth Kings"), - - // Clue scrolls - CLUE_SCROLL_BEGINNER("Clue Scroll (Beginner)", ItemID.CLUE_SCROLL_BEGINNER, "Clue Scrolls"), - CLUE_SCROLL_EASY("Clue Scroll (Easy)", ItemID.CLUE_SCROLL_EASY, "Clue Scrolls"), - CLUE_SCROLL_MEDIUM("Clue Scroll (Medium)", ItemID.CLUE_SCROLL_MEDIUM, "Clue Scrolls"), - CLUE_SCROLL_HARD("Clue Scroll (Hard)", ItemID.CLUE_SCROLL_HARD, "Clue Scrolls"), - CLUE_SCROLL_ELITE("Clue Scroll (Elite)", ItemID.CLUE_SCROLL_ELITE, "Clue Scrolls"), - CLUE_SCROLL_MASTER("Clue Scroll (Master)", ItemID.CLUE_SCROLL_MASTER, "Clue Scrolls"); - - private static final Map NAME_MAP; - private static final Multimap CATEGORY_MAP; - - static - { - final ImmutableMap.Builder byName = ImmutableMap.builder(); - final ImmutableMultimap.Builder categoryMap = ImmutableMultimap.builder(); - - for (BossTab tab : values()) - { - byName.put(tab.getName().toUpperCase(), tab); - categoryMap.put(tab.getCategory(), tab); - } - - NAME_MAP = byName.build(); - CATEGORY_MAP = categoryMap.build(); - } - - private final String name; - private final int itemID; - private final String category; - - @Nullable - public static BossTab getByName(final String name) - { - return NAME_MAP.get(name.toUpperCase()); - } - - public static Collection getByCategoryName(final String name) - { - return CATEGORY_MAP.get(name); - } - - public static Set getCategories() - { - return new TreeSet<>(CATEGORY_MAP.keySet()); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/data/UniqueItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/data/UniqueItem.java deleted file mode 100644 index 1857023ed1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/data/UniqueItem.java +++ /dev/null @@ -1,940 +0,0 @@ -/* - * 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.stonedtracker.data; - -import com.google.common.collect.ImmutableMultimap; -import java.util.Collection; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; -import net.runelite.api.ItemDefinition; -import net.runelite.api.ItemID; -import net.runelite.client.game.ItemManager; - -@RequiredArgsConstructor -@Getter(AccessLevel.PUBLIC) -public enum UniqueItem -{ - // "Uniques" which are actually dropped by multiple bosses - // God Wars - GODSWORD_SHARD_1(ItemID.GODSWORD_SHARD_1, BossTab.KREEARRA, BossTab.GENERAL_GRAARDOR, BossTab.COMMANDER_ZILYANA, BossTab.KRIL_TSUTSAROTH), - GODSWORD_SHARD_2(ItemID.GODSWORD_SHARD_2, BossTab.KREEARRA, BossTab.GENERAL_GRAARDOR, BossTab.COMMANDER_ZILYANA, BossTab.KRIL_TSUTSAROTH), - GODSWORD_SHARD_3(ItemID.GODSWORD_SHARD_3, BossTab.KREEARRA, BossTab.GENERAL_GRAARDOR, BossTab.COMMANDER_ZILYANA, BossTab.KRIL_TSUTSAROTH), - // Wildy - PET_CHAOS_ELEMENTAL(ItemID.PET_CHAOS_ELEMENTAL, BossTab.CHAOS_ELEMENTAL, BossTab.CHAOS_FANATIC), - // MYSTERIOUS_EMBLEM(BossTab.MYSTERIOUS_EMBLEM, ItemID.MYSTERIOUS_EMBLEM, BossTab.), - CURVED_BONE(ItemID.CURVED_BONE, BossTab.CALLISTO, BossTab.VETION, BossTab.VENENATIS, BossTab.GIANT_MOLE), - DRAGON_PICKAXE(ItemID.DRAGON_PICKAXE, BossTab.CALLISTO, BossTab.VETION, BossTab.VENENATIS, BossTab.KING_BLACK_DRAGON), - DRAGON_2H_SWORD(ItemID.DRAGON_2H_SWORD, BossTab.CALLISTO, BossTab.VETION, BossTab.VENENATIS, BossTab.KALPHITE_QUEEN), - // Other - DRAGON_CHAINBODY(ItemID.DRAGON_CHAINBODY_3140, BossTab.THERMONUCLEAR_SMOKE_DEVIL, BossTab.KALPHITE_QUEEN), - DRAGON_AXE(ItemID.DRAGON_AXE, BossTab.DAGANNOTH_REX, BossTab.DAGANNOTH_PRIME, BossTab.DAGANNOTH_SUPREME, BossTab.WINTERTODT), - UNCUT_ONYX(ItemID.UNCUT_ONYX, BossTab.ZULRAH, BossTab.SKOTIZO, BossTab.ZALCANO), - - // Unique Items - // Barrows Uniques - // Ahrim - AHRIMS_HOOD(ItemID.AHRIMS_HOOD, BossTab.BARROWS, 0), - AHRIMS_ROBETOP(ItemID.AHRIMS_ROBETOP, BossTab.BARROWS, 0), - AHRIMS_ROBESKIRT(ItemID.AHRIMS_ROBESKIRT, BossTab.BARROWS, 0), - AHRIMS_STAFF(ItemID.AHRIMS_STAFF, BossTab.BARROWS, 0), - // Dharok - DHAROKS_HELM(ItemID.DHAROKS_HELM, BossTab.BARROWS, 1), - DHAROKS_PLATEBODY(ItemID.DHAROKS_PLATEBODY, BossTab.BARROWS, 1), - DHAROKS_PLATELEGS(ItemID.DHAROKS_PLATELEGS, BossTab.BARROWS, 1), - DHAROKS_GREATAXE(ItemID.DHAROKS_GREATAXE, BossTab.BARROWS, 1), - // Guthans - GUTHANS_HELM(ItemID.GUTHANS_HELM, BossTab.BARROWS, 2), - GUTHANS_PLATEBODY(ItemID.GUTHANS_PLATEBODY, BossTab.BARROWS, 2), - GUTHANS_CHAINSKIRT(ItemID.GUTHANS_CHAINSKIRT, BossTab.BARROWS, 2), - GUTHANS_WARSPEAR(ItemID.GUTHANS_WARSPEAR, BossTab.BARROWS, 2), - // Karils - KARILS_COIF(ItemID.KARILS_COIF, BossTab.BARROWS, 3), - KARILS_LEATHERTOP(ItemID.KARILS_LEATHERTOP, BossTab.BARROWS, 3), - KARILS_LEATHERSKIRT(ItemID.KARILS_LEATHERSKIRT, BossTab.BARROWS, 3), - KARILS_CROSSBOW(ItemID.KARILS_CROSSBOW, BossTab.BARROWS, 3), - //Torag - TORAGS_HELM(ItemID.TORAGS_HELM, BossTab.BARROWS, 4), - TORAGS_PLATEBODY(ItemID.TORAGS_PLATEBODY, BossTab.BARROWS, 4), - TORAGS_PLATELEGS(ItemID.TORAGS_PLATELEGS, BossTab.BARROWS, 4), - TORAGS_HAMMERS(ItemID.TORAGS_HAMMERS, BossTab.BARROWS, 4), - // Veracs - VERACS_HELM(ItemID.VERACS_HELM, BossTab.BARROWS, 5), - VERACS_BRASSARD(ItemID.VERACS_BRASSARD, BossTab.BARROWS, 5), - VERACS_PLATESKIRT(ItemID.VERACS_PLATESKIRT, BossTab.BARROWS, 5), - VERACS_FLAIL(ItemID.VERACS_FLAIL, BossTab.BARROWS, 5), - - // Raids Uniques - // Mage - KODAI_INSIGNIA(ItemID.KODAI_INSIGNIA, BossTab.CHAMBERS_OF_XERIC, 0), - ANCESTRAL_HAT(ItemID.ANCESTRAL_HAT, BossTab.CHAMBERS_OF_XERIC, 0), - ANCESTRAL_ROBE_TOP(ItemID.ANCESTRAL_ROBE_TOP, BossTab.CHAMBERS_OF_XERIC, 0), - ANCESTRAL_ROBE_BOTTOM(ItemID.ANCESTRAL_ROBE_BOTTOM, BossTab.CHAMBERS_OF_XERIC, 0), - // Range - DRAGON_HUNTER_CROSSBOW(ItemID.DRAGON_HUNTER_CROSSBOW, BossTab.CHAMBERS_OF_XERIC, 1), - TWISTED_BUCKLER(ItemID.TWISTED_BUCKLER, BossTab.CHAMBERS_OF_XERIC, 1), - TWISTED_BOW(ItemID.TWISTED_BOW, BossTab.CHAMBERS_OF_XERIC, 1), - // Melee - DRAGON_CLAWS(ItemID.DRAGON_CLAWS, BossTab.CHAMBERS_OF_XERIC, 2), - DINHS_BULWARK(ItemID.DINHS_BULWARK, BossTab.CHAMBERS_OF_XERIC, 2), - ELDER_MAUL(ItemID.ELDER_MAUL, BossTab.CHAMBERS_OF_XERIC, 2), - // Prayers/Other - TORN_PRAYER_SCROLL(ItemID.TORN_PRAYER_SCROLL, BossTab.CHAMBERS_OF_XERIC, 3), - ARCANE_PRAYER_SCROLL(ItemID.ARCANE_PRAYER_SCROLL, BossTab.CHAMBERS_OF_XERIC, 3), - DEXTEROUS_PRAYER_SCROLL(ItemID.DEXTEROUS_PRAYER_SCROLL, BossTab.CHAMBERS_OF_XERIC, 3), - DARK_RELIC(ItemID.DARK_RELIC, BossTab.CHAMBERS_OF_XERIC, 3), - - // Raids 2 Unqiues (Theater of Blood) - // Weapons / Pet - GHRAZI_RAPIER(ItemID.GHRAZI_RAPIER, BossTab.THEATRE_OF_BLOOD, 0), - SCYTHE_OF_VITUR_UNCHARGED(ItemID.SCYTHE_OF_VITUR_UNCHARGED, BossTab.THEATRE_OF_BLOOD, 0), - SANGUINESTI_STAFF_UNCHAGRED(ItemID.SANGUINESTI_STAFF_UNCHARGED, BossTab.THEATRE_OF_BLOOD, 0), - LIL_ZIK(ItemID.LIL_ZIK, BossTab.THEATRE_OF_BLOOD, 0), - // Armor - AVERNIC_DEFENDER_HILT(ItemID.AVERNIC_DEFENDER_HILT, BossTab.THEATRE_OF_BLOOD, 1), - JUSTICIAR_FACEGUARD(ItemID.JUSTICIAR_FACEGUARD, BossTab.THEATRE_OF_BLOOD, 1), - JUSTICIAR_CHESTGUARD(ItemID.JUSTICIAR_CHESTGUARD, BossTab.THEATRE_OF_BLOOD, 1), - JUSTICIAR_LEGGUARDS(ItemID.JUSTICIAR_LEGGUARDS, BossTab.THEATRE_OF_BLOOD, 1), - - // Zulrah - // Uniques - TANZANITE_FANG(ItemID.TANZANITE_FANG, BossTab.ZULRAH, -1), - MAGIC_FANG(ItemID.MAGIC_FANG, BossTab.ZULRAH, -1), - SERPENTINE_VISAGE(ItemID.SERPENTINE_VISAGE, BossTab.ZULRAH, -1), - // Rares - PET_SNAKELING(ItemID.PET_SNAKELING, BossTab.ZULRAH, 0), - TANZANITE_MUTAGEN(ItemID.TANZANITE_MUTAGEN, BossTab.ZULRAH, 0), - MAGMA_MUTAGEN(ItemID.MAGMA_MUTAGEN, BossTab.ZULRAH, 0), - JAR_OF_SWAMP(ItemID.JAR_OF_SWAMP, BossTab.ZULRAH, 0), - - // Vorkath - DRAGONBONE_NECKLACE(ItemID.DRAGONBONE_NECKLACE, BossTab.VORKATH, 0), - VORKATHS_HEAD(ItemID.VORKATHS_HEAD_21907, BossTab.VORKATH, 0), - JAR_OF_DECAY(ItemID.JAR_OF_DECAY, BossTab.VORKATH, 0), - VORKI(ItemID.VORKI, BossTab.VORKATH, 0), - SKELETAL_VISAGE(ItemID.SKELETAL_VISAGE, BossTab.VORKATH, 0), - - - // God Wars Dungeon - // Kreearra (Armadyl) - ARMADYL_HELMET(ItemID.ARMADYL_HELMET, BossTab.KREEARRA, 0), - ARMADYL_CHESTPLATE(ItemID.ARMADYL_CHESTPLATE, BossTab.KREEARRA, 0), - ARMADYL_CHAINSKIRT(ItemID.ARMADYL_CHAINSKIRT, BossTab.KREEARRA, 0), - ARMADYL_HILT(ItemID.ARMADYL_HILT, BossTab.KREEARRA, 0), - PET_KREEARRA(ItemID.PET_KREEARRA, BossTab.KREEARRA, -1), - // General Graardor (Bandos) - BANDOS_CHESTPLATE(ItemID.BANDOS_CHESTPLATE, BossTab.GENERAL_GRAARDOR, 0), - BANDOS_TASSETS(ItemID.BANDOS_TASSETS, BossTab.GENERAL_GRAARDOR, 0), - BANDOS_BOOTS(ItemID.BANDOS_BOOTS, BossTab.GENERAL_GRAARDOR, 0), - BANDOS_HILT(ItemID.BANDOS_HILT, BossTab.GENERAL_GRAARDOR, 0), - PET_GENERAL_GRAARDOR(ItemID.PET_GENERAL_GRAARDOR, BossTab.GENERAL_GRAARDOR, -1), - // Command Zilyana (Saradomin) - SARADOMIN_SWORD(ItemID.SARADOMIN_SWORD, BossTab.COMMANDER_ZILYANA, 0), - ARMADYL_CROSSBOW(ItemID.ARMADYL_CROSSBOW, BossTab.COMMANDER_ZILYANA, 0), - SARADOMINS_LIGHT(ItemID.SARADOMINS_LIGHT, BossTab.COMMANDER_ZILYANA, 0), - SARADOMIN_HILT(ItemID.SARADOMIN_HILT, BossTab.COMMANDER_ZILYANA, 0), - PET_ZILYANA(ItemID.PET_ZILYANA, BossTab.COMMANDER_ZILYANA, -1), - // Kril Tsutsaroth (Zammy) - STEAM_BATTLESTAFF(ItemID.STEAM_BATTLESTAFF, BossTab.KRIL_TSUTSAROTH, 0), - STAFF_OF_THE_DEAD(ItemID.STAFF_OF_THE_DEAD, BossTab.KRIL_TSUTSAROTH, 0), - ZAMORAKIAN_SPEAR(ItemID.ZAMORAKIAN_SPEAR, BossTab.KRIL_TSUTSAROTH, 0), - ZAMORAK_HILT(ItemID.ZAMORAK_HILT, BossTab.KRIL_TSUTSAROTH, 0), - PET_KRIL_TSUTSAROTH(ItemID.PET_KRIL_TSUTSAROTH, BossTab.KRIL_TSUTSAROTH, -1), - - - // Wildy Bosses - // Vetion - RING_OF_THE_GODS(ItemID.RING_OF_THE_GODS, BossTab.VETION, 0), - VETION_JR(ItemID.VETION_JR, BossTab.VETION, 0), - SKELETON_CHAMPION_SCROLL(ItemID.SKELETON_CHAMPION_SCROLL, BossTab.VETION, 0), - // Venenatis - TREASONOUS_RING(ItemID.TREASONOUS_RING, BossTab.VENENATIS, -1), - VENENATIS_SPIDERLING(ItemID.VENENATIS_SPIDERLING, BossTab.VENENATIS, -1), - // Callisto - TYRANNICAL_RING(ItemID.TYRANNICAL_RING, BossTab.CALLISTO, -1), - CALLISTO_CUB(ItemID.CALLISTO_CUB, BossTab.CALLISTO, -1), - // Chaos Elemental Uniques are all in Shared - // Chaos Fanatic - ODIUM_SHARD_1(ItemID.ODIUM_SHARD_1, BossTab.CHAOS_FANATIC, -1), - MALEDICTION_SHARD_1(ItemID.MALEDICTION_SHARD_1, BossTab.CHAOS_FANATIC, -1), - // Crazy Archaeologist - ODIUM_SHARD_2(ItemID.ODIUM_SHARD_2, BossTab.CRAZY_ARCHAEOLOGIST, 0), - MALEDICTION_SHARD_2(ItemID.MALEDICTION_SHARD_2, BossTab.CRAZY_ARCHAEOLOGIST, 0), - FEDORA(ItemID.FEDORA, BossTab.CRAZY_ARCHAEOLOGIST, 0), - // Scorpia - ODIUM_SHARD_3(ItemID.ODIUM_SHARD_3, BossTab.SCORPIA, 0), - MALEDICTION_SHARD_3(ItemID.MALEDICTION_SHARD_3, BossTab.SCORPIA, 0), - SCORPIAS_OFFSPRING(ItemID.SCORPIAS_OFFSPRING, BossTab.SCORPIA, 0), - // King Black Dragon, - KBD_HEADS(ItemID.KBD_HEADS, BossTab.KING_BLACK_DRAGON, -1), - DRACONIC_VISAGE(ItemID.DRACONIC_VISAGE, BossTab.KING_BLACK_DRAGON, -1), - PRINCE_BLACK_DRAGON(ItemID.PRINCE_BLACK_DRAGON, BossTab.KING_BLACK_DRAGON, -1), - - // Slayer Bosses - // Skotizo - DARK_CLAW(ItemID.DARK_CLAW, BossTab.SKOTIZO, -1), - SKOTOS(ItemID.SKOTOS, BossTab.SKOTIZO, -1), - JAR_OF_DARKNESS(ItemID.JAR_OF_DARKNESS, BossTab.SKOTIZO, -1), - // Grotesque Guardians - GRANITE_GLOVES(ItemID.GRANITE_GLOVES, BossTab.GROTESQUE_GUARDIANS, 0), - GRANITE_RING(ItemID.GRANITE_RING, BossTab.GROTESQUE_GUARDIANS, 0), - GRANITE_HAMMER(ItemID.GRANITE_HAMMER, BossTab.GROTESQUE_GUARDIANS, 0), - BLACK_TOURMALINE_CORE(ItemID.BLACK_TOURMALINE_CORE, BossTab.GROTESQUE_GUARDIANS, 1), - NOON(ItemID.NOON, BossTab.GROTESQUE_GUARDIANS, 1), - JAR_OF_STONE(ItemID.JAR_OF_STONE, BossTab.GROTESQUE_GUARDIANS, 1), - // Abyssal Sire - UNSIRED(ItemID.UNSIRED, BossTab.ABYSSAL_SIRE, 0), - BLUDGEON_CLAW(ItemID.BLUDGEON_CLAW, BossTab.ABYSSAL_SIRE, 0), - BLUDGEON_SPINE(ItemID.BLUDGEON_SPINE, BossTab.ABYSSAL_SIRE, 0), - BLUDGEON_AXON(ItemID.BLUDGEON_AXON, BossTab.ABYSSAL_SIRE, 0), - ABYSSAL_DAGGER(ItemID.ABYSSAL_DAGGER, BossTab.ABYSSAL_SIRE, 1), - ABYSSAL_WHIP(ItemID.ABYSSAL_WHIP, BossTab.ABYSSAL_SIRE, 1), - ABYSSAL_ORPHAN(ItemID.ABYSSAL_ORPHAN, BossTab.ABYSSAL_SIRE, 1), - JAR_OF_MIASMA(ItemID.JAR_OF_MIASMA, BossTab.ABYSSAL_SIRE, 1), - ABYSSAL_HEAD(ItemID.ABYSSAL_HEAD, BossTab.ABYSSAL_SIRE, 1), - // Kraken - TRIDENT_OF_THE_SEAS_FULL(ItemID.TRIDENT_OF_THE_SEAS_FULL, BossTab.KRAKEN, 0), - KRAKEN_TENTACLE(ItemID.KRAKEN_TENTACLE, BossTab.KRAKEN, 0), - JAR_OF_DIRT(ItemID.JAR_OF_DIRT, BossTab.KRAKEN, 0), - PET_KRAKEN(ItemID.PET_KRAKEN, BossTab.KRAKEN, 0), - // Cerberus - PRIMORDIAL_CRYSTAL(ItemID.PRIMORDIAL_CRYSTAL, BossTab.CERBERUS, 0), - PEGASIAN_CRYSTAL(ItemID.PEGASIAN_CRYSTAL, BossTab.CERBERUS, 0), - ETERNAL_CRYSTAL(ItemID.ETERNAL_CRYSTAL, BossTab.CERBERUS, 0), - SMOULDERING_STONE(ItemID.SMOULDERING_STONE, BossTab.CERBERUS, 0), - JAR_OF_SOULS(ItemID.JAR_OF_SOULS, BossTab.CERBERUS, 0), - HELLPUPPY(ItemID.HELLPUPPY, BossTab.CERBERUS, 0), - // Thermonuclear Smoke Devil - SMOKE_BATTLESTAFF(ItemID.SMOKE_BATTLESTAFF, BossTab.THERMONUCLEAR_SMOKE_DEVIL, -1), - OCCULT_NECKLACE(ItemID.OCCULT_NECKLACE, BossTab.THERMONUCLEAR_SMOKE_DEVIL, -1), - PET_SMOKE_DEVIL(ItemID.PET_SMOKE_DEVIL, BossTab.THERMONUCLEAR_SMOKE_DEVIL, -1), - // Alchemical Hydra - HYDRAS_EYE(ItemID.HYDRAS_EYE, BossTab.ALCHEMICAL_HYDRA, 0), - HYDRAS_FANG(ItemID.HYDRAS_FANG, BossTab.ALCHEMICAL_HYDRA, 0), - HYDRAS_HEART(ItemID.HYDRAS_HEART, BossTab.ALCHEMICAL_HYDRA, 0), - HYDRA_TAIL(ItemID.HYDRA_TAIL, BossTab.ALCHEMICAL_HYDRA, 0), - HYDRA_HEADS(ItemID.ALCHEMICAL_HYDRA_HEADS, BossTab.ALCHEMICAL_HYDRA, 0), - HYDRA_LEATHER(ItemID.HYDRA_LEATHER, BossTab.ALCHEMICAL_HYDRA, 1), - HYDRAS_CLAW(ItemID.HYDRAS_CLAW, BossTab.ALCHEMICAL_HYDRA, 1), - DRAGON_THROWNAXE(ItemID.DRAGON_THROWNAXE, BossTab.ALCHEMICAL_HYDRA, 1), - DRAGON_KNIFE(ItemID.DRAGON_KNIFE, BossTab.ALCHEMICAL_HYDRA, 1), - IKKLE_HYDRA(ItemID.IKKLE_HYDRA, BossTab.ALCHEMICAL_HYDRA, 1), - - - // Other Bosses - // Giant Mole - BABY_MOLE(ItemID.BABY_MOLE, BossTab.GIANT_MOLE, -1), - // Kalphite Queen - KQ_HEAD(ItemID.KQ_HEAD, BossTab.KALPHITE_QUEEN, -1), - JAR_OF_SAND(ItemID.JAR_OF_SAND, BossTab.KALPHITE_QUEEN, -1), - KALPHITE_PRINCESS(ItemID.KALPHITE_PRINCESS, BossTab.KALPHITE_QUEEN, -1), - // Corporeal Beast - SPIRIT_SHIELD(ItemID.SPIRIT_SHIELD, BossTab.CORPOREAL_BEAST, 0), - HOLY_ELIXIR(ItemID.HOLY_ELIXIR, BossTab.CORPOREAL_BEAST, 0), - PET_DARK_CORE(ItemID.PET_DARK_CORE, BossTab.CORPOREAL_BEAST, 0), - SPECTRAL_SIGIL(ItemID.SPECTRAL_SIGIL, BossTab.CORPOREAL_BEAST, 1), - ARCANE_SIGIL(ItemID.ARCANE_SIGIL, BossTab.CORPOREAL_BEAST, 1), - ELYSIAN_SIGIL(ItemID.ELYSIAN_SIGIL, BossTab.CORPOREAL_BEAST, 1), - // Sraracha - SARACHNIS_CUDGEL(ItemID.SARACHNIS_CUDGEL, BossTab.SARACHNIS, 0), - JAR_OF_EYES(ItemID.JAR_OF_EYES, BossTab.SARACHNIS, 0), - SRARACHA(ItemID.SRARACHA, BossTab.SARACHNIS, 0), - // The Gauntlet - CRYSTAL_SHARD(ItemID.CRYSTAL_SHARD, BossTab.THE_GAUNTLET, 0), - CRYSTAL_WEAPON_SEED(ItemID.CRYSTAL_WEAPON_SEED, BossTab.THE_GAUNTLET, 0), - CRYSTAL_ARMOUR_SEED(ItemID.CRYSTAL_ARMOUR_SEED, BossTab.THE_GAUNTLET, 0), - BLADE_OF_SAELDOR(ItemID.BLADE_OF_SAELDOR, BossTab.THE_GAUNTLET, 0), - YOUNGLLEF(ItemID.YOUNGLLEF, BossTab.THE_GAUNTLET, 0), - // Dagannoth Rex - RING_OF_LIFE(ItemID.RING_OF_LIFE, BossTab.DAGANNOTH_REX, -1), - WARRIOR_RING(ItemID.WARRIOR_RING, BossTab.DAGANNOTH_REX, -1), - BERSERKER_RING(ItemID.BERSERKER_RING, BossTab.DAGANNOTH_REX, -1), - PET_DAGANNOTH_REX(ItemID.PET_DAGANNOTH_REX, BossTab.DAGANNOTH_REX, -1), - // Dagannoth Prime - MUD_BATTLESTAFF(ItemID.MUD_BATTLESTAFF, BossTab.DAGANNOTH_PRIME, -1), - SEERS_RING(ItemID.SEERS_RING, BossTab.DAGANNOTH_PRIME, -1), - PET_DAGANNOTH_PRIME(ItemID.PET_DAGANNOTH_PRIME, BossTab.DAGANNOTH_PRIME, -1), - // Dagannoth Supreme - SEERCULL(ItemID.SEERCULL, BossTab.DAGANNOTH_SUPREME, -1), - ARCHERS_RING(ItemID.ARCHERS_RING, BossTab.DAGANNOTH_SUPREME, -1), - PET_DAGANNOTH_SUPREME(ItemID.PET_DAGANNOTH_SUPREME, BossTab.DAGANNOTH_SUPREME, -1), - - // Beginner Clue Scrolls - BEAR_FEET(ItemID.BEAR_FEET, BossTab.CLUE_SCROLL_BEGINNER, -1), - FROG_SLIPPERS(ItemID.FROG_SLIPPERS, BossTab.CLUE_SCROLL_BEGINNER, -1), - DEMON_FEET(ItemID.DEMON_FEET, BossTab.CLUE_SCROLL_BEGINNER, -1), - MOLE_SLIPPERS(ItemID.MOLE_SLIPPERS, BossTab.CLUE_SCROLL_BEGINNER, -1), - - SANDWICH_LADY_HAT(ItemID.SANDWICH_LADY_HAT, BossTab.CLUE_SCROLL_BEGINNER, 0), - SANDWICH_LADY_TOP(ItemID.SANDWICH_LADY_TOP, BossTab.CLUE_SCROLL_BEGINNER, 0), - SANDWICH_LADY_BOTTOM(ItemID.SANDWICH_LADY_BOTTOM, BossTab.CLUE_SCROLL_BEGINNER, 0), - - JESTER_CAPE(ItemID.JESTER_CAPE, BossTab.CLUE_SCROLL_BEGINNER, 1), - SHOULDER_PARROT(ItemID.SHOULDER_PARROT, BossTab.CLUE_SCROLL_BEGINNER, 1), - AMULET_OF_DEFENCE_T(ItemID.AMULET_OF_DEFENCE_T, BossTab.CLUE_SCROLL_BEGINNER, 1), - - MONKS_ROBE_TOP_T(ItemID.MONKS_ROBE_TOP_T, BossTab.CLUE_SCROLL_BEGINNER, 2), - MONKS_ROBE_T(ItemID.MONKS_ROBE_T, BossTab.CLUE_SCROLL_BEGINNER, 2), - RUNE_SCIMITAR_ORNAMENT_KIT_GUTHIX(ItemID.RUNE_SCIMITAR_ORNAMENT_KIT_GUTHIX, BossTab.CLUE_SCROLL_BEGINNER, 2), - RUNE_SCIMITAR_ORNAMENT_KIT_SARADOMIN(ItemID.RUNE_SCIMITAR_ORNAMENT_KIT_SARADOMIN, BossTab.CLUE_SCROLL_BEGINNER, 2), - RUNE_SCIMITAR_ORNAMENT_KIT_ZAMORAK(ItemID.RUNE_SCIMITAR_ORNAMENT_KIT_ZAMORAK, BossTab.CLUE_SCROLL_BEGINNER, 2), - - // Easy Clue Scrolls - BRONZE_FULL_HELM_T(ItemID.BRONZE_FULL_HELM_T, BossTab.CLUE_SCROLL_EASY, -1), - BRONZE_PLATEBODY_T(ItemID.BRONZE_PLATEBODY_T, BossTab.CLUE_SCROLL_EASY, -1), - BRONZE_PLATELEGS_T(ItemID.BRONZE_PLATELEGS_T, BossTab.CLUE_SCROLL_EASY, -1), - BRONZE_PLATESKIRT_T(ItemID.BRONZE_PLATESKIRT_T, BossTab.CLUE_SCROLL_EASY, -1), - BRONZE_KITESHIELD_T(ItemID.BRONZE_KITESHIELD_T, BossTab.CLUE_SCROLL_EASY, -1), - BRONZE_FULL_HELM_G(ItemID.BRONZE_FULL_HELM_G, BossTab.CLUE_SCROLL_EASY, 0), - BRONZE_PLATEBODY_G(ItemID.BRONZE_PLATEBODY_G, BossTab.CLUE_SCROLL_EASY, 0), - BRONZE_PLATELEGS_G(ItemID.BRONZE_PLATELEGS_G, BossTab.CLUE_SCROLL_EASY, 0), - BRONZE_PLATESKIRT_G(ItemID.BRONZE_PLATESKIRT_G, BossTab.CLUE_SCROLL_EASY, 0), - BRONZE_KITESHIELD_G(ItemID.BRONZE_KITESHIELD_G, BossTab.CLUE_SCROLL_EASY, 0), - IRON_FULL_HELM_T(ItemID.IRON_FULL_HELM_T, BossTab.CLUE_SCROLL_EASY, 1), - IRON_PLATEBODY_T(ItemID.IRON_PLATEBODY_T, BossTab.CLUE_SCROLL_EASY, 1), - IRON_PLATELEGS_T(ItemID.IRON_PLATELEGS_T, BossTab.CLUE_SCROLL_EASY, 1), - IRON_PLATESKIRT_T(ItemID.IRON_PLATESKIRT_T, BossTab.CLUE_SCROLL_EASY, 1), - IRON_KITESHIELD_T(ItemID.IRON_KITESHIELD_T, BossTab.CLUE_SCROLL_EASY, 1), - IRON_FULL_HELM_G(ItemID.IRON_FULL_HELM_G, BossTab.CLUE_SCROLL_EASY, 2), - IRON_PLATEBODY_G(ItemID.IRON_PLATEBODY_G, BossTab.CLUE_SCROLL_EASY, 2), - IRON_PLATELEGS_G(ItemID.IRON_PLATELEGS_G, BossTab.CLUE_SCROLL_EASY, 2), - IRON_PLATESKIRT_G(ItemID.IRON_PLATESKIRT_G, BossTab.CLUE_SCROLL_EASY, 2), - IRON_KITESHIELD_G(ItemID.IRON_KITESHIELD_G, BossTab.CLUE_SCROLL_EASY, 2), - STEEL_FULL_HELM_T(ItemID.STEEL_FULL_HELM_T, BossTab.CLUE_SCROLL_EASY, 3), - STEEL_PLATEBODY_T(ItemID.STEEL_PLATEBODY_T, BossTab.CLUE_SCROLL_EASY, 3), - STEEL_PLATELEGS_T(ItemID.STEEL_PLATELEGS_T, BossTab.CLUE_SCROLL_EASY, 3), - STEEL_PLATESKIRT_T(ItemID.STEEL_PLATESKIRT_T, BossTab.CLUE_SCROLL_EASY, 3), - STEEL_KITESHIELD_T(ItemID.STEEL_KITESHIELD_T, BossTab.CLUE_SCROLL_EASY, 3), - STEEL_FULL_HELM_G(ItemID.STEEL_FULL_HELM_G, BossTab.CLUE_SCROLL_EASY, 4), - STEEL_PLATEBODY_G(ItemID.STEEL_PLATEBODY_G, BossTab.CLUE_SCROLL_EASY, 4), - STEEL_PLATELEGS_G(ItemID.STEEL_PLATELEGS_G, BossTab.CLUE_SCROLL_EASY, 4), - STEEL_PLATESKIRT_G(ItemID.STEEL_PLATESKIRT_G, BossTab.CLUE_SCROLL_EASY, 4), - STEEL_KITESHIELD_G(ItemID.STEEL_KITESHIELD_G, BossTab.CLUE_SCROLL_EASY, 4), - BLACK_FULL_HELM_T(ItemID.BLACK_FULL_HELM_T, BossTab.CLUE_SCROLL_EASY, 5), - BLACK_PLATEBODY_T(ItemID.BLACK_PLATEBODY_T, BossTab.CLUE_SCROLL_EASY, 5), - BLACK_PLATELEGS_T(ItemID.BLACK_PLATELEGS_T, BossTab.CLUE_SCROLL_EASY, 5), - BLACK_PLATESKIRT_T(ItemID.BLACK_PLATESKIRT_T, BossTab.CLUE_SCROLL_EASY, 5), - BLACK_KITESHIELD_T(ItemID.BLACK_KITESHIELD_T, BossTab.CLUE_SCROLL_EASY, 5), - BLACK_FULL_HELM_G(ItemID.BLACK_FULL_HELM_G, BossTab.CLUE_SCROLL_EASY, 6), - BLACK_PLATEBODY_G(ItemID.BLACK_PLATEBODY_G, BossTab.CLUE_SCROLL_EASY, 6), - BLACK_PLATELEGS_G(ItemID.BLACK_PLATELEGS_G, BossTab.CLUE_SCROLL_EASY, 6), - BLACK_PLATESKIRT_G(ItemID.BLACK_PLATESKIRT_G, BossTab.CLUE_SCROLL_EASY, 6), - BLACK_KITESHIELD_G(ItemID.BLACK_KITESHIELD_G, BossTab.CLUE_SCROLL_EASY, 6), - BLUE_WIZARD_HAT_T(ItemID.BLUE_WIZARD_HAT_T, BossTab.CLUE_SCROLL_EASY, 7), - BLUE_WIZARD_ROBE_T(ItemID.BLUE_WIZARD_ROBE_T, BossTab.CLUE_SCROLL_EASY, 7), - BLUE_SKIRT_T(ItemID.BLUE_SKIRT_T, BossTab.CLUE_SCROLL_EASY, 7), - BLUE_WIZARD_HAT_G(ItemID.BLUE_WIZARD_HAT_G, BossTab.CLUE_SCROLL_EASY, 8), - BLUE_WIZARD_ROBE_G(ItemID.BLUE_WIZARD_ROBE_G, BossTab.CLUE_SCROLL_EASY, 8), - BLUE_SKIRT_G(ItemID.BLUE_SKIRT_G, BossTab.CLUE_SCROLL_EASY, 8), - BLACK_WIZARD_HAT_T(ItemID.BLACK_WIZARD_HAT_T, BossTab.CLUE_SCROLL_EASY, 9), - BLACK_WIZARD_ROBE_T(ItemID.BLACK_WIZARD_ROBE_T, BossTab.CLUE_SCROLL_EASY, 9), - BLACK_SKIRT_T(ItemID.BLACK_SKIRT_T, BossTab.CLUE_SCROLL_EASY, 9), - BLACK_WIZARD_HAT_G(ItemID.BLACK_WIZARD_HAT_G, BossTab.CLUE_SCROLL_EASY, 10), - BLACK_WIZARD_ROBE_G(ItemID.BLACK_WIZARD_ROBE_G, BossTab.CLUE_SCROLL_EASY, 10), - BLACK_SKIRT_G(ItemID.BLACK_SKIRT_G, BossTab.CLUE_SCROLL_EASY, 10), - LEATHER_BODY_G(ItemID.LEATHER_BODY_G, BossTab.CLUE_SCROLL_EASY, 11), - LEATHER_CHAPS_G(ItemID.LEATHER_CHAPS_G, BossTab.CLUE_SCROLL_EASY, 11), - STUDDED_BODY_T(ItemID.STUDDED_BODY_T, BossTab.CLUE_SCROLL_EASY, 11), - STUDDED_CHAPS_T(ItemID.STUDDED_CHAPS_T, BossTab.CLUE_SCROLL_EASY, 11), - STUDDED_BODY_G(ItemID.STUDDED_BODY_G, BossTab.CLUE_SCROLL_EASY, 11), - STUDDED_CHAPS_G(ItemID.STUDDED_CHAPS_G, BossTab.CLUE_SCROLL_EASY, 11), - BLACK_HELM_H1(ItemID.BLACK_HELM_H1, BossTab.CLUE_SCROLL_EASY, 12), - BLACK_HELM_H2(ItemID.BLACK_HELM_H2, BossTab.CLUE_SCROLL_EASY, 12), - BLACK_HELM_H3(ItemID.BLACK_HELM_H3, BossTab.CLUE_SCROLL_EASY, 12), - BLACK_HELM_H4(ItemID.BLACK_HELM_H4, BossTab.CLUE_SCROLL_EASY, 12), - BLACK_HELM_H5(ItemID.BLACK_HELM_H5, BossTab.CLUE_SCROLL_EASY, 12), - BLACK_SHIELD_H1(ItemID.BLACK_SHIELD_H1, BossTab.CLUE_SCROLL_EASY, 13), - BLACK_SHIELD_H2(ItemID.BLACK_SHIELD_H2, BossTab.CLUE_SCROLL_EASY, 13), - BLACK_SHIELD_H3(ItemID.BLACK_SHIELD_H3, BossTab.CLUE_SCROLL_EASY, 13), - BLACK_SHIELD_H4(ItemID.BLACK_SHIELD_H4, BossTab.CLUE_SCROLL_EASY, 13), - BLACK_SHIELD_H5(ItemID.BLACK_SHIELD_H5, BossTab.CLUE_SCROLL_EASY, 13), - BLUE_ELEGANT_SHIRT(ItemID.BLUE_ELEGANT_SHIRT, BossTab.CLUE_SCROLL_EASY, 14), - BLUE_ELEGANT_LEGS(ItemID.BLUE_ELEGANT_LEGS, BossTab.CLUE_SCROLL_EASY, 14), - BLUE_ELEGANT_BLOUSE(ItemID.BLUE_ELEGANT_BLOUSE, BossTab.CLUE_SCROLL_EASY, 14), - BLUE_ELEGANT_SKIRT(ItemID.BLUE_ELEGANT_SKIRT, BossTab.CLUE_SCROLL_EASY, 14), - GREEN_ELEGANT_SHIRT(ItemID.GREEN_ELEGANT_SHIRT, BossTab.CLUE_SCROLL_EASY, 15), - GREEN_ELEGANT_LEGS(ItemID.GREEN_ELEGANT_LEGS, BossTab.CLUE_SCROLL_EASY, 15), - GREEN_ELEGANT_BLOUSE(ItemID.GREEN_ELEGANT_BLOUSE, BossTab.CLUE_SCROLL_EASY, 15), - GREEN_ELEGANT_SKIRT(ItemID.GREEN_ELEGANT_SKIRT, BossTab.CLUE_SCROLL_EASY, 15), - RED_ELEGANT_SHIRT(ItemID.RED_ELEGANT_SHIRT, BossTab.CLUE_SCROLL_EASY, 16), - RED_ELEGANT_LEGS(ItemID.RED_ELEGANT_LEGS, BossTab.CLUE_SCROLL_EASY, 16), - RED_ELEGANT_BLOUSE(ItemID.RED_ELEGANT_BLOUSE, BossTab.CLUE_SCROLL_EASY, 16), - RED_ELEGANT_SKIRT(ItemID.RED_ELEGANT_SKIRT, BossTab.CLUE_SCROLL_EASY, 16), - BOBS_RED_SHIRT(ItemID.BOBS_RED_SHIRT, BossTab.CLUE_SCROLL_EASY, 17), - BOBS_BLUE_SHIRT(ItemID.BOBS_BLUE_SHIRT, BossTab.CLUE_SCROLL_EASY, 17), - BOBS_GREEN_SHIRT(ItemID.BOBS_GREEN_SHIRT, BossTab.CLUE_SCROLL_EASY, 17), - BOBS_BLACK_SHIRT(ItemID.BOBS_BLACK_SHIRT, BossTab.CLUE_SCROLL_EASY, 17), - BOBS_PURPLE_SHIRT(ItemID.BOBS_PURPLE_SHIRT, BossTab.CLUE_SCROLL_EASY, 17), - STAFF_OF_BOB_THE_CAT(ItemID.STAFF_OF_BOB_THE_CAT, BossTab.CLUE_SCROLL_EASY, 17), - A_POWDERED_WIG(ItemID.A_POWDERED_WIG, BossTab.CLUE_SCROLL_EASY, 18), - FLARED_TROUSERS(ItemID.FLARED_TROUSERS, BossTab.CLUE_SCROLL_EASY, 18), - PANTALOONS(ItemID.PANTALOONS, BossTab.CLUE_SCROLL_EASY, 18), - SLEEPING_CAP(ItemID.SLEEPING_CAP, BossTab.CLUE_SCROLL_EASY, 18), - GUTHIX_ROBE_TOP(ItemID.GUTHIX_ROBE_TOP, BossTab.CLUE_SCROLL_EASY, 19), - GUTHIX_ROBE_LEGS(ItemID.GUTHIX_ROBE_LEGS, BossTab.CLUE_SCROLL_EASY, 19), - SARADOMIN_ROBE_TOP(ItemID.SARADOMIN_ROBE_TOP, BossTab.CLUE_SCROLL_EASY, 19), - SARADOMIN_ROBE_LEGS(ItemID.SARADOMIN_ROBE_LEGS, BossTab.CLUE_SCROLL_EASY, 19), - ZAMORAK_ROBE_TOP(ItemID.ZAMORAK_ROBE_TOP, BossTab.CLUE_SCROLL_EASY, 19), - ZAMORAK_ROBE_LEGS(ItemID.ZAMORAK_ROBE_LEGS, BossTab.CLUE_SCROLL_EASY, 19), - ANCIENT_ROBE_TOP(ItemID.ANCIENT_ROBE_TOP, BossTab.CLUE_SCROLL_EASY, 20), - ANCIENT_ROBE_LEGS(ItemID.ANCIENT_ROBE_LEGS, BossTab.CLUE_SCROLL_EASY, 20), - BANDOS_ROBE_TOP(ItemID.BANDOS_ROBE_TOP, BossTab.CLUE_SCROLL_EASY, 20), - BANDOS_ROBE_LEGS(ItemID.BANDOS_ROBE_LEGS, BossTab.CLUE_SCROLL_EASY, 20), - ARMADYL_ROBE_TOP(ItemID.ARMADYL_ROBE_TOP, BossTab.CLUE_SCROLL_EASY, 20), - ARMADYL_ROBE_LEGS(ItemID.ARMADYL_ROBE_LEGS, BossTab.CLUE_SCROLL_EASY, 20), - BLACK_BERET(ItemID.BLACK_BERET, BossTab.CLUE_SCROLL_EASY, 21), - BLUE_BERET(ItemID.BLUE_BERET, BossTab.CLUE_SCROLL_EASY, 21), - WHITE_BERET(ItemID.WHITE_BERET, BossTab.CLUE_SCROLL_EASY, 21), - RED_BERET(ItemID.RED_BERET, BossTab.CLUE_SCROLL_EASY, 21), - HIGHWAYMAN_MASK(ItemID.HIGHWAYMAN_MASK, BossTab.CLUE_SCROLL_EASY, 22), - IMP_MASK(ItemID.IMP_MASK, BossTab.CLUE_SCROLL_EASY, 22), - GOBLIN_MASK(ItemID.GOBLIN_MASK, BossTab.CLUE_SCROLL_EASY, 22), - BEANIE(ItemID.BEANIE, BossTab.CLUE_SCROLL_EASY, 22), - TEAM_CAPE_I(ItemID.TEAM_CAPE_I, BossTab.CLUE_SCROLL_EASY, 23), - TEAM_CAPE_X(ItemID.TEAM_CAPE_X, BossTab.CLUE_SCROLL_EASY, 23), - TEAM_CAPE_ZERO(ItemID.TEAM_CAPE_ZERO, BossTab.CLUE_SCROLL_EASY, 23), - CAPE_OF_SKULLS(ItemID.CAPE_OF_SKULLS, BossTab.CLUE_SCROLL_EASY, 23), - AMULET_OF_MAGIC_T(ItemID.AMULET_OF_MAGIC_T, BossTab.CLUE_SCROLL_EASY, 24), - AMULET_OF_POWER_T(ItemID.AMULET_OF_POWER_T, BossTab.CLUE_SCROLL_EASY, 24), - BLACK_CANE(ItemID.BLACK_CANE, BossTab.CLUE_SCROLL_EASY, 24), - BLACK_PICKAXE(ItemID.BLACK_PICKAXE, BossTab.CLUE_SCROLL_EASY, 24), - LARGE_SPADE(ItemID.LARGE_SPADE, BossTab.CLUE_SCROLL_EASY, 24), - RAIN_BOW(ItemID.RAIN_BOW, BossTab.CLUE_SCROLL_EASY, 24), - HAM_JOINT(ItemID.HAM_JOINT, BossTab.CLUE_SCROLL_EASY, 24), - WOODEN_SHIELD_G(ItemID.WOODEN_SHIELD_G, BossTab.CLUE_SCROLL_EASY, 25), - GOLDEN_CHEFS_HAT(ItemID.GOLDEN_CHEFS_HAT, BossTab.CLUE_SCROLL_EASY, 25), - GOLDEN_APRON(ItemID.GOLDEN_APRON, BossTab.CLUE_SCROLL_EASY, 25), - MONKS_ROBE_TOP_G(ItemID.MONKS_ROBE_TOP_G, BossTab.CLUE_SCROLL_EASY, 25), - MONKS_ROBE_G(ItemID.MONKS_ROBE_G, BossTab.CLUE_SCROLL_EASY, 25), - BLACK_PLATEBODY_H1(ItemID.BLACK_PLATEBODY_H1, BossTab.CLUE_SCROLL_EASY, 26), - BLACK_PLATEBODY_H2(ItemID.BLACK_PLATEBODY_H2, BossTab.CLUE_SCROLL_EASY, 26), - BLACK_PLATEBODY_H3(ItemID.BLACK_PLATEBODY_H3, BossTab.CLUE_SCROLL_EASY, 26), - BLACK_PLATEBODY_H4(ItemID.BLACK_PLATEBODY_H4, BossTab.CLUE_SCROLL_EASY, 26), - BLACK_PLATEBODY_H5(ItemID.BLACK_PLATEBODY_H5, BossTab.CLUE_SCROLL_EASY, 26), - - // Medium Clue Scrolls - MITHRIL_FULL_HELM_T(ItemID.MITHRIL_FULL_HELM_T, BossTab.CLUE_SCROLL_MEDIUM, -1), - MITHRIL_PLATEBODY_T(ItemID.MITHRIL_PLATEBODY_T, BossTab.CLUE_SCROLL_MEDIUM, -1), - MITHRIL_PLATELEGS_T(ItemID.MITHRIL_PLATELEGS_T, BossTab.CLUE_SCROLL_MEDIUM, -1), - MITHRIL_PLATESKIRT_T(ItemID.MITHRIL_PLATESKIRT_T, BossTab.CLUE_SCROLL_MEDIUM, -1), - MITHRIL_KITESHIELD_T(ItemID.MITHRIL_KITESHIELD_T, BossTab.CLUE_SCROLL_MEDIUM, -1), - MITHRIL_FULL_HELM_G(ItemID.MITHRIL_FULL_HELM_G, BossTab.CLUE_SCROLL_MEDIUM, 0), - MITHRIL_PLATEBODY_G(ItemID.MITHRIL_PLATEBODY_G, BossTab.CLUE_SCROLL_MEDIUM, 0), - MITHRIL_PLATELEGS_G(ItemID.MITHRIL_PLATELEGS_G, BossTab.CLUE_SCROLL_MEDIUM, 0), - MITHRIL_PLATESKIRT_G(ItemID.MITHRIL_PLATESKIRT_G, BossTab.CLUE_SCROLL_MEDIUM, 0), - MITHRIL_KITESHIELD_G(ItemID.MITHRIL_KITESHIELD_G, BossTab.CLUE_SCROLL_MEDIUM, 0), - ADAMANT_FULL_HELM_T(ItemID.ADAMANT_FULL_HELM_T, BossTab.CLUE_SCROLL_MEDIUM, 1), - ADAMANT_PLATEBODY_T(ItemID.ADAMANT_PLATEBODY_T, BossTab.CLUE_SCROLL_MEDIUM, 1), - ADAMANT_PLATELEGS_T(ItemID.ADAMANT_PLATELEGS_T, BossTab.CLUE_SCROLL_MEDIUM, 1), - ADAMANT_PLATESKIRT_T(ItemID.ADAMANT_PLATESKIRT_T, BossTab.CLUE_SCROLL_MEDIUM, 1), - ADAMANT_KITESHIELD_T(ItemID.ADAMANT_KITESHIELD_T, BossTab.CLUE_SCROLL_MEDIUM, 1), - ADAMANT_FULL_HELM_G(ItemID.ADAMANT_FULL_HELM_G, BossTab.CLUE_SCROLL_MEDIUM, 2), - ADAMANT_PLATEBODY_G(ItemID.ADAMANT_PLATEBODY_G, BossTab.CLUE_SCROLL_MEDIUM, 2), - ADAMANT_PLATELEGS_G(ItemID.ADAMANT_PLATELEGS_G, BossTab.CLUE_SCROLL_MEDIUM, 2), - ADAMANT_PLATESKIRT_G(ItemID.ADAMANT_PLATESKIRT_G, BossTab.CLUE_SCROLL_MEDIUM, 2), - ADAMANT_KITESHIELD_G(ItemID.ADAMANT_KITESHIELD_G, BossTab.CLUE_SCROLL_MEDIUM, 2), - RANGER_BOOTS(ItemID.RANGER_BOOTS, BossTab.CLUE_SCROLL_MEDIUM, 3), - HOLY_SANDALS(ItemID.HOLY_SANDALS, BossTab.CLUE_SCROLL_MEDIUM, 3), - WIZARD_BOOTS(ItemID.WIZARD_BOOTS, BossTab.CLUE_SCROLL_MEDIUM, 3), - CLIMBING_BOOTS_G(ItemID.CLIMBING_BOOTS_G, BossTab.CLUE_SCROLL_MEDIUM, 3), - RED_HEADBAND(ItemID.RED_HEADBAND, BossTab.CLUE_SCROLL_MEDIUM, 4), - BLACK_HEADBAND(ItemID.BLACK_HEADBAND, BossTab.CLUE_SCROLL_MEDIUM, 4), - BROWN_HEADBAND(ItemID.BROWN_HEADBAND, BossTab.CLUE_SCROLL_MEDIUM, 4), - PINK_HEADBAND(ItemID.PINK_HEADBAND, BossTab.CLUE_SCROLL_MEDIUM, 4), - GREEN_HEADBAND(ItemID.GREEN_HEADBAND, BossTab.CLUE_SCROLL_MEDIUM, 5), - BLUE_HEADBAND(ItemID.BLUE_HEADBAND, BossTab.CLUE_SCROLL_MEDIUM, 5), - GOLD_HEADBAND(ItemID.GOLD_HEADBAND, BossTab.CLUE_SCROLL_MEDIUM, 5), - WHITE_HEADBAND(ItemID.WHITE_HEADBAND, BossTab.CLUE_SCROLL_MEDIUM, 5), - RED_BOATER(ItemID.RED_BOATER, BossTab.CLUE_SCROLL_MEDIUM, 6), - ORANGE_BOATER(ItemID.ORANGE_BOATER, BossTab.CLUE_SCROLL_MEDIUM, 6), - GREEN_BOATER(ItemID.GREEN_BOATER, BossTab.CLUE_SCROLL_MEDIUM, 6), - BLUE_BOATER(ItemID.BLUE_BOATER, BossTab.CLUE_SCROLL_MEDIUM, 6), - BLACK_BOATER(ItemID.BLACK_BOATER, BossTab.CLUE_SCROLL_MEDIUM, 7), - PINK_BOATER(ItemID.PINK_BOATER, BossTab.CLUE_SCROLL_MEDIUM, 7), - PURPLE_BOATER(ItemID.PURPLE_BOATER, BossTab.CLUE_SCROLL_MEDIUM, 7), - WHITE_BOATER(ItemID.WHITE_BOATER, BossTab.CLUE_SCROLL_MEDIUM, 7), - ADAMANT_HELM_H1(ItemID.ADAMANT_HELM_H1, BossTab.CLUE_SCROLL_MEDIUM, 8), - ADAMANT_HELM_H2(ItemID.ADAMANT_HELM_H2, BossTab.CLUE_SCROLL_MEDIUM, 8), - ADAMANT_HELM_H3(ItemID.ADAMANT_HELM_H3, BossTab.CLUE_SCROLL_MEDIUM, 8), - ADAMANT_HELM_H4(ItemID.ADAMANT_HELM_H4, BossTab.CLUE_SCROLL_MEDIUM, 8), - ADAMANT_HELM_H5(ItemID.ADAMANT_HELM_H5, BossTab.CLUE_SCROLL_MEDIUM, 8), - ADAMANT_SHIELD_H1(ItemID.ADAMANT_SHIELD_H1, BossTab.CLUE_SCROLL_MEDIUM, 9), - ADAMANT_SHIELD_H2(ItemID.ADAMANT_SHIELD_H2, BossTab.CLUE_SCROLL_MEDIUM, 9), - ADAMANT_SHIELD_H3(ItemID.ADAMANT_SHIELD_H3, BossTab.CLUE_SCROLL_MEDIUM, 9), - ADAMANT_SHIELD_H4(ItemID.ADAMANT_SHIELD_H4, BossTab.CLUE_SCROLL_MEDIUM, 9), - ADAMANT_SHIELD_H5(ItemID.ADAMANT_SHIELD_H5, BossTab.CLUE_SCROLL_MEDIUM, 9), - GREEN_DHIDE_BODY_T(ItemID.GREEN_DHIDE_BODY_T, BossTab.CLUE_SCROLL_MEDIUM, 10), - GREEN_DHIDE_CHAPS_T(ItemID.GREEN_DHIDE_CHAPS_T, BossTab.CLUE_SCROLL_MEDIUM, 10), - GREEN_DHIDE_BODY_G(ItemID.GREEN_DHIDE_BODY_G, BossTab.CLUE_SCROLL_MEDIUM, 10), - GREEN_DHIDE_CHAPS_G(ItemID.GREEN_DHIDE_CHAPS_G, BossTab.CLUE_SCROLL_MEDIUM, 10), - BLACK_ELEGANT_SHIRT(ItemID.BLACK_ELEGANT_SHIRT, BossTab.CLUE_SCROLL_MEDIUM, 11), - BLACK_ELEGANT_LEGS(ItemID.BLACK_ELEGANT_LEGS, BossTab.CLUE_SCROLL_MEDIUM, 11), - WHITE_ELEGANT_BLOUSE(ItemID.WHITE_ELEGANT_BLOUSE, BossTab.CLUE_SCROLL_MEDIUM, 11), - WHITE_ELEGANT_SKIRT(ItemID.WHITE_ELEGANT_SKIRT, BossTab.CLUE_SCROLL_MEDIUM, 11), - PURPLE_ELEGANT_SHIRT(ItemID.PURPLE_ELEGANT_SHIRT, BossTab.CLUE_SCROLL_MEDIUM, 12), - PURPLE_ELEGANT_LEGS(ItemID.PURPLE_ELEGANT_LEGS, BossTab.CLUE_SCROLL_MEDIUM, 12), - PURPLE_ELEGANT_BLOUSE(ItemID.PURPLE_ELEGANT_BLOUSE, BossTab.CLUE_SCROLL_MEDIUM, 12), - PURPLE_ELEGANT_SKIRT(ItemID.PURPLE_ELEGANT_SKIRT, BossTab.CLUE_SCROLL_MEDIUM, 12), - PINK_ELEGANT_SHIRT(ItemID.PINK_ELEGANT_SHIRT, BossTab.CLUE_SCROLL_MEDIUM, 13), - PINK_ELEGANT_LEGS(ItemID.PINK_ELEGANT_LEGS, BossTab.CLUE_SCROLL_MEDIUM, 13), - PINK_ELEGANT_BLOUSE(ItemID.PINK_ELEGANT_BLOUSE, BossTab.CLUE_SCROLL_MEDIUM, 13), - PINK_ELEGANT_SKIRT(ItemID.PINK_ELEGANT_SKIRT, BossTab.CLUE_SCROLL_MEDIUM, 13), - GOLD_ELEGANT_SHIRT(ItemID.GOLD_ELEGANT_SHIRT, BossTab.CLUE_SCROLL_MEDIUM, 14), - GOLD_ELEGANT_LEGS(ItemID.GOLD_ELEGANT_LEGS, BossTab.CLUE_SCROLL_MEDIUM, 14), - GOLD_ELEGANT_BLOUSE(ItemID.GOLD_ELEGANT_BLOUSE, BossTab.CLUE_SCROLL_MEDIUM, 14), - GOLD_ELEGANT_SKIRT(ItemID.GOLD_ELEGANT_SKIRT, BossTab.CLUE_SCROLL_MEDIUM, 14), - GUTHIX_MITRE(ItemID.GUTHIX_MITRE, BossTab.CLUE_SCROLL_MEDIUM, 15), - GUTHIX_CLOAK(ItemID.GUTHIX_CLOAK, BossTab.CLUE_SCROLL_MEDIUM, 15), - SARADOMIN_MITRE(ItemID.SARADOMIN_MITRE, BossTab.CLUE_SCROLL_MEDIUM, 15), - SARADOMIN_CLOAK(ItemID.SARADOMIN_CLOAK, BossTab.CLUE_SCROLL_MEDIUM, 15), - ZAMORAK_MITRE(ItemID.ZAMORAK_MITRE, BossTab.CLUE_SCROLL_MEDIUM, 15), - ZAMORAK_CLOAK(ItemID.ZAMORAK_CLOAK, BossTab.CLUE_SCROLL_MEDIUM, 15), - ANCIENT_MITRE(ItemID.ANCIENT_MITRE, BossTab.CLUE_SCROLL_MEDIUM, 16), - ANCIENT_CLOAK(ItemID.ANCIENT_CLOAK, BossTab.CLUE_SCROLL_MEDIUM, 16), - BANDOS_MITRE(ItemID.BANDOS_MITRE, BossTab.CLUE_SCROLL_MEDIUM, 16), - BANDOS_CLOAK(ItemID.BANDOS_CLOAK, BossTab.CLUE_SCROLL_MEDIUM, 16), - ARMADYL_MITRE(ItemID.ARMADYL_MITRE, BossTab.CLUE_SCROLL_MEDIUM, 16), - ARMADYL_CLOAK(ItemID.ARMADYL_CLOAK, BossTab.CLUE_SCROLL_MEDIUM, 16), - ARMADYL_STOLE(ItemID.ARMADYL_STOLE, BossTab.CLUE_SCROLL_MEDIUM, 17), - ARMADYL_CROZIER(ItemID.ARMADYL_CROZIER, BossTab.CLUE_SCROLL_MEDIUM, 17), - ANCIENT_STOLE(ItemID.ANCIENT_STOLE, BossTab.CLUE_SCROLL_MEDIUM, 17), - ANCIENT_CROZIER(ItemID.ANCIENT_CROZIER, BossTab.CLUE_SCROLL_MEDIUM, 17), - BANDOS_STOLE(ItemID.BANDOS_STOLE, BossTab.CLUE_SCROLL_MEDIUM, 17), - BANDOS_CROZIER(ItemID.BANDOS_CROZIER, BossTab.CLUE_SCROLL_MEDIUM, 17), - CAT_MASK(ItemID.CAT_MASK, BossTab.CLUE_SCROLL_MEDIUM, 18), - PENGUIN_MASK(ItemID.PENGUIN_MASK, BossTab.CLUE_SCROLL_MEDIUM, 18), - BLACK_UNICORN_MASK(ItemID.BLACK_UNICORN_MASK, BossTab.CLUE_SCROLL_MEDIUM, 18), - WHITE_UNICORN_MASK(ItemID.WHITE_UNICORN_MASK, BossTab.CLUE_SCROLL_MEDIUM, 18), - LEPRECHAUN_HAT(ItemID.LEPRECHAUN_HAT, BossTab.CLUE_SCROLL_MEDIUM, 18), - BLACK_LEPRECHAUN_HAT(ItemID.BLACK_LEPRECHAUN_HAT, BossTab.CLUE_SCROLL_MEDIUM, 18), - ARCEUUS_BANNER(ItemID.ARCEUUS_BANNER, BossTab.CLUE_SCROLL_MEDIUM, 19), - HOSIDIUS_BANNER(ItemID.HOSIDIUS_BANNER, BossTab.CLUE_SCROLL_MEDIUM, 19), - LOVAKENGJ_BANNER(ItemID.LOVAKENGJ_BANNER, BossTab.CLUE_SCROLL_MEDIUM, 19), - PISCARILIUS_BANNER(ItemID.PISCARILIUS_BANNER, BossTab.CLUE_SCROLL_MEDIUM, 19), - SHAYZIEN_BANNER(ItemID.SHAYZIEN_BANNER, BossTab.CLUE_SCROLL_MEDIUM, 19), - CRIER_HAT(ItemID.CRIER_HAT, BossTab.CLUE_SCROLL_MEDIUM, 20), - CRIER_BELL(ItemID.CRIER_BELL, BossTab.CLUE_SCROLL_MEDIUM, 20), - CRIER_COAT(ItemID.CRIER_COAT, BossTab.CLUE_SCROLL_MEDIUM, 20), - WOLF_MASK(ItemID.WOLF_MASK, BossTab.CLUE_SCROLL_MEDIUM, 20), - WOLF_CLOAK(ItemID.WOLF_CLOAK, BossTab.CLUE_SCROLL_MEDIUM, 20), - SPIKED_MANACLES(ItemID.SPIKED_MANACLES, BossTab.CLUE_SCROLL_MEDIUM, 21), - STRENGTH_AMULET_T(ItemID.STRENGTH_AMULET_T, BossTab.CLUE_SCROLL_MEDIUM, 21), - ADAMANT_CANE(ItemID.ADAMANT_CANE, BossTab.CLUE_SCROLL_MEDIUM, 21), - GNOMISH_FIRELIGHTER(ItemID.GNOMISH_FIRELIGHTER, BossTab.CLUE_SCROLL_MEDIUM, 21), - CABBAGE_ROUND_SHIELD(ItemID.CABBAGE_ROUND_SHIELD, BossTab.CLUE_SCROLL_MEDIUM, 21), - CLUELESS_SCROLL(ItemID.CLUELESS_SCROLL, BossTab.CLUE_SCROLL_MEDIUM, 21), - ADAMANT_PLATEBODY_H1(ItemID.ADAMANT_PLATEBODY_H1, BossTab.CLUE_SCROLL_MEDIUM, 22), - ADAMANT_PLATEBODY_H2(ItemID.ADAMANT_PLATEBODY_H2, BossTab.CLUE_SCROLL_MEDIUM, 22), - ADAMANT_PLATEBODY_H3(ItemID.ADAMANT_PLATEBODY_H3, BossTab.CLUE_SCROLL_MEDIUM, 22), - ADAMANT_PLATEBODY_H4(ItemID.ADAMANT_PLATEBODY_H4, BossTab.CLUE_SCROLL_MEDIUM, 22), - ADAMANT_PLATEBODY_H5(ItemID.ADAMANT_PLATEBODY_H5, BossTab.CLUE_SCROLL_MEDIUM, 22), - - // Hard Clue Scrolls - RUNE_FULL_HELM_T(ItemID.RUNE_FULL_HELM_T, BossTab.CLUE_SCROLL_HARD, -1), - RUNE_PLATEBODY_T(ItemID.RUNE_PLATEBODY_T, BossTab.CLUE_SCROLL_HARD, -1), - RUNE_PLATELEGS_T(ItemID.RUNE_PLATELEGS_T, BossTab.CLUE_SCROLL_HARD, -1), - RUNE_PLATESKIRT_T(ItemID.RUNE_PLATESKIRT_T, BossTab.CLUE_SCROLL_HARD, -1), - RUNE_KITESHIELD_T(ItemID.RUNE_KITESHIELD_T, BossTab.CLUE_SCROLL_HARD, -1), - RUNE_FULL_HELM_G(ItemID.RUNE_FULL_HELM_G, BossTab.CLUE_SCROLL_HARD, 0), - RUNE_PLATEBODY_G(ItemID.RUNE_PLATEBODY_G, BossTab.CLUE_SCROLL_HARD, 0), - RUNE_PLATELEGS_G(ItemID.RUNE_PLATELEGS_G, BossTab.CLUE_SCROLL_HARD, 0), - RUNE_PLATESKIRT_G(ItemID.RUNE_PLATESKIRT_G, BossTab.CLUE_SCROLL_HARD, 0), - RUNE_KITESHIELD_G(ItemID.RUNE_KITESHIELD_G, BossTab.CLUE_SCROLL_HARD, 0), - GUTHIX_FULL_HELM(ItemID.GUTHIX_FULL_HELM, BossTab.CLUE_SCROLL_HARD, 1), - GUTHIX_PLATEBODY(ItemID.GUTHIX_PLATEBODY, BossTab.CLUE_SCROLL_HARD, 1), - GUTHIX_PLATELEGS(ItemID.GUTHIX_PLATELEGS, BossTab.CLUE_SCROLL_HARD, 1), - GUTHIX_PLATESKIRT(ItemID.GUTHIX_PLATESKIRT, BossTab.CLUE_SCROLL_HARD, 1), - GUTHIX_KITESHIELD(ItemID.GUTHIX_KITESHIELD, BossTab.CLUE_SCROLL_HARD, 1), - SARADOMIN_FULL_HELM(ItemID.SARADOMIN_FULL_HELM, BossTab.CLUE_SCROLL_HARD, 2), - SARADOMIN_PLATEBODY(ItemID.SARADOMIN_PLATEBODY, BossTab.CLUE_SCROLL_HARD, 2), - SARADOMIN_PLATELEGS(ItemID.SARADOMIN_PLATELEGS, BossTab.CLUE_SCROLL_HARD, 2), - SARADOMIN_PLATESKIRT(ItemID.SARADOMIN_PLATESKIRT, BossTab.CLUE_SCROLL_HARD, 2), - SARADOMIN_KITESHIELD(ItemID.SARADOMIN_KITESHIELD, BossTab.CLUE_SCROLL_HARD, 2), - ZAMORAK_FULL_HELM(ItemID.ZAMORAK_FULL_HELM, BossTab.CLUE_SCROLL_HARD, 3), - ZAMORAK_PLATEBODY(ItemID.ZAMORAK_PLATEBODY, BossTab.CLUE_SCROLL_HARD, 3), - ZAMORAK_PLATELEGS(ItemID.ZAMORAK_PLATELEGS, BossTab.CLUE_SCROLL_HARD, 3), - ZAMORAK_PLATESKIRT(ItemID.ZAMORAK_PLATESKIRT, BossTab.CLUE_SCROLL_HARD, 3), - ZAMORAK_KITESHIELD(ItemID.ZAMORAK_KITESHIELD, BossTab.CLUE_SCROLL_HARD, 3), - ANCIENT_FULL_HELM(ItemID.ANCIENT_FULL_HELM, BossTab.CLUE_SCROLL_HARD, 4), - ANCIENT_PLATEBODY(ItemID.ANCIENT_PLATEBODY, BossTab.CLUE_SCROLL_HARD, 4), - ANCIENT_PLATELEGS(ItemID.ANCIENT_PLATELEGS, BossTab.CLUE_SCROLL_HARD, 4), - ANCIENT_PLATESKIRT(ItemID.ANCIENT_PLATESKIRT, BossTab.CLUE_SCROLL_HARD, 4), - ANCIENT_KITESHIELD(ItemID.ANCIENT_KITESHIELD, BossTab.CLUE_SCROLL_HARD, 4), - BANDOS_FULL_HELM(ItemID.BANDOS_FULL_HELM, BossTab.CLUE_SCROLL_HARD, 5), - BANDOS_PLATEBODY(ItemID.BANDOS_PLATEBODY, BossTab.CLUE_SCROLL_HARD, 5), - BANDOS_PLATELEGS(ItemID.BANDOS_PLATELEGS, BossTab.CLUE_SCROLL_HARD, 5), - BANDOS_PLATESKIRT(ItemID.BANDOS_PLATESKIRT, BossTab.CLUE_SCROLL_HARD, 5), - BANDOS_KITESHIELD(ItemID.BANDOS_KITESHIELD, BossTab.CLUE_SCROLL_HARD, 5), - ARMADYL_FULL_HELM(ItemID.ARMADYL_FULL_HELM, BossTab.CLUE_SCROLL_HARD, 6), - ARMADYL_PLATEBODY(ItemID.ARMADYL_PLATEBODY, BossTab.CLUE_SCROLL_HARD, 6), - ARMADYL_PLATELEGS(ItemID.ARMADYL_PLATELEGS, BossTab.CLUE_SCROLL_HARD, 6), - ARMADYL_PLATESKIRT(ItemID.ARMADYL_PLATESKIRT, BossTab.CLUE_SCROLL_HARD, 6), - ARMADYL_KITESHIELD(ItemID.ARMADYL_KITESHIELD, BossTab.CLUE_SCROLL_HARD, 6), - GILDED_FULL_HELM(ItemID.GILDED_FULL_HELM, BossTab.CLUE_SCROLL_HARD, 7), - GILDED_PLATEBODY(ItemID.GILDED_PLATEBODY, BossTab.CLUE_SCROLL_HARD, 7), - GILDED_PLATELEGS(ItemID.GILDED_PLATELEGS, BossTab.CLUE_SCROLL_HARD, 7), - GILDED_PLATESKIRT(ItemID.GILDED_PLATESKIRT, BossTab.CLUE_SCROLL_HARD, 7), - GILDED_KITESHIELD(ItemID.GILDED_KITESHIELD, BossTab.CLUE_SCROLL_HARD, 7), - GILDED_MED_HELM(ItemID.GILDED_MED_HELM, BossTab.CLUE_SCROLL_HARD, 8), - GILDED_CHAINBODY(ItemID.GILDED_CHAINBODY, BossTab.CLUE_SCROLL_HARD, 8), - GILDED_SQ_SHIELD(ItemID.GILDED_SQ_SHIELD, BossTab.CLUE_SCROLL_HARD, 8), - GILDED_2H_SWORD(ItemID.GILDED_2H_SWORD, BossTab.CLUE_SCROLL_HARD, 8), - GILDED_SPEAR(ItemID.GILDED_SPEAR, BossTab.CLUE_SCROLL_HARD, 8), - GILDED_HASTA(ItemID.GILDED_HASTA, BossTab.CLUE_SCROLL_HARD, 8), - RUNE_HELM_H1(ItemID.RUNE_HELM_H1, BossTab.CLUE_SCROLL_HARD, 9), - RUNE_HELM_H2(ItemID.RUNE_HELM_H2, BossTab.CLUE_SCROLL_HARD, 9), - RUNE_HELM_H3(ItemID.RUNE_HELM_H3, BossTab.CLUE_SCROLL_HARD, 9), - RUNE_HELM_H4(ItemID.RUNE_HELM_H4, BossTab.CLUE_SCROLL_HARD, 9), - RUNE_HELM_H5(ItemID.RUNE_HELM_H5, BossTab.CLUE_SCROLL_HARD, 9), - RUNE_SHIELD_H1(ItemID.RUNE_SHIELD_H1, BossTab.CLUE_SCROLL_HARD, 10), - RUNE_SHIELD_H2(ItemID.RUNE_SHIELD_H2, BossTab.CLUE_SCROLL_HARD, 10), - RUNE_SHIELD_H3(ItemID.RUNE_SHIELD_H3, BossTab.CLUE_SCROLL_HARD, 10), - RUNE_SHIELD_H4(ItemID.RUNE_SHIELD_H4, BossTab.CLUE_SCROLL_HARD, 10), - RUNE_SHIELD_H5(ItemID.RUNE_SHIELD_H5, BossTab.CLUE_SCROLL_HARD, 10), - BLUE_DHIDE_BODY_T(ItemID.BLUE_DHIDE_BODY_T, BossTab.CLUE_SCROLL_HARD, 11), - BLUE_DHIDE_CHAPS_T(ItemID.BLUE_DHIDE_CHAPS_T, BossTab.CLUE_SCROLL_HARD, 11), - BLUE_DHIDE_BODY_G(ItemID.BLUE_DHIDE_BODY_G, BossTab.CLUE_SCROLL_HARD, 11), - BLUE_DHIDE_CHAPS_G(ItemID.BLUE_DHIDE_CHAPS_G, BossTab.CLUE_SCROLL_HARD, 11), - RED_DHIDE_BODY_T(ItemID.RED_DHIDE_BODY_T, BossTab.CLUE_SCROLL_HARD, 12), - RED_DHIDE_CHAPS_T(ItemID.RED_DHIDE_CHAPS_T, BossTab.CLUE_SCROLL_HARD, 12), - RED_DHIDE_BODY_G(ItemID.RED_DHIDE_BODY_G, BossTab.CLUE_SCROLL_HARD, 12), - RED_DHIDE_CHAPS_G(ItemID.RED_DHIDE_CHAPS_G, BossTab.CLUE_SCROLL_HARD, 12), - ENCHANTED_HAT(ItemID.ENCHANTED_HAT, BossTab.CLUE_SCROLL_HARD, 13), - ENCHANTED_TOP(ItemID.ENCHANTED_TOP, BossTab.CLUE_SCROLL_HARD, 13), - ENCHANTED_ROBE(ItemID.ENCHANTED_ROBE, BossTab.CLUE_SCROLL_HARD, 13), - AMULET_OF_GLORY_T(ItemID.AMULET_OF_GLORY_T, BossTab.CLUE_SCROLL_HARD, 13), - ROBIN_HOOD_HAT(ItemID.ROBIN_HOOD_HAT, BossTab.CLUE_SCROLL_HARD, 14), - PIRATE_HAT(ItemID.PIRATE_HAT, BossTab.CLUE_SCROLL_HARD, 14), - PITH_HELMET(ItemID.PITH_HELMET, BossTab.CLUE_SCROLL_HARD, 14), - EXPLORER_BACKPACK(ItemID.EXPLORER_BACKPACK, BossTab.CLUE_SCROLL_HARD, 14), - RED_CAVALIER(ItemID.RED_CAVALIER, BossTab.CLUE_SCROLL_HARD, 15), - TAN_CAVALIER(ItemID.TAN_CAVALIER, BossTab.CLUE_SCROLL_HARD, 15), - DARK_CAVALIER(ItemID.DARK_CAVALIER, BossTab.CLUE_SCROLL_HARD, 15), - BLACK_CAVALIER(ItemID.BLACK_CAVALIER, BossTab.CLUE_SCROLL_HARD, 15), - NAVY_CAVALIER(ItemID.NAVY_CAVALIER, BossTab.CLUE_SCROLL_HARD, 15), - WHITE_CAVALIER(ItemID.WHITE_CAVALIER, BossTab.CLUE_SCROLL_HARD, 15), - _3RD_AGE_FULL_HELMET(ItemID._3RD_AGE_FULL_HELMET, BossTab.CLUE_SCROLL_HARD, 16), - _3RD_AGE_PLATEBODY(ItemID._3RD_AGE_PLATEBODY, BossTab.CLUE_SCROLL_HARD, 16), - _3RD_AGE_PLATELEGS(ItemID._3RD_AGE_PLATELEGS, BossTab.CLUE_SCROLL_HARD, 16), - _3RD_AGE_PLATESKIRT(ItemID._3RD_AGE_PLATESKIRT, BossTab.CLUE_SCROLL_HARD, 16), - _3RD_AGE_KITESHIELD(ItemID._3RD_AGE_KITESHIELD, BossTab.CLUE_SCROLL_HARD, 16), - _3RD_AGE_RANGE_COIF(ItemID._3RD_AGE_RANGE_COIF, BossTab.CLUE_SCROLL_HARD, 17), - _3RD_AGE_RANGE_TOP(ItemID._3RD_AGE_RANGE_TOP, BossTab.CLUE_SCROLL_HARD, 17), - _3RD_AGE_RANGE_LEGS(ItemID._3RD_AGE_RANGE_LEGS, BossTab.CLUE_SCROLL_HARD, 17), - _3RD_AGE_VAMBRACES(ItemID._3RD_AGE_VAMBRACES, BossTab.CLUE_SCROLL_HARD, 17), - _3RD_AGE_MAGE_HAT(ItemID._3RD_AGE_MAGE_HAT, BossTab.CLUE_SCROLL_HARD, 18), - _3RD_AGE_ROBE_TOP(ItemID._3RD_AGE_ROBE_TOP, BossTab.CLUE_SCROLL_HARD, 18), - _3RD_AGE_ROBE(ItemID._3RD_AGE_ROBE, BossTab.CLUE_SCROLL_HARD, 18), - _3RD_AGE_AMULET(ItemID._3RD_AGE_AMULET, BossTab.CLUE_SCROLL_HARD, 18), - GUTHIX_COIF(ItemID.GUTHIX_COIF, BossTab.CLUE_SCROLL_HARD, 19), - GUTHIX_DHIDE(ItemID.GUTHIX_DRAGONHIDE, BossTab.CLUE_SCROLL_HARD, 19), - GUTHIX_CHAPS(ItemID.GUTHIX_CHAPS, BossTab.CLUE_SCROLL_HARD, 19), - GUTHIX_BRACERS(ItemID.GUTHIX_BRACERS, BossTab.CLUE_SCROLL_HARD, 19), - GUTHIX_DHIDE_BOOTS(ItemID.GUTHIX_DHIDE_BOOTS, BossTab.CLUE_SCROLL_HARD, 19), - GUTHIX_DHIDE_SHIELD(ItemID.GUTHIX_DHIDE_SHIELD, BossTab.CLUE_SCROLL_HARD, 19), - SARADOMIN_COIF(ItemID.SARADOMIN_COIF, BossTab.CLUE_SCROLL_HARD, 20), - SARADOMIN_DHIDE(ItemID.SARADOMIN_DHIDE, BossTab.CLUE_SCROLL_HARD, 20), - SARADOMIN_CHAPS(ItemID.SARADOMIN_CHAPS, BossTab.CLUE_SCROLL_HARD, 20), - SARADOMIN_BRACERS(ItemID.SARADOMIN_BRACERS, BossTab.CLUE_SCROLL_HARD, 20), - SARADOMIN_DHIDE_BOOTS(ItemID.SARADOMIN_DHIDE_BOOTS, BossTab.CLUE_SCROLL_HARD, 20), - SARADOMIN_DHIDE_SHIELD(ItemID.SARADOMIN_DHIDE_SHIELD, BossTab.CLUE_SCROLL_HARD, 20), - ZAMORAK_COIF(ItemID.ZAMORAK_COIF, BossTab.CLUE_SCROLL_HARD, 21), - ZAMORAK_DHIDE(ItemID.ZAMORAK_DHIDE, BossTab.CLUE_SCROLL_HARD, 21), - ZAMORAK_CHAPS(ItemID.ZAMORAK_CHAPS, BossTab.CLUE_SCROLL_HARD, 21), - ZAMORAK_BRACERS(ItemID.ZAMORAK_BRACERS, BossTab.CLUE_SCROLL_HARD, 21), - ZAMORAK_DHIDE_BOOTS(ItemID.ZAMORAK_DHIDE_BOOTS, BossTab.CLUE_SCROLL_HARD, 21), - ZAMORAK_DHIDE_SHIELD(ItemID.ZAMORAK_DHIDE_SHIELD, BossTab.CLUE_SCROLL_HARD, 21), - ANCIENT_COIF(ItemID.ANCIENT_COIF, BossTab.CLUE_SCROLL_HARD, 22), - ANCIENT_DHIDE(ItemID.ANCIENT_DHIDE, BossTab.CLUE_SCROLL_HARD, 22), - ANCIENT_CHAPS(ItemID.ANCIENT_CHAPS, BossTab.CLUE_SCROLL_HARD, 22), - ANCIENT_BRACERS(ItemID.ANCIENT_BRACERS, BossTab.CLUE_SCROLL_HARD, 22), - ANCIENT_DHIDE_BOOTS(ItemID.ANCIENT_DHIDE_BOOTS, BossTab.CLUE_SCROLL_HARD, 22), - ANCIENT_DHIDE_SHIELD(ItemID.ANCIENT_DHIDE_SHIELD, BossTab.CLUE_SCROLL_HARD, 22), - BANDOS_COIF(ItemID.BANDOS_COIF, BossTab.CLUE_SCROLL_HARD, 23), - BANDOS_DHIDE(ItemID.BANDOS_DHIDE, BossTab.CLUE_SCROLL_HARD, 23), - BANDOS_CHAPS(ItemID.BANDOS_CHAPS, BossTab.CLUE_SCROLL_HARD, 23), - BANDOS_BRACERS(ItemID.BANDOS_BRACERS, BossTab.CLUE_SCROLL_HARD, 23), - BANDOS_DHIDE_BOOTS(ItemID.BANDOS_DHIDE_BOOTS, BossTab.CLUE_SCROLL_HARD, 23), - BANDOS_DHIDE_SHIELD(ItemID.BANDOS_DHIDE_SHIELD, BossTab.CLUE_SCROLL_HARD, 23), - ARMADYL_COIF(ItemID.ARMADYL_COIF, BossTab.CLUE_SCROLL_HARD, 24), - ARMADYL_DHIDE(ItemID.ARMADYL_DHIDE, BossTab.CLUE_SCROLL_HARD, 24), - ARMADYL_CHAPS(ItemID.ARMADYL_CHAPS, BossTab.CLUE_SCROLL_HARD, 24), - ARMADYL_BRACERS(ItemID.ARMADYL_BRACERS, BossTab.CLUE_SCROLL_HARD, 24), - ARMADYL_DHIDE_BOOTS(ItemID.ARMADYL_DHIDE_BOOTS, BossTab.CLUE_SCROLL_HARD, 24), - ARMADYL_DHIDE_SHIELD(ItemID.ARMADYL_DHIDE_SHIELD, BossTab.CLUE_SCROLL_HARD, 24), - GUTHIX_STOLE(ItemID.GUTHIX_STOLE, BossTab.CLUE_SCROLL_HARD, 25), - GUTHIX_CROZIER(ItemID.GUTHIX_CROZIER, BossTab.CLUE_SCROLL_HARD, 25), - SARADOMIN_STOLE(ItemID.SARADOMIN_STOLE, BossTab.CLUE_SCROLL_HARD, 25), - SARADOMIN_CROZIER(ItemID.SARADOMIN_CROZIER, BossTab.CLUE_SCROLL_HARD, 25), - ZAMORAK_STOLE(ItemID.ZAMORAK_STOLE, BossTab.CLUE_SCROLL_HARD, 25), - ZAMORAK_CROZIER(ItemID.ZAMORAK_CROZIER, BossTab.CLUE_SCROLL_HARD, 25), - GREEN_DRAGON_MASK(ItemID.GREEN_DRAGON_MASK, BossTab.CLUE_SCROLL_HARD, 26), - RED_DRAGON_MASK(ItemID.RED_DRAGON_MASK, BossTab.CLUE_SCROLL_HARD, 26), - BLUE_DRAGON_MASK(ItemID.BLUE_DRAGON_MASK, BossTab.CLUE_SCROLL_HARD, 26), - BLACK_DRAGON_MASK(ItemID.BLACK_DRAGON_MASK, BossTab.CLUE_SCROLL_HARD, 26), - RUNE_CANE(ItemID.RUNE_CANE, BossTab.CLUE_SCROLL_HARD, 27), - ZOMBIE_HEAD(ItemID.ZOMBIE_HEAD, BossTab.CLUE_SCROLL_HARD, 27), - CYCLOPS_HEAD(ItemID.CYCLOPS_HEAD, BossTab.CLUE_SCROLL_HARD, 27), - NUNCHAKU(ItemID.NUNCHAKU, BossTab.CLUE_SCROLL_HARD, 27), - DUAL_SAI(ItemID.DUAL_SAI, BossTab.CLUE_SCROLL_HARD, 27), - THIEVING_BAG(ItemID.THIEVING_BAG, BossTab.CLUE_SCROLL_HARD, 27), - DRAGON_BOOTS_ORNAMENT_KIT(ItemID.DRAGON_BOOTS_ORNAMENT_KIT, BossTab.CLUE_SCROLL_HARD, 28), - RUNE_DEFENDER_ORNAMENT_KIT(ItemID.RUNE_DEFENDER_ORNAMENT_KIT, BossTab.CLUE_SCROLL_HARD, 28), - TZHAARKETOM_ORNAMENT_KIT(ItemID.TZHAARKETOM_ORNAMENT_KIT, BossTab.CLUE_SCROLL_HARD, 28), - BERSERKER_NECKLACE_ORNAMENT_KIT(ItemID.BERSERKER_NECKLACE_ORNAMENT_KIT, BossTab.CLUE_SCROLL_HARD, 28), - RUNE_PLATEBODY_H1(ItemID.RUNE_PLATEBODY_H1, BossTab.CLUE_SCROLL_HARD, 29), - RUNE_PLATEBODY_H2(ItemID.RUNE_PLATEBODY_H2, BossTab.CLUE_SCROLL_HARD, 29), - RUNE_PLATEBODY_H3(ItemID.RUNE_PLATEBODY_H3, BossTab.CLUE_SCROLL_HARD, 29), - RUNE_PLATEBODY_H4(ItemID.RUNE_PLATEBODY_H4, BossTab.CLUE_SCROLL_HARD, 29), - RUNE_PLATEBODY_H5(ItemID.RUNE_PLATEBODY_H5, BossTab.CLUE_SCROLL_HARD, 29), - - // Elite Clue Scrolls - DRAGON_FULL_HELM_ORNAMENT_KIT(ItemID.DRAGON_FULL_HELM_ORNAMENT_KIT, BossTab.CLUE_SCROLL_ELITE, -1), - DRAGON_CHAINBODY_ORNAMENT_KIT(ItemID.DRAGON_CHAINBODY_ORNAMENT_KIT, BossTab.CLUE_SCROLL_ELITE, -1), - DRAGON_LEGSSKIRT_ORNAMENT_KIT(ItemID.DRAGON_LEGSSKIRT_ORNAMENT_KIT, BossTab.CLUE_SCROLL_ELITE, -1), - DRAGON_SQ_SHIELD_ORNAMENT_KIT(ItemID.DRAGON_SQ_SHIELD_ORNAMENT_KIT, BossTab.CLUE_SCROLL_ELITE, -1), - DRAGON_SCIMITAR_ORNAMENT_KIT(ItemID.DRAGON_SCIMITAR_ORNAMENT_KIT, BossTab.CLUE_SCROLL_ELITE, -1), - LIGHT_INFINITY_COLOUR_KIT(ItemID.LIGHT_INFINITY_COLOUR_KIT, BossTab.CLUE_SCROLL_ELITE, 0), - DARK_INFINITY_COLOUR_KIT(ItemID.DARK_INFINITY_COLOUR_KIT, BossTab.CLUE_SCROLL_ELITE, 0), - FURY_ORNAMENT_KIT(ItemID.FURY_ORNAMENT_KIT, BossTab.CLUE_SCROLL_ELITE, 0), - MUSKETEER_HAT(ItemID.MUSKETEER_HAT, BossTab.CLUE_SCROLL_ELITE, 1), - MUSKETEER_TABARD(ItemID.MUSKETEER_TABARD, BossTab.CLUE_SCROLL_ELITE, 1), - MUSKETEER_PANTS(ItemID.MUSKETEER_PANTS, BossTab.CLUE_SCROLL_ELITE, 1), - DRAGON_CANE(ItemID.DRAGON_CANE, BossTab.CLUE_SCROLL_ELITE, 1), - TOP_HAT(ItemID.TOP_HAT, BossTab.CLUE_SCROLL_ELITE, 2), - MONOCLE(ItemID.MONOCLE, BossTab.CLUE_SCROLL_ELITE, 2), - BRIEFCASE(ItemID.BRIEFCASE, BossTab.CLUE_SCROLL_ELITE, 2), - SAGACIOUS_SPECTACLES(ItemID.SAGACIOUS_SPECTACLES, BossTab.CLUE_SCROLL_ELITE, 2), - BIG_PIRATE_HAT(ItemID.BIG_PIRATE_HAT, BossTab.CLUE_SCROLL_ELITE, 3), - DEERSTALKER(ItemID.DEERSTALKER, BossTab.CLUE_SCROLL_ELITE, 3), - BLACKSMITHS_HELM(ItemID.BLACKSMITHS_HELM, BossTab.CLUE_SCROLL_ELITE, 3), - BUCKET_HELM(ItemID.BUCKET_HELM, BossTab.CLUE_SCROLL_ELITE, 3), - AFRO(ItemID.AFRO, BossTab.CLUE_SCROLL_ELITE, 3), - GILDED_COIF(ItemID.GILDED_COIF, BossTab.CLUE_SCROLL_ELITE, 4), - GILDED_DHIDE_BODY(ItemID.GILDED_DHIDE_BODY, BossTab.CLUE_SCROLL_ELITE, 4), - GILDED_DHIDE_CHAPS(ItemID.GILDED_DHIDE_CHAPS, BossTab.CLUE_SCROLL_ELITE, 4), - GILDED_DHIDE_VAMBS(ItemID.GILDED_DHIDE_VAMBS, BossTab.CLUE_SCROLL_ELITE, 4), - GILDED_BOOTS(ItemID.GILDED_BOOTS, BossTab.CLUE_SCROLL_ELITE, 5), - GILDED_SCIMITAR(ItemID.GILDED_SCIMITAR, BossTab.CLUE_SCROLL_ELITE, 5), - GILDED_PICKAXE(ItemID.GILDED_PICKAXE, BossTab.CLUE_SCROLL_ELITE, 5), - GILDED_SPADE(ItemID.GILDED_SPADE, BossTab.CLUE_SCROLL_ELITE, 5), - GILDED_AXE(ItemID.GILDED_AXE, BossTab.CLUE_SCROLL_ELITE, 5), - BRONZE_DRAGON_MASK(ItemID.BRONZE_DRAGON_MASK, BossTab.CLUE_SCROLL_ELITE, 6), - IRON_DRAGON_MASK(ItemID.IRON_DRAGON_MASK, BossTab.CLUE_SCROLL_ELITE, 6), - STEEL_DRAGON_MASK(ItemID.STEEL_DRAGON_MASK, BossTab.CLUE_SCROLL_ELITE, 6), - MITHRIL_DRAGON_MASK(ItemID.MITHRIL_DRAGON_MASK, BossTab.CLUE_SCROLL_ELITE, 6), - ADAMANT_DRAGON_MASK(ItemID.ADAMANT_DRAGON_MASK, BossTab.CLUE_SCROLL_ELITE, 6), - RUNE_DRAGON_MASK(ItemID.RUNE_DRAGON_MASK, BossTab.CLUE_SCROLL_ELITE, 6), - LAVA_DRAGON_MASK(ItemID.LAVA_DRAGON_MASK, BossTab.CLUE_SCROLL_ELITE, 6), - BLACK_DHIDE_BODY_T(ItemID.BLACK_DHIDE_BODY_T, BossTab.CLUE_SCROLL_ELITE, 7), - BLACK_DHIDE_CHAPS_T(ItemID.BLACK_DHIDE_CHAPS_T, BossTab.CLUE_SCROLL_ELITE, 7), - BLACK_DHIDE_BODY_G(ItemID.BLACK_DHIDE_BODY_G, BossTab.CLUE_SCROLL_ELITE, 7), - BLACK_DHIDE_CHAPS_G(ItemID.BLACK_DHIDE_CHAPS_G, BossTab.CLUE_SCROLL_ELITE, 7), - _3RD_AGE_CLOAK(ItemID._3RD_AGE_CLOAK, BossTab.CLUE_SCROLL_ELITE, 8), - _3RD_AGE_WAND(ItemID._3RD_AGE_WAND, BossTab.CLUE_SCROLL_ELITE, 8), - _3RD_AGE_BOW(ItemID._3RD_AGE_BOW, BossTab.CLUE_SCROLL_ELITE, 8), - _3RD_AGE_LONGSWORD(ItemID._3RD_AGE_LONGSWORD, BossTab.CLUE_SCROLL_ELITE, 8), - ROYAL_CROWN(ItemID.ROYAL_CROWN, BossTab.CLUE_SCROLL_ELITE, 9), - ROYAL_GOWN_TOP(ItemID.ROYAL_GOWN_TOP, BossTab.CLUE_SCROLL_ELITE, 9), - ROYAL_GOWN_BOTTOM(ItemID.ROYAL_GOWN_BOTTOM, BossTab.CLUE_SCROLL_ELITE, 9), - ROYAL_SCEPTRE(ItemID.ROYAL_SCEPTRE, BossTab.CLUE_SCROLL_ELITE, 9), - ARCEUUS_SCARF(ItemID.ARCEUUS_SCARF, BossTab.CLUE_SCROLL_ELITE, 10), - HOSIDIUS_SCARF(ItemID.HOSIDIUS_SCARF, BossTab.CLUE_SCROLL_ELITE, 10), - LOVAKENGJ_SCARF(ItemID.LOVAKENGJ_SCARF, BossTab.CLUE_SCROLL_ELITE, 10), - PISCARILIUS_SCARF(ItemID.PISCARILIUS_SCARF, BossTab.CLUE_SCROLL_ELITE, 10), - SHAYZIEN_SCARF(ItemID.SHAYZIEN_SCARF, BossTab.CLUE_SCROLL_ELITE, 10), - DARK_BOW_TIE(ItemID.DARK_BOW_TIE, BossTab.CLUE_SCROLL_ELITE, 11), - DARK_TUXEDO_JACKET(ItemID.DARK_TUXEDO_JACKET, BossTab.CLUE_SCROLL_ELITE, 11), - DARK_TROUSERS(ItemID.DARK_TROUSERS, BossTab.CLUE_SCROLL_ELITE, 11), - DARK_TUXEDO_CUFFS(ItemID.DARK_TUXEDO_CUFFS, BossTab.CLUE_SCROLL_ELITE, 11), - DARK_TUXEDO_SHOES(ItemID.DARK_TUXEDO_SHOES, BossTab.CLUE_SCROLL_ELITE, 11), - LIGHT_BOW_TIE(ItemID.LIGHT_BOW_TIE, BossTab.CLUE_SCROLL_ELITE, 12), - LIGHT_TUXEDO_JACKET(ItemID.LIGHT_TUXEDO_JACKET, BossTab.CLUE_SCROLL_ELITE, 12), - LIGHT_TROUSERS(ItemID.LIGHT_TROUSERS, BossTab.CLUE_SCROLL_ELITE, 12), - LIGHT_TUXEDO_CUFFS(ItemID.LIGHT_TUXEDO_CUFFS, BossTab.CLUE_SCROLL_ELITE, 12), - LIGHT_TUXEDO_SHOES(ItemID.LIGHT_TUXEDO_SHOES, BossTab.CLUE_SCROLL_ELITE, 12), - HOLY_WRAPS(ItemID.HOLY_WRAPS, BossTab.CLUE_SCROLL_ELITE, 13), - RING_OF_NATURE(ItemID.RING_OF_NATURE, BossTab.CLUE_SCROLL_ELITE, 13), - HEAVY_CASKET(ItemID.HEAVY_CASKET, BossTab.CLUE_SCROLL_ELITE, 13), - KATANA(ItemID.KATANA, BossTab.CLUE_SCROLL_ELITE, 13), - URIS_HAT(ItemID.URIS_HAT, BossTab.CLUE_SCROLL_ELITE, 13), - RANGERS_TUNIC(ItemID.RANGERS_TUNIC, BossTab.CLUE_SCROLL_ELITE, 14), - RANGERS_TIGHTS(ItemID.RANGERS_TIGHTS, BossTab.CLUE_SCROLL_ELITE, 14), - RANGER_GLOVES(ItemID.RANGER_GLOVES, BossTab.CLUE_SCROLL_ELITE, 14), - - // Master Clue Scrolls - DRAGON_PLATEBODY_ORNAMENT_KIT(ItemID.DRAGON_PLATEBODY_ORNAMENT_KIT, BossTab.CLUE_SCROLL_MASTER, -1), - DRAGON_KITESHIELD_ORNAMENT_KIT(ItemID.DRAGON_KITESHIELD_ORNAMENT_KIT, BossTab.CLUE_SCROLL_MASTER, -1), - DRAGON_DEFENDER_ORNAMENT_KIT(ItemID.DRAGON_DEFENDER_ORNAMENT_KIT, BossTab.CLUE_SCROLL_MASTER, -1), - ANGUISH_ORNAMENT_KIT(ItemID.ANGUISH_ORNAMENT_KIT, BossTab.CLUE_SCROLL_MASTER, -1), - TORTURE_ORNAMENT_KIT(ItemID.TORTURE_ORNAMENT_KIT, BossTab.CLUE_SCROLL_MASTER, -1), - TORMENTED_ORNAMENT_KIT(ItemID.TORMENTED_ORNAMENT_KIT, BossTab.CLUE_SCROLL_MASTER, -1), - OCCULT_ORNAMENT_KIT(ItemID.OCCULT_ORNAMENT_KIT, BossTab.CLUE_SCROLL_MASTER, 0), - ARMADYL_GODSWORD_ORNAMENT_KIT(ItemID.ARMADYL_GODSWORD_ORNAMENT_KIT, BossTab.CLUE_SCROLL_MASTER, 0), - BANDOS_GODSWORD_ORNAMENT_KIT(ItemID.BANDOS_GODSWORD_ORNAMENT_KIT, BossTab.CLUE_SCROLL_MASTER, 0), - SARADOMIN_GODSWORD_ORNAMENT_KIT(ItemID.SARADOMIN_GODSWORD_ORNAMENT_KIT, BossTab.CLUE_SCROLL_MASTER, 0), - ZAMORAK_GODSWORD_ORNAMENT_KIT(ItemID.ZAMORAK_GODSWORD_ORNAMENT_KIT, BossTab.CLUE_SCROLL_MASTER, 0), - _3RD_AGE_DRUIDIC(ItemID._3RD_AGE_DRUIDIC_ROBE_TOP, BossTab.CLUE_SCROLL_MASTER, 1), - _3RD_AGE_DRUIDIC_CLOAK(ItemID._3RD_AGE_DRUIDIC_CLOAK, BossTab.CLUE_SCROLL_MASTER, 1), - _3RD_AGE_DRUIDIC_ROBE_BOTTOMS(ItemID._3RD_AGE_DRUIDIC_ROBE_BOTTOMS, BossTab.CLUE_SCROLL_MASTER, 1), - _3RD_AGE_DRUIDIC_STAFF(ItemID._3RD_AGE_DRUIDIC_STAFF, BossTab.CLUE_SCROLL_MASTER, 1), - _3RD_AGE_AXE(ItemID._3RD_AGE_AXE, BossTab.CLUE_SCROLL_MASTER, 1), - _3RD_AGE_PICKAXE(ItemID._3RD_AGE_PICKAXE, BossTab.CLUE_SCROLL_MASTER, 1), - LESSER_DEMON_MASK(ItemID.LESSER_DEMON_MASK, BossTab.CLUE_SCROLL_MASTER, 2), - GREATER_DEMON_MASK(ItemID.GREATER_DEMON_MASK, BossTab.CLUE_SCROLL_MASTER, 2), - BLACK_DEMON_MASK(ItemID.BLACK_DEMON_MASK, BossTab.CLUE_SCROLL_MASTER, 2), - JUNGLE_DEMON_MASK(ItemID.JUNGLE_DEMON_MASK, BossTab.CLUE_SCROLL_MASTER, 2), - OLD_DEMON_MASK(ItemID.OLD_DEMON_MASK, BossTab.CLUE_SCROLL_MASTER, 2), - ARCEUUS_HOOD(ItemID.ARCEUUS_HOOD, BossTab.CLUE_SCROLL_MASTER, 3), - HOSIDIUS_HOOD(ItemID.HOSIDIUS_HOOD, BossTab.CLUE_SCROLL_MASTER, 3), - LOVAKENGJ_HOOD(ItemID.LOVAKENGJ_HOOD, BossTab.CLUE_SCROLL_MASTER, 3), - PISCARILIUS_HOOD(ItemID.PISCARILIUS_HOOD, BossTab.CLUE_SCROLL_MASTER, 3), - SHAYZIEN_HOUSE_HOOD(ItemID.SHAYZIEN_HOOD, BossTab.CLUE_SCROLL_MASTER, 3), - SAMURAI_KASA(ItemID.SAMURAI_KASA, BossTab.CLUE_SCROLL_MASTER, 4), - SAMURAI_SHIRT(ItemID.SAMURAI_SHIRT, BossTab.CLUE_SCROLL_MASTER, 4), - SAMURAI_GREAVES(ItemID.SAMURAI_GREAVES, BossTab.CLUE_SCROLL_MASTER, 4), - SAMURAI_GLOVES(ItemID.SAMURAI_GLOVES, BossTab.CLUE_SCROLL_MASTER, 4), - SAMURAI_BOOTS(ItemID.SAMURAI_BOOTS, BossTab.CLUE_SCROLL_MASTER, 4), - MUMMYS_HEAD(ItemID.MUMMYS_HEAD, BossTab.CLUE_SCROLL_MASTER, 5), - MUMMYS_BODY(ItemID.MUMMYS_BODY, BossTab.CLUE_SCROLL_MASTER, 5), - MUMMYS_LEGS(ItemID.MUMMYS_LEGS, BossTab.CLUE_SCROLL_MASTER, 5), - MUMMYS_HANDS(ItemID.MUMMYS_HANDS, BossTab.CLUE_SCROLL_MASTER, 5), - MUMMYS_FEET(ItemID.MUMMYS_FEET, BossTab.CLUE_SCROLL_MASTER, 5), - ANKOU_MASK(ItemID.ANKOU_MASK, BossTab.CLUE_SCROLL_MASTER, 6), - ANKOU_TOP(ItemID.ANKOU_TOP, BossTab.CLUE_SCROLL_MASTER, 6), - ANKOUS_LEGGINGS(ItemID.ANKOU_LEGGINGS, BossTab.CLUE_SCROLL_MASTER, 6), - ANKOU_GLOVES(ItemID.ANKOU_GLOVES, BossTab.CLUE_SCROLL_MASTER, 6), - ANKOU_SOCKS(ItemID.ANKOU_SOCKS, BossTab.CLUE_SCROLL_MASTER, 6), - HOOD_OF_DARKNESS(ItemID.HOOD_OF_DARKNESS, BossTab.CLUE_SCROLL_MASTER, 7), - ROBE_TOP_OF_DARKNESS(ItemID.ROBE_TOP_OF_DARKNESS, BossTab.CLUE_SCROLL_MASTER, 7), - ROBE_BOTTOM_OF_DARKNESS(ItemID.ROBE_BOTTOM_OF_DARKNESS, BossTab.CLUE_SCROLL_MASTER, 7), - BOOTS_OF_DARKNESS(ItemID.BOOTS_OF_DARKNESS, BossTab.CLUE_SCROLL_MASTER, 7), - GLOVES_OF_DARKNESS(ItemID.GLOVES_OF_DARKNESS, BossTab.CLUE_SCROLL_MASTER, 7), - RING_OF_COINS(ItemID.RING_OF_COINS, BossTab.CLUE_SCROLL_MASTER, 8), - LEFT_EYE_PATCH(ItemID.LEFT_EYE_PATCH, BossTab.CLUE_SCROLL_MASTER, 8), - OBSIDIAN_CAPE_R(ItemID.OBSIDIAN_CAPE_R, BossTab.CLUE_SCROLL_MASTER, 8), - FANCY_TIARA(ItemID.FANCY_TIARA, BossTab.CLUE_SCROLL_MASTER, 8), - HALF_MOON_SPECTACLES(ItemID.HALF_MOON_SPECTACLES, BossTab.CLUE_SCROLL_MASTER, 8), - ALE_OF_THE_GODS(ItemID.ALE_OF_THE_GODS, BossTab.CLUE_SCROLL_MASTER, 9), - BUCKET_HELM_G(ItemID.BUCKET_HELM_G, BossTab.CLUE_SCROLL_MASTER, 9), - BOWL_WIG(ItemID.BOWL_WIG, BossTab.CLUE_SCROLL_MASTER, 9), - BLOODHOUND(ItemID.BLOODHOUND, BossTab.CLUE_SCROLL_MASTER, 9), - - // Wintertodt - BRUMA_TORCH(ItemID.BRUMA_TORCH, BossTab.WINTERTODT, -1), - TOME_OF_FIRE(ItemID.TOME_OF_FIRE_EMPTY, BossTab.WINTERTODT, -1), - PET_PHOENIX(ItemID.PHOENIX, BossTab.WINTERTODT, -1), - PYROMANCER_HOOD(ItemID.PYROMANCER_HOOD, BossTab.WINTERTODT, 0), - PYROMANCER_GARB(ItemID.PYROMANCER_GARB, BossTab.WINTERTODT, 0), - PYROMANCER_ROBE(ItemID.PYROMANCER_ROBE, BossTab.WINTERTODT, 0), - PYROMANCER_BOOTS(ItemID.PYROMANCER_BOOTS, BossTab.WINTERTODT, 0), - WARM_GLOVES(ItemID.WARM_GLOVES, BossTab.WINTERTODT, 0), - - // Herbiboar - HERBI(ItemID.HERBI, BossTab.HERBIBOAR, 0), - - // Elven Crystal Chest - DRAGONSTONE_FULL_HELM(ItemID.DRAGONSTONE_FULL_HELM, BossTab.ELVEN_CRYSTAL_CHEST, 0), - DRAGONSTONE_PLATEBODY(ItemID.DRAGONSTONE_PLATEBODY, BossTab.ELVEN_CRYSTAL_CHEST, 0), - DRAGONSTONE_PLATELEGS(ItemID.DRAGONSTONE_PLATELEGS, BossTab.ELVEN_CRYSTAL_CHEST, 0), - DRAGONSTONE_BOOTS(ItemID.DRAGONSTONE_BOOTS, BossTab.ELVEN_CRYSTAL_CHEST, 0), - DRAGONSTONE_GAUNTLETS(ItemID.DRAGONSTONE_GAUNTLETS, BossTab.ELVEN_CRYSTAL_CHEST, 0), - - // Brimstone chest - MYSTIC_HAT_DUSK(ItemID.MYSTIC_HAT_DUSK, BossTab.BRIMSTONE_CHEST, 0), - MYSTIC_ROBE_TOP_DUSK(ItemID.MYSTIC_ROBE_TOP_DUSK, BossTab.BRIMSTONE_CHEST, 0), - MYSTIC_ROBE_BOTTOM_DUSK(ItemID.MYSTIC_ROBE_BOTTOM_DUSK, BossTab.BRIMSTONE_CHEST, 0), - MYSTIC_GLOVES_DUSK(ItemID.MYSTIC_GLOVES_DUSK, BossTab.BRIMSTONE_CHEST, 0), - MYSTIC_BOOTS_DUSK(ItemID.MYSTIC_BOOTS_DUSK, BossTab.BRIMSTONE_CHEST, 0), - BROKEN_DRAGON_HASTA(ItemID.BROKEN_DRAGON_HASTA, BossTab.BRIMSTONE_CHEST, 0), - - CRYSTAL_TOOL_SEED(ItemID.CRYSTAL_TOOL_SEED, BossTab.ZALCANO, -1), - ZALCANO_SHARD(ItemID.ZALCANO_SHARD, BossTab.ZALCANO, -1), - SMOLCANO(ItemID.SMOLCANO, BossTab.ZALCANO, -1); - - private static final ImmutableMultimap BOSS_MAP; - - static - { - final ImmutableMultimap.Builder map = ImmutableMultimap.builder(); - for (UniqueItem item : values()) - { - for (BossTab b : item.getBosses()) - { - map.put(b.getName(), item); - } - } - - BOSS_MAP = map.build(); - } - - private final int itemID; - private final BossTab[] bosses; - private final int position; - private String name; - private int price; - private int linkedID; - @Setter - // Used to store the qty being displayed on the sprite - private int qty; - - // Non-Shared Unique Items - UniqueItem(int id, BossTab boss, int position) - { - this.itemID = id; - this.bosses = new BossTab[]{boss}; - this.position = position; - } - - // Shared Unique Items - UniqueItem(int id, BossTab... bosses) - { - this.itemID = id; - this.bosses = bosses; - this.position = -1; - } - - public static void prepareUniqueItems(final ItemManager itemManager) - { - for (final UniqueItem item : values()) - { - if (item.getName() != null) - { - return; - } - - final ItemDefinition c = itemManager.getItemDefinition(item.getItemID()); - item.name = c.getName(); - item.linkedID = c.getLinkedNoteId(); - item.price = itemManager.getItemPrice(c.getId()); - } - } - - public static Collection getUniquesForBoss(final String bossName) - { - return BOSS_MAP.get(bossName); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/ItemPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/ItemPanel.java deleted file mode 100644 index 11b3d6bb50..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/ItemPanel.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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.stonedtracker.ui; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.GridLayout; -import javax.swing.BorderFactory; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import javax.swing.border.Border; -import javax.swing.border.EmptyBorder; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.loottracker.localstorage.LTItemEntry; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.components.shadowlabel.JShadowedLabel; -import net.runelite.client.util.QuantityFormatter; - -@Getter(AccessLevel.PACKAGE) -class ItemPanel extends JPanel -{ - private static final GridBagLayout LAYOUT = new GridBagLayout(); - private static final Dimension PANEL_SIZE = new Dimension(215, 50); - - private static final Border PANEL_BORDER = BorderFactory.createMatteBorder(3, 0, 3, 0, ColorScheme.DARK_GRAY_COLOR); - private static final Color PANEL_BACKGROUND_COLOR = ColorScheme.DARKER_GRAY_COLOR; - - private static final Border CONTAINER_BORDER = BorderFactory.createMatteBorder(4, 15, 4, 15, PANEL_BACKGROUND_COLOR); - - private final LTItemEntry record; - private final long total; - - ItemPanel(final LTItemEntry record, final ItemManager itemManager) - { - setLayout(LAYOUT); - setBorder(PANEL_BORDER); - setBackground(PANEL_BACKGROUND_COLOR); - setPreferredSize(PANEL_SIZE); - - this.record = record; - this.total = record.getPrice() * record.getQuantity(); - - // Item Image Icon - final JLabel icon = new JLabel(); - final boolean stackable = record.getQuantity() > 1; - itemManager.getImage(record.getId(), record.getQuantity(), stackable).addTo(icon); - icon.setHorizontalAlignment(JLabel.CENTER); - - // Container for Info - final JPanel uiInfo = new JPanel(new GridLayout(2, 1)); - uiInfo.setBorder(new EmptyBorder(0, 5, 0, 0)); - uiInfo.setBackground(PANEL_BACKGROUND_COLOR); - - final JShadowedLabel labelName = new JShadowedLabel(this.record.getName()); - labelName.setFont(FontManager.getRunescapeSmallFont()); - labelName.setForeground(getRSValueColor(this.record.getPrice())); - labelName.setVerticalAlignment(SwingUtilities.BOTTOM); - - final JShadowedLabel labelValue = new JShadowedLabel(QuantityFormatter.quantityToStackSize(total) + " gp"); - labelValue.setFont(FontManager.getRunescapeSmallFont()); - labelValue.setForeground(getRSValueColor(total)); - labelValue.setVerticalAlignment(SwingUtilities.TOP); - - uiInfo.add(labelName); - uiInfo.add(labelValue); - - // Create and append elements to container panel - final JPanel panel = createPanel(); - panel.add(icon, BorderLayout.LINE_START); - panel.add(uiInfo, BorderLayout.CENTER); - - final GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.BOTH; - c.weightx = 1; - c.gridx = 0; - c.gridy = 0; - - this.add(panel, c); - this.setToolTipText(buildToolTip(this.record)); - } - - private static String buildToolTip(final LTItemEntry record) - { - final String name = record.getName(); - final int quantity = record.getQuantity(); - final long price = record.getPrice(); - - return "" + name + " x " + QuantityFormatter.formatNumber(quantity) - + "
Price: " + QuantityFormatter.quantityToStackSize(price) - + "
Total: " + QuantityFormatter.quantityToStackSize(quantity * price) + ""; - } - - private static Color getRSValueColor(long val) - { - return (val >= 10000000) ? Color.GREEN : (val >= 100000) ? Color.WHITE : Color.YELLOW; - } - - private JPanel createPanel() - { - final JPanel panel = new JPanel(); - panel.setLayout(new BorderLayout()); - panel.setBorder(CONTAINER_BORDER); - panel.setBackground(PANEL_BACKGROUND_COLOR); - - return panel; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/LootGrid.java b/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/LootGrid.java deleted file mode 100644 index e5af1d92a0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/LootGrid.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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.stonedtracker.ui; - -import java.awt.Dimension; -import java.awt.GridLayout; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.loottracker.localstorage.LTItemEntry; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.util.QuantityFormatter; - -class LootGrid extends JPanel -{ - private static final int ITEMS_PER_ROW = 5; - private static final Dimension ITEM_SIZE = new Dimension(40, 40); - - LootGrid(final LTItemEntry[] itemsToDisplay, final ItemManager itemManager) - { - setBorder(new EmptyBorder(5, 0, 5, 0)); - // Calculates how many rows need to be display to fit all items - final int rowSize = ((itemsToDisplay.length % ITEMS_PER_ROW == 0) ? 0 : 1) + itemsToDisplay.length / ITEMS_PER_ROW; - setLayout(new GridLayout(rowSize, ITEMS_PER_ROW, 1, 1)); - - // Create stacked items from the item list, calculates total price and then displays all the items in the UI. - for (int i = 0; i < rowSize * ITEMS_PER_ROW; i++) - { - final JPanel slot = new JPanel(); - slot.setLayout(new GridLayout(1, 1, 0, 0)); - slot.setBackground(ColorScheme.DARKER_GRAY_COLOR); - slot.setPreferredSize(ITEM_SIZE); - if (i < itemsToDisplay.length) - { - final LTItemEntry item = itemsToDisplay[i]; - if (item == null) - { - continue; - } - final JLabel itemLabel = new JLabel(); - itemLabel.setToolTipText(buildToolTip(item)); - itemLabel.setVerticalAlignment(SwingConstants.CENTER); - itemLabel.setHorizontalAlignment(SwingConstants.CENTER); - itemManager.getImage(item.getId(), item.getQuantity(), item.getQuantity() > 1).addTo(itemLabel); - slot.add(itemLabel); - } - - add(slot); - } - - repaint(); - } - - private static String buildToolTip(final LTItemEntry item) - { - final String name = item.getName(); - final int quantity = item.getQuantity(); - final long price = item.getPrice(); - - return "" + name + " x " + QuantityFormatter.formatNumber(quantity) - + "
Price: " + QuantityFormatter.quantityToStackSize(price) - + "
Total: " + QuantityFormatter.quantityToStackSize(quantity * price) + ""; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/LootPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/LootPanel.java deleted file mode 100644 index 9c1677eb97..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/LootPanel.java +++ /dev/null @@ -1,346 +0,0 @@ -/* - * 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.stonedtracker.ui; - -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.Iterators; -import com.google.common.collect.Multimap; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import javax.swing.border.EmptyBorder; -import lombok.extern.slf4j.Slf4j; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.loottracker.localstorage.LTItemEntry; -import net.runelite.client.plugins.loottracker.localstorage.LTRecord; -import net.runelite.client.plugins.stonedtracker.ItemSortTypes; -import net.runelite.client.plugins.stonedtracker.data.UniqueItem; -import net.runelite.client.ui.ColorScheme; - -@Slf4j -class LootPanel extends JPanel -{ - private final String name; - private final Collection records; - private final Collection uniques; - private final boolean hideUniques; - private final ItemSortTypes sortType; - private final boolean itemBreakdown; - private final ItemManager itemManager; - // Consolidate LTItemEntries stored by ItemID - private final Map consolidated = new HashMap<>(); - - private boolean playbackPlaying = false; - private boolean cancelPlayback = false; - - LootPanel( - final String name, - final Collection records, - final Collection uniques, - final boolean hideUnqiues, - final ItemSortTypes sort, - final boolean itemBreakdown, - final ItemManager itemManager) - { - this.name = name; - this.records = records; - this.uniques = uniques; - this.hideUniques = hideUnqiues; - this.sortType = sort; - this.itemBreakdown = itemBreakdown; - this.itemManager = itemManager; - - setLayout(new GridBagLayout()); - setBorder(new EmptyBorder(0, 10, 0, 10)); - setBackground(ColorScheme.DARK_GRAY_COLOR); - - createPanel(this.records, true); - } - - /** - * Sorts the collection of LTItemEntry based on the selected {@link ItemSortTypes} - * - * @param sortType The {@link ItemSortTypes} describing how these entries should be sorted - * @return returns the sorted list - */ - private static Comparator createLTItemEntryComparator(final ItemSortTypes sortType) - { - return (o1, o2) -> - { - switch (sortType) - { - case ITEM_ID: - return o1.getId() - o2.getId(); - case PRICE: - if (o1.getPrice() != o2.getPrice()) - { - return o1.getPrice() > o2.getPrice() ? -1 : 1; - } - break; - case VALUE: - if (o1.getTotal() != o2.getTotal()) - { - return o1.getTotal() > o2.getTotal() ? -1 : 1; - } - break; - case ALPHABETICAL: - // Handled below - break; - default: - log.warn("Sort Type not being handled correctly, defaulting to alphabetical."); - break; - } - - // Default to alphabetical - return o1.getName().compareTo(o2.getName()); - }; - } - - private void createPanel(final Collection records, final boolean reconsolidate) - { - final GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.HORIZONTAL; - c.weightx = 1; - c.gridx = 0; - c.gridy = 0; - - if (reconsolidate) - { - this.consolidated.clear(); - final Collection consolidatedLTItemEntries = LTRecord.consolidateLTItemEntries(records); - final Map itemMap = LTItemEntry.consolidateItemEntires(consolidatedLTItemEntries); - this.consolidated.putAll(itemMap); - } - - // Create necessary helpers for the unique toggles - final Multimap positionMap = ArrayListMultimap.create(); - final Set uniqueIds = new HashSet<>(); - - // Loop over all UniqueItems and check how many the player has received as a drop for each - // Also add all Item IDs for uniques to a Set for easy hiding later on. - for (final UniqueItem item : this.uniques) - { - final int id = item.getItemID(); - final int linkedId = item.getLinkedID(); - uniqueIds.add(id); - uniqueIds.add(linkedId); - - final LTItemEntry entry = this.consolidated.get(id); - final LTItemEntry notedEntry = this.consolidated.get(linkedId); - final int qty = (entry == null ? 0 : entry.getQuantity()) + (notedEntry == null ? 0 : notedEntry.getQuantity()); - item.setQty(qty); - positionMap.put(item.getPosition(), item); - } - - for (final int position : positionMap.keySet()) - { - final Collection uniques = positionMap.get(position); - - final UniqueItemPanel p = new UniqueItemPanel(uniques, this.itemManager); - this.add(p, c); - c.gridy++; - } - - // Attach Kill Count Panel(s) - final int amount = records.size(); - String currentText; - String loggedText; - - log.debug(name); - - switch (name) - { - case "master farmer": - currentText = "Current pick-pocket count:"; - loggedText = "Pickpockets logged:"; - break; - case "Wintertodt": - currentText = "Current Killcount:"; - loggedText = "Crates logged:"; - break; - case "Herbiboar": - currentText = "Herbiboars looted:"; - loggedText = "Loots logged:"; - break; - case "Brimstone Chest": - case "Crystal Chest": - case "Larran's big chest": - case "Larran's small chest": - case "Elven Crystal Chest": - currentText = "Chests opened:"; - loggedText = "Chests logged:"; - break; - case "Clue Scroll (Beginner)": - case "Clue Scroll (Easy)": - case "Clue Scroll (Medium)": - case "Clue Scroll (Hard)": - case "Clue Scroll (Elite)": - case "Clue Scroll (Master)": - currentText = "Clues completed:"; - loggedText = "Clues logged:"; - break; - default: - currentText = "Current Killcount:"; - loggedText = "Kills logged:"; - break; - } - - if (amount > 0) - { - final LTRecord entry = Iterators.get(records.iterator(), (amount - 1)); - if (entry.getKillCount() != -1) - { - final TextPanel p = new TextPanel(currentText, entry.getKillCount()); - this.add(p, c); - c.gridy++; - } - } - - final TextPanel p2 = new TextPanel(loggedText, amount); - this.add(p2, c); - c.gridy++; - - // Track total price of all tracked items for this panel - // Also ensure it is placed in correct location by preserving its gridy value - long totalValue = consolidated.values().stream().mapToLong(e -> e.getPrice() * e.getQuantity()).sum(); - final int totalValueIndex = c.gridy; - c.gridy++; - - - final Collection itemsToDisplay = consolidated.values().stream() - .filter(e -> !(hideUniques && uniqueIds.contains(e.getId()))) - .sorted(createLTItemEntryComparator(sortType)) - .collect(Collectors.toList()); - - if (itemsToDisplay.size() > 0) - { - if (itemBreakdown) - { - for (final LTItemEntry e : itemsToDisplay) - { - final ItemPanel p = new ItemPanel(e, itemManager); - this.add(p, c); - c.gridy++; - } - } - else - { - final LootGrid grid = new LootGrid(itemsToDisplay.toArray(new LTItemEntry[0]), itemManager); - this.add(grid, c); - c.gridy++; - } - } - - // Only add the total value element if it has something useful to display - if (totalValue > 0) - { - c.gridy = totalValueIndex; - final TextPanel totalPanel = new TextPanel("Total Value:", totalValue); - this.add(totalPanel, c); - } - } - - void addedRecord(final LTRecord record) - { - records.add(record); - for (final LTItemEntry entry : record.getDrops()) - { - final LTItemEntry current = consolidated.get(entry.getId()); - if (current != null) - { - entry.setQuantity(entry.getQuantity() + current.getQuantity()); - } - consolidated.put(entry.getId(), entry); - - } - // TODO: Smarter update system so it only repaints necessary Item and Text Panels - this.removeAll(); - - this.createPanel(this.records, false); - - this.revalidate(); - this.repaint(); - } - - void playback() - { - if (playbackPlaying) - { - cancelPlayback = true; - return; - } - - playbackPlaying = true; - - if (this.records.size() > 0) - { - final Collection recs = new ArrayList<>(); - for (final LTRecord r : this.records) - { - recs.add(r); - - SwingUtilities.invokeLater(() -> refreshPlayback(recs)); - - try - { - if (cancelPlayback) - { - playbackPlaying = false; - cancelPlayback = false; - SwingUtilities.invokeLater(() -> refreshPlayback(this.records)); - break; - } - // TODO: Allow this rate to be configurable? - Thread.sleep(250); - } - catch (InterruptedException e) - { - System.out.println(e.getMessage()); - } - } - } - - playbackPlaying = false; - } - - private void refreshPlayback(final Collection recs) - { - this.removeAll(); - - this.createPanel(recs, true); - - this.revalidate(); - this.repaint(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/LootTrackerPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/LootTrackerPanel.java deleted file mode 100644 index 7e50c48a7d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/LootTrackerPanel.java +++ /dev/null @@ -1,323 +0,0 @@ -/* - * 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.stonedtracker.ui; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Comparator; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.border.CompoundBorder; -import javax.swing.border.EmptyBorder; -import javax.swing.border.MatteBorder; -import lombok.extern.slf4j.Slf4j; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.loottracker.localstorage.LTRecord; -import net.runelite.client.plugins.stonedtracker.StonedTrackerPlugin; -import net.runelite.client.plugins.stonedtracker.data.UniqueItem; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.ui.components.PluginErrorPanel; -import net.runelite.client.util.ImageUtil; - -@Slf4j -public class LootTrackerPanel extends PluginPanel -{ - private static final BufferedImage ICON_DELETE; - private static final BufferedImage ICON_REFRESH; - private static final BufferedImage ICON_BACK; - private static final BufferedImage ICON_REPLAY; - - private final static Color BACKGROUND_COLOR = ColorScheme.DARK_GRAY_COLOR; - private final static Color BUTTON_HOVER_COLOR = ColorScheme.DARKER_GRAY_HOVER_COLOR; - - static - { - ICON_DELETE = ImageUtil.getResourceStreamFromClass(StonedTrackerPlugin.class, "delete-white.png"); - ICON_REFRESH = ImageUtil.getResourceStreamFromClass(StonedTrackerPlugin.class, "refresh-white.png"); - ICON_BACK = ImageUtil.getResourceStreamFromClass(StonedTrackerPlugin.class, "back-arrow-white.png"); - ICON_REPLAY = ImageUtil.getResourceStreamFromClass(StonedTrackerPlugin.class, "replay-white.png"); - } - - private final ItemManager itemManager; - private final StonedTrackerPlugin plugin; - - // NPC name for current view or null if on selection screen - private String currentView = null; - private LootPanel lootPanel; - - public LootTrackerPanel(final ItemManager itemManager, final StonedTrackerPlugin plugin) - { - super(false); - this.itemManager = itemManager; - this.plugin = plugin; - - this.setBackground(ColorScheme.DARK_GRAY_COLOR); - this.setLayout(new BorderLayout()); - - showSelectionView(); - } - - // Loot Selection view - public void showSelectionView() - { - this.removeAll(); - currentView = null; - lootPanel = null; - - final PluginErrorPanel errorPanel = new PluginErrorPanel(); - errorPanel.setBorder(new EmptyBorder(10, 25, 10, 25)); - errorPanel.setContent("Loot Tracker", "Please select the Activity, Player, or NPC you wish to view loot for"); - - final SelectionPanel selection = new SelectionPanel(plugin.config.bossButtons(), plugin.getLootNames(), this, itemManager); - - this.add(errorPanel, BorderLayout.NORTH); - this.add(wrapContainer(selection), BorderLayout.CENTER); - - this.revalidate(); - this.repaint(); - } - - // Loot breakdown view - public void showLootView(final String name) - { - this.removeAll(); - currentView = name; - - final Collection data = plugin.getDataByName(name); - - // Grab all Uniques for this NPC/Activity - Collection uniques = UniqueItem.getUniquesForBoss(name); - if (uniques == null) - { - uniques = new ArrayList<>(); - } - - uniques = uniques.stream().sorted(Comparator.comparingInt(UniqueItem::getPosition)).collect(Collectors.toList()); - - final JPanel title = createLootViewTitle(name); - lootPanel = new LootPanel(name, data, uniques, plugin.config.hideUniques(), plugin.config.itemSortType(), plugin.config.itemBreakdown(), itemManager); - - this.add(title, BorderLayout.NORTH); - this.add(wrapContainer(lootPanel), BorderLayout.CENTER); - - this.revalidate(); - this.repaint(); - } - - // Title element for Loot breakdown view - private JPanel createLootViewTitle(final String name) - { - final JPanel title = new JPanel(); - title.setBorder(new CompoundBorder( - new EmptyBorder(10, 8, 8, 8), - new MatteBorder(0, 0, 1, 0, Color.GRAY) - )); - title.setLayout(new BorderLayout()); - title.setBackground(BACKGROUND_COLOR); - - final JPanel first = new JPanel(); - first.setBackground(BACKGROUND_COLOR); - - // Back Button - final JLabel back = createIconLabel(ICON_BACK); - back.addMouseListener(new MouseAdapter() - { - @Override - public void mouseClicked(MouseEvent e) - { - showSelectionView(); - } - }); - back.setToolTipText("Back to selection screen"); - - final JLabel text = new JLabel(name); - text.setForeground(Color.WHITE); - - first.add(back); - first.add(text); - - final JPanel second = new JPanel(); - second.setBackground(BACKGROUND_COLOR); - - // Refresh Data button - final JLabel refresh = createIconLabel(ICON_REFRESH); - refresh.addMouseListener(new MouseAdapter() - { - @Override - public void mouseClicked(MouseEvent e) - { - showLootView(name); - } - }); - refresh.setToolTipText("Refresh panel"); - - // Clear data button - final JLabel clear = createIconLabel(ICON_DELETE); - clear.addMouseListener(new MouseAdapter() - { - @Override - public void mouseClicked(MouseEvent e) - { - clearData(name); - } - }); - clear.setToolTipText("Clear stored data"); - - // Clear data button - final JLabel replay = createIconLabel(ICON_REPLAY); - replay.addMouseListener(new MouseAdapter() - { - @Override - public void mouseClicked(MouseEvent e) - { - playbackLoot(); - } - }); - replay.setToolTipText("Replay Loot"); - - second.add(refresh); - second.add(clear); - second.add(replay); - - title.add(first, BorderLayout.WEST); - title.add(second, BorderLayout.EAST); - - return title; - } - - private JLabel createIconLabel(final BufferedImage icon) - { - final JLabel label = new JLabel(); - label.setIcon(new ImageIcon(icon)); - label.setOpaque(true); - label.setBackground(BACKGROUND_COLOR); - - label.addMouseListener(new MouseAdapter() - { - @Override - public void mouseEntered(MouseEvent e) - { - label.setBackground(BUTTON_HOVER_COLOR); - } - - @Override - public void mouseExited(MouseEvent e) - { - label.setBackground(BACKGROUND_COLOR); - } - }); - - return label; - } - - // Wrap the panel inside a scroll pane - private JScrollPane wrapContainer(final JPanel container) - { - final JPanel wrapped = new JPanel(new BorderLayout()); - wrapped.add(container, BorderLayout.NORTH); - wrapped.setBackground(BACKGROUND_COLOR); - - final JScrollPane scroller = new JScrollPane(wrapped); - scroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - scroller.getVerticalScrollBar().setPreferredSize(new Dimension(8, 0)); - scroller.setBackground(BACKGROUND_COLOR); - - return scroller; - } - - // Clear stored data and return to selection screen - private void clearData(final String name) - { - // Confirm delete action - final int delete = JOptionPane.showConfirmDialog(this.getRootPane(), "Are you sure you want to clear all data for this tab?
There is no way to undo this action.", "Warning", JOptionPane.YES_NO_OPTION); - if (delete == JOptionPane.YES_OPTION) - { - boolean deleted = plugin.clearStoredDataByName(name); - if (!deleted) - { - JOptionPane.showMessageDialog(this.getRootPane(), "Unable to clear stored data, please try again."); - return; - } - - // Return to selection screen - showSelectionView(); - } - } - - public void addLog(final LTRecord r) - { - if (currentView == null) - { - showLootView(r.getName()); - } - else if (currentView.equalsIgnoreCase(r.getName())) - { - lootPanel.addedRecord(r); - } - } - - // Refresh panel when config options are changed - public void refreshUI() - { - log.debug("Refreshing UI"); - if (currentView == null) - { - showSelectionView(); - } - else - { - showLootView(currentView); - } - } - - private void playbackLoot() - { - if (lootPanel == null) - { - return; - } - - // Create a new thread for this so it doesn't cause swing freezes - final ScheduledExecutorService ex = Executors.newSingleThreadScheduledExecutor(); - if (currentView != null) - { - ex.schedule(lootPanel::playback, 0, TimeUnit.SECONDS); - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/SelectionPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/SelectionPanel.java deleted file mode 100644 index 2b69c00b19..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/SelectionPanel.java +++ /dev/null @@ -1,323 +0,0 @@ -/* - * 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.stonedtracker.ui; - -import com.google.common.base.Strings; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.GridLayout; -import java.awt.Image; -import java.awt.Insets; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.Arrays; -import java.util.Collection; -import java.util.Set; -import java.util.TreeSet; -import java.util.stream.Collectors; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.stonedtracker.data.BossTab; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.ui.components.IconTextField; -import net.runelite.client.ui.components.materialtabs.MaterialTab; -import net.runelite.client.ui.components.materialtabs.MaterialTabGroup; -import net.runelite.client.util.AsyncBufferedImage; -import org.apache.commons.text.similarity.JaroWinklerDistance; - -class SelectionPanel extends JPanel -{ - private final static Color BACKGROUND_COLOR = ColorScheme.DARK_GRAY_COLOR; - private final static Color BUTTON_COLOR = ColorScheme.DARKER_GRAY_COLOR; - private final static Color BUTTON_HOVER_COLOR = ColorScheme.DARKER_GRAY_HOVER_COLOR; - private static final JaroWinklerDistance DISTANCE = new JaroWinklerDistance(); - - private final Set names; - private final LootTrackerPanel parent; - private final ItemManager itemManager; - - private final IconTextField searchBar = new IconTextField(); - private final JPanel namePanel = new JPanel(); - - private final boolean configToggle; - - SelectionPanel( - final boolean configToggle, - final Set names, - final LootTrackerPanel parent, - final ItemManager itemManager) - { - this.names = names == null ? new TreeSet<>() : names; - this.parent = parent; - this.itemManager = itemManager; - this.configToggle = configToggle; - - this.setLayout(new GridBagLayout()); - this.setBackground(BACKGROUND_COLOR); - - searchBar.setIcon(IconTextField.Icon.SEARCH); - searchBar.setPreferredSize(new Dimension(PluginPanel.PANEL_WIDTH - 20, 30)); - searchBar.setBackground(ColorScheme.DARKER_GRAY_COLOR); - searchBar.setHoverBackgroundColor(ColorScheme.DARK_GRAY_HOVER_COLOR); - searchBar.getDocument().addDocumentListener(new DocumentListener() - { - @Override - public void insertUpdate(DocumentEvent e) - { - onSearchBarChanged(); - } - - @Override - public void removeUpdate(DocumentEvent e) - { - onSearchBarChanged(); - } - - @Override - public void changedUpdate(DocumentEvent e) - { - onSearchBarChanged(); - } - }); - - namePanel.setLayout(new GridBagLayout()); - - createPanel(); - } - - private static boolean matchesSearchTerm(final String name, final String[] terms) - { - for (final String term : terms) - { - if (Arrays.stream(name.toLowerCase().split(" ")).noneMatch((nameTerm -> - nameTerm.contains(term) || DISTANCE.apply(nameTerm, term) > 0.9))) - { - return false; - } - } - - return true; - } - - private void createPanel() - { - final GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.HORIZONTAL; - c.weightx = 1; - c.gridx = 0; - c.gridy = 0; - c.insets = new Insets(5, 0, 0, 0); - - // Add the bosses tabs, by category, to tabGroup - if (configToggle) - { - this.add(createBossTabPanel(), c); - c.gridy++; - } - - this.add(searchBar, c); - c.gridy++; - - addNamesToPanel(this.names); - this.add(namePanel, c); - } - - private JPanel createBossTabPanel() - { - final GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.HORIZONTAL; - c.weightx = 1; - c.gridx = 0; - c.gridy = 0; - c.insets = new Insets(5, 0, 0, 0); - - final JPanel container = new JPanel(new GridBagLayout()); - container.setBorder(new EmptyBorder(0, 0, 10, 0)); - - for (final String categoryName : BossTab.getCategories()) - { - container.add(createTabCategory(categoryName), c); - c.gridy++; - } - - return container; - } - - private void addNamesToPanel(final Collection names) - { - namePanel.removeAll(); - - final GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.HORIZONTAL; - c.weightx = 1; - c.gridx = 0; - c.gridy = 0; - c.insets = new Insets(5, 0, 0, 0); - - for (final String name : names) - { - // Ignore boss tabs based on config - if (!configToggle || BossTab.getByName(name) == null) - { - namePanel.add(createNamePanel(name), c); - c.gridy++; - } - } - - namePanel.revalidate(); - } - - private JPanel createNamePanel(final String name) - { - final JPanel p = new JPanel(); - p.add(new JLabel(name)); - p.setBackground(BUTTON_COLOR); - p.addMouseListener(new MouseAdapter() - { - @Override - public void mouseEntered(MouseEvent e) - { - p.setBackground(BUTTON_HOVER_COLOR); - } - - @Override - public void mouseExited(MouseEvent e) - { - p.setBackground(BUTTON_COLOR); - } - - @Override - public void mouseClicked(MouseEvent e) - { - parent.showLootView(name); - } - }); - - return p; - } - - // Creates all tabs for a specific category - private JPanel createTabCategory(final String categoryName) - { - final JPanel container = new JPanel(); - container.setLayout(new GridBagLayout()); - container.setBorder(new EmptyBorder(0, 5, 0, 5)); - - final GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.HORIZONTAL; - c.weightx = 1; - c.gridx = 0; - c.gridy = 0; - - final MaterialTabGroup thisTabGroup = new MaterialTabGroup(); - thisTabGroup.setLayout(new GridLayout(0, 4, 7, 7)); - thisTabGroup.setBorder(new EmptyBorder(4, 0, 0, 0)); - - final JLabel name = new JLabel(categoryName); - name.setBorder(new EmptyBorder(8, 0, 0, 0)); - name.setForeground(Color.WHITE); - name.setVerticalAlignment(SwingConstants.CENTER); - - final Collection categoryTabs = BossTab.getByCategoryName(categoryName); - for (final BossTab tab : categoryTabs) - { - // Create tab (with hover effects/text) - final MaterialTab materialTab = new MaterialTab("", thisTabGroup, null); - materialTab.setName(tab.getName()); - materialTab.setToolTipText(tab.getName()); - //materialTab.setSelectedBorder(new EmptyBorder(0, 0, 0, 0)); - materialTab.addMouseListener(new MouseAdapter() - { - @Override - public void mouseEntered(MouseEvent e) - { - materialTab.setBackground(BUTTON_HOVER_COLOR); - } - - @Override - public void mouseExited(MouseEvent e) - { - materialTab.setBackground(BUTTON_COLOR); - } - }); - - materialTab.setOnSelectEvent(() -> - { - parent.showLootView(tab.getName()); - return true; - }); - - // Attach Icon to the Tab - final AsyncBufferedImage image = itemManager.getImage(tab.getItemID()); - final Runnable resize = () -> - { - materialTab.setIcon(new ImageIcon(image.getScaledInstance(35, 35, Image.SCALE_SMOOTH))); - materialTab.setOpaque(true); - materialTab.setBackground(BUTTON_COLOR); - materialTab.setHorizontalAlignment(SwingConstants.CENTER); - materialTab.setVerticalAlignment(SwingConstants.CENTER); - materialTab.setPreferredSize(new Dimension(35, 35)); - }; - image.onLoaded(resize); - resize.run(); - - thisTabGroup.addTab(materialTab); - } - - container.add(name, c); - c.gridy++; - container.add(thisTabGroup, c); - - return container; - } - - private void onSearchBarChanged() - { - final String text = searchBar.getText(); - if (Strings.isNullOrEmpty(text)) - { - addNamesToPanel(this.names); - } - else - { - addNamesToPanel(filterNames(this.names, text)); - } - } - - private Collection filterNames(final Collection names, final String searchText) - { - final String[] searchTerms = searchText.toLowerCase().split(" "); - return names.stream().filter(name -> matchesSearchTerm(name, searchTerms)).collect(Collectors.toList()); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/TextPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/TextPanel.java deleted file mode 100644 index 4e953e37b0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/TextPanel.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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.stonedtracker.ui; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import javax.swing.BorderFactory; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingConstants; -import javax.swing.border.Border; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.util.QuantityFormatter; - -@Getter(AccessLevel.PACKAGE) -class TextPanel extends JPanel -{ - private static final GridBagLayout LAYOUT = new GridBagLayout(); - - private static final Border PANEL_BORDER = BorderFactory.createMatteBorder(3, 0, 3, 0, ColorScheme.DARK_GRAY_COLOR); - private static final Color PANEL_BACKGROUND_COLOR = ColorScheme.DARKER_GRAY_COLOR; - - private static final Border CONTAINER_BORDER = BorderFactory.createMatteBorder(0, 15, 0, 15, PANEL_BACKGROUND_COLOR); - - // Long value should be for Total Value - TextPanel(final String text, final long totalValue) - { - this.setLayout(LAYOUT); - this.setBorder(PANEL_BORDER); - this.setBackground(PANEL_BACKGROUND_COLOR); - - final JLabel totalText = new JLabel(text, SwingConstants.LEFT); - totalText.setForeground(Color.WHITE); - - // Item Values (Colored off Total Value of item) - final JLabel total = new JLabel(QuantityFormatter.quantityToStackSize(totalValue) + " gp", SwingConstants.LEFT); - total.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - total.setForeground(getRSValueColor(totalValue)); - - final JPanel panel = createPanel(); - - panel.add(totalText, BorderLayout.LINE_START); - panel.add(total, BorderLayout.CENTER); - - final GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.BOTH; - c.weightx = 1; - c.gridx = 0; - c.gridy = 0; - c.ipady = 20; - - panel.setToolTipText(QuantityFormatter.formatNumber(totalValue)); - - this.add(panel, c); - } - - TextPanel(final String text, final int value) - { - this.setLayout(LAYOUT); - this.setBorder(PANEL_BORDER); - this.setBackground(PANEL_BACKGROUND_COLOR); - - final JLabel textLabel = new JLabel(text, SwingConstants.LEFT); - textLabel.setForeground(Color.WHITE); - - final JLabel valueLabel = new JLabel(String.valueOf(value), SwingConstants.LEFT); - valueLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); - - final JPanel panel = createPanel(); - panel.add(textLabel, BorderLayout.LINE_START); - panel.add(valueLabel, BorderLayout.CENTER); - - final GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.BOTH; - c.weightx = 1; - c.gridx = 0; - c.gridy = 0; - c.ipady = 20; - - this.add(panel, c); - } - - private static JPanel createPanel() - { - final JPanel panel = new JPanel(); - panel.setLayout(new BorderLayout()); - panel.setBorder(CONTAINER_BORDER); - panel.setBackground(PANEL_BACKGROUND_COLOR); - - return panel; - } - - private static Color getRSValueColor(long val) - { - return (val >= 10000000) ? Color.GREEN : (val >= 100000) ? Color.WHITE : Color.YELLOW; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/UniqueItemPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/UniqueItemPanel.java deleted file mode 100644 index 90974de6b8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/stonedtracker/ui/UniqueItemPanel.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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.stonedtracker.ui; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.image.BufferedImage; -import java.util.Collection; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingConstants; -import javax.swing.border.Border; -import javax.swing.border.EmptyBorder; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.stonedtracker.data.UniqueItem; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.util.AsyncBufferedImage; -import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.QuantityFormatter; - -@Getter(AccessLevel.PACKAGE) -class UniqueItemPanel extends JPanel -{ - private final static float alphaMissing = 0.35f; - private final static float alphaHas = 1.0f; - - private static final Dimension panelSize = new Dimension(215, 50); - private static final Border panelBorder = new EmptyBorder(3, 0, 3, 0); - private static final Color panelBackgroundColor = ColorScheme.DARK_GRAY_COLOR; - - UniqueItemPanel(final Collection items, final ItemManager itemManager) - { - final JPanel panel = new JPanel(); - panel.setLayout(new GridBagLayout()); - panel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - panel.setBorder(new EmptyBorder(3, 0, 3, 0)); - - this.setLayout(new BorderLayout()); - this.setBorder(panelBorder); - this.setBackground(panelBackgroundColor); - this.setPreferredSize(panelSize); - - GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.BOTH; - c.weightx = 1; - c.gridx = 0; - c.gridy = 0; - c.ipady = 5; - - // Add each Unique Item icon to the panel - for (final UniqueItem l : items) - { - final int quantity = l.getQty(); - final float alpha = (quantity > 0 ? alphaHas : alphaMissing); - final AsyncBufferedImage image = itemManager.getImage(l.getItemID(), quantity, quantity > 1); - final BufferedImage opaque = ImageUtil.alphaOffset(image, alpha); - - final JLabel icon = new JLabel(); - icon.setToolTipText(buildToolTip(l, quantity)); - icon.setIcon(new ImageIcon(opaque)); - icon.setVerticalAlignment(SwingConstants.CENTER); - icon.setHorizontalAlignment(SwingConstants.CENTER); - panel.add(icon, c); - c.gridx++; - - // in case the image is blank we will refresh it upon load - // Should only trigger if image hasn't been added - image.onLoaded(() -> - { - icon.setIcon(new ImageIcon(ImageUtil.alphaOffset(image, alpha))); - icon.revalidate(); - icon.repaint(); - }); - } - - this.add(panel, BorderLayout.NORTH); - } - - private static String buildToolTip(final UniqueItem item, final int qty) - { - String s = "" + item.getName(); - if (qty > 0) - { - s += " x " + QuantityFormatter.formatNumber(qty); - } - if (item.getPrice() > 0) - { - s += "
Price: " + QuantityFormatter.quantityToStackSize(item.getPrice()); - // Check for qty here as well as we should only show Total if the item has a value as well - if (qty > 0) - { - s += "
Total: " + QuantityFormatter.quantityToStackSize(qty * item.getPrice()) + " - * 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.client.plugins.stretchedmode; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("stretchedmode") -public interface StretchedModeConfig extends Config -{ - @ConfigItem( - keyName = "keepAspectRatio", - name = "Keep aspect ratio", - description = "Keeps the aspect ratio when stretching." - ) - default boolean keepAspectRatio() - { - return false; - } - - @ConfigItem( - keyName = "increasedPerformance", - name = "Increased performance mode", - description = "Uses a fast algorithm when stretching, lowering quality but increasing performance." - ) - default boolean increasedPerformance() - { - return false; - } - - @ConfigItem( - keyName = "integerScaling", - name = "Integer Scaling", - description = "Forces use of a whole number scale factor when stretching." - ) - default boolean integerScaling() - { - return false; - } - - @ConfigItem( - keyName = "scalingFactor", - name = "Resizable Scaling (%)", - description = "In resizable mode, the game is reduced in size this much before it's stretched." - ) - default int scalingFactor() - { - return 50; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/stretchedmode/StretchedModePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/stretchedmode/StretchedModePlugin.java deleted file mode 100644 index 606f2795ab..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/stretchedmode/StretchedModePlugin.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.stretchedmode; - -import com.google.inject.Provides; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.events.ResizeableChanged; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.input.MouseManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Stretched Mode", - description = "Stretches the game in fixed and resizable modes.", - tags = {"resize", "ui", "interface", "stretch", "scaling", "fixed"}, - enabledByDefault = false, - type = PluginType.MISCELLANEOUS -) -@Singleton -public class StretchedModePlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private StretchedModeConfig config; - - @Inject - private MouseManager mouseManager; - - @Inject - private TranslateMouseListener mouseListener; - - @Inject - private TranslateMouseWheelListener mouseWheelListener; - - @Provides - StretchedModeConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(StretchedModeConfig.class); - } - - @Override - protected void startUp() - { - - mouseManager.registerMouseListener(0, mouseListener); - mouseManager.registerMouseWheelListener(0, mouseWheelListener); - - client.setStretchedEnabled(true); - updateConfig(); - } - - @Override - protected void shutDown() - { - client.setStretchedEnabled(false); - client.invalidateStretching(true); - - mouseManager.unregisterMouseListener(mouseListener); - mouseManager.unregisterMouseWheelListener(mouseWheelListener); - } - - @Subscribe - private void onResizeableChanged(ResizeableChanged event) - { - client.invalidateStretching(true); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("stretchedmode")) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - client.setStretchedIntegerScaling(config.integerScaling()); - client.setStretchedKeepAspectRatio(config.keepAspectRatio()); - client.setStretchedFast(config.increasedPerformance()); - client.setScalingFactor(config.scalingFactor()); - - client.invalidateStretching(true); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/stretchedmode/TranslateMouseListener.java b/runelite-client/src/main/java/net/runelite/client/plugins/stretchedmode/TranslateMouseListener.java deleted file mode 100644 index c2093cb32b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/stretchedmode/TranslateMouseListener.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.stretchedmode; - -import java.awt.Component; -import java.awt.Dimension; -import java.awt.event.MouseEvent; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.client.input.MouseListener; - -@Singleton -public class TranslateMouseListener implements MouseListener -{ - private final Client client; - - @Inject - public TranslateMouseListener(final Client client) - { - this.client = client; - } - - @Override - public MouseEvent mouseClicked(MouseEvent mouseEvent) - { - return translateEvent(mouseEvent); - } - - @Override - public MouseEvent mousePressed(MouseEvent mouseEvent) - { - return translateEvent(mouseEvent); - } - - @Override - public MouseEvent mouseReleased(MouseEvent mouseEvent) - { - return translateEvent(mouseEvent); - } - - @Override - public MouseEvent mouseEntered(MouseEvent mouseEvent) - { - return translateEvent(mouseEvent); - } - - @Override - public MouseEvent mouseExited(MouseEvent mouseEvent) - { - return translateEvent(mouseEvent); - } - - @Override - public MouseEvent mouseDragged(MouseEvent mouseEvent) - { - return translateEvent(mouseEvent); - } - - @Override - public MouseEvent mouseMoved(MouseEvent mouseEvent) - { - return translateEvent(mouseEvent); - } - - private MouseEvent translateEvent(MouseEvent e) - { - Dimension stretchedDimensions = client.getStretchedDimensions(); - Dimension realDimensions = client.getRealDimensions(); - - int newX = (int) (e.getX() / (stretchedDimensions.width / realDimensions.getWidth())); - int newY = (int) (e.getY() / (stretchedDimensions.height / realDimensions.getHeight())); - - return new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), e.getModifiersEx(), - newX, newY, e.getClickCount(), e.isPopupTrigger(), e.getButton()); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/stretchedmode/TranslateMouseWheelListener.java b/runelite-client/src/main/java/net/runelite/client/plugins/stretchedmode/TranslateMouseWheelListener.java deleted file mode 100644 index e204be23cc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/stretchedmode/TranslateMouseWheelListener.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.stretchedmode; - -import java.awt.Component; -import java.awt.Dimension; -import java.awt.event.MouseWheelEvent; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.client.input.MouseWheelListener; - -@Singleton -public class TranslateMouseWheelListener implements MouseWheelListener -{ - private final Client client; - - @Inject - public TranslateMouseWheelListener(final Client client) - { - this.client = client; - } - - @Override - public MouseWheelEvent mouseWheelMoved(MouseWheelEvent event) - { - return translateEvent(event); - } - - private MouseWheelEvent translateEvent(MouseWheelEvent e) - { - Dimension stretchedDimensions = client.getStretchedDimensions(); - Dimension realDimensions = client.getRealDimensions(); - - int newX = (int) (e.getX() / (stretchedDimensions.width / realDimensions.getWidth())); - int newY = (int) (e.getY() / (stretchedDimensions.height / realDimensions.getHeight())); - - return new MouseWheelEvent((Component) e.getSource(), e.getID(), e.getWhen(), e.getModifiers(), newX, newY, - e.getClickCount(), e.isPopupTrigger(), e.getScrollType(), e.getScrollAmount(), e.getWheelRotation()); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/strongholdofsecurity/StrongholdAnswer.java b/runelite-client/src/main/java/net/runelite/client/plugins/strongholdofsecurity/StrongholdAnswer.java deleted file mode 100644 index 3386588874..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/strongholdofsecurity/StrongholdAnswer.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2019, FlaxOnEm - * 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.strongholdofsecurity; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.api.widgets.Widget; -import java.util.HashMap; -import java.util.Map; - -@Getter -@RequiredArgsConstructor -enum StrongholdAnswer -{ - PAIR_0("To pass you must answer me this: Hey adventurer!
You've been randomly selected for a prize of 1 year of
free membership! I'm just going to need some of your
account details so I can put it on your account!", "No way! I'm reporting you to Jagex!"), - PAIR_1("To pass you must answer me this: Can I leave my
account logged in while I'm out of the room?", "No."), - PAIR_2("To pass you must answer me this: How do I remove a
hijacker from my account?", "Use the Account Recovery System."), - PAIR_3("To pass you must answer me this: What do you do if
someone asks you for your password or bank PIN to
make you a player moderator?", "Don't give them the information and send an 'Abuse report'."), - PAIR_4("To pass you must answer me this: You're watching a
stream by someone claiming to be Jagex offering double
xp. What do you do?", "Report the stream as a scam. Real Jagex streams have a 'verified' mark."), - PAIR_5("To pass you must answer me this: My friend asks me
for my password so that he can do a difficult quest for
me. Do I give it to them?", "Don't give them my password."), - PAIR_6("To pass you must answer me this: Who can I give my
password to?", "Nobody."), - PAIR_7("To pass you must answer me this: How do I set up
two-factor authentication for my Old School RuneScape
account?", "Through account settings on oldschool.runescape.com."), - PAIR_8("To pass you must answer me this: What is an example
of a good bank PIN?", "The birthday of a famous person or event."), - PAIR_9("To pass you must answer me this: What should you do
if your real-life friend asks for your password so he
can check your stats?", "Don't give out your password to anyone. Not even close friends."), - PAIR_A("To pass you must answer me this: A player tells you to
search for a video online, click the link in the description
and comment on the forum post to win a cash prize.
What do you do?", "Report the player for phishing."), - PAIR_B("To pass you must answer me this: You have been
offered an opportunity to check out a free giveaway or
double XP signup via email or in game chat. What
should I do?", "Report the incident and do not click any links."), - PAIR_C("To pass you must answer me this: How do I set a
bank PIN?", "Talk to any banker."), - PAIR_D("To pass you must answer me this: What do I do if a
moderator asks me for my account details?", "Politely tell them no and then use the 'Report Abuse' button."), - PAIR_E("To pass you must answer me this: You are part way
through the Stronghold of Security when you have to
answer another question. After you answer the question,
you should...", "Read the text and follow the advice given."), - PAIR_F("To pass you must answer me this: Will Jagex prevent
me from saying my PIN in game?", "No."), - PAIR_G("that sound?", "No way! You'll just take my gold for your own! Reported!"), - PAIR_H("To pass you must answer me this: What should I do if
I receive an email asking me to verify my identity or
Account details due to suspicious activity?", "Don't click any links, forward the email to reportphishing@jagex.com."), - PAIR_I("To pass you must answer me this: A website claims that
they can make me a player moderator. What should I
do?", "Inform Jagex by emailing reportphishing@jagex.com."), - PAIR_J("react?", "Don't share your information and report the player."), - PAIR_K("To pass you must answer me this: What do you do if
someone asks you for your password or bank PIN to
make you a member for free?", "Don't tell them anything and click the 'Report Abuse' button."), - PAIR_L("To pass you must answer me this: Is it OK to buy an
Old School RuneScape account?", "No, you should never buy an account."), - PAIR_M("To pass you must answer me this: You have been
offered an opportunity to check out a free giveaway or
double XP signup via social media or stream. What
should I do?", "Report the incident and do not click any links."), - PAIR_N("To pass you must answer me this: Where is it safe to
use my Old School RuneScape password?", "Only on the Old School RuneScape website."), - PAIR_O("To pass you must answer me this: What is the best
way to secure your account?", "Authenticator and two-step login on my registered email."), - PAIR_P("To pass you must answer me this: Who is it ok to
share my account with?", "Nobody."), - PAIR_Q("To pass you must answer me this: What should you do
if another player messages you recommending a website
to purchase items and/or gold?", "Do not visit the website and report the player who messaged you."), - PAIR_R("To pass you must answer me this: Whose responsibility
is it to keep your account secure?", "Me."), - PAIR_S("To pass you must answer me this: Is it safe to pay
someone to level your account?", "No, you should never allow anyone to level your account."), - PAIR_T("To pass you must answer me this: What do I do if my
account is compromised?", "Secure my device and reset my password."), - PAIR_U("respond?", "Decline the offer and report that player."), - PAIR_V("To pass you must answer me this: A player says that
Jagex prevents you from saying your password
backwards in game. What do you do?", "Don't type in my password backwards and report the player."), - PAIR_W("To pass you must answer me this: What do I do if I
think I have a keylogger or virus?", "Virus scan my device then change my password."), - PAIR_X("To pass you must answer me this: What is the best
security step you can take to keep your registered
email secure?", "Set up 2 step authentication with my email provider."); - - static final Map MATCHES = new HashMap<>(); - - static - { - for (StrongholdAnswer strongholdAnswer : StrongholdAnswer.values()) - { - MATCHES.put(strongholdAnswer.question, strongholdAnswer.answer); - } - } - - private final String question; - private final String answer; - - static Widget findCorrect(final String question, final Widget[] widgets) - { - final String s = MATCHES.get(question); - - for (Widget widget : widgets) - { - if (widget != null && widget.getText().equals(s)) - { - return widget; - } - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/strongholdofsecurity/StrongholdPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/strongholdofsecurity/StrongholdPlugin.java deleted file mode 100644 index 8eef7a2783..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/strongholdofsecurity/StrongholdPlugin.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2019, FlaxOnEm - * 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.strongholdofsecurity; - -import net.runelite.api.Client; -import net.runelite.api.events.ClientTick; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.util.ColorUtil; -import javax.inject.Inject; -import java.awt.Color; - -@PluginDescriptor( - name = "Stronghold", - description = "Highlights the correct answer to Stronghold of Security questions", - tags = {"stronghold", "security", "overlay", "answer", "highlight"}, - type = PluginType.UTILITY, - enabledByDefault = false -) -public class StrongholdPlugin extends Plugin -{ - private static final Color ANSWER_COLOR = new Color(230, 0, 230); - - @Inject - private Client client; - - private boolean queueNPCDialogue; - private boolean queueNPCOption; - private String questionCache; - - @Subscribe - public void onWidgetLoaded(WidgetLoaded widgetLoaded) - { - switch (widgetLoaded.getGroupId()) - { - case WidgetID.DIALOG_NPC_GROUP_ID: - queueNPCDialogue = true; - break; - case WidgetID.DIALOG_OPTION_GROUP_ID: - queueNPCOption = true; - break; - } - } - - @Subscribe - public void onClientTick(ClientTick t) - { - if (queueNPCDialogue) - { - queueNPCDialogue = false; - onNPCDialogue(); - } - if (queueNPCOption) - { - queueNPCOption = false; - onNPCOption(); - } - } - - private void onNPCDialogue() - { - final Widget debugWidget = client.getWidget(WidgetInfo.DIALOG_NPC_TEXT); - - if (debugWidget == null) - { - return; - } - - final String npcText = debugWidget.getText(); - if (StrongholdAnswer.MATCHES.containsKey(npcText)) - { - questionCache = npcText; - } - } - - private void onNPCOption() - { - if (questionCache == null) - { - return; - } - - final Widget optionsWidget = client.getWidget(WidgetInfo.DIALOG_OPTION); - if (optionsWidget == null) - { - return; - } - - final Widget[] widgets = optionsWidget.getParent().getChildren(); - - final Widget answerWidget = StrongholdAnswer.findCorrect(questionCache, widgets); - questionCache = null; - if (answerWidget == null) - { - return; - } - - final String answerText = answerWidget.getText(); - answerWidget.setText(ColorUtil.wrapWithColorTag(answerText, ANSWER_COLOR)); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/ActionType.java b/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/ActionType.java deleted file mode 100644 index 33f8663f4a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/ActionType.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2018, Davis Cook - * Copyright (c) 2018, Daddy Dozer - * 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.suppliestracker; - -/** - * Type of action performed in a menu - */ -public enum ActionType -{ - CONSUMABLE, - TELEPORT, - CAST -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/BlowpipeDartType.java b/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/BlowpipeDartType.java deleted file mode 100644 index d353bf615a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/BlowpipeDartType.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2018, Davis Cook - * 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.suppliestracker; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import static net.runelite.api.ItemID.ADAMANT_DART; -import static net.runelite.api.ItemID.BRONZE_DART; -import static net.runelite.api.ItemID.DRAGON_DART; -import static net.runelite.api.ItemID.IRON_DART; -import static net.runelite.api.ItemID.MITHRIL_DART; -import static net.runelite.api.ItemID.RUNE_DART; -import static net.runelite.api.ItemID.STEEL_DART; - -/** - * Type of darts that can be put into the blowpipe - */ -@AllArgsConstructor -public enum BlowpipeDartType -{ - BRONZE(BRONZE_DART), - IRON(IRON_DART), - STEEL(STEEL_DART), - MITHRIL(MITHRIL_DART), - ADAMANT(ADAMANT_DART), - RUNE(RUNE_DART), - DRAGON(DRAGON_DART); - - @Getter(AccessLevel.MODULE) - private int dartID; - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/ItemType.java b/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/ItemType.java deleted file mode 100644 index 8b5f105093..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/ItemType.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2018, Davis Cook - * Copyright (c) 2018, Daddy Dozer - * 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.suppliestracker; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import static net.runelite.api.ItemID.*; - -/** - * The potential types that supplies can be along with a categorization function - * that assigns the supplies to these categories - */ -@AllArgsConstructor -public enum ItemType -{ - FOOD("Food"), - POTION("Potions"), - RUNE("Runes"), - AMMO("Ammo"), - TELEPORT("Teleports"), - COINS("Coins"), - JEWELLERY("Jewellery"), - CHARGES("Charges"), - FARMING("Farming"), - PRAYER("Prayer"); - - @Getter(AccessLevel.PUBLIC) - private String label; - - /** - * Takes an item and determines what ItemType it should categorize into - * - * @param item the item to determine category for - * @return our best guess for what category this item goes into - * note that if the guess is wrong (per say) it won't break anything because it will be - * consistently wrong but it could have an item that is clearly not food in the food section - */ - public static ItemType categorize(SuppliesTrackerItem item) - { - if (item.getName().contains("(4)")) - { - return ItemType.POTION; - } - else if ((item.getName().toLowerCase().contains("bones") && !item.getName().toLowerCase().contains(" to ")) || - item.getName().toLowerCase().contains("ensouled")) - { - return ItemType.PRAYER; - } - else if (item.getName().toLowerCase().contains("bolt") || item.getName().toLowerCase().contains("dart") - || item.getName().toLowerCase().contains(" arrow") || item.getName().toLowerCase().contains("javelin") - || item.getName().toLowerCase().contains("knive") || item.getName().toLowerCase().contains("throwing") - || item.getName().toLowerCase().contains("zulrah's scale") || item.getName().toLowerCase().contains("cannonball") - || item.getName().toLowerCase().contains("knife")) - { - return ItemType.AMMO; - } - else if (item.getName().toLowerCase().contains("rune")) - { - return ItemType.RUNE; - } - else if (item.getName().toLowerCase().contains("teleport")) - { - return ItemType.TELEPORT; - } - else if (item.getId() == COINS_995) - { - return ItemType.COINS; - } - else if (item.getName().toLowerCase().contains("ring of") || item.getName().toLowerCase().contains("amulet") || - item.getName().toLowerCase().contains("bracelet") || item.getName().toLowerCase().contains("necklace")) - { - return ItemType.JEWELLERY; - } - else if (item.getName().toLowerCase().contains(" sapling") || item.getName().toLowerCase().contains(" seed") || - item.getName().toLowerCase().contains("compost") || item.getName().toLowerCase().contains("plant cure")) - { - return ItemType.FARMING; - } - else if (item.getId() == SCYTHE_OF_VITUR || item.getId() == SANGUINESTI_STAFF || - item.getId() == TRIDENT_OF_THE_SEAS || item.getId() == TRIDENT_OF_THE_SWAMP || - item.getId() == BLADE_OF_SAELDOR) - { - return ItemType.CHARGES; - } - return ItemType.FOOD; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/MenuAction.java b/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/MenuAction.java deleted file mode 100644 index 35be3e9a42..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/MenuAction.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2018, Davis Cook - * 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.suppliestracker; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.Item; - -/** - * Data class that tracks all info related to a menu click action - */ -@AllArgsConstructor -public class MenuAction -{ - @Getter(AccessLevel.MODULE) - private ActionType type; - @Getter(AccessLevel.MODULE) - private Item[] oldInventory; - - static class ItemAction extends MenuAction - { - - @Getter(AccessLevel.MODULE) - private int itemID; - @Getter(AccessLevel.MODULE) - private int slot; - - ItemAction(final ActionType type, final Item[] oldInventory, final int itemID, final int slot) - { - super(type, oldInventory); - this.itemID = itemID; - this.slot = slot; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/Runes.java b/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/Runes.java deleted file mode 100644 index 59d409794f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/Runes.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2017, Tyler - * 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.suppliestracker; - - -import com.google.common.collect.ImmutableMap; -import java.awt.image.BufferedImage; -import java.util.Map; -import lombok.Getter; -import lombok.Setter; -import static net.runelite.api.ItemID.AIR_RUNE; -import static net.runelite.api.ItemID.ASTRAL_RUNE; -import static net.runelite.api.ItemID.BLOOD_RUNE; -import static net.runelite.api.ItemID.BODY_RUNE; -import static net.runelite.api.ItemID.CHAOS_RUNE; -import static net.runelite.api.ItemID.COSMIC_RUNE; -import static net.runelite.api.ItemID.DEATH_RUNE; -import static net.runelite.api.ItemID.DUST_RUNE; -import static net.runelite.api.ItemID.EARTH_RUNE; -import static net.runelite.api.ItemID.FIRE_RUNE; -import static net.runelite.api.ItemID.LAVA_RUNE; -import static net.runelite.api.ItemID.LAW_RUNE; -import static net.runelite.api.ItemID.MIND_RUNE; -import static net.runelite.api.ItemID.MIST_RUNE; -import static net.runelite.api.ItemID.MUD_RUNE; -import static net.runelite.api.ItemID.NATURE_RUNE; -import static net.runelite.api.ItemID.SMOKE_RUNE; -import static net.runelite.api.ItemID.SOUL_RUNE; -import static net.runelite.api.ItemID.STEAM_RUNE; -import static net.runelite.api.ItemID.WATER_RUNE; -import static net.runelite.api.ItemID.WRATH_RUNE; - -public enum Runes -{ - AIR(1, AIR_RUNE), - WATER(2, WATER_RUNE), - EARTH(3, EARTH_RUNE), - FIRE(4, FIRE_RUNE), - MIND(5, MIND_RUNE), - CHAOS(6, CHAOS_RUNE), - DEATH(7, DEATH_RUNE), - BLOOD(8, BLOOD_RUNE), - COSMIC(9, COSMIC_RUNE), - NATURE(10, NATURE_RUNE), - LAW(11, LAW_RUNE), - BODY(12, BODY_RUNE), - SOUL(13, SOUL_RUNE), - ASTRAL(14, ASTRAL_RUNE), - MIST(15, MIST_RUNE), - MUD(16, MUD_RUNE), - DUST(17, DUST_RUNE), - LAVA(18, LAVA_RUNE), - STEAM(19, STEAM_RUNE), - SMOKE(20, SMOKE_RUNE), - WRATH(21, WRATH_RUNE); - - private static final Map runes; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - for (Runes rune : values()) - { - builder.put(rune.getId(), rune); - } - runes = builder.build(); - } - - @Getter - private final int id; - @Getter - private final int itemId; - @Getter - @Setter - private BufferedImage image; - - Runes(int id, int itemId) - { - this.id = id; - this.itemId = itemId; - } - - public static Runes getRune(int varbit) - { - return runes.get(varbit); - } - - public String getName() - { - String name = this.name(); - name = name.substring(0, 1) + name.substring(1).toLowerCase(); - return name; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/SuppliesTrackerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/SuppliesTrackerConfig.java deleted file mode 100644 index 9975338ec4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/SuppliesTrackerConfig.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2018, Davis Cook - * 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.suppliestracker; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigTitleSection; -import net.runelite.client.config.Title; - -@ConfigGroup("suppliestracker") -public interface SuppliesTrackerConfig extends Config -{ - @ConfigTitleSection( - keyName = "blowpipeTitle", - name = "Blowpipe", - description = "", - position = 1 - ) - default Title blowpipeTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "blowpipeAmmo", - name = "Ammo", - description = "What type of dart are you using in your toxic blowpipe", - titleSection = "blowpipeTitle" - ) - default BlowpipeDartType blowpipeAmmo() - { - return BlowpipeDartType.MITHRIL; - } - - @ConfigTitleSection( - keyName = "chargesBoxTitle", - name = "Charges Box", - description = "", - position = 2 - ) - default Title chargesBoxTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "chargesBox", - name = "Show weapons charges used box?", - description = "Separates items with charges to show how many of those charges you used.", - titleSection = "chargesBoxTitle" - ) - default boolean chargesBox() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/SuppliesTrackerItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/SuppliesTrackerItem.java deleted file mode 100644 index 634ddc5b55..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/SuppliesTrackerItem.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2018, Daddy Dozer - * 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.suppliestracker; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter(AccessLevel.PUBLIC) -@AllArgsConstructor -public class SuppliesTrackerItem -{ - private int id; - private String name; - private int quantity; - private long price; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/SuppliesTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/SuppliesTrackerPlugin.java deleted file mode 100644 index 9d3abd0c2d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/SuppliesTrackerPlugin.java +++ /dev/null @@ -1,1340 +0,0 @@ -/* - * Copyright (c) 2018, Psikoi - * Copyright (c) 2018, Adam - * Copyright (c) 2018, Sir Girion - * Copyright (c) 2018, Davis Cook - * Copyright (c) 2018, Daddy Dozer - * 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.suppliestracker; - -import com.google.inject.Provides; -import java.awt.image.BufferedImage; -import java.util.ArrayDeque; -import java.util.Deque; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.regex.Pattern; -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.swing.SwingUtilities; -import lombok.extern.slf4j.Slf4j; -import static net.runelite.api.AnimationID.*; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.EquipmentInventorySlot; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemDefinition; -import static net.runelite.api.ItemID.*; -import net.runelite.api.Player; -import net.runelite.api.VarPlayer; -import net.runelite.api.Varbits; -import net.runelite.api.events.AnimationChanged; -import net.runelite.api.events.CannonChanged; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.StatChanged; -import net.runelite.api.events.VarbitChanged; -import net.runelite.client.config.ConfigManager; -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.plugins.PluginType; -import static net.runelite.client.plugins.suppliestracker.ActionType.*; -import net.runelite.client.plugins.suppliestracker.skills.Farming; -import net.runelite.client.plugins.suppliestracker.skills.Prayer; -import net.runelite.client.plugins.suppliestracker.ui.SuppliesTrackerPanel; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.util.ImageUtil; -import net.runelite.http.api.item.ItemPrice; - -@PluginDescriptor( - name = "Supplies Used Tracker", - description = "Tracks supplies used during the session", - tags = {"cost"}, - type = PluginType.MISCELLANEOUS, - enabledByDefault = false -) -@Singleton -@Slf4j -public class SuppliesTrackerPlugin extends Plugin -{ - //Regex patterns - public static final String POTION_PATTERN = "[(]\\d[)]"; - private static final String EAT_PATTERN = "^eat"; - private static final String DRINK_PATTERN = "^drink"; - private static final String TELEPORT_PATTERN = "^teleport"; - private static final String TELETAB_PATTERN = "^break"; - private static final String SPELL_PATTERN = "^cast|^grand\\sexchange|^outside|^seers|^yanille"; - - //Equipment slot constants - private static final int EQUIPMENT_MAINHAND_SLOT = EquipmentInventorySlot.WEAPON.getSlotIdx(); - private static final int EQUIPMENT_AMMO_SLOT = EquipmentInventorySlot.AMMO.getSlotIdx(); - private static final int EQUIPMENT_CAPE_SLOT = EquipmentInventorySlot.CAPE.getSlotIdx(); - - //Ava's calculations - private static final double NO_AVAS_PERCENT = 1.0; - private static final double ASSEMBLER_PERCENT = 0.20; - private static final double ACCUMULATOR_PERCENT = 0.28; - private static final double ATTRACTOR_PERCENT = 0.40; - private static final Random random = new Random(); - - //blowpipe attack timings - private static final int BLOWPIPE_TICKS_RAPID_PVM = 2; - private static final int BLOWPIPE_TICKS_RAPID_PVP = 3; - private static final int BLOWPIPE_TICKS_NORMAL_PVM = 3; - private static final int BLOWPIPE_TICKS_NORMAL_PVP = 4; - - //blowpipe scale usage - private static final double SCALES_PERCENT = 0.66; - - //Max use amounts - private static final int POTION_DOSES = 4, CAKE_DOSES = 3, PIZZA_PIE_DOSES = 2; - - // id array for checking thrown items and runes - private static final int[] THROWING_IDS = new int[]{BRONZE_DART, IRON_DART, STEEL_DART, BLACK_DART, MITHRIL_DART, ADAMANT_DART, RUNE_DART, DRAGON_DART, BRONZE_KNIFE, IRON_KNIFE, STEEL_KNIFE, BLACK_KNIFE, MITHRIL_KNIFE, ADAMANT_KNIFE, RUNE_KNIFE, BRONZE_THROWNAXE, IRON_THROWNAXE, STEEL_THROWNAXE, MITHRIL_THROWNAXE, ADAMANT_THROWNAXE, RUNE_THROWNAXE, DRAGON_KNIFE, DRAGON_KNIFE_22812, DRAGON_KNIFE_22814, DRAGON_KNIFEP_22808, DRAGON_KNIFEP_22810, DRAGON_KNIFEP, DRAGON_THROWNAXE, CHINCHOMPA_10033, RED_CHINCHOMPA_10034, BLACK_CHINCHOMPA}; - private static final int[] RUNE_IDS = new int[]{FIRE_RUNE, AIR_RUNE, WATER_RUNE, EARTH_RUNE, MIND_RUNE, BODY_RUNE, COSMIC_RUNE, CHAOS_RUNE, NATURE_RUNE, LAW_RUNE, DEATH_RUNE, ASTRAL_RUNE, BLOOD_RUNE, SOUL_RUNE, WRATH_RUNE, MIST_RUNE, DUST_RUNE, MUD_RUNE, SMOKE_RUNE, STEAM_RUNE, LAVA_RUNE}; - - //Hold Supply Data - private final Map suppliesEntry = new HashMap<>(); - private final Deque actionStack = new ArrayDeque<>(); - - //Item arrays - private final String[] RAIDS_CONSUMABLES = new String[]{"xeric's", "elder", "twisted", "revitalisation", "overload", "prayer enhance", "pysk", "suphi", "leckish", "brawk", "mycil", "roqed", "kyren", "guanic", "prael", "giral", "phluxia", "kryket", "murng", "psykk", "egniol"}; - private final int[] TRIDENT_OF_THE_SEAS_IDS = new int[]{TRIDENT_OF_THE_SEAS, TRIDENT_OF_THE_SEAS_E, TRIDENT_OF_THE_SEAS_FULL}; - private final int[] TRIDENT_OF_THE_SWAMP_IDS = new int[]{TRIDENT_OF_THE_SWAMP_E, TRIDENT_OF_THE_SWAMP, UNCHARGED_TOXIC_TRIDENT_E, UNCHARGED_TOXIC_TRIDENT}; - - //Rune pouch stuff - private final Varbits[] AMOUNT_VARBITS = - { - Varbits.RUNE_POUCH_AMOUNT1, Varbits.RUNE_POUCH_AMOUNT2, Varbits.RUNE_POUCH_AMOUNT3 - }; - private final Varbits[] RUNE_VARBITS = - { - Varbits.RUNE_POUCH_RUNE1, Varbits.RUNE_POUCH_RUNE2, Varbits.RUNE_POUCH_RUNE3 - }; - private final int[] OLD_AMOUNT_VARBITS = - { - 0, 0, 0 - }; - private final int[] OLD_RUNE_VARBITS = - { - 0, 0, 0 - }; - private int rune1 = 0; - private int rune2 = 0; - private int rune3 = 0; - private boolean runepouchInInv = false; - private int amountused1 = 0; - private int amountused2 = 0; - private int amountused3 = 0; - private boolean magicXpChanged = false; - private boolean skipTick = false; - private boolean noXpCast = false; - private int magicXp = 0; - - //prayer stuff - private Prayer prayer; - private boolean prayerAltarAnimationCheck = false; - private int prayerXp = 0; - private int boneId = 0; - private boolean skipBone = false; - private int longTickWait = 0; - private int ensouledHeadId = 0; - - //farming stuff - private Farming farming; - - - private ItemContainer old; - private int ammoId = 0; - private int ammoAmount = 0; - private int thrownId = 0; - private int thrownAmount = 0; - private boolean ammoLoaded = false; - private boolean throwingAmmoLoaded = false; - private boolean mainHandThrowing = false; - private int mainHand = 0; - private int attackStyleVarbit = -1; - private int ticks = 0; - private int ticksInAnimation; - - private SuppliesTrackerPanel panel; - private NavigationButton navButton; - @Inject - private ClientToolbar clientToolbar; - @Inject - private ItemManager itemManager; - @Inject - private SuppliesTrackerConfig config; - @Inject - private Client client; - - /** - * Checks if item name is potion - * - * @param name the name of the item - * @return if the item is a potion - i.e. has a (1) (2) (3) or (4) in the name - */ - public static boolean isPotion(String name) - { - return name.contains("(4)") || - name.contains("(3)") || - name.contains("(2)") || - name.contains("(1)"); - } - /** - * Checks if item name is pizza or pie - * - * @param name the name of the item - * @return if the item is a pizza or a pie - i.e. has pizza or pie in the name - */ - public static boolean isPizzaPie(String name) - { - return name.toLowerCase().contains("pizza") || - name.toLowerCase().contains(" pie"); - } - public static boolean isCake(String name, int itemId) - { - return name.toLowerCase().contains("cake") || - itemId == CHOCOLATE_SLICE; - } - - @Override - protected void startUp() - { - - panel = new SuppliesTrackerPanel(itemManager, this); - farming = new Farming(this, itemManager); - prayer = new Prayer(this, itemManager); - final BufferedImage header = ImageUtil.getResourceStreamFromClass(getClass(), "panel_icon.png"); - panel.loadHeaderIcon(header); - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "panel_icon.png"); - - navButton = NavigationButton.builder() - .tooltip("Supplies Tracker") - .icon(icon) - .priority(5) - .panel(panel) - .build(); - - clientToolbar.addNavigation(navButton); - } - - @Override - protected void shutDown() - { - clientToolbar.removeNavigation(navButton); - } - - @Provides - SuppliesTrackerConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(SuppliesTrackerConfig.class); - } - - @Subscribe - void onStatChanged(StatChanged event) - { - if (event.getSkill().name().toLowerCase().equals("magic")) - { - if (magicXp != event.getXp()) - { - skipTick = true; - magicXpChanged = true; - magicXp = event.getXp(); - } - } - if (event.getSkill().name().toLowerCase().equals("prayer")) - { - if (prayerXp != event.getXp()) - { - if (prayerAltarAnimationCheck) - { - if (!skipBone) - { - prayer.build(); - } - } - prayerXp = event.getXp(); - } - } - } - - @Subscribe - private void onGameTick(GameTick tick) - { - Player player = client.getLocalPlayer(); - if (player.getAnimation() == BLOWPIPE_ATTACK) - { - ticks++; - } - if (ticks == ticksInAnimation && - (player.getAnimation() == BLOWPIPE_ATTACK)) - { - double ava_percent = getAccumulatorPercent(); - // randomize the usage of supplies since we CANNOT actually get real supplies used - if (random.nextDouble() <= ava_percent) - { - buildEntries(config.blowpipeAmmo().getDartID()); - } - if (random.nextDouble() <= SCALES_PERCENT) - { - buildEntries(ZULRAHS_SCALES); - } - ticks = 0; - } - - //reset skip bone for dark altar - skipBone = false; - - //Waits to reset prayer animation check. needed for 1 ticking or - //in case animation gets interrupted - if (longTickWait > 0) - { - longTickWait = longTickWait - 1; - } - else if (prayerAltarAnimationCheck) - { - prayerAltarAnimationCheck = false; - } - - - if (skipTick) - { - skipTick = false; - return; - } - else if (magicXpChanged) - { - checkUsedRunePouch(); - magicXpChanged = false; - noXpCast = false; - } - else if (noXpCast) - { - checkUsedRunePouch(); - noXpCast = false; - } - - amountused1 = 0; - amountused2 = 0; - amountused3 = 0; - } - - /** - * checks the player's cape slot to determine what percent of their darts are lost - * - where lost means either break or drop to floor - * - * @return the percent lost - */ - private double getAccumulatorPercent() - { - double percent = NO_AVAS_PERCENT; - ItemContainer equipment = client.getItemContainer(InventoryID.EQUIPMENT); - if (equipment != null && equipment.getItems().length > EQUIPMENT_CAPE_SLOT) - { - int capeID = equipment.getItems()[EQUIPMENT_CAPE_SLOT].getId(); - switch (capeID) - { - case AVAS_ASSEMBLER: - case AVAS_ASSEMBLER_L: - case ASSEMBLER_MAX_CAPE: - percent = ASSEMBLER_PERCENT; - break; - case AVAS_ACCUMULATOR: - case AVAS_ACCUMULATOR_23609: - case ACCUMULATOR_MAX_CAPE: - // TODO: the ranging cape can be used as an attractor so this could be wrong - case RANGING_CAPE: - percent = ACCUMULATOR_PERCENT; - break; - case AVAS_ATTRACTOR: - percent = ATTRACTOR_PERCENT; - break; - } - } - return percent; - } - - @Subscribe - private void onVarbitChanged(VarbitChanged event) - { - updateRunePouch(); - - if (attackStyleVarbit == -1 || - attackStyleVarbit != client.getVar(VarPlayer.ATTACK_STYLE)) - { - attackStyleVarbit = client.getVar(VarPlayer.ATTACK_STYLE); - if (attackStyleVarbit == 0 || - attackStyleVarbit == 3) - { - ticksInAnimation = BLOWPIPE_TICKS_NORMAL_PVM; - if (client.getLocalPlayer() != null && - client.getLocalPlayer().getInteracting() instanceof Player) - { - ticksInAnimation = BLOWPIPE_TICKS_NORMAL_PVP; - } - } - else if (attackStyleVarbit == 1) - { - ticksInAnimation = BLOWPIPE_TICKS_RAPID_PVM; - if (client.getLocalPlayer() != null && - client.getLocalPlayer().getInteracting() instanceof Player) - { - ticksInAnimation = BLOWPIPE_TICKS_RAPID_PVP; - } - } - } - } - - /** - * Checks local variable data against client data then returns differences then updates local to client - */ - private void updateRunePouch() - { - //check amounts - if (OLD_AMOUNT_VARBITS[0] != client.getVar(AMOUNT_VARBITS[0])) - { - if (OLD_AMOUNT_VARBITS[0] > client.getVar(AMOUNT_VARBITS[0])) - { - amountused1 += OLD_AMOUNT_VARBITS[0] - client.getVar(AMOUNT_VARBITS[0]); - } - OLD_AMOUNT_VARBITS[0] = client.getVar(AMOUNT_VARBITS[0]); - } - if (OLD_AMOUNT_VARBITS[1] != client.getVar(AMOUNT_VARBITS[1])) - { - if (OLD_AMOUNT_VARBITS[1] > client.getVar(AMOUNT_VARBITS[1])) - { - amountused2 += OLD_AMOUNT_VARBITS[1] - client.getVar(AMOUNT_VARBITS[1]); - } - OLD_AMOUNT_VARBITS[1] = client.getVar(AMOUNT_VARBITS[1]); - } - if (OLD_AMOUNT_VARBITS[2] != client.getVar(AMOUNT_VARBITS[2])) - { - if (OLD_AMOUNT_VARBITS[2] > client.getVar(AMOUNT_VARBITS[2])) - { - amountused3 += OLD_AMOUNT_VARBITS[2] - client.getVar(AMOUNT_VARBITS[2]); - } - OLD_AMOUNT_VARBITS[2] = client.getVar(AMOUNT_VARBITS[2]); - } - - //check runes - if (OLD_RUNE_VARBITS[0] != client.getVar(RUNE_VARBITS[0])) - { - rune1 = client.getVar(RUNE_VARBITS[0]); - OLD_RUNE_VARBITS[0] = client.getVar(RUNE_VARBITS[0]); - } - if (OLD_RUNE_VARBITS[1] != client.getVar(RUNE_VARBITS[1])) - { - rune2 = client.getVar(RUNE_VARBITS[1]); - OLD_RUNE_VARBITS[1] = client.getVar(RUNE_VARBITS[1]); - } - if (OLD_RUNE_VARBITS[2] != client.getVar(RUNE_VARBITS[2])) - { - rune3 = client.getVar(RUNE_VARBITS[2]); - OLD_RUNE_VARBITS[2] = client.getVar(RUNE_VARBITS[2]); - } - } - - /** - * Checks for changes between the provided inventories in runes specifically to add those runes - * to the supply tracker - *

- * we can't in general just check for when inventory slots change but this method is only run - * immediately after the player performs a cast animation or cast menu click/entry - * - * @param itemContainer the new inventory - * @param oldInv the old inventory - */ - private void checkUsedRunes(ItemContainer itemContainer, Item[] oldInv) - { - try - { - for (int i = 0; i < itemContainer.getItems().length; i++) - { - Item newItem = itemContainer.getItems()[i]; - Item oldItem = oldInv[i]; - boolean isRune = false; - for (int runeId : RUNE_IDS) - { - if (oldItem.getId() == runeId) - { - isRune = true; - break; - } - } - if (isRune && (newItem.getId() != oldItem.getId() || - newItem.getQuantity() != oldItem.getQuantity())) - { - int quantity = oldItem.getQuantity(); - if (newItem.getId() == oldItem.getId()) - { - quantity -= newItem.getQuantity(); - } - // ensure that only positive quantities are added since it is reported - // that sometimes checkUsedRunes is called on the same tick that a player - // gains runes in their inventory - if (quantity > 0) - { - buildEntries(oldItem.getId(), quantity); - } - } - } - } - catch (IndexOutOfBoundsException ignored) - { - } - } - - @Subscribe - private void onCannonballFired(CannonChanged cannonChanged) - { - if (cannonChanged.getCannonballId() == null) - { - return; - } - buildEntries(CANNONBALL); - } - - @Subscribe - private void onAnimationChanged(AnimationChanged animationChanged) - { - if (animationChanged.getActor() == client.getLocalPlayer()) - { - int playerAniId = animationChanged.getActor().getAnimation(); - - switch (playerAniId) - { - case HIGH_LEVEL_MAGIC_ATTACK: - //Trident of the seas - for (int tridentOfTheSeas : TRIDENT_OF_THE_SEAS_IDS) - { - if (mainHand == tridentOfTheSeas) - { - if (config.chargesBox()) - { - buildChargesEntries(TRIDENT_OF_THE_SEAS); - } - else - { - buildEntries(CHAOS_RUNE); - buildEntries(DEATH_RUNE); - buildEntries(FIRE_RUNE, 5); - buildEntries(COINS_995, 10); - } - break; - } - } - //Trident of the swamp - for (int tridentOfTheSwamp : TRIDENT_OF_THE_SWAMP_IDS) - { - if (mainHand == tridentOfTheSwamp) - { - if (config.chargesBox()) - { - buildChargesEntries(TRIDENT_OF_THE_SWAMP); - } - else - { - buildEntries(CHAOS_RUNE); - buildEntries(DEATH_RUNE); - buildEntries(FIRE_RUNE, 5); - buildEntries(ZULRAHS_SCALES); - } - break; - } - } - //Sang Staff - if (mainHand == SANGUINESTI_STAFF) - { - if (config.chargesBox()) - { - buildChargesEntries(SANGUINESTI_STAFF); - } - else - { - buildEntries(BLOOD_RUNE, 3); - } - } - break; - case LOW_LEVEL_MAGIC_ATTACK: - case BARRAGE_ANIMATION: - case BLITZ_ANIMATION: - case LOW_LEVEL_STANDARD_SPELLS: - case WAVE_SPELL_ANIMATION: - case SURGE_SPELL_ANIMATION: - case HIGH_ALCH_ANIMATION: - case LUNAR_HUMIDIFY: - old = client.getItemContainer(InventoryID.INVENTORY); - - if (old != null && old.getItems() != null && - actionStack.stream().noneMatch(a -> - a.getType() == CAST)) - { - MenuAction newAction = new MenuAction(CAST, old.getItems()); - actionStack.push(newAction); - } - if (!magicXpChanged) - { - skipTick = true; - noXpCast = true; - } - break; - case SCYTHE_OF_VITUR_ANIMATION: - if (config.chargesBox()) - { - buildChargesEntries(SCYTHE_OF_VITUR); - } - else - { - buildEntries(BLOOD_RUNE, 3); - buildEntries(COINS_995, itemManager.getItemPrice(VIAL_OF_BLOOD_22446) / 100); - } - break; - case ONEHAND_SLASH_SWORD_ANIMATION: - case ONEHAND_STAB_SWORD_ANIMATION: - if (mainHand == BLADE_OF_SAELDOR) buildChargesEntries(BLADE_OF_SAELDOR); - break; - case USING_GILDED_ALTAR: - case PRAY_AT_ALTAR: - prayerAltarAnimationCheck = true; - longTickWait = 5; - break; - case ENSOULED_HEADS_ANIMATION: - if (ensouledHeadId != 0) - { - buildEntries(ensouledHeadId); - ensouledHeadId = 0; - } - break; - } - } - } - - @Subscribe - private void onItemContainerChanged(ItemContainerChanged itemContainerChanged) - { - ItemContainer itemContainer = itemContainerChanged.getItemContainer(); - - - if (itemContainer != null && itemContainer == client.getItemContainer(InventoryID.INVENTORY)) - { - for (int i = 0; i < client.getItemContainer(InventoryID.INVENTORY).getItems().length; i++) - { - - int tItemId = client.getItemContainer(InventoryID.INVENTORY).getItems()[i].getId(); - - if (tItemId == RUNE_POUCH || tItemId == RUNE_POUCH_23650 || tItemId == RUNE_POUCH_L) - { - runepouchInInv = true; - break; - } - else - { - runepouchInInv = false; - } - } - } - - if (itemContainer == client.getItemContainer(InventoryID.INVENTORY) && - old != null) - { - while (!actionStack.isEmpty()) - { - MenuAction frame = actionStack.pop(); - ActionType type = frame.getType(); - MenuAction.ItemAction itemFrame; - Item[] oldInv = frame.getOldInventory(); - switch (type) - { - case CONSUMABLE: - itemFrame = (MenuAction.ItemAction) frame; - int nextItem = itemFrame.getItemID(); - int nextSlot = itemFrame.getSlot(); - if (itemContainer.getItems()[nextSlot].getId() != oldInv[nextSlot].getId()) - { - buildEntries(nextItem); - } - break; - case TELEPORT: - itemFrame = (MenuAction.ItemAction) frame; - int teleid = itemFrame.getItemID(); - int slot = itemFrame.getSlot(); - if (itemContainer.getItems()[slot].getId() != oldInv[slot].getId() || - itemContainer.getItems()[slot].getQuantity() != oldInv[slot].getQuantity()) - { - buildEntries(teleid); - } - break; - case CAST: - checkUsedRunes(itemContainer, oldInv); - break; - } - } - } - - if (itemContainer == client.getItemContainer(InventoryID.EQUIPMENT)) - { - //set mainhand for trident tracking - if (itemContainer.getItems().length > EQUIPMENT_MAINHAND_SLOT) - { - mainHand = itemContainer.getItems()[EQUIPMENT_MAINHAND_SLOT].getId(); - net.runelite.api.Item mainHandItem = itemContainer.getItems()[EQUIPMENT_MAINHAND_SLOT]; - for (int throwingIDs : THROWING_IDS) - { - if (mainHand == throwingIDs) - { - mainHandThrowing = true; - break; - } - else - { - mainHandThrowing = false; - } - } - if (mainHandThrowing) - { - if (throwingAmmoLoaded) - { - if (thrownId == mainHandItem.getId()) - { - if (thrownAmount - 1 == mainHandItem.getQuantity()) - { - buildEntries(mainHandItem.getId()); - thrownAmount = mainHandItem.getQuantity(); - } - else - { - thrownAmount = mainHandItem.getQuantity(); - } - } - else - { - thrownId = mainHandItem.getId(); - thrownAmount = mainHandItem.getQuantity(); - } - } - else - { - thrownId = mainHandItem.getId(); - thrownAmount = mainHandItem.getQuantity(); - throwingAmmoLoaded = true; - } - } - else - { - throwingAmmoLoaded = false; - } - } - //Ammo tracking - if (itemContainer.getItems().length > EQUIPMENT_AMMO_SLOT) - { - net.runelite.api.Item ammoSlot = itemContainer.getItems()[EQUIPMENT_AMMO_SLOT]; - if (ammoSlot != null) - { - if (ammoLoaded) - { - if (ammoId == ammoSlot.getId()) - { - if (ammoAmount - 1 == ammoSlot.getQuantity()) - { - buildEntries(ammoSlot.getId()); - ammoAmount = ammoSlot.getQuantity(); - } - else - { - ammoAmount = ammoSlot.getQuantity(); - } - } - else - { - ammoId = ammoSlot.getId(); - ammoAmount = ammoSlot.getQuantity(); - } - } - else - { - ammoId = ammoSlot.getId(); - ammoAmount = ammoSlot.getQuantity(); - ammoLoaded = true; - } - } - } - - } - } - - @Subscribe - private void onMenuOptionClicked(final MenuOptionClicked event) - { - - // Uses stacks to push/pop for tick eating - // Create pattern to find eat/drink at beginning - Pattern eatPattern = Pattern.compile(EAT_PATTERN); - Pattern drinkPattern = Pattern.compile(DRINK_PATTERN); - if ((eatPattern.matcher(event.getOption().toLowerCase()).find() || drinkPattern.matcher(event.getOption().toLowerCase()).find()) && - actionStack.stream().noneMatch(a -> - { - if (a instanceof MenuAction.ItemAction) - { - MenuAction.ItemAction i = (MenuAction.ItemAction) a; - return i.getItemID() == event.getIdentifier(); - } - return false; - })) - { - switch (event.getMenuOpcode()) - { - case ITEM_FIRST_OPTION: - case ITEM_SECOND_OPTION: - case ITEM_THIRD_OPTION: - case ITEM_FOURTH_OPTION: - case ITEM_FIFTH_OPTION: - case CC_OP_LOW_PRIORITY: - case WIDGET_FIRST_OPTION: - case WIDGET_SECOND_OPTION: - case WIDGET_THIRD_OPTION: - case WIDGET_FOURTH_OPTION: - case WIDGET_FIFTH_OPTION: - case CC_OP: - break; - default: - return; - } - old = client.getItemContainer(InventoryID.INVENTORY); - int slot = event.getParam0(); - if (old.getItems() != null) - { - int pushItem = old.getItems()[event.getParam0()].getId(); - MenuAction newAction = new MenuAction.ItemAction(CONSUMABLE, old.getItems(), pushItem, slot); - actionStack.push(newAction); - } - } - - // Create pattern for teleport scrolls and tabs - Pattern teleportPattern = Pattern.compile(TELEPORT_PATTERN); - Pattern teletabPattern = Pattern.compile(TELETAB_PATTERN); - if (teleportPattern.matcher(event.getTarget().toLowerCase()).find() || - teletabPattern.matcher(event.getTarget().toLowerCase()).find()) - { - old = client.getItemContainer(InventoryID.INVENTORY); - - // Makes stack only contains one teleport type to stop from adding multiple of one teleport - if (old != null && old.getItems() != null && - actionStack.stream().noneMatch(a -> - a.getType() == TELEPORT)) - { - int teleid = event.getIdentifier(); - MenuAction newAction = new MenuAction.ItemAction(TELEPORT, old.getItems(), teleid, event.getParam0()); - actionStack.push(newAction); - } - } - - // Create pattern for spell cast - Pattern spellPattern = Pattern.compile(SPELL_PATTERN); - // note that here we look at the option not target b/c the option for all spells is cast - // but the target differs based on each spell name - if (spellPattern.matcher(event.getOption().toLowerCase()).find()) - { - old = client.getItemContainer(InventoryID.INVENTORY); - - if (old != null && old.getItems() != null && actionStack.stream().noneMatch(a -> - a.getType() == CAST)) - { - MenuAction newAction = new MenuAction(CAST, old.getItems()); - actionStack.push(newAction); - } - - } - - if (event.getTarget().toLowerCase().equals("use")) - { - if (itemManager.getItemDefinition(event.getIdentifier()).getName().toLowerCase().contains("compost")) - { - farming.setBucketId(event.getIdentifier()); - } - else - { - farming.setPlantId(event.getIdentifier()); - } - - } - - if (event.getTarget().equals("Use") || event.getOption().toLowerCase().contains("bury")) - { - if (itemManager.getItemDefinition(event.getIdentifier()).getName().toLowerCase().contains("bones")) - { - prayer.setBonesId(event.getIdentifier()); - boneId = event.getIdentifier(); - } - } - - if (event.getOption().equals("Reanimate") && event.getMenuOpcode().name().equals("ITEM_USE_ON_WIDGET")) - { - ensouledHeadId = event.getIdentifier(); - } - - //Adds tracking to Master Scroll Book - if (event.getOption().toLowerCase().equals("activate")) - { - String target = event.getTarget(); - if (target.toLowerCase().contains("teleport scroll")) - { - switch (target.toLowerCase().substring(target.indexOf(">") + 1)) - { - case "watson teleport scroll": - buildEntries(WATSON_TELEPORT); - break; - case "zul-andra teleport scroll": - buildEntries(ZULANDRA_TELEPORT); - break; - case "nardah teleport scroll": - buildEntries(NARDAH_TELEPORT); - break; - case "digsite teleport scroll": - buildEntries(DIGSITE_TELEPORT); - break; - case "feldip hills teleport scroll": - buildEntries(FELDIP_HILLS_TELEPORT); - break; - case "lunar isle teleport scroll": - buildEntries(LUNAR_ISLE_TELEPORT); - break; - case "mort'ton teleport scroll": - buildEntries(MORTTON_TELEPORT); - break; - case "pest control teleport scroll": - buildEntries(PEST_CONTROL_TELEPORT); - break; - case "piscatoris teleport scroll": - buildEntries(PISCATORIS_TELEPORT); - break; - case "iorwerth camp teleport scroll": - buildEntries(IORWERTH_CAMP_TELEPORT); - break; - case "mos le'harmless teleport scroll": - buildEntries(MOS_LEHARMLESS_TELEPORT); - break; - case "lumberyard teleport scroll": - buildEntries(LUMBERYARD_TELEPORT); - break; - case "revenant cave teleport scroll": - buildEntries(REVENANT_CAVE_TELEPORT); - break; - case "tai bwo wannai teleport scroll": - buildEntries(TAI_BWO_WANNAI_TELEPORT); - break; - case "key master teleport": - buildEntries(KEY_MASTER_TELEPORT); - } - } - } - } - - @Subscribe - void onChatMessage(ChatMessage event) - { - String message = event.getMessage(); - - if (event.getType() == ChatMessageType.GAMEMESSAGE || event.getType() == ChatMessageType.SPAM) - { - if (message.toLowerCase().contains("you plant ")) - { - farming.OnChatPlant(message.toLowerCase()); - } - else if (message.toLowerCase().contains("you treat ")) - { - farming.setEndlessBucket(message); - farming.OnChatTreat(message.toLowerCase()); - } - else if (message.toLowerCase().contains("you bury the bones")) - { - prayer.OnChat(message); - } - else if (message.toLowerCase().contains("dark lord")) - { - skipBone = true; - } - else if (message.toLowerCase().contains("your amulet has") || - message.toLowerCase().contains("your amulet's last charge")) - { - buildChargesEntries(AMULET_OF_GLORY6); - } - else if (message.toLowerCase().contains("your ring of dueling has") || - message.toLowerCase().contains("your ring of dueling crumbles")) - { - buildChargesEntries(RING_OF_DUELING8); - } - else if (message.toLowerCase().contains("your ring of wealth has")) - { - buildChargesEntries(RING_OF_WEALTH_5); - } - else if (message.toLowerCase().contains("your combat bracelet has") || - message.toLowerCase().contains("your combat bracelet's last charge")) - { - buildChargesEntries(COMBAT_BRACELET6); - } - else if (message.toLowerCase().contains("your games necklace has") || - message.toLowerCase().contains("your games necklace crumbles")) - { - buildChargesEntries(GAMES_NECKLACE8); - } - else if (message.toLowerCase().contains("your skills necklace has") || - message.toLowerCase().contains("your skills necklace's last charge")) - { - buildChargesEntries(SKILLS_NECKLACE6); - } - else if (message.toLowerCase().contains("your necklace of passage has") || - message.toLowerCase().contains("your necklace of passage crumbles")) - { - buildChargesEntries(NECKLACE_OF_PASSAGE5); - } - else if (message.toLowerCase().contains("your burning amulet has") || - message.toLowerCase().contains("your burning amulet crumbles")) - { - buildChargesEntries(BURNING_AMULET5); - } - } - } - - /** - * correct prices for potions, pizzas pies, and cakes - * tracker tracks each dose of a potion/pizza/pie/cake as an entire one - * so must divide price by total amount of doses in each - * this is necessary b/c the most correct/accurate price for these resources is the - * full price not the 1-dose price - * - * @param name the item name - * @param itemId the item id - * @param price the current calculated price - * @return the price modified by the number of doses - */ - private long scalePriceByDoses(String name, int itemId, long price) - { - if (isPotion(name)) - { - return price / POTION_DOSES; - } - if (isPizzaPie(name)) - { - return price / PIZZA_PIE_DOSES; - } - if (isCake(name, itemId)) - { - return price / CAKE_DOSES; - } - return price; - } - - /** - * Add an item to the supply tracker (with 1 count for that item) - * - * @param itemId the id of the item - */ - public void buildEntries(int itemId) - { - buildEntries(itemId, 1); - } - - /** - * Add an item to the supply tracker - * - * @param itemId the id of the item - * @param count the amount of the item to add to the tracker - */ - public void buildEntries(int itemId, int count) - { - final ItemDefinition itemComposition = itemManager.getItemDefinition(itemId); - String name = itemComposition.getName(); - long calculatedPrice; - - for (String raidsConsumables : RAIDS_CONSUMABLES) - { - if (name.toLowerCase().contains(raidsConsumables)) - { - return; - } - } - - if (itemId == PADDLEFISH) - { - return; - } - // convert potions, pizzas/pies, and cakes to their full equivalents - // e.g. a half pizza becomes full pizza, 3 dose potion becomes 4, etc... - if (isPotion(name)) - { - name = name.replaceAll(POTION_PATTERN, "(4)"); - itemId = getPotionID(name); - } - if (isPizzaPie(name)) - { - itemId = getFullVersionItemID(itemId); - name = itemManager.getItemDefinition(itemId).getName(); - } - if (isCake(name, itemId)) - { - itemId = getFullVersionItemID(itemId); - name = itemManager.getItemDefinition(itemId).getName(); - } - - int newQuantity; - if (suppliesEntry.containsKey(itemId)) - { - newQuantity = suppliesEntry.get(itemId).getQuantity() + count; - } - else - { - newQuantity = count; - } - - // calculate price for amount of doses used - calculatedPrice = ((long) itemManager.getItemPrice(itemId)) * ((long) newQuantity); - calculatedPrice = scalePriceByDoses(name, itemId, calculatedPrice); - - // write the new quantity and calculated price for this entry - SuppliesTrackerItem newEntry = new SuppliesTrackerItem( - itemId, - name, - newQuantity, - calculatedPrice); - - - suppliesEntry.put(itemId, newEntry); - SwingUtilities.invokeLater(() -> - panel.addItem(newEntry)); - } - - /** - * Add an item to the supply tracker - * - * @param itemId the id of the item - */ - private void buildChargesEntries(int itemId) - { - final ItemDefinition itemComposition = itemManager.getItemDefinition(itemId); - String name = itemComposition.getName(); - long calculatedPrice = 0; - - - int newQuantity; - if (suppliesEntry.containsKey(itemId)) - { - newQuantity = suppliesEntry.get(itemId).getQuantity() + 1; - } - else - { - newQuantity = 1; - } - - switch (itemId) - { - case AMULET_OF_GLORY6: - calculatedPrice = (((itemManager.getItemPrice(AMULET_OF_GLORY6) - (itemManager.getItemPrice(AMULET_OF_GLORY))) * newQuantity) / 6); - break; - case RING_OF_DUELING8: - calculatedPrice = ((itemManager.getItemPrice(RING_OF_DUELING8) * newQuantity) / 8); - break; - case RING_OF_WEALTH_5: - calculatedPrice = (((itemManager.getItemPrice(RING_OF_WEALTH_5) - (itemManager.getItemPrice(RING_OF_WEALTH))) * newQuantity) / 5); - break; - case COMBAT_BRACELET6: - calculatedPrice = ((itemManager.getItemPrice(COMBAT_BRACELET6) * newQuantity) / 6); - break; - case GAMES_NECKLACE8: - calculatedPrice = ((itemManager.getItemPrice(GAMES_NECKLACE8) * newQuantity) / 8); - break; - case SKILLS_NECKLACE6: - calculatedPrice = (((itemManager.getItemPrice(SKILLS_NECKLACE6) - (itemManager.getItemPrice(SKILLS_NECKLACE))) * newQuantity) / 6); - break; - case NECKLACE_OF_PASSAGE5: - calculatedPrice = ((itemManager.getItemPrice(NECKLACE_OF_PASSAGE5) * newQuantity) / 5); - break; - case BURNING_AMULET5: - calculatedPrice = ((itemManager.getItemPrice(BURNING_AMULET5) * newQuantity) / 5); - break; - case SCYTHE_OF_VITUR: - calculatedPrice = (itemManager.getItemPrice(BLOOD_RUNE) * newQuantity * 3) + (itemManager.getItemPrice(VIAL_OF_BLOOD_22446) * newQuantity / 100); - break; - case TRIDENT_OF_THE_SWAMP: - calculatedPrice = (itemManager.getItemPrice(CHAOS_RUNE) * newQuantity) + (itemManager.getItemPrice(DEATH_RUNE) * newQuantity) + - (itemManager.getItemPrice(FIRE_RUNE) * newQuantity) + (itemManager.getItemPrice(ZULRAHS_SCALES) * newQuantity); - break; - case TRIDENT_OF_THE_SEAS: - calculatedPrice = (itemManager.getItemPrice(CHAOS_RUNE) * newQuantity) + (itemManager.getItemPrice(DEATH_RUNE) * newQuantity) + - (itemManager.getItemPrice(FIRE_RUNE) * newQuantity) + (itemManager.getItemPrice(COINS_995) * newQuantity * 10); - break; - case SANGUINESTI_STAFF: - calculatedPrice = (itemManager.getItemPrice(BLOOD_RUNE) * newQuantity * 3); - break; - case BLADE_OF_SAELDOR: - calculatedPrice = 0; - break; - } - - // write the new quantity and calculated price for this entry - SuppliesTrackerItem newEntry = new SuppliesTrackerItem( - itemId, - name, - newQuantity, - calculatedPrice); - - suppliesEntry.put(itemId, newEntry); - SwingUtilities.invokeLater(() -> - panel.addItem(newEntry)); - } - - - /** - * reset all item stacks - */ - public void clearSupplies() - { - suppliesEntry.clear(); - } - - /** - * reset an individual item stack - * - * @param itemId the id of the item stack - */ - public void clearItem(int itemId) - { - suppliesEntry.remove(itemId); - } - - /** - * Gets the item id that matches the provided name within the itemManager - * - * @param name the given name - * @return the item id for this name - */ - public int getPotionID(String name) - { - int itemId = 0; - - List items = itemManager.search(name); - for (ItemPrice item : items) - { - if (item.getName().contains(name)) - { - itemId = item.getId(); - } - } - return itemId; - } - - /** - * Takes the item id of a partial item (e.g. 1 dose potion, 1/2 a pizza, etc...) and returns - * the corresponding full item - * - * @param itemId the partial item id - * @return the full item id - */ - private int getFullVersionItemID(int itemId) - { - switch (itemId) - { - case _12_ANCHOVY_PIZZA: - itemId = ANCHOVY_PIZZA; - break; - case _12_MEAT_PIZZA: - itemId = MEAT_PIZZA; - break; - case _12_PINEAPPLE_PIZZA: - itemId = PINEAPPLE_PIZZA; - break; - case _12_PLAIN_PIZZA: - itemId = PLAIN_PIZZA; - break; - case HALF_A_REDBERRY_PIE: - itemId = REDBERRY_PIE; - break; - case HALF_A_GARDEN_PIE: - itemId = GARDEN_PIE; - break; - case HALF_A_SUMMER_PIE: - itemId = SUMMER_PIE; - break; - case HALF_A_FISH_PIE: - itemId = FISH_PIE; - break; - case HALF_A_BOTANICAL_PIE: - itemId = BOTANICAL_PIE; - break; - case HALF_A_MUSHROOM_PIE: - itemId = MUSHROOM_PIE; - break; - case HALF_AN_ADMIRAL_PIE: - itemId = ADMIRAL_PIE; - break; - case HALF_A_WILD_PIE: - itemId = WILD_PIE; - break; - case HALF_AN_APPLE_PIE: - itemId = APPLE_PIE; - break; - case HALF_A_MEAT_PIE: - itemId = MEAT_PIE; - break; - case _23_CAKE: - case SLICE_OF_CAKE: - itemId = CAKE; - break; - case _23_CHOCOLATE_CAKE: - case CHOCOLATE_SLICE: - itemId = CHOCOLATE_CAKE; - break; - } - return itemId; - } - - private void checkUsedRunePouch() - { - if (magicXpChanged || noXpCast) - { - if (amountused1 != 0 && amountused1 < 20) - { - buildEntries(Runes.getRune(rune1).getItemId(), amountused1); - } - if (amountused2 != 0 && amountused2 < 20) - { - buildEntries(Runes.getRune(rune2).getItemId(), amountused2); - } - if (amountused3 != 0 && amountused3 < 20) - { - buildEntries(Runes.getRune(rune3).getItemId(), amountused3); - } - } - - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/skills/Farming.java b/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/skills/Farming.java deleted file mode 100644 index 4bc0b7e95a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/skills/Farming.java +++ /dev/null @@ -1,95 +0,0 @@ -package net.runelite.client.plugins.suppliestracker.skills; - - -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.suppliestracker.SuppliesTrackerPlugin; -import javax.inject.Singleton; -import static net.runelite.api.ItemID.*; - -@Singleton -public class Farming -{ - private SuppliesTrackerPlugin plugin; - private ItemManager itemManager; - private int plantId = 0; - private int compostId = 0; - private int bucketId = 0; - private final int[] ALLOTMENT_SEEDS = new int[]{POTATO_SEED, ONION_SEED, CABBAGE_SEED, TOMATO_SEED, SWEETCORN_SEED, STRAWBERRY_SEED, WATERMELON_SEED, SNAPE_GRASS_SEED}; - - - public Farming(SuppliesTrackerPlugin plugin, ItemManager itemManager) - { - this.plugin = plugin; - this.itemManager = itemManager; - } - - public void OnChatPlant(String message) - { - if (plantId <= 0) - { - return; - } - String name = itemManager.getItemDefinition(plantId).getName().toLowerCase(); - if ( name.contains(" seed") || name.contains(" sapling")) - { - for (int seedId: ALLOTMENT_SEEDS) - { - if (plantId == seedId) - { - plugin.buildEntries(plantId, 3); - return; - } - } - plugin.buildEntries(plantId); - } - } - - public void OnChatTreat(String message) - { - if (bucketId <= 0) - { - return; - } - String name = itemManager.getItemDefinition(bucketId).getName().toLowerCase(); - - if (name.contains(" compost") || name.contains("plant cure")) - { - if (bucketId == BOTTOMLESS_COMPOST_BUCKET || bucketId == BOTTOMLESS_COMPOST_BUCKET_22997) - { - plugin.buildEntries(compostId); - } - else - { - plugin.buildEntries(bucketId); - } - } - } - - - - public void setPlantId(int plantId) - { - this.plantId = plantId; - } - - public void setBucketId(int bucketId) - { - this.bucketId = bucketId; - } - - public void setEndlessBucket(String message) - { - if (message.toLowerCase().contains("ultracompost")) - { - compostId = ULTRACOMPOST; - } - else if (message.toLowerCase().contains("supercompost")) - { - compostId = SUPERCOMPOST; - } - else - { - compostId = COMPOST; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/skills/Prayer.java b/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/skills/Prayer.java deleted file mode 100644 index b6e289f3e3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/skills/Prayer.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.runelite.client.plugins.suppliestracker.skills; - -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.suppliestracker.SuppliesTrackerPlugin; -import javax.inject.Singleton; - -@Singleton -public class Prayer -{ - private SuppliesTrackerPlugin plugin; - private ItemManager itemManager; - private int bonesId = 0; - - public Prayer(SuppliesTrackerPlugin plugin, ItemManager itemManager) - { - this.plugin = plugin; - this.itemManager = itemManager; - } - - public void OnChat(String message) - { - String name = itemManager.getItemDefinition(bonesId).getName().toLowerCase(); - - if (bonesId <= 0 || !name.contains("bones")) - { - return; - } - if (message.toLowerCase().contains("you bury the bones")) - { - plugin.buildEntries(bonesId); - } - } - - public void build() - { - plugin.buildEntries(bonesId); - } - - public void setBonesId(int bonesId) - { - this.bonesId = bonesId; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/ui/SuppliesBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/ui/SuppliesBox.java deleted file mode 100644 index eec57f7183..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/ui/SuppliesBox.java +++ /dev/null @@ -1,711 +0,0 @@ -/* - * Copyright (c) 2018, Davis Cook - * Copyright (c) 2018, Daddy Dozer - * 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.suppliestracker.ui; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.GridLayout; -import java.util.ArrayList; -import java.util.List; -import javax.inject.Singleton; -import javax.swing.JLabel; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import net.runelite.client.plugins.suppliestracker.ItemType; -import net.runelite.client.plugins.suppliestracker.SuppliesTrackerItem; -import net.runelite.client.plugins.suppliestracker.SuppliesTrackerPlugin; -import lombok.AccessLevel; -import lombok.Getter; -import static net.runelite.api.ItemID.*; -import net.runelite.api.util.Text; -import net.runelite.client.game.ItemManager; -import static net.runelite.client.plugins.suppliestracker.SuppliesTrackerPlugin.POTION_PATTERN; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.util.AsyncBufferedImage; -import net.runelite.client.util.QuantityFormatter; - -@Singleton -public abstract class SuppliesBox extends JPanel -{ - private static final int ITEMS_PER_ROW = 5; - - public final ItemManager itemManager; - protected final SuppliesTrackerPlugin plugin; - private final JPanel itemContainer = new JPanel(); - private final JLabel priceLabel = new JLabel(); - private final JLabel subTitleLabel = new JLabel(); - private final SuppliesTrackerPanel panel; - - private final String id; - @Getter(AccessLevel.PACKAGE) - private final ItemType type; - - private final List trackedItems = new ArrayList<>(); - private long totalPrice; - - protected SuppliesBox( - ItemManager itemManager, - String id, - SuppliesTrackerPlugin plugin, - SuppliesTrackerPanel panel, - ItemType type) - { - this.id = id; - this.itemManager = itemManager; - this.plugin = plugin; - this.panel = panel; - this.type = type; - - render(); - } - - public static SuppliesBox of( - ItemManager itemManager, - String id, - SuppliesTrackerPlugin plugin, - SuppliesTrackerPanel panel, - ItemType type) - { - switch (type) - { - case JEWELLERY: - return new JewellerySuppliesBox(itemManager, id, plugin, panel, type); - case CHARGES: - return new ChargesSuppliesBox(itemManager, id, plugin, panel, type); - case FOOD: - return new FoodSuppliesBox(itemManager, id, plugin, panel, type); - case POTION: - return new PotionSuppliesBox(itemManager, id, plugin, panel, type); - } - - return new DefaultSuppliesBox(itemManager, id, plugin, panel, type); - } - - abstract String buildTooltip(int itemId, int qty, SuppliesTrackerItem item); - - /** - * Builds the box onto the panel - */ - private void render() - { - setLayout(new BorderLayout(0, 1)); - setBorder(new EmptyBorder(5, 0, 0, 0)); - - final JPanel logTitle = new JPanel(new BorderLayout(5, 0)); - logTitle.setBorder(new EmptyBorder(7, 7, 7, 7)); - logTitle.setBackground(ColorScheme.DARKER_GRAY_COLOR.darker()); - - final JLabel titleLabel = new JLabel(Text.removeTags(id)); - titleLabel.setFont(FontManager.getRunescapeSmallFont()); - titleLabel.setForeground(Color.WHITE); - - logTitle.add(titleLabel, BorderLayout.WEST); - - subTitleLabel.setFont(FontManager.getRunescapeSmallFont()); - subTitleLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR); - logTitle.add(subTitleLabel, BorderLayout.CENTER); - - priceLabel.setFont(FontManager.getRunescapeSmallFont()); - priceLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR); - logTitle.add(priceLabel, BorderLayout.EAST); - - add(logTitle, BorderLayout.NORTH); - add(itemContainer, BorderLayout.CENTER); - - // Create popup menu - final JPopupMenu popupMenu = new JPopupMenu(); - popupMenu.setBorder(new EmptyBorder(5, 5, 5, 5)); - setComponentPopupMenu(popupMenu); - - // Create reset menu - final JMenuItem reset = new JMenuItem("Reset Category"); - reset.addActionListener(e -> - { - for (SuppliesTrackerItem item : trackedItems) - { - plugin.clearItem(item.getId()); - } - clearAll(); - rebuild(); - panel.updateOverall(); - }); - - popupMenu.add(reset); - - setVisible(false); - } - - /** - * Adds item to trackedItems - * - * @param item item to be checked - */ - public void update(SuppliesTrackerItem item) - { - trackedItems.removeIf(r -> r.getId() == item.getId()); - if (item.getName() == null || item.getId() == 0 || item.getName().toLowerCase().equals("null")) - { - return; - } - trackedItems.add(item); - setVisible(trackedItems.size() > 0); - } - - /** - * Removes item from trackedItems - * - * @param item item to be checked - */ - private void remove(SuppliesTrackerItem item) - { - trackedItems.removeIf(r -> r.getId() == item.getId()); - plugin.clearItem(item.getId()); - setVisible(trackedItems.size() > 0); - } - - /** - * Clears trackedItems - */ - public void clearAll() - { - trackedItems.clear(); - setVisible(false); - } - - /** - * Adds the total cost of all items to be returned - * - * @return the total cost of all tracked items - */ - public long getTotalSupplies() - { - long totalSupplies = 0; - for (SuppliesTrackerItem item : trackedItems) - { - totalSupplies += item.getQuantity(); - } - return totalSupplies; - } - - public long getTotalPrice() - { - return totalPrice; - } - - /** - * Runs buildItems method and recalculates supplies cost and quantity. - */ - public void rebuild() - { - buildItems(); - - priceLabel.setText(QuantityFormatter.quantityToStackSize(totalPrice) + " gp"); - priceLabel.setToolTipText(QuantityFormatter.formatNumber(totalPrice) + " gp"); - - final long supplies = getTotalSupplies(); - if (supplies > 0) - { - subTitleLabel.setText("x " + supplies); - } - else - { - subTitleLabel.setText(""); - } - - validate(); - repaint(); - } - - /** - * Changes itemId to single use variant - * - * @param name name to be checked - * @param itemId is either changed or returned to method - * @return returns updated itemId - */ - abstract int getModifiedItemId(String name, int itemId); - - /** - * Builds an arraylist of items based off trackedItems and populates - * boxes with item information - */ - void buildItems() - { - final List items = new ArrayList<>(trackedItems); - totalPrice = 0; - - for (SuppliesTrackerItem item : items) - { - totalPrice += item.getPrice(); - } - - items.sort((i1, i2) -> Long.compare(i2.getPrice(), i1.getPrice())); - - // calculates how many rows need to be displayed to fit all item - final int rowSize = ((items.size() % ITEMS_PER_ROW == 0) ? 0 : 1) + items.size() / ITEMS_PER_ROW; - - itemContainer.removeAll(); - itemContainer.setLayout(new GridLayout(rowSize, ITEMS_PER_ROW, 1, 1)); - - for (int i = 0; i < rowSize * ITEMS_PER_ROW; i++) - { - final JPanel slotContainer = new JPanel(); - slotContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - if (i < items.size()) - { - final SuppliesTrackerItem item = items.get(i); - final JLabel imageLabel = new JLabel(); - imageLabel.setToolTipText(buildTooltip(getModifiedItemId(item.getName(), item.getId()), item.getQuantity(), item)); - imageLabel.setVerticalAlignment(SwingConstants.CENTER); - imageLabel.setHorizontalAlignment(SwingConstants.CENTER); - - AsyncBufferedImage itemImage = itemManager.getImage(getModifiedItemId(item.getName(), item.getId()), item.getQuantity(), item.getQuantity() > 1); - itemImage.addTo(imageLabel); - slotContainer.add(imageLabel); - - if (item.getName() == null || item.getId() == 0 - || item.getName().toLowerCase().equals("null") - || getModifiedItemId(item.getName(), item.getId()) == 0 - || itemManager.getImage(getModifiedItemId(item.getName(), item.getId()), item.getQuantity(), item.getQuantity() > 1) == null) - { - continue; - } - - // create popup menu - final JPopupMenu popupMenu = new JPopupMenu(); - popupMenu.setBorder(new EmptyBorder(5, 5, 5, 5)); - slotContainer.setComponentPopupMenu(popupMenu); - - final JMenuItem reset = new JMenuItem("Reset"); - reset.addActionListener(e -> - { - remove(item); - rebuild(); - panel.updateOverall(); - }); - - popupMenu.add(reset); - } - itemContainer.add(slotContainer); - } - itemContainer.repaint(); - } - - private static class JewellerySuppliesBox extends SuppliesBox - { - protected JewellerySuppliesBox(ItemManager itemManager, String id, SuppliesTrackerPlugin plugin, SuppliesTrackerPanel panel, ItemType type) - { - super(itemManager, id, plugin, panel, type); - } - - @Override - final String buildTooltip(int itemId, int qty, SuppliesTrackerItem item) - { - final String name = item.getName(); - StringBuilder tooltip = new StringBuilder(); - - if (name.toLowerCase().contains("glory")) - { - long price = (((itemManager.getItemPrice(AMULET_OF_GLORY6) - (itemManager.getItemPrice(AMULET_OF_GLORY))) * qty) / 6); - tooltip.append("Amulet of Glory(6) x ") - .append(qty) - .append("/6 (") - .append(QuantityFormatter.quantityToStackSize(price)) - .append("gp)"); - } - else if (name.toLowerCase().contains("dueling")) - { - tooltip.append("Ring of Dueling(8) x ") - .append(qty) - .append("/8 (") - .append(QuantityFormatter.quantityToStackSize((itemManager.getItemPrice(RING_OF_DUELING8) * qty) / 8)) - .append("gp)"); - } - else if (name.toLowerCase().contains("wealth")) - { - long price = (((itemManager.getItemPrice(RING_OF_WEALTH_5) - (itemManager.getItemPrice(RING_OF_WEALTH))) * qty) / 5); - tooltip.append("Ring of Wealth(5) x ") - .append(qty) - .append("/5 (") - .append(QuantityFormatter.quantityToStackSize(price)) - .append("gp)"); - } - else if (name.toLowerCase().contains("combat")) - { - long price = (((itemManager.getItemPrice(COMBAT_BRACELET6) - (itemManager.getItemPrice(COMBAT_BRACELET))) * qty) / 6); - tooltip.append("Combat Bracelet(6) x ") - .append(qty) - .append("/6 (") - .append(QuantityFormatter.quantityToStackSize(price)) - .append("gp)"); - } - else if (name.toLowerCase().contains("games")) - { - tooltip.append("Games Necklace(8) x ") - .append(qty) - .append("/8 (") - .append(QuantityFormatter.quantityToStackSize((itemManager.getItemPrice(GAMES_NECKLACE8) * qty) / 8)) - .append("gp)"); - } - else if (name.toLowerCase().contains("skills")) - { - long price = (((itemManager.getItemPrice(SKILLS_NECKLACE6) - (itemManager.getItemPrice(SKILLS_NECKLACE))) * qty) / 6); - tooltip.append("Skills Necklace(6) x ") - .append(qty) - .append("/6 (") - .append(QuantityFormatter.quantityToStackSize(price)) - .append("gp)"); - } - else if (name.toLowerCase().contains("passage")) - { - tooltip.append("Necklace of Passage(5) x ") - .append(qty) - .append("/5 (") - .append(QuantityFormatter.quantityToStackSize((itemManager.getItemPrice(NECKLACE_OF_PASSAGE5) * qty) / 5)) - .append("gp)"); - } - else if (name.toLowerCase().contains("burning")) - { - tooltip.append("Burning Amulet(5) x ") - .append(qty) - .append("/5 (") - .append(QuantityFormatter.quantityToStackSize((itemManager.getItemPrice(BURNING_AMULET5) * qty) / 5)) - .append("gp)"); - } - return tooltip.toString(); - } - - @Override - int getModifiedItemId(String name, int itemId) - { - return itemId; - } - } - - private static class ChargesSuppliesBox extends SuppliesBox - { - protected ChargesSuppliesBox(ItemManager itemManager, String id, SuppliesTrackerPlugin plugin, SuppliesTrackerPanel panel, ItemType type) - { - super(itemManager, id, plugin, panel, type); - } - - @Override - final String buildTooltip(int itemId, int qty, SuppliesTrackerItem item) - { - StringBuilder tooltip = new StringBuilder(); - - switch (itemId) - { - case SCYTHE_OF_VITUR: - tooltip.append("") - .append("Blood Rune x ") - .append(qty * 3) - .append(" (") - .append(QuantityFormatter.quantityToStackSize( - itemManager.getItemPrice(BLOOD_RUNE) * qty * 3) - ) - .append("gp)") - .append("
") - .append("Vial of Blood x ") - .append(qty).append("/100 (") - .append(QuantityFormatter.quantityToStackSize( - (itemManager.getItemPrice(VIAL_OF_BLOOD_22446) * qty) / 100) - ) - .append("gp)") - .append("
") - .append(""); - return tooltip.toString(); - - case SANGUINESTI_STAFF: - tooltip.append("Blood Rune x ") - .append(qty * 3).append(" (") - .append(QuantityFormatter.quantityToStackSize( - itemManager.getItemPrice(BLOOD_RUNE) * qty * 3) - ) - .append("gp)"); - return tooltip.toString(); - - case BLADE_OF_SAELDOR: - tooltip.append("Crystal Shard x ") - .append(qty).append(" / 100"); - return tooltip.toString(); - - case TRIDENT_OF_THE_SEAS: - tooltip.append("") - .append("Chaos Rune x ") - .append(qty).append(" (") - .append(QuantityFormatter.quantityToStackSize( - itemManager.getItemPrice(CHAOS_RUNE) * qty) - ) - .append("gp)") - .append("
") - .append("Death Rune x ") - .append(qty) - .append(" (") - .append(QuantityFormatter.quantityToStackSize( - itemManager.getItemPrice(DEATH_RUNE) * qty) - ) - .append("gp)") - .append("
") - .append("
") - .append("Fire Rune x ") - .append(qty * 5) - .append(" (") - .append(QuantityFormatter.quantityToStackSize( - (itemManager.getItemPrice(FIRE_RUNE) * qty) * 5) - ) - .append("gp)") - .append("
") - .append("
") - .append("Coins x ") - .append(qty * 10) - .append(" (") - .append(QuantityFormatter.quantityToStackSize( - (itemManager.getItemPrice(COINS_995) * qty) * 10) - ) - .append("gp)") - .append("
") - .append(""); - return tooltip.toString(); - - case TRIDENT_OF_THE_SWAMP: - tooltip.append("") - .append("Chaos Rune x ") - .append(qty) - .append(" (") - .append(QuantityFormatter.quantityToStackSize( - itemManager.getItemPrice(CHAOS_RUNE) * qty) - ) - .append("gp)") - .append("
") - .append("Death Rune x ") - .append(qty) - .append(" (") - .append(QuantityFormatter.quantityToStackSize( - (itemManager.getItemPrice(DEATH_RUNE) * qty)) - ) - .append("gp)") - .append("
") - .append("
") - .append("Fire Rune x ") - .append(qty * 5) - .append(" (") - .append(QuantityFormatter.quantityToStackSize( - (itemManager.getItemPrice(FIRE_RUNE) * qty) * 5) - ) - .append("gp)") - .append("
") - .append("
") - .append("Zulrah's Scales x ") - .append(qty) - .append(" (") - .append(QuantityFormatter.quantityToStackSize( - (itemManager.getItemPrice(ZULRAHS_SCALES) * qty)) - ) - .append("gp)") - .append("
") - .append(""); - return tooltip.toString(); - } - - return tooltip.toString(); - } - - @Override - int getModifiedItemId(String name, int itemId) - { - return itemId; - } - } - - private static class FoodSuppliesBox extends SuppliesBox - { - protected FoodSuppliesBox(ItemManager itemManager, String id, SuppliesTrackerPlugin plugin, SuppliesTrackerPanel panel, ItemType type) - { - super(itemManager, id, plugin, panel, type); - } - - //Switches full cake ids to get the image for slice - private static int getSlice(int itemId) - { - switch (itemId) - { - case CAKE: - itemId = SLICE_OF_CAKE; - break; - case CHOCOLATE_CAKE: - itemId = CHOCOLATE_SLICE; - break; - } - return itemId; - } - - //Switches full pizza and pie ids to get the image for half - private static int getHalf(int itemId) - { - switch (itemId) - { - case ANCHOVY_PIZZA: - itemId = _12_ANCHOVY_PIZZA; - break; - case MEAT_PIZZA: - itemId = _12_MEAT_PIZZA; - break; - case PINEAPPLE_PIZZA: - itemId = _12_PINEAPPLE_PIZZA; - break; - case PLAIN_PIZZA: - itemId = _12_PLAIN_PIZZA; - break; - case REDBERRY_PIE: - itemId = HALF_A_REDBERRY_PIE; - break; - case GARDEN_PIE: - itemId = HALF_A_GARDEN_PIE; - break; - case SUMMER_PIE: - itemId = HALF_A_SUMMER_PIE; - break; - case FISH_PIE: - itemId = HALF_A_FISH_PIE; - break; - case BOTANICAL_PIE: - itemId = HALF_A_BOTANICAL_PIE; - break; - case MUSHROOM_PIE: - itemId = HALF_A_MUSHROOM_PIE; - break; - case ADMIRAL_PIE: - itemId = HALF_AN_ADMIRAL_PIE; - break; - case WILD_PIE: - itemId = HALF_A_WILD_PIE; - break; - case APPLE_PIE: - itemId = HALF_AN_APPLE_PIE; - break; - case MEAT_PIE: - itemId = HALF_A_MEAT_PIE; - break; - - } - return itemId; - } - - @Override - final String buildTooltip(int itemId, int qty, SuppliesTrackerItem item) - { - final long price = itemManager.getItemPrice(itemId); - return item.getName() + " x " + qty + " (" + QuantityFormatter.quantityToStackSize(price * qty) + ") "; - } - - @Override - int getModifiedItemId(String name, int itemId) - { - if (SuppliesTrackerPlugin.isCake(name, itemId)) - { - return getSlice(itemId); - } - if (SuppliesTrackerPlugin.isPizzaPie(name)) - { - return getHalf(itemId); - } - - return itemId; - } - } - - private static class PotionSuppliesBox extends SuppliesBox - { - protected PotionSuppliesBox(ItemManager itemManager, String id, SuppliesTrackerPlugin plugin, SuppliesTrackerPanel panel, ItemType type) - { - super(itemManager, id, plugin, panel, type); - } - - @Override - final String buildTooltip(int itemId, int qty, SuppliesTrackerItem item) - { - final long price = itemManager.getItemPrice(plugin.getPotionID(item.getName().replaceAll(POTION_PATTERN, "(4)"))) / 4; - return item.getName() + " x " + qty + " (" + QuantityFormatter.quantityToStackSize(price * qty) + ") "; - } - - @Override - int getModifiedItemId(String name, int itemId) - { - if (SuppliesTrackerPlugin.isPotion(name)) - { - return getSingleDose(name); - } - - return itemId; - } - - /** - * Turns a potion itemid into the single dose id - * - * @param name potion name to be checked - * @return itemid of single dose potion - */ - private int getSingleDose(String name) - { - String nameModified = name.replace("(4)", "(1)"); - int itemId = 0; - - if (itemManager.search(nameModified).size() > 0) - { - itemId = itemManager.search(nameModified).get(0).getId(); - } - - return itemId; - } - } - - private static class DefaultSuppliesBox extends SuppliesBox - { - protected DefaultSuppliesBox(ItemManager itemManager, String id, SuppliesTrackerPlugin plugin, SuppliesTrackerPanel panel, ItemType type) - { - super(itemManager, id, plugin, panel, type); - } - - @Override - final String buildTooltip(int itemId, int qty, SuppliesTrackerItem item) - { - final long price = itemManager.getItemPrice(itemId); - return item.getName() + " x " + qty + " (" + QuantityFormatter.quantityToStackSize(price * qty) + ") "; - } - - @Override - int getModifiedItemId(String name, int itemId) - { - return itemId; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/ui/SuppliesTrackerPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/ui/SuppliesTrackerPanel.java deleted file mode 100644 index de53ca0862..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/ui/SuppliesTrackerPanel.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright (c) 2018, Psikoi - * Copyright (c) 2018, Tomas Slusny - * Copyright (c) 2018, Daddy Dozer - * 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.suppliestracker.ui; - -import java.awt.BorderLayout; -import java.awt.GridLayout; -import java.awt.image.BufferedImage; -import java.util.ArrayList; -import java.util.List; -import javax.inject.Singleton; -import javax.swing.BoxLayout; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.border.EmptyBorder; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.suppliestracker.ItemType; -import net.runelite.client.plugins.suppliestracker.SuppliesTrackerItem; -import net.runelite.client.plugins.suppliestracker.SuppliesTrackerPlugin; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.ui.components.PluginErrorPanel; -import net.runelite.client.util.ColorUtil; -import net.runelite.client.util.QuantityFormatter; - -@Singleton -public class SuppliesTrackerPanel extends PluginPanel -{ - private static final String HTML_LABEL_TEMPLATE = - "%s%s"; - - // Handle supplies logs - @Getter(AccessLevel.PACKAGE) - private final JPanel logsContainer = new JPanel(); - // Handle overall session data - private final JPanel overallPanel = new JPanel(); - //Boxes for holding supplies - private final List boxList = new ArrayList<>(); - private final PluginErrorPanel errorPanel = new PluginErrorPanel(); - private final JLabel overallSuppliesUsedLabel = new JLabel(); - private final JLabel overallCostLabel = new JLabel(); - private final JLabel overallIcon = new JLabel(); - private UpdatePanel updatePanel; - @Getter(AccessLevel.PACKAGE) - private JButton info; - private int overallSuppliesUsed; - private int overallCost; - - public SuppliesTrackerPanel(final ItemManager itemManager, SuppliesTrackerPlugin plugin) - { - setBorder(new EmptyBorder(6, 6, 6, 6)); - setBackground(ColorScheme.DARK_GRAY_COLOR); - setLayout(new BorderLayout()); - updatePanel = new UpdatePanel(this); - - // Create layout panel for wrapping - final JPanel layoutPanel = new JPanel(); - layoutPanel.setLayout(new BoxLayout(layoutPanel, BoxLayout.Y_AXIS)); - add(layoutPanel, BorderLayout.NORTH); - - // Create panel that will contain overall data - overallPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); - overallPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - overallPanel.setLayout(new BorderLayout()); - overallPanel.setVisible(true); - - // Add icon and contents - final JPanel overallInfo = new JPanel(); - overallInfo.setBackground(ColorScheme.DARKER_GRAY_COLOR); - overallInfo.setLayout(new GridLayout(2, 1)); - overallInfo.setBorder(new EmptyBorder(0, 10, 0, 0)); - overallSuppliesUsedLabel.setFont(FontManager.getRunescapeSmallFont()); - overallCostLabel.setFont(FontManager.getRunescapeSmallFont()); - overallInfo.add(overallSuppliesUsedLabel); - overallInfo.add(overallCostLabel); - overallPanel.add(overallIcon, BorderLayout.WEST); - overallPanel.add(overallInfo, BorderLayout.CENTER); - - //Sorts boxes into usage types - for (ItemType type : ItemType.values()) - { - SuppliesBox newBox = SuppliesBox.of(itemManager, type.getLabel(), plugin, this, type); - logsContainer.add(newBox); - boxList.add(newBox); - } - - // Create reset all menu - final JMenuItem reset = new JMenuItem("Reset All"); - reset.addActionListener(e -> - { - overallSuppliesUsed = 0; - overallCost = 0; - plugin.clearSupplies(); - for (SuppliesBox box : boxList) - { - box.clearAll(); - } - updateOverall(); - logsContainer.repaint(); - }); - - // Create popup menu - final JPopupMenu popupMenu = new JPopupMenu(); - popupMenu.setBorder(new EmptyBorder(5, 5, 5, 5)); - popupMenu.add(reset); - overallPanel.setComponentPopupMenu(popupMenu); - - // Create Supply Rows wrapper - logsContainer.setLayout(new BoxLayout(logsContainer, BoxLayout.Y_AXIS)); - layoutPanel.add(overallPanel); - layoutPanel.add(logsContainer); - - errorPanel.setContent("Supply trackers", "You have not used any supplies yet."); - add(updatePanel); - updatePanel.setVisible(true); - overallPanel.setVisible(false); - logsContainer.setVisible(false); - info = new JButton("Info"); - info.addActionListener(e -> - { - overallPanel.setVisible(false); - logsContainer.setVisible(false); - - remove(updatePanel); - updatePanel = new UpdatePanel(this); - add(updatePanel); - - updatePanel.setVisible(true); - info.setVisible(false); - }); - layoutPanel.add(info); - info.setVisible(false); - } - - /** - * convert key value pair to html formatting needed to display nicely - * - * @param key key - * @param value value - * @return key: value in html - */ - private static String htmlLabel(String key, long value) - { - final String valueStr = QuantityFormatter.quantityToStackSize(value); - return String.format(HTML_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR), key, valueStr); - } - - /** - * loads an img to the icon on the header - * - * @param img the img for the header icon - */ - public void loadHeaderIcon(BufferedImage img) - { - overallIcon.setIcon(new ImageIcon(img)); - } - - /** - * Add an item to the supply panel by placing it into the correct box - * - * @param item the item to add - */ - public void addItem(SuppliesTrackerItem item) - { - ItemType category = ItemType.categorize(item); - for (SuppliesBox box : boxList) - { - if (box.getType() == category) - { - box.update(item); - box.rebuild(); - break; - } - } - updateOverall(); - } - - /** - * Updates overall stats to calculate overall used and overall cost from - * the info in each box - */ - public void updateOverall() - { - overallSuppliesUsed = 0; - for (SuppliesBox box : boxList) - { - overallSuppliesUsed += box.getTotalSupplies(); - } - - overallCost = 0; - - //Checks all supply boxes for total price - for (SuppliesBox box : boxList) - { - overallCost += box.getTotalPrice(); - } - - overallSuppliesUsedLabel.setText(htmlLabel("Total Supplies: ", overallSuppliesUsed)); - overallCostLabel.setText(htmlLabel("Total Cost: ", overallCost)); - - if (overallSuppliesUsed <= 0) - { - add(errorPanel); - overallPanel.setVisible(false); - } - else - { - remove(errorPanel); - if (!updatePanel.isVisible()) - { - overallPanel.setVisible(true); - } - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/ui/UpdatePanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/ui/UpdatePanel.java deleted file mode 100644 index 895ff54d2e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/suppliestracker/ui/UpdatePanel.java +++ /dev/null @@ -1,54 +0,0 @@ -package net.runelite.client.plugins.suppliestracker.ui; - - -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.PluginPanel; -import javax.inject.Singleton; -import javax.swing.BoxLayout; -import javax.swing.JButton; -import javax.swing.JEditorPane; -import javax.swing.border.EmptyBorder; -import java.io.IOException; - -@Singleton -class UpdatePanel extends PluginPanel -{ - - private SuppliesTrackerPanel panel; - - UpdatePanel(SuppliesTrackerPanel suppliesTrackerPanel) - { - this.panel = suppliesTrackerPanel; - setBorder(new EmptyBorder(6, 6, 6, 6)); - setBackground(ColorScheme.DARK_GRAY_COLOR); - setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); - JEditorPane editorPane = new JEditorPane(); - editorPane.setEditable(false); - java.net.URL helpURL = UpdatePanel.class.getResource( - "Info.html"); - - if (helpURL != null) - { - try - { - editorPane.setPage(helpURL); - } - catch (IOException e) - { - throw new IllegalStateException("File not found"); - } - } - - JButton close = new JButton("Close info"); - close.addActionListener(e -> - { - this.setVisible(false); - panel.updateOverall(); - panel.getInfo().setVisible(true); - panel.getLogsContainer().setVisible(true); - }); - this.add(close); - this.add(editorPane); - - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tarnslair/Obstacles.java b/runelite-client/src/main/java/net/runelite/client/plugins/tarnslair/Obstacles.java deleted file mode 100644 index 79bbec3122..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tarnslair/Obstacles.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2018, Shaun Dreclin - * 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.tarnslair; - -import com.google.common.collect.Sets; -import java.util.Set; -import static net.runelite.api.NullObjectID.NULL_20575; -import static net.runelite.api.ObjectID.*; - -class Obstacles -{ - static final Set STAIRCASE_IDS = Sets.newHashSet( - PASSAGEWAY_15770, /*Wall staircase*/ - PASSAGEWAY_15771, /*Wall staircase*/ - PASSAGEWAY_15772, /*Wall staircase*/ - PASSAGEWAY_15773, /*Wall staircase*/ - PASSAGEWAY_15774, /*Wall staircase*/ - PASSAGEWAY_16129, /*Wall staircase*/ - PASSAGEWAY_16130, /*Wall staircase*/ - PASSAGEWAY_16131, /*Wall staircase*/ - PASSAGEWAY_16132, /*Wall staircase*/ - PASSAGEWAY_16133, /*Wall staircase*/ - PASSAGEWAY_16134, /*Wall staircase*/ - PASSAGEWAY_18307, /*Wall staircase*/ - PASSAGEWAY_18308, /*Wall staircase*/ - PASSAGEWAY_18309, /*Wall staircase*/ - PASSAGEWAY_18310, /*Wall staircase*/ - PASSAGEWAY_18311, /*Wall staircase*/ - PASSAGEWAY_20488, /*Wall staircase*/ - PASSAGEWAY_20489, /*Wall staircase*/ - PASSAGEWAY_20490, /*Wall staircase*/ - PASSAGEWAY_20491, /*Wall staircase*/ - PASSAGEWAY_20492, /*Wall staircase*/ - PASSAGEWAY_20493, /*Wall staircase*/ - PASSAGEWAY_20495, /*Wall staircase*/ - PASSAGEWAY_20497, /*Wall staircase*/ - PASSAGEWAY_20498, /*Wall staircase*/ - PASSAGEWAY_20499, /*Wall staircase*/ - PASSAGEWAY_20500, /*Wall staircase*/ - PASSAGEWAY_20501, /*Wall staircase*/ - PASSAGEWAY_20502, /*Wall staircase*/ - PASSAGEWAY_20503, /*Wall staircase*/ - PASSAGEWAY_20504, /*Wall staircase*/ - PASSAGEWAY_20505, /*Wall staircase*/ - PASSAGEWAY_20506, /*Wall staircase*/ - PASSAGEWAY_20506, /*Wall staircase*/ - PASSAGEWAY_20507, /*Wall staircase*/ - PASSAGEWAY_20509, /*Wall staircase*/ - PASSAGEWAY_20510, /*Wall staircase*/ - PASSAGEWAY_20511, /*Wall staircase*/ - PASSAGEWAY_20512, /*Wall staircase*/ - PASSAGEWAY_20513, /*Wall staircase*/ - PASSAGEWAY_20514, /*Wall staircase*/ - PASSAGEWAY_20515, /*Wall staircase*/ - PASSAGEWAY_20516, /*Wall staircase*/ - PASSAGEWAY_20517, /*Wall staircase*/ - PASSAGEWAY_20518, /*Wall staircase*/ - PASSAGEWAY_20519, /*Wall staircase*/ - PASSAGEWAY_20520, /*Wall staircase*/ - PASSAGEWAY_20521, /*Wall staircase*/ - PASSAGEWAY_20522, /*Wall staircase*/ - PASSAGEWAY_20523, /*Wall staircase*/ - PASSAGEWAY_20524, /*Wall staircase*/ - PASSAGEWAY_20525, /*Wall staircase*/ - PASSAGEWAY_20526, /*Wall staircase*/ - PASSAGEWAY_20527, /*Wall staircase*/ - PASSAGEWAY_20528, /*Wall staircase*/ - PASSAGEWAY_20529, /*Wall staircase*/ - PASSAGEWAY_20530, /*Wall staircase*/ - PASSAGEWAY_20531, /*Wall staircase*/ - PASSAGEWAY_20532, /*Wall staircase*/ - PASSAGEWAY_20533, /*Wall staircase*/ - PASSAGEWAY_20534, /*Wall staircase*/ - PASSAGEWAY_20535, /*Wall staircase*/ - PASSAGEWAY_20536, /*Wall staircase*/ - PASSAGEWAY_20537, /*Wall staircase*/ - PASSAGEWAY_20538, /*Wall staircase*/ - PASSAGEWAY_20539, /*Wall staircase*/ - STAIRS_17098, /*Floor staircase*/ - STAIRS_17099, /*Floor staircase*/ - STAIRS_18973, /*Floor staircase*/ - STAIRS_18974 /*Floor staircase*/ - ); - - static final Set WALL_TRAP_IDS = Sets.newHashSet( - WALL_20590, /*Wall spikes*/ - WALL_20592, /*Wall spikes*/ - WALL_20594, /*Wall spikes*/ - WALL_20596, /*Wall spikes*/ - WALL_20588, /*Wall spikes*/ - WALL_20613, /*Wall pusher*/ - WALL_20615, /*Wall pusher*/ - WALL_20616, /*Wall pusher*/ - WALL_20618, /*Wall pusher*/ - HANGING_LOG_20571, /*Hanging log*/ - HANGING_LOG_20572, /*Hanging log*/ - HANGING_LOG_20573, /*Hanging log*/ - HANGING_LOG_20574 /*Hanging log*/ - ); - - static final Set FLOOR_TRAP_IDS = Sets.newHashSet( - FLOOR_20583, /*Floor spikes*/ - FLOOR_20584, /*Floor spikes*/ - NULL_20575, /*Floor spikes (visible)*/ - FLOOR_20628, /*Trapdoor*/ - FLOOR_20634, /*Floor button*/ - FLOOR_20636 /*Floor button*/ - ); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tarnslair/TarnsLairOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/tarnslair/TarnsLairOverlay.java deleted file mode 100644 index 8201c4270d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tarnslair/TarnsLairOverlay.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2018, Shaun Dreclin - * 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.tarnslair; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.Shape; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -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; - -@Singleton -@Slf4j -public class TarnsLairOverlay extends Overlay -{ - private static final int MAX_DISTANCE = 2350; - - private final Client client; - private final TarnsLairPlugin plugin; - - @Inject - public TarnsLairOverlay(final Client client, final TarnsLairPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isInLair()) - { - return null; - } - - LocalPoint playerLocation = client.getLocalPlayer().getLocalLocation(); - - plugin.getStaircases().forEach((obstacle, tile) -> - { - if (tile.getPlane() == client.getPlane() && obstacle.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE) - { - Shape p = tile.getGameObjects()[0].getConvexHull(); - if (p != null) - { - graphics.setColor(Color.GREEN); - graphics.draw(p); - } - } - }); - - plugin.getWallTraps().forEach((obstacle, tile) -> - { - if (tile.getPlane() == client.getPlane() && obstacle.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE) - { - Shape p = tile.getGameObjects()[0].getConvexHull(); - if (p != null) - { - graphics.setColor(Color.CYAN); - graphics.draw(p); - } - } - }); - - plugin.getFloorTraps().forEach((obstacle, tile) -> - { - if (tile.getPlane() == client.getPlane() && obstacle.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE) - { - Polygon p = obstacle.getCanvasTilePoly(); - if (p != null) - { - graphics.setColor(Color.CYAN); - graphics.drawPolygon(p); - } - } - }); - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tarnslair/TarnsLairPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/tarnslair/TarnsLairPlugin.java deleted file mode 100644 index d67737167e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tarnslair/TarnsLairPlugin.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2018-2019, Shaun Dreclin - * 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.tarnslair; - -import java.util.HashMap; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.Tile; -import net.runelite.api.TileObject; -import net.runelite.api.events.GameObjectChanged; -import net.runelite.api.events.GameObjectDespawned; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.GroundObjectChanged; -import net.runelite.api.events.GroundObjectDespawned; -import net.runelite.api.events.GroundObjectSpawned; -import net.runelite.client.eventbus.Subscribe; -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; - -@PluginDescriptor( - name = "Tarn's Lair", - description = "Mark tiles and clickboxes to help traverse the maze", - tags = {"agility", "maze", "minigame", "overlay"}, - type = PluginType.MINIGAME, - enabledByDefault = false -) -@Singleton -@Slf4j -public class TarnsLairPlugin extends Plugin -{ - private static final int TARNS_LAIR_NORTH_REGION = 12616; - private static final int TARNS_LAIR_SOUTH_REGION = 12615; - - @Getter(AccessLevel.PACKAGE) - private final Map staircases = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private final Map wallTraps = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private final Map floorTraps = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private boolean inLair; - - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private TarnsLairOverlay overlay; - - @Override - protected void startUp() - { - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - staircases.clear(); - wallTraps.clear(); - floorTraps.clear(); - inLair = false; - } - - @Subscribe - private void onGameTick(GameTick event) - { - int regionID = client.getLocalPlayer().getWorldLocation().getRegionID(); - inLair = (regionID == TARNS_LAIR_NORTH_REGION || regionID == TARNS_LAIR_SOUTH_REGION); - } - - @Subscribe - private void onGameObjectSpawned(GameObjectSpawned event) - { - onTileObject(event.getTile(), null, event.getGameObject()); - } - - @Subscribe - private void onGameObjectChanged(GameObjectChanged event) - { - onTileObject(event.getTile(), event.getPrevious(), event.getGameObject()); - } - - @Subscribe - private void onGameObjectDespawned(GameObjectDespawned event) - { - onTileObject(event.getTile(), event.getGameObject(), null); - } - - @Subscribe - private void onGroundObjectSpawned(GroundObjectSpawned event) - { - onTileObject(event.getTile(), null, event.getGroundObject()); - } - - @Subscribe - private void onGroundObjectChanged(GroundObjectChanged event) - { - onTileObject(event.getTile(), event.getPrevious(), event.getGroundObject()); - } - - @Subscribe - private void onGroundObjectDespawned(GroundObjectDespawned event) - { - onTileObject(event.getTile(), event.getGroundObject(), null); - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOADING) - { - staircases.clear(); - wallTraps.clear(); - floorTraps.clear(); - } - } - - private void onTileObject(Tile tile, TileObject oldObject, TileObject newObject) - { - staircases.remove(oldObject); - if (newObject != null && Obstacles.STAIRCASE_IDS.contains(newObject.getId())) - { - staircases.put(newObject, tile); - } - - wallTraps.remove(oldObject); - if (newObject != null && Obstacles.WALL_TRAP_IDS.contains(newObject.getId())) - { - wallTraps.put(newObject, tile); - } - - floorTraps.remove(oldObject); - if (newObject != null && Obstacles.FLOOR_TRAP_IDS.contains(newObject.getId())) - { - floorTraps.put(newObject, tile); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/teamcapes/TeamCapesConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/teamcapes/TeamCapesConfig.java deleted file mode 100644 index 17e42e0f24..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/teamcapes/TeamCapesConfig.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2018, Mathieu Bernier - * 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.teamcapes; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("teamCapes") -public interface TeamCapesConfig extends Config -{ - @ConfigItem( - keyName = "minimumCapeCount", - name = "Minimum Cape Count", - description = "Configures the minimum number of team capes which must be present before being displayed.", - position = 0 - ) - default int getMinimumCapeCount() - { - return 1; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/teamcapes/TeamCapesOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/teamcapes/TeamCapesOverlay.java deleted file mode 100644 index ef5cd3ca7e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/teamcapes/TeamCapesOverlay.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2017, Devin French - * 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.teamcapes; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.ItemID; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.client.game.ItemManager; -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; -import net.runelite.client.ui.overlay.components.ComponentOrientation; -import net.runelite.client.ui.overlay.components.ImageComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; - -@Singleton -public class TeamCapesOverlay extends Overlay -{ - private final PanelComponent panelComponent = new PanelComponent(); - private final TeamCapesPlugin plugin; - private final TeamCapesConfig config; - private final ItemManager manager; - - @Inject - private TeamCapesOverlay(final TeamCapesPlugin plugin, final TeamCapesConfig config, final ItemManager manager) - { - super(plugin); - setPosition(OverlayPosition.TOP_LEFT); - setPriority(OverlayPriority.LOW); - this.plugin = plugin; - this.config = config; - this.manager = manager; - panelComponent.setOrientation(ComponentOrientation.HORIZONTAL); - panelComponent.setWrapping(4); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Teamcapes overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - Map teams = plugin.getTeams(); - if (teams.isEmpty()) - { - return null; - } - - panelComponent.getChildren().clear(); - - for (Map.Entry team : teams.entrySet()) - { - // Only display team capes that have a count greater than the configured minimum - if (team.getValue() < config.getMinimumCapeCount()) - { - continue; - } - - // Make the number 0 based - final int teamcapeNumber = team.getKey() - 1; - final int itemID; - if (teamcapeNumber < 50) - { - // The team cape is every 2nd item id based on tc number - itemID = 2 * teamcapeNumber + ItemID.TEAM1_CAPE; - } - else - { - // The team cape is every 3rd item id based on tc number starting from 0 - itemID = 3 * (teamcapeNumber - 50) + ItemID.TEAM_CAPE_ZERO; - } - - panelComponent.getChildren().add(new ImageComponent(manager.getImage(itemID, team.getValue(), true))); - } - - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/teamcapes/TeamCapesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/teamcapes/TeamCapesPlugin.java deleted file mode 100644 index 9d35a5b106..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/teamcapes/TeamCapesPlugin.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2017, Devin French - * 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.teamcapes; - -import com.google.inject.Provides; -import java.time.temporal.ChronoUnit; -import java.util.Comparator; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.Player; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.task.Schedule; -import net.runelite.client.ui.overlay.OverlayManager; - -@PluginDescriptor( - name = "Team Capes", - description = "Show the different team capes in your area and the amount of each", - tags = {"overlay", "players"}, - enabledByDefault = false, - type = PluginType.MISCELLANEOUS -) -@Singleton -public class TeamCapesPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private TeamCapesOverlay overlay; - - // Hashmap of team capes: Key is the teamCape #, Value is the count of teamcapes in the area. - private Map teams = new HashMap<>(); - - @Provides - TeamCapesConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(TeamCapesConfig.class); - } - - @Override - protected void startUp() - { - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - teams.clear(); - } - - @Schedule( - period = 1800, - unit = ChronoUnit.MILLIS - ) - public void update() - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - List players = client.getPlayers(); - teams.clear(); - for (Player player : players) - { - int team = player.getTeam(); - if (team > 0) - { - if (teams.containsKey(team)) - { - teams.put(team, teams.get(team) + 1); - } - else - { - teams.put(team, 1); - } - } - } - - // Sort teams by value in descending order and then by key in ascending order, limited to 5 entries - teams = teams.entrySet().stream() - .sorted( - Comparator.comparing(Map.Entry::getValue, Comparator.reverseOrder()) - .thenComparingInt(Map.Entry::getKey) - ) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new)); - } - - public Map getTeams() - { - return teams; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixExperienceOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixExperienceOverlay.java deleted file mode 100644 index 36dee60e62..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixExperienceOverlay.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2018, Aquivers - * 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.tearsofguthix; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.table.TableAlignment; -import net.runelite.client.ui.overlay.components.table.TableComponent; - -@Singleton -class TearsOfGuthixExperienceOverlay extends Overlay -{ - private final TearsOfGuthixPlugin plugin; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - private Client client; - - @Inject - private TearsOfGuthixExperienceOverlay(final TearsOfGuthixPlugin plugin) - { - setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT); - setPriority(OverlayPriority.LOW); - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.getPlayerLowestSkill() == null) - { - return null; - } - - panelComponent.getChildren().clear(); - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - tableComponent.addRow(plugin.getPlayerLowestSkill().getName(), "Lvl - " + client.getRealSkillLevel(plugin.getPlayerLowestSkill()) + ""); - - if (!tableComponent.isEmpty()) - { - 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/tearsofguthix/TearsOfGuthixOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixOverlay.java deleted file mode 100644 index be546772ab..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixOverlay.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2018, Infinitay - * 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.tearsofguthix; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.time.Duration; -import java.time.Instant; -import javax.inject.Inject; -import javax.inject.Singleton; -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.components.ProgressPieComponent; - -@Singleton -class TearsOfGuthixOverlay extends Overlay -{ - private static final Color CYAN_ALPHA = new Color(Color.CYAN.getRed(), Color.CYAN.getGreen(), Color.CYAN.getBlue(), 100); - private static final Duration MAX_TIME = Duration.ofSeconds(9); - private final TearsOfGuthixPlugin plugin; - - @Inject - private TearsOfGuthixOverlay(final TearsOfGuthixPlugin plugin) - { - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D graphics) - { - plugin.getStreams().forEach((object, timer) -> - { - final Point position = object.getCanvasLocation(100); - - if (position == null) - { - return; - } - - final ProgressPieComponent progressPie = new ProgressPieComponent(); - progressPie.setDiameter(15); - progressPie.setFill(CYAN_ALPHA); - progressPie.setBorderColor(Color.CYAN); - progressPie.setPosition(position); - - final Duration duration = Duration.between(timer, Instant.now()); - progressPie.setProgress(1 - (duration.compareTo(MAX_TIME) < 0 - ? (double) duration.toMillis() / MAX_TIME.toMillis() - : 1)); - - progressPie.render(graphics); - }); - - return null; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixPlugin.java deleted file mode 100644 index 407845dfcc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixPlugin.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2018, Infinitay - * 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.tearsofguthix; - -import java.time.Instant; -import java.util.HashMap; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.DecorativeObject; -import net.runelite.api.GameState; -import net.runelite.api.ObjectID; -import net.runelite.api.Skill; -import net.runelite.api.events.DecorativeObjectDespawned; -import net.runelite.api.events.DecorativeObjectSpawned; -import net.runelite.api.events.GameStateChanged; -import net.runelite.client.eventbus.Subscribe; -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; - -@PluginDescriptor( - name = "Tears Of Guthix", - description = "Show timers for the Tears Of Guthix streams", - tags = {"minigame", "overlay", "skilling", "timers", "tog"}, - type = PluginType.MINIGAME -) -@Singleton -public class TearsOfGuthixPlugin extends Plugin -{ - private static final int TOG_REGION = 12948; - - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private TearsOfGuthixOverlay overlay; - - @Inject - private TearsOfGuthixExperienceOverlay experienceOverlay; - - @Getter(AccessLevel.PACKAGE) - private final Map streams = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - private Skill playerLowestSkill = null; - - @Override - protected void startUp() - { - - overlayManager.add(overlay); - overlayManager.add(experienceOverlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - overlayManager.remove(experienceOverlay); - streams.clear(); - playerLowestSkill = null; - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - switch (event.getGameState()) - { - case LOADING: - case LOGIN_SCREEN: - case HOPPING: - streams.clear(); - } - - if (event.getGameState() == GameState.LOGGED_IN && client.getLocalPlayer() != null) - { - if (client.getLocalPlayer().getWorldLocation().getRegionID() == TOG_REGION) - { - if (playerLowestSkill != null) - { - return; - } - - if (client.getSkillExperience(Skill.HITPOINTS) > 0) - { - playerLowestSkill = getLowestPlayerSkill(); - } - } - else - { - playerLowestSkill = null; - } - } - } - - @Subscribe - private void onDecorativeObjectSpawned(DecorativeObjectSpawned event) - { - DecorativeObject object = event.getDecorativeObject(); - - if ((object.getId() == ObjectID.BLUE_TEARS || - object.getId() == ObjectID.BLUE_TEARS_6665) && - client.getLocalPlayer().getWorldLocation().getRegionID() == TOG_REGION) - { - streams.put(event.getDecorativeObject(), Instant.now()); - } - } - - @Subscribe - private void onDecorativeObjectDespawned(DecorativeObjectDespawned event) - { - if (streams.isEmpty()) - { - return; - } - - DecorativeObject object = event.getDecorativeObject(); - streams.remove(object); - } - - private Skill getLowestPlayerSkill() - { - final Skill[] playerSkills = Skill.values(); - Skill lowestExperienceSkill = null; - int lowestExperienceAmount = Integer.MAX_VALUE; - - for (Skill skill : playerSkills) - { - int currentSkillExp = client.getSkillExperience(skill); - - if (currentSkillExp < lowestExperienceAmount) - { - lowestExperienceAmount = currentSkillExp; - lowestExperienceSkill = skill; - } - } - - return lowestExperienceSkill; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/templetrekking/TempleTrekkingBogOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/templetrekking/TempleTrekkingBogOverlay.java deleted file mode 100644 index 37d947df77..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/templetrekking/TempleTrekkingBogOverlay.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2018, Frosty Fridge - * 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.templetrekking; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import javax.inject.Inject; -import net.runelite.api.GroundObject; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; -import net.runelite.client.ui.overlay.OverlayUtil; - -public class TempleTrekkingBogOverlay extends Overlay -{ - private static final Color GREEN = new Color(0, 200, 83); - private final TempleTrekkingConfig config; - private final TempleTrekkingPlugin plugin; - - @Inject - private TempleTrekkingBogOverlay(TempleTrekkingConfig config, TempleTrekkingPlugin plugin) - { - super(plugin); - this.config = config; - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.LOW); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (config.bogMapActive()) - { - for (GroundObject bog : plugin.getBogList()) - { - Polygon bogPoly = bog.getCanvasTilePoly(); - OverlayUtil.renderPolygon(graphics, bogPoly, GREEN); - } - } - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/templetrekking/TempleTrekkingConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/templetrekking/TempleTrekkingConfig.java deleted file mode 100644 index d0acd72aa5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/templetrekking/TempleTrekkingConfig.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2018, Frosty Fridge - * 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.templetrekking; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("templetrekking") -public interface TempleTrekkingConfig extends Config -{ - @ConfigItem( - keyName = "bogMapActive", - name = "Bog Map", - description = "Marks out a safe route through the bog event", - position = 0 - ) - default boolean bogMapActive() - { - return true; - } - - @ConfigItem( - keyName = "pointTrackerActive", - name = "Point Tracker", - description = "Track your Temple Trek reward points, which determine the size of your reward.", - position = 1 - ) - default boolean pointTrackerActive() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/templetrekking/TempleTrekkingOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/templetrekking/TempleTrekkingOverlay.java deleted file mode 100644 index bef52d84e1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/templetrekking/TempleTrekkingOverlay.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2018, Frosty Fridge - * 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.templetrekking; - -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.OverlayPriority; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; - -public class TempleTrekkingOverlay extends Overlay -{ - private final TempleTrekkingConfig config; - private final TempleTrekkingPlugin plugin; - - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - private TempleTrekkingOverlay(TempleTrekkingConfig config, TempleTrekkingPlugin plugin) - { - super(plugin); - this.config = config; - this.plugin = plugin; - setPosition(OverlayPosition.TOP_LEFT); - setPriority(OverlayPriority.LOW); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (config.pointTrackerActive() && plugin.isInTrek()) - { - int points = plugin.getRewardPoints(); - double percentage = plugin.getRewardPercentage() * 100; - panelComponent.getChildren().clear(); - Color rightColor = percentage < 25 ? Color.RED : percentage >= 25 && percentage < 50 ? Color.YELLOW : - percentage >= 50 && percentage < 75 ? Color.BLUE : Color.GREEN; - panelComponent.getChildren().add(LineComponent.builder() - .left("Trek Points: ") - .right(Integer.toString(points)) - .rightColor(rightColor) - .build()); - panelComponent.getChildren().add(LineComponent.builder() - .left("Reward %: ") - .right(String.format("%.2f", percentage) + "%") - .rightColor(rightColor) - .build()); - return panelComponent.render(graphics); - } - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/templetrekking/TempleTrekkingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/templetrekking/TempleTrekkingPlugin.java deleted file mode 100644 index 4b7336fd83..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/templetrekking/TempleTrekkingPlugin.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2018, Frosty Fridge - * 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.templetrekking; - -import com.google.inject.Provides; -import java.util.HashSet; -import java.util.Set; -import javax.inject.Inject; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.GroundObject; -import net.runelite.api.ObjectID; -import net.runelite.api.Varbits; -import net.runelite.api.events.GroundObjectSpawned; -import net.runelite.api.events.VarbitChanged; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -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; - -@PluginDescriptor( - name = "Temple Trekking", - description = "Helpers for the Temple Trek minigame", - tags = {"minigame", "overlay", "temple trek"}, - type = PluginType.MINIGAME -) -public class TempleTrekkingPlugin extends Plugin -{ - @Getter - private final Set bogList = new HashSet<>(); - - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private TempleTrekkingOverlay overlay; - - @Inject - private TempleTrekkingBogOverlay bogOverlay; - - @Getter - private boolean inTrek = false; - - @Provides - TempleTrekkingConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(TempleTrekkingConfig.class); - } - - @Override - protected void startUp() - { - overlayManager.add(overlay); - overlayManager.add(bogOverlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - overlayManager.remove(bogOverlay); - bogList.clear(); - } - - @Subscribe - public void onGroundObjectSpawned(GroundObjectSpawned event) - { - GroundObject obj = event.getGroundObject(); - if (obj.getId() == ObjectID.BOG) - { - bogList.add(obj); - } - } - - //onGroundObjectDespawned is having issues handling this, so bogmap removal is here instead. - @Subscribe - public void onVarbitChanged(VarbitChanged event) - { - if (!bogList.isEmpty() && client.getVar(Varbits.TREK_EVENT) == 0) - { - bogList.clear(); - } - if (!inTrek && client.getVar(Varbits.TREK_STARTED) == 1) - { - inTrek = true; - } - else if (inTrek && client.getVar(Varbits.TREK_STATUS) == 0 && client.getVar(Varbits.TREK_POINTS) == 0) - { - inTrek = false; - } - } - - protected int getRewardPoints() - { - return client.getVar(Varbits.TREK_POINTS); - } - - protected double getRewardPercentage() - { - double percentage = 0.000126945 * getRewardPoints() - 0.0357188951; - return Math.max(percentage, 0); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/RoomHandler.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/RoomHandler.java deleted file mode 100644 index bbe032ff58..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/RoomHandler.java +++ /dev/null @@ -1,124 +0,0 @@ -package net.runelite.client.plugins.theatre; - -import java.awt.Color; -import java.awt.Font; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.util.Map; -import net.runelite.api.Client; -import net.runelite.api.NPC; -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.OverlayUtil; - -public abstract class RoomHandler -{ - - protected final Client client; - protected final TheatrePlugin plugin; - - protected RoomHandler(final Client client, final TheatrePlugin plugin) - { - this.client = client; - this.plugin = plugin; - } - - public abstract void onStart(); - - public abstract void onStop(); - - protected void drawTile2(Graphics2D graphics, WorldPoint point, Color color, int strokeWidth, int outlineAlpha, int fillAlpha) - { - WorldPoint playerLocation = client.getLocalPlayer().getWorldLocation(); - if (point.distanceTo(playerLocation) >= 32) - { - return; - } - LocalPoint lp = LocalPoint.fromWorld(client, point); - if (lp == null) - { - return; - } - - Polygon poly = Perspective.getCanvasTileAreaPoly(client, lp, 7); - if (poly == null) - { - return; - } - //OverlayUtil.renderPolygon(graphics, poly, color); - OverlayUtil.drawStrokeAndFillPoly(graphics, color, strokeWidth, outlineAlpha, fillAlpha, poly); - - } - - protected void renderProjectiles(Graphics2D graphics, Map projectiles) - { - for (Map.Entry entry : projectiles.entrySet()) - { - int projectileId = entry.getKey().getId(); - String text = entry.getValue(); - int x = (int) entry.getKey().getX(); - int y = (int) entry.getKey().getY(); - LocalPoint projectilePoint = new LocalPoint(x, y); - Point textLocation = Perspective.getCanvasTextLocation(client, graphics, projectilePoint, text, 0); - if (textLocation != null) - { - if (projectileId == 1607) - { // range - renderTextLocation(graphics, text, 17, Font.BOLD, new Color(57, 255, 20, 255), textLocation); - } - else if (projectileId == 1606) - { //mage - renderTextLocation(graphics, text, 17, Font.BOLD, new Color(64, 224, 208, 255), textLocation); - } - else - { //Orb of death? i hope - renderTextLocation(graphics, text, 20, Font.BOLD, Color.WHITE, textLocation); - } - } - } - } - - protected void drawTile(Graphics2D graphics, WorldPoint point, Color color, int strokeWidth, int outlineAlpha, int fillAlpha) - { - WorldPoint playerLocation = client.getLocalPlayer().getWorldLocation(); - - OverlayUtil.drawTiles(graphics, client, point, playerLocation, color, strokeWidth, outlineAlpha, fillAlpha); - } - - protected void renderNpcOverlay(Graphics2D graphics, NPC actor, Color color, int outlineWidth, int outlineAlpha, int fillAlpha) - { - OverlayUtil.renderNpcOverlay(graphics, actor, color, outlineWidth, outlineAlpha, fillAlpha, client); - } - - protected 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 canvasCenterPointShadow = new Point(canvasPoint.getX() + 1, canvasPoint.getY() + 1); - - OverlayUtil.renderTextLocation(graphics, canvasCenterPointShadow, txtString, Color.BLACK); - OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor); - } - } - - protected String twoDigitString(long number) - { - - if (number == 0) - { - return "00"; - } - - if (number / 10 == 0) - { - return "0" + number; - } - - return String.valueOf(number); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreConfig.java deleted file mode 100644 index 1654719cf1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreConfig.java +++ /dev/null @@ -1,456 +0,0 @@ -/* - * THIS SOFTWARE WRITTEN BY A KEYBOARD-WIELDING MONKEY BOI - * No rights reserved. Use, redistribute, and modify at your own discretion, - * and in accordance with Yagex and RuneLite guidelines. - * However, aforementioned monkey would prefer if you don't sell this plugin for profit. - * Good luck on your raids! - */ - -package net.runelite.client.plugins.theatre; - -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.ConfigSection; - -@ConfigGroup("Theatre") - -public interface TheatreConfig extends Config -{ - @ConfigSection( - position = 0, - keyName = "maidenSection", - name = "Maiden", - description = "" - ) - default boolean experimentalSection() - { - return false; - } - - @ConfigItem( - position = 1, - keyName = "showMaidenBloodToss", - name = "Show Maiden Blood Toss", - description = "Displays the tile location where tossed blood will land.", - section = "maidenSection" - ) - default boolean showMaidenBloodToss() - { - return true; - } - - @ConfigItem( - position = 2, - keyName = "showMaidenBloodSpawns", - name = "Show Maiden Blood Spawns", - description = "Show the tiles that blood spawns will travel to.", - section = "maidenSection" - ) - default boolean showMaidenBloodSpawns() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "showNyloFreezeHighlights", - name = "Show Nylo Freeze Highlights", - description = "Show when to freeze Nylos at maiden. Say n1,n2,s1,s2 in chat for it to register.", - section = "maidenSection" - ) - default boolean showNyloFreezeHighlights() - { - return true; - } - - @ConfigSection( - position = 4, - keyName = "bloatSection", - name = "Bloat", - description = "" - ) - default boolean bloatSection() - { - return false; - } - - @ConfigItem( - position = 5, - keyName = "showBloatIndicator", - name = "Show Bloat Status", - description = "Displays Bloat's status (asleep, wake, and enrage) using color code.", - section = "bloatSection" - ) - default boolean showBloatIndicator() - { - return true; - } - - @ConfigItem( - position = 6, - keyName = "showBloatHands", - name = "Show Bloat Hands", - description = "Highlights the falling hands inside Bloat.", - section = "bloatSection" - ) - default boolean showBloatHands() - { - return true; - } - - @ConfigItem( - position = 7, - keyName = "bloatFeet", - name = "Bloat Hands Rave Edition", - description = "", - section = "bloatSection" - ) - default boolean BloatFeetIndicatorRaveEdition() - { - return false; - } - - @ConfigItem( - position = 8, - keyName = "showBloatTimer", - name = "Show Bloat Timer", - description = "Show the estimated time when Bloat will go down.", - section = "bloatSection" - ) - default boolean showBloatTimer() - { - return false; - } - - @ConfigSection( - position = 9, - keyName = "nylocasSection", - name = "Nylocas", - description = "" - ) - default boolean nylocasSection() - { - return false; - } - - @ConfigItem( - position = 10, - keyName = "showNyloPillarHealth", - name = "Show Nylocas Pillar Health", - description = "Show the health bars of the Nylocas pillars.", - section = "nylocasSection" - ) - default boolean showNyloPillarHealth() - { - return true; - } - - @ConfigItem( - position = 11, - keyName = "showNylocasExplosions", - name = "Highlight Old Nylocas", - description = "Either a timer on the nylo counting down to explosion, or a tile underneath.", - section = "nylocasSection" - ) - default NYLOOPTION showNylocasExplosions() - { - return NYLOOPTION.NONE; - } - - @ConfigItem( - position = 12, - keyName = "showNylocasAmount", - name = "Show Nylocas Amount", - description = "An overlay will appear that counts the amount of Nylocas in the room.", - section = "nylocasSection" - ) - default boolean showNylocasAmount() - { - return true; - } - - @ConfigItem( - position = 13, - keyName = "nylocasMenuSwap", - name = "Hide Nylocas wrong attack options", - description = "hides attack options on small nylos of the wrong style", - section = "nylocasSection" - ) - default boolean nylocasMenuSwap() - { - return true; - } - - /** - * @ConfigItem( position = 8, - * keyName = "showNylocasSpawns", - * name = "Show Nylocas Pre-spawns", - * description = "Know the contents of the next upcoming wave." - * ) - * default boolean showNylocasSpawns() - * { - * return true; - * } - * @ConfigItem( position = 9, - * keyName = "highlightNyloRoles", - * name = "Highlight Nylo Prespawns", - * description = "Highlights the next upcoming wave based on role. FOR BEGINNERS" - * ) - * default NYLOCAS highlightNyloRoles() - * { - * return NYLOCAS.NONE; - * } - * @ConfigItem( position = 10, - * keyName = "highlightNyloParents", - * name = "Show Nylo Parents (Un-used)", - * description = "Highlight the Nylocas that spawn outside the center." - * ) - * default boolean highlightNyloParents() - * { - * return true; - * } - **/ - - @ConfigItem( - position = 14, - keyName = "highlightNyloAgros", - name = "Show Nylocas Agros", - description = "Highlight the Nylocas that are aggressive to the player.", - section = "nylocasSection" - ) - default boolean highlightNyloAgros() - { - return true; - } - - - @ConfigSection( - position = 15, - keyName = "sotetsegSection", - name = "Sotetseg", - description = "" - ) - default boolean sotetsegSection() - { - return false; - } - - @ConfigItem( - position = 16, - keyName = "showSotetsegAttacks", - name = "Show Sotetseg Attacks", - description = "Highlight the attacks which Sotetseg throws at you.", - section = "sotetsegSection" - ) - default boolean showSotetsegAttacks() - { - return true; - } - - @ConfigItem( - position = 17, - keyName = "showSotetsegMaze", - name = "Mark Sotetseg Maze", - description = "Marks the tiles of Sotetseg's maze while in the overworld.", - section = "sotetsegSection" - ) - default boolean showSotetsegMaze() - { - return true; - } - - @ConfigItem( - position = 18, - keyName = "showSotetsegSolo", - name = "Mark Sotetseg Maze (Solo)", - description = "Marks the tiles of Sotetseg's maze while in the underworld.", - section = "sotetsegSection" - ) - default boolean showSotetsegSolo() - { - return true; - } - - @ConfigItem( - position = 19, - keyName = "markerColor", - name = "Sotey Tile Colour", - description = "Configures the color of marked tile", - section = "sotetsegSection" - ) - default Color mazeTileColour() - { - return Color.WHITE; - } - - @ConfigSection( - position = 20, - keyName = "xarpusSection", - name = "Xarpus", - description = "" - ) - default boolean xarpusSection() - { - return false; - } - - @ConfigItem( - position = 21, - keyName = "showXarpusHeals", - name = "Show Xarpus Heals", - description = "Highlights the tiles that Xarpus is healing with.", - section = "xarpusSection" - ) - default boolean showXarpusHeals() - { - return true; - } - - @ConfigItem( - position = 22, - keyName = "showXarpusTick", - name = "Show Xarpus Turn Tick", - description = "Count down the ticks until Xarpus turns their head.", - section = "xarpusSection" - ) - default boolean showXarpusTick() - { - return true; - } - - @ConfigSection( - position = 23, - keyName = "verzikSection", - name = "Verzik", - description = "" - ) - default boolean verzikSection() - { - return false; - } - - @ConfigItem( - position = 24, - keyName = "showVerzikAttacks", - name = "Show Verzik Attack Tick", - description = "Count down the ticks until Verzik attacks.", - section = "verzikSection" - ) - default boolean showVerzikAttacks() - { - return true; - } - - @ConfigItem( - position = 25, - keyName = "showVerzikYellows", - name = "Show Yellows Tick", - description = "Count down the ticks until Verzik yellow's damage tick.", - section = "verzikSection" - ) - default boolean showVerzikYellows() - { - return true; - } - - @ConfigItem( - position = 26, - keyName = "showCrabTargets", - name = "Show Crab Targets", - description = "Shows the target of crabs at Verzik.", - section = "verzikSection" - ) - default boolean showCrabTargets() - { - return true; - } - - @ConfigItem( - position = 27, - keyName = "VerzikTankTile", - name = "Verzik P3 Tile Overlay", - description = "", - section = "verzikSection" - ) - default boolean VerzikTankTile() - { - return false; - } - - @ConfigItem( - position = 28, - keyName = "verzikrangeattacks", - name = "Show Verzik Range Attacks", - description = "", - section = "verzikSection" - ) - default boolean verzikRangeAttacks() - { - return true; - } - - @ConfigItem( - position = 29, - keyName = "extratimers", - name = "Show Extra Timers", - description = "", - section = "verzikSection" - ) - default boolean extraTimers() - { - return false; - } - - @ConfigItem( - position = 30, - keyName = "p1attacks", - name = "Verzik P1 Timer", - description = "", - section = "verzikSection" - ) - default boolean p1attacks() - { - return true; - } - - @ConfigItem( - position = 31, - keyName = "p2attacks", - name = "Verzik P2 Timer", - description = "", - section = "verzikSection" - ) - default boolean p2attacks() - { - return true; - } - - @ConfigItem( - position = 32, - keyName = "p3attacks", - name = "Verzik P3 Timer", - description = "", - section = "verzikSection" - ) - default boolean p3attacks() - { - return true; - } - - enum NYLOCAS - { - NONE, - MAGE, - MELEE, - RANGER - } - - enum NYLOOPTION - { - NONE, - TILE, - TIMER - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreConstant.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreConstant.java deleted file mode 100644 index 0724fb099e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreConstant.java +++ /dev/null @@ -1,54 +0,0 @@ -package net.runelite.client.plugins.theatre; - -public class TheatreConstant -{ - public static final int MAIDEN_BLOOD_THROW = 1579; - - public static final int NPC_ID_NYLOCAS_PILLAR = 8358; - - public static final int GROUNDOBJECT_ID_BLACKMAZE = 33034; - public static final int GROUNDOBJECT_ID_REDMAZE = 33035; - public static final int GROUNDOBJECT_ID_EXHUMED = 32743; - - public static final int ANIMATION_ID_XARPUS = 8059; - - public static final int SOTETSEG_NORMAL = 8388; - public static final int SOTETSEG_MAZE = 8387; - public static final int SOTETSEG_BOMB = 1604; - public static final int SOTETSEG_RANGE = 1607; - public static final int SOTETSEG_MAGE = 1606; - - public static final int GRAPHICSOBJECT_ID_YELLOW = 1595; - - public static final int PROJECTILE_ID_P2RANGE = 1583; - public static final int PROJECTILE_ID_YELLOW = 1596; - - public static final int ANIMATION_ID_P3_WEB = 8127; - public static final int ANIMATION_ID_P3_YELLOW = 8126; - public static final int ANIMATION_ID_P3_MELEE = 8123; - public static final int ANIMATION_ID_P3_MAGE = 8124; - public static final int ANIMATION_ID_P3_RANGE = 8125; - - public static final int ANIMATION_ID_P1_ATTACK = 8109; - public static final int ANIMATION_ID_P2_ATTACK_RANGE = 8114; - public static final int ANIMATION_ID_P2_ATTACK_MELEE = 8116; - public static final int ANIMATION_ID_P2_SHIELD = 8117; - - public static final int VERZIK_ID_P0 = 8369; - public static final int VERZIK_ID_P1 = 8370; - public static final int VERZIK_ID_P1_WALK = 8371; - public static final int VERZIK_ID_P2 = 8372; - public static final int VERZIK_ID_P2_TRANSFORM = 8373; - public static final int VERZIK_ID_P3 = 8374; - public static final int VERZIK_ID_P3_BAT = 8375; - - public static final int VERZIK_P3_RANGE = 1593; - public static final int VERZIK_P3_MAGE = 1594; - - public static final int NPC_ID_TORNADO = 8386; - public static final int PROJECTILE_ID_P3_GREEN = 1598; - - public static final int GRAPHIC_ID_YELLOWS = 1595; - - public static final int DOOR_VARP = 6447; -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreOverlay.java deleted file mode 100644 index 5237641000..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreOverlay.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * THIS SOFTWARE WRITTEN BY A KEYBOARD-WIELDING MONKEY BOI - * No rights reserved. Use, redistribute, and modify at your own discretion, - * and in accordance with Yagex and RuneLite guidelines. - * However, aforementioned monkey would prefer if you don't sell this plugin for profit. - * Good luck on your raids! - */ - -package net.runelite.client.plugins.theatre; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -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; - -@Singleton -public class TheatreOverlay extends Overlay -{ - private final TheatrePlugin plugin; - - @Inject - private TheatreOverlay(final TheatrePlugin plugin) - { - this.plugin = plugin; - - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGH); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D graphics) - { - switch (plugin.getRoom()) - { - case MAIDEN: - plugin.getMaidenHandler().render(graphics); - break; - case BLOAT: - plugin.getBloatHandler().render(graphics); - break; - case NYLOCAS: - plugin.getNyloHandler().render(graphics); - break; - case SOTETSEG: - plugin.getSotetsegHandler().render(graphics); - break; - case XARPUS: - plugin.getXarpusHandler().render(graphics); - break; - case VERSIK: - plugin.getVerzikHandler().render(graphics); - break; - default: - break; - } - return null; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatrePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatrePlugin.java deleted file mode 100644 index 54cd40a3f5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatrePlugin.java +++ /dev/null @@ -1,387 +0,0 @@ -/* - * THIS SOFTWARE WRITTEN BY A KEYBOARD-WIELDING MONKEY BOI - * No rights reserved. Use, redistribute, and modify at your own discretion, - * and in accordance with Yagex and RuneLite guidelines. - * However, aforementioned monkey would prefer if you don't sell this plugin for profit. - * Good luck on your raids! - */ - -package net.runelite.client.plugins.theatre; - -import com.google.inject.Provides; -import java.awt.Color; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.events.AnimationChanged; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.GroundObjectSpawned; -import net.runelite.api.events.NpcDefinitionChanged; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.events.ProjectileMoved; -import net.runelite.api.events.ProjectileSpawned; -import net.runelite.api.events.SpotAnimationChanged; -import net.runelite.api.events.VarbitChanged; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.graphics.ModelOutlineRenderer; -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.plugins.theatre.rooms.BloatHandler; -import net.runelite.client.plugins.theatre.rooms.MaidenHandler; -import net.runelite.client.plugins.theatre.rooms.SotetsegHandler; -import net.runelite.client.plugins.theatre.rooms.VerzikHandler; -import net.runelite.client.plugins.theatre.rooms.nylocas.NyloHandler; -import net.runelite.client.plugins.theatre.rooms.xarpus.XarpusHandler; -import net.runelite.client.ui.overlay.OverlayManager; - -@PluginDescriptor( - name = "Theatre of Blood", - description = "All-in-one plugin for Theatre of Blood.", - tags = {"ToB", "Theatre", "Theatre of Blood", "Lyzrd"}, - type = PluginType.PVM, - enabledByDefault = false -) -@Singleton -@Slf4j -@Getter(AccessLevel.PUBLIC) -public class TheatrePlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private EventBus eventBus; - - @Inject - private OverlayManager overlayManager; - - @Inject - private TheatreOverlay overlay; - - @Inject - private TheatreConfig config; - - @Inject - private MenuManager menuManager; - - @Inject - private ItemManager itemManager; - - @Inject - private ModelOutlineRenderer modelOutline; - - private BloatHandler bloatHandler; - private MaidenHandler maidenHandler; - private NyloHandler nyloHandler; - private SotetsegHandler sotetsegHandler; - @Setter(AccessLevel.PUBLIC) - private TheatreRoom room; - private VerzikHandler verzikHandler; - private XarpusHandler xarpusHandler; - private boolean BloatFeetIndicatorRaveEdition; - private boolean extraTimers; - private boolean highlightNyloAgros; - private boolean p1attacks; - private boolean p2attacks; - private boolean p3attacks; - private boolean showBloatHands; - private boolean showBloatIndicator; - private boolean showBloatTimer; - private boolean showCrabTargets; - private boolean showMaidenBloodSpawns; - private boolean showMaidenBloodToss; - private boolean showNylocasAmount; - private boolean showNyloFreezeHighlights; - private boolean showNyloPillarHealth; - private boolean nylocasMenuSwap; - private boolean showSotetsegAttacks; - private boolean showSotetsegMaze; - private boolean showSotetsegSolo; - private boolean showVerzikAttacks; - private boolean showVerzikYellows; - private boolean showXarpusHeals; - private boolean showXarpusTick; - private boolean verzikRangeAttacks; - private boolean VerzikTankTile; - private Color mazeTileColour; - private TheatreConfig.NYLOOPTION showNylocasExplosions; - - @Provides - TheatreConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(TheatreConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - room = TheatreRoom.UNKNOWN; - maidenHandler = new MaidenHandler(client, this, modelOutline); - bloatHandler = new BloatHandler(client, this); - nyloHandler = new NyloHandler(client, this, menuManager, eventBus); - sotetsegHandler = new SotetsegHandler(client, this); - xarpusHandler = new XarpusHandler(client, this); - verzikHandler = new VerzikHandler(client, this); - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - maidenHandler.onStop(); - maidenHandler = null; - bloatHandler.onStop(); - bloatHandler = null; - nyloHandler.startTime = 0L; - nyloHandler.onStop(); - nyloHandler = null; - sotetsegHandler.onStop(); - sotetsegHandler = null; - xarpusHandler.onStop(); - xarpusHandler = null; - verzikHandler.onStop(); - verzikHandler = null; - room = TheatreRoom.UNKNOWN; - overlayManager.remove(overlay); - } - - @Subscribe - private void onAnimationChanged(AnimationChanged event) - { - if (verzikHandler != null) - { - verzikHandler.onAnimationChanged(event); - } - } - - @Subscribe - private void onChatMessage(ChatMessage event) - { - if (maidenHandler != null) - { - maidenHandler.onChatMessage(event); - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("Theatre")) - { - return; - } - - if (nyloHandler != null) - { - nyloHandler.onConfigChanged(); - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - if (maidenHandler != null) - { - maidenHandler.onGameTick(); - } - - if (bloatHandler != null) - { - bloatHandler.onGameTick(); - } - - if (nyloHandler != null) - { - nyloHandler.onGameTick(); - } - - if (sotetsegHandler != null) - { - sotetsegHandler.onGameTick(); - } - - if (xarpusHandler != null) - { - xarpusHandler.onGameTick(); - } - - if (verzikHandler != null) - { - verzikHandler.onGameTick(); - } - } - - @Subscribe - private void onGroundObjectSpawned(GroundObjectSpawned event) - { - if (sotetsegHandler != null) - { - sotetsegHandler.onGroundObjectSpawned(event); - } - - if (xarpusHandler != null) - { - xarpusHandler.onGroundObjectSpawned(event); - } - } - - @Subscribe - private void onNpcDefinitionChanged(NpcDefinitionChanged event) - { - if (maidenHandler != null) - { - maidenHandler.onNpcDefinitionChanged(event); - } - } - - @Subscribe - private void onNpcDespawned(NpcDespawned event) - { - if (maidenHandler != null) - { - maidenHandler.onNpcDespawned(event); - } - - if (bloatHandler != null) - { - bloatHandler.onNpcDespawned(event); - } - - if (nyloHandler != null) - { - nyloHandler.onNpcDespawned(event); - } - - if (sotetsegHandler != null) - { - sotetsegHandler.onNpcDespawned(event); - } - - if (xarpusHandler != null) - { - xarpusHandler.onNpcDespawned(event); - } - - } - - @Subscribe - private void onNpcSpawned(NpcSpawned event) - { - if (maidenHandler != null) - { - maidenHandler.onNpcSpawned(event); - } - - if (bloatHandler != null) - { - bloatHandler.onNpcSpawned(event); - } - - if (nyloHandler != null) - { - nyloHandler.onNpcSpawned(event); - } - - if (sotetsegHandler != null) - { - sotetsegHandler.onNpcSpawned(event); - } - - if (xarpusHandler != null) - { - xarpusHandler.onNpcSpawned(event); - } - - if (verzikHandler != null) - { - verzikHandler.onNpcSpawned(event); - } - - } - - @Subscribe - private void onProjectileMoved(ProjectileMoved event) - { - if (verzikHandler != null) - { - verzikHandler.onProjectileMoved(event); - } - } - - @Subscribe - private void onProjectileSpawned(ProjectileSpawned event) - { - if (sotetsegHandler != null) - { - sotetsegHandler.onProjectileSpawned(event); - - } - } - - @Subscribe - private void onSpotAnimationChanged(SpotAnimationChanged event) - { - if (maidenHandler != null) - { - maidenHandler.onSpotAnimationChanged(event); - } - } - - @Subscribe - private void onVarbitChanged(VarbitChanged event) - { - if (bloatHandler != null) - { - bloatHandler.onVarbitChanged(event); - } - - if (xarpusHandler != null) - { - xarpusHandler.onVarbitChanged(event); - } - } - - private void updateConfig() - { - this.showMaidenBloodToss = config.showMaidenBloodToss(); - this.showMaidenBloodSpawns = config.showMaidenBloodSpawns(); - this.showNyloFreezeHighlights = config.showNyloFreezeHighlights(); - this.showBloatIndicator = config.showBloatIndicator(); - this.showBloatHands = config.showBloatHands(); - this.BloatFeetIndicatorRaveEdition = config.BloatFeetIndicatorRaveEdition(); - this.showBloatTimer = config.showBloatTimer(); - this.showNyloPillarHealth = config.showNyloPillarHealth(); - this.nylocasMenuSwap = config.nylocasMenuSwap(); - this.showNylocasExplosions = config.showNylocasExplosions(); - this.showNylocasAmount = config.showNylocasAmount(); - this.highlightNyloAgros = config.highlightNyloAgros(); - this.showSotetsegAttacks = config.showSotetsegAttacks(); - this.showSotetsegMaze = config.showSotetsegMaze(); - this.showSotetsegSolo = config.showSotetsegSolo(); - this.mazeTileColour = config.mazeTileColour(); - this.showXarpusHeals = config.showXarpusHeals(); - this.showXarpusTick = config.showXarpusTick(); - this.showVerzikAttacks = config.showVerzikAttacks(); - this.showVerzikYellows = config.showVerzikYellows(); - this.showCrabTargets = config.showCrabTargets(); - this.VerzikTankTile = config.VerzikTankTile(); - this.verzikRangeAttacks = config.verzikRangeAttacks(); - this.extraTimers = config.extraTimers(); - this.p1attacks = config.p1attacks(); - this.p2attacks = config.p2attacks(); - this.p3attacks = config.p3attacks(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreRoom.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreRoom.java deleted file mode 100644 index 4da8512503..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/TheatreRoom.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.runelite.client.plugins.theatre; - -public enum TheatreRoom -{ - MAIDEN, - BLOAT, - NYLOCAS, - SOTETSEG, - XARPUS, - VERSIK, - UNKNOWN -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/BloatHandler.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/BloatHandler.java deleted file mode 100644 index dddc77f9ad..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/BloatHandler.java +++ /dev/null @@ -1,229 +0,0 @@ -package net.runelite.client.plugins.theatre.rooms; - -import java.awt.Color; -import java.awt.Font; -import java.awt.Graphics2D; -import java.util.Random; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.GraphicsObject; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.Point; -import net.runelite.api.Varbits; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.events.VarbitChanged; -import net.runelite.client.plugins.theatre.RoomHandler; -import net.runelite.client.plugins.theatre.TheatrePlugin; -import net.runelite.client.plugins.theatre.TheatreRoom; - -public class BloatHandler extends RoomHandler -{ - - private int bloatTimer; - @Getter(AccessLevel.PUBLIC) - private NPC bloat; - private int counter; - private boolean bloatFlag; - private Color color; - @Getter(AccessLevel.PUBLIC) - private BloatState bloatState; - - public BloatHandler(final Client client, final TheatrePlugin plugin) - { - super(client, plugin); - } - - @Override - public void onStart() - { - if (this.plugin.getRoom() == TheatreRoom.BLOAT) - { - return; - } - - this.reset(); - this.plugin.setRoom(TheatreRoom.BLOAT); - } - - @Override - public void onStop() - { - this.reset(); - this.plugin.setRoom(TheatreRoom.UNKNOWN); - } - - private void reset() - { - bloat = null; - bloatFlag = false; - bloatTimer = 0; - counter = 0; - bloatState = BloatState.UP; - } - - public void render(Graphics2D graphics) - { - if (bloat == null) - { - return; - } - - if (plugin.isShowBloatIndicator()) - { - switch (bloatState) - { - case DOWN: - renderNpcOverlay(graphics, bloat, Color.GREEN, 3, 150, 0); - break; - case WARN: - renderNpcOverlay(graphics, bloat, Color.YELLOW, 3, 150, 0); - break; - case UP: - renderNpcOverlay(graphics, bloat, new Color(223, 109, 255), 3, 150, 0); - break; - } - } - - if (plugin.isShowBloatHands()) - { - for (GraphicsObject object : client.getGraphicsObjects()) - { - int id = object.getId(); - if (id >= 1560 && id <= 1590) - { - WorldPoint point = WorldPoint.fromLocal(client, object.getLocation()); - if (!plugin.isBloatFeetIndicatorRaveEdition()) - { - drawTile(graphics, point, new Color(36, 248, 229), 2, 255, 10); - } - else - { - drawTile(graphics, point, color, 2, 255, 10); - } - - } - } - } - - if (plugin.isShowBloatTimer()) - { - final String tickCounter = String.valueOf(bloatTimer); - int secondConversion = (int) (bloatTimer * .6); - if (bloat != null) - { - Point canvasPoint = bloat.getCanvasTextLocation(graphics, tickCounter, 60); - if (bloatTimer <= 37) - { - renderTextLocation(graphics, tickCounter + "( " + secondConversion + " )", 15, Font.BOLD, Color.WHITE, canvasPoint); - } - else - { - renderTextLocation(graphics, tickCounter + "( " + secondConversion + " )", 15, Font.BOLD, Color.RED, canvasPoint); - } - } - } - } - - public void onVarbitChanged(VarbitChanged event) - { - if (client.getVar(Varbits.BLOAT_DOOR) == 1 && !bloatFlag) - { - bloatTimer = 0; - bloatFlag = true; - } - } - - public void onNpcSpawned(NpcSpawned event) - { - NPC npc = event.getNpc(); - int id = npc.getId(); - - if (id == NpcID.PESTILENT_BLOAT) - { - this.onStart(); - bloatTimer = 0; - bloat = npc; - } - } - - public void onNpcDespawned(NpcDespawned event) - { - NPC npc = event.getNpc(); - int id = npc.getId(); - - if (id == NpcID.PESTILENT_BLOAT) - { - this.onStop(); - bloatTimer = 0; - bloat = null; - } - } - - public void onGameTick() - { - if (plugin.getRoom() != TheatreRoom.BLOAT) - { - return; - } - - //Color generating code for bloat feet rave edition - int R = (int) (Math.random() * 256); - int G = (int) (Math.random() * 256); - int B = (int) (Math.random() * 256); - color = new Color(R, G, B); //random color, but can be bright or dull - Random random = new Random(); - final float hue = random.nextFloat(); - final float saturation = 0.9f;//1.0 for brilliant, 0.0 for dull - final float luminance = 1.0f; //1.0 for brighter, 0.0 for black - color = Color.getHSBColor(hue, saturation, luminance); - - - counter++; - - if (bloat.getAnimation() == -1) - { - bloatTimer++; - counter = 0; - if (bloat.getHealth() == 0) - { - bloatState = BloatState.DOWN; - } - else - { - bloatState = BloatState.UP; - } - } - else - { - if (25 < counter && counter < 35) - { - bloatState = BloatState.WARN; - } - else if (counter < 26) - { - bloatTimer = 0; - bloatState = BloatState.DOWN; - } - else if (bloat.getModelHeight() == 568) - { - bloatTimer = 0; - bloatState = BloatState.DOWN; - } - else - { - bloatState = BloatState.UP; - } - } - } - - public enum BloatState - { - DOWN, - UP, - WARN - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/MaidenHandler.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/MaidenHandler.java deleted file mode 100644 index ea6a201463..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/MaidenHandler.java +++ /dev/null @@ -1,343 +0,0 @@ -package net.runelite.client.plugins.theatre.rooms; - -import com.google.common.collect.ImmutableSet; -import java.awt.Color; -import java.awt.Graphics2D; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GraphicsObject; -import net.runelite.api.NPC; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.NpcDefinitionChanged; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.events.SpotAnimationChanged; -import net.runelite.api.util.Text; -import net.runelite.client.graphics.ModelOutlineRenderer; -import net.runelite.client.plugins.theatre.RoomHandler; -import net.runelite.client.plugins.theatre.TheatreConstant; -import net.runelite.client.plugins.theatre.TheatrePlugin; -import net.runelite.client.plugins.theatre.TheatreRoom; - -@Slf4j -public class MaidenHandler extends RoomHandler -{ - private static final ImmutableSet N1 = ImmutableSet.of( - new WorldPoint(3182, 4457, 0), - new WorldPoint(3174, 4457, 0) - ); - private static final ImmutableSet N2 = ImmutableSet.of( - new WorldPoint(3178, 4457, 0), - new WorldPoint(3186, 4455, 0), - new WorldPoint(3186, 4457, 0) - ); - private static final ImmutableSet S1 = ImmutableSet.of( - new WorldPoint(3174, 4437, 0), - new WorldPoint(3182, 4437, 0) - ); - private static final ImmutableSet S2 = ImmutableSet.of( - new WorldPoint(3186, 4439, 0), - new WorldPoint(3186, 4437, 0), - new WorldPoint(3178, 4437, 0) - ); - private static final ImmutableSet FREEZEANIMS = ImmutableSet.of( - 361, - 363, - 367, - 369 - ); - private static final Color TRANSPARENT = new Color(0, 0, 0, 0); - private static final Color FREEZE = new Color(0, 226, 255, 255); - private final List bloodThrows = new ArrayList<>(); - private final List bloodSpawns = new ArrayList<>(); - private List bloodSpawnLocation = new ArrayList<>(); - private final List bloodSpawnTarget = new ArrayList<>(); - private NPC maiden; - private String nyloCall; - private final Set nylos = new HashSet<>(); - private final List healers = new ArrayList<>(); - private int healerCount = 0; - private int wave = 1; - private long startTime = 0; - private final ModelOutlineRenderer modelOutline; - - public MaidenHandler(final Client client, final TheatrePlugin plugin, final ModelOutlineRenderer modelOutline) - { - super(client, plugin); - this.modelOutline = modelOutline; - } - - @Override - public void onStart() - { - if (this.plugin.getRoom() == TheatreRoom.MAIDEN) - { - return; - } - this.reset(); - this.plugin.setRoom(TheatreRoom.MAIDEN); - this.startTime = System.currentTimeMillis(); - log.debug("Starting Maiden Room"); - } - - @Override - public void onStop() - { - this.reset(); - this.plugin.setRoom(TheatreRoom.UNKNOWN); - log.debug("Stopping Maiden Room"); - } - - private void reset() - { - this.bloodThrows.clear(); - this.bloodSpawns.clear(); - this.bloodSpawnLocation.clear(); - this.bloodSpawnTarget.clear(); - this.healers.clear(); - this.nylos.clear(); - this.healerCount = 0; - this.startTime = -1; - this.wave = 1; - } - - public void render(Graphics2D graphics) - { - for (Nylos nylo : nylos) - { - if (nylo.getNpc() == null || nylo.getNpc().getId() == -1) - { - continue; - } - - final String location = nylo.getSpawnLocation().getName(); - - if (nyloCall == null || nyloCall.equals("")) - { - nyloCall = "n1"; - } - - if (location.equals(nyloCall)) - { - Color color = Color.WHITE; - int width = 4; - - if (nylo.getNpc().getWorldArea().distanceTo(maiden.getWorldArea()) <= 3) - { - color = FREEZE; - width = 8; - } - - modelOutline.drawOutline(nylo.getNpc(), width, color, TRANSPARENT); - } - } - - if (plugin.isShowMaidenBloodToss()) - { - for (WorldPoint point : bloodThrows) - { - drawTile(graphics, point, new Color(36, 248, 229), 2, 150, 10); - } - } - - if (plugin.isShowMaidenBloodSpawns()) - { - for (WorldPoint point : bloodSpawnLocation) - { - drawTile(graphics, point, new Color(36, 248, 229), 2, 180, 20); - } - - for (WorldPoint point : bloodSpawnTarget) - { - drawTile(graphics, point, new Color(36, 248, 229), 1, 120, 10); - } - } - } - - public void onSpotAnimationChanged(SpotAnimationChanged event) - { - if (event.getActor() instanceof NPC) - { - NPC npc = (NPC) event.getActor(); - - if (npc.getId() != 8366) - { - return; - } - - int anim = npc.getSpotAnimation(); - - if (FREEZEANIMS.contains(anim)) - { - nylos.removeIf(c -> c.getNpc() == npc); - } - } - } - - public void onNpcSpawned(NpcSpawned event) - { - NPC npc = event.getNpc(); - - if (npc.getName() == null) - { - return; - } - - switch (npc.getName()) - { - case "The Maiden of Sugadinti": - this.onStart(); - maiden = npc; - break; - case "Nylocas Matomenos": - if (!plugin.isShowNyloFreezeHighlights()) - { - return; - } - - this.healers.add(npc); - - WorldPoint wp = WorldPoint.fromLocalInstance(client, npc.getLocalLocation()); - - if (wp == null) - { - return; - } - - if (N1.contains(wp)) - { - addNylo(npc, Nylos.SpawnLocation.N1); - } - if (N2.contains(wp)) - { - addNylo(npc, Nylos.SpawnLocation.N2); - } - if (S1.contains(wp)) - { - addNylo(npc, Nylos.SpawnLocation.S1); - } - if (S2.contains(wp)) - { - addNylo(npc, Nylos.SpawnLocation.S2); - } - if (!N1.contains(wp) && !N2.contains(wp) && !S1.contains(wp) && !S2.contains(wp)) - { - log.info("No World Points Matched"); - log.info("Instance Loc: " + wp); - } - break; - case "Blood spawn": - if (!bloodSpawns.contains(npc)) - { - bloodSpawns.add(npc); - } - break; - } - } - - public void onNpcDefinitionChanged(NpcDefinitionChanged event) - { - NPC npc = event.getNpc(); - - if (npc.getName() != null && npc.getName().equals("Nylocas Matomenos") && npc.getId() == -1) - { - nylos.removeIf(c -> c.getNpc() == npc); - } - } - - public void onChatMessage(ChatMessage event) - { - if (client.getLocalPlayer() == null || (event.getSender() != null && !event.getSender().equals(client.getLocalPlayer().getName()))) - { - return; - } - - String msg = Text.standardize(event.getMessageNode().getValue()); - - switch (msg) - { - case "n1": - case "n2": - case "s1": - case "s2": - nyloCall = msg; - log.debug("Nylo Call Assigned: " + msg); - break; - } - } - - public void onNpcDespawned(NpcDespawned event) - { - NPC npc = event.getNpc(); - - if (npc.getName() == null) - { - return; - } - - switch (npc.getName()) - { - case "The Maiden of Sugadinti": - this.onStop(); - break; - case "Blood Spawn": - bloodSpawns.remove(npc); - break; - } - } - - public void onGameTick() - { - if (plugin.getRoom() != TheatreRoom.MAIDEN) - { - return; - } - - bloodThrows.clear(); - - for (GraphicsObject o : client.getGraphicsObjects()) - { - if (o.getId() == TheatreConstant.MAIDEN_BLOOD_THROW) - { - bloodThrows.add(WorldPoint.fromLocal(client, o.getLocation())); - } - } - - bloodSpawnLocation = new ArrayList<>(bloodSpawnTarget); - bloodSpawnTarget.clear(); - - for (NPC spawn : bloodSpawns) - { - bloodSpawnTarget.add(spawn.getWorldLocation()); - } - - if (this.healerCount != this.healers.size()) - { - this.healerCount = this.healers.size(); - - long elapsedTime = System.currentTimeMillis() - this.startTime; - long seconds = elapsedTime / 1000L; - - long minutes = seconds / 60L; - seconds = seconds % 60; - - int percentage = 70 - (20 * ((wave++) - 1)); - if (plugin.isExtraTimers()) - { - this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'The Maiden of Sugadinti - " + percentage + "%' completed! Duration: " + minutes + ":" + twoDigitString(seconds), null); - } - } - } - - - private void addNylo(NPC npc, Nylos.SpawnLocation spawnLocation) - { - nylos.add(new Nylos(npc, spawnLocation)); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/Nylos.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/Nylos.java deleted file mode 100644 index abd7933d8d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/Nylos.java +++ /dev/null @@ -1,37 +0,0 @@ -package net.runelite.client.plugins.theatre.rooms; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.NPC; - -class Nylos -{ - @Getter(AccessLevel.PUBLIC) - private NPC npc; - @Getter(AccessLevel.PUBLIC) - private int npcIndex; - @Getter(AccessLevel.PUBLIC) - @Setter(AccessLevel.PUBLIC) - private SpawnLocation spawnLocation; - - Nylos(NPC npc, SpawnLocation spawnLocation) - { - this.npc = npc; - this.npcIndex = npc.getIndex(); - this.spawnLocation = spawnLocation; - } - - @Getter(AccessLevel.PACKAGE) - @AllArgsConstructor - enum SpawnLocation - { - N1("n1"), - N2("n2"), - S1("s1"), - S2("s2"); - - private String name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/SotetsegHandler.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/SotetsegHandler.java deleted file mode 100644 index 1cfc1a0666..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/SotetsegHandler.java +++ /dev/null @@ -1,326 +0,0 @@ -package net.runelite.client.plugins.theatre.rooms; - -import com.google.common.collect.ImmutableSet; -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.GroundObject; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.Point; -import net.runelite.api.Projectile; -import net.runelite.api.ProjectileID; -import net.runelite.api.Tile; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GroundObjectSpawned; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.events.ProjectileSpawned; -import net.runelite.client.plugins.theatre.RoomHandler; -import net.runelite.client.plugins.theatre.TheatreConstant; -import net.runelite.client.plugins.theatre.TheatrePlugin; -import net.runelite.client.plugins.theatre.TheatreRoom; -import net.runelite.client.ui.overlay.OverlayUtil; - -public class SotetsegHandler extends RoomHandler -{ - private static final Set SOTE_PROJ = ImmutableSet.of( - ProjectileID.SOTETSEG_MAGE, ProjectileID.SOTETSEG_RANGE - ); - @Getter(AccessLevel.PUBLIC) - private final Map redTiles = new LinkedHashMap<>(); - @Getter(AccessLevel.PUBLIC) - private List redOverworld = new ArrayList<>(); - private final List blackOverworld = new ArrayList<>(); - private final List blackUnderworld = new ArrayList<>(); - private final List redUnderworld = new ArrayList<>(); - private final List gridPath = new ArrayList<>(); - private final Set soteyProjectiles = new HashSet<>(); - private NPC npc; - - public SotetsegHandler(final Client client, final TheatrePlugin plugin) - { - super(client, plugin); - } - - @Override - public void onStart() - { - if (this.plugin.getRoom() == TheatreRoom.SOTETSEG) - { - return; - } - - this.reset(); - this.plugin.setRoom(TheatreRoom.SOTETSEG); - } - - @Override - public void onStop() - { - this.reset(); - this.plugin.setRoom(TheatreRoom.UNKNOWN); - } - - private void reset() - { - npc = null; - redTiles.clear(); - redOverworld.clear(); - blackOverworld.clear(); - blackUnderworld.clear(); - redUnderworld.clear(); - gridPath.clear(); - } - - public void render(Graphics2D graphics) - { - if (plugin.isShowSotetsegMaze()) - { - int i = 1; - for (GroundObject o : redTiles.keySet()) - { - Polygon poly = o.getCanvasTilePoly(); - - if (poly != null) - { - graphics.setColor(plugin.getMazeTileColour()); - graphics.setStroke(new BasicStroke(2)); - graphics.draw(poly); - } - - Point textLocation = o.getCanvasTextLocation(graphics, String.valueOf(i), 0); - if (textLocation != null) - { - OverlayUtil.renderTextLocation(graphics, textLocation, String.valueOf(i), Color.WHITE); - } - - i++; - } - } - - if (plugin.isShowSotetsegSolo()) - { - for (WorldPoint p : redOverworld) - { - drawTile(graphics, p, plugin.getMazeTileColour(), 2, 255, 10); - } - } - - if (plugin.isShowSotetsegAttacks()) - { - - Map projectileMap = new HashMap<>(); - for (Projectile p : soteyProjectiles) - { - final int ticksRemaining = p.getRemainingCycles() / 30; - int id = p.getId(); - String countdownStr; - if (id == 1607) - { - countdownStr = "R " + ticksRemaining; - } - else - { - countdownStr = "M " + ticksRemaining; - } - - projectileMap.put(p, countdownStr); - } - renderProjectiles(graphics, projectileMap); - } - } - - public void onProjectileSpawned(ProjectileSpawned event) - { - final Projectile projectile = event.getProjectile(); - - if (SOTE_PROJ.contains(projectile.getId()) && projectile.getInteracting() == client.getLocalPlayer()) - { - soteyProjectiles.add(projectile); - } - else if (projectile.getId() == ProjectileID.SOTETSEG_BOMB) - { - soteyProjectiles.add(projectile); - } - } - - - public void onNpcSpawned(NpcSpawned event) - { - npc = event.getNpc(); - - if (npc.getName() != null && npc.getName().equals("Sotetseg")) - { - this.onStart(); - } - } - - public void onNpcDespawned(NpcDespawned event) - { - npc = event.getNpc(); - - if (npc.getName() != null && npc.getName().equals("Sotetseg")) - { - redTiles.clear(); - if (client.getPlane() != 3) - { - this.onStop(); - } - } - } - - public void onGroundObjectSpawned(GroundObjectSpawned event) - { - if (plugin.getRoom() != TheatreRoom.SOTETSEG) - { - return; - } - - GroundObject o = event.getGroundObject(); - if (o.getId() == TheatreConstant.GROUNDOBJECT_ID_BLACKMAZE) - { - Tile t = event.getTile(); - WorldPoint p = t.getWorldLocation(); - if (t.getPlane() == 0) - { - if (!blackOverworld.contains(p)) - { - blackOverworld.add(p); - } - } - else - { - if (!blackUnderworld.contains(p)) - { - blackUnderworld.add(p); - } - } - } - - if (o.getId() == TheatreConstant.GROUNDOBJECT_ID_REDMAZE) - { - Tile t = event.getTile(); - WorldPoint p = t.getWorldLocation(); - if (p.getPlane() == 0) - { - if (!redTiles.containsValue(t)) - { - redTiles.put(o, t); - } - } - else - { - if (!redUnderworld.contains(p)) - { - redUnderworld.add(p); - } - } - } - } - - public void onGameTick() - { - if (plugin.getRoom() != TheatreRoom.SOTETSEG) - { - return; - } - - if (!soteyProjectiles.isEmpty()) - { - soteyProjectiles.removeIf(p -> p.getRemainingCycles() <= 0); - } - - boolean sotetsegFighting = false; - - for (NPC npc : client.getNpcs()) - { - if (npc.getId() == NpcID.SOTETSEG_8388) - { - this.reset(); - sotetsegFighting = true; - break; - } - } - - if (!sotetsegFighting) - { - if (!blackUnderworld.isEmpty() && !redUnderworld.isEmpty() && gridPath.isEmpty()) - { - int minX = 99999; - int minY = 99999; - - for (WorldPoint p : blackUnderworld) - { - int x = p.getX(); - int y = p.getY(); - if (x < minX) - { - minX = x; - } - if (y < minY) - { - minY = y; - } - } - - boolean messageSent = false; - for (WorldPoint p : redUnderworld) - { - WorldPoint pN = new WorldPoint(p.getX(), p.getY() + 1, p.getPlane()); - WorldPoint pS = new WorldPoint(p.getX(), p.getY() - 1, p.getPlane()); - WorldPoint pE = new WorldPoint(p.getX() + 1, p.getY(), p.getPlane()); - WorldPoint pW = new WorldPoint(p.getX() - 1, p.getY(), p.getPlane()); - - if (!((redUnderworld.contains(pN) && redUnderworld.contains(pS)) || - (redUnderworld.contains(pE) && redUnderworld.contains(pW)))) - { - gridPath.add(new Point(p.getX() - minX, p.getY() - minY)); - if (!messageSent) - { - //client.addChatMessage(ChatMessageType.SERVER, "", "Maze path acquired.", null); - messageSent = true; - } - } - - } - } - - if (!blackOverworld.isEmpty() && !gridPath.isEmpty() && redOverworld.isEmpty()) - { - int minX = 99999; - int minY = 99999; - - for (WorldPoint p : blackOverworld) - { - int x = p.getX(); - int y = p.getY(); - if (x < minX) - { - minX = x; - } - if (y < minY) - { - minY = y; - } - } - - for (Point p : gridPath) - { - redOverworld.add(new WorldPoint(minX + p.getX(), minY + p.getY(), 0)); - } - } - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/VerzikHandler.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/VerzikHandler.java deleted file mode 100644 index 65cb217054..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/VerzikHandler.java +++ /dev/null @@ -1,491 +0,0 @@ -package net.runelite.client.plugins.theatre.rooms; - -import java.awt.Color; -import java.awt.Font; -import java.awt.Graphics2D; -import java.util.HashMap; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -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.GraphicsObject; -import net.runelite.api.NPC; -import net.runelite.api.Perspective; -import net.runelite.api.Player; -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.api.events.AnimationChanged; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.events.ProjectileMoved; -import net.runelite.client.plugins.theatre.RoomHandler; -import net.runelite.client.plugins.theatre.TheatreConstant; -import net.runelite.client.plugins.theatre.TheatrePlugin; -import net.runelite.client.plugins.theatre.TheatreRoom; - -public class VerzikHandler extends RoomHandler -{ - - @Getter(AccessLevel.PACKAGE) - private final Map Verzik_RangeProjectiles = new HashMap<>(); - //My variables - private int redCrabsTimer; - @Getter(AccessLevel.PUBLIC) - private int versikCounter = 0; - private int attacksLeft = 0; - @Getter(AccessLevel.PUBLIC) - private NPC npc; - private int lastId = -1; - private int yellows; - private boolean tornados; - private long startTime = 0; - - public VerzikHandler(final Client client, final TheatrePlugin plugin) - { - super(client, plugin); - } - - @Override - public void onStart() - { - if (this.plugin.getRoom() == TheatreRoom.VERSIK) - { - return; - } - - this.reset(); - this.plugin.setRoom(TheatreRoom.VERSIK); - } - - @Override - public void onStop() - { - this.reset(); - this.plugin.setRoom(TheatreRoom.UNKNOWN); - } - - private void reset() - { - this.redCrabsTimer = 13; - this.Verzik_RangeProjectiles.clear(); - this.versikCounter = 19; - this.attacksLeft = 0; - this.npc = null; - this.yellows = 0; - this.lastId = -1; - this.tornados = false; - this.startTime = 0; - } - - public void render(Graphics2D graphics) - { - if (npc == null) - { - return; - } - - int id = npc.getId(); - if (plugin.isVerzikRangeAttacks()) - { - for (WorldPoint p : getVerzik_RangeProjectiles().values()) - { - drawTile(graphics, p, Color.RED, 2, 180, 50); - } - } - if (plugin.isShowVerzikAttacks()) - { - - if (id == TheatreConstant.VERZIK_ID_P1) - { - if (plugin.isP1attacks() && this.versikCounter >= 0) - { - String str = Integer.toString(versikCounter); - - LocalPoint lp = npc.getLocalLocation(); - Point point = Perspective.getCanvasTextLocation(client, graphics, lp, str, 0); - - renderTextLocation(graphics, str, 20, Font.BOLD, Color.CYAN, point); - } - } - else if (id == TheatreConstant.VERZIK_ID_P2) - { - if (plugin.isP2attacks() && this.versikCounter >= 0) - { - String str = Integer.toString(versikCounter); - - LocalPoint lp = npc.getLocalLocation(); - Point point = Perspective.getCanvasTextLocation(client, graphics, lp, str, 0); - - renderTextLocation(graphics, str, 20, Font.BOLD, Color.CYAN, point); - } - } - - else if (id == TheatreConstant.VERZIK_ID_P3 && plugin.isP3attacks() && versikCounter > 0 && versikCounter < 8) - { - String str = Math.max(versikCounter, 0) + "";// + " | " + model.getModelHeight();// + " | " + model.getRadius(); - - LocalPoint lp = npc.getLocalLocation(); - Point point = Perspective.getCanvasTextLocation(client, graphics, lp, str, 0); - - renderTextLocation(graphics, str, 15, Font.BOLD, Color.WHITE, point); - } - } - - if (plugin.isVerzikTankTile() && id == TheatreConstant.VERZIK_ID_P3) - { - WorldPoint wp = new WorldPoint(npc.getWorldLocation().getX() + 3, npc.getWorldLocation().getY() + 3, client.getPlane()); - drawTile2(graphics, wp, new Color(75, 0, 130), 2, 255, 0); - //renderNpcOverlay(graphics, boss, new Color(75, 0, 130), 1, 255, 0); - } - - - if (plugin.isShowVerzikYellows() && this.yellows > 0) - { - String text = Integer.toString(this.yellows); - - for (GraphicsObject object : client.getGraphicsObjects()) - { - if (object.getId() == TheatreConstant.GRAPHIC_ID_YELLOWS) - { - drawTile(graphics, WorldPoint.fromLocal(client, object.getLocation()), Color.YELLOW, 3, 255, 0); - LocalPoint lp = object.getLocation(); - Point point = Perspective.getCanvasTextLocation(client, graphics, lp, text, 0); - renderTextLocation(graphics, text, 12, Font.BOLD, Color.WHITE, point); - } - } - } - - if (plugin.isShowCrabTargets()) - { - Player local = client.getLocalPlayer(); - if (local != null && local.getName() != null) - { - for (NPC npc : client.getNpcs()) - { - if (npc.getName() == null) - { - continue; - } - - Pattern p = Pattern.compile("Nylocas (Hagios|Toxobolos|Ischyros)"); - Matcher m = p.matcher(npc.getName()); - if (!m.matches()) - { - continue; - } - - Actor target = npc.getInteracting(); - if (target == null || target.getName() == null) - { - continue; - } - - LocalPoint lp = npc.getLocalLocation(); - Color color = local.getName().equals(target.getName()) ? Color.RED : Color.GREEN; - - Point point = Perspective.getCanvasTextLocation(client, graphics, lp, target.getName(), 0); - renderTextLocation(graphics, target.getName(), 14, Font.BOLD, color, point); - } - } - } - - } - - public void onProjectileMoved(ProjectileMoved event) - { - Projectile projectile = event.getProjectile(); - if (projectile.getId() == 1583) - { - WorldPoint p = WorldPoint.fromLocal(client, event.getPosition()); - Verzik_RangeProjectiles.put(projectile, p); - } - } - - public void onNpcSpawned(NpcSpawned event) - { - NPC npc = event.getNpc(); - int id = npc.getId(); - - if (npc.getName() != null && npc.getName().equals("Verzik Vitur")) - { - this.npc = npc; - if (id == TheatreConstant.VERZIK_ID_P3_BAT) - { - this.onStop(); - } - else - { - this.onStart(); - - if (id == TheatreConstant.VERZIK_ID_P1) - { - this.versikCounter = 19; - } - else if (id == TheatreConstant.VERZIK_ID_P2) - { - this.versikCounter = 3; - } - else if (id == TheatreConstant.VERZIK_ID_P3) - { - this.versikCounter = -1; - this.attacksLeft = 9; - } - } - } - } - - public void onAnimationChanged(AnimationChanged event) - { - if (plugin.getRoom() != TheatreRoom.VERSIK) - { - return; - } - - Actor actor = event.getActor(); - if (!(actor instanceof NPC)) - { - return; - } - - NPC npc = (NPC) actor; - int id = npc.getId(); - - if (event.getActor().getAnimation() == 8117) - { - redCrabsTimer = 11; - } - - if (id == TheatreConstant.VERZIK_ID_P1) - { - int animation = npc.getAnimation(); - if (animation == TheatreConstant.ANIMATION_ID_P1_ATTACK) - { -// System.out.println("Verzik is shooting her attack on P1."); - versikCounter = 15; - } - } - else if (id == TheatreConstant.VERZIK_ID_P2) - { - int animation = npc.getAnimation(); - if (animation == TheatreConstant.ANIMATION_ID_P2_ATTACK_RANGE || animation == TheatreConstant.ANIMATION_ID_P2_ATTACK_MELEE) - { -// System.out.println("Verzik is shooting her attack on P2."); - versikCounter = 5; - } - else if (animation == TheatreConstant.ANIMATION_ID_P2_SHIELD) - { -// System.out.println("Verzik is healing on P2."); - versikCounter = 13; - } - } - } - - public void onGameTick() - { - if (plugin.getRoom() != TheatreRoom.VERSIK) - { - return; - } - if (!Verzik_RangeProjectiles.isEmpty()) - { - Verzik_RangeProjectiles.keySet().removeIf(p -> p.getRemainingCycles() < 1); - } - if (this.yellows == 0) - { - //if (this.autosSinceYellows > 0){ - for (GraphicsObject object : client.getGraphicsObjects()) - { - if (object.getId() == TheatreConstant.GRAPHIC_ID_YELLOWS) - { - this.yellows = 14; -// this.versikCounter = 22; - break; - } - } - //} - } - else - { - this.yellows--; - } - - if (npc != null && npc.getAnimation() == 8117) - { - redCrabsTimer = redCrabsTimer - 1; - } - - - boolean foundVerzik = false; - boolean foundTornado = false; - - for (NPC npc : client.getNpcs()) - { - if (npc.getName() != null && npc.getName().equals("Verzik Vitur")) - { - foundVerzik = true; - this.npc = npc; - } - else if (npc.getId() == TheatreConstant.NPC_ID_TORNADO) - { - foundTornado = true; - } - - if (foundTornado && foundVerzik) - { - break; - } - } - - if (!foundVerzik) - { - this.onStop(); - return; - } - - if (npc == null) - { - return; - } - - int id = npc.getId(); - - if (this.lastId != id) - { - this.lastId = id; - - if (id == TheatreConstant.VERZIK_ID_P1) - { - this.startTime = System.currentTimeMillis(); - } - else if (id == TheatreConstant.VERZIK_ID_P1_WALK && this.startTime != 0) - { - long elapsedTime = System.currentTimeMillis() - this.startTime; - long seconds = elapsedTime / 1000L; - - long minutes = seconds / 60L; - seconds = seconds % 60; - if (plugin.isExtraTimers()) - { - this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'The Final Challenge - Part 1' completed! Duration: " + minutes + ":" + twoDigitString(seconds), null); - } - } - else if (id == TheatreConstant.VERZIK_ID_P2_TRANSFORM && this.startTime != 0) - { - long elapsedTime = System.currentTimeMillis() - this.startTime; - long seconds = elapsedTime / 1000L; - - long minutes = seconds / 60L; - seconds = seconds % 60; - - this.versikCounter = -1; - this.attacksLeft = 9; - if (plugin.isExtraTimers()) - { - this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'The Final Challenge - Part 2' completed! Duration: " + minutes + ":" + twoDigitString(seconds), null); - } - } - } - - if (id == TheatreConstant.VERZIK_ID_P3_BAT) - { - this.onStop(); - return; - } - else if (id == TheatreConstant.VERZIK_ID_P1_WALK) - { - versikCounter = 4; - return; - } - - if (id == TheatreConstant.VERZIK_ID_P1 || id == TheatreConstant.VERZIK_ID_P2) - { - versikCounter--; - if (versikCounter < 0) - { - versikCounter = 0; - } - } - else if (id == TheatreConstant.VERZIK_ID_P3) - { - if (foundTornado && !this.tornados) - { - this.tornados = true; - } - - boolean isGreenBall = false; - for (Projectile projectile : client.getProjectiles()) - { - if (projectile.getId() == TheatreConstant.PROJECTILE_ID_P3_GREEN) - { - isGreenBall = projectile.getRemainingCycles() > 210; - break; - } - } - - versikCounter--; - - int animation = npc.getAnimation(); - - switch (animation) - { - case TheatreConstant.ANIMATION_ID_P3_MELEE: - case TheatreConstant.ANIMATION_ID_P3_MAGE: - if (versikCounter < 2) - { - this.attacksLeft--; - if (this.tornados) - { - versikCounter = 5; - } - else - { - versikCounter = 7; - } - - if (attacksLeft < 1) - { - versikCounter = 24; - } - } - break; - case TheatreConstant.ANIMATION_ID_P3_RANGE: - if (versikCounter < 2) - { - attacksLeft--; - if (this.tornados) - { - versikCounter = 5; - } - else - { - versikCounter = 7; - } - - if (attacksLeft < 1) - { - versikCounter = 30; - } - - if (isGreenBall) - { - versikCounter = 12; - } - } - break; - case TheatreConstant.ANIMATION_ID_P3_WEB: - attacksLeft = 4; - versikCounter = 11; - break; - case TheatreConstant.ANIMATION_ID_P3_YELLOW: - attacksLeft = 14; - versikCounter = 11; - break; - } - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloHandler.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloHandler.java deleted file mode 100644 index 538e36112b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloHandler.java +++ /dev/null @@ -1,458 +0,0 @@ -package net.runelite.client.plugins.theatre.rooms.nylocas; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Font; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.Shape; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.menus.AbstractComparableEntry; -import net.runelite.client.menus.MenuManager; -import net.runelite.client.plugins.theatre.RoomHandler; -import net.runelite.client.plugins.theatre.TheatreConstant; -import net.runelite.client.plugins.theatre.TheatrePlugin; -import net.runelite.client.plugins.theatre.TheatreRoom; - -@Slf4j -public class NyloHandler extends RoomHandler -{ - private static final String MESNAME = "tobmes"; - final List waveSpawns = new ArrayList<>(); - final List waveAgros = new ArrayList<>(); - private final MenuManager menuManager; - private final EventBus eventBus; - public long startTime = 0L; - int startTick = 0; - @Getter(AccessLevel.PUBLIC) - private Map pillars = new HashMap<>(); - @Getter(AccessLevel.PUBLIC) - private Map spiders = new HashMap<>(); - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private int wave = 0; - private NyloOverlay overlay = null; - private NyloPredictor predictor = null; - - public NyloHandler(final Client client, final TheatrePlugin plugin, final MenuManager menuManager, final EventBus eventBus) - { - super(client, plugin); - this.menuManager = menuManager; - this.eventBus = eventBus; - } - - @Override - public void onStart() - { - if (this.plugin.getRoom() == TheatreRoom.NYLOCAS) - { - return; - } - - this.reset(); - - this.plugin.setRoom(TheatreRoom.NYLOCAS); - if (overlay == null && plugin.isShowNylocasAmount()) - { - overlay = new NyloOverlay(client, plugin, this); - plugin.getOverlayManager().add(overlay); - } - - this.startTime = System.currentTimeMillis(); - this.startTick = this.client.getTickCount(); - if (plugin.isNylocasMenuSwap()) - { - eventBus.subscribe(MenuOptionClicked.class, MESNAME, this::onMenuOptionClicked); - } - - } - - @Override - public void onStop() - { - this.reset(); - - this.plugin.setRoom(TheatreRoom.UNKNOWN); - - if (overlay != null) - { - plugin.getOverlayManager().remove(overlay); - overlay = null; - } - - this.predictor = null; - - long elapsedTime = System.currentTimeMillis() - this.startTime; - long seconds = elapsedTime / 1000L; - - long minutes = seconds / 60L; - seconds = seconds % 60; - - if (this.startTime != 0 && plugin.isExtraTimers()) - { - this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'The Nylocas - Waves' " + - "completed! Duration: " + minutes + ":" + twoDigitString(seconds), null); - } - } - - private void reset() - { - this.pillars.clear(); - this.spiders.clear(); - this.wave = 0; - this.predictor = new NyloPredictor(client, this); - this.waveSpawns.clear(); - this.waveAgros.clear(); - this.predictor.reset(); - menuManager.removeSwaps("Nylocas Hagios", "Nylocas Toxobolos", "Nylocas Ischyros"); - } - - public void onConfigChanged() - { - if (plugin.isNylocasMenuSwap()) - { - eventBus.subscribe(MenuOptionClicked.class, MESNAME, this::onMenuOptionClicked); - } - else - { - eventBus.unregister(MESNAME); - reset(); - } - if (plugin.getRoom() != TheatreRoom.NYLOCAS) - { - return; - } - - if (overlay == null && plugin.isShowNylocasAmount()) - { - overlay = new NyloOverlay(client, plugin, this); - plugin.getOverlayManager().add(overlay); - } - else if (overlay != null && !plugin.isShowNylocasAmount()) - { - plugin.getOverlayManager().remove(overlay); - overlay = null; - } - } - - private Color healthColorCode(int health) - { - health = Math.max(health, 0); - health = Math.min(health, 100); - - double rMod = 130.0 * health / 100.0; - double gMod = 255.0 * health / 100.0; - double bMod = 125.0 * health / 100.0; - - return new Color((int) (255 - rMod), (int) (0 + gMod), (int) (0 + bMod)); - } - - public void render(Graphics2D graphics) - { - if (plugin.isShowNyloPillarHealth()) - { - for (Map.Entry pillars : pillars.entrySet()) - { - final int health = pillars.getValue(); - final String healthStr = health + "%"; - WorldPoint p = pillars.getKey().getWorldLocation(); - LocalPoint lp = LocalPoint.fromWorld(client, p.getX() + 1, p.getY() + 1); - - Color c = this.healthColorCode(health); - Point canvasPoint = null; - if (lp != null) - { - canvasPoint = Perspective.localToCanvas(client, lp, client.getPlane(), 65); - } - renderTextLocation(graphics, healthStr, 13, Font.BOLD, c, canvasPoint); - } - } - - switch (plugin.getShowNylocasExplosions()) - { - case TILE: - for (Map.Entry spiders : spiders.entrySet()) - { - int ticksLeft = spiders.getValue(); - if (ticksLeft > -1 && ticksLeft < 6) - { - Color color = new Color(255, 255, 0, 180); - int outlineWidth = 2; - int outlineAlpha = 150; - renderNpcOverlay(graphics, spiders.getKey(), color, outlineWidth, outlineAlpha, 15); - } - } - break; - case TIMER: - for (NPC npc : spiders.keySet()) - { - int ticksLeft = spiders.get(npc); - if (ticksLeft > -1 && ticksLeft < 15) - { - String str = Integer.toString(ticksLeft); - LocalPoint lp = npc.getLocalLocation(); - Point point = Perspective.getCanvasTextLocation(client, graphics, lp, str, 0); - renderTextLocation(graphics, str, 13, Font.BOLD, this.healthColorCode(ticksLeft), point); - } - } - break; - case NONE: - break; - } - - Set toHighlight = new HashSet<>(); - - if (plugin.isHighlightNyloAgros()) - { - for (NPC npc : new ArrayList<>(this.waveAgros)) - { - try - { - if (npc.getHealthRatio() == 0 || npc.isDead()) - { - this.waveAgros.remove(npc); - continue; - } - - toHighlight.add(npc); - } - catch (Exception ignored) - { - - } - } - } - - for (NPC npc : toHighlight) - { - try - { - Shape objectClickbox = npc.getConvexHull(); - - Color color; - String name = npc.getName() != null ? npc.getName() : ""; - - if (name.contains("Hagios")) - { - color = Color.CYAN; - } - else if (name.contains("Toxobolos")) - { - color = Color.GREEN; - } - else - { - color = Color.LIGHT_GRAY; - } - - graphics.setColor(color); - graphics.draw(objectClickbox); - } - catch (Exception ignored) - { - - } - } - } - - public void onNpcSpawned(NpcSpawned event) - { - NPC npc = event.getNpc(); - int id = npc.getId(); - - if (id == TheatreConstant.NPC_ID_NYLOCAS_PILLAR) - { - this.onStart(); - this.pillars.put(npc, 100); - this.recalculateLocal(); - } - else if (npc.getName() != null && this.plugin.getRoom() == TheatreRoom.NYLOCAS) - { - Pattern p = Pattern.compile("Nylocas (Hagios|Toxobolos|Ischyros)"); - Matcher m = p.matcher(npc.getName()); - if (m.matches()) - { - this.spiders.put(npc, 52); - - if (this.predictor != null) - { - this.predictor.onNpcSpawned(event); - } - } - else if (npc.getName().equals("Nylocas Vasilias")) - { - this.onStop(); - } - } - } - - public void onNpcDespawned(NpcDespawned event) - { - NPC npc = event.getNpc(); - int id = npc.getId(); - - this.waveSpawns.remove(npc); - - this.waveAgros.remove(npc); - - if (id == TheatreConstant.NPC_ID_NYLOCAS_PILLAR) - { - this.pillars.remove(npc); - } - else if (npc.getName() != null && this.plugin.getRoom() == TheatreRoom.NYLOCAS) - { - Pattern p = Pattern.compile("Nylocas (Hagios|Toxobolos|Ischyros)"); - Matcher m = p.matcher(npc.getName()); - if (m.matches()) - { - this.spiders.remove(npc); - } - } - } - - 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); - } - } - - public void onGameTick() - { - if (plugin.getRoom() != TheatreRoom.NYLOCAS) - { - return; - } - else - { - boolean findPillar = false; - - for (NPC npc : client.getNpcs()) - { - if (npc.getId() == 8358) - { - findPillar = true; - break; - } - } - - if (!findPillar) - { - this.onStop(); - return; - } - } - - for (NPC spider : new ArrayList<>(spiders.keySet())) - { - int ticksLeft = spiders.get(spider); - - if (ticksLeft < 0) - { - spiders.remove(spider); - continue; - } - - spiders.replace(spider, ticksLeft - 1); - } - - this.recalculateLocal(); - for (NPC pillar : pillars.keySet()) - { - int healthPercent = pillar.getHealthRatio(); - if (healthPercent > -1) - { - pillars.replace(pillar, healthPercent); - } - } - } - - private void onMenuOptionClicked(MenuOptionClicked event) - { - final String option = event.getOption().toLowerCase(); - - if (!option.equals("equip") && !option.equals("wield") && !option.equals("hold")) - { - return; - } - - final int id = event.getIdentifier(); - final Set entries = Weapons.getEntries(id); - menuManager.removeSwaps("Nylocas Hagios", "Nylocas Toxobolos", "Nylocas Ischyros"); - - if (entries.isEmpty()) - { - return; - } - - entries.forEach(menuManager::addHiddenEntry); - } - - private void recalculateLocal() - { - if (this.pillars != null && this.pillars.size() == 4) - { - int minX = Integer.MAX_VALUE; - int minY = Integer.MAX_VALUE; - for (NPC npc : pillars.keySet()) - { - LocalPoint lp = npc.getLocalLocation(); - - if (lp.getSceneX() < minX) - { - minX = lp.getSceneX(); - } - - if (lp.getSceneY() < minY) - { - minY = lp.getSceneY(); - } - } - - int centerX = minX + 5; - int centerY = minY + 5; - - if (this.predictor != null) - { - this.predictor.southBound = centerY - 12; - this.predictor.eastBound = centerX + 13; - this.predictor.westBound = centerX - 12; - } - } - } - - private enum AttackStyle - { - MELEE, - MAGE, - RANGE, - RANGE2H - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloOverlay.java deleted file mode 100644 index cd1c2f53e5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloOverlay.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2018, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.theatre.rooms.nylocas; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.NPC; -import net.runelite.client.plugins.theatre.TheatrePlugin; -import net.runelite.client.plugins.theatre.TheatreRoom; -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; -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; -import net.runelite.client.util.ColorUtil; - -class NyloOverlay extends Overlay -{ - - private final Client client; - - private final TheatrePlugin plugin; - private final PanelComponent panelComponent = new PanelComponent(); - - private final NyloHandler nylohandler; - - NyloOverlay(final Client client, final TheatrePlugin plugin, final NyloHandler nylohandler) - { - super(plugin); - - setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT); - setPriority(OverlayPriority.HIGH); - - this.client = client; - this.plugin = plugin; - this.nylohandler = nylohandler; - - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Nylocas Overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.getRoom() != TheatreRoom.NYLOCAS) - { - return null; - } - - int hagios = 0; - int toxobolos = 0; - int ischyros = 0; - - for (NPC npc : this.client.getNpcs()) - { - String name = npc.getName(); - if (name != null) - { - switch (name) - { - case "Nylocas Hagios": - hagios++; - break; - case "Nylocas Toxobolos": - toxobolos++; - break; - case "Nylocas Ischyros": - ischyros++; - break; - } - } - } - - panelComponent.getChildren().clear(); - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - int nyloCount = (hagios + toxobolos + ischyros); - if (nylohandler.getWave() < 21) - { - if (nyloCount > 12) - { - tableComponent.addRow("Total Nylocas:", ColorUtil.prependColorTag(nyloCount + " / 12", Color.RED)); - } - else - { - tableComponent.addRow("Total Nylocas:", ColorUtil.prependColorTag(nyloCount + " / 12", Color.GREEN)); - } - - } - else - { - if (nyloCount > 24) - { - tableComponent.addRow("Total Nylocas:", ColorUtil.prependColorTag(nyloCount + " / 24", Color.RED)); - } - else - { - tableComponent.addRow("Total Nylocas:", ColorUtil.prependColorTag(nyloCount + " / 24", Color.GREEN)); - } - } - - 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/theatre/rooms/nylocas/NyloPredictor.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloPredictor.java deleted file mode 100644 index 13447b917d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/NyloPredictor.java +++ /dev/null @@ -1,497 +0,0 @@ -package net.runelite.client.plugins.theatre.rooms.nylocas; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.events.NpcSpawned; - -public class NyloPredictor -{ - - private static final Wave[] NYLOCAS_WAVES = new Wave[] - { - new Wave(new Nylocas(NylocasType.RANGE_162, Spawn.WEST), new Nylocas(NylocasType.MAGE_162, Spawn.SOUTH), new Nylocas(NylocasType.MELEE_162, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MAGE_162, Spawn.WEST), new Nylocas(NylocasType.MELEE_162, Spawn.SOUTH), new Nylocas(NylocasType.RANGE_162, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MELEE_162, Spawn.WEST), new Nylocas(NylocasType.RANGE_162, Spawn.SOUTH), new Nylocas(NylocasType.MAGE_162, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.RANGE_162, Spawn.WEST), new Nylocas(NylocasType.MAGE_260, Spawn.SOUTH), new Nylocas(NylocasType.MELEE_162, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.RANGE_260, Spawn.WEST), new Nylocas(NylocasType.MELEE_162, Spawn.SOUTH), new Nylocas(NylocasType.MAGE_162, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MAGE_162, Spawn.WEST), new Nylocas(NylocasType.RANGE_162, Spawn.SOUTH), new Nylocas(NylocasType.MELEE_260, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.RANGE_260, Spawn.SOUTH), new Nylocas(NylocasType.MAGE_162, Spawn.SOUTH), new Nylocas(NylocasType.MELEE_162, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MAGE_260, Spawn.WEST), new Nylocas(NylocasType.MELEE_162, Spawn.SOUTH), new Nylocas(NylocasType.RANGE_162, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MELEE_162, Spawn.WEST), new Nylocas(NylocasType.RANGE_260, Spawn.WEST), new Nylocas(NylocasType.MAGE_162, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.RANGE_162, Spawn.WEST), new Nylocas(NylocasType.RANGE_162, Spawn.WEST), new Nylocas(NylocasType.RANGE_162, Spawn.SOUTH), new Nylocas(NylocasType.RANGE_162, Spawn.SOUTH), new Nylocas(NylocasType.RANGE_260, Spawn.EAST), new Nylocas(NylocasType.RANGE_162, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MAGE_260, Spawn.WEST), new Nylocas(NylocasType.MAGE_162, Spawn.SOUTH), new Nylocas(NylocasType.MAGE_162, Spawn.SOUTH), new Nylocas(NylocasType.MAGE_162, Spawn.EAST), new Nylocas(NylocasType.MAGE_162, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MELEE_162, Spawn.WEST), new Nylocas(NylocasType.MELEE_162, Spawn.WEST), new Nylocas(NylocasType.MELEE_260, Spawn.SOUTH), new Nylocas(NylocasType.MELEE_162, Spawn.EAST), new Nylocas(NylocasType.MELEE_162, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.RANGE_162, Spawn.WEST), new Nylocas(NylocasType.MAGE_162, Spawn.WEST), new Nylocas(NylocasType.MELEE_162, Spawn.SOUTH), new Nylocas(NylocasType.RANGE_162, Spawn.SOUTH), new Nylocas(NylocasType.MELEE_260, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MAGE_162, Spawn.WEST), new Nylocas(NylocasType.MELEE_162, Spawn.WEST), new Nylocas(NylocasType.RANGE_162, Spawn.SOUTH), new Nylocas(NylocasType.MAGE_162, Spawn.SOUTH), new Nylocas(NylocasType.RANGE_260, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MELEE_162, Spawn.WEST), new Nylocas(NylocasType.RANGE_162, Spawn.WEST), new Nylocas(NylocasType.MAGE_260, Spawn.SOUTH), new Nylocas(NylocasType.RANGE_162, Spawn.EAST), new Nylocas(NylocasType.MAGE_162, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.RANGE_162, Spawn.WEST), new Nylocas(NylocasType.MELEE_162, Spawn.SOUTH), new Nylocas(NylocasType.MAGE_162, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MAGE_260, Spawn.WEST), new Nylocas(NylocasType.MAGE_260, Spawn.SOUTH), new Nylocas(NylocasType.MAGE_260, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.RANGE_260, Spawn.WEST), new Nylocas(NylocasType.RANGE_260, Spawn.SOUTH), new Nylocas(NylocasType.RANGE_260, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MAGE_260, Spawn.WEST), new Nylocas(NylocasType.MAGE_260, Spawn.SOUTH), new Nylocas(NylocasType.MAGE_260, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MELEE_260, Spawn.WEST), new Nylocas(NylocasType.MAGE_260, Spawn.SOUTH), new Nylocas(NylocasType.MELEE_260, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MAGE_162, Spawn.WEST), new Nylocas(NylocasType.MAGE_162, Spawn.WEST), new Nylocas(NylocasType.MELEE_162, Spawn.SOUTH), new Nylocas(NylocasType.MELEE_162, Spawn.SOUTH), new Nylocas(NylocasType.RANGE_162, Spawn.EAST), new Nylocas(NylocasType.RANGE_162, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MELEE_260, Spawn.WEST), new Nylocas(NylocasType.MAGE_162, Spawn.SOUTH), new Nylocas(NylocasType.RANGE_162, Spawn.SOUTH), new Nylocas(NylocasType.MAGE_260, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MAGE_162, Spawn.WEST), new Nylocas(NylocasType.RANGE_162, Spawn.WEST), new Nylocas(NylocasType.RANGE_260, Spawn.SOUTH), new Nylocas(NylocasType.MAGE_260, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.RANGE_260, Spawn.WEST), new Nylocas(NylocasType.MAGE_260, Spawn.SOUTH), new Nylocas(NylocasType.MELEE_260, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MELEE_260, Spawn.WEST), new Nylocas(NylocasType.RANGE_260, Spawn.SOUTH), new Nylocas(NylocasType.MAGE_260, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MAGE_260, Spawn.WEST), new Nylocas(NylocasType.MELEE_260, Spawn.SOUTH), new Nylocas(NylocasType.MAGE_260, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MAGE_260, Spawn.WEST), new Nylocas(NylocasType.MELEE_260, Spawn.SOUTH), new Nylocas(NylocasType.MAGE_260, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MELEE_162, Spawn.WEST), new Nylocas(NylocasType.RANGE_162, Spawn.WEST), new Nylocas(NylocasType.MAGE_162, Spawn.SOUTH), new Nylocas(NylocasType.MELEE_162, Spawn.SOUTH), new Nylocas(NylocasType.RANGE_162, Spawn.EAST), new Nylocas(NylocasType.MAGE_162, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MELEE_162, Spawn.WEST), new Nylocas(NylocasType.RANGE_162, Spawn.WEST), new Nylocas(NylocasType.MELEE_260, Spawn.SOUTH), new Nylocas(NylocasType.RANGE_162, Spawn.EAST), new Nylocas(NylocasType.MAGE_162, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.RANGE_260, Spawn.WEST), new Nylocas(NylocasType.MAGE_162, Spawn.SOUTH), new Nylocas(NylocasType.MELEE_162, Spawn.SOUTH), new Nylocas(NylocasType.MAGE_260, Spawn.EAST)), - new Wave(new Nylocas(NylocasType.MELEE_162, Spawn.WEST), new Nylocas(NylocasType.RANGE_162, Spawn.WEST), new Nylocas(NylocasType.MAGE_162, Spawn.SOUTH), new Nylocas(NylocasType.MELEE_162, Spawn.SOUTH), new Nylocas(NylocasType.RANGE_162, Spawn.EAST), new Nylocas(NylocasType.MAGE_162, Spawn.EAST)) - }; - private final Client client; - int westBound = 50; - int eastBound = 77; - int southBound = 42; - private final NyloHandler handler; - private final Map currentSpawns = new HashMap<>(); - private int currentIndex = -1; - - NyloPredictor(Client client, NyloHandler handler) - { - this.client = client; - this.handler = handler; - this.reset(); - } - - public void reset() - { - this.currentSpawns.clear(); - this.currentIndex = -1; - } - - public void onNpcSpawned(NpcSpawned event) - { - NPC npc = event.getNpc(); - - LocalPoint lp = npc.getLocalLocation(); - - int x = lp.getSceneX(); - int y = lp.getSceneY(); - - Spawn spawn = null; - if (x <= westBound) - { - spawn = Spawn.WEST; - } - else if (x >= eastBound) - { - spawn = Spawn.EAST; - } - else if (y <= southBound) - { - spawn = Spawn.SOUTH; - } - - NylocasType type = null; - - String name = npc.getName(); - int level = npc.getCombatLevel(); - - if (name.contains("Hagios")) - { - type = NylocasType.valueOf("MAGE_" + level); - } - else if (name.contains("Toxobolos")) - { - type = NylocasType.valueOf("RANGE_" + level); - } - else if (name.contains("Ischyros")) - { - type = NylocasType.valueOf("MELEE_" + level); - } - - if (spawn == null || type == null) - { - return; - } - - currentSpawns.put(new Nylocas(type, spawn), npc); - this.checkSpawns(); - } - - private void checkSpawns() - { - for (int i = (currentIndex + 1); i < NYLOCAS_WAVES.length; i++) - { - Wave checkWave = NYLOCAS_WAVES[i]; - - List queue = new ArrayList<>(currentSpawns.keySet()); - HashMap npcs = new HashMap<>(); - - boolean found = true; - for (Nylocas nylocas : checkWave.getSpawns()) - { - if (queue.contains(nylocas)) - { - int index = queue.indexOf(nylocas); - Nylocas hashed = queue.remove(index); - npcs.put(currentSpawns.get(hashed), hashed); - } - else - { - found = false; - break; - } - } - - if (found) - { - currentIndex = i; - currentSpawns.clear(); - - handler.setWave(currentIndex); - - for (Map.Entry nylocas : npcs.entrySet()) - { - Nylocas nylo = nylocas.getValue(); - - if (!this.handler.waveSpawns.contains(nylocas.getKey())) - { - this.handler.waveSpawns.add(nylocas.getKey()); - } - - if (this.isAgressive(nylo.getType(), nylo.getSpawn(), currentIndex) && !this.handler.waveAgros.contains(nylocas.getKey())) - { - this.handler.waveAgros.add(nylocas.getKey()); - } - } - - int elapsedTicks = client.getTickCount() - this.handler.startTick; - - int mage_count = 0; - int range_count = 0; - int melee_count = 0; - - int mage_level = 0; - int range_level = 0; - int melee_level = 0; - - for (NPC npc : client.getNpcs()) - { - if (npc.getHealthRatio() == 0) - { - continue; - } - if (npc.getName().equalsIgnoreCase("Nylocas Hagios")) - { - mage_level += npc.getCombatLevel(); - mage_count += 1; - } - else if (npc.getName().equalsIgnoreCase("Nylocas Toxobolos")) - { - range_level += npc.getCombatLevel(); - range_count += 1; - } - else if (npc.getName().equalsIgnoreCase("Nylocas Ischyros")) - { - melee_level += npc.getCombatLevel(); - melee_count += 1; - } - } - - for (Nylocas nylocas : checkWave.getSpawns()) - { - NylocasType type = nylocas.getType(); - if (type.name().contains("RANGE")) - { - range_count--; - range_level -= Integer.parseInt(type.name().split("_")[1]); - } - else if (type.name().contains("MAGE")) - { - mage_count--; - mage_level -= Integer.parseInt(type.name().split("_")[1]); - } - else if (type.name().contains("MELEE")) - { - melee_count--; - melee_level -= Integer.parseInt(type.name().split("_")[1]); - } - } - - } - } - } - - private boolean isAgressive(NylocasType type, Spawn spawn, int wave) - { - if (wave == 0 && spawn == Spawn.WEST) - { - return true; - } - else if (wave == 1 && spawn == Spawn.SOUTH) - { - return true; - } - else if (wave == 2 && spawn == Spawn.EAST) - { - return true; - } - else if (wave == 6 && spawn == Spawn.SOUTH && type == NylocasType.RANGE_260) - { - return true; - } - else if (wave == 7 && spawn == Spawn.WEST) - { - return true; - } - else if (wave == 8 && spawn == Spawn.WEST && type == NylocasType.RANGE_260) - { - return true; - } - else if (wave == 9) - { - if (spawn == Spawn.EAST && type == NylocasType.RANGE_162) - { - return true; - } - else - { - return spawn == Spawn.WEST; - } - } - else if (wave == 10 && (spawn == Spawn.EAST || spawn == Spawn.WEST)) - { - return true; - } - else if (wave == 11 && (spawn == Spawn.EAST || spawn == Spawn.WEST)) - { - return true; - } - else if (wave == 12) - { - if (spawn == Spawn.WEST && type == NylocasType.MAGE_162) - { - return true; - } - else - { - return spawn == Spawn.EAST; - } - } - else if (wave == 13) - { - if (spawn == Spawn.WEST && type == NylocasType.MELEE_162) - { - return true; - } - else - { - return spawn == Spawn.EAST; - } - } - else if (wave == 14) - { - if (spawn == Spawn.WEST && type == NylocasType.RANGE_162) - { - return true; - } - else - { - return spawn == Spawn.EAST && type == NylocasType.MAGE_162; - } - } - else if (wave == 17 && spawn == Spawn.WEST) - { - return true; - } - else if (wave == 18 && spawn == Spawn.EAST) - { - return true; - } - else if (wave == 19 && spawn == Spawn.SOUTH) - { - return true; - } - else if (wave == 20 && (spawn == Spawn.EAST || spawn == Spawn.SOUTH)) - { - return true; - } - else if (wave == 21 && spawn == Spawn.EAST) - { - return true; - } - else if (wave == 22 && spawn == Spawn.SOUTH) - { - return true; - } - else if (wave == 23) - { - return true; - } - else if ((wave == 24 || wave == 25) && spawn == Spawn.WEST) - { - return true; - } - else if (wave == 26 && spawn == Spawn.SOUTH) - { - return true; - } - else if (wave == 27 && spawn == Spawn.WEST && type == NylocasType.RANGE_162) - { - return true; - } - else if (wave == 28) - { - if (spawn == Spawn.EAST && type == NylocasType.RANGE_162) - { - return true; - } - else - { - return spawn == Spawn.WEST && type == NylocasType.MELEE_162; - } - - } - else - { - return wave == 29 && spawn == Spawn.EAST; - } - - } - - public int getCurrentWave() - { - return this.currentIndex + 1; - } - - public int getTotalWaves() - { - return NyloPredictor.NYLOCAS_WAVES.length; - } - - public Wave getNextWave() - { - if ((currentIndex + 1) < NYLOCAS_WAVES.length) - { - return NYLOCAS_WAVES[currentIndex + 1]; - } - else - { - return null; - } - } - - public String getSpawnStr(Spawn spawn, Wave wave) - { - if (wave == null || spawn == null) - { - return null; - } - else - { - StringBuilder types = new StringBuilder(); - - for (Nylocas nylo : wave.getSpawns()) - { - if (nylo.getSpawn() == spawn) - { - if (types.length() > 0) - { - types.append(", "); - } - - switch (nylo.getType()) - { - case MAGE_162: - types.append("Small Mage"); - break; - case MAGE_260: - types.append("Big Mage"); - break; - case MELEE_162: - types.append("Small Melee"); - break; - case MELEE_260: - types.append("Big Melee"); - break; - case RANGE_162: - types.append("Small Range"); - break; - case RANGE_260: - types.append("Big Range"); - break; - } - } - } - - return types.length() > 0 ? types.toString() : null; - } - } - - public enum NylocasType - { - MELEE_162, - RANGE_162, - MAGE_162, - MELEE_260, - RANGE_260, - MAGE_260 - } - - public enum Spawn - { - WEST, - SOUTH, - EAST - } - - static class Nylocas - { - - private final NylocasType type; - private final Spawn spawn; - - Nylocas(NylocasType type, Spawn spawn) - { - this.type = type; - this.spawn = spawn; - } - - NylocasType getType() - { - return this.type; - } - - Spawn getSpawn() - { - return this.spawn; - } - - @Override - public boolean equals(Object object) - { - if ((object instanceof Nylocas)) - { - Nylocas nylo = (Nylocas) object; - return nylo.getType() == this.type && nylo.getSpawn() == this.spawn; - } - - return false; - } - } - - public static class Wave - { - - private final Nylocas[] spawns; - - Wave(Nylocas... nylocas) - { - this.spawns = nylocas; - } - - Nylocas[] getSpawns() - { - return this.spawns; - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/Weapons.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/Weapons.java deleted file mode 100644 index 6883fe0840..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/nylocas/Weapons.java +++ /dev/null @@ -1,72 +0,0 @@ -package net.runelite.client.plugins.theatre.rooms.nylocas; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import javax.annotation.Nullable; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.ItemID; -import net.runelite.client.menus.AbstractComparableEntry; -import net.runelite.client.menus.ComparableEntries; - -@Getter(AccessLevel.PACKAGE) -@AllArgsConstructor -public enum Weapons -{ - MELEE(ImmutableSet.of(ItemID.ABYSSAL_WHIP, ItemID.ABYSSAL_TENTACLE, ItemID.SCYTHE_OF_VITUR, - ItemID.SCYTHE_OF_VITUR_22664, ItemID.SCYTHE_OF_VITUR_UNCHARGED, ItemID.HAM_JOINT, ItemID.SWIFT_BLADE, - ItemID.BANDOS_GODSWORD, ItemID.BANDOS_GODSWORD_20782, ItemID.BANDOS_GODSWORD_21060, ItemID.BANDOS_GODSWORD_OR, - ItemID.DRAGON_WARHAMMER, ItemID.DRAGON_CLAWS, ItemID.EVENT_RPG, ItemID.GHRAZI_RAPIER, ItemID.GHRAZI_RAPIER_23628, - ItemID.BLADE_OF_SAELDOR, ItemID.CRYSTAL_HALBERD, ItemID.DRAGON_SCIMITAR, ItemID.RUNE_SCIMITAR, ItemID.BLADE_OF_SAELDOR_23996, - ItemID.BLADE_OF_SAELDOR_INACTIVE, ItemID.BLADE_OF_SAELDOR_INACTIVE_23999), - ImmutableSet.of(ComparableEntries.newBaseComparableEntry("Attack", "Nylocas Hagios"), - ComparableEntries.newBaseComparableEntry("Attack", "Nylocas Toxobolos")) - ), - MAGE(ImmutableSet.of(ItemID.KODAI_WAND, ItemID.MASTER_WAND, ItemID.TRIDENT_OF_THE_SEAS, - ItemID.TRIDENT_OF_THE_SWAMP, ItemID.SANGUINESTI_STAFF, ItemID.IBANS_STAFF, ItemID.IBANS_STAFF_1410, - ItemID.IBANS_STAFF_U, ItemID.TRIDENT_OF_THE_SWAMP_E, ItemID.TRIDENT_OF_THE_SEAS_E), - ImmutableSet.of(ComparableEntries.newBaseComparableEntry("Attack", "Nylocas Ischyros"), - ComparableEntries.newBaseComparableEntry("Attack", "Nylocas Toxobolos")) - ), - RANGE(ImmutableSet.of(ItemID.TOXIC_BLOWPIPE, ItemID.TWISTED_BOW, ItemID.CRAWS_BOW, - ItemID.RED_CHINCHOMPA, ItemID.CHINCHOMPA, ItemID.BLACK_CHINCHOMPA, ItemID.ARMADYL_CROSSBOW, - ItemID.DRAGON_CROSSBOW, ItemID.RUNE_CROSSBOW, ItemID.DORGESHUUN_CROSSBOW), - ImmutableSet.of(ComparableEntries.newBaseComparableEntry("Attack", "Nylocas Hagios"), - ComparableEntries.newBaseComparableEntry("Attack", "Nylocas Ischyros")) - ); - - private final Set ids; - private final Set entries; - private static final Map, Set> map; - - static - { - final ImmutableMap.Builder, Set> builder = new ImmutableMap.Builder<>(); - for (Weapons weps : Weapons.values()) - { - builder.put(weps.getIds(), weps.getEntries()); - } - map = builder.build(); - } - - @Nullable - static Set getEntries(int id) - { - final Set entries = new HashSet<>(); - - for (Map.Entry, Set> entry : map.entrySet()) - { - if (entry.getKey().contains(id)) - { - entries.addAll(entry.getValue()); - break; - } - } - - return entries; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/xarpus/XarpusCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/xarpus/XarpusCounter.java deleted file mode 100644 index 1c9026a44f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/xarpus/XarpusCounter.java +++ /dev/null @@ -1,63 +0,0 @@ -package net.runelite.client.plugins.theatre.rooms.xarpus; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.client.plugins.theatre.TheatrePlugin; -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.TableAlignment; -import net.runelite.client.ui.overlay.components.table.TableComponent; - -class XarpusCounter extends Overlay -{ - private final PanelComponent panelComponent = new PanelComponent(); - private final XarpusHandler xarpusHandler; - - XarpusCounter(final TheatrePlugin plugin, final XarpusHandler xarpushandler) - { - super(plugin); - this.xarpusHandler = xarpushandler; - - setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Theatre xarpus overlay")); - - } - - @Override - public Dimension render(Graphics2D graphics) - { - - if (xarpusHandler.getNpc().getId() == 8339) - { - panelComponent.getChildren().clear(); - String overlayTitle = "Exhume Counter"; - - // Build overlay title - panelComponent.getChildren().add(TitleComponent.builder() - .text(overlayTitle) - .color(Color.GREEN) - .build()); - - //Set the size of overlay - panelComponent.setPreferredSize(new Dimension( - graphics.getFontMetrics().stringWidth(overlayTitle) + 30, 0 - )); - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - tableComponent.addRow("Exhumes", String.valueOf(xarpusHandler.getExhumesCount())); - - panelComponent.getChildren().add(tableComponent); - - return panelComponent.render(graphics); - } - - return null; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/xarpus/XarpusHandler.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/xarpus/XarpusHandler.java deleted file mode 100644 index 36c7cf918e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/rooms/xarpus/XarpusHandler.java +++ /dev/null @@ -1,291 +0,0 @@ -package net.runelite.client.plugins.theatre.rooms.xarpus; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Font; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GroundObject; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.Varbits; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.events.GroundObjectSpawned; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.events.VarbitChanged; -import net.runelite.client.plugins.theatre.RoomHandler; -import net.runelite.client.plugins.theatre.TheatreConstant; -import net.runelite.client.plugins.theatre.TheatrePlugin; -import net.runelite.client.plugins.theatre.TheatreRoom; - -public class XarpusHandler extends RoomHandler -{ - - private final Map exhumes = new HashMap<>(); - private int previousTurn; - private boolean staring; - private int ticksUntilShoot = 8; - - @Getter(AccessLevel.PUBLIC) - private NPC npc; - - private long startTime = 0; - private boolean up = false; - - @Getter(AccessLevel.PUBLIC) - private int exhumesCount; - private boolean xarpusFlag; - - private XarpusCounter overlay = null; - - public XarpusHandler(final Client client, final TheatrePlugin plugin) - { - super(client, plugin); - } - - @Override - public void onStart() - { - if (this.plugin.getRoom() == TheatreRoom.XARPUS) - { - return; - } - - this.reset(); - this.plugin.setRoom(TheatreRoom.XARPUS); - - if (overlay == null) - { - overlay = new XarpusCounter(plugin, this); - plugin.getOverlayManager().add(overlay); - } - } - - @Override - public void onStop() - { - this.reset(); - this.plugin.setRoom(TheatreRoom.UNKNOWN); - - if (overlay != null) - { - plugin.getOverlayManager().remove(overlay); - overlay = null; - } - } - - private void reset() - { - exhumesCount = 0; - xarpusFlag = false; - - npc = null; - staring = false; - ticksUntilShoot = 8; - previousTurn = 0; - this.startTime = 0; - this.up = false; - this.exhumes.clear(); - } - - public void render(Graphics2D graphics) - { - if (npc == null) - { - return; - } - - if (npc.getId() == NpcID.XARPUS_8340) //&& !staring&& config.showXarpusTick()) - { - if (!this.up) - { - this.up = true; - long elapsedTime = System.currentTimeMillis() - this.startTime; - long seconds = elapsedTime / 1000L; - - long minutes = seconds / 60L; - seconds = seconds % 60; - - this.ticksUntilShoot = 8; - if (plugin.isExtraTimers()) - { - this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'Xarpus - Recovery' completed! Duration: " + minutes + ":" + twoDigitString(seconds), null); - } - } - - final String ticksLeftStr = String.valueOf(ticksUntilShoot); - Point canvasPoint = npc.getCanvasTextLocation(graphics, ticksLeftStr, 130); - renderTextLocation(graphics, ticksLeftStr, 12, Font.BOLD, Color.WHITE, canvasPoint); - } - - if (npc.getId() == NpcID.XARPUS_8339 && plugin.isShowXarpusHeals()) - { - for (Map.Entry exhum : exhumes.entrySet()) - { - Polygon poly = exhum.getKey().getCanvasTilePoly(); - if (poly != null) - { - Color c = new Color(0, 255, 0, 130); - graphics.setColor(c); - graphics.setStroke(new BasicStroke(1)); - graphics.draw(poly); - - String count = Integer.toString(exhum.getValue() + 1); - LocalPoint lp = exhum.getKey().getLocalLocation(); - Point point = Perspective.getCanvasTextLocation(client, graphics, lp, count, 0); - if (point != null) - { - renderTextLocation(graphics, count, 14, Font.BOLD, Color.WHITE, point); - } - } - } - } - } - - public void onVarbitChanged(VarbitChanged event) - { - if ((client.getVar(Varbits.MULTICOMBAT_AREA) == 1 || - client.getVarbitValue(client.getVarps(), TheatreConstant.DOOR_VARP) == 2) && - !xarpusFlag) - { - int players = client.getPlayers().size(); - - if (players == 5) - { - exhumesCount = 18; - } - else if (players == 4) - { - exhumesCount = 15; - } - else if (players == 3) - { - exhumesCount = 12; - } - else if (players == 2) - { - exhumesCount = 9; - } - else - { - exhumesCount = 7; - } - - xarpusFlag = true; - } - } - - public void onNpcSpawned(NpcSpawned event) - { - NPC npc = event.getNpc(); - - if (npc.getName() != null && npc.getName().equals("Xarpus")) - { - this.onStart(); - this.npc = npc; - } - } - - public void onNpcDespawned(NpcDespawned event) - { - NPC npc = event.getNpc(); - - if (npc.getName() != null && npc.getName().equals("Xarpus")) - { - this.onStop(); - } - } - - public void onGroundObjectSpawned(GroundObjectSpawned event) - { - if (plugin.getRoom() != TheatreRoom.XARPUS) - { - return; - } - - GroundObject o = event.getGroundObject(); - if (o.getId() == TheatreConstant.GROUNDOBJECT_ID_EXHUMED) - { - if (this.startTime == 0) - { - this.startTime = System.currentTimeMillis() - 2000L; - } - -// exhumes.put(o, 18); - exhumes.put(o, 11); - } - } - - public void onGameTick() - { - if (plugin.getRoom() != TheatreRoom.XARPUS) - { - return; - } - - for (GroundObject key : new ArrayList<>(exhumes.keySet())) - { - int i = exhumes.get(key) - 1; - if (i >= 0) - { - exhumes.replace(key, i); - } - else - { - exhumes.remove(key); - this.exhumesCount--; - } - } - - if (npc.getOverheadText() != null) - { - if (!staring) - { - staring = true; - - long elapsedTime = System.currentTimeMillis() - this.startTime; - long seconds = elapsedTime / 1000L; - - long minutes = seconds / 60L; - seconds = seconds % 60; - if (plugin.isExtraTimers()) - { - this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'Xarpus - Acid' completed! Duration: " + minutes + ":" + twoDigitString(seconds), null); - } - } - - ticksUntilShoot = 6; - } - - ticksUntilShoot--; - ticksUntilShoot = Math.max(0, ticksUntilShoot); - if (ticksUntilShoot <= 0) - { - ticksUntilShoot = 4; - } - - if (previousTurn != npc.getOrientation()) - { - if (staring) - { - ticksUntilShoot = 8; - } - else - { - ticksUntilShoot = 4; - } - - previousTurn = npc.getOrientation(); - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/timers/RoomTimer.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/timers/RoomTimer.java deleted file mode 100644 index d0777a46f4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/timers/RoomTimer.java +++ /dev/null @@ -1,83 +0,0 @@ -package net.runelite.client.plugins.theatre.timers; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.Player; -import net.runelite.client.plugins.theatre.TheatrePlugin; -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; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -public class RoomTimer extends Overlay -{ - - private final Client client; - - private final TheatrePlugin plugin; - - private final PanelComponent panelComponent = new PanelComponent(); - - - @Inject - public RoomTimer(final Client client, final TheatrePlugin plugin) - { - super(plugin); - - setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT); - setPriority(OverlayPriority.HIGH); - - this.client = client; - this.plugin = plugin; - - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "TOB Timer Overlay")); - } - - - @Override - public Dimension render(Graphics2D graphics) - { - panelComponent.getChildren().clear(); - - Player local = client.getLocalPlayer(); - if (local == null || local.getName() == null) - { - return null; - } - - switch (plugin.getRoom()) - { - case MAIDEN: - plugin.getMaidenHandler().render(graphics); - break; - case BLOAT: - plugin.getBloatHandler().render(graphics); - break; - case NYLOCAS: - plugin.getNyloHandler().render(graphics); - break; - case SOTETSEG: - plugin.getSotetsegHandler().render(graphics); - break; - case XARPUS: - plugin.getXarpusHandler().render(graphics); - break; - case VERSIK: - plugin.getVerzikHandler().render(graphics); - break; - default: - break; - } - - panelComponent.getChildren().add(TitleComponent.builder().text("Room Timer").color(Color.WHITE).build()); - - return panelComponent.render(graphics); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/timers/Timeable.java b/runelite-client/src/main/java/net/runelite/client/plugins/theatre/timers/Timeable.java deleted file mode 100644 index 250fdca506..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/theatre/timers/Timeable.java +++ /dev/null @@ -1,8 +0,0 @@ -package net.runelite.client.plugins.theatre.timers; - -import java.util.Map; - -public interface Timeable -{ - Map getTimes(); -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/thieving/Chest.java b/runelite-client/src/main/java/net/runelite/client/plugins/thieving/Chest.java deleted file mode 100644 index ec2b374990..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/thieving/Chest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2019, whs - * 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.thieving; - -import com.google.common.collect.ImmutableMap; -import java.time.Duration; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ObjectID; - -enum Chest -{ - TEN_COIN(Duration.ofMillis(6000), ObjectID.CHEST_11735), - FIFTY_COIN(Duration.ofMillis(46000), ObjectID.CHEST_11737), - NATURE_RUNE(Duration.ofMillis(10000), ObjectID.CHEST_11736), - STEEL_ARROWTIPS(Duration.ofMillis(77000), ObjectID.CHEST_11742), - AVERAGE_CHEST(Duration.ofMillis(90000), ObjectID.CHEST_22697), - BLOOD_RUNE(Duration.ofMillis(120000), ObjectID.CHEST_11738), - ARDOUGNE_CASTLE(Duration.ofMillis(400000), ObjectID.CHEST_11739), // FIXME: Please time - RICH_CHEST(Duration.ofMillis(300000), ObjectID.CHEST_22681), // FIXME: Please time - ROGUE_CASTLE(Duration.ofMillis(10000), ObjectID.CHEST_26757); // FIXME: Please time - - private static final Map CHESTS; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - for (Chest chest : values()) - { - for (int id : chest.ids) - { - builder.put(id, chest); - } - } - CHESTS = builder.build(); - } - - @Getter(AccessLevel.PACKAGE) - private final Duration respawnTime; - private final int[] ids; - - Chest(Duration respawnTime, int... ids) - { - this.respawnTime = respawnTime; - this.ids = ids; - } - - static Chest of(int id) - { - return CHESTS.get(id); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/thieving/ChestOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/thieving/ChestOverlay.java deleted file mode 100644 index 20d084df2b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/thieving/ChestOverlay.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2019, whs - * 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.thieving; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.time.Instant; -import java.time.temporal.ChronoUnit; -import java.util.Iterator; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Setter; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -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.components.ProgressPieComponent; - -@Singleton -class ChestOverlay extends Overlay -{ - private final Client client; - private final List respawns; - - @Setter(AccessLevel.PACKAGE) - private Color pieFillColor; - @Setter(AccessLevel.PACKAGE) - private Color pieBorderColor; - @Setter(AccessLevel.PACKAGE) - private boolean respawnPieInverted; - @Setter(AccessLevel.PACKAGE) - private int respawnPieDiameter; - - @Inject - private ChestOverlay(final Client client, final ThievingPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.respawns = plugin.getRespawns(); - this.client = client; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (respawns.isEmpty()) - { - return null; - } - - Instant now = Instant.now(); - for (Iterator it = respawns.iterator(); it.hasNext(); ) - { - ChestRespawn chestRespawn = it.next(); - - float percent = 1.0f - (now.until(chestRespawn.getEndTime(), ChronoUnit.MILLIS) / (float) chestRespawn.getRespawnTime()); - if (percent > 1.0f) - { - it.remove(); - continue; - } - - if (chestRespawn.getWorld() != client.getWorld()) - { - continue; - } - - WorldPoint worldPoint = chestRespawn.getWorldPoint(); - LocalPoint loc = LocalPoint.fromWorld(client, worldPoint); - if (loc == null) - { - continue; - } - - Point point = Perspective.localToCanvas(client, loc, client.getPlane(), 0); - if (point == null) - { - continue; - } - - if (respawnPieInverted) - { - percent = 1.0f - percent; - } - - ProgressPieComponent ppc = new ProgressPieComponent(); - ppc.setDiameter(respawnPieDiameter); - ppc.setBorderColor(pieBorderColor); - ppc.setFill(pieFillColor); - ppc.setPosition(point); - ppc.setProgress(percent); - ppc.render(graphics); - } - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/thieving/ChestRespawn.java b/runelite-client/src/main/java/net/runelite/client/plugins/thieving/ChestRespawn.java deleted file mode 100644 index f8231dd5c0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/thieving/ChestRespawn.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2019, whs - * 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.thieving; - -import java.time.Instant; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.api.coords.WorldPoint; - -@RequiredArgsConstructor -@Getter(AccessLevel.PACKAGE) -class ChestRespawn -{ - private final Chest chest; - private final WorldPoint worldPoint; - private final Instant endTime; - private final int world; - - private long respawnTime = -1; - - long getRespawnTime() - { - if (respawnTime != -1) - { - return respawnTime; - } - - respawnTime = chest.getRespawnTime().toMillis(); - return respawnTime; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/thieving/ThievingConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/thieving/ThievingConfig.java deleted file mode 100644 index 31e6709818..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/thieving/ThievingConfig.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2018, Joris K - * Copyright (c) 2018, Lasse - * Copyright (c) 2019, ermalsh - * 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.thieving; - -import java.awt.Color; -import net.runelite.client.config.Alpha; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigSection; -import net.runelite.client.config.Range; - -@ConfigGroup("thieving") -public interface ThievingConfig extends Config -{ - @ConfigItem( - position = 1, - keyName = "statTimeout", - name = "Reset stats (minutes)", - description = "Change the time until the thieving session is reset and the overlay is hidden" - ) - default int statTimeout() - { - return 5; - } - - @ConfigSection( - name = "Chest", - description = "", - position = 2, - keyName = "chestSection" - ) - default boolean chestSection() - { - return false; - } - - @Alpha - @ConfigItem( - keyName = "respawnColor", - name = "Respawn timer color", - description = "Configures the color of the respawn timer", - section = "chestSection" - ) - default Color respawnColor() - { - return Color.YELLOW; - } - - @ConfigItem( - keyName = "respawnPieInverted", - name = "Invert respawn timer", - description = "Configures whether the respawn timer goes from empty to full or the other way around", - section = "chestSection" - ) - default boolean respawnPieInverted() - { - return false; - } - - @Range( - min = 1, - max = 50 - ) - @ConfigItem( - keyName = "respawnPieDiameter", - name = "Respawn pie diameter", - description = "Configures how big the respawn timer pie is", - section = "chestSection" - ) - default int respawnPieDiameter() - { - return 30; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/thieving/ThievingOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/thieving/ThievingOverlay.java deleted file mode 100644 index dd5f912b5b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/thieving/ThievingOverlay.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2018, Joris K - * Copyright (c) 2018, Lasse - * Copyright (c) 2019, ermalsh - * 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.thieving; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.text.DecimalFormat; -import javax.inject.Inject; -import javax.inject.Singleton; -import static net.runelite.api.AnimationID.BLOCK_UNARMED; -import static net.runelite.api.AnimationID.PICKPOCKET_SUCCESS; -import static net.runelite.api.AnimationID.THIEVING_STALL; -import net.runelite.api.Client; -import net.runelite.api.Skill; -import net.runelite.client.plugins.xptracker.XpTrackerService; -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; - -@Singleton -public class ThievingOverlay extends Overlay -{ - private static final DecimalFormat FORMAT = new DecimalFormat("#.#"); - - private final Client client; - private final ThievingPlugin plugin; - private final XpTrackerService xpTrackerService; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - private ThievingOverlay(final Client client, final ThievingPlugin plugin, final XpTrackerService xpTrackerService) - { - setPosition(OverlayPosition.TOP_LEFT); - this.client = client; - this.plugin = plugin; - this.xpTrackerService = xpTrackerService; - } - - @Override - public Dimension render(Graphics2D graphics) - { - ThievingSession session = plugin.getSession(); - if (session == null) - { - return null; - } - - panelComponent.setPreferredSize(new Dimension(145, 0)); - panelComponent.getChildren().clear(); - - if (isThieving()) - { - panelComponent.getChildren().add(TitleComponent.builder() - .text("Thieving") - .color(Color.GREEN) - .build()); - } - else if (isStunned()) - { - panelComponent.getChildren().add(TitleComponent.builder() - .text("Stunned") - .color(Color.ORANGE) - .build()); - } - else - { - panelComponent.getChildren().add(TitleComponent.builder() - .text("NOT thieving") - .color(Color.RED) - .build()); - } - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - tableComponent.addRow("Succeeded:", session.getSuccessful() + (session.getSuccessful() >= 1 ? " (" + xpTrackerService.getActionsHr(Skill.THIEVING) + "/hr)" : "")); - tableComponent.addRow("Failed:", session.getFailed() + (session.getFailed() >= 1 ? " (" + FORMAT.format(session.getSuccessRate()) + "%)" : "")); - - panelComponent.getChildren().add(tableComponent); - - return panelComponent.render(graphics); - } - - private boolean isThieving() - { - if (client.getLocalPlayer() == null) - { - return false; - } - - switch (client.getLocalPlayer().getAnimation()) - { - case THIEVING_STALL: - case PICKPOCKET_SUCCESS: - return true; - default: - return false; - } - } - - private boolean isStunned() - { - if (client.getLocalPlayer() == null) - { - return false; - } - - return client.getLocalPlayer().getAnimation() == BLOCK_UNARMED; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/thieving/ThievingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/thieving/ThievingPlugin.java deleted file mode 100644 index e995d6a8b7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/thieving/ThievingPlugin.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright (c) 2018, Joris K - * Copyright (c) 2018, Lasse - * Copyright (c) 2019, ermalsh - * 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.thieving; - -import com.google.inject.Provides; -import java.time.Duration; -import java.time.Instant; -import java.util.ArrayList; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.GameState; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameObjectDespawned; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDependency; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.xptracker.XpTrackerPlugin; -import net.runelite.client.ui.overlay.OverlayManager; - -@PluginDescriptor( - name = "Thieving", - description = "Show thieving overlay", - tags = {"overlay", "skilling", "thieving", "pickpocketing"}, - type = PluginType.SKILLING, - enabledByDefault = false -) -@Singleton -@PluginDependency(XpTrackerPlugin.class) -public class ThievingPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private ThievingConfig config; - - @Inject - private ThievingOverlay overlay; - - @Inject - private ChestOverlay chestOverlay; - - @Inject - private OverlayManager overlayManager; - - @Getter(AccessLevel.PACKAGE) - private ThievingSession session; - - @Getter(AccessLevel.PACKAGE) - private final List respawns = new ArrayList<>(); - - private int statTimeout; - private boolean recentlyLoggedIn = false; - - @Provides - ThievingConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(ThievingConfig.class); - } - - @Override - protected void startUp() - { - - this.statTimeout = config.statTimeout(); - - chestOverlay.setPieFillColor(config.respawnColor()); - chestOverlay.setPieBorderColor(config.respawnColor().darker()); - chestOverlay.setRespawnPieInverted(config.respawnPieInverted()); - chestOverlay.setRespawnPieDiameter(config.respawnPieDiameter()); - - session = null; - overlayManager.add(overlay); - overlayManager.add(chestOverlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - overlayManager.remove(chestOverlay); - session = null; - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGGED_IN) - { - recentlyLoggedIn = true; - } - } - - @Subscribe - private void onGameTick(GameTick gameTick) - { - recentlyLoggedIn = false; - - if (session == null || this.statTimeout == 0) - { - return; - } - - Duration statTimeout = Duration.ofMinutes(this.statTimeout); - Duration sinceCut = Duration.between(session.getLastTheivingAction(), Instant.now()); - - if (sinceCut.compareTo(statTimeout) >= 0) - { - session = null; - } - } - - @Subscribe - private void onChatMessage(ChatMessage event) - { - if (event.getType() != ChatMessageType.SPAM) - { - return; - } - - final String message = event.getMessage(); - - if (message.startsWith("You pickpocket") || message.startsWith("You pick-pocket") || message.startsWith("You steal") || message.startsWith("You successfully pick-pocket") || message.startsWith("You successfully pick") || message.startsWith("You successfully steal")) - { - if (session == null) - { - session = new ThievingSession(); - } - - session.updateLastThevingAction(); - session.hasSucceeded(); - } - else if (message.startsWith("You fail to pick") || message.startsWith("You fail to steal")) - { - if (session == null) - { - session = new ThievingSession(); - } - - session.updateLastThevingAction(); - session.hasFailed(); - } - } - - @Subscribe - private void onGameObjectDespawned(GameObjectDespawned event) - { - if (client.getGameState() != GameState.LOGGED_IN || recentlyLoggedIn) - { - return; - } - - final GameObject object = event.getGameObject(); - - Chest chest = Chest.of(object.getId()); - if (chest != null) - { - ChestRespawn chestRespawn = new ChestRespawn(chest, object.getWorldLocation(), Instant.now().plus(chest.getRespawnTime()), client.getWorld()); - respawns.add(chestRespawn); - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!"thieving".equals(event.getGroup())) - { - return; - } - - this.statTimeout = config.statTimeout(); - chestOverlay.setPieFillColor(config.respawnColor()); - chestOverlay.setPieBorderColor(config.respawnColor().darker()); - chestOverlay.setRespawnPieInverted(config.respawnPieInverted()); - chestOverlay.setRespawnPieDiameter(config.respawnPieDiameter()); - } -} - diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/thieving/ThievingSession.java b/runelite-client/src/main/java/net/runelite/client/plugins/thieving/ThievingSession.java deleted file mode 100644 index 967fd60cf4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/thieving/ThievingSession.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2018, Joris K - * Copyright (c) 2018, Lasse - * Copyright (c) 2019, ermalsh - * 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.thieving; - -import java.time.Instant; -import lombok.AccessLevel; -import lombok.Getter; - -class ThievingSession -{ - @Getter(AccessLevel.PACKAGE) - private Instant lastTheivingAction; - @Getter(AccessLevel.PACKAGE) - private int successful; - @Getter(AccessLevel.PACKAGE) - private int failed; - - void updateLastThevingAction() - { - this.lastTheivingAction = Instant.now(); - } - - void hasSucceeded() - { - this.successful++; - } - - void hasFailed() - { - this.failed++; - } - - double getSuccessRate() - { - return ((double) getFailed() / (getSuccessful() + getFailed())) * 100; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/ticktimers/NPCContainer.java b/runelite-client/src/main/java/net/runelite/client/plugins/ticktimers/NPCContainer.java deleted file mode 100644 index 29e8c87623..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/ticktimers/NPCContainer.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2019, Ganom - * Copyright (c) 2019, Lucas - * 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.ticktimers; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import java.awt.Color; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; -import net.runelite.api.Actor; -import net.runelite.api.AnimationID; -import net.runelite.api.NPC; -import net.runelite.api.NPCDefinition; -import net.runelite.api.NpcID; -import net.runelite.api.Prayer; - -@Getter(AccessLevel.PACKAGE) -class NPCContainer -{ - private NPC npc; - private int npcIndex; - private String npcName; - private int npcSize; - private ImmutableSet animations; - private int attackSpeed; - @Setter(AccessLevel.PACKAGE) - private int ticksUntilAttack; - @Setter(AccessLevel.PACKAGE) - private Actor npcInteracting; - @Setter(AccessLevel.PACKAGE) - private AttackStyle attackStyle; - - NPCContainer(final NPC npc, final int attackSpeed) - { - this.npc = npc; - this.npcName = npc.getName(); - this.npcIndex = npc.getIndex(); - this.npcInteracting = npc.getInteracting(); - this.attackStyle = AttackStyle.UNKNOWN; - this.attackSpeed = attackSpeed; - this.ticksUntilAttack = -1; - final NPCDefinition composition = npc.getTransformedDefinition(); - - BossMonsters monster = BossMonsters.of(npc.getId()); - - if (monster == null) - { - throw new IllegalStateException(); - } - - this.animations = monster.animations; - this.attackStyle = monster.attackStyle; - - if (composition != null) - { - this.npcSize = composition.getSize(); - } - } - - @RequiredArgsConstructor - enum BossMonsters - { - SERGEANT_STRONGSTACK(NpcID.SERGEANT_STRONGSTACK, AttackStyle.MELEE, ImmutableSet.of(AnimationID.MINION_AUTO1, AnimationID.MINION_AUTO2, AnimationID.MINION_AUTO3)), - SERGEANT_STEELWILL(NpcID.SERGEANT_STEELWILL, AttackStyle.MAGE, ImmutableSet.of(AnimationID.MINION_AUTO1, AnimationID.MINION_AUTO2, AnimationID.MINION_AUTO3)), - SERGEANT_GRIMSPIKE(NpcID.SERGEANT_GRIMSPIKE, AttackStyle.RANGE, ImmutableSet.of(AnimationID.MINION_AUTO1, AnimationID.MINION_AUTO2, AnimationID.MINION_AUTO4)), - GENERAL_GRAARDOR(NpcID.GENERAL_GRAARDOR, AttackStyle.MELEE, ImmutableSet.of(AnimationID.GENERAL_AUTO1, AnimationID.GENERAL_AUTO2, AnimationID.GENERAL_AUTO3)), - - TSTANON_KARLAK(NpcID.TSTANON_KARLAK, AttackStyle.MELEE, ImmutableSet.of(AnimationID.ZAMMY_GENERIC_AUTO)), - BALFRUG_KREEYATH(NpcID.BALFRUG_KREEYATH, AttackStyle.MAGE, ImmutableSet.of(AnimationID.ZAMMY_GENERIC_AUTO, AnimationID.BALFRUG_AUTO)), - ZAKLN_GRITCH(NpcID.ZAKLN_GRITCH, AttackStyle.RANGE, ImmutableSet.of(AnimationID.ZAMMY_GENERIC_AUTO, AnimationID.ZAKL_AUTO)), - KRIL_TSUTSAROTH(NpcID.KRIL_TSUTSAROTH, AttackStyle.UNKNOWN, ImmutableSet.of(AnimationID.KRIL_SPEC, AnimationID.KRIL_AUTO)), - - STARLIGHT(NpcID.STARLIGHT, AttackStyle.MELEE, ImmutableSet.of(AnimationID.STARLIGHT_AUTO)), - GROWLER(NpcID.GROWLER, AttackStyle.MAGE, ImmutableSet.of(AnimationID.GROWLER_AUTO)), - BREE(NpcID.BREE, AttackStyle.RANGE, ImmutableSet.of(AnimationID.BREE_AUTO)), - COMMANDER_ZILYANA(NpcID.COMMANDER_ZILYANA, AttackStyle.UNKNOWN, ImmutableSet.of(AnimationID.ZILYANA_AUTO, AnimationID.ZILYANA_MELEE_AUTO, AnimationID.ZILYANA_SPEC)), - - FLIGHT_KILISA(NpcID.FLIGHT_KILISA, AttackStyle.MELEE, ImmutableSet.of(AnimationID.KILISA_AUTO)), - FLOCKLEADER_GEERIN(NpcID.FLOCKLEADER_GEERIN, AttackStyle.RANGE, ImmutableSet.of(AnimationID.GEERIN_AUTO, AnimationID.GEERIN_FLINCH)), - WINGMAN_SKREE(NpcID.WINGMAN_SKREE, AttackStyle.MAGE, ImmutableSet.of(AnimationID.SKREE_AUTO)), - KREEARRA(NpcID.KREEARRA, AttackStyle.RANGE, ImmutableSet.of(AnimationID.KREE_RANGED)), - - DAGANNOTH_REX(NpcID.DAGANNOTH_REX, AttackStyle.MELEE, ImmutableSet.of(AnimationID.DAG_REX)), - DAGANNOTH_SUPREME(NpcID.DAGANNOTH_SUPREME, AttackStyle.RANGE, ImmutableSet.of(AnimationID.DAG_SUPREME)), - DAGANNOTH_PRIME(NpcID.DAGANNOTH_PRIME, AttackStyle.MAGE, ImmutableSet.of(AnimationID.DAG_PRIME)); - - private static final ImmutableMap idMap; - - static - { - ImmutableMap.Builder builder = ImmutableMap.builder(); - - for (BossMonsters monster : values()) - { - builder.put(monster.npcID, monster); - } - - idMap = builder.build(); - } - - private final int npcID; - private final AttackStyle attackStyle; - private final ImmutableSet animations; - - static BossMonsters of(int npcID) - { - return idMap.get(npcID); - } - } - - @AllArgsConstructor - @Getter - public enum AttackStyle - { - MAGE("Mage", Color.CYAN, Prayer.PROTECT_FROM_MAGIC), - RANGE("Range", Color.GREEN, Prayer.PROTECT_FROM_MISSILES), - MELEE("Melee", Color.RED, Prayer.PROTECT_FROM_MELEE), - UNKNOWN("Unknown", Color.WHITE, null); - - private String name; - private Color color; - private Prayer prayer; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/ticktimers/TickTimersConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/ticktimers/TickTimersConfig.java deleted file mode 100644 index fed238e356..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/ticktimers/TickTimersConfig.java +++ /dev/null @@ -1,191 +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.ticktimers; - -import java.awt.Font; -import lombok.AccessLevel; -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.ConfigTitleSection; -import net.runelite.client.config.Range; -import net.runelite.client.config.Title; - -@ConfigGroup("TickTimers") -public interface TickTimersConfig extends Config -{ - @ConfigTitleSection( - keyName = "mainConfig", - position = 0, - name = "Main Config", - description = "" - ) - default Title mainConfig() - { - return new Title(); - } - - @ConfigItem( - position = 1, - keyName = "prayerWidgetHelper", - name = "Prayer Widget Helper", - description = "Shows you which prayer to click and the time until click.", - titleSection = "mainConfig" - ) - default boolean showPrayerWidgetHelper() - { - return false; - } - - @ConfigItem( - position = 2, - keyName = "showHitSquares", - name = "Show Hit Squares", - description = "Shows you where the melee bosses can hit you from.", - titleSection = "mainConfig" - ) - default boolean showHitSquares() - { - return false; - } - - @ConfigItem( - position = 3, - keyName = "changeTickColor", - name = "Change Tick Color", - description = "If this is enabled, it will change the tick color to white" + - "
at 1 tick remaining, signaling you to swap.", - titleSection = "mainConfig" - ) - default boolean changeTickColor() - { - return false; - } - - @ConfigTitleSection( - keyName = "bosses", - position = 4, - name = "Bosses", - description = "" - ) - default Title bosses() - { - return new Title(); - } - - @ConfigItem( - position = 5, - keyName = "gwd", - name = "God Wars Dungeon", - description = "Show tick timers for GWD Bosses. This must be enabled before you zone in.", - titleSection = "bosses" - ) - default boolean gwd() - { - return true; - } - - @ConfigItem( - position = 6, - keyName = "dks", - name = "Dagannoth Kings", - description = "Show tick timers for Dagannoth Kings. This must be enabled before you zone in.", - titleSection = "bosses" - ) - default boolean dks() - { - return true; - } - - @ConfigTitleSection( - keyName = "text", - position = 7, - name = "Text", - description = "" - ) - default Title text() - { - return new Title(); - } - - @ConfigItem( - position = 8, - keyName = "fontStyle", - name = "Font Style", - description = "Plain | Bold | Italics", - titleSection = "text" - ) - default FontStyle fontStyle() - { - return FontStyle.BOLD; - } - - @Range( - min = 14, - max = 40 - ) - @ConfigItem( - position = 9, - keyName = "textSize", - name = "Text Size", - description = "Text Size for Timers.", - titleSection = "text" - ) - default int textSize() - { - return 32; - } - - @ConfigItem( - position = 10, - keyName = "shadows", - name = "Shadows", - description = "Adds Shadows to text.", - titleSection = "text" - ) - default boolean shadows() - { - return false; - } - - @Getter(AccessLevel.PACKAGE) - @AllArgsConstructor - 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(); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/ticktimers/TickTimersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/ticktimers/TickTimersPlugin.java deleted file mode 100644 index 476dcf1bca..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/ticktimers/TickTimersPlugin.java +++ /dev/null @@ -1,284 +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.ticktimers; - -import com.google.inject.Provides; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -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.ConfigChanged; -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; - -@PluginDescriptor( - name = "Boss Tick Timers", - description = "Tick timers for bosses", - tags = {"pvm", "bossing"}, - enabledByDefault = false, - type = PluginType.PVM -) -@Singleton -@Slf4j -public class TickTimersPlugin extends Plugin -{ - private static final int GENERAL_REGION = 11347; - private static final int ARMA_REGION = 11346; - private static final int SARA_REGION = 11601; - private static final int ZAMMY_REGION = 11603; - private static final int WATERBITH_REGION = 11589; - - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private TimersOverlay timersOverlay; - - @Inject - private TickTimersConfig config; - - @Inject - private NPCManager npcManager; - - @Getter(AccessLevel.PACKAGE) - private Set npcContainer = new HashSet<>(); - private boolean validRegion; - - @Getter(AccessLevel.PACKAGE) - private boolean showPrayerWidgetHelper; - @Getter(AccessLevel.PACKAGE) - private boolean showHitSquares; - @Getter(AccessLevel.PACKAGE) - private boolean changeTickColor; - private boolean gwd; - private boolean dks; - @Getter(AccessLevel.PACKAGE) - private TickTimersConfig.FontStyle fontStyle; - @Getter(AccessLevel.PACKAGE) - private int textSize; - @Getter(AccessLevel.PACKAGE) - private boolean shadows; - - @Provides - TickTimersConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(TickTimersConfig.class); - } - - @Override - public void startUp() - { - updateConfig(); - npcContainer.clear(); - } - - @Override - public void shutDown() - { - npcContainer.clear(); - overlayManager.remove(timersOverlay); - validRegion = false; - } - - @Subscribe - private void onGameStateChanged(GameStateChanged gameStateChanged) - { - if (gameStateChanged.getGameState() != GameState.LOGGED_IN) - { - return; - } - - if (regionCheck()) - { - validRegion = true; - overlayManager.add(timersOverlay); - } - else - { - validRegion = false; - overlayManager.remove(timersOverlay); - } - npcContainer.clear(); - } - - @Subscribe - private void onNpcSpawned(NpcSpawned event) - { - if (!validRegion) - { - return; - } - - NPC npc = event.getNpc(); - - switch (npc.getId()) - { - case NpcID.SERGEANT_STRONGSTACK: - case NpcID.SERGEANT_STEELWILL: - case NpcID.SERGEANT_GRIMSPIKE: - case NpcID.GENERAL_GRAARDOR: - case NpcID.TSTANON_KARLAK: - case NpcID.BALFRUG_KREEYATH: - case NpcID.ZAKLN_GRITCH: - case NpcID.KRIL_TSUTSAROTH: - case NpcID.STARLIGHT: - case NpcID.BREE: - case NpcID.GROWLER: - case NpcID.COMMANDER_ZILYANA: - case NpcID.FLIGHT_KILISA: - case NpcID.FLOCKLEADER_GEERIN: - case NpcID.WINGMAN_SKREE: - case NpcID.KREEARRA: - if (this.gwd) - { - npcContainer.add(new NPCContainer(npc, npcManager.getAttackSpeed(npc.getId()))); - } - break; - case NpcID.DAGANNOTH_REX: - case NpcID.DAGANNOTH_SUPREME: - case NpcID.DAGANNOTH_PRIME: - if (this.dks) - { - npcContainer.add(new NPCContainer(npc, npcManager.getAttackSpeed(npc.getId()))); - } - break; - } - } - - @Subscribe - private void onNpcDespawned(NpcDespawned event) - { - if (!validRegion) - { - return; - } - - NPC npc = event.getNpc(); - - switch (npc.getId()) - { - case NpcID.SERGEANT_STRONGSTACK: - case NpcID.SERGEANT_STEELWILL: - case NpcID.SERGEANT_GRIMSPIKE: - case NpcID.GENERAL_GRAARDOR: - case NpcID.TSTANON_KARLAK: - case NpcID.BALFRUG_KREEYATH: - case NpcID.ZAKLN_GRITCH: - case NpcID.KRIL_TSUTSAROTH: - case NpcID.STARLIGHT: - case NpcID.BREE: - case NpcID.GROWLER: - case NpcID.COMMANDER_ZILYANA: - case NpcID.FLIGHT_KILISA: - case NpcID.FLOCKLEADER_GEERIN: - case NpcID.WINGMAN_SKREE: - case NpcID.KREEARRA: - case NpcID.DAGANNOTH_REX: - case NpcID.DAGANNOTH_SUPREME: - case NpcID.DAGANNOTH_PRIME: - npcContainer.removeIf(c -> c.getNpc() == npc); - break; - } - } - - @Subscribe - public void onGameTick(GameTick Event) - { - if (!validRegion) - { - return; - } - - handleBosses(); - } - - private void handleBosses() - { - for (NPCContainer npcs : getNpcContainer()) - { - if (npcs.getTicksUntilAttack() >= 0) - { - npcs.setTicksUntilAttack(npcs.getTicksUntilAttack() - 1); - } - - for (int anims : npcs.getAnimations()) - { - if (anims == npcs.getNpc().getAnimation() && npcs.getTicksUntilAttack() < 1) - { - npcs.setTicksUntilAttack(npcs.getAttackSpeed()); - } - } - } - } - - private boolean regionCheck() - { - return Arrays.stream(client.getMapRegions()).anyMatch( - x -> x == ARMA_REGION || x == GENERAL_REGION || x == ZAMMY_REGION || x == SARA_REGION || x == WATERBITH_REGION - ); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!"TickTimers".equals(event.getGroup())) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.showPrayerWidgetHelper = config.showPrayerWidgetHelper(); - this.showHitSquares = config.showHitSquares(); - this.changeTickColor = config.changeTickColor(); - this.gwd = config.gwd(); - this.dks = config.dks(); - this.fontStyle = config.fontStyle(); - this.textSize = config.textSize(); - this.shadows = config.shadows(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/ticktimers/TimersOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/ticktimers/TimersOverlay.java deleted file mode 100644 index d00e4863ed..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/ticktimers/TimersOverlay.java +++ /dev/null @@ -1,139 +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.ticktimers; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Point; -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.OverlayPriority; -import net.runelite.client.ui.overlay.OverlayUtil; - -@Singleton -public class TimersOverlay extends Overlay -{ - private final TickTimersPlugin plugin; - private final Client client; - - @Inject - TimersOverlay(final TickTimersPlugin plugin, final Client client) - { - this.plugin = plugin; - this.client = client; - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGHEST); - setLayer(OverlayLayer.ALWAYS_ON_TOP); - } - - @Override - public Dimension render(Graphics2D graphics) - { - for (NPCContainer npc : plugin.getNpcContainer()) - { - if (npc.getNpc() == null) - { - continue; - } - - int ticksLeft = npc.getTicksUntilAttack(); - final List hitSquares = OverlayUtil.getHitSquares(npc.getNpc().getWorldLocation(), npc.getNpcSize(), 1, false); - final NPCContainer.AttackStyle attackStyle = npc.getAttackStyle(); - - if (plugin.isShowHitSquares() && attackStyle.getName().equals("Melee")) - { - for (WorldPoint p : hitSquares) - { - OverlayUtil.drawTiles(graphics, client, p, client.getLocalPlayer().getWorldLocation(), attackStyle.getColor(), 0, 0, 50); - } - } - - if (ticksLeft <= 0) - { - continue; - } - - final String ticksLeftStr = String.valueOf(ticksLeft); - final int font = plugin.getFontStyle().getFont(); - final boolean shadows = plugin.isShadows(); - Color color = (ticksLeft <= 1 ? Color.WHITE : attackStyle.getColor()); - - if (!plugin.isChangeTickColor()) - { - color = attackStyle.getColor(); - } - - final Point canvasPoint = npc.getNpc().getCanvasTextLocation(graphics, Integer.toString(ticksLeft), 0); - - OverlayUtil.renderTextLocation(graphics, ticksLeftStr, plugin.getTextSize(), font, color, canvasPoint, shadows, 0); - - if (plugin.isShowPrayerWidgetHelper() && attackStyle.getPrayer() != null) - { - Rectangle bounds = OverlayUtil.renderPrayerOverlay(graphics, client, attackStyle.getPrayer(), color); - - if (bounds != null) - { - renderTextLocation(graphics, ticksLeftStr, 16, plugin.getFontStyle().getFont(), color, centerPoint(bounds), shadows); - } - } - } - return null; - } - - private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint, boolean shadows) - { - graphics.setFont(new Font("Arial", fontStyle, fontSize)); - if (canvasPoint != null) - { - final Point canvasCenterPoint = new Point( - canvasPoint.getX() - 3, - canvasPoint.getY() + 6); - final Point canvasCenterPoint_shadow = new Point( - canvasPoint.getX() - 2, - canvasPoint.getY() + 7); - if (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); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsConfig.java deleted file mode 100644 index 2260883600..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsConfig.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.tileindicators; - -import java.awt.Color; -import net.runelite.client.config.Alpha; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("tileindicators") -public interface TileIndicatorsConfig extends Config -{ - @Alpha - @ConfigItem( - keyName = "highlightDestinationColor", - name = "Color of current destination highlighting", - description = "Configures the highlight color of current destination", - position = 0 - ) - default Color highlightDestinationColor() - { - return Color.GRAY; - } - - @ConfigItem( - keyName = "highlightDestinationTile", - name = "Highlight destination tile", - description = "Highlights tile player is walking to", - position = 1 - ) - default boolean highlightDestinationTile() - { - return true; - } - - @ConfigItem( - keyName = "thinDestinationTile", - name = "Thin destination tile", - description = "Renders the tile border as 1 pixel wide instead of 2", - position = 2 - ) - default boolean thinDestinationTile() - { - return false; - } - - @Alpha - @ConfigItem( - keyName = "highlightCurrentColor", - name = "Color of current tile highlighting", - description = "Configures the highlight color of current tile position", - position = 3 - ) - default Color highlightCurrentColor() - { - return Color.CYAN; - } - - @ConfigItem( - keyName = "highlightCurrentTile", - name = "Highlight current tile", - description = "Highlights tile player is on", - position = 4 - ) - default boolean highlightCurrentTile() - { - return false; - } - - @ConfigItem( - keyName = "thinCurrentTile", - name = "Thin current tile", - description = "Renders the tile border as 1 pixel wide instead of 2", - position = 5 - ) - default boolean thinCurrentTile() - { - return false; - } - - @Alpha - @ConfigItem( - keyName = "highlightHoveredColor", - name = "Color of current hovered highlighting", - description = "Configures the highlight color of hovered tile", - position = 6 - ) - default Color highlightHoveredColor() - { - return new Color(0, 0, 0, 0); - } - - @ConfigItem( - keyName = "highlightHoveredTile", - name = "Highlight hovered tile", - description = "Highlights tile player is hovering with mouse", - position = 7 - ) - default boolean highlightHoveredTile() - { - return false; - } - - @ConfigItem( - keyName = "thinHoveredTile", - name = "Thin hovered tile", - description = "Renders the tile border as 1 pixel wide instead of 2", - position = 8 - ) - default boolean thinHoveredTile() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsOverlay.java deleted file mode 100644 index 785cea22dc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsOverlay.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.tileindicators; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -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.OverlayPriority; -import net.runelite.client.ui.overlay.OverlayUtil; - -@Singleton -public class TileIndicatorsOverlay extends Overlay -{ - private final Client client; - private final TileIndicatorsPlugin plugin; - - @Inject - private TileIndicatorsOverlay(final Client client, final TileIndicatorsPlugin plugin) - { - this.client = client; - this.plugin = plugin; - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - setPriority(OverlayPriority.MED); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.isHighlightHoveredTile() && - // If we have tile "selected" render it - client.getSelectedSceneTile() != null) - { - if (plugin.isThinHoveredTile()) - { - renderTileThin(graphics, client.getSelectedSceneTile().getLocalLocation(), plugin.getHighlightHoveredColor()); - } - else - { - renderTile(graphics, client.getSelectedSceneTile().getLocalLocation(), plugin.getHighlightHoveredColor()); - } - } - - if (plugin.isHighlightDestinationTile()) - { - if (plugin.isThinDestinationTile()) - { - renderTileThin(graphics, client.getLocalDestinationLocation(), plugin.getHighlightDestinationColor()); - } - else - { - renderTile(graphics, client.getLocalDestinationLocation(), plugin.getHighlightDestinationColor()); - } - } - - if (plugin.isHighlightCurrentTile()) - { - final WorldPoint playerPos = client.getLocalPlayer().getWorldLocation(); - if (playerPos == null) - { - return null; - } - - final LocalPoint playerPosLocal = LocalPoint.fromWorld(client, client.getLocalPlayer().getWorldLocation()); - if (playerPosLocal == null) - { - return null; - } - - if (plugin.isThinCurrentTile()) - { - renderTileThin(graphics, playerPosLocal, plugin.getHighlightCurrentColor()); - } - else - { - renderTile(graphics, playerPosLocal, plugin.getHighlightCurrentColor()); - } - } - - return null; - } - - private void renderTile(final Graphics2D graphics, final LocalPoint dest, final Color color) - { - if (dest == null) - { - return; - } - - final Polygon poly = Perspective.getCanvasTilePoly(client, dest); - - if (poly == null) - { - return; - } - - OverlayUtil.renderPolygon(graphics, poly, color); - } - - private void renderTileThin(final Graphics2D graphics, final LocalPoint dest, final Color color) - { - if (dest == null) - { - return; - } - - final Polygon poly = Perspective.getCanvasTilePoly(client, dest); - - if (poly == null) - { - return; - } - - OverlayUtil.renderPolygonThin(graphics, poly, color); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsPlugin.java deleted file mode 100644 index a9d2532d5c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tileindicators/TileIndicatorsPlugin.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.tileindicators; - -import com.google.inject.Provides; -import java.awt.Color; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@PluginDescriptor( - name = "Tile Indicators", - description = "Highlight the tile you are currently moving to", - tags = {"highlight", "overlay"}, - enabledByDefault = false, - type = PluginType.UTILITY -) -@Singleton -public class TileIndicatorsPlugin extends Plugin -{ - @Inject - private OverlayManager overlayManager; - - @Inject - private TileIndicatorsOverlay overlay; - - @Inject - private TileIndicatorsConfig config; - - @Getter(AccessLevel.PACKAGE) - private Color highlightDestinationColor; - @Getter(AccessLevel.PACKAGE) - private boolean highlightDestinationTile; - @Getter(AccessLevel.PACKAGE) - private boolean thinDestinationTile; - @Getter(AccessLevel.PACKAGE) - private Color highlightCurrentColor; - @Getter(AccessLevel.PACKAGE) - private boolean highlightCurrentTile; - @Getter(AccessLevel.PACKAGE) - private boolean thinCurrentTile; - @Getter(AccessLevel.PACKAGE) - private Color highlightHoveredColor; - @Getter(AccessLevel.PACKAGE) - private boolean highlightHoveredTile; - @Getter(AccessLevel.PACKAGE) - private boolean thinHoveredTile; - - @Provides - TileIndicatorsConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(TileIndicatorsConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!"tileindicators".equals(event.getGroup())) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.highlightDestinationColor = config.highlightDestinationColor(); - this.highlightDestinationTile = config.highlightDestinationTile(); - this.thinDestinationTile = config.thinDestinationTile(); - this.highlightCurrentColor = config.highlightCurrentColor(); - this.highlightCurrentTile = config.highlightCurrentTile(); - this.thinCurrentTile = config.thinCurrentTile(); - this.highlightHoveredColor = config.highlightHoveredColor(); - this.highlightHoveredTile = config.highlightHoveredTile(); - this.thinHoveredTile = config.thinHoveredTile(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/GameIndicator.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/GameIndicator.java deleted file mode 100644 index 0cdf993aed..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/GameIndicator.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2018, Tyler - * 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.timers; - -import java.awt.Color; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.SpriteID; - -@Getter(AccessLevel.PACKAGE) -enum GameIndicator -{ - VENGEANCE_ACTIVE(SpriteID.SPELL_VENGEANCE_OTHER, GameTimerImageType.SPRITE, "Vengeance active"); - - private final String description; - private String text; - private Color textColor; - private final int imageId; - private final GameTimerImageType imageType; - - GameIndicator(final int imageId, final GameTimerImageType idType, final String description, final String text, final Color textColor) - { - this.imageId = imageId; - this.imageType = idType; - this.description = description; - this.text = text; - this.textColor = textColor; - } - - GameIndicator(final int imageId, final GameTimerImageType idType, final String description) - { - this(imageId, idType, description, "", null); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/GameTimer.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/GameTimer.java deleted file mode 100644 index 790b6776d1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/GameTimer.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * Copyright (c) 2017, Adam - * Copyright (c) 2018, Jordan Atwood - * Copyright (c) 2019, Lucas - * 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.timers; - -import java.time.Duration; -import java.time.temporal.ChronoUnit; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.GraphicID; -import net.runelite.api.ItemID; -import net.runelite.api.SpriteID; - -@Getter(AccessLevel.PACKAGE) -enum GameTimer -{ - STAMINA(ItemID.STAMINA_POTION4, GameTimerImageType.ITEM, "Stamina", 2, ChronoUnit.MINUTES, true), - ANTIFIRE(ItemID.ANTIFIRE_POTION4, GameTimerImageType.ITEM, "Antifire", 6, ChronoUnit.MINUTES), - EXANTIFIRE(ItemID.EXTENDED_ANTIFIRE4, GameTimerImageType.ITEM, "Extended antifire", 12, ChronoUnit.MINUTES), - OVERLOAD(ItemID.OVERLOAD_4, GameTimerImageType.ITEM, "Overload", 5, ChronoUnit.MINUTES, true), - CANNON(ItemID.CANNON_BARRELS, GameTimerImageType.ITEM, "Cannon", 25, ChronoUnit.MINUTES), - MAGICIMBUE(SpriteID.SPELL_MAGIC_IMBUE, GameTimerImageType.SPRITE, "Magic imbue", 12, ChronoUnit.SECONDS), - FULLTB(SpriteID.SPELL_TELE_BLOCK, GameTimerImageType.SPRITE, "Full Teleblock", 5, ChronoUnit.MINUTES, true), - HALFTB(SpriteID.SPELL_TELE_BLOCK, GameTimerImageType.SPRITE, "Half Teleblock", 150, ChronoUnit.SECONDS, true), - DMM_FULLTB(SpriteID.SPELL_TELE_BLOCK, GameTimerImageType.SPRITE, "Deadman Mode Full Teleblock", 150, ChronoUnit.SECONDS, true), - DMM_HALFTB(SpriteID.SPELL_TELE_BLOCK, GameTimerImageType.SPRITE, "Deadman Mode Half Teleblock", 75, ChronoUnit.SECONDS, true), - SUPERANTIFIRE(ItemID.SUPER_ANTIFIRE_POTION4, GameTimerImageType.ITEM, "Super antifire", 3, ChronoUnit.MINUTES), - BIND(SpriteID.SPELL_BIND, GameTimerImageType.SPRITE, "Bind", GraphicID.BIND, 5, ChronoUnit.SECONDS, true), - SNARE(SpriteID.SPELL_SNARE, GameTimerImageType.SPRITE, "Snare", GraphicID.SNARE, 10, ChronoUnit.SECONDS, true), - ENTANGLE(SpriteID.SPELL_ENTANGLE, GameTimerImageType.SPRITE, "Entangle", GraphicID.ENTANGLE, 15, ChronoUnit.SECONDS, true), - ICERUSH(SpriteID.SPELL_ICE_RUSH, GameTimerImageType.SPRITE, "Ice rush", GraphicID.ICE_RUSH, 5, ChronoUnit.SECONDS, true), - ICEBURST(SpriteID.SPELL_ICE_BURST, GameTimerImageType.SPRITE, "Ice burst", GraphicID.ICE_BURST, 10, ChronoUnit.SECONDS, true), - ICEBLITZ(SpriteID.SPELL_ICE_BLITZ, GameTimerImageType.SPRITE, "Ice blitz", GraphicID.ICE_BLITZ, 15, ChronoUnit.SECONDS, true), - ICEBARRAGE(SpriteID.SPELL_ICE_BARRAGE, GameTimerImageType.SPRITE, "Ice barrage", GraphicID.ICE_BARRAGE, 20, ChronoUnit.SECONDS, true), - IMBUEDHEART(ItemID.IMBUED_HEART, GameTimerImageType.ITEM, "Imbued heart", GraphicID.IMBUED_HEART, 420, ChronoUnit.SECONDS, true), - VENGEANCE(SpriteID.SPELL_VENGEANCE, GameTimerImageType.SPRITE, "Vengeance", 30, ChronoUnit.SECONDS), - EXSUPERANTIFIRE(ItemID.EXTENDED_SUPER_ANTIFIRE4, GameTimerImageType.ITEM, "Extended Super AntiFire", 6, ChronoUnit.MINUTES), - OVERLOAD_RAID(ItemID.OVERLOAD_4_20996, GameTimerImageType.ITEM, "Overload", 5, ChronoUnit.MINUTES, true), - PRAYER_ENHANCE(ItemID.PRAYER_ENHANCE_4, GameTimerImageType.ITEM, "Prayer enhance", 290, ChronoUnit.SECONDS, true), - GOD_WARS_ALTAR(SpriteID.SKILL_PRAYER, GameTimerImageType.SPRITE, "God wars altar", 10, ChronoUnit.MINUTES), - CHARGE(SpriteID.SPELL_CHARGE, GameTimerImageType.SPRITE, "Charge", 6, ChronoUnit.MINUTES), - STAFF_OF_THE_DEAD(ItemID.STAFF_OF_THE_DEAD, GameTimerImageType.ITEM, "Staff of the Dead", 1, ChronoUnit.MINUTES), - ABYSSAL_SIRE_STUN(ItemID.ABYSSAL_ORPHAN, GameTimerImageType.ITEM, "Abyssal Sire Stun", 30, ChronoUnit.SECONDS, true), - HOME_TELEPORT(SpriteID.SPELL_LUMBRIDGE_HOME_TELEPORT, GameTimerImageType.SPRITE, "Home Teleport", 30, ChronoUnit.MINUTES), - MINIGAME_TELEPORT(SpriteID.TAB_QUESTS_RED_MINIGAMES, GameTimerImageType.SPRITE, "Minigame Teleport", 20, ChronoUnit.MINUTES), - SKULL(SpriteID.PLAYER_KILLER_SKULL_523, GameTimerImageType.SPRITE, "Skull", 20, ChronoUnit.MINUTES), - ANTIPOISON(ItemID.ANTIPOISON4, GameTimerImageType.ITEM, "Antipoison"), - ANTIVENOM(ItemID.ANTIVENOM4, GameTimerImageType.ITEM, "Anti-venom"), - DRAGON_FIRE_SHIELD(ItemID.DRAGONFIRE_SHIELD_11284, GameTimerImageType.ITEM, "Dragonfire Shield Special", 2, ChronoUnit.MINUTES), - DIVINE_SUPER_ATTACK(ItemID.DIVINE_SUPER_ATTACK_POTION4, GameTimerImageType.ITEM, "Divine Super Attack", 5, ChronoUnit.MINUTES), - DIVINE_SUPER_STRENGTH(ItemID.DIVINE_SUPER_STRENGTH_POTION4, GameTimerImageType.ITEM, "Divine Super Strength", 5, ChronoUnit.MINUTES), - DIVINE_SUPER_DEFENCE(ItemID.DIVINE_SUPER_DEFENCE_POTION4, GameTimerImageType.ITEM, "Divine Super Defence", 5, ChronoUnit.MINUTES), - DIVINE_SUPER_COMBAT(ItemID.DIVINE_SUPER_COMBAT_POTION4, GameTimerImageType.ITEM, "Divine Super Combat", 5, ChronoUnit.MINUTES), - DIVINE_RANGING(ItemID.DIVINE_RANGING_POTION4, GameTimerImageType.ITEM, "Divine Ranging", 5, ChronoUnit.MINUTES), - DIVINE_MAGIC(ItemID.DIVINE_MAGIC_POTION4, GameTimerImageType.ITEM, "Divine Magic", 5, ChronoUnit.MINUTES); - - private final Duration duration; - private final Integer graphicId; - private final String description; - private final boolean removedOnDeath; - - private final int imageId; - private final GameTimerImageType imageType; - - GameTimer(final int imageId, final GameTimerImageType idType, final String description, final Integer graphicId, final long time, final ChronoUnit unit, final boolean removedOnDeath) - { - this.description = description; - this.graphicId = graphicId; - this.duration = Duration.of(time, unit); - this.imageId = imageId; - this.imageType = idType; - this.removedOnDeath = removedOnDeath; - } - - GameTimer(final int imageId, final GameTimerImageType idType, final String description, final long time, final ChronoUnit unit, final boolean removeOnDeath) - { - this(imageId, idType, description, null, time, unit, removeOnDeath); - } - - GameTimer(final int imageId, final GameTimerImageType idType, final String description, final Integer graphicId, final long time, final ChronoUnit unit) - { - this(imageId, idType, description, graphicId, time, unit, false); - } - - GameTimer(final int imageId, final GameTimerImageType idType, final String description, final long time, final ChronoUnit unit) - { - this(imageId, idType, description, null, time, unit, false); - } - - GameTimer(final int imageId, final GameTimerImageType idType, final String description) - { - this(imageId, idType, description, null, 1, ChronoUnit.MILLIS, false); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/GameTimerImageType.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/GameTimerImageType.java deleted file mode 100644 index 008e323fe1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/GameTimerImageType.java +++ /dev/null @@ -1,31 +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.timers; - -enum GameTimerImageType -{ - ITEM, - SPRITE -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/IndicatorIndicator.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/IndicatorIndicator.java deleted file mode 100644 index 85263b0f00..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/IndicatorIndicator.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2018, Tyler - * 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.timers; - -import java.awt.Color; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.ui.overlay.infobox.InfoBox; -import net.runelite.client.ui.overlay.infobox.InfoBoxPriority; - -public class IndicatorIndicator extends InfoBox -{ - @Getter(AccessLevel.PACKAGE) - private final GameIndicator indicator; - - IndicatorIndicator(final GameIndicator indicator, final Plugin plugin) - { - super(null, plugin); - this.indicator = indicator; - setPriority(InfoBoxPriority.MED); - } - - @Override - public String getText() - { - return indicator.getText(); - } - - @Override - public Color getTextColor() - { - return indicator.getTextColor(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TeleportWidget.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TeleportWidget.java deleted file mode 100644 index 1c7beb0c8b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TeleportWidget.java +++ /dev/null @@ -1,61 +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.timers; - -import com.google.common.collect.ImmutableList; -import java.util.Collection; -import javax.annotation.Nullable; -import net.runelite.api.widgets.WidgetInfo; - -enum TeleportWidget -{ - HOME_TELEPORT, - MINIGAME_TELEPORT; - - private static final Collection HOME_TELEPORT_IDS = ImmutableList.of( - WidgetInfo.SPELL_LUMBRIDGE_HOME_TELEPORT.getId(), - WidgetInfo.SPELL_EDGEVILLE_HOME_TELEPORT.getId(), - WidgetInfo.SPELL_LUNAR_HOME_TELEPORT.getId(), - WidgetInfo.SPELL_ARCEUUS_HOME_TELEPORT.getId(), - WidgetInfo.SPELL_KOUREND_HOME_TELEPORT.getId() - ); - private static final Collection MINIGAME_TELEPORT_IDS = ImmutableList.of( - WidgetInfo.MINIGAME_TELEPORT_BUTTON.getId() - ); - - @Nullable - static TeleportWidget of(int widgetId) - { - if (HOME_TELEPORT_IDS.contains(widgetId)) - { - return HOME_TELEPORT; - } - else if (MINIGAME_TELEPORT_IDS.contains(widgetId)) - { - return MINIGAME_TELEPORT; - } - return null; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimerTimer.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimerTimer.java deleted file mode 100644 index 88776d3bb6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimerTimer.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * Copyright (c) 2019, Lucas - * 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.timers; - -import java.time.temporal.ChronoUnit; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.ui.overlay.infobox.InfoBoxPriority; -import net.runelite.client.ui.overlay.infobox.Timer; - -class TimerTimer extends Timer -{ - private final GameTimer timer; - - TimerTimer(final GameTimer timer, final Plugin plugin) - { - super(timer.getDuration().toMillis(), ChronoUnit.MILLIS, null, plugin); - this.timer = timer; - setPriority(InfoBoxPriority.MED); - } - - TimerTimer(final GameTimer timer, final int amount, final Plugin plugin) - { - super(timer.getDuration().toMillis() * amount, ChronoUnit.MILLIS, null, plugin); - this.timer = timer; - setPriority(InfoBoxPriority.MED); - } - - public GameTimer getTimer() - { - return timer; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersConfig.java deleted file mode 100644 index 90a8990843..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersConfig.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.timers; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("timers") -public interface TimersConfig extends Config -{ - @ConfigItem( - keyName = "showHomeMinigameTeleports", - name = "Teleport cooldown timers", - description = "Configures whether timers for home and minigame teleport cooldowns are displayed" - ) - default boolean showHomeMinigameTeleports() - { - return true; - } - - @ConfigItem( - keyName = "showAntipoison", - name = "Antipoison/Venom timers", - description = "Configures whether timers for Antipoison, Antidote and Antivenom are displayed" - ) - default boolean showAntiPoison() - { - return true; - } - - @ConfigItem( - keyName = "showAntiFire", - name = "Antifire timer", - description = "Configures whether antifire timer is displayed" - ) - default boolean showAntiFire() - { - return true; - } - - @ConfigItem( - keyName = "showStamina", - name = "Stamina timer", - description = "Configures whether stamina timer is displayed" - ) - default boolean showStamina() - { - return true; - } - - @ConfigItem( - keyName = "showOverload", - name = "Overload timer", - description = "Configures whether overload timer is displayed" - ) - default boolean showOverload() - { - return true; - } - - @ConfigItem( - keyName = "showPrayerEnhance", - name = "Prayer enhance timer", - description = "Configures whether prayer enhance timer is displayed" - ) - default boolean showPrayerEnhance() - { - return true; - } - - @ConfigItem( - keyName = "showDivine", - name = "Divine potion timer", - description = "Configures whether divine potion timer is displayed" - ) - default boolean showDivine() - { - return true; - } - - @ConfigItem( - keyName = "showCannon", - name = "Cannon timer", - description = "Configures whether cannon timer is displayed" - ) - default boolean showCannon() - { - return true; - } - - @ConfigItem( - keyName = "showMagicImbue", - name = "Magic imbue timer", - description = "Configures whether magic imbue timer is displayed" - ) - default boolean showMagicImbue() - { - return true; - } - - @ConfigItem( - keyName = "showCharge", - name = "Charge timer", - description = "Configures whether to show a timer for the Charge spell" - ) - default boolean showCharge() - { - return true; - } - - @ConfigItem( - keyName = "showImbuedHeart", - name = "Imbued heart timer", - description = "Configures whether imbued heart timer is displayed" - ) - default boolean showImbuedHeart() - { - return true; - } - - @ConfigItem( - keyName = "showVengeance", - name = "Vengeance timer", - description = "Configures whether vengeance and vengeance other timer is displayed" - ) - default boolean showVengeance() - { - return true; - } - - @ConfigItem( - keyName = "showVengeanceActive", - name = "Vengeance active", - description = "Configures whether an indicator for vengeance being active is displayed" - ) - default boolean showVengeanceActive() - { - return true; - } - - @ConfigItem( - keyName = "showTeleblock", - name = "Teleblock timer", - description = "Configures whether teleblock timer is displayed" - ) - default boolean showTeleblock() - { - return true; - } - - @ConfigItem( - keyName = "showFreezes", - name = "Freeze timer", - description = "Configures whether freeze timer is displayed" - ) - default boolean showFreezes() - { - return true; - } - - @ConfigItem( - keyName = "showGodWarsAltar", - name = "God wars altar timer", - description = "Configures whether god wars altar timer is displayed" - ) - default boolean showGodWarsAltar() - { - return true; - } - - @ConfigItem( - keyName = "showSkull", - name = "Skull timer", - description = "Configures whether skull timer is displayed" - ) - default boolean showSkull() - { - return true; - } - - @ConfigItem( - keyName = "showStaffOfTheDead", - name = "Staff of the Dead timer", - description = "Configures whether staff of the dead timer is displayed" - ) - default boolean showStaffOfTheDead() - { - return true; - } - - @ConfigItem( - keyName = "showAbyssalSireStun", - name = "Abyssal Sire stun timer", - description = "Configures whether Abyssal Sire stun timer is displayed" - ) - default boolean showAbyssalSireStun() - { - return true; - } - - @ConfigItem( - keyName = "showDfsSpecial", - name = "Dragonfire Shield special timer", - description = "Configures whether the special attack cooldown timer for the Dragonfire Shield is displayed" - ) - default boolean showDFSSpecial() - { - return true; - } -} \ No newline at end of file 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 deleted file mode 100644 index 0f621b8286..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java +++ /dev/null @@ -1,1057 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * Copyright (c) 2018, Jordan Atwood - * Copyright (c) 2019, Lucas - * 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.timers; - -import com.google.inject.Provides; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Actor; -import net.runelite.api.AnimationID; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.EquipmentInventorySlot; -import net.runelite.api.GameState; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemID; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.Player; -import net.runelite.api.Skill; -import net.runelite.api.SkullIcon; -import net.runelite.api.VarPlayer; -import net.runelite.api.Varbits; -import net.runelite.api.WorldType; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.AnimationChanged; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.PlayerDeath; -import net.runelite.api.events.SpotAnimationChanged; -import net.runelite.api.events.StatChanged; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.events.WidgetHiddenChanged; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import static net.runelite.api.widgets.WidgetInfo.PVP_WORLD_SAFE_ZONE; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import static net.runelite.client.plugins.timers.GameIndicator.VENGEANCE_ACTIVE; -import static net.runelite.client.plugins.timers.GameTimer.*; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; - -@PluginDescriptor( - name = "Timers", - description = "Show various timers in an infobox", - tags = {"combat", "items", "magic", "potions", "prayer", "overlay", "abyssal", "sire"}, - type = PluginType.MISCELLANEOUS -) -@Slf4j -@Singleton -public class TimersPlugin extends Plugin -{ - private static final String ANTIFIRE_DRINK_MESSAGE = "You drink some of your antifire potion."; - private static final String ANTIFIRE_EXPIRED_MESSAGE = "Your antifire potion has expired."; - private static final String CANNON_FURNACE_MESSAGE = "You add the furnace."; - private static final String CANNON_PICKUP_MESSAGE = "You pick up the cannon. It's really heavy."; - 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 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 GOD_WARS_ALTAR_MESSAGE = "you recharge your prayer."; - private static final String IMBUED_HEART_READY_MESSAGE = "Your imbued heart has regained its magical power."; - private static final String IMBUED_HEART_NOTREADY_MESSAGE = "The heart is still drained of its 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!"; - private static final String STAFF_OF_THE_DEAD_SPEC_EXPIRED_MESSAGE = "Your protection fades away"; - private static final String STAFF_OF_THE_DEAD_SPEC_MESSAGE = "Spirits of deceased evildoers offer you their protection"; - private static final String STAMINA_DRINK_MESSAGE = "You drink some of your stamina potion."; - private static final String STAMINA_SHARED_DRINK_MESSAGE = "You have received a shared dose of stamina potion."; - private static final String STAMINA_EXPIRED_MESSAGE = "Your stamina potion has expired."; - private static final String SUPER_ANTIFIRE_DRINK_MESSAGE = "You drink some of your super antifire potion"; - private static final String SUPER_ANTIFIRE_EXPIRED_MESSAGE = "Your super antifire potion has expired."; - private static final int VENOM_VALUE_CUTOFF = -40; // Antivenom < -40 =< Antipoison < 0 - private static final int POISON_TICK_LENGTH = 30; - private static final String KILLED_TELEBLOCK_OPPONENT_TEXT = "Your Tele Block has been removed because you killed "; - private static final String PRAYER_ENHANCE_EXPIRED = "Your prayer enhance effect has worn off."; - private static final Pattern DEADMAN_HALF_TELEBLOCK_PATTERN = Pattern.compile("A Tele Block spell has been cast on you by (.+)\\. It will expire in 1 minute, 15 seconds\\."); - private static final Pattern FULL_TELEBLOCK_PATTERN = Pattern.compile("A Tele Block spell has been cast on you by (.+)\\. It will expire in 5 minutes\\."); - private static final Pattern HALF_TELEBLOCK_PATTERN = Pattern.compile("A Tele Block spell has been cast on you by (.+)\\. It will expire in 2 minutes, 30 seconds\\."); - private static final Pattern DIVINE_POTION_PATTERN = Pattern.compile("You drink some of your divine (.+) potion\\."); - - private TimerTimer freezeTimer; - private int freezeTime = -1; // time frozen, in game ticks - - private int lastRaidVarb; - private int lastWildernessVarb; - private int lastVengCooldownVarb; - private int lastIsVengeancedVarb; - private int lastPoisonVarp; - private int nextPoisonTick; - private WorldPoint lastPoint; - private TeleportWidget lastTeleportClicked; - private int lastAnimation; - private boolean loggedInRace; - private boolean widgetHiddenChangedOnPvpWorld; - private boolean skulledLastTick = false; - private boolean imbuedHeartClicked; - - @Inject - private ItemManager itemManager; - - @Inject - private SpriteManager spriteManager; - - @Inject - private Client client; - - @Inject - private TimersConfig config; - - @Inject - private InfoBoxManager infoBoxManager; - - private boolean showHomeMinigameTeleports; - private boolean showAntiPoison; - private boolean showAntiFire; - private boolean showStamina; - private boolean showOverload; - private boolean showPrayerEnhance; - private boolean showCannon; - private boolean showMagicImbue; - private boolean showCharge; - private boolean showImbuedHeart; - private boolean showVengeance; - private boolean showVengeanceActive; - @Setter(AccessLevel.PACKAGE) - private boolean showTeleblock; - private boolean showFreezes; - private boolean showGodWarsAltar; - private boolean showSkull; - private boolean showStaffOfTheDead; - private boolean showAbyssalSireStun; - private boolean showDivine; - - @Provides - TimersConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(TimersConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - } - - @Override - protected void shutDown() - { - infoBoxManager.removeIf(t -> t instanceof TimerTimer); - lastRaidVarb = -1; - lastPoint = null; - lastTeleportClicked = null; - lastAnimation = -1; - loggedInRace = false; - widgetHiddenChangedOnPvpWorld = false; - lastPoisonVarp = 0; - nextPoisonTick = 0; - imbuedHeartClicked = false; - } - - @Subscribe - private void onVarbitChanged(VarbitChanged event) - { - int raidVarb = client.getVar(Varbits.IN_RAID); - int vengCooldownVarb = client.getVar(Varbits.VENGEANCE_COOLDOWN); - int isVengeancedVarb = client.getVar(Varbits.VENGEANCE_ACTIVE); - int poisonVarp = client.getVar(VarPlayer.POISON); - - if (lastRaidVarb != raidVarb) - { - removeGameTimer(OVERLOAD_RAID); - removeGameTimer(PRAYER_ENHANCE); - lastRaidVarb = raidVarb; - } - - if (lastVengCooldownVarb != vengCooldownVarb && this.showVengeance) - { - if (vengCooldownVarb == 1) - { - createGameTimer(VENGEANCE); - } - else - { - removeGameTimer(VENGEANCE); - } - - lastVengCooldownVarb = vengCooldownVarb; - } - - if (lastIsVengeancedVarb != isVengeancedVarb && this.showVengeanceActive) - { - if (isVengeancedVarb == 1) - { - createGameIndicator(VENGEANCE_ACTIVE); - } - else - { - removeGameIndicator(VENGEANCE_ACTIVE); - } - - lastIsVengeancedVarb = isVengeancedVarb; - } - - int inWilderness = client.getVar(Varbits.IN_WILDERNESS); - - if (lastWildernessVarb != inWilderness - && client.getGameState() == GameState.LOGGED_IN - && !loggedInRace) - { - if (!WorldType.isPvpWorld(client.getWorldType()) - && inWilderness == 0) - { - log.debug("Left wilderness in non-PVP world, clearing Teleblock timer."); - removeTbTimers(); - } - - lastWildernessVarb = inWilderness; - } - - if (lastPoisonVarp != poisonVarp && this.showAntiPoison) - { - if (nextPoisonTick - client.getTickCount() <= 0 || lastPoisonVarp == 0) - { - nextPoisonTick = client.getTickCount() + 30; - } - - if (poisonVarp >= 0) - { - removeGameTimer(ANTIPOISON); - removeGameTimer(ANTIVENOM); - } - else if (poisonVarp >= VENOM_VALUE_CUTOFF) - { - int duration = 600 * (nextPoisonTick - client.getTickCount() + Math.abs((poisonVarp + 1) * POISON_TICK_LENGTH)); - removeGameTimer(ANTIVENOM); - createGameTimer(ANTIPOISON, duration); - } - else - { - int duration = 600 * (nextPoisonTick - client.getTickCount() + Math.abs((poisonVarp + 1 - VENOM_VALUE_CUTOFF) * POISON_TICK_LENGTH)); - removeGameTimer(ANTIPOISON); - createGameTimer(ANTIVENOM, duration); - } - - lastPoisonVarp = poisonVarp; - } - } - - @Subscribe - private void onWidgetHiddenChanged(WidgetHiddenChanged event) - { - Widget widget = event.getWidget(); - if (WorldType.isPvpWorld(client.getWorldType()) - && WidgetInfo.TO_GROUP(widget.getId()) == WidgetID.PVP_GROUP_ID) - { - widgetHiddenChangedOnPvpWorld = true; - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("timers")) - { - return; - } - - updateConfig(); - - if (!this.showHomeMinigameTeleports) - { - removeGameTimer(HOME_TELEPORT); - removeGameTimer(MINIGAME_TELEPORT); - } - - if (!this.showAntiFire) - { - removeGameTimer(ANTIFIRE); - removeGameTimer(EXANTIFIRE); - removeGameTimer(SUPERANTIFIRE); - } - - if (!this.showStamina) - { - removeGameTimer(STAMINA); - } - - if (!this.showOverload) - { - removeGameTimer(OVERLOAD); - removeGameTimer(OVERLOAD_RAID); - } - - if (!this.showPrayerEnhance) - { - removeGameTimer(PRAYER_ENHANCE); - } - - if (!this.showDivine) - { - removeGameTimer(DIVINE_SUPER_ATTACK); - removeGameTimer(DIVINE_SUPER_STRENGTH); - removeGameTimer(DIVINE_SUPER_DEFENCE); - removeGameTimer(DIVINE_SUPER_COMBAT); - removeGameTimer(DIVINE_RANGING); - removeGameTimer(DIVINE_MAGIC); - } - - if (!this.showCannon) - { - removeGameTimer(CANNON); - } - - if (!this.showMagicImbue) - { - removeGameTimer(MAGICIMBUE); - } - - if (!this.showCharge) - { - removeGameTimer(CHARGE); - } - - if (!this.showImbuedHeart) - { - removeGameTimer(IMBUEDHEART); - } - - if (!this.showStaffOfTheDead) - { - removeGameTimer(STAFF_OF_THE_DEAD); - } - - if (!this.showVengeance) - { - removeGameTimer(VENGEANCE); - } - - if (!this.showVengeanceActive) - { - removeGameIndicator(VENGEANCE_ACTIVE); - } - - if (!this.showTeleblock) - { - removeTbTimers(); - } - - if (!this.showFreezes) - { - removeGameTimer(BIND); - removeGameTimer(SNARE); - removeGameTimer(ENTANGLE); - removeGameTimer(ICERUSH); - removeGameTimer(ICEBURST); - removeGameTimer(ICEBLITZ); - removeGameTimer(ICEBARRAGE); - } - - if (!config.showAntiPoison()) - { - removeGameTimer(ANTIPOISON); - removeGameTimer(ANTIVENOM); - } - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked event) - { - if (this.showStamina - && event.getOption().contains("Drink") - && (event.getIdentifier() == ItemID.STAMINA_MIX1 - || event.getIdentifier() == ItemID.STAMINA_MIX2 - || event.getIdentifier() == ItemID.EGNIOL_POTION_1 - || event.getIdentifier() == ItemID.EGNIOL_POTION_2 - || event.getIdentifier() == ItemID.EGNIOL_POTION_3 - || event.getIdentifier() == ItemID.EGNIOL_POTION_4)) - { - // Needs menu option hook because mixes use a common drink message, distinct from their standard potion messages - createGameTimer(STAMINA); - return; - } - - if (this.showAntiFire - && event.getOption().contains("Drink") - && (event.getIdentifier() == ItemID.ANTIFIRE_MIX1 - || event.getIdentifier() == ItemID.ANTIFIRE_MIX2)) - { - // Needs menu option hook because mixes use a common drink message, distinct from their standard potion messages - createGameTimer(ANTIFIRE); - return; - } - - if (this.showAntiFire - && event.getOption().contains("Drink") - && (event.getIdentifier() == ItemID.EXTENDED_ANTIFIRE_MIX1 - || event.getIdentifier() == ItemID.EXTENDED_ANTIFIRE_MIX2)) - { - // Needs menu option hook because mixes use a common drink message, distinct from their standard potion messages - createGameTimer(EXANTIFIRE); - return; - } - - if (this.showAntiFire - && event.getOption().contains("Drink") - && (event.getIdentifier() == ItemID.SUPER_ANTIFIRE_MIX1 - || event.getIdentifier() == ItemID.SUPER_ANTIFIRE_MIX2)) - { - // Needs menu option hook because mixes use a common drink message, distinct from their standard potion messages - createGameTimer(SUPERANTIFIRE); - return; - } - - if (this.showAntiFire - && event.getOption().contains("Drink") - && (event.getIdentifier() == ItemID.EXTENDED_SUPER_ANTIFIRE_MIX1 - || event.getIdentifier() == ItemID.EXTENDED_SUPER_ANTIFIRE_MIX2)) - { - // Needs menu option hook because mixes use a common drink message, distinct from their standard potion messages - createGameTimer(EXSUPERANTIFIRE); - return; - } - - TeleportWidget teleportWidget = TeleportWidget.of(event.getParam1()); - if (teleportWidget != null) - { - lastTeleportClicked = teleportWidget; - } - - if (this.showImbuedHeart - && event.getOption().contains("Invigorate")) - { - // Needs a hook as there's a few cases where potions boost the same amount as the heart - imbuedHeartClicked = true; - } - } - - @Subscribe - void onChatMessage(ChatMessage event) - { - if (event.getType() != ChatMessageType.SPAM && event.getType() != ChatMessageType.GAMEMESSAGE) - { - return; - } - - if (this.showStamina && (event.getMessage().equals(STAMINA_DRINK_MESSAGE) || event.getMessage().equals(STAMINA_SHARED_DRINK_MESSAGE))) - { - createGameTimer(STAMINA); - } - - if (this.showStamina && event.getMessage().equals(STAMINA_EXPIRED_MESSAGE)) - { - removeGameTimer(STAMINA); - } - - if (this.showAntiFire && event.getMessage().equals(ANTIFIRE_DRINK_MESSAGE)) - { - createGameTimer(ANTIFIRE); - } - - if (this.showAntiFire && event.getMessage().equals(EXTENDED_ANTIFIRE_DRINK_MESSAGE)) - { - createGameTimer(EXANTIFIRE); - } - - if (this.showGodWarsAltar && event.getMessage().equalsIgnoreCase(GOD_WARS_ALTAR_MESSAGE))//Normal altars are "You recharge your Prayer points." while gwd is "You recharge your Prayer." - { - createGameTimer(GOD_WARS_ALTAR); - } - - if (this.showAntiFire && event.getMessage().equals(EXTENDED_SUPER_ANTIFIRE_DRINK_MESSAGE)) - { - createGameTimer(EXSUPERANTIFIRE); - } - - if (this.showAntiFire && event.getMessage().equals(ANTIFIRE_EXPIRED_MESSAGE)) - { - //they have the same expired message - removeGameTimer(ANTIFIRE); - removeGameTimer(EXANTIFIRE); - } - - if (this.showOverload && event.getMessage().startsWith("You drink some of your") && event.getMessage().contains("overload")) - { - if (client.getVar(Varbits.IN_RAID) == 1) - { - createGameTimer(OVERLOAD_RAID); - } - else - { - createGameTimer(OVERLOAD); - } - - } - - if (this.showCannon && (event.getMessage().equals(CANNON_FURNACE_MESSAGE) || event.getMessage().contains(CANNON_REPAIR_MESSAGE))) - { - createGameTimer(CANNON); - } - - if (this.showCannon && event.getMessage().equals(CANNON_PICKUP_MESSAGE)) - { - removeGameTimer(CANNON); - } - - if (this.showMagicImbue && event.getMessage().equals(MAGIC_IMBUE_MESSAGE)) - { - createGameTimer(MAGICIMBUE); - } - - if (event.getMessage().equals(MAGIC_IMBUE_EXPIRED_MESSAGE)) - { - removeGameTimer(MAGICIMBUE); - } - - if (this.showTeleblock) - { - if (FULL_TELEBLOCK_PATTERN.matcher(event.getMessage()).find()) - { - createGameTimer(FULLTB); - } - else if (HALF_TELEBLOCK_PATTERN.matcher(event.getMessage()).find()) - { - if (client.getWorldType().contains(WorldType.DEADMAN)) - { - createGameTimer(DMM_FULLTB); - } - else - { - createGameTimer(HALFTB); - } - } - else if (DEADMAN_HALF_TELEBLOCK_PATTERN.matcher(event.getMessage()).find()) - { - createGameTimer(DMM_HALFTB); - } - else if (event.getMessage().startsWith(KILLED_TELEBLOCK_OPPONENT_TEXT)) - { - removeTbTimers(); - } - } - - if (this.showAntiFire && event.getMessage().contains(SUPER_ANTIFIRE_DRINK_MESSAGE)) - { - createGameTimer(SUPERANTIFIRE); - } - - if (this.showAntiFire && event.getMessage().equals(SUPER_ANTIFIRE_EXPIRED_MESSAGE)) - { - removeGameTimer(SUPERANTIFIRE); - } - - if (this.showImbuedHeart && event.getMessage().contains(IMBUED_HEART_NOTREADY_MESSAGE)) - { - imbuedHeartClicked = false; - return; - } - - if (this.showImbuedHeart && event.getMessage().equals(IMBUED_HEART_READY_MESSAGE)) - { - removeGameTimer(IMBUEDHEART); - } - - if (this.showPrayerEnhance && event.getMessage().startsWith("You drink some of your") && event.getMessage().contains("prayer enhance")) - { - createGameTimer(PRAYER_ENHANCE); - } - - if (this.showPrayerEnhance && event.getMessage().equals(PRAYER_ENHANCE_EXPIRED)) - { - removeGameTimer(PRAYER_ENHANCE); - } - - if (this.showCharge && event.getMessage().equals(CHARGE_MESSAGE)) - { - createGameTimer(CHARGE); - } - - if (this.showCharge && event.getMessage().equals(CHARGE_EXPIRED_MESSAGE)) - { - removeGameTimer(CHARGE); - } - - if (this.showStaffOfTheDead && event.getMessage().contains(STAFF_OF_THE_DEAD_SPEC_MESSAGE)) - { - createGameTimer(STAFF_OF_THE_DEAD); - } - - if (this.showStaffOfTheDead && event.getMessage().contains(STAFF_OF_THE_DEAD_SPEC_EXPIRED_MESSAGE)) - { - removeGameTimer(STAFF_OF_THE_DEAD); - } - - if (this.showFreezes && event.getMessage().equals(FROZEN_MESSAGE)) - { - freezeTimer = createGameTimer(ICEBARRAGE); - freezeTime = client.getTickCount(); - } - - if (config.showDivine()) - { - Matcher mDivine = DIVINE_POTION_PATTERN.matcher(event.getMessage()); - if (mDivine.find()) - { - switch (mDivine.group(1)) - { - case "super attack": - createGameTimer(DIVINE_SUPER_ATTACK); - break; - - case "super strength": - createGameTimer(DIVINE_SUPER_STRENGTH); - break; - - case "super defence": - createGameTimer(DIVINE_SUPER_DEFENCE); - break; - - case "combat": - createGameTimer(DIVINE_SUPER_COMBAT); - break; - - case "ranging": - createGameTimer(DIVINE_RANGING); - break; - - case "magic": - createGameTimer(DIVINE_MAGIC); - break; - } - } - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - loggedInRace = false; - - Player player = client.getLocalPlayer(); - - if (player == null) - { - return; - } - - WorldPoint currentWorldPoint = player.getWorldLocation(); - - final boolean isSkulled = player.getSkullIcon() != null && player.getSkullIcon() != SkullIcon.SKULL_FIGHT_PIT; - - if (isSkulled != skulledLastTick && this.showSkull) - { - skulledLastTick = isSkulled; - if (isSkulled) - { - createGameTimer(SKULL); - } - else - { - removeGameTimer(SKULL); - } - } - - if (freezeTimer != null && - // assume movement means unfrozen - freezeTime != client.getTickCount() - && !currentWorldPoint.equals(lastPoint)) - { - removeGameTimer(freezeTimer.getTimer()); - freezeTimer = null; - } - - lastPoint = currentWorldPoint; - - if (!widgetHiddenChangedOnPvpWorld) - { - return; - } - - widgetHiddenChangedOnPvpWorld = false; - - Widget widget = client.getWidget(PVP_WORLD_SAFE_ZONE); - if (widget != null - && !widget.isSelfHidden()) - { - log.debug("Entered safe zone in PVP world, clearing Teleblock timer."); - removeTbTimers(); - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged gameStateChanged) - { - switch (gameStateChanged.getGameState()) - { - case HOPPING: - case LOGIN_SCREEN: - removeTbTimers(); - break; - case LOGGED_IN: - loggedInRace = true; - break; - } - } - - @Subscribe - private void onAnimationChanged(AnimationChanged event) - { - Actor actor = event.getActor(); - - if (this.showAbyssalSireStun - && actor instanceof NPC) - { - int npcId = ((NPC) actor).getId(); - - switch (npcId) - { - // Show the countdown when the Sire enters the stunned state. - case NpcID.ABYSSAL_SIRE_5887: - createGameTimer(ABYSSAL_SIRE_STUN); - break; - - // Hide the countdown if the Sire isn't in the stunned state. - // This is necessary because the Sire leaves the stunned - // state early once all all four respiratory systems are killed. - case NpcID.ABYSSAL_SIRE: - case NpcID.ABYSSAL_SIRE_5888: - case NpcID.ABYSSAL_SIRE_5889: - case NpcID.ABYSSAL_SIRE_5890: - case NpcID.ABYSSAL_SIRE_5891: - case NpcID.ABYSSAL_SIRE_5908: - removeGameTimer(ABYSSAL_SIRE_STUN); - break; - } - } - - Player player = client.getLocalPlayer(); - - if (player == null || actor != player) - { - return; - } - - if (this.showHomeMinigameTeleports - && player.getAnimation() == AnimationID.IDLE - && (lastAnimation == AnimationID.BOOK_HOME_TELEPORT_5 - || lastAnimation == AnimationID.COW_HOME_TELEPORT_6)) - { - if (lastTeleportClicked == TeleportWidget.HOME_TELEPORT) - { - createGameTimer(HOME_TELEPORT); - } - else if (lastTeleportClicked == TeleportWidget.MINIGAME_TELEPORT) - { - createGameTimer(MINIGAME_TELEPORT); - } - } - - if (config.showDFSSpecial() && lastAnimation == AnimationID.DRAGONFIRE_SHIELD_SPECIAL) - { - createGameTimer(DRAGON_FIRE_SHIELD); - } - - lastAnimation = player.getAnimation(); - } - - @Subscribe - private void onSpotAnimationChanged(SpotAnimationChanged event) - { - Actor actor = event.getActor(); - Player player = client.getLocalPlayer(); - - if (player == null || actor != client.getLocalPlayer()) - { - return; - } - - if (this.showImbuedHeart && actor.getSpotAnimation() == IMBUEDHEART.getGraphicId()) - { - createGameTimer(IMBUEDHEART); - } - - if (this.showFreezes) - { - if (actor.getSpotAnimation() == BIND.getGraphicId()) - { - createGameTimer(BIND); - } - - if (actor.getSpotAnimation() == SNARE.getGraphicId()) - { - createGameTimer(SNARE); - } - - if (actor.getSpotAnimation() == ENTANGLE.getGraphicId()) - { - createGameTimer(ENTANGLE); - } - - // downgrade freeze based on graphic, if at the same tick as the freeze message - if (freezeTime == client.getTickCount()) - { - if (actor.getSpotAnimation() == ICERUSH.getGraphicId()) - { - removeGameTimer(ICEBARRAGE); - freezeTimer = createGameTimer(ICERUSH); - } - - if (actor.getSpotAnimation() == ICEBURST.getGraphicId()) - { - removeGameTimer(ICEBARRAGE); - freezeTimer = createGameTimer(ICEBURST); - } - - if (actor.getSpotAnimation() == ICEBLITZ.getGraphicId()) - { - removeGameTimer(ICEBARRAGE); - freezeTimer = createGameTimer(ICEBLITZ); - } - } - } - } - - /** - * remove SOTD timer when weapon is changed - * - * @param itemContainerChanged - */ - @Subscribe - private void onItemContainerChanged(ItemContainerChanged itemContainerChanged) - { - ItemContainer container = itemContainerChanged.getItemContainer(); - if (container == client.getItemContainer(InventoryID.EQUIPMENT)) - { - Item[] items = container.getItems(); - int weaponIdx = EquipmentInventorySlot.WEAPON.getSlotIdx(); - - if (items == null || weaponIdx >= items.length) - { - removeGameTimer(STAFF_OF_THE_DEAD); - return; - } - - Item weapon = items[weaponIdx]; - if (weapon == null) - { - removeGameTimer(STAFF_OF_THE_DEAD); - return; - } - - switch (weapon.getId()) - { - case ItemID.STAFF_OF_THE_DEAD: - case ItemID.TOXIC_STAFF_OF_THE_DEAD: - case ItemID.STAFF_OF_LIGHT: - case ItemID.TOXIC_STAFF_UNCHARGED: - // don't reset timer if still wielding staff - return; - default: - removeGameTimer(STAFF_OF_THE_DEAD); - } - } - } - - @Subscribe - private void onNpcDespawned(NpcDespawned npcDespawned) - { - NPC npc = npcDespawned.getNpc(); - - if (!npc.isDead()) - { - return; - } - - int npcId = npc.getId(); - - if (npcId == NpcID.ZOMBIFIED_SPAWN || npcId == NpcID.ZOMBIFIED_SPAWN_8063) - { - removeGameTimer(ICEBARRAGE); - } - } - - @Subscribe - private void onPlayerDeath(PlayerDeath playerDeath) - { - if (playerDeath.getPlayer() == client.getLocalPlayer()) - { - infoBoxManager.removeIf(t -> t instanceof TimerTimer && ((TimerTimer) t).getTimer().isRemovedOnDeath()); - } - } - - @Subscribe - private void onStatChanged(StatChanged event) - { - Skill skill = event.getSkill(); - - if (skill != Skill.MAGIC || !this.showImbuedHeart || !imbuedHeartClicked) - { - return; - } - - int magicLvl = client.getRealSkillLevel(skill); - int magicBoost = client.getBoostedSkillLevel(skill); - int heartBoost = 1 + (int) (magicLvl * 0.1); - - if (magicBoost - magicLvl != heartBoost) - { - return; - } - - imbuedHeartClicked = false; - createGameTimer(IMBUEDHEART); - } - - private TimerTimer createGameTimer(final GameTimer timer) - { - removeGameTimer(timer); - - TimerTimer t = new TimerTimer(timer, this); - switch (timer.getImageType()) - { - case SPRITE: - spriteManager.getSpriteAsync(timer.getImageId(), 0, t); - break; - case ITEM: - t.setImage(itemManager.getImage(timer.getImageId())); - break; - } - t.setTooltip(timer.getDescription()); - infoBoxManager.addInfoBox(t); - return t; - } - - private TimerTimer createGameTimer(final GameTimer timer, final int duration) - { - removeGameTimer(timer); - - TimerTimer t = new TimerTimer(timer, duration, this); - switch (timer.getImageType()) - { - case SPRITE: - spriteManager.getSpriteAsync(timer.getImageId(), 0, t); - break; - case ITEM: - t.setImage(itemManager.getImage(timer.getImageId())); - break; - } - t.setTooltip(timer.getDescription()); - infoBoxManager.addInfoBox(t); - return t; - } - - private void removeGameTimer(GameTimer timer) - { - infoBoxManager.removeIf(t -> t instanceof TimerTimer && ((TimerTimer) t).getTimer() == timer); - } - - private IndicatorIndicator createGameIndicator(GameIndicator gameIndicator) - { - removeGameIndicator(gameIndicator); - - IndicatorIndicator indicator = new IndicatorIndicator(gameIndicator, this); - switch (gameIndicator.getImageType()) - { - case SPRITE: - spriteManager.getSpriteAsync(gameIndicator.getImageId(), 0, indicator); - break; - case ITEM: - indicator.setImage(itemManager.getImage(gameIndicator.getImageId())); - break; - } - indicator.setTooltip(gameIndicator.getDescription()); - infoBoxManager.addInfoBox(indicator); - - return indicator; - } - - private void removeGameIndicator(GameIndicator indicator) - { - infoBoxManager.removeIf(t -> t instanceof IndicatorIndicator && ((IndicatorIndicator) t).getIndicator() == indicator); - } - - private void removeTbTimers() - { - removeGameTimer(FULLTB); - removeGameTimer(HALFTB); - removeGameTimer(DMM_FULLTB); - removeGameTimer(DMM_HALFTB); - } - - private void updateConfig() - { - this.showHomeMinigameTeleports = config.showHomeMinigameTeleports(); - this.showAntiPoison = config.showAntiPoison(); - this.showAntiFire = config.showAntiFire(); - this.showStamina = config.showStamina(); - this.showOverload = config.showOverload(); - this.showPrayerEnhance = config.showPrayerEnhance(); - this.showCannon = config.showCannon(); - this.showMagicImbue = config.showMagicImbue(); - this.showCharge = config.showCharge(); - this.showImbuedHeart = config.showImbuedHeart(); - this.showVengeance = config.showVengeance(); - this.showVengeanceActive = config.showVengeanceActive(); - this.showTeleblock = config.showTeleblock(); - this.showFreezes = config.showFreezes(); - this.showGodWarsAltar = config.showGodWarsAltar(); - this.showSkull = config.showSkull(); - this.showStaffOfTheDead = config.showStaffOfTheDead(); - this.showAbyssalSireStun = config.showAbyssalSireStun(); - this.showDivine = config.showDivine(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timestamp/TimestampConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/timestamp/TimestampConfig.java deleted file mode 100644 index fda97b0941..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timestamp/TimestampConfig.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2019, Tomas Slusny - * 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.timestamp; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("timestamp") -public interface TimestampConfig extends Config -{ - @ConfigItem( - keyName = "opaqueTimestamp", - name = "Timestamps (opaque)", - position = 1, - description = "Colour of Timestamps from the Timestamps plugin (opaque)" - ) - Color opaqueTimestamp(); - - @ConfigItem( - keyName = "transparentTimestamp", - name = "Timestamps (transparent)", - position = 2, - description = "Colour of Timestamps from the Timestamps plugin (transparent)" - ) - Color transparentTimestamp(); - - @ConfigItem( - keyName = "format", - name = "Timestamp Format", - position = 3, - description = "Customize your timestamp format by using the following characters
" + - "'yyyy' : year
" + - "'MM' : month
" + - "'dd' : day
" + - "'HH' : hour in 24 hour format
" + - "'hh' : hour in 12 hour format
" + - "'mm' : minute
" + - "'ss' : second" - ) - default String timestampFormat() - { - return "[HH:mm]"; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timestamp/TimestampPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/timestamp/TimestampPlugin.java deleted file mode 100644 index 5aa41eb4ec..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timestamp/TimestampPlugin.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2018, Magic fTail - * Copyright (c) 2018, 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.timestamp; - -import com.google.inject.Provides; -import java.awt.Color; -import java.text.SimpleDateFormat; -import java.time.Instant; -import java.time.ZoneId; -import java.time.ZonedDateTime; -import java.util.Date; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.MessageNode; -import net.runelite.api.Varbits; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.util.ColorUtil; - -@PluginDescriptor( - name = "Chat Timestamps", - description = "Add timestamps to chat messages", - tags = {"timestamp"}, - enabledByDefault = false, - type = PluginType.UTILITY -) -@Singleton -public class TimestampPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private TimestampConfig config; - - @Getter(AccessLevel.PACKAGE) - private SimpleDateFormat formatter; - - @Provides - public TimestampConfig provideConfig(final ConfigManager configManager) - { - return configManager.getConfig(TimestampConfig.class); - } - - @Override - protected void startUp() - { - - updateFormatter(); - } - - @Override - protected void shutDown() - { - formatter = null; - } - - @Subscribe - void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("timestamp") && event.getKey().equals("format")) - { - updateFormatter(); - } - } - - @Subscribe - private void onScriptCallbackEvent(ScriptCallbackEvent event) - { - if (!event.getEventName().equals("addTimestamp")) - { - return; - } - - int[] intStack = client.getIntStack(); - int intStackSize = client.getIntStackSize(); - - String[] stringStack = client.getStringStack(); - int stringStackSize = client.getStringStackSize(); - - int messageId = intStack[intStackSize - 1]; - - MessageNode messageNode = (MessageNode) client.getMessages().get(messageId); - - String timestamp = generateTimestamp(messageNode.getTimestamp(), ZoneId.systemDefault()) + " "; - - Color timestampColour = getTimestampColour(); - if (timestampColour != null) - { - timestamp = ColorUtil.wrapWithColorTag(timestamp, timestampColour); - } - - stringStack[stringStackSize - 1] = timestamp; - } - - private Color getTimestampColour() - { - boolean isChatboxTransparent = client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1; - - return isChatboxTransparent ? config.transparentTimestamp() : config.opaqueTimestamp(); - } - - String generateTimestamp(int timestamp, ZoneId zoneId) - { - final ZonedDateTime time = ZonedDateTime.ofInstant( - Instant.ofEpochSecond(timestamp), zoneId); - - return formatter.format(Date.from(time.toInstant())); - } - - private void updateFormatter() - { - try - { - formatter = new SimpleDateFormat(config.timestampFormat()); - } - catch (IllegalArgumentException e) - { - formatter = new SimpleDateFormat("[HH:mm]"); - } - } -} \ No newline at end of file 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 deleted file mode 100644 index 973eec5eaa..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/OverviewItemPanel.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2018, Daniel Teo - * 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.timetracking; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -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; -import net.runelite.client.util.ImageUtil; - -class OverviewItemPanel extends JPanel -{ - private static final ImageIcon ARROW_RIGHT_ICON; - - private static final Color HOVER_COLOR = ColorScheme.DARKER_GRAY_HOVER_COLOR; - - private final JLabel statusLabel; - - static - { - ARROW_RIGHT_ICON = new ImageIcon(ImageUtil.getResourceStreamFromClass(TimeTrackingPlugin.class, "/net/runelite/client/plugins/timetracking/arrow_right.png")); - } - - OverviewItemPanel(ItemManager itemManager, TimeTrackingPanel pluginPanel, Tab tab, String title) - { - setBackground(ColorScheme.DARKER_GRAY_COLOR); - setLayout(new BorderLayout()); - setBorder(new EmptyBorder(7, 7, 7, 7)); - - JLabel iconLabel = new JLabel(); - iconLabel.setMinimumSize(new Dimension(Constants.ITEM_SPRITE_WIDTH, Constants.ITEM_SPRITE_HEIGHT)); - itemManager.getImage(tab.getItemID()).addTo(iconLabel); - add(iconLabel, BorderLayout.WEST); - - JPanel textContainer = new JPanel(); - textContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR); - textContainer.setLayout(new GridLayout(2, 1)); - textContainer.setBorder(new EmptyBorder(5, 7, 5, 7)); - - addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - pluginPanel.switchTab(tab); - setBackground(ColorScheme.DARKER_GRAY_COLOR); - textContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR); - } - - @Override - public void mouseReleased(MouseEvent e) - { - setBackground(HOVER_COLOR); - textContainer.setBackground(HOVER_COLOR); - } - - @Override - public void mouseEntered(MouseEvent e) - { - setBackground(HOVER_COLOR); - textContainer.setBackground(HOVER_COLOR); - setCursor(new Cursor(Cursor.HAND_CURSOR)); - } - - @Override - public void mouseExited(MouseEvent e) - { - setBackground(ColorScheme.DARKER_GRAY_COLOR); - textContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR); - setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); - } - }); - - JLabel titleLabel = new JLabel(title); - titleLabel.setForeground(Color.WHITE); - titleLabel.setFont(FontManager.getRunescapeSmallFont()); - - statusLabel = new JLabel(); - statusLabel.setForeground(Color.GRAY); - statusLabel.setFont(FontManager.getRunescapeSmallFont()); - - textContainer.add(titleLabel); - textContainer.add(statusLabel); - - add(textContainer, BorderLayout.CENTER); - - JLabel arrowLabel = new JLabel(ARROW_RIGHT_ICON); - add(arrowLabel, BorderLayout.EAST); - } - - void updateStatus(String text, Color color) - { - statusLabel.setText(text); - statusLabel.setForeground(color); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/OverviewTabPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/OverviewTabPanel.java deleted file mode 100644 index 059ec9292e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/OverviewTabPanel.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2018, Daniel Teo - * 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.timetracking; - -import com.google.common.collect.ImmutableMap; -import java.awt.Color; -import java.awt.GridLayout; -import java.time.Instant; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Stream; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.timetracking.clocks.ClockManager; -import net.runelite.client.plugins.timetracking.farming.FarmingTracker; -import net.runelite.client.plugins.timetracking.hunter.BirdHouseTracker; -import net.runelite.client.ui.ColorScheme; - -class OverviewTabPanel extends TabContentPanel -{ - private final TimeTrackingConfig config; - private final FarmingTracker farmingTracker; - private final BirdHouseTracker birdHouseTracker; - private final ClockManager clockManager; - - private final OverviewItemPanel timerOverview; - private final OverviewItemPanel stopwatchOverview; - private final Map farmingOverviews; - private final OverviewItemPanel birdHouseOverview; - - OverviewTabPanel(ItemManager itemManager, TimeTrackingConfig config, TimeTrackingPanel pluginPanel, - FarmingTracker farmingTracker, BirdHouseTracker birdHouseTracker, ClockManager clockManager) - { - this.config = config; - this.farmingTracker = farmingTracker; - this.birdHouseTracker = birdHouseTracker; - this.clockManager = clockManager; - - setLayout(new GridLayout(0, 1, 0, 8)); - setBackground(ColorScheme.DARK_GRAY_COLOR); - - timerOverview = new OverviewItemPanel(itemManager, pluginPanel, Tab.CLOCK, "Timers"); - add(timerOverview); - - stopwatchOverview = new OverviewItemPanel(itemManager, pluginPanel, Tab.CLOCK, "Stopwatches"); - add(stopwatchOverview); - - birdHouseOverview = new OverviewItemPanel(itemManager, pluginPanel, Tab.BIRD_HOUSE, "Bird Houses"); - add(birdHouseOverview); - - farmingOverviews = Stream.of(Tab.FARMING_TABS) - .filter(v -> v != Tab.OVERVIEW) - .collect(ImmutableMap.toImmutableMap( - Function.identity(), - t -> - { - OverviewItemPanel p = new OverviewItemPanel(itemManager, pluginPanel, t, t.getName()); - add(p); - return p; - } - )); - } - - @Override - public int getUpdateInterval() - { - return 50; // 10 seconds - } - - @Override - public void update() - { - final long timers = clockManager.getActiveTimerCount(); - final long stopwatches = clockManager.getActiveStopwatchCount(); - - if (timers == 0) - { - timerOverview.updateStatus("No active timers", Color.GRAY); - } - else - { - timerOverview.updateStatus(timers + " active timer" + (timers == 1 ? "" : "s"), ColorScheme.PROGRESS_COMPLETE_COLOR); - } - - if (stopwatches == 0) - { - stopwatchOverview.updateStatus("No active stopwatches", Color.GRAY); - } - else - { - stopwatchOverview.updateStatus(stopwatches + " active stopwatch" + (stopwatches == 1 ? "" : "es"), ColorScheme.PROGRESS_COMPLETE_COLOR); - } - - farmingOverviews.forEach((patchType, panel) -> - updateItemPanel(panel, farmingTracker.getSummary(patchType), farmingTracker.getCompletionTime(patchType))); - - updateItemPanel(birdHouseOverview, birdHouseTracker.getSummary(), birdHouseTracker.getCompletionTime()); - } - - private void updateItemPanel(OverviewItemPanel panel, SummaryState summary, long completionTime) - { - switch (summary) - { - case COMPLETED: - case IN_PROGRESS: - { - long duration = completionTime - Instant.now().getEpochSecond(); - - if (duration <= 0) - { - panel.updateStatus("Ready", ColorScheme.PROGRESS_COMPLETE_COLOR); - } - else - { - panel.updateStatus("Ready " + getFormattedEstimate(duration, config.estimateRelative()), Color.GRAY); - } - - break; - } - case EMPTY: - panel.updateStatus("Empty", Color.GRAY); - break; - case UNKNOWN: - default: - panel.updateStatus("Unknown", Color.GRAY); - break; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/SummaryState.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/SummaryState.java deleted file mode 100644 index 3dc659f53e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/SummaryState.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2018, Daniel Teo - * 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.timetracking; - -public enum SummaryState -{ - COMPLETED, - IN_PROGRESS, - EMPTY, - UNKNOWN -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/Tab.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/Tab.java deleted file mode 100644 index 87249940b4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/Tab.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.timetracking; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.api.ItemID; - -@RequiredArgsConstructor -@Getter(AccessLevel.PACKAGE) -public enum Tab -{ - OVERVIEW("Overview", ItemID.OLD_NOTES), - CLOCK("Timers & Stopwatches", ItemID.WATCH), - BIRD_HOUSE("Bird Houses", ItemID.OAK_BIRD_HOUSE), - ALLOTMENT("Allotment Patches", ItemID.CABBAGE), - FLOWER("Flower Patches", ItemID.RED_FLOWERS), - HERB("Herb Patches", ItemID.GRIMY_RANARR_WEED), - TREE("Tree Patches", ItemID.YEW_LOGS), - FRUIT_TREE("Fruit Tree Patches", ItemID.PINEAPPLE), - HOPS("Hops Patches", ItemID.BARLEY), - BUSH("Bush Patches", ItemID.POISON_IVY_BERRIES), - GRAPE("Grape Patches", ItemID.GRAPES), - SPECIAL("Special Patches", ItemID.MUSHROOM); - - public static final Tab[] FARMING_TABS = {HERB, TREE, FRUIT_TREE, SPECIAL, FLOWER, ALLOTMENT, BUSH, GRAPE, HOPS}; - - private final String name; - private final int itemID; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TabContentPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TabContentPanel.java deleted file mode 100644 index 799887ff4a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TabContentPanel.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2018, Daniel Teo - * 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.timetracking; - -import java.time.LocalDateTime; -import java.time.format.TextStyle; -import java.time.temporal.ChronoUnit; -import java.util.Locale; -import javax.swing.JPanel; -import net.runelite.client.util.QuantityFormatter; - -public abstract class TabContentPanel extends JPanel -{ - /** - * Gets the update interval of this panel, in units of 200 milliseconds - * (the plugin panel checks if its contents should be updated every 200 ms; - * this can be considered its "tick rate"). - */ - public abstract int getUpdateInterval(); - - public abstract void update(); - - protected static String getFormattedEstimate(long remainingSeconds, boolean useRelativeTime) - { - if (useRelativeTime) - { - StringBuilder sb = new StringBuilder("in "); - long duration = (remainingSeconds + 59) / 60; - long minutes = duration % 60; - long hours = (duration / 60) % 24; - long days = duration / (60 * 24); - if (days > 0) - { - sb.append(days).append("d "); - } - if (hours > 0) - { - sb.append(hours).append("h "); - } - if (minutes > 0) - { - sb.append(minutes).append("m "); - } - return sb.toString(); - } - else - { - StringBuilder sb = new StringBuilder(); - LocalDateTime endTime = LocalDateTime.now().plus(remainingSeconds, ChronoUnit.SECONDS); - LocalDateTime currentTime = LocalDateTime.now(); - if (endTime.getDayOfWeek() != currentTime.getDayOfWeek()) - { - sb.append(endTime.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.getDefault())).append(" "); - } - - sb.append("at ").append(QuantityFormatter.getPlatformTimeStringFromLocalDateTime(endTime)); - return sb.toString(); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingConfig.java deleted file mode 100644 index 056217673f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingConfig.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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.timetracking; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("timetracking") -public interface TimeTrackingConfig extends Config -{ - String CONFIG_GROUP = "timetracking"; - String AUTOWEED = "autoweed"; - String BIRD_HOUSE = "birdhouse"; - String TIMERS = "timers"; - String STOPWATCHES = "stopwatches"; - - @ConfigItem( - keyName = "estimateRelative", - name = "Show relative time", - description = "Show amount of time remaining instead of completion time", - position = 1 - ) - default boolean estimateRelative() - { - return false; - } - - @ConfigItem( - keyName = "timerNotification", - name = "Timer notification", - description = "Notify you whenever a timer has finished counting down", - position = 2 - ) - default boolean timerNotification() - { - return false; - } - - @ConfigItem( - keyName = "birdHouseNotification", - name = "Bird house notification", - description = "Notify you when all bird houses are full", - position = 3 - ) - default boolean birdHouseNotification() - { - return false; - } - - @ConfigItem( - keyName = "defaultTimerMinutes", - name = "Default Time (Minutes)", - description = "The default time for the timer in minutes", - position = 4 - ) - default int defaultTimerMinutes() - { - return 5; - } - - @ConfigItem( - keyName = "activeTab", - name = "Active Tab", - description = "The currently selected tab", - hidden = true - ) - default Tab activeTab() - { - return Tab.CLOCK; - } - - @ConfigItem( - keyName = "activeTab", - name = "", - description = "", - hidden = true - ) - void setActiveTab(Tab t); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPanel.java deleted file mode 100644 index 7c468ec8df..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPanel.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2018 Abex - * Copyright (c) 2018, Psikoi - * 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.timetracking; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.awt.Image; -import java.awt.image.BufferedImage; -import java.util.HashMap; -import java.util.Map; -import javax.annotation.Nullable; -import javax.swing.ImageIcon; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.SwingUtilities; -import javax.swing.border.EmptyBorder; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.timetracking.clocks.ClockManager; -import net.runelite.client.plugins.timetracking.farming.FarmingTracker; -import net.runelite.client.plugins.timetracking.hunter.BirdHouseTracker; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.ui.components.materialtabs.MaterialTab; -import net.runelite.client.ui.components.materialtabs.MaterialTabGroup; -import net.runelite.client.util.AsyncBufferedImage; - -class TimeTrackingPanel extends PluginPanel -{ - private final ItemManager itemManager; - private final TimeTrackingConfig config; - - /* This is the panel the tabs' respective panels will be displayed on. */ - private final JPanel display = new JPanel(); - private final Map uiTabs = new HashMap<>(); - private final MaterialTabGroup tabGroup = new MaterialTabGroup(display); - - private boolean active; - - @Nullable - private TabContentPanel activeTabPanel = null; - - TimeTrackingPanel(ItemManager itemManager, TimeTrackingConfig config, - FarmingTracker farmingTracker, BirdHouseTracker birdHouseTracker, ClockManager clockManager) - { - super(false); - - this.itemManager = itemManager; - this.config = config; - - setLayout(new BorderLayout()); - setBackground(ColorScheme.DARK_GRAY_COLOR); - - display.setBorder(new EmptyBorder(10, 10, 8, 10)); - - tabGroup.setLayout(new GridLayout(0, 6, 7, 7)); - tabGroup.setBorder(new EmptyBorder(10, 10, 0, 10)); - - add(tabGroup, BorderLayout.NORTH); - add(display, BorderLayout.CENTER); - - addTab(Tab.OVERVIEW, new OverviewTabPanel(itemManager, config, this, farmingTracker, birdHouseTracker, clockManager)); - addTab(Tab.CLOCK, clockManager.getClockTabPanel()); - addTab(Tab.BIRD_HOUSE, birdHouseTracker.createBirdHouseTabPanel()); - - for (Tab tab : Tab.FARMING_TABS) - { - addTab(tab, farmingTracker.createTabPanel(tab)); - } - } - - private void addTab(Tab tab, TabContentPanel tabContentPanel) - { - JPanel wrapped = new JPanel(new BorderLayout()); - wrapped.add(tabContentPanel, BorderLayout.NORTH); - wrapped.setBackground(ColorScheme.DARK_GRAY_COLOR); - - JScrollPane scroller = new JScrollPane(wrapped); - scroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - scroller.getVerticalScrollBar().setPreferredSize(new Dimension(16, 0)); - scroller.getVerticalScrollBar().setBorder(new EmptyBorder(0, 9, 0, 0)); - scroller.setBackground(ColorScheme.DARK_GRAY_COLOR); - - // Use a placeholder icon until the async image gets loaded - MaterialTab materialTab = new MaterialTab(new ImageIcon(), tabGroup, scroller); - materialTab.setPreferredSize(new Dimension(30, 27)); - materialTab.setName(tab.getName()); - materialTab.setToolTipText(tab.getName()); - - AsyncBufferedImage icon = itemManager.getImage(tab.getItemID()); - Runnable resize = () -> - { - BufferedImage subIcon = icon.getSubimage(0, 0, 32, 32); - materialTab.setIcon(new ImageIcon(subIcon.getScaledInstance(24, 24, Image.SCALE_SMOOTH))); - }; - icon.onLoaded(resize); - resize.run(); - - materialTab.setOnSelectEvent(() -> - { - config.setActiveTab(tab); - activeTabPanel = tabContentPanel; - - tabContentPanel.update(); - return true; - }); - - uiTabs.put(tab, materialTab); - tabGroup.addTab(materialTab); - - if (config.activeTab() == tab) - { - tabGroup.select(materialTab); - } - } - - void switchTab(Tab tab) - { - tabGroup.select(uiTabs.get(tab)); - } - - /** - * Gets the update interval of the active tab panel, in units of 200 milliseconds. - */ - int getUpdateInterval() - { - return activeTabPanel == null ? Integer.MAX_VALUE : activeTabPanel.getUpdateInterval(); - } - - /** - * Updates the active tab panel, if this plugin panel is displayed. - */ - void update() - { - if (!active || activeTabPanel == null) - { - return; - } - - SwingUtilities.invokeLater(activeTabPanel::update); - } - - @Override - public void onActivate() - { - active = true; - update(); - } - - @Override - public void onDeactivate() - { - active = false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPlugin.java deleted file mode 100644 index 9a6d209125..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeTrackingPlugin.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) 2018 Abex - * Copyright (c) 2018, Daniel Teo - * 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.timetracking; - -import com.google.inject.Provides; -import java.awt.image.BufferedImage; -import java.time.Instant; -import java.time.temporal.ChronoUnit; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.UsernameChanged; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import static net.runelite.client.plugins.timetracking.TimeTrackingConfig.CONFIG_GROUP; -import static net.runelite.client.plugins.timetracking.TimeTrackingConfig.STOPWATCHES; -import static net.runelite.client.plugins.timetracking.TimeTrackingConfig.TIMERS; -import net.runelite.client.plugins.timetracking.clocks.ClockManager; -import net.runelite.client.plugins.timetracking.farming.FarmingTracker; -import net.runelite.client.plugins.timetracking.hunter.BirdHouseTracker; -import net.runelite.client.task.Schedule; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.util.ImageUtil; - -@PluginDescriptor( - name = "Time Tracking", - description = "Enable the Time Tracking panel, which contains timers, stopwatches, and farming and bird house trackers", - tags = {"birdhouse", "farming", "hunter", "notifications", "skilling", "stopwatches", "timers", "panel"}, - type = PluginType.MISCELLANEOUS -) -public class TimeTrackingPlugin extends Plugin -{ - @Inject - private ClientToolbar clientToolbar; - - @Inject - private Client client; - - @Inject - private FarmingTracker farmingTracker; - - @Inject - private BirdHouseTracker birdHouseTracker; - - @Inject - private ClockManager clockManager; - - @Inject - private ItemManager itemManager; - - @Inject - private TimeTrackingConfig config; - - @Inject - private ScheduledExecutorService executorService; - - private ScheduledFuture panelUpdateFuture; - - private TimeTrackingPanel panel; - - private NavigationButton navButton; - - private WorldPoint lastTickLocation; - private boolean lastTickPostLogin; - - @Provides - TimeTrackingConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(TimeTrackingConfig.class); - } - - @Override - protected void startUp() - { - - clockManager.loadTimers(); - clockManager.loadStopwatches(); - birdHouseTracker.loadFromConfig(); - farmingTracker.loadCompletionTimes(); - - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "/net/runelite/client/plugins/timetracking/watch.png"); - - panel = new TimeTrackingPanel(itemManager, config, farmingTracker, birdHouseTracker, clockManager); - - navButton = NavigationButton.builder() - .tooltip("Time Tracking") - .icon(icon) - .panel(panel) - .priority(4) - .build(); - - clientToolbar.addNavigation(navButton); - - panelUpdateFuture = executorService.scheduleAtFixedRate(this::updatePanel, 200, 200, TimeUnit.MILLISECONDS); - } - - @Override - protected void shutDown() - { - lastTickLocation = null; - lastTickPostLogin = false; - - if (panelUpdateFuture != null) - { - panelUpdateFuture.cancel(true); - panelUpdateFuture = null; - } - - clientToolbar.removeNavigation(navButton); - } - - @Subscribe - private void onConfigChanged(ConfigChanged e) - { - if (!e.getGroup().equals(CONFIG_GROUP)) - { - return; - } - - if (clockManager.getTimers().isEmpty() && e.getKey().equals(TIMERS)) - { - clockManager.loadTimers(); - } - else if (clockManager.getStopwatches().isEmpty() && e.getKey().equals(STOPWATCHES)) - { - clockManager.loadStopwatches(); - } - } - - @Subscribe - private void onGameTick(GameTick t) - { - if (client.getGameState() != GameState.LOGGED_IN) - { - lastTickLocation = null; - return; - } - - // bird house data is only sent after exiting the post-login screen - Widget motd = client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN_MESSAGE_OF_THE_DAY); - if (motd != null && !motd.isHidden()) - { - lastTickPostLogin = true; - return; - } - - if (lastTickPostLogin) - { - lastTickPostLogin = false; - return; - } - - WorldPoint loc = lastTickLocation; - lastTickLocation = client.getLocalPlayer().getWorldLocation(); - - if (loc == null || loc.getRegionID() != lastTickLocation.getRegionID()) - { - return; - } - - boolean birdHouseDataChanged = birdHouseTracker.updateData(loc); - boolean farmingDataChanged = farmingTracker.updateData(loc); - - if (birdHouseDataChanged || farmingDataChanged) - { - panel.update(); - } - } - - @Subscribe - private void onUsernameChanged(UsernameChanged e) - { - farmingTracker.loadCompletionTimes(); - birdHouseTracker.loadFromConfig(); - if (panel != null) - { - panel.update(); - } - } - - @Schedule(period = 10, unit = ChronoUnit.SECONDS) - public void checkCompletion() - { - boolean birdHouseDataChanged = birdHouseTracker.checkCompletion(); - - if (birdHouseDataChanged) - { - panel.update(); - } - } - - private void updatePanel() - { - long unitTime = Instant.now().toEpochMilli() / 200; - - boolean clockDataChanged = false; - - if (unitTime % 5 == 0) - { - clockDataChanged = clockManager.checkCompletion(); - } - - if (unitTime % panel.getUpdateInterval() == 0 || clockDataChanged) - { - panel.update(); - } - } -} 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 deleted file mode 100644 index ee078ceb69..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeablePanel.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2018 Abex - * Copyright (c) 2018, Psikoi - * 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.timetracking; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridLayout; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; -import lombok.AccessLevel; -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; -import net.runelite.client.ui.components.shadowlabel.JShadowedLabel; - -@Getter(AccessLevel.PUBLIC) -public class TimeablePanel extends JPanel -{ - private final T timeable; - private final JLabel icon = new JLabel(); - private final JLabel estimate = new JLabel(); - private final ThinProgressBar progress = new ThinProgressBar(); - - public TimeablePanel(T timeable, String title, int maximumProgressValue) - { - this.timeable = timeable; - - setLayout(new BorderLayout()); - setBorder(new EmptyBorder(7, 0, 0, 0)); - - JPanel topContainer = new JPanel(); - topContainer.setBorder(new EmptyBorder(7, 7, 6, 0)); - topContainer.setLayout(new BorderLayout()); - topContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - icon.setMinimumSize(new Dimension(Constants.ITEM_SPRITE_WIDTH, Constants.ITEM_SPRITE_HEIGHT)); - - JPanel infoPanel = new JPanel(); - infoPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - infoPanel.setLayout(new GridLayout(2, 1)); - infoPanel.setBorder(new EmptyBorder(4, 4, 4, 0)); - - final JLabel location = new JShadowedLabel(title); - location.setFont(FontManager.getRunescapeSmallFont()); - location.setForeground(Color.WHITE); - - estimate.setFont(FontManager.getRunescapeSmallFont()); - estimate.setForeground(Color.GRAY); - - infoPanel.add(location); - infoPanel.add(estimate); - - topContainer.add(icon, BorderLayout.WEST); - topContainer.add(infoPanel, BorderLayout.CENTER); - - progress.setValue(0); - progress.setMaximumValue(maximumProgressValue); - - add(topContainer, BorderLayout.NORTH); - add(progress, BorderLayout.SOUTH); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/Clock.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/Clock.java deleted file mode 100644 index 8a8d5be15e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/Clock.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2018, Daniel Teo - * 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.timetracking.clocks; - -import java.time.Instant; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter(AccessLevel.PACKAGE) -@Setter(AccessLevel.PACKAGE) -@NoArgsConstructor -@AllArgsConstructor -abstract class Clock -{ - protected String name; - - // last updated time (recorded as seconds since epoch) - protected long lastUpdate; - - // whether the clock is currently running - protected boolean active; - - Clock(String name) - { - this.name = name; - this.lastUpdate = Instant.now().getEpochSecond(); - this.active = false; - } - - abstract long getDisplayTime(); - - abstract void setDuration(long duration); - - abstract boolean start(); - - abstract boolean pause(); - - abstract void reset(); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/ClockManager.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/ClockManager.java deleted file mode 100644 index 01531a9e5a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/ClockManager.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) 2018, Daniel Teo - * 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.timetracking.clocks; - -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; -import com.google.inject.Singleton; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; -import javax.inject.Inject; -import javax.swing.SwingUtilities; -import joptsimple.internal.Strings; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.client.Notifier; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.plugins.timetracking.TimeTrackingConfig; - -@Singleton -@Slf4j -public class ClockManager -{ - @Inject - private ConfigManager configManager; - - @Inject - private TimeTrackingConfig config; - - @Inject - private Notifier notifier; - - @Getter(AccessLevel.PUBLIC) - private final List timers = new CopyOnWriteArrayList<>(); - - @Getter(AccessLevel.PUBLIC) - private final List stopwatches = new ArrayList<>(); - - @Getter(AccessLevel.PUBLIC) - private ClockTabPanel clockTabPanel; - - ClockManager() - { - try - { - SwingUtilities.invokeAndWait(() -> clockTabPanel = new ClockTabPanel(this)); - } - catch (InterruptedException | InvocationTargetException e) - { - log.error("Error constructing ClockManager", e); - } - } - - void addTimer() - { - timers.add(new Timer("Timer " + (timers.size() + 1), config.defaultTimerMinutes() * 60)); - saveTimers(); - - SwingUtilities.invokeLater(clockTabPanel::rebuild); - } - - void addStopwatch() - { - stopwatches.add(new Stopwatch("Stopwatch " + (stopwatches.size() + 1))); - saveStopwatches(); - - SwingUtilities.invokeLater(clockTabPanel::rebuild); - } - - void removeTimer(Timer timer) - { - timers.remove(timer); - saveTimers(); - - SwingUtilities.invokeLater(clockTabPanel::rebuild); - } - - void removeStopwatch(Stopwatch stopwatch) - { - stopwatches.remove(stopwatch); - saveStopwatches(); - - SwingUtilities.invokeLater(clockTabPanel::rebuild); - } - - public long getActiveTimerCount() - { - return timers.stream().filter(Timer::isActive).count(); - } - - public long getActiveStopwatchCount() - { - return stopwatches.stream().filter(Stopwatch::isActive).count(); - } - - /** - * Checks if any timers have completed, and send notifications if required. - */ - public boolean checkCompletion() - { - boolean changed = false; - - for (Timer timer : timers) - { - if (timer.isActive() && timer.getDisplayTime() == 0) - { - timer.pause(); - changed = true; - - if (config.timerNotification()) - { - notifier.notify("[" + timer.getName() + "] has finished counting down."); - } - } - } - - if (changed) - { - saveTimers(); - SwingUtilities.invokeLater(clockTabPanel::rebuild); - } - - return changed; - } - - public void loadTimers() - { - final String timersJson = configManager.getConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.TIMERS); - - if (!Strings.isNullOrEmpty(timersJson)) - { - final Gson gson = new Gson(); - final List timers = gson.fromJson(timersJson, new TypeToken>() {}.getType()); - - this.timers.clear(); - this.timers.addAll(timers); - SwingUtilities.invokeLater(clockTabPanel::rebuild); - } - } - - public void loadStopwatches() - { - final String stopwatchesJson = configManager.getConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.STOPWATCHES); - - if (!Strings.isNullOrEmpty(stopwatchesJson)) - { - final Gson gson = new Gson(); - final List stopwatches = gson.fromJson(stopwatchesJson, new TypeToken>() {}.getType()); - - this.stopwatches.clear(); - this.stopwatches.addAll(stopwatches); - SwingUtilities.invokeLater(clockTabPanel::rebuild); - } - } - - public void clear() - { - timers.clear(); - stopwatches.clear(); - - SwingUtilities.invokeLater(clockTabPanel::rebuild); - } - - void saveToConfig() - { - saveTimers(); - saveStopwatches(); - } - - void saveTimers() - { - final Gson gson = new Gson(); - final String json = gson.toJson(timers); - configManager.setConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.TIMERS, json); - } - - void saveStopwatches() - { - final Gson gson = new Gson(); - final String json = gson.toJson(stopwatches); - configManager.setConfiguration(TimeTrackingConfig.CONFIG_GROUP, TimeTrackingConfig.STOPWATCHES, json); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/ClockPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/ClockPanel.java deleted file mode 100644 index 1879921946..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/ClockPanel.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (c) 2018, Daniel Teo - * 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.timetracking.clocks; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.time.Duration; -import java.time.format.DateTimeParseException; -import javax.swing.BorderFactory; -import javax.swing.JButton; -import javax.swing.JPanel; -import javax.swing.JToggleButton; -import javax.swing.SwingConstants; -import javax.swing.border.Border; -import javax.swing.border.CompoundBorder; -import javax.swing.border.EmptyBorder; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.components.FlatTextField; -import net.runelite.client.util.SwingUtil; - -abstract class ClockPanel extends JPanel -{ - private static final Border NAME_BOTTOM_BORDER = new CompoundBorder( - BorderFactory.createMatteBorder(0, 0, 1, 0, ColorScheme.DARK_GRAY_COLOR), - BorderFactory.createLineBorder(ColorScheme.DARKER_GRAY_COLOR)); - - private static final Color ACTIVE_CLOCK_COLOR = ColorScheme.LIGHT_GRAY_COLOR.brighter(); - private static final Color INACTIVE_CLOCK_COLOR = ColorScheme.LIGHT_GRAY_COLOR.darker(); - - private static final String INPUT_HMS_REGEX = ".*[hms].*"; - private static final String WHITESPACE_REGEX = "\\s+"; - - // additional content or buttons should be added to these panels in the subclasses - final JPanel contentContainer; - final JPanel leftActions; - final JPanel rightActions; - - private final FlatTextField nameInput; - private final JToggleButton startPauseButton; - private final FlatTextField displayInput; - - @Getter(AccessLevel.PACKAGE) - private final Clock clock; - - private final String clockType; - private final boolean editable; - - ClockPanel(ClockManager clockManager, Clock clock, String clockType, boolean editable) - { - this.clock = clock; - this.clockType = clockType; - this.editable = editable; - - setLayout(new BorderLayout()); - setBorder(new EmptyBorder(3, 0, 0, 0)); - - JPanel nameWrapper = new JPanel(new BorderLayout()); - nameWrapper.setBackground(ColorScheme.DARKER_GRAY_COLOR); - nameWrapper.setBorder(NAME_BOTTOM_BORDER); - - nameInput = new FlatTextField(); - nameInput.setText(clock.getName()); - nameInput.setBorder(null); - nameInput.setBackground(ColorScheme.DARKER_GRAY_COLOR); - nameInput.setPreferredSize(new Dimension(0, 24)); - nameInput.getTextField().setBorder(new EmptyBorder(0, 8, 0, 0)); - nameInput.addActionListener(e -> getParent().requestFocusInWindow()); - - nameInput.getTextField().addFocusListener(new FocusListener() - { - @Override - public void focusGained(FocusEvent e) - { - nameInput.getTextField().selectAll(); - } - - @Override - public void focusLost(FocusEvent e) - { - clock.setName(nameInput.getText()); - clockManager.saveToConfig(); - } - }); - - nameWrapper.add(nameInput, BorderLayout.CENTER); - - JPanel mainContainer = new JPanel(new BorderLayout()); - mainContainer.setBorder(new EmptyBorder(5, 0, 0, 0)); - mainContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - contentContainer = new JPanel(new BorderLayout()); - contentContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - displayInput = new FlatTextField(); - displayInput.setEditable(editable); - displayInput.setBorder(null); - displayInput.setBackground(ColorScheme.DARKER_GRAY_COLOR); - displayInput.setPreferredSize(new Dimension(0, 24)); - displayInput.getTextField().setHorizontalAlignment(SwingConstants.CENTER); - displayInput.addActionListener(e -> getParent().requestFocusInWindow()); - - displayInput.getTextField().addFocusListener(new FocusListener() - { - @Override - public void focusGained(FocusEvent e) - { - displayInput.getTextField().setForeground(INACTIVE_CLOCK_COLOR); - displayInput.getTextField().selectAll(); - } - - @Override - public void focusLost(FocusEvent e) - { - long duration = 0; - - try - { - duration = stringToSeconds(displayInput.getText()); - } - catch (Exception ignored) - { - } - - clock.setDuration(Math.max(0, duration)); - clock.reset(); - updateDisplayInput(); - updateActivityStatus(); - clockManager.saveTimers(); - } - }); - - updateDisplayInput(); - - contentContainer.add(displayInput, BorderLayout.NORTH); - - JPanel actionsBar = new JPanel(new BorderLayout()); - actionsBar.setBorder(new EmptyBorder(4, 0, 4, 0)); - actionsBar.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - leftActions = new JPanel(new FlowLayout(FlowLayout.LEFT, 6, 0)); - leftActions.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - startPauseButton = new JToggleButton(ClockTabPanel.START_ICON); - startPauseButton.setRolloverIcon(ClockTabPanel.START_ICON_HOVER); - startPauseButton.setSelectedIcon(ClockTabPanel.PAUSE_ICON); - startPauseButton.setRolloverSelectedIcon(ClockTabPanel.PAUSE_ICON_HOVER); - SwingUtil.removeButtonDecorations(startPauseButton); - startPauseButton.setPreferredSize(new Dimension(16, 14)); - updateActivityStatus(); - - startPauseButton.addActionListener(e -> - { - if (!startPauseButton.isSelected()) - { - clock.pause(); - } - else if (!clock.start()) - { - return; - } - - updateActivityStatus(); - clockManager.saveToConfig(); - }); - - JButton resetButton = new JButton(ClockTabPanel.RESET_ICON); - resetButton.setRolloverIcon(ClockTabPanel.RESET_ICON_HOVER); - SwingUtil.removeButtonDecorations(resetButton); - resetButton.setPreferredSize(new Dimension(16, 14)); - resetButton.setToolTipText("Reset " + clockType); - - resetButton.addActionListener(e -> - { - clock.reset(); - reset(); - clockManager.saveToConfig(); - }); - - leftActions.add(startPauseButton); - leftActions.add(resetButton); - - rightActions = new JPanel(new FlowLayout(FlowLayout.RIGHT, 6, 0)); - rightActions.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - actionsBar.add(leftActions, BorderLayout.WEST); - actionsBar.add(rightActions, BorderLayout.EAST); - - mainContainer.add(contentContainer, BorderLayout.CENTER); - mainContainer.add(actionsBar, BorderLayout.SOUTH); - - add(nameWrapper, BorderLayout.NORTH); - add(mainContainer, BorderLayout.CENTER); - } - - void reset() - { - updateDisplayInput(); - updateActivityStatus(); - } - - void updateDisplayInput() - { - if (!displayInput.getTextField().hasFocus()) - { - displayInput.setText(getFormattedDuration(clock.getDisplayTime())); - } - } - - private void updateActivityStatus() - { - boolean isActive = clock.isActive(); - - displayInput.setEditable(editable && !isActive); - displayInput.getTextField().setForeground(isActive ? ACTIVE_CLOCK_COLOR : INACTIVE_CLOCK_COLOR); - startPauseButton.setToolTipText(isActive ? "Pause " + clockType : "Start " + clockType); - startPauseButton.setSelected(isActive); - - if (editable && clock.getDisplayTime() == 0 && !isActive) - { - displayInput.getTextField().setForeground(ColorScheme.PROGRESS_ERROR_COLOR.darker()); - } - } - - static String getFormattedDuration(long duration) - { - long hours = duration / (60 * 60); - long mins = (duration / 60) % 60; - long seconds = duration % 60; - - return String.format("%02d:%02d:%02d", hours, mins, seconds); - } - - static long stringToSeconds(String time) throws NumberFormatException, DateTimeParseException - { - long duration = 0; - - if (time.matches(INPUT_HMS_REGEX)) - { - String textWithoutWhitespaces = time.replaceAll(WHITESPACE_REGEX, ""); - //parse input using ISO-8601 Duration format (e.g. 'PT1h30m10s') - duration = Duration.parse("PT" + textWithoutWhitespaces).toMillis() / 1000; - } - else - { - String[] parts = time.split(":"); - // parse from back to front, so as to accept hour:min:sec, min:sec, and sec formats - for (int i = parts.length - 1, multiplier = 1; i >= 0 && multiplier <= 3600; i--, multiplier *= 60) - { - duration += Integer.parseInt(parts[i].trim()) * multiplier; - } - } - - return duration; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/ClockTabPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/ClockTabPanel.java deleted file mode 100644 index cd1b1a5a2e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/ClockTabPanel.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (c) 2018, Daniel Teo - * 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.timetracking.clocks; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.event.ActionListener; -import java.awt.image.BufferedImage; -import java.util.ArrayList; -import java.util.List; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.border.EmptyBorder; -import net.runelite.client.plugins.timetracking.TabContentPanel; -import net.runelite.client.plugins.timetracking.TimeTrackingPlugin; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.DynamicGridLayout; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.components.shadowlabel.JShadowedLabel; -import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.SwingUtil; - -public class ClockTabPanel extends TabContentPanel -{ - static final ImageIcon DELETE_ICON; - static final ImageIcon DELETE_ICON_HOVER; - static final ImageIcon LAP_ICON; - static final ImageIcon LAP_ICON_HOVER; - static final ImageIcon PAUSE_ICON; - static final ImageIcon PAUSE_ICON_HOVER; - static final ImageIcon RESET_ICON; - static final ImageIcon RESET_ICON_HOVER; - static final ImageIcon START_ICON; - static final ImageIcon START_ICON_HOVER; - - private static final ImageIcon ADD_ICON; - private static final ImageIcon ADD_ICON_HOVER; - - private final ClockManager clockManager; - - private final List clockPanels = new ArrayList<>(); - - static - { - BufferedImage deleteIcon = ImageUtil.getResourceStreamFromClass(TimeTrackingPlugin.class, "delete_icon.png"); - BufferedImage lapIcon = ImageUtil.getResourceStreamFromClass(TimeTrackingPlugin.class, "lap_icon.png"); - BufferedImage pauseIcon = ImageUtil.getResourceStreamFromClass(TimeTrackingPlugin.class, "pause_icon.png"); - BufferedImage resetIcon = ImageUtil.getResourceStreamFromClass(TimeTrackingPlugin.class, "reset_icon.png"); - BufferedImage startIcon = ImageUtil.getResourceStreamFromClass(TimeTrackingPlugin.class, "start_icon.png"); - BufferedImage addIcon = ImageUtil.getResourceStreamFromClass(TimeTrackingPlugin.class, "add_icon.png"); - - DELETE_ICON = new ImageIcon(deleteIcon); - DELETE_ICON_HOVER = new ImageIcon(ImageUtil.luminanceOffset(deleteIcon, -80)); - LAP_ICON = new ImageIcon(lapIcon); - LAP_ICON_HOVER = new ImageIcon(ImageUtil.luminanceOffset(lapIcon, -80)); - PAUSE_ICON = new ImageIcon(pauseIcon); - PAUSE_ICON_HOVER = new ImageIcon(ImageUtil.luminanceOffset(pauseIcon, -80)); - RESET_ICON = new ImageIcon(resetIcon); - RESET_ICON_HOVER = new ImageIcon(ImageUtil.luminanceOffset(resetIcon, -80)); - START_ICON = new ImageIcon(startIcon); - START_ICON_HOVER = new ImageIcon(ImageUtil.luminanceOffset(startIcon, -80)); - ADD_ICON = new ImageIcon(addIcon); - ADD_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(addIcon, 0.53f)); - } - - ClockTabPanel(ClockManager clockManager) - { - this.clockManager = clockManager; - - setLayout(new DynamicGridLayout(0, 1, 0, 4)); - setBackground(ColorScheme.DARK_GRAY_COLOR); - - rebuild(); - } - - /** - * Clears and recreates the components of this panel. - * This should be done whenever a clock is added or removed. - */ - void rebuild() - { - removeAll(); - clockPanels.clear(); - - add(createHeaderPanel("Timers", "timer", false, e -> clockManager.addTimer())); - - for (Timer timer : clockManager.getTimers()) - { - TimerPanel panel = new TimerPanel(clockManager, timer); - - clockPanels.add(panel); - add(panel); - } - - if (clockManager.getTimers().isEmpty()) - { - add(createInfoPanel("Click the + button to add a timer.")); - } - - add(createHeaderPanel("Stopwatches", "stopwatch", true, e -> clockManager.addStopwatch())); - - for (Stopwatch stopwatch : clockManager.getStopwatches()) - { - StopwatchPanel panel = new StopwatchPanel(clockManager, stopwatch); - - clockPanels.add(panel); - add(panel); - } - - if (clockManager.getStopwatches().isEmpty()) - { - add(createInfoPanel("Click the + button to add a stopwatch.")); - } - - revalidate(); - } - - private JPanel createHeaderPanel(String title, String type, boolean largePadding, ActionListener actionListener) - { - JPanel panel = new JPanel(new BorderLayout()); - panel.setBorder(new EmptyBorder(largePadding ? 11 : 0, 0, 0, 0)); - panel.setBackground(ColorScheme.DARK_GRAY_COLOR); - - JLabel headerLabel = new JLabel(title); - headerLabel.setForeground(Color.WHITE); - headerLabel.setFont(FontManager.getRunescapeSmallFont()); - panel.add(headerLabel, BorderLayout.CENTER); - - JButton addButton = new JButton(ADD_ICON); - addButton.setRolloverIcon(ADD_ICON_HOVER); - SwingUtil.removeButtonDecorations(addButton); - addButton.setPreferredSize(new Dimension(14, 14)); - addButton.setToolTipText("Add a " + type); - addButton.addActionListener(actionListener); - panel.add(addButton, BorderLayout.EAST); - - return panel; - } - - private JPanel createInfoPanel(String text) - { - JPanel panel = new JPanel(new BorderLayout()); - panel.setBorder(new EmptyBorder(7, 8, 6, 8)); - panel.setBackground(ColorScheme.DARK_GRAY_COLOR); - - JLabel infoLabel = new JShadowedLabel(text); - infoLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR.darker()); - infoLabel.setFont(FontManager.getRunescapeSmallFont()); - panel.add(infoLabel); - - return panel; - } - - @Override - public int getUpdateInterval() - { - return 1; // 200 milliseconds - } - - @Override - public void update() - { - for (ClockPanel panel : clockPanels) - { - if (panel.getClock().isActive()) - { - panel.updateDisplayInput(); - } - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/Stopwatch.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/Stopwatch.java deleted file mode 100644 index df4efd03d2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/Stopwatch.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2018, Daniel Teo - * 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.timetracking.clocks; - -import java.time.Instant; -import java.util.ArrayList; -import java.util.List; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; - -@Getter(AccessLevel.PACKAGE) -@Setter(AccessLevel.PACKAGE) -@AllArgsConstructor -class Stopwatch extends Clock -{ - // the number of seconds elapsed, as of last updated time - private long elapsed = 0; - - // a list of lap times (recorded as seconds since epoch) - private List laps = new ArrayList<>(); - - Stopwatch(String name) - { - super(name); - } - - @Override - long getDisplayTime() - { - if (!active) - { - return elapsed; - } - - return Math.max(0, elapsed + (Instant.now().getEpochSecond() - lastUpdate)); - } - - @Override - void setDuration(long duration) - { - elapsed = duration; - } - - @Override - boolean start() - { - if (!active) - { - lastUpdate = Instant.now().getEpochSecond(); - active = true; - return true; - } - - return false; - } - - @Override - boolean pause() - { - if (active) - { - active = false; - elapsed = Math.max(0, elapsed + (Instant.now().getEpochSecond() - lastUpdate)); - lastUpdate = Instant.now().getEpochSecond(); - return true; - } - - return false; - } - - void lap() - { - laps.add(getDisplayTime()); - } - - @Override - void reset() - { - active = false; - elapsed = 0; - laps.clear(); - lastUpdate = Instant.now().getEpochSecond(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/StopwatchPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/StopwatchPanel.java deleted file mode 100644 index 0603907d54..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/StopwatchPanel.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2018, Daniel Teo - * 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.timetracking.clocks; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.util.List; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingConstants; -import javax.swing.border.EmptyBorder; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.util.SwingUtil; - -class StopwatchPanel extends ClockPanel -{ - private static final Color LAP_DATA_COLOR = ColorScheme.LIGHT_GRAY_COLOR.darker(); - - private final JPanel lapsContainer; - private final Stopwatch stopwatch; - - StopwatchPanel(ClockManager clockManager, Stopwatch stopwatch) - { - super(clockManager, stopwatch, "stopwatch", false); - - this.stopwatch = stopwatch; - - lapsContainer = new JPanel(new GridBagLayout()); - lapsContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR); - rebuildLapList(); - - contentContainer.add(lapsContainer); - - JButton lapButton = new JButton(ClockTabPanel.LAP_ICON); - lapButton.setRolloverIcon(ClockTabPanel.LAP_ICON_HOVER); - SwingUtil.removeButtonDecorations(lapButton); - lapButton.setPreferredSize(new Dimension(16, 14)); - lapButton.setToolTipText("Add lap time"); - - lapButton.addActionListener(e -> - { - stopwatch.lap(); - rebuildLapList(); - clockManager.saveStopwatches(); - }); - - leftActions.add(lapButton); - - JButton deleteButton = new JButton(ClockTabPanel.DELETE_ICON); - deleteButton.setRolloverIcon(ClockTabPanel.DELETE_ICON_HOVER); - SwingUtil.removeButtonDecorations(deleteButton); - deleteButton.setPreferredSize(new Dimension(16, 14)); - deleteButton.setToolTipText("Delete stopwatch"); - deleteButton.addActionListener(e -> clockManager.removeStopwatch(stopwatch)); - rightActions.add(deleteButton); - } - - @Override - void reset() - { - super.reset(); - rebuildLapList(); - } - - private void rebuildLapList() - { - lapsContainer.removeAll(); - - List laps = stopwatch.getLaps(); - - if (laps.isEmpty()) - { - lapsContainer.setBorder(null); - } - else - { - lapsContainer.setBorder(new EmptyBorder(5, 0, 0, 0)); - - GridBagConstraints c = new GridBagConstraints(); - c.insets = new Insets(4, 5, 3, 5); - c.fill = GridBagConstraints.HORIZONTAL; - c.weightx = 1; - c.gridx = 0; - c.gridy = 0; - - long previousLap = 0; - for (long lap : stopwatch.getLaps()) - { - c.gridx = 0; - lapsContainer.add(createSmallLabel("" + (c.gridy + 1)), c); - - c.gridx = 1; - lapsContainer.add(createSmallLabel(getFormattedDuration(lap - previousLap)), c); - - c.gridx = 2; - lapsContainer.add(createSmallLabel(getFormattedDuration(lap)), c); - - previousLap = lap; - c.gridy++; - } - } - - lapsContainer.revalidate(); - lapsContainer.repaint(); - } - - private JLabel createSmallLabel(String text) - { - JLabel label = new JLabel(text, SwingConstants.CENTER); - label.setFont(FontManager.getRunescapeSmallFont()); - label.setForeground(LAP_DATA_COLOR); - - return label; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/Timer.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/Timer.java deleted file mode 100644 index d8b5a67f86..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/Timer.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2018, Daniel Teo - * 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.timetracking.clocks; - -import java.time.Instant; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; - -@Getter(AccessLevel.PACKAGE) -@Setter(AccessLevel.PACKAGE) -@AllArgsConstructor -class Timer extends Clock -{ - // the total number of seconds that the timer should run for - private long duration; - - // the number of seconds remaining on the timer, as of last updated time - private long remaining; - - Timer(String name, long duration) - { - super(name); - this.duration = duration; - this.remaining = duration; - } - - @Override - long getDisplayTime() - { - if (!active) - { - return remaining; - } - - return Math.max(0, remaining - (Instant.now().getEpochSecond() - lastUpdate)); - } - - @Override - boolean start() - { - if (!active && duration > 0) - { - if (remaining <= 0) - { - remaining = duration; - } - lastUpdate = Instant.now().getEpochSecond(); - active = true; - return true; - } - - return false; - } - - @Override - boolean pause() - { - if (active) - { - active = false; - remaining = Math.max(0, remaining - (Instant.now().getEpochSecond() - lastUpdate)); - lastUpdate = Instant.now().getEpochSecond(); - return true; - } - - return false; - } - - @Override - void reset() - { - active = false; - remaining = duration; - lastUpdate = Instant.now().getEpochSecond(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/TimerPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/TimerPanel.java deleted file mode 100644 index c1fc578dff..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/clocks/TimerPanel.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2018, Daniel Teo - * 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.timetracking.clocks; - -import java.awt.Dimension; -import javax.swing.JButton; -import net.runelite.client.util.SwingUtil; - -class TimerPanel extends ClockPanel -{ - TimerPanel(ClockManager clockManager, Timer timer) - { - super(clockManager, timer, "timer", true); - - JButton deleteButton = new JButton(ClockTabPanel.DELETE_ICON); - SwingUtil.removeButtonDecorations(deleteButton); - deleteButton.setRolloverIcon(ClockTabPanel.DELETE_ICON_HOVER); - deleteButton.setPreferredSize(new Dimension(16, 14)); - deleteButton.setToolTipText("Delete timer"); - deleteButton.addActionListener(e -> clockManager.removeTimer(timer)); - rightActions.add(deleteButton); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/CropState.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/CropState.java deleted file mode 100644 index 61dab85622..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/CropState.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.timetracking.farming; - -import java.awt.Color; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.client.ui.ColorScheme; - -@RequiredArgsConstructor -@Getter(AccessLevel.PACKAGE) -public enum CropState -{ - HARVESTABLE(ColorScheme.PROGRESS_COMPLETE_COLOR), - GROWING(ColorScheme.PROGRESS_COMPLETE_COLOR), - DISEASED(ColorScheme.PROGRESS_INPROGRESS_COLOR), - DEAD(ColorScheme.PROGRESS_ERROR_COLOR); - - private final Color color; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingPatch.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingPatch.java deleted file mode 100644 index a7d13486ce..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingPatch.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.timetracking.farming; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; -import net.runelite.api.Varbits; - -@RequiredArgsConstructor( - access = AccessLevel.PACKAGE -) -@Getter(AccessLevel.PACKAGE) -class FarmingPatch -{ - @Setter(AccessLevel.PACKAGE) - private FarmingRegion region; - private final String name; - private final Varbits varbit; - private final PatchImplementation implementation; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingRegion.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingRegion.java deleted file mode 100644 index 041056c7d8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingRegion.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.timetracking.farming; - -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Varbits; -import net.runelite.api.coords.WorldPoint; - -@Getter(AccessLevel.PACKAGE) -public class FarmingRegion -{ - private final String name; - private final int regionID; - private final FarmingPatch[] patches; - private final Varbits[] varbits; - - FarmingRegion(String name, int regionID, FarmingPatch... patches) - { - this.name = name; - this.regionID = regionID; - this.patches = patches; - this.varbits = new Varbits[patches.length]; - for (int i = 0; i < patches.length; i++) - { - FarmingPatch p = patches[i]; - p.setRegion(this); - varbits[i] = p.getVarbit(); - } - } - - public boolean isInBounds(WorldPoint loc) - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTabPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTabPanel.java deleted file mode 100644 index fa6852082d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTabPanel.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2018 Abex - * Copyright (c) 2018, Psikoi - * 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.timetracking.farming; - -import com.google.common.base.Strings; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.time.Instant; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import javax.swing.JLabel; -import javax.swing.border.EmptyBorder; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.timetracking.TabContentPanel; -import net.runelite.client.plugins.timetracking.TimeTrackingConfig; -import net.runelite.client.plugins.timetracking.TimeablePanel; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; - -public class FarmingTabPanel extends TabContentPanel -{ - private final FarmingTracker farmingTracker; - private final ItemManager itemManager; - private final TimeTrackingConfig config; - private final List> patchPanels; - - FarmingTabPanel( - FarmingTracker farmingTracker, - ItemManager itemManager, - TimeTrackingConfig config, - Set patches - ) - { - this.farmingTracker = farmingTracker; - this.itemManager = itemManager; - this.config = config; - this.patchPanels = new ArrayList<>(); - - setLayout(new GridBagLayout()); - setBackground(ColorScheme.DARK_GRAY_COLOR); - - GridBagConstraints c = new GridBagConstraints(); - c.fill = GridBagConstraints.HORIZONTAL; - c.weightx = 1; - c.gridx = 0; - c.gridy = 0; - - PatchImplementation lastImpl = null; - - boolean first = true; - for (FarmingPatch patch : patches) - { - String title = patch.getRegion().getName() + (Strings.isNullOrEmpty(patch.getName()) ? "" : " (" + patch.getName() + ")"); - TimeablePanel p = new TimeablePanel<>(patch, title, 1); - - /* Show labels to subdivide tabs into sections */ - if (patch.getImplementation() != lastImpl && !Strings.isNullOrEmpty(patch.getImplementation().getName())) - { - JLabel groupLabel = new JLabel(patch.getImplementation().getName()); - - if (first) - { - first = false; - groupLabel.setBorder(new EmptyBorder(4, 0, 0, 0)); - } - else - { - groupLabel.setBorder(new EmptyBorder(15, 0, 0, 0)); - } - - groupLabel.setFont(FontManager.getRunescapeSmallFont()); - - add(groupLabel, c); - c.gridy++; - lastImpl = patch.getImplementation(); - } - - patchPanels.add(p); - add(p, c); - c.gridy++; - - /* This is a weird hack to remove the top border on the first tracker of every tab */ - if (first) - { - first = false; - p.setBorder(null); - } - } - - } - - @Override - public int getUpdateInterval() - { - return 50; // 10 seconds - } - - @Override - public void update() - { - long unixNow = Instant.now().getEpochSecond(); - - for (TimeablePanel panel : patchPanels) - { - FarmingPatch patch = panel.getTimeable(); - PatchPrediction prediction = farmingTracker.predictPatch(patch); - - if (prediction == null) - { - itemManager.getImage(Produce.WEEDS.getItemID()).addTo(panel.getIcon()); - panel.getIcon().setToolTipText("Unknown state"); - panel.getProgress().setMaximumValue(0); - panel.getProgress().setValue(0); - panel.getProgress().setVisible(false); - panel.getEstimate().setText("Unknown"); - panel.getProgress().setBackground(null); - } - else - { - if (prediction.getProduce().getItemID() < 0) - { - panel.getIcon().setIcon(null); - panel.getIcon().setToolTipText("Unknown state"); - } - else - { - itemManager.getImage(prediction.getProduce().getItemID()).addTo(panel.getIcon()); - panel.getIcon().setToolTipText(prediction.getProduce().getName()); - } - - switch (prediction.getCropState()) - { - case HARVESTABLE: - panel.getEstimate().setText("Done"); - break; - case GROWING: - if (prediction.getDoneEstimate() < unixNow) - { - panel.getEstimate().setText("Done"); - } - else - { - panel.getEstimate().setText("Done " + getFormattedEstimate(prediction.getDoneEstimate() - unixNow, config.estimateRelative())); - } - break; - case DISEASED: - panel.getEstimate().setText("Diseased"); - break; - case DEAD: - panel.getEstimate().setText("Dead"); - break; - } - - /* Hide any fully grown weeds' progress bar. */ - if (prediction.getProduce() != Produce.WEEDS || prediction.getStage() < prediction.getStages() - 1) - { - panel.getProgress().setVisible(true); - panel.getProgress().setForeground(prediction.getCropState().getColor().darker()); - panel.getProgress().setMaximumValue(prediction.getStages() - 1); - panel.getProgress().setValue(prediction.getStage()); - } - else - { - panel.getProgress().setVisible(false); - } - } - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTracker.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTracker.java deleted file mode 100644 index dff6f640fe..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingTracker.java +++ /dev/null @@ -1,313 +0,0 @@ -/* - * 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.timetracking.farming; - -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.time.Instant; -import java.util.EnumMap; -import java.util.Map; -import java.util.Set; -import javax.annotation.Nullable; -import net.runelite.api.Client; -import net.runelite.api.Varbits; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.vars.Autoweed; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.timetracking.SummaryState; -import net.runelite.client.plugins.timetracking.Tab; -import net.runelite.client.plugins.timetracking.TimeTrackingConfig; - -@Singleton -public class FarmingTracker -{ - private final Client client; - private final ItemManager itemManager; - private final ConfigManager configManager; - private final TimeTrackingConfig config; - private final FarmingWorld farmingWorld; - - private final Map summaries = new EnumMap<>(Tab.class); - - /** - * The time at which all patches of a particular type will be ready to be harvested, - * or {@code -1} if we have no data about any patch of the given type. - */ - private final Map completionTimes = new EnumMap<>(Tab.class); - - @Inject - private FarmingTracker(Client client, ItemManager itemManager, ConfigManager configManager, TimeTrackingConfig config, FarmingWorld farmingWorld) - { - this.client = client; - this.itemManager = itemManager; - this.configManager = configManager; - this.config = config; - this.farmingWorld = farmingWorld; - } - - - public FarmingTabPanel createTabPanel(Tab tab) - { - return new FarmingTabPanel(this, itemManager, config, farmingWorld.getTabs().get(tab)); - } - - /** - * Updates tracker data for the current region. Returns true if any data was changed. - */ - public boolean updateData(WorldPoint location) - { - boolean changed = false; - - { - String group = TimeTrackingConfig.CONFIG_GROUP + "." + client.getUsername(); - String autoweed = Integer.toString(client.getVar(Varbits.AUTOWEED)); - if (!autoweed.equals(configManager.getConfiguration(group, TimeTrackingConfig.AUTOWEED))) - { - configManager.setConfiguration(group, TimeTrackingConfig.AUTOWEED, autoweed); - changed = true; - } - } - - FarmingRegion region = farmingWorld.getRegions().get(location.getRegionID()); - if (region != null && region.isInBounds(location)) - { - // Write config with new varbits - // timetracking...=: - String group = TimeTrackingConfig.CONFIG_GROUP + "." + client.getUsername() + "." + region.getRegionID(); - long unixNow = Instant.now().getEpochSecond(); - for (FarmingPatch patch : region.getPatches()) - { - // Write the config value if it doesn't match what is current, or it is more than 5 minutes old - Varbits varbit = patch.getVarbit(); - String key = Integer.toString(varbit.getId()); - String strVarbit = Integer.toString(client.getVar(varbit)); - String storedValue = configManager.getConfiguration(group, key); - - if (storedValue != null) - { - String[] parts = storedValue.split(":"); - if (parts.length == 2 && parts[0].equals(strVarbit)) - { - long unixTime = 0; - try - { - unixTime = Long.parseLong(parts[1]); - } - catch (NumberFormatException e) - { - // ignored - } - if (unixTime + (5 * 60) > unixNow && unixNow + 30 > unixTime) - { - continue; - } - } - } - - String value = strVarbit + ":" + unixNow; - configManager.setConfiguration(group, key, value); - changed = true; - } - } - - if (changed) - { - updateCompletionTime(); - } - - return changed; - } - - @Nullable - public PatchPrediction predictPatch(FarmingPatch patch) - { - long unixNow = Instant.now().getEpochSecond(); - - boolean autoweed; - { - String group = TimeTrackingConfig.CONFIG_GROUP + "." + client.getUsername(); - autoweed = Integer.toString(Autoweed.ON.ordinal()) - .equals(configManager.getConfiguration(group, TimeTrackingConfig.AUTOWEED)); - } - - String group = TimeTrackingConfig.CONFIG_GROUP + "." + client.getUsername() + "." + patch.getRegion().getRegionID(); - String key = Integer.toString(patch.getVarbit().getId()); - String storedValue = configManager.getConfiguration(group, key); - - if (storedValue == null) - { - return null; - } - - long unixTime = 0; - int value = 0; - { - String[] parts = storedValue.split(":"); - if (parts.length == 2) - { - try - { - value = Integer.parseInt(parts[0]); - unixTime = Long.parseLong(parts[1]); - } - catch (NumberFormatException ignored) - { - } - } - } - - if (unixTime <= 0) - { - return null; - } - - PatchState state = patch.getImplementation().forVarbitValue(value); - - if (state == null) - { - return null; - } - - int stage = state.getStage(); - int stages = state.getStages(); - int tickrate = state.getTickRate() * 60; - - if (autoweed && state.getProduce() == Produce.WEEDS) - { - stage = 0; - stages = 1; - tickrate = 0; - } - - long doneEstimate = 0; - if (tickrate > 0) - { - long tickNow = (unixNow + (5 * 60)) / tickrate; - long tickTime = (unixTime + (5 * 60)) / tickrate; - int delta = (int) (tickNow - tickTime); - - doneEstimate = ((stages - 1 - stage) + tickTime) * tickrate + (5 * 60); - - stage += delta; - if (stage >= stages) - { - stage = stages - 1; - } - } - - return new PatchPrediction( - state.getProduce(), - state.getCropState(), - doneEstimate, - stage, - stages - ); - } - - public void loadCompletionTimes() - { - summaries.clear(); - completionTimes.clear(); - updateCompletionTime(); - } - - public SummaryState getSummary(Tab patchType) - { - SummaryState summary = summaries.get(patchType); - return summary == null ? SummaryState.UNKNOWN : summary; - } - - /** - * Gets the overall completion time for the given patch type. - * - * @see #completionTimes - */ - public long getCompletionTime(Tab patchType) - { - Long completionTime = completionTimes.get(patchType); - return completionTime == null ? -1 : completionTime; - } - - /** - * Updates the overall completion time for the given patch type. - * - * @see #completionTimes - */ - private void updateCompletionTime() - { - for (Map.Entry> tab : farmingWorld.getTabs().entrySet()) - { - long maxCompletionTime = 0; - boolean allUnknown = true; - boolean allEmpty = true; - - for (FarmingPatch patch : tab.getValue()) - { - PatchPrediction prediction = predictPatch(patch); - if (prediction == null || prediction.getProduce().getItemID() < 0) - { - continue; // unknown state - } - - allUnknown = false; - - if (prediction.getProduce() != Produce.WEEDS && prediction.getProduce() != Produce.SCARECROW) - { - allEmpty = false; - - // update max duration if this patch takes longer to grow - maxCompletionTime = Math.max(maxCompletionTime, prediction.getDoneEstimate()); - } - } - - final SummaryState state; - final long completionTime; - - if (allUnknown) - { - state = SummaryState.UNKNOWN; - completionTime = -1L; - } - else if (allEmpty) - { - state = SummaryState.EMPTY; - completionTime = -1L; - } - else if (maxCompletionTime <= Instant.now().getEpochSecond()) - { - state = SummaryState.COMPLETED; - completionTime = 0; - } - else - { - state = SummaryState.IN_PROGRESS; - completionTime = maxCompletionTime; - } - summaries.put(tab.getKey(), state); - completionTimes.put(tab.getKey(), completionTime); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingWorld.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingWorld.java deleted file mode 100644 index 6360d50586..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/FarmingWorld.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (c) 2018, NotFoxtrot - * 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.timetracking.farming; - -import com.google.common.collect.ImmutableMap; -import com.google.inject.Singleton; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; -import java.util.TreeSet; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Varbits; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.plugins.timetracking.Tab; - -@Singleton -class FarmingWorld -{ - @Getter(AccessLevel.PACKAGE) - private final ImmutableMap regions; - - @Getter(AccessLevel.PACKAGE) - private Map> tabs = new HashMap<>(); - - private final Comparator tabSorter = Comparator - .comparing(FarmingPatch::getImplementation) - .thenComparing((FarmingPatch p) -> p.getRegion().getName()) - .thenComparing(FarmingPatch::getName); - - FarmingWorld() - { - ImmutableMap.Builder regionBuilder = ImmutableMap.builderWithExpectedSize(40); - - // Some of these patches get updated in multiple regions. - // It may be worth it to add a specialization for these patches - add(regionBuilder, new FarmingRegion("Al Kharid", 13106, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.CACTUS) - )); - - add(regionBuilder, new FarmingRegion("Ardougne", 10290, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.BUSH) - )); - add(regionBuilder, new FarmingRegion("Ardougne", 10548, - new FarmingPatch("North", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT), - new FarmingPatch("South", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT), - new FarmingPatch("", Varbits.FARMING_4773, PatchImplementation.FLOWER), - new FarmingPatch("", Varbits.FARMING_4774, PatchImplementation.HERB) - )); - - add(regionBuilder, new FarmingRegion("Brimhaven", 11058, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE), - new FarmingPatch("", Varbits.FARMING_4772, PatchImplementation.SPIRIT_TREE) - )); - - add(regionBuilder, new FarmingRegion("Catherby", 11062, - new FarmingPatch("North", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT), - new FarmingPatch("South", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT), - new FarmingPatch("", Varbits.FARMING_4773, PatchImplementation.FLOWER), - new FarmingPatch("", Varbits.FARMING_4774, PatchImplementation.HERB) - )); - add(regionBuilder, new FarmingRegion("Catherby", 11317, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE) - )); - - add(regionBuilder, new FarmingRegion("Champions' Guild", 12596, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.BUSH) - )); - - add(regionBuilder, new FarmingRegion("Draynor Manor", 12340, - new FarmingPatch("Belladonna", Varbits.FARMING_4771, PatchImplementation.BELLADONNA) - )); - - add(regionBuilder, new FarmingRegion("Entrana", 11060, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.HOPS) - )); - - add(regionBuilder, new FarmingRegion("Etceteria", 10300, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.BUSH), - new FarmingPatch("", Varbits.FARMING_4772, PatchImplementation.SPIRIT_TREE) - )); - - add(regionBuilder, new FarmingRegion("Falador", 11828, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.TREE) - )); - add(regionBuilder, new FarmingRegion("Falador", 12083, - new FarmingPatch("North West", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT), - new FarmingPatch("South East", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT), - new FarmingPatch("", Varbits.FARMING_4773, PatchImplementation.FLOWER), - new FarmingPatch("", Varbits.FARMING_4774, PatchImplementation.HERB) - ) - { - @Override - public boolean isInBounds(WorldPoint loc) - { - return loc.getY() > 3280; - } - }); - - add(regionBuilder, new FarmingRegion("Fossil Island", 14651, - new FarmingPatch("East", Varbits.FARMING_4771, PatchImplementation.HARDWOOD_TREE), - new FarmingPatch("Middle", Varbits.FARMING_4772, PatchImplementation.HARDWOOD_TREE), - new FarmingPatch("West", Varbits.FARMING_4773, PatchImplementation.HARDWOOD_TREE) - ), 14907); - add(regionBuilder, new FarmingRegion("Seaweed", 15008, - new FarmingPatch("North", Varbits.FARMING_4771, PatchImplementation.SEAWEED), - new FarmingPatch("South", Varbits.FARMING_4772, PatchImplementation.SEAWEED) - )); - - add(regionBuilder, new FarmingRegion("Gnome Stronghold", 9781, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.TREE), - new FarmingPatch("", Varbits.FARMING_4772, PatchImplementation.FRUIT_TREE) - )); - - add(regionBuilder, new FarmingRegion("Harmony", 15148, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT), - new FarmingPatch("", Varbits.FARMING_4772, PatchImplementation.HERB) - )); - - add(regionBuilder, new FarmingRegion("Kourend", 6967, - new FarmingPatch("North East", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT), - new FarmingPatch("South West", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT), - new FarmingPatch("", Varbits.FARMING_4773, PatchImplementation.FLOWER), - new FarmingPatch("", Varbits.FARMING_4774, PatchImplementation.HERB) - )); - add(regionBuilder, new FarmingRegion("Kourend", 6711, - new FarmingPatch("", Varbits.FARMING_7904, PatchImplementation.SPIRIT_TREE) - )); - add(regionBuilder, new FarmingRegion("Kourend", 7223, - new FarmingPatch("East 1", Varbits.GRAPES_4953, PatchImplementation.GRAPES), - new FarmingPatch("East 2", Varbits.GRAPES_4954, PatchImplementation.GRAPES), - new FarmingPatch("East 3", Varbits.GRAPES_4955, PatchImplementation.GRAPES), - new FarmingPatch("East 4", Varbits.GRAPES_4956, PatchImplementation.GRAPES), - new FarmingPatch("East 5", Varbits.GRAPES_4957, PatchImplementation.GRAPES), - new FarmingPatch("East 6", Varbits.GRAPES_4958, PatchImplementation.GRAPES), - new FarmingPatch("West 1", Varbits.GRAPES_4959, PatchImplementation.GRAPES), - new FarmingPatch("West 2", Varbits.GRAPES_4960, PatchImplementation.GRAPES), - new FarmingPatch("West 3", Varbits.GRAPES_4961, PatchImplementation.GRAPES), - new FarmingPatch("West 4", Varbits.GRAPES_4962, PatchImplementation.GRAPES), - new FarmingPatch("West 5", Varbits.GRAPES_4963, PatchImplementation.GRAPES), - new FarmingPatch("West 6", Varbits.GRAPES_4964, PatchImplementation.GRAPES) - )); - - add(regionBuilder, new FarmingRegion("Lletya", 9265, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE) - )); - - add(regionBuilder, new FarmingRegion("Lumbridge", 12851, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.HOPS) - )); - add(regionBuilder, new FarmingRegion("Lumbridge", 12594, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.TREE) - )); - - add(regionBuilder, new FarmingRegion("Morytania", 13622, - new FarmingPatch("Mushroom", Varbits.FARMING_4771, PatchImplementation.MUSHROOM) - )); - add(regionBuilder, new FarmingRegion("Morytania", 14391, - new FarmingPatch("North West", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT), - new FarmingPatch("South East", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT), - new FarmingPatch("", Varbits.FARMING_4773, PatchImplementation.FLOWER), - new FarmingPatch("", Varbits.FARMING_4774, PatchImplementation.HERB) - )); - - - add(regionBuilder, new FarmingRegion("Port Sarim", 12082, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.SPIRIT_TREE) - )); - - add(regionBuilder, new FarmingRegion("Rimmington", 11570, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.BUSH) - ), 11826); - - add(regionBuilder, new FarmingRegion("Seers' Village", 10551, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.HOPS) - )); - - add(regionBuilder, new FarmingRegion("Tai Bwo Wannai", 11056, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.CALQUAT) - )); - - add(regionBuilder, new FarmingRegion("Taverley", 11573, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.TREE) - )); - - add(regionBuilder, new FarmingRegion("Tree Gnome Village", 9777, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.FRUIT_TREE) - )); - - add(regionBuilder, new FarmingRegion("Troll Stronghold", 11321, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.HERB) - )); - - add(regionBuilder, new FarmingRegion("Varrock", 12854, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.TREE) - ), 12853); - - add(regionBuilder, new FarmingRegion("Yanille", 10288, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.HOPS) - )); - - add(regionBuilder, new FarmingRegion("Weiss", 11325, - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.HERB) - )); - - add(regionBuilder, new FarmingRegion("Farming Guild", 5021, - new FarmingPatch("Hespori", Varbits.FARMING_7908, PatchImplementation.HESPORI) - )); - - add(regionBuilder, new FarmingRegion("Farming Guild", 4922, - new FarmingPatch("", Varbits.FARMING_7905, PatchImplementation.TREE), - new FarmingPatch("", Varbits.FARMING_4775, PatchImplementation.HERB), - new FarmingPatch("", Varbits.FARMING_4772, PatchImplementation.BUSH), - new FarmingPatch("", Varbits.FARMING_7906, PatchImplementation.FLOWER), - new FarmingPatch("North", Varbits.FARMING_4773, PatchImplementation.ALLOTMENT), - new FarmingPatch("South", Varbits.FARMING_4774, PatchImplementation.ALLOTMENT), - new FarmingPatch("", Varbits.FARMING_7904, PatchImplementation.CACTUS), - new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.SPIRIT_TREE), - new FarmingPatch("", Varbits.FARMING_7909, PatchImplementation.FRUIT_TREE), - new FarmingPatch("Anima", Varbits.FARMING_7911, PatchImplementation.ANIMA), - new FarmingPatch("", Varbits.FARMING_7910, PatchImplementation.CELASTRUS), - new FarmingPatch("", Varbits.FARMING_7907, PatchImplementation.REDWOOD) - )); - - add(regionBuilder, new FarmingRegion("Prifddinas", 13151, - new FarmingPatch("North", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT), - new FarmingPatch("South", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT), - new FarmingPatch("", Varbits.FARMING_4773, PatchImplementation.FLOWER), - new FarmingPatch("", Varbits.FARMING_4775, PatchImplementation.CRYSTAL_TREE) - )); - - // Finalize - this.regions = regionBuilder.build(); - - Map> umtabs = new TreeMap<>(); - for (Map.Entry> e : tabs.entrySet()) - { - umtabs.put(e.getKey(), Collections.unmodifiableSet(e.getValue())); - } - this.tabs = Collections.unmodifiableMap(umtabs); - } - - private void add(ImmutableMap.Builder builder, FarmingRegion r, int... extraRegions) - { - builder.put(r.getRegionID(), r); - for (int er : extraRegions) - { - builder.put(er, r); - } - for (FarmingPatch p : r.getPatches()) - { - tabs - .computeIfAbsent(p.getImplementation().getTab(), k -> new TreeSet<>(tabSorter)) - .add(p); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/PatchImplementation.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/PatchImplementation.java deleted file mode 100644 index 0da756e304..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/PatchImplementation.java +++ /dev/null @@ -1,2615 +0,0 @@ -/* - * Copyright (c) 2019 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.timetracking.farming; - -import javax.annotation.Nullable; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.client.plugins.timetracking.Tab; - -@RequiredArgsConstructor -@Getter(AccessLevel.PACKAGE) -public enum PatchImplementation -{ - BELLADONNA(Tab.SPECIAL, "") - { - @Override - PatchState forVarbitValue(int value) - { - if (value >= 0 && value <= 3) - { - // Belladonna patch[Rake,Inspect,Guide] 7560,7559,7558,7557 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); - } - if (value >= 4 && value <= 7) - { - // Belladonna[Inspect,Guide] 7561,7562,7563,7564 - return new PatchState(Produce.BELLADONNA, CropState.GROWING, value - 4); - } - if (value == 8) - { - // Belladonna[Pick,Inspect,Guide] 7565 - return new PatchState(Produce.BELLADONNA, CropState.HARVESTABLE, 0); - } - if (value >= 9 && value <= 11) - { - // Diseased Belladonna[Cure,Inspect,Guide] 7566,7567,7568 - return new PatchState(Produce.BELLADONNA, CropState.DISEASED, value - 8); - } - if (value >= 12 && value <= 14) - { - // Dead Belladonna[Clear,Inspect,Guide] 7569,7570,7571 - return new PatchState(Produce.BELLADONNA, CropState.DEAD, value - 11); - } - if (value >= 15 && value <= 255) - { - // Belladonna patch[Rake,Inspect,Guide] 7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - return null; - } - }, - MUSHROOM(Tab.SPECIAL, "") - { - @Override - PatchState forVarbitValue(int value) - { - if (value >= 0 && value <= 3) - { - // Mushroom patch[Rake,Inspect,Guide] 8314,8313,8312,8311 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); - } - if (value >= 4 && value <= 9) - { - // Bittercap Mushrooms[Inspect,Guide] 8315,8316,8317,8318,8319,8320 - return new PatchState(Produce.MUSHROOM, CropState.GROWING, value - 4); - } - if (value >= 10 && value <= 15) - { - // Bittercap Mushrooms[Pick,Inspect,Guide] 8321,8322,8323,8324,8325,8326 - return new PatchState(Produce.MUSHROOM, CropState.HARVESTABLE, value - 10); - } - if (value >= 16 && value <= 20) - { - // Diseased Bittercap Mushrooms[Cure,Inspect,Guide] 8327,8328,8329,8330,8331 - return new PatchState(Produce.MUSHROOM, CropState.DISEASED, value - 15); - } - if (value >= 21 && value <= 25) - { - // Dead Bittercap Mushrooms[Clear,Inspect,Guide] 8332,8333,8334,8335,8336 - return new PatchState(Produce.MUSHROOM, CropState.DEAD, value - 20); - } - if (value >= 26 && value <= 255) - { - // Mushroom patch[Rake,Inspect,Guide] 8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - return null; - } - }, - HESPORI(Tab.SPECIAL, "") - { - @Override - PatchState forVarbitValue(int value) - { - if (value >= 0 && value <= 3) - { - // Hespori patch[Rake,Inspect,Guide] 33722,33723,33724,33725 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); - } - if (value >= 4 && value <= 6) - { - // Hespori[Inspect,Guide] 33726,33727,33728 - return new PatchState(Produce.HESPORI, CropState.GROWING, value - 4); - } - if (value >= 7 && value <= 8) - { - // Hespori[Harvest,Inspect,Guide,Clear] 33729,33730 - return new PatchState(Produce.HESPORI, CropState.HARVESTABLE, value - 7); - } - if (value == 9) - { - // Hespori patch[Rake,Inspect,Guide] 33722 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - return null; - } - }, - ALLOTMENT(Tab.ALLOTMENT, "") - { - @Override - PatchState forVarbitValue(int value) - { - if (value >= 0 && value <= 3) - { - // Allotment[Rake,Inspect,Guide] 8576,8575,8574,8573 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); - } - if (value >= 4 && value <= 5) - { - // Allotment[Rake,Inspect,Guide] 8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 6 && value <= 9) - { - // Potato seed,Potato plant[Inspect,Guide] 8558,8559,8560,8561 - return new PatchState(Produce.POTATO, CropState.GROWING, value - 6); - } - if (value >= 10 && value <= 12) - { - // Potato[Harvest,Inspect,Guide] 8562,8562,8562 - return new PatchState(Produce.POTATO, CropState.HARVESTABLE, value - 10); - } - if (value >= 13 && value <= 16) - { - // Onion seeds,Onion plant[Inspect,Guide] 8580,8581,8582,8583 - return new PatchState(Produce.ONION, CropState.GROWING, value - 13); - } - if (value >= 17 && value <= 19) - { - // Onion[Harvest,Inspect,Guide] 8584,8584,8584 - return new PatchState(Produce.ONION, CropState.HARVESTABLE, value - 17); - } - if (value >= 20 && value <= 23) - { - // Cabbages[Inspect,Guide] 8535,8536,8537,8538 - return new PatchState(Produce.CABBAGE, CropState.GROWING, value - 20); - } - if (value >= 24 && value <= 26) - { - // Cabbages[Harvest,Inspect,Guide] 8539,8539,8539 - return new PatchState(Produce.CABBAGE, CropState.HARVESTABLE, value - 24); - } - if (value >= 27 && value <= 30) - { - // Tomato plant[Inspect,Guide] 8641,8642,8643,8644 - return new PatchState(Produce.TOMATO, CropState.GROWING, value - 27); - } - if (value >= 31 && value <= 33) - { - // Tomato[Harvest,Inspect,Guide] 8645,8645,8645 - return new PatchState(Produce.TOMATO, CropState.HARVESTABLE, value - 31); - } - if (value >= 34 && value <= 39) - { - // Sweetcorn seed,Sweetcorn plant[Inspect,Guide] 8618,8619,8620,8621,8622,8623 - return new PatchState(Produce.SWEETCORN, CropState.GROWING, value - 34); - } - if (value >= 40 && value <= 42) - { - // Sweetcorn[Harvest,Inspect,Guide] 8624,8624,8624 - return new PatchState(Produce.SWEETCORN, CropState.HARVESTABLE, value - 40); - } - if (value >= 43 && value <= 48) - { - // Strawberry seed,Strawberry plant[Inspect,Guide] 8595,8596,8597,8598,8599,8600 - return new PatchState(Produce.STRAWBERRY, CropState.GROWING, value - 43); - } - if (value >= 49 && value <= 51) - { - // Strawberry[Harvest,Inspect,Guide] 8601,8601,8601 - return new PatchState(Produce.STRAWBERRY, CropState.HARVESTABLE, value - 49); - } - if (value >= 52 && value <= 59) - { - // Watermelon seed,Watermelons[Inspect,Guide] 8656,8657,8658,8659,8660,8661,8662,8663 - return new PatchState(Produce.WATERMELON, CropState.GROWING, value - 52); - } - if (value >= 60 && value <= 62) - { - // Watermelon[Harvest,Inspect,Guide] 8664,8664,8664 - return new PatchState(Produce.WATERMELON, CropState.HARVESTABLE, value - 60); - } - if (value >= 63 && value <= 69) - { - // Snape grass seedling,Snape grass plant[Inspect,Guide] 33674,33675,33676,33677,33678,33679,33680 - return new PatchState(Produce.SNAPE_GRASS, CropState.GROWING, value - 63); - } - if (value >= 70 && value <= 73) - { - // Potato seed,Potato plant[Inspect,Guide] 8563,8564,8565,8566 - return new PatchState(Produce.POTATO, CropState.GROWING, value - 70); - } - if (value >= 74 && value <= 76) - { - // Allotment[Rake,Inspect,Guide] 8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 77 && value <= 80) - { - // Onion seeds,Onion plant[Inspect,Guide] 8585,8586,8587,8588 - return new PatchState(Produce.ONION, CropState.GROWING, value - 77); - } - if (value >= 81 && value <= 83) - { - // Allotment[Rake,Inspect,Guide] 8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 84 && value <= 87) - { - // Cabbages[Inspect,Guide] 8540,8541,8542,8543 - return new PatchState(Produce.CABBAGE, CropState.GROWING, value - 84); - } - if (value >= 88 && value <= 90) - { - // Allotment[Rake,Inspect,Guide] 8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 91 && value <= 94) - { - // Tomato plant[Inspect,Guide] 8646,8647,8648,8649 - return new PatchState(Produce.TOMATO, CropState.GROWING, value - 91); - } - if (value >= 95 && value <= 97) - { - // Allotment[Rake,Inspect,Guide] 8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 98 && value <= 103) - { - // Sweetcorn seed,Sweetcorn plant[Inspect,Guide] 8625,8626,8627,8628,8629,8630 - return new PatchState(Produce.SWEETCORN, CropState.GROWING, value - 98); - } - if (value >= 104 && value <= 106) - { - // Allotment[Rake,Inspect,Guide] 8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 107 && value <= 112) - { - // Strawberry seed,Strawberry plant[Inspect,Guide] 8602,8603,8604,8605,8606,8607 - return new PatchState(Produce.STRAWBERRY, CropState.GROWING, value - 107); - } - if (value >= 113 && value <= 115) - { - // Allotment[Rake,Inspect,Guide] 8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 116 && value <= 123) - { - // Watermelon seed,Watermelons[Inspect,Guide] 8665,8666,8667,8668,8669,8670,8671,8672 - return new PatchState(Produce.WATERMELON, CropState.GROWING, value - 116); - } - if (value >= 124 && value <= 127) - { - // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 128 && value <= 134) - { - // Snape grass seedling,Snape grass plant[Inspect,Guide] 33666,33667,33668,33669,33670,33671,33672 - return new PatchState(Produce.SNAPE_GRASS, CropState.GROWING, value - 128); - } - if (value >= 135 && value <= 137) - { - // Diseased potatoes[Cure,Inspect,Guide] 8567,8568,8569 - return new PatchState(Produce.POTATO, CropState.DISEASED, value - 134); - } - if (value >= 138 && value <= 140) - { - // Snape grass plant[Harvest,Inspect,Guide] 33673,33673,33673 - return new PatchState(Produce.SNAPE_GRASS, CropState.HARVESTABLE, value - 138); - } - if (value == 141) - { - // Allotment[Rake,Inspect,Guide] 8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 142 && value <= 144) - { - // Diseased onions[Cure,Inspect,Guide] 8589,8590,8591 - return new PatchState(Produce.ONION, CropState.DISEASED, value - 141); - } - if (value >= 145 && value <= 148) - { - // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 149 && value <= 151) - { - // Diseased cabbages[Cure,Inspect,Guide] 8544,8545,8546 - return new PatchState(Produce.CABBAGE, CropState.DISEASED, value - 148); - } - if (value >= 152 && value <= 155) - { - // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 156 && value <= 158) - { - // Diseased tomato plant[Cure,Inspect,Guide] 8650,8651,8652 - return new PatchState(Produce.TOMATO, CropState.DISEASED, value - 155); - } - if (value >= 159 && value <= 162) - { - // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 163 && value <= 167) - { - // Diseased sweetcorn plant[Cure,Inspect,Guide] 8631,8632,8633,8634,8635 - return new PatchState(Produce.SWEETCORN, CropState.DISEASED, value - 162); - } - if (value >= 168 && value <= 171) - { - // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 172 && value <= 176) - { - // Diseased strawberry plant[Cure,Inspect,Guide] 8608,8609,8610,8611,8612 - return new PatchState(Produce.STRAWBERRY, CropState.DISEASED, value - 171); - } - if (value >= 177 && value <= 180) - { - // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 181 && value <= 187) - { - // Diseased watermelons[Cure,Inspect,Guide] 8673,8674,8675,8676,8677,8678,8679 - return new PatchState(Produce.WATERMELON, CropState.DISEASED, value - 180); - } - if (value >= 188 && value <= 192) - { - // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 193 && value <= 195) - { - // Dead Snape grass[Clear,Inspect,Guide] 33687,33688,33689 - return new PatchState(Produce.SNAPE_GRASS, CropState.DEAD, value - 192); - } - if (value >= 196 && value <= 198) - { - // Diseased Snape grass[Cure,Inspect,Guide] 33681,33682,33683 - return new PatchState(Produce.SNAPE_GRASS, CropState.DISEASED, value - 195); - } - if (value >= 199 && value <= 201) - { - // Dead potatoes[Clear,Inspect,Guide] 8570,8571,8572 - return new PatchState(Produce.POTATO, CropState.DEAD, value - 198); - } - if (value >= 202 && value <= 204) - { - // Diseased Snape grass[Cure,Inspect,Guide] 33684,33685,33686 - return new PatchState(Produce.SNAPE_GRASS, CropState.DISEASED, 3 + value - 201); - } - if (value == 205) - { - // Allotment[Rake,Inspect,Guide] 8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 206 && value <= 208) - { - // Dead onions[Clear,Inspect,Guide] 8592,8593,8594 - return new PatchState(Produce.ONION, CropState.DEAD, value - 205); - } - if (value >= 209 && value <= 211) - { - // Dead Snape grass[Clear,Inspect,Guide] 33690,33691,33692 - return new PatchState(Produce.SNAPE_GRASS, CropState.DEAD, 3 + value - 208); - } - if (value == 212) - { - // Allotment[Rake,Inspect,Guide] 8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 213 && value <= 215) - { - // Dead cabbages[Clear,Inspect,Guide] 8547,8548,8549 - return new PatchState(Produce.CABBAGE, CropState.DEAD, value - 212); - } - if (value >= 216 && value <= 219) - { - // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 220 && value <= 222) - { - // Dead tomato plant[Clear,Inspect,Guide] 8653,8654,8655 - return new PatchState(Produce.TOMATO, CropState.DEAD, value - 219); - } - if (value >= 223 && value <= 226) - { - // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 227 && value <= 231) - { - // Dead sweetcorn plant[Clear,Inspect,Guide] 8636,8637,8638,8639,8640 - return new PatchState(Produce.SWEETCORN, CropState.DEAD, value - 226); - } - if (value >= 232 && value <= 235) - { - // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 236 && value <= 240) - { - // Dead strawberry plant[Clear,Inspect,Guide] 8613,8614,8615,8616,8617 - return new PatchState(Produce.STRAWBERRY, CropState.DEAD, value - 235); - } - if (value >= 241 && value <= 244) - { - // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 245 && value <= 251) - { - // Dead watermelons[Clear,Inspect,Guide] 8680,8681,8682,8683,8684,8685,8686 - return new PatchState(Produce.WATERMELON, CropState.DEAD, value - 244); - } - if (value >= 252 && value <= 255) - { - // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - return null; - } - }, - HERB(Tab.HERB, "") - { - @Override - PatchState forVarbitValue(int value) - { - if (value >= 0 && value <= 3) - { - // Herb patch[Rake,Inspect,Guide] 8135,8134,8133,8132 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); - } - if (value >= 4 && value <= 7) - { - // Herbs[Inspect,Guide] 8139,8140,8141,8142 - return new PatchState(Produce.GUAM, CropState.GROWING, value - 4); - } - if (value >= 8 && value <= 10) - { - // Herbs[Pick,Inspect,Guide] 8143,8143,8143 - return new PatchState(Produce.GUAM, CropState.HARVESTABLE, 10 - value); - } - if (value >= 11 && value <= 14) - { - // Herbs[Inspect,Guide] 8139,8140,8141,8142 - return new PatchState(Produce.MARRENTILL, CropState.GROWING, value - 11); - } - if (value >= 15 && value <= 17) - { - // Herbs[Pick,Inspect,Guide] 8143,8143,8143 - return new PatchState(Produce.MARRENTILL, CropState.HARVESTABLE, 17 - value); - } - if (value >= 18 && value <= 21) - { - // Herbs[Inspect,Guide] 8139,8140,8141,8142 - return new PatchState(Produce.TARROMIN, CropState.GROWING, value - 18); - } - if (value >= 22 && value <= 24) - { - // Herbs[Pick,Inspect,Guide] 8143,8143,8143 - return new PatchState(Produce.TARROMIN, CropState.HARVESTABLE, 24 - value); - } - if (value >= 25 && value <= 28) - { - // Herbs[Inspect,Guide] 8139,8140,8141,8142 - return new PatchState(Produce.HARRALANDER, CropState.GROWING, value - 25); - } - if (value >= 29 && value <= 31) - { - // Herbs[Pick,Inspect,Guide] 8143,8143,8143 - return new PatchState(Produce.HARRALANDER, CropState.HARVESTABLE, 31 - value); - } - if (value >= 32 && value <= 35) - { - // Herbs[Inspect,Guide] 8139,8140,8141,8142 - return new PatchState(Produce.RANARR, CropState.GROWING, value - 32); - } - if (value >= 36 && value <= 38) - { - // Herbs[Pick,Inspect,Guide] 8143,8143,8143 - return new PatchState(Produce.RANARR, CropState.HARVESTABLE, 38 - value); - } - if (value >= 39 && value <= 42) - { - // Herbs[Inspect,Guide] 8139,8140,8141,8142 - return new PatchState(Produce.TOADFLAX, CropState.GROWING, value - 39); - } - if (value >= 43 && value <= 45) - { - // Herbs[Pick,Inspect,Guide] 8143,8143,8143 - return new PatchState(Produce.TOADFLAX, CropState.HARVESTABLE, 45 - value); - } - if (value >= 46 && value <= 49) - { - // Herbs[Inspect,Guide] 8139,8140,8141,8142 - return new PatchState(Produce.IRIT, CropState.GROWING, value - 46); - } - if (value >= 50 && value <= 52) - { - // Herbs[Pick,Inspect,Guide] 8143,8143,8143 - return new PatchState(Produce.IRIT, CropState.HARVESTABLE, 52 - value); - } - if (value >= 53 && value <= 56) - { - // Herbs[Inspect,Guide] 8139,8140,8141,8142 - return new PatchState(Produce.AVANTOE, CropState.GROWING, value - 53); - } - if (value >= 57 && value <= 59) - { - // Herbs[Pick,Inspect,Guide] 8143,8143,8143 - return new PatchState(Produce.AVANTOE, CropState.HARVESTABLE, 59 - value); - } - if (value >= 60 && value <= 67) - { - // Herb patch[Rake,Inspect,Guide] 8135,8135,8135,8135,8135,8135,8135,8135 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 68 && value <= 71) - { - // Herbs[Inspect,Guide] 8139,8140,8141,8142 - return new PatchState(Produce.KWUARM, CropState.GROWING, value - 68); - } - if (value >= 72 && value <= 74) - { - // Herbs[Pick,Inspect,Guide] 8143,8143,8143 - return new PatchState(Produce.KWUARM, CropState.HARVESTABLE, 74 - value); - } - if (value >= 75 && value <= 78) - { - // Herbs[Inspect,Guide] 8139,8140,8141,8142 - return new PatchState(Produce.SNAPDRAGON, CropState.GROWING, value - 75); - } - if (value >= 79 && value <= 81) - { - // Herbs[Pick,Inspect,Guide] 8143,8143,8143 - return new PatchState(Produce.SNAPDRAGON, CropState.HARVESTABLE, 81 - value); - } - if (value >= 82 && value <= 85) - { - // Herbs[Inspect,Guide] 8139,8140,8141,8142 - return new PatchState(Produce.CADANTINE, CropState.GROWING, value - 82); - } - if (value >= 86 && value <= 88) - { - // Herbs[Pick,Inspect,Guide] 8143,8143,8143 - return new PatchState(Produce.CADANTINE, CropState.HARVESTABLE, 88 - value); - } - if (value >= 89 && value <= 92) - { - // Herbs[Inspect,Guide] 8139,8140,8141,8142 - return new PatchState(Produce.LANTADYME, CropState.GROWING, value - 89); - } - if (value >= 93 && value <= 95) - { - // Herbs[Pick,Inspect,Guide] 8143,8143,8143 - return new PatchState(Produce.LANTADYME, CropState.HARVESTABLE, 95 - value); - } - if (value >= 96 && value <= 99) - { - // Herbs[Inspect,Guide] 8139,8140,8141,8142 - return new PatchState(Produce.DWARF_WEED, CropState.GROWING, value - 96); - } - if (value >= 100 && value <= 102) - { - // Herbs[Pick,Inspect,Guide] 8143,8143,8143 - return new PatchState(Produce.DWARF_WEED, CropState.HARVESTABLE, 102 - value); - } - if (value >= 103 && value <= 106) - { - // Herbs[Inspect,Guide] 8139,8140,8141,8142 - return new PatchState(Produce.TORSTOL, CropState.GROWING, value - 103); - } - if (value >= 107 && value <= 109) - { - // Herbs[Pick,Inspect,Guide] 8143,8143,8143 - return new PatchState(Produce.TORSTOL, CropState.HARVESTABLE, 109 - value); - } - if (value >= 128 && value <= 130) - { - // Diseased herbs[Cure,Inspect,Guide] 8144,8145,8146 - return new PatchState(Produce.GUAM, CropState.DISEASED, value - 127); - } - if (value >= 131 && value <= 133) - { - // Diseased herbs[Cure,Inspect,Guide] 8144,8145,8146 - return new PatchState(Produce.MARRENTILL, CropState.DISEASED, value - 130); - } - if (value >= 134 && value <= 136) - { - // Diseased herbs[Cure,Inspect,Guide] 8144,8145,8146 - return new PatchState(Produce.TARROMIN, CropState.DISEASED, value - 133); - } - if (value >= 137 && value <= 139) - { - // Diseased herbs[Cure,Inspect,Guide] 8144,8145,8146 - return new PatchState(Produce.HARRALANDER, CropState.DISEASED, value - 136); - } - if (value >= 140 && value <= 142) - { - // Diseased herbs[Cure,Inspect,Guide] 8144,8145,8146 - return new PatchState(Produce.RANARR, CropState.DISEASED, value - 139); - } - if (value >= 143 && value <= 145) - { - // Diseased herbs[Cure,Inspect,Guide] 8144,8145,8146 - return new PatchState(Produce.TOADFLAX, CropState.DISEASED, value - 142); - } - if (value >= 146 && value <= 148) - { - // Diseased herbs[Cure,Inspect,Guide] 8144,8145,8146 - return new PatchState(Produce.IRIT, CropState.DISEASED, value - 145); - } - if (value >= 149 && value <= 151) - { - // Diseased herbs[Cure,Inspect,Guide] 8144,8145,8146 - return new PatchState(Produce.AVANTOE, CropState.DISEASED, value - 148); - } - if (value >= 152 && value <= 154) - { - // Diseased herbs[Cure,Inspect,Guide] 8144,8145,8146 - return new PatchState(Produce.KWUARM, CropState.DISEASED, value - 151); - } - if (value >= 155 && value <= 157) - { - // Diseased herbs[Cure,Inspect,Guide] 8144,8145,8146 - return new PatchState(Produce.SNAPDRAGON, CropState.DISEASED, value - 154); - } - if (value >= 158 && value <= 160) - { - // Diseased herbs[Cure,Inspect,Guide] 8144,8145,8146 - return new PatchState(Produce.CADANTINE, CropState.DISEASED, value - 157); - } - if (value >= 161 && value <= 163) - { - // Diseased herbs[Cure,Inspect,Guide] 8144,8145,8146 - return new PatchState(Produce.LANTADYME, CropState.DISEASED, value - 160); - } - if (value >= 164 && value <= 166) - { - // Diseased herbs[Cure,Inspect,Guide] 8144,8145,8146 - return new PatchState(Produce.DWARF_WEED, CropState.DISEASED, value - 163); - } - if (value >= 167 && value <= 169) - { - // Diseased herbs[Cure,Inspect,Guide] 8144,8145,8146 - return new PatchState(Produce.TORSTOL, CropState.DISEASED, value - 166); - } - if (value >= 170 && value <= 172) - { - // Dead herbs[Clear,Inspect,Guide] 8147,8148,8149 - return new PatchState(Produce.ANYHERB, CropState.DEAD, value - 169); - } - if (value >= 173 && value <= 191) - { - // Herb patch[Rake,Inspect,Guide] 8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 192 && value <= 195) - { - // Goutweed[Inspect,Guide] 9044,9045,9046,9047 - return new PatchState(Produce.GOUTWEED, CropState.GROWING, value - 192); - } - if (value >= 196 && value <= 197) - { - // Goutweed[Pick,Inspect,Guide] 9048,9048 - return new PatchState(Produce.GOUTWEED, CropState.HARVESTABLE, 197 - value); - } - if (value >= 198 && value <= 200) - { - // Diseased goutweed[Cure,Inspect,Guide] 9049,9050,9051 - return new PatchState(Produce.GOUTWEED, CropState.DISEASED, value - 197); - } - if (value >= 201 && value <= 203) - { - // Dead goutweed[Clear,Inspect,Guide] 9052,9053,9054 - return new PatchState(Produce.GOUTWEED, CropState.DEAD, value - 200); - } - if (value >= 204 && value <= 219) - { - // Herb patch[Rake,Inspect,Guide] 8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 221 && value <= 255) - { - // Herb patch[Rake,Inspect,Guide] 8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - return null; - } - }, - FLOWER(Tab.FLOWER, "") - { - @Override - PatchState forVarbitValue(int value) - { - if (value >= 0 && value <= 3) - { - // Flower Patch[Rake,Inspect,Guide] 7843,7842,7841,7840 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); - } - if (value >= 4 && value <= 7) - { - // Flower Patch[Rake,Inspect,Guide] 7843,7843,7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 8 && value <= 11) - { - // Marigold[Inspect,Guide] 7867,7868,7869,7870 - return new PatchState(Produce.MARIGOLD, CropState.GROWING, value - 8); - } - if (value == 12) - { - // Marigold[Pick,Inspect,Guide] 7871 - return new PatchState(Produce.MARIGOLD, CropState.HARVESTABLE, 0); - } - if (value >= 13 && value <= 16) - { - // Rosemary[Inspect,Guide] 7899,7900,7901,7902 - return new PatchState(Produce.ROSEMARY, CropState.GROWING, value - 13); - } - if (value == 17) - { - // Rosemary[Pick,Inspect,Guide] 7903 - return new PatchState(Produce.ROSEMARY, CropState.HARVESTABLE, 0); - } - if (value >= 18 && value <= 21) - { - // Nasturtium[Inspect,Guide] 7883,7884,7885,7886 - return new PatchState(Produce.NASTURTIUM, CropState.GROWING, value - 18); - } - if (value == 22) - { - // Nasturtium[Pick,Inspect,Guide] 7887 - return new PatchState(Produce.NASTURTIUM, CropState.HARVESTABLE, 0); - } - if (value >= 23 && value <= 26) - { - // Woad plant[Inspect,Guide] 7919,7920,7921,7922 - return new PatchState(Produce.WOAD, CropState.GROWING, value - 23); - } - if (value == 27) - { - // Woad plant[Pick,Inspect,Guide] 7923 - return new PatchState(Produce.WOAD, CropState.HARVESTABLE, 0); - } - if (value >= 28 && value <= 31) - { - // Limpwurt plant[Inspect,Guide] 7851,7852,7853,7854 - return new PatchState(Produce.LIMPWURT, CropState.GROWING, value - 28); - } - if (value == 32) - { - // Limpwurt plant[Pick,Inspect,Guide] 7855 - return new PatchState(Produce.LIMPWURT, CropState.HARVESTABLE, 0); - } - if (value >= 33 && value <= 35) - { - // Scarecrow[Rake,Inspect,Guide,Remove] 7918,7917,7916 - return new PatchState(Produce.SCARECROW, CropState.GROWING, 35 - value); - } - if (value == 36) - { - // Scarecrow[Remove,Inspect,Guide] 7915 - return new PatchState(Produce.SCARECROW, CropState.GROWING, 0); - } - if (value >= 37 && value <= 40) - { - // White lily[Inspect,Guide] 33650,33651,33652,33653 - return new PatchState(Produce.WHITE_LILY, CropState.GROWING, value - 37); - } - if (value == 41) - { - // White lily[Pick,Inspect,Guide] 33654 - return new PatchState(Produce.WHITE_LILY, CropState.HARVESTABLE, 0); - } - if (value >= 42 && value <= 71) - { - // Flower Patch[Rake,Inspect,Guide] 7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 72 && value <= 75) - { - // Marigold[Inspect,Guide] 7872,7873,7874,7875 - return new PatchState(Produce.MARIGOLD, CropState.GROWING, value - 72); - } - if (value == 76) - { - // Flower Patch[Rake,Inspect,Guide] 7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 77 && value <= 80) - { - // Rosemary[Inspect,Guide] 7904,7905,7906,7907 - return new PatchState(Produce.ROSEMARY, CropState.GROWING, value - 77); - } - if (value == 81) - { - // Flower Patch[Rake,Inspect,Guide] 7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 82 && value <= 85) - { - // Nasturtium[Inspect,Guide] 7888,7889,7890,7891 - return new PatchState(Produce.NASTURTIUM, CropState.GROWING, value - 82); - } - if (value == 86) - { - // Flower Patch[Rake,Inspect,Guide] 7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 87 && value <= 90) - { - // Woad plant[Inspect,Guide] 7924,7925,7926,7927 - return new PatchState(Produce.WOAD, CropState.GROWING, value - 87); - } - if (value == 91) - { - // Flower Patch[Rake,Inspect,Guide] 7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 92 && value <= 95) - { - // Limpwurt plant[Inspect,Guide] 7856,7857,7858,7859 - return new PatchState(Produce.LIMPWURT, CropState.GROWING, value - 92); - } - if (value >= 96 && value <= 100) - { - // Flower Patch[Rake,Inspect,Guide] 7843,7843,7843,7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 101 && value <= 104) - { - // White lily[Inspect,Guide] 33655,33656,33657,33658 - return new PatchState(Produce.WHITE_LILY, CropState.GROWING, value - 101); - } - if (value >= 105 && value <= 136) - { - // Flower Patch[Rake,Inspect,Guide] 7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 137 && value <= 139) - { - // Diseased marigold[Cure,Inspect,Guide] 7876,7877,7878 - return new PatchState(Produce.MARIGOLD, CropState.DISEASED, value - 136); - } - if (value >= 140 && value <= 141) - { - // Flower Patch[Rake,Inspect,Guide] 7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 142 && value <= 144) - { - // Diseased rosemary[Cure,Inspect,Guide] 7908,7909,7910 - return new PatchState(Produce.ROSEMARY, CropState.DISEASED, value - 141); - } - if (value >= 145 && value <= 146) - { - // Flower Patch[Rake,Inspect,Guide] 7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 147 && value <= 149) - { - // Diseased nasturtium[Cure,Inspect,Guide] 7892,7893,7894 - return new PatchState(Produce.NASTURTIUM, CropState.DISEASED, value - 146); - } - if (value >= 150 && value <= 151) - { - // Flower Patch[Rake,Inspect,Guide] 7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 152 && value <= 154) - { - // Diseased woad plant[Cure,Inspect,Guide] 7928,7929,7930 - return new PatchState(Produce.WOAD, CropState.DISEASED, value - 151); - } - if (value >= 155 && value <= 156) - { - // Flower Patch[Rake,Inspect,Guide] 7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 157 && value <= 159) - { - // Diseased limpwurt plant[Cure,Inspect,Guide] 7860,7861,7862 - return new PatchState(Produce.LIMPWURT, CropState.DISEASED, value - 156); - } - if (value >= 160 && value <= 165) - { - // Flower Patch[Rake,Inspect,Guide] 7843,7843,7843,7843,7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 166 && value <= 168) - { - // Diseased White lily[Cure,Inspect,Guide] 33659,33660,33661 - return new PatchState(Produce.WHITE_LILY, CropState.DISEASED, value - 165); - } - if (value >= 169 && value <= 200) - { - // Flower Patch[Rake,Inspect,Guide] 7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 201 && value <= 204) - { - // Dead marigold[Clear,Inspect,Guide] 7879,7880,7881,7882 - return new PatchState(Produce.MARIGOLD, CropState.DEAD, value - 200); - } - if (value == 205) - { - // Flower Patch[Rake,Inspect,Guide] 7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 206 && value <= 209) - { - // Dead rosemary[Clear,Inspect,Guide] 7911,7912,7913,7914 - return new PatchState(Produce.ROSEMARY, CropState.DEAD, value - 205); - } - if (value == 210) - { - // Flower Patch[Rake,Inspect,Guide] 7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 211 && value <= 214) - { - // Dead nasturtium[Clear,Inspect,Guide] 7895,7896,7897,7898 - return new PatchState(Produce.NASTURTIUM, CropState.DEAD, value - 210); - } - if (value == 215) - { - // Flower Patch[Rake,Inspect,Guide] 7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 216 && value <= 219) - { - // Dead woad plant[Clear,Inspect,Guide] 7931,7932,7933,7934 - return new PatchState(Produce.WOAD, CropState.DEAD, value - 215); - } - if (value == 220) - { - // Flower Patch[Rake,Inspect,Guide] 7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 221 && value <= 224) - { - // Dead limpwurt plant[Clear,Inspect,Guide] 7863,7864,7865,7866 - return new PatchState(Produce.LIMPWURT, CropState.DEAD, value - 220); - } - if (value >= 225 && value <= 229) - { - // Flower Patch[Rake,Inspect,Guide] 7843,7843,7843,7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 230 && value <= 233) - { - // Dead White lily[Clear,Inspect,Guide] 33662,33663,33664,33665 - return new PatchState(Produce.WHITE_LILY, CropState.DEAD, value - 229); - } - if (value >= 234 && value <= 255) - { - // Flower Patch[Rake,Inspect,Guide] 7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - return null; - } - }, - BUSH(Tab.BUSH, "") - { - @Override - PatchState forVarbitValue(int value) - { - if (value >= 0 && value <= 3) - { - // Bush Patch[Rake,Inspect,Guide] 7576,7575,7574,7573 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); - } - if (value == 4) - { - // Bush Patch[Rake,Inspect,Guide] 7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 5 && value <= 9) - { - // Redberry bush[Inspect,Guide] 7692,7693,7694,7695,7696 - return new PatchState(Produce.REDBERRIES, CropState.GROWING, value - 5); - } - if (value >= 10 && value <= 14) - { - // Redberry bush[Clear,Inspect,Guide,Pick-from] 7697,7701,7701,7701,7701 - return new PatchState(Produce.REDBERRIES, CropState.HARVESTABLE, value - 10); - } - if (value >= 15 && value <= 20) - { - // Cadavaberry bush[Inspect,Guide] 7581,7582,7583,7584,7585,7586 - return new PatchState(Produce.CADAVABERRIES, CropState.GROWING, value - 15); - } - if (value >= 21 && value <= 25) - { - // Cadavaberry bush[Clear,Inspect,Guide,Pick-from] 7587,7591,7591,7591,7591 - return new PatchState(Produce.CADAVABERRIES, CropState.HARVESTABLE, value - 21); - } - if (value >= 26 && value <= 32) - { - // Dwellberry bush[Inspect,Guide] 7605,7606,7607,7608,7609,7610,7611 - return new PatchState(Produce.DWELLBERRIES, CropState.GROWING, value - 26); - } - if (value >= 33 && value <= 37) - { - // Dwellberry bush[Clear,Inspect,Guide,Pick-from] 7612,7616,7616,7616,7616 - return new PatchState(Produce.DWELLBERRIES, CropState.HARVESTABLE, value - 33); - } - if (value >= 38 && value <= 45) - { - // Jangerberry bush[Inspect,Guide] 7632,7633,7634,7635,7636,7637,7638,7639 - return new PatchState(Produce.JANGERBERRIES, CropState.GROWING, value - 38); - } - if (value >= 46 && value <= 50) - { - // Jangerberry bush[Clear,Inspect,Guide,Pick-from] 7640,7644,7644,7644,7644 - return new PatchState(Produce.JANGERBERRIES, CropState.HARVESTABLE, value - 46); - } - if (value >= 51 && value <= 58) - { - // Whiteberry bush[Inspect,Guide] 7713,7714,7715,7716,7717,7718,7719,7720 - return new PatchState(Produce.WHITEBERRIES, CropState.GROWING, value - 51); - } - if (value >= 59 && value <= 63) - { - // Whiteberry bush[Clear,Inspect,Guide,Pick-from] 7721,7725,7725,7725,7725 - return new PatchState(Produce.WHITEBERRIES, CropState.HARVESTABLE, value - 59); - } - if (value >= 64 && value <= 69) - { - // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 70 && value <= 74) - { - // Diseased redberry bush[Prune,Inspect,Guide] 7703,7704,7705,7706,7707 - return new PatchState(Produce.REDBERRIES, CropState.DISEASED, value - 69); - } - if (value >= 75 && value <= 79) - { - // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 80 && value <= 85) - { - // Diseased cadavaberry bush[Prune,Inspect,Guide] 7593,7594,7595,7596,7597,7598 - return new PatchState(Produce.CADAVABERRIES, CropState.DISEASED, value - 79); - } - if (value >= 86 && value <= 90) - { - // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 91 && value <= 97) - { - // Diseased dwellberry bush[Prune,Inspect,Guide] 7618,7619,7620,7621,7622,7623,7624 - return new PatchState(Produce.DWELLBERRIES, CropState.DISEASED, value - 90); - } - if (value >= 98 && value <= 102) - { - // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 103 && value <= 110) - { - // Diseased jangerberry bush[Prune,Inspect,Guide] 7646,7647,7648,7649,7650,7651,7652,7653 - return new PatchState(Produce.JANGERBERRIES, CropState.DISEASED, value - 102); - } - if (value >= 111 && value <= 115) - { - // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 116 && value <= 123) - { - // Diseased whiteberry bush[Prune,Inspect,Guide] 7727,7728,7729,7730,7731,7732,7733,7734 - return new PatchState(Produce.WHITEBERRIES, CropState.DISEASED, value - 115); - } - if (value >= 124 && value <= 133) - { - // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576,7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 134 && value <= 138) - { - // Dead redberry bush[Clear,Inspect,Guide] 7708,7709,7710,7711,7712 - return new PatchState(Produce.REDBERRIES, CropState.DEAD, value - 133); - } - if (value >= 139 && value <= 143) - { - // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 144 && value <= 149) - { - // Dead cadavaberry bush[Clear,Inspect,Guide] 7599,7600,7601,7602,7603,7604 - return new PatchState(Produce.CADAVABERRIES, CropState.DEAD, value - 143); - } - if (value >= 150 && value <= 154) - { - // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 155 && value <= 161) - { - // Dead dwellberry bush[Clear,Inspect,Guide] 7625,7626,7627,7628,7629,7630,7631 - return new PatchState(Produce.DWELLBERRIES, CropState.DEAD, value - 154); - } - if (value >= 162 && value <= 166) - { - // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 167 && value <= 174) - { - // Dead jangerberry bush[Clear,Inspect,Guide] 7654,7655,7656,7657,7658,7659,7660,7661 - return new PatchState(Produce.JANGERBERRIES, CropState.DEAD, value - 166); - } - if (value >= 175 && value <= 179) - { - // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 180 && value <= 187) - { - // Dead whiteberry bush[Clear,Inspect,Guide] 7735,7736,7737,7738,7739,7740,7741,7742 - return new PatchState(Produce.WHITEBERRIES, CropState.DEAD, value - 179); - } - if (value >= 188 && value <= 196) - { - // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 197 && value <= 204) - { - // Poison Ivy bush[Inspect,Guide] 7662,7663,7664,7665,7666,7667,7668,7669 - return new PatchState(Produce.POISON_IVY, CropState.GROWING, value - 197); - } - if (value >= 205 && value <= 209) - { - // Poison Ivy bush[Clear,Inspect,Guide,Pick-from] 7670,7674,7674,7674,7674 - return new PatchState(Produce.POISON_IVY, CropState.HARVESTABLE, value - 205); - } - if (value >= 210 && value <= 216) - { - // Diseased Poison Ivy bush[Prune,Inspect,Guide] 7676,7677,7678,7679,7680,7681,7682 - return new PatchState(Produce.POISON_IVY, CropState.DISEASED, value - 209); - } - if (value >= 217 && value <= 224) - { - // Dead Poison Ivy bush[Clear,Inspect,Guide] 7684,7685,7686,7687,7688,7689,7690,7691 - return new PatchState(Produce.POISON_IVY, CropState.DEAD, value - 216); - } - if (value == 225) - { - // Diseased Poison Ivy bush[Prune,Inspect,Guide] 7683 - return new PatchState(Produce.POISON_IVY, CropState.DISEASED, 8); - } - if (value >= 226 && value <= 249) - { - // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value == 250) - { - // Redberry bush[Check-health,Inspect,Guide] 7702 - return new PatchState(Produce.REDBERRIES, CropState.GROWING, Produce.REDBERRIES.getStages() - 1); - } - if (value == 251) - { - // Cadavaberry bush[Check-health,Inspect,Guide] 7592 - return new PatchState(Produce.CADAVABERRIES, CropState.GROWING, Produce.CADAVABERRIES.getStages() - 1); - } - if (value == 252) - { - // Dwellberry bush[Check-health,Inspect,Guide] 7617 - return new PatchState(Produce.DWELLBERRIES, CropState.GROWING, Produce.DWELLBERRIES.getStages() - 1); - } - if (value == 253) - { - // Jangerberry bush[Check-health,Inspect,Guide] 7645 - return new PatchState(Produce.JANGERBERRIES, CropState.GROWING, Produce.JANGERBERRIES.getStages() - 1); - } - if (value == 254) - { - // Whiteberry bush[Check-health,Inspect,Guide] 7726 - return new PatchState(Produce.WHITEBERRIES, CropState.GROWING, Produce.WHITEBERRIES.getStages() - 1); - } - if (value == 255) - { - // Poison Ivy bush[Check-health,Inspect,Guide] 7675 - return new PatchState(Produce.POISON_IVY, CropState.GROWING, Produce.POISON_IVY.getStages() - 1); - } - return null; - } - }, - FRUIT_TREE(Tab.FRUIT_TREE, "") - { - @Override - PatchState forVarbitValue(int value) - { - if (value >= 0 && value <= 3) - { - // Fruit Tree Patch[Rake,Inspect,Guide] 8050,8049,8048,8047 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); - } - if (value >= 4 && value <= 7) - { - // Fruit Tree Patch[Rake,Inspect,Guide] 8050,8050,8050,8050 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 8 && value <= 13) - { - // Apple tree[Inspect,Guide] 7935,7936,7937,7938,7939,7940 - return new PatchState(Produce.APPLE, CropState.GROWING, value - 8); - } - if (value >= 14 && value <= 20) - { - // Apple tree[Chop-down,Inspect,Guide,Pick-apple] 7941,7942,7943,7944,7945,7946,7947 - return new PatchState(Produce.APPLE, CropState.HARVESTABLE, value - 14); - } - if (value >= 21 && value <= 26) - { - // Diseased apple tree[Prune,Inspect,Guide] 7949,7950,7951,7952,7953,7954 - return new PatchState(Produce.APPLE, CropState.DISEASED, value - 20); - } - if (value >= 27 && value <= 32) - { - // Dead apple tree[Clear,Inspect,Guide] 7955,7956,7957,7958,7959,7960 - return new PatchState(Produce.APPLE, CropState.DEAD, value - 26); - } - if (value == 33) - { - // Apple tree stump[Clear,Inspect,Guide] 7961 - return new PatchState(Produce.APPLE, CropState.HARVESTABLE, 0); - } - if (value == 34) - { - // Apple tree[Check-health,Inspect,Guide] 7948 - return new PatchState(Produce.APPLE, CropState.GROWING, Produce.APPLE.getStages() - 1); - } - if (value >= 35 && value <= 40) - { - // Banana tree[Inspect,Guide] 7993,7994,7995,7996,7997,7998 - return new PatchState(Produce.BANANA, CropState.GROWING, value - 35); - } - if (value >= 41 && value <= 47) - { - // Banana tree[Chop-down,Inspect,Guide,Pick-banana] 8000,8001,8002,8003,8004,8005,8006 - return new PatchState(Produce.BANANA, CropState.HARVESTABLE, value - 41); - } - if (value >= 48 && value <= 53) - { - // Diseased banana tree[Prune,Inspect,Guide] 8007,8008,8009,8010,8011,8012 - return new PatchState(Produce.BANANA, CropState.DISEASED, value - 47); - } - if (value >= 54 && value <= 59) - { - // Dead banana tree[Clear,Inspect,Guide] 8013,8014,8015,8016,8017,8018 - return new PatchState(Produce.BANANA, CropState.DEAD, value - 53); - } - if (value == 60) - { - // Banana tree stump[Clear,Inspect,Guide] 8019 - return new PatchState(Produce.BANANA, CropState.HARVESTABLE, 0); - } - if (value == 61) - { - // Banana tree[Check-health,Inspect,Guide] 7999 - return new PatchState(Produce.BANANA, CropState.GROWING, Produce.BANANA.getStages() - 1); - } - if (value >= 62 && value <= 71) - { - // Fruit Tree Patch[Rake,Inspect,Guide] 8050,8050,8050,8050,8050,8050,8050,8050,8050,8050 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 72 && value <= 77) - { - // Orange tree[Inspect,Guide] 8051,8052,8053,8054,8055,8056 - return new PatchState(Produce.ORANGE, CropState.GROWING, value - 72); - } - if (value >= 78 && value <= 84) - { - // Orange tree[Chop-down,Inspect,Guide,Pick-orange] 8057,8058,8059,8060,8061,8062,8063 - return new PatchState(Produce.ORANGE, CropState.HARVESTABLE, value - 78); - } - if (value >= 85 && value <= 89) - { - // Diseased orange tree[Prune,Inspect,Guide] 8065,8066,8067,8068,8069 - return new PatchState(Produce.ORANGE, CropState.DISEASED, value - 84); - } - if (value == 90) - { - // Diseased orange tree[Chop-down,Inspect,Guide] 8070 - return new PatchState(Produce.ORANGE, CropState.DISEASED, 6); - } - if (value >= 91 && value <= 96) - { - // Dead orange tree[Clear,Inspect,Guide] 8071,8072,8073,8074,8075,8076 - return new PatchState(Produce.ORANGE, CropState.DEAD, value - 90); - } - if (value == 97) - { - // Orange tree stump[Clear,Inspect,Guide] 8077 - return new PatchState(Produce.ORANGE, CropState.HARVESTABLE, 0); - } - if (value == 98) - { - // Orange tree[Check-health,Inspect,Guide] 8064 - return new PatchState(Produce.ORANGE, CropState.GROWING, Produce.ORANGE.getStages() - 1); - } - if (value >= 99 && value <= 104) - { - // Curry tree[Inspect,Guide] 8020,8021,8022,8023,8024,8025 - return new PatchState(Produce.CURRY, CropState.GROWING, value - 99); - } - if (value >= 105 && value <= 111) - { - // Curry tree[Chop-down,Inspect,Guide,Pick-leaf] 8026,8027,8028,8029,8030,8031,8032 - return new PatchState(Produce.CURRY, CropState.HARVESTABLE, value - 105); - } - if (value >= 112 && value <= 117) - { - // Diseased curry tree[Prune,Inspect,Guide] 8034,8035,8036,8037,8038,8039 - return new PatchState(Produce.CURRY, CropState.DISEASED, value - 111); - } - if (value >= 118 && value <= 123) - { - // Dead curry tree[Clear,Inspect,Guide] 8040,8041,8042,8043,8044,8045 - return new PatchState(Produce.CURRY, CropState.DEAD, value - 117); - } - if (value == 124) - { - // Curry tree stump[Clear,Inspect,Guide] 8046 - return new PatchState(Produce.CURRY, CropState.HARVESTABLE, 0); - } - if (value == 125) - { - // Curry tree[Check-health,Inspect,Guide] 8033 - return new PatchState(Produce.CURRY, CropState.GROWING, Produce.CURRY.getStages() - 1); - } - if (value >= 126 && value <= 135) - { - // Fruit Tree Patch[Rake,Inspect,Guide] 8050,8050,8050,8050,8050,8050,8050,8050,8050,8050 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 136 && value <= 141) - { - // Pineapple plant[Inspect,Guide] 7966,7967,7968,7969,7970,7971 - return new PatchState(Produce.PINEAPPLE, CropState.GROWING, value - 136); - } - if (value >= 142 && value <= 148) - { - // Pineapple plant[Chop down,Inspect,Guide,Pick-pineapple] 7972,7973,7974,7975,7976,7977,7978 - return new PatchState(Produce.PINEAPPLE, CropState.HARVESTABLE, value - 142); - } - if (value >= 149 && value <= 154) - { - // Diseased pineapple plant[Prune,Inspect,Guide] 7980,7981,7982,7983,7984,7985 - return new PatchState(Produce.PINEAPPLE, CropState.DISEASED, value - 148); - } - if (value >= 155 && value <= 160) - { - // Dead pineapple plant[Clear,Inspect,Guide] 7986,7987,7988,7989,7990,7991 - return new PatchState(Produce.PINEAPPLE, CropState.DEAD, value - 154); - } - if (value == 161) - { - // Pineapple plant stump[Clear,Inspect,Guide] 7992 - return new PatchState(Produce.PINEAPPLE, CropState.HARVESTABLE, 0); - } - if (value == 162) - { - // Pineapple plant[Check-health,Inspect,Guide] 7979 - return new PatchState(Produce.PINEAPPLE, CropState.GROWING, Produce.PINEAPPLE.getStages() - 1); - } - if (value >= 163 && value <= 168) - { - // Papaya tree[Inspect,Guide] 8105,8106,8107,8108,8109,8110 - return new PatchState(Produce.PAPAYA, CropState.GROWING, value - 163); - } - if (value >= 169 && value <= 175) - { - // Papaya tree[Chop-down,Inspect,Guide,Pick-fruit] 8111,8112,8113,8114,8115,8116,8117 - return new PatchState(Produce.PAPAYA, CropState.HARVESTABLE, value - 169); - } - if (value >= 176 && value <= 181) - { - // Diseased papaya tree[Prune,Inspect,Guide] 8119,8120,8121,8122,8123,8124 - return new PatchState(Produce.PAPAYA, CropState.DISEASED, value - 175); - } - if (value >= 182 && value <= 187) - { - // Dead papaya tree[Clear,Inspect,Guide] 8125,8126,8127,8128,8129,8130 - return new PatchState(Produce.PAPAYA, CropState.DEAD, value - 181); - } - if (value == 188) - { - // Papaya tree stump[Clear,Inspect,Guide] 8131 - return new PatchState(Produce.PAPAYA, CropState.HARVESTABLE, 0); - } - if (value == 189) - { - // Papaya tree[Check-health,Inspect,Guide] 8118 - return new PatchState(Produce.PAPAYA, CropState.GROWING, Produce.PAPAYA.getStages() - 1); - } - if (value >= 190 && value <= 199) - { - // Fruit Tree Patch[Rake,Inspect,Guide] 8050,8050,8050,8050,8050,8050,8050,8050,8050,8050 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 200 && value <= 205) - { - // Palm tree[Inspect,Guide] 8078,8079,8080,8081,8082,8083 - return new PatchState(Produce.PALM, CropState.GROWING, value - 200); - } - if (value >= 206 && value <= 212) - { - // Palm tree[Chop-down,Inspect,Guide,Pick-coconut] 8084,8085,8086,8087,8088,8089,8090 - return new PatchState(Produce.PALM, CropState.HARVESTABLE, value - 206); - } - if (value >= 213 && value <= 218) - { - // Diseased palm tree[Prune,Inspect,Guide] 8092,8093,8094,8095,8096,8097 - return new PatchState(Produce.PALM, CropState.DISEASED, value - 212); - } - if (value >= 219 && value <= 224) - { - // Dead palm tree[Clear,Inspect,Guide] 8098,8099,8100,8101,8102,8103 - return new PatchState(Produce.PALM, CropState.DEAD, value - 218); - } - if (value == 225) - { - // Palm tree stump[Clear,Inspect,Guide] 8104 - return new PatchState(Produce.PALM, CropState.HARVESTABLE, 0); - } - if (value == 226) - { - // Palm tree[Check-health,Inspect,Guide] 8091 - return new PatchState(Produce.PALM, CropState.GROWING, Produce.PALM.getStages() - 1); - } - if (value >= 227 && value <= 232) - { - // Dragonfruit tree[Inspect,Guide] 34008,34009,34010,34011,34012,34013 - return new PatchState(Produce.DRAGONFRUIT, CropState.GROWING, value - 227); - } - if (value >= 233 && value <= 239) - { - // Dragonfruit tree[Chop down,Inspect,Guide,Pick-dragonfruit] 34014,34015,34016,34017,34018,34019,34020 - return new PatchState(Produce.DRAGONFRUIT, CropState.HARVESTABLE, value - 233); - } - if (value >= 240 && value <= 245) - { - // Diseased dragonfruit plant[Prune,Inspect,Guide] 34022,34023,34024,34025,34026,34027 - return new PatchState(Produce.DRAGONFRUIT, CropState.DISEASED, value - 239); - } - if (value >= 246 && value <= 251) - { - // Dead dragonfruit plant[Clear,Inspect,Guide] 34028,34029,34030,34031,34032,34033 - return new PatchState(Produce.DRAGONFRUIT, CropState.DEAD, value - 245); - } - if (value == 252) - { - // Dragonfruit tree stump[Clear,Inspect,Guide] 34034 - return new PatchState(Produce.DRAGONFRUIT, CropState.HARVESTABLE, 0); - } - if (value == 253) - { - // Dragonfruit tree[Check-health,Inspect,Guide] 34021 - return new PatchState(Produce.DRAGONFRUIT, CropState.GROWING, Produce.DRAGONFRUIT.getStages() - 1); - } - if (value >= 254 && value <= 255) - { - // Fruit Tree Patch[Rake,Inspect,Guide] 8050,8050 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - return null; - } - }, - HOPS(Tab.HOPS, "") - { - @Override - PatchState forVarbitValue(int value) - { - if (value >= 0 && value <= 3) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8209,8208,8207 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); - } - if (value >= 4 && value <= 7) - { - // Hammerstone Hops[Inspect,Guide] 8177,8178,8179,8180 - return new PatchState(Produce.HAMMERSTONE, CropState.GROWING, value - 4); - } - if (value >= 8 && value <= 10) - { - // Hammerstone Hops[Harvest,Inspect,Guide] 8181,8181,8181 - return new PatchState(Produce.HAMMERSTONE, CropState.HARVESTABLE, value - 8); - } - if (value >= 11 && value <= 15) - { - // Asgarnian Hops[Inspect,Guide] 8154,8155,8156,8157,8158 - return new PatchState(Produce.ASGARNIAN, CropState.GROWING, value - 11); - } - if (value >= 16 && value <= 18) - { - // Asgarnian Hops[Harvest,Inspect,Guide] 8159,8159,8159 - return new PatchState(Produce.ASGARNIAN, CropState.HARVESTABLE, value - 16); - } - if (value >= 19 && value <= 24) - { - // Yanillian Hops[Inspect,Guide] 8288,8289,8290,8291,8292,8293 - return new PatchState(Produce.YANILLIAN, CropState.GROWING, value - 19); - } - if (value >= 25 && value <= 27) - { - // Yanillian Hops[Harvest,Inspect,Guide] 8294,8294,8294 - return new PatchState(Produce.YANILLIAN, CropState.HARVESTABLE, value - 25); - } - if (value >= 28 && value <= 34) - { - // Krandorian Hops[Inspect,Guide] 8211,8212,8213,8214,8215,8216,8217 - return new PatchState(Produce.KRANDORIAN, CropState.GROWING, value - 28); - } - if (value >= 35 && value <= 37) - { - // Krandorian Hops[Harvest,Inspect,Guide] 8218,8218,8218 - return new PatchState(Produce.KRANDORIAN, CropState.HARVESTABLE, value - 35); - } - if (value >= 38 && value <= 45) - { - // Wildblood Hops[Inspect,Guide] 8257,8258,8259,8260,8261,8262,8263,8264 - return new PatchState(Produce.WILDBLOOD, CropState.GROWING, value - 38); - } - if (value >= 46 && value <= 48) - { - // Wildblood Hops[Harvest,Inspect,Guide] 8265,8265,8265 - return new PatchState(Produce.WILDBLOOD, CropState.HARVESTABLE, value - 46); - } - if (value >= 49 && value <= 52) - { - // Barley[Inspect,Guide] 8192,8193,8194,8195 - return new PatchState(Produce.BARLEY, CropState.GROWING, value - 49); - } - if (value >= 53 && value <= 55) - { - // Barley[Harvest,Inspect,Guide] 8196,8196,8196 - return new PatchState(Produce.BARLEY, CropState.HARVESTABLE, value - 53); - } - if (value >= 56 && value <= 60) - { - // Jute[Inspect,Guide] 8238,8239,8240,8241,8242 - return new PatchState(Produce.JUTE, CropState.GROWING, value - 56); - } - if (value >= 61 && value <= 63) - { - // Jute[Harvest,Inspect,Guide] 8243,8243,8243 - return new PatchState(Produce.JUTE, CropState.HARVESTABLE, value - 61); - } - if (value >= 64 && value <= 67) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 68 && value <= 71) - { - // Hammerstone Hops[Inspect,Guide] 8182,8183,8184,8185 - return new PatchState(Produce.HAMMERSTONE, CropState.GROWING, value - 68); - } - if (value >= 72 && value <= 74) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 75 && value <= 79) - { - // Asgarnian Hops[Inspect,Guide] 8160,8161,8162,8163,8164 - return new PatchState(Produce.ASGARNIAN, CropState.GROWING, value - 75); - } - if (value >= 80 && value <= 82) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 83 && value <= 88) - { - // Yanillian Hops[Inspect,Guide] 8295,8296,8297,8298,8299,8300 - return new PatchState(Produce.YANILLIAN, CropState.GROWING, value - 83); - } - if (value >= 89 && value <= 91) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 92 && value <= 98) - { - // Krandorian Hops[Inspect,Guide] 8219,8220,8221,8222,8223,8224,8225 - return new PatchState(Produce.KRANDORIAN, CropState.GROWING, value - 92); - } - if (value >= 99 && value <= 101) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 102 && value <= 109) - { - // Wildblood Hops[Inspect,Guide] 8266,8267,8268,8269,8270,8271,8272,8273 - return new PatchState(Produce.WILDBLOOD, CropState.GROWING, value - 102); - } - if (value >= 110 && value <= 112) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 113 && value <= 116) - { - // Barley[Inspect,Guide] 8197,8198,8199,8200 - return new PatchState(Produce.BARLEY, CropState.GROWING, value - 113); - } - if (value >= 117 && value <= 119) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 120 && value <= 124) - { - // Jute[Inspect,Guide] 8244,8245,8246,8247,8248 - return new PatchState(Produce.JUTE, CropState.GROWING, value - 120); - } - if (value >= 125 && value <= 132) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210,8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 133 && value <= 135) - { - // Diseased Hammerstone Hops[Cure,Inspect,Guide] 8186,8187,8188 - return new PatchState(Produce.HAMMERSTONE, CropState.DISEASED, value - 132); - } - if (value >= 136 && value <= 139) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 140 && value <= 143) - { - // Diseased Asgarnian Hops[Cure,Inspect,Guide] 8165,8166,8167,8168 - return new PatchState(Produce.ASGARNIAN, CropState.DISEASED, value - 139); - } - if (value >= 144 && value <= 147) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 148 && value <= 152) - { - // Diseased Yanillian Hops[Cure,Inspect,Guide] 8301,8302,8303,8304,8305 - return new PatchState(Produce.YANILLIAN, CropState.DISEASED, value - 147); - } - if (value >= 153 && value <= 156) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 157 && value <= 162) - { - // Diseased Krandorian Hops[Cure,Inspect,Guide] 8226,8227,8228,8229,8230,8231 - return new PatchState(Produce.KRANDORIAN, CropState.DISEASED, value - 156); - } - if (value >= 163 && value <= 166) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 167 && value <= 173) - { - // Diseased Wildblood Hops[Cure,Inspect,Guide] 8274,8275,8276,8277,8278,8279,8280 - return new PatchState(Produce.WILDBLOOD, CropState.DISEASED, value - 166); - } - if (value >= 174 && value <= 177) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 178 && value <= 180) - { - // Diseased Barley[Cure,Inspect,Guide] 8201,8202,8203 - return new PatchState(Produce.BARLEY, CropState.DISEASED, value - 177); - } - if (value == 181) - { - // Hops Patch[Rake,Inspect,Guide] 8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 183 && value <= 184) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 185 && value <= 188) - { - // Diseased Jute[Cure,Inspect,Guide] 8249,8250,8251,8252 - return new PatchState(Produce.JUTE, CropState.DISEASED, value - 184); - } - if (value >= 189 && value <= 196) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210,8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 197 && value <= 199) - { - // Dead Hammerstone Hops[Clear,Inspect,Guide] 8189,8190,8191 - return new PatchState(Produce.HAMMERSTONE, CropState.DEAD, value - 196); - } - if (value >= 200 && value <= 203) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 204 && value <= 207) - { - // Dead Asgarnian Hops[Clear,Inspect,Guide] 8169,8170,8171,8172 - return new PatchState(Produce.ASGARNIAN, CropState.DEAD, value - 203); - } - if (value >= 208 && value <= 211) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 212 && value <= 216) - { - // Dead Yanillian Hops[Clear,Inspect,Guide] 8306,8307,8308,8309,8310 - return new PatchState(Produce.YANILLIAN, CropState.DEAD, value - 211); - } - if (value >= 217 && value <= 220) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 221 && value <= 226) - { - // Dead Krandorian Hops[Clear,Inspect,Guide] 8232,8233,8234,8235,8236,8237 - return new PatchState(Produce.KRANDORIAN, CropState.DEAD, value - 220); - } - if (value >= 227 && value <= 230) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 231 && value <= 237) - { - // Dead Wildblood Hops[Clear,Inspect,Guide] 8281,8282,8283,8284,8285,8286,8287 - return new PatchState(Produce.WILDBLOOD, CropState.DEAD, value - 230); - } - if (value >= 238 && value <= 241) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 242 && value <= 244) - { - // Dead Barley[Clear,Inspect,Guide] 8204,8205,8206 - return new PatchState(Produce.BARLEY, CropState.DEAD, value - 241); - } - if (value >= 245 && value <= 248) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 249 && value <= 252) - { - // Dead Jute[Clear,Inspect,Guide] 8253,8254,8255,8256 - return new PatchState(Produce.JUTE, CropState.DEAD, value - 248); - } - if (value >= 253 && value <= 255) - { - // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - return null; - } - }, - TREE(Tab.TREE, "") - { - @Override - PatchState forVarbitValue(int value) - { - if (value >= 0 && value <= 3) - { - // Tree patch[Rake,Inspect,Guide] 8395,8394,8393,8392 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); - } - if (value >= 4 && value <= 7) - { - // Tree patch[Rake,Inspect,Guide] 8395,8395,8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 8 && value <= 11) - { - // Oak[Inspect,Guide] 8462,8463,8464,8465 - return new PatchState(Produce.OAK, CropState.GROWING, value - 8); - } - if (value == 12) - { - // Oak[Check-health,Inspect,Guide] 8466 - return new PatchState(Produce.OAK, CropState.GROWING, Produce.OAK.getStages() - 1); - } - if (value == 13) - { - // Oak[Chop down,Inspect,Guide] 8467 - return new PatchState(Produce.OAK, CropState.HARVESTABLE, 0); - } - if (value == 14) - { - // Oak tree stump[Clear,Inspect,Guide] 8468 - return new PatchState(Produce.OAK, CropState.HARVESTABLE, 0); - } - if (value >= 15 && value <= 20) - { - // Willow Tree[Inspect,Guide] 8481,8482,8483,8484,8485,8486 - return new PatchState(Produce.WILLOW, CropState.GROWING, value - 15); - } - if (value == 21) - { - // Willow Tree[Check-health,Inspect,Guide] 8487 - return new PatchState(Produce.WILLOW, CropState.GROWING, Produce.WILLOW.getStages() - 1); - } - if (value == 22) - { - // Willow Tree[Chop down,Inspect,Guide] 8488 - return new PatchState(Produce.WILLOW, CropState.HARVESTABLE, 0); - } - if (value == 23) - { - // Willow tree stump[Clear,Inspect,Guide] 8489 - return new PatchState(Produce.WILLOW, CropState.HARVESTABLE, 0); - } - if (value >= 24 && value <= 31) - { - // Maple Tree[Inspect,Guide] 8435,8436,8437,8438,8439,8440,8441,8442 - return new PatchState(Produce.MAPLE, CropState.GROWING, value - 24); - } - if (value == 32) - { - // Maple Tree[Check-health,Inspect,Guide] 8443 - return new PatchState(Produce.MAPLE, CropState.GROWING, Produce.MAPLE.getStages() - 1); - } - if (value == 33) - { - // Maple Tree[Chop down,Inspect,Guide] 8444 - return new PatchState(Produce.MAPLE, CropState.HARVESTABLE, 0); - } - if (value == 34) - { - // Tree stump[Clear,Inspect,Guide] 8445 - return new PatchState(Produce.MAPLE, CropState.HARVESTABLE, 0); - } - if (value >= 35 && value <= 44) - { - // Yew sapling,Yew tree[Inspect,Guide] 8502,8503,8504,8505,8506,8507,8508,8509,8510,8511 - return new PatchState(Produce.YEW, CropState.GROWING, value - 35); - } - if (value == 45) - { - // Yew tree[Check-health,Inspect,Guide] 8512 - return new PatchState(Produce.YEW, CropState.GROWING, Produce.YEW.getStages() - 1); - } - if (value == 46) - { - // Yew tree[Chop down,Inspect,Guide] 8513 - return new PatchState(Produce.YEW, CropState.HARVESTABLE, 0); - } - if (value == 47) - { - // Yew tree stump[Clear,Inspect,Guide] 8514 - return new PatchState(Produce.YEW, CropState.HARVESTABLE, 0); - } - if (value >= 48 && value <= 59) - { - // Magic Tree[Inspect,Guide] 8396,8397,8398,8399,8400,8401,8402,8403,8404,8405,8406,8407 - return new PatchState(Produce.MAGIC, CropState.GROWING, value - 48); - } - if (value == 60) - { - // Magic Tree[Check-health,Inspect,Guide] 8408 - return new PatchState(Produce.MAGIC, CropState.GROWING, Produce.MAGIC.getStages() - 1); - } - if (value == 61) - { - // Magic Tree[Chop down,Inspect,Guide] 8409 - return new PatchState(Produce.MAGIC, CropState.HARVESTABLE, 0); - } - if (value == 62) - { - // Magic Tree Stump[Clear,Inspect,Guide] 8410 - return new PatchState(Produce.MAGIC, CropState.HARVESTABLE, 0); - } - if (value >= 63 && value <= 72) - { - // Tree patch[Rake,Inspect,Guide] 8395,8395,8395,8395,8395,8395,8395,8395,8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 73 && value <= 75) - { - // Diseased Oak[Prune,Inspect,Guide] 8473,8474,8475 - return new PatchState(Produce.OAK, CropState.DISEASED, value - 72); - } - if (value == 77) - { - // Diseased Oak[Prune,Inspect,Guide] 8476 - return new PatchState(Produce.OAK, CropState.DISEASED, 4); - } - if (value >= 78 && value <= 79) - { - // Tree patch[Rake,Inspect,Guide] 8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 80 && value <= 84) - { - // Diseased Willow[Prune,Inspect,Guide] 8490,8491,8492,8493,8494 - return new PatchState(Produce.WILLOW, CropState.DISEASED, value - 79); - } - if (value == 86) - { - // Diseased Willow[Prune,Inspect,Guide] 8495 - return new PatchState(Produce.WILLOW, CropState.DISEASED, 6); - } - if (value >= 87 && value <= 88) - { - // Tree patch[Rake,Inspect,Guide] 8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 89 && value <= 95) - { - // Diseased Maple[Prune,Inspect,Guide] 8446,8447,8448,8449,8450,8451,8452 - return new PatchState(Produce.MAPLE, CropState.DISEASED, value - 88); - } - if (value == 97) - { - // Diseased Maple[Prune,Inspect,Guide] 8453 - return new PatchState(Produce.MAPLE, CropState.DISEASED, 8); - } - if (value >= 98 && value <= 99) - { - // Tree patch[Rake,Inspect,Guide] 8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 100 && value <= 108) - { - // Diseased Yew[Prune,Inspect,Guide] 8515,8516,8517,8518,8519,8520,8521,8522,8523 - return new PatchState(Produce.YEW, CropState.DISEASED, value - 99); - } - if (value == 110) - { - // Diseased Yew[Prune,Inspect,Guide] 8524 - return new PatchState(Produce.YEW, CropState.DISEASED, 10); - } - if (value >= 111 && value <= 112) - { - // Tree patch[Rake,Inspect,Guide] 8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 113 && value <= 123) - { - // Diseased Magic Tree[Prune,Inspect,Guide] 8411,8412,8413,8414,8415,8416,8417,8418,8419,8420,8421 - return new PatchState(Produce.MAGIC, CropState.DISEASED, value - 112); - } - if (value == 125) - { - // Diseased Magic Tree[Prune,Inspect,Guide] 8422 - return new PatchState(Produce.MAGIC, CropState.DISEASED, 12); - } - if (value >= 126 && value <= 136) - { - // Tree patch[Rake,Inspect,Guide] 8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 137 && value <= 139) - { - // Dead Oak[Clear,Inspect,Guide] 8477,8478,8479 - return new PatchState(Produce.OAK, CropState.DEAD, value - 136); - } - if (value == 141) - { - // Dead Oak[Clear,Inspect,Guide] 8480 - return new PatchState(Produce.OAK, CropState.DEAD, 4); - } - if (value >= 142 && value <= 143) - { - // Tree patch[Rake,Inspect,Guide] 8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 144 && value <= 148) - { - // Dead Willow[Clear,Inspect,Guide] 8496,8497,8498,8499,8500 - return new PatchState(Produce.WILLOW, CropState.DEAD, value - 143); - } - if (value == 150) - { - // Dead Willow[Clear,Inspect,Guide] 8501 - return new PatchState(Produce.WILLOW, CropState.DEAD, 6); - } - if (value >= 151 && value <= 152) - { - // Tree patch[Rake,Inspect,Guide] 8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 153 && value <= 159) - { - // Dead Maple[Clear,Inspect,Guide] 8454,8455,8456,8457,8458,8459,8460 - return new PatchState(Produce.MAPLE, CropState.DEAD, value - 152); - } - if (value == 161) - { - // Dead Maple[Clear,Inspect,Guide] 8461 - return new PatchState(Produce.MAPLE, CropState.DEAD, 8); - } - if (value >= 162 && value <= 163) - { - // Tree patch[Rake,Inspect,Guide] 8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 164 && value <= 172) - { - // Dead Yew[Clear,Inspect,Guide] 8525,8526,8527,8528,8529,8530,8531,8532,8533 - return new PatchState(Produce.YEW, CropState.DEAD, value - 163); - } - if (value == 174) - { - // Dead Yew[Clear,Inspect,Guide] 8534 - return new PatchState(Produce.YEW, CropState.DEAD, 10); - } - if (value >= 175 && value <= 176) - { - // Tree patch[Rake,Inspect,Guide] 8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 177 && value <= 187) - { - // Dead Magic Tree[Clear,Inspect,Guide] 8423,8424,8425,8426,8427,8428,8429,8430,8431,8432,8433 - return new PatchState(Produce.MAGIC, CropState.DEAD, value - 176); - } - if (value == 189) - { - // Dead Magic Tree[Clear,Inspect,Guide] 8434 - return new PatchState(Produce.MAGIC, CropState.DEAD, 12); - } - if (value >= 190 && value <= 191) - { - // Tree patch[Rake,Inspect,Guide] 8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 192 && value <= 197) - { - // Willow Tree[Chop down,Inspect,Guide] 8488,8488,8488,8488,8488,8488 - return new PatchState(Produce.WILLOW, CropState.HARVESTABLE, 0); - } - if (value >= 198 && value <= 255) - { - // Tree patch[Rake,Inspect,Guide] 8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - return null; - } - }, - HARDWOOD_TREE(Tab.TREE, "Hardwood Trees") - { - @Override - PatchState forVarbitValue(int value) - { - if (value >= 0 && value <= 3) - { - // Tree patch[Rake,Inspect,Guide] 30479,30478,30477,30476 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); - } - if (value >= 4 && value <= 7) - { - // Tree patch[Rake,Inspect,Guide] 30479,30479,30479,30479 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 8 && value <= 14) - { - // Teak Tree[Inspect,Guide] 30437,30438,30439,30440,30441,30442,30443 - return new PatchState(Produce.TEAK, CropState.GROWING, value - 8); - } - if (value == 15) - { - // Teak Tree[Check-health,Inspect,Guide] 30444 - return new PatchState(Produce.TEAK, CropState.GROWING, Produce.TEAK.getStages() - 1); - } - if (value == 16) - { - // Teak Tree[Chop down,Inspect,Guide] 30445 - return new PatchState(Produce.TEAK, CropState.HARVESTABLE, 0); - } - if (value == 17) - { - // Tree stump[Clear,Inspect,Guide] 30446 - return new PatchState(Produce.TEAK, CropState.HARVESTABLE, 0); - } - if (value >= 18 && value <= 23) - { - // Diseased Teak[Prune,Inspect,Guide] 30447,30448,30449,30450,30451,30452 - return new PatchState(Produce.TEAK, CropState.DISEASED, value - 17); - } - if (value >= 24 && value <= 29) - { - // Dead Teak[Clear,Inspect,Guide] 30453,30454,30455,30456,30457,30458 - return new PatchState(Produce.TEAK, CropState.DEAD, value - 23); - } - if (value >= 30 && value <= 37) - { - // Mahogany sapling,Mahogany tree[Inspect,Guide] 30406,30407,30408,30409,30410,30411,30412,30413 - return new PatchState(Produce.MAHOGANY, CropState.GROWING, value - 30); - } - if (value == 38) - { - // Mahogany tree[Check-health,Inspect,Guide] 30416 - return new PatchState(Produce.MAHOGANY, CropState.GROWING, Produce.MAHOGANY.getStages() - 1); - } - if (value == 39) - { - // Mahogany tree[Chop down,Inspect,Guide] 30417 - return new PatchState(Produce.MAHOGANY, CropState.HARVESTABLE, 0); - } - if (value == 40) - { - // Mahogany tree stump[Clear,Inspect,Guide] 30418 - return new PatchState(Produce.MAHOGANY, CropState.HARVESTABLE, 0); - } - if (value >= 41 && value <= 47) - { - // Diseased Mahogany[Prune,Inspect,Guide] 30419,30420,30421,30422,30423,30424,30425 - return new PatchState(Produce.MAHOGANY, CropState.DISEASED, value - 40); - } - if (value >= 48 && value <= 54) - { - // Dead Mahogany[Clear,Inspect,Guide] 30428,30429,30430,30431,30432,30433,30434 - return new PatchState(Produce.MAHOGANY, CropState.DEAD, value - 47); - } - if (value >= 55 && value <= 255) - { - // Tree patch[Rake,Inspect,Guide] 30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - return null; - } - }, - REDWOOD(Tab.TREE, "Redwood Trees") - { - @Override - PatchState forVarbitValue(int value) - { - if (value >= 0 && value <= 3) - { - // Redwood tree patch[Rake,Inspect,Guide] 34050,34049,34048,34047 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); - } - if (value >= 4 && value <= 7) - { - // Redwood tree patch[Rake,Inspect,Guide] 34050,34050,34050,34050 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 8 && value <= 17) - { - // Redwood tree[Inspect,Guide] 34205,34206,34207,34208,34209,34210,34215,34224,34242,34260 - return new PatchState(Produce.REDWOOD, CropState.GROWING, value - 8); - } - if (value == 18) - { - // Redwood tree[Clear,Inspect,Guide] 34278 - return new PatchState(Produce.REDWOOD, CropState.HARVESTABLE, 0); - } - if (value >= 19 && value <= 27) - { - // Diseased Redwood tree[Prune,Inspect,Guide] 34130,34131,34132,34133,34134,34139,34148,34166,34184 - return new PatchState(Produce.REDWOOD, CropState.DISEASED, value - 18); - } - if (value >= 28 && value <= 36) - { - // Dead Redwood tree[Clear,Inspect,Guide] 34061,34062,34063,34064,34065,34070,34079,34097,34115 - return new PatchState(Produce.REDWOOD, CropState.DEAD, value - 27); - } - if (value == 37) - { - // Redwood tree[Check-health,Inspect,Guide] 34297 - return new PatchState(Produce.REDWOOD, CropState.GROWING, Produce.REDWOOD.getStages() - 1); - } - if (value >= 41 && value <= 55) - { - // Redwood tree[Clear,Inspect,Guide] 34278,34278,34278,34278,34278,34278,34278,34278,34278,34278,34278,34278,34278,34278,34278 - return new PatchState(Produce.REDWOOD, CropState.HARVESTABLE, 0); - } - return null; - } - }, - SPIRIT_TREE(Tab.TREE, "Spirit Trees") - { - @Override - PatchState forVarbitValue(int value) - { - if (value >= 0 && value <= 3) - { - // Spirit Tree Patch[Rake,Inspect,Guide] 8342,8341,8340,8339 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); - } - if (value >= 4 && value <= 7) - { - // Spirit Tree Patch[Rake,Inspect,Guide] 8342,8342,8342,8342 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 8 && value <= 19) - { - // Spirit Tree[Inspect,Guide] 8343,8344,8345,8346,8347,8348,8349,8350,8351,8352,8353,8354 - return new PatchState(Produce.SPIRIT_TREE, CropState.GROWING, value - 8); - } - if (value == 20) - { - // Spirit Tree[Travel,Talk-to,Inspect,Guide,Clear] 8355 - return new PatchState(Produce.SPIRIT_TREE, CropState.GROWING, 12); - } - if (value >= 21 && value <= 31) - { - // Diseased Spirit Tree[Prune,Inspect,Guide] 8358,8359,8360,8361,8362,8363,8364,8365,8366,8367,8368 - return new PatchState(Produce.SPIRIT_TREE, CropState.DISEASED, value - 20); - } - if (value >= 32 && value <= 43) - { - // Dead Spirit Tree[Clear,Inspect,Guide] 8370,8371,8372,8373,8374,8375,8376,8377,8378,8379,8380,8381 - return new PatchState(Produce.SPIRIT_TREE, CropState.DEAD, value - 31); - } - if (value == 44) - { - // Spirit Tree[Check-health,Inspect,Guide] 8356 - return new PatchState(Produce.SPIRIT_TREE, CropState.GROWING, Produce.SPIRIT_TREE.getStages() - 1); - } - if (value >= 45 && value <= 63) - { - // Spirit Tree Patch[Rake,Inspect,Guide] 8342,8342,8342,8342,8342,8342,8342,8342,8342,8342,8342,8342,8342,8342,8342,8342,8342,8342,8342 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - return null; - } - }, - ANIMA(Tab.SPECIAL, "") - { - @Override - PatchState forVarbitValue(int value) - { - if (value >= 0 && value <= 3) - { - // Anima patch[Rake,Inspect,Guide] 33983,33982,33981,33980 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); - } - if (value >= 4 && value <= 7) - { - // Anima patch[Rake,Inspect,Guide] 33983,33983,33983,33983 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 8 && value <= 16) - { - // Attas plant[Inspect,Guide] 33991,33992,33993,33994,33995 - // Attas plant[Inspect,Guide] 33995,33995 - // Withering Attas plant[Inspect,Guide] 33996 - // Dead Attas plant[Clear,Inspect,Guide] 33997 - return new PatchState(Produce.ATTAS, CropState.GROWING, value - 8); - } - if (value >= 17 && value <= 25) - { - // Iasor plant[Inspect,Guide] 33984,33985,33986,33987,33988 - // Iasor plant[Inspect,Guide] 33988,33988 - // Withering Iasor plant[Inspect,Guide] 33989 - // Dead Iasor plant[Clear,Inspect,Guide] 33990 - return new PatchState(Produce.IASOR, CropState.GROWING, value - 17); - } - if (value >= 26 && value <= 34) - { - // Kronos plant[Inspect,Guide] 33999,34000,34001,34002,34003 - // Kronos plant[Inspect,Guide] 34003,34003 - // Withering Kronos plant[Inspect,Guide] 34004 - // Dead Kronos plant[Clear,Inspect,Guide] 34005 - return new PatchState(Produce.KRONOS, CropState.GROWING, value - 26); - } - if (value >= 35 && value <= 255) - { - // Anima patch[Rake,Inspect,Guide] 33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - return null; - } - }, - CACTUS(Tab.SPECIAL, "Cactus") - { - @Override - PatchState forVarbitValue(int value) - { - if (value >= 0 && value <= 3) - { - // Cactus patch[Rake,Inspect,Guide] 7746,7745,7744,7743 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); - } - if (value >= 4 && value <= 7) - { - // Cactus patch[Rake,Inspect,Guide] 7746,7746,7746,7746 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 8 && value <= 14) - { - // Cactus[Inspect,Guide] 7747,7748,7749,7750,7751,7752,7753 - return new PatchState(Produce.CACTUS, CropState.GROWING, value - 8); - } - if (value >= 15 && value <= 18) - { - // Cactus[Clear,Inspect,Guide,Pick-spine] 7754,7757,7757,7757 - return new PatchState(Produce.CACTUS, CropState.HARVESTABLE, value - 15); - } - if (value >= 19 && value <= 24) - { - // Diseased cactus[Cure,Inspect,Guide] 7759,7760,7761,7762,7763,7764 - return new PatchState(Produce.CACTUS, CropState.DISEASED, value - 18); - } - if (value >= 25 && value <= 30) - { - // Dead cactus[Clear,Inspect,Guide] 7765,7766,7767,7768,7769,7770 - return new PatchState(Produce.CACTUS, CropState.DEAD, value - 24); - } - if (value == 31) - { - // Cactus[Check-health,Inspect,Guide] 7758 - return new PatchState(Produce.CACTUS, CropState.GROWING, Produce.CACTUS.getStages() - 1); - } - if (value >= 32 && value <= 38) - { - // Potato cactus[Inspect,Guide] 33734,33735,33736,33737,33738,33739,33740 - return new PatchState(Produce.POTATO_CACTUS, CropState.GROWING, value - 32); - } - if (value >= 39 && value <= 45) - { - // Potato cactus[Clear,Inspect,Guide,Pick] 33741,33742,33743,33744,33745,33746,33747 - return new PatchState(Produce.POTATO_CACTUS, CropState.HARVESTABLE, value - 39); - } - if (value >= 46 && value <= 51) - { - // Diseased Potato cactus[Cure,Inspect,Guide] 33749,33750,33751,33752,33753,33754 - return new PatchState(Produce.POTATO_CACTUS, CropState.DISEASED, value - 45); - } - if (value >= 52 && value <= 57) - { - // Dead Potato cactus[Clear,Inspect,Guide] 33755,33756,33757,33758,33759,33760 - return new PatchState(Produce.POTATO_CACTUS, CropState.DEAD, value - 51); - } - if (value == 58) - { - // Potato cactus[Check-health,Inspect,Guide] 33748 - return new PatchState(Produce.POTATO_CACTUS, CropState.GROWING, Produce.POTATO_CACTUS.getStages() - 1); - } - if (value >= 59 && value <= 255) - { - // Cactus patch[Rake,Inspect,Guide] 7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - return null; - } - }, - SEAWEED(Tab.SPECIAL, "Seaweed") - { - @Override - PatchState forVarbitValue(int value) - { - if (value >= 0 && value <= 3) - { - // Seaweed patch[Rake,Inspect,Guide] 30486,30485,30484,30483 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); - } - if (value >= 4 && value <= 7) - { - // Seaweed[Inspect,Guide] 30487,30488,30489,30490 - return new PatchState(Produce.SEAWEED, CropState.GROWING, value - 4); - } - if (value >= 8 && value <= 10) - { - // Seaweed[Pick,Inspect,Guide] 30491,30492,30493 - return new PatchState(Produce.SEAWEED, CropState.HARVESTABLE, value - 8); - } - if (value >= 11 && value <= 13) - { - // Diseased seaweed[Cure,Inspect,Guide] 30494,30495,30496 - return new PatchState(Produce.SEAWEED, CropState.DISEASED, value - 10); - } - if (value >= 14 && value <= 16) - { - // Dead seaweed[Clear,Inspect,Guide] 30497,30498,30499 - return new PatchState(Produce.SEAWEED, CropState.DEAD, value - 13); - } - if (value >= 17 && value <= 255) - { - // Seaweed patch[Rake,Inspect,Guide] 30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - return null; - } - }, - CALQUAT(Tab.FRUIT_TREE, "Calquat") - { - @Override - PatchState forVarbitValue(int value) - { - if (value >= 0 && value <= 3) - { - // Calquat patch[Rake,Inspect,Guide] 7775,7774,7773,7772 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); - } - if (value >= 4 && value <= 11) - { - // Calquat Tree[Inspect,Guide] 7776,7777,7778,7779,7780,7781,7782,7783 - return new PatchState(Produce.CALQUAT, CropState.GROWING, value - 4); - } - if (value >= 12 && value <= 18) - { - // Calquat Tree[Clear,Inspect,Guide,Pick-fruit] 7784,7785,7786,7787,7788,7789,7790 - return new PatchState(Produce.CALQUAT, CropState.HARVESTABLE, value - 12); - } - if (value >= 19 && value <= 25) - { - // Diseased Calquat[Prune,Inspect,Guide] 7792,7793,7794,7795,7796,7797,7798 - return new PatchState(Produce.CALQUAT, CropState.DISEASED, value - 18); - } - if (value >= 26 && value <= 33) - { - // Dead Calquat[Clear,Inspect,Guide] 7799,7800,7801,7802,7803,7804,7805,7806 - return new PatchState(Produce.CALQUAT, CropState.DEAD, value - 25); - } - if (value == 34) - { - // Calquat Tree[Check-health,Inspect,Guide] 7791 - return new PatchState(Produce.CALQUAT, CropState.GROWING, Produce.CALQUAT.getStages() - 1); - } - if (value >= 35 && value <= 255) - { - // Calquat patch[Rake,Inspect,Guide] 7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - return null; - } - }, - CELASTRUS(Tab.FRUIT_TREE, "Celastrus") - { - @Override - PatchState forVarbitValue(int value) - { - if (value >= 0 && value <= 3) - { - // Celastrus patch[Rake,Inspect,Guide] 33698,33697,33696,33695 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); - } - if (value >= 4 && value <= 7) - { - // Celastrus patch[Rake,Inspect,Guide] 33698,33698,33698,33698 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 8 && value <= 12) - { - // Celastrus tree[Inspect,Guide] 33699,33700,33701,33702,33703 - return new PatchState(Produce.CELASTRUS, CropState.GROWING, value - 8); - } - if (value == 13) - { - // Celastrus tree[Check-health,Inspect,Guide] 33704 - return new PatchState(Produce.CELASTRUS, CropState.GROWING, Produce.CELASTRUS.getStages() - 1); - } - if (value >= 14 && value <= 16) - { - // Celastrus tree[Harvest,Inspect,Guide] 33719,33718,33717 - return new PatchState(Produce.CELASTRUS, CropState.HARVESTABLE, value - 14); - } - if (value == 17) - { - // Harvested Celastrus tree[Chop,Inspect,Guide] 33720 - return new PatchState(Produce.CELASTRUS, CropState.HARVESTABLE, 0); - } - if (value >= 18 && value <= 22) - { - // Diseased celastrus tree[Prune,Inspect,Guide] 33705,33706,33707,33708,33709 - return new PatchState(Produce.CELASTRUS, CropState.DISEASED, value - 17); - } - if (value >= 23 && value <= 27) - { - // Dead celastrus tree[Clear,Inspect,Guide] 33711,33712,33713,33714,33715 - return new PatchState(Produce.CELASTRUS, CropState.DEAD, value - 22); - } - if (value == 28) - { - // Celastrus tree stump[Clear,Inspect,Guide] 33721 - return new PatchState(Produce.CELASTRUS, CropState.HARVESTABLE, 0); - } - if (value >= 29 && value <= 255) - { - // Celastrus patch[Rake,Inspect,Guide] 33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - return null; - } - }, - GRAPES(Tab.GRAPE, "") - { - @Override - PatchState forVarbitValue(int value) - { - if (value >= 0 && value <= 1) - { - // Empty, empty+fertilizer - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); - } - if (value >= 2 && value <= 9) - { - return new PatchState(Produce.GRAPE, CropState.GROWING, value - 2); - } - if (value == 10) - { - return new PatchState(Produce.GRAPE, CropState.GROWING, 7); - } - if (value >= 11 && value <= 15) - { - return new PatchState(Produce.GRAPE, CropState.HARVESTABLE, value - 11); - } - return null; - } - }, - CRYSTAL_TREE(Tab.FRUIT_TREE, "Crystal Tree") - { - @Override - PatchState forVarbitValue(int value) - { - if (value >= 0 && value <= 3) - { - // Crystal tree patch[Rake,Inspect,Guide] 34910,34909,34908,34907 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); - } - if (value >= 8 && value <= 13) - { - // Crystal tree[Inspect,Guide] 34911,34912,34913,34914,34915,34916 - return new PatchState(Produce.CRYSTAL_TREE, CropState.GROWING, value - 8); - } - if (value == 14) - { - // Crystal tree[Check-health,Inspect,Guide] 34917 - return new PatchState(Produce.CRYSTAL_TREE, CropState.GROWING, Produce.CRYSTAL_TREE.getStages() - 1); - } - if (value == 15) - { - // Crystal tree[Chop-down,Inspect,Guide] 34918 - return new PatchState(Produce.CRYSTAL_TREE, CropState.HARVESTABLE, 0); - } - return null; - } - }; - - @Nullable - abstract PatchState forVarbitValue(int value); - - private final Tab tab; - - private final String name; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/PatchPrediction.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/PatchPrediction.java deleted file mode 100644 index 9a2b98aeab..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/PatchPrediction.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.timetracking.farming; - -import lombok.Value; - -@Value -class PatchPrediction -{ - private final Produce produce; - private final CropState cropState; - private final long doneEstimate; - private final int stage; - private final int stages; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/PatchState.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/PatchState.java deleted file mode 100644 index 2857882b3f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/PatchState.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.timetracking.farming; - -import lombok.Value; - -@Value -class PatchState -{ - private final Produce produce; - private final CropState cropState; - private final int stage; - - int getStages() - { - return cropState == CropState.HARVESTABLE ? produce.getHarvestStages() : produce.getStages(); - } - - int getTickRate() - { - switch (cropState) - { - case HARVESTABLE: - return produce.getRegrowTickrate(); - case GROWING: - return produce.getTickrate(); - default: - return 0; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/Produce.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/Produce.java deleted file mode 100644 index bf9374a5c8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/farming/Produce.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2018 Abex - * Copyright (c) 2018, NotFoxtrot - * 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.timetracking.farming; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.api.ItemID; -import net.runelite.api.NullItemID; - -@RequiredArgsConstructor -@Getter(AccessLevel.PACKAGE) -public enum Produce -{ - WEEDS("Weeds", ItemID.WEEDS, 5, 4), - SCARECROW("Scarecrow", ItemID.SCARECROW, 5, 4), - - // Allotment crops - POTATO("Potato", ItemID.POTATO, 10, 5, 0, 3), - ONION("Onion", ItemID.ONION, 10, 5, 0, 3), - CABBAGE("Cabbage", ItemID.CABBAGE, 10, 5, 0, 3), - TOMATO("Tomato", ItemID.TOMATO, 10, 5, 0, 3), - SWEETCORN("Sweetcorn", ItemID.SWEETCORN, 10, 6, 0, 3), - STRAWBERRY("Strawberry", ItemID.STRAWBERRY, 10, 7, 0, 3), - WATERMELON("Watermelon", ItemID.WATERMELON, 10, 8, 0, 3), - SNAPE_GRASS("Snape grass", ItemID.SNAPE_GRASS, 10, 8, 0, 3), - - // Flower crops - MARIGOLD("Marigold", ItemID.MARIGOLDS, 5, 5), - ROSEMARY("Rosemary", ItemID.ROSEMARY, 5, 5), - NASTURTIUM("Nasturtium", ItemID.NASTURTIUMS, 5, 5), - WOAD("Woad", ItemID.WOAD_LEAF, 5, 5), - LIMPWURT("Limpwurt", ItemID.LIMPWURT_ROOT, 5, 5), - WHITE_LILY("While lily", ItemID.WHITE_LILY, 5, 5), - - // Bush crops - REDBERRIES("Redberry", ItemID.REDBERRIES, 20, 6, 20, 5), - CADAVABERRIES("Cadavaberry", ItemID.CADAVA_BERRIES, 20, 7, 20, 5), - DWELLBERRIES("Dwellberry", ItemID.DWELLBERRIES, 20, 8, 20, 5), - JANGERBERRIES("Jangerberry", ItemID.JANGERBERRIES, 20, 9, 20, 5), - WHITEBERRIES("Whiteberry", ItemID.WHITE_BERRIES, 20, 9, 20, 5), - POISON_IVY("Poison", ItemID.POISON_IVY_BERRIES, 20, 9, 20, 5), - - // Hop crops - BARLEY("Barley", ItemID.BARLEY, 10, 5, 0, 3), - HAMMERSTONE("Hammerstone", ItemID.HAMMERSTONE_HOPS, 10, 5, 0, 3), - ASGARNIAN("Asgarnian", ItemID.ASGARNIAN_HOPS, 10, 6, 0, 3), - JUTE("Jute", ItemID.JUTE_FIBRE, 10, 6, 0, 3), - YANILLIAN("Yanillian", ItemID.YANILLIAN_HOPS, 10, 7, 0, 3), - KRANDORIAN("Krandorian", ItemID.KRANDORIAN_HOPS, 10, 8, 0, 3), - WILDBLOOD("Wildblood", ItemID.WILDBLOOD_HOPS, 10, 9, 0, 3), - - // Herb crops - GUAM("Guam", ItemID.GUAM_LEAF, 20, 5, 0, 3), - MARRENTILL("Marrentill", ItemID.MARRENTILL, 20, 5, 0, 3), - TARROMIN("Tarromin", ItemID.TARROMIN, 20, 5, 0, 3), - HARRALANDER("Harralander", ItemID.HARRALANDER, 20, 5, 0, 3), - RANARR("Ranarr", ItemID.RANARR_WEED, 20, 5, 0, 3), - TOADFLAX("Toadflax", ItemID.TOADFLAX, 20, 5, 0, 3), - IRIT("Irit", ItemID.IRIT_LEAF, 20, 5, 0, 3), - AVANTOE("Avantoe", ItemID.AVANTOE, 20, 5, 0, 3), - KWUARM("Kwuarm", ItemID.KWUARM, 20, 5, 0, 3), - SNAPDRAGON("Snapdragon", ItemID.SNAPDRAGON, 20, 5, 0, 3), - CADANTINE("Cadantine", ItemID.CADANTINE, 20, 5, 0, 3), - LANTADYME("Lantadyme", ItemID.LANTADYME, 20, 5, 0, 3), - DWARF_WEED("Dwarf Weed", ItemID.DWARF_WEED, 20, 5, 0, 3), - TORSTOL("Torstol", ItemID.TORSTOL, 20, 5, 0, 3), - GOUTWEED("Goutweed", ItemID.GOUTWEED, 20, 5, 0, 2), - ANYHERB("Any herb", ItemID.GUAM_LEAF, 20, 5, 0, 3), - - // Tree crops - OAK("Oak", ItemID.OAK_LOGS, 40, 5), - WILLOW("Willow", ItemID.WILLOW_LOGS, 40, 7), - MAPLE("Maple", ItemID.MAPLE_LOGS, 40, 9), - YEW("Yew", ItemID.YEW_LOGS, 40, 11), - MAGIC("Magic", ItemID.MAGIC_LOGS, 40, 13), - - // Fruit tree crops - APPLE("Apple", ItemID.COOKING_APPLE, 160, 7, 45, 7), - BANANA("Banana", ItemID.BANANA, 160, 7, 45, 7), - ORANGE("Orange", ItemID.ORANGE, 160, 7, 45, 7), - CURRY("Curry", ItemID.CURRY_LEAF, 160, 7, 45, 7), - PINEAPPLE("Pineapple", ItemID.PINEAPPLE, 160, 7, 45, 7), - PAPAYA("Papaya", ItemID.PAPAYA_FRUIT, 160, 7, 45, 7), - PALM("Palm", ItemID.COCONUT, 160, 7, 45, 7), - DRAGONFRUIT("Dragonfruit", ItemID.DRAGONFRUIT, 160, 7, 45, 7), - - // Cactus - CACTUS("Cactus", ItemID.CACTUS_SPINE, 80, 8, 20, 4), - POTATO_CACTUS("Potato cactus", ItemID.POTATO_CACTUS, 10, 8, 5, 7), - - // Hardwood - TEAK("Teak", ItemID.TEAK_LOGS, 560, 8), - MAHOGANY("Mahogany", ItemID.MAHOGANY_LOGS, 640, 9), - - // Anima - ATTAS("Attas", NullItemID.NULL_22940, 640, 9), - IASOR("Iasor", NullItemID.NULL_22939, 640, 9), - KRONOS("Kronos", NullItemID.NULL_22938, 640, 9), - - // Special crops - SEAWEED("Seaweed", ItemID.GIANT_SEAWEED, 10, 5, 0, 4), - GRAPE("Grape", ItemID.GRAPES, 5, 8, 0, 5), - MUSHROOM("Mushroom", ItemID.MUSHROOM, 40, 7, 0, 7), - BELLADONNA("Belladonna", ItemID.CAVE_NIGHTSHADE, 80, 5), - CALQUAT("Calquat", ItemID.CALQUAT_FRUIT, 160, 9, 0, 7), - SPIRIT_TREE("Spirit tree", ItemID.SPIRIT_TREE, 320, 13), - CELASTRUS("Celastrus", ItemID.BATTLESTAFF, 160, 6, 0, 4), - REDWOOD("Redwood", ItemID.REDWOOD_LOGS, 640, 11), - HESPORI("Hespori", NullItemID.NULL_23044, 640, 4, 0, 2), - CRYSTAL_TREE("Crystal tree", ItemID.CRYSTAL_SHARDS, 80, 7); - - /** - * User-visible name - */ - private final String name; - /** - * User-visible item icon - */ - private final int itemID; - /** - * How many minutes per growth tick - */ - private final int tickrate; - /** - * How many states this crop has during growth. Typically tickcount+1 - */ - private final int stages; - /** - * How many minutes to regrow crops, or zero if it doesn't regrow - */ - private final int regrowTickrate; - /** - * How many states this crop has during harvest. - * This is often called lives. - */ - private final int harvestStages; - - Produce(String name, int itemID, int tickrate, int stages) - { - this(name, itemID, tickrate, stages, 0, 1); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouse.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouse.java deleted file mode 100644 index d04944ba75..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouse.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2018, Daniel Teo - * 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.timetracking.hunter; - -import javax.annotation.Nullable; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.ItemID; - -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -enum BirdHouse -{ - NORMAL("Bird House", ItemID.BIRD_HOUSE), - OAK("Oak Bird House", ItemID.OAK_BIRD_HOUSE), - WILLOW("Willow Bird House", ItemID.WILLOW_BIRD_HOUSE), - TEAK("Teak Bird House", ItemID.TEAK_BIRD_HOUSE), - MAPLE("Maple Bird House", ItemID.MAPLE_BIRD_HOUSE), - MAHOGANY("Mahogany Bird House", ItemID.MAHOGANY_BIRD_HOUSE), - YEW("Yew Bird House", ItemID.YEW_BIRD_HOUSE), - MAGIC("Magic Bird House", ItemID.MAGIC_BIRD_HOUSE), - REDWOOD("Redwood Bird House", ItemID.REDWOOD_BIRD_HOUSE); - - private final String name; - private final int itemID; - - /** - * Gets the {@code BirdHouse} corresponding to the given {@code VarPlayer} value. - */ - @Nullable - static BirdHouse fromVarpValue(int varp) - { - int index = (varp - 1) / 3; - - if (varp <= 0 || index >= values().length) - { - return null; - } - - return values()[index]; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouseData.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouseData.java deleted file mode 100644 index f5af4893ef..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouseData.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2018, Daniel Teo - * 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.timetracking.hunter; - -import lombok.Value; - -/** - * Contains data about the state of a particular {@link BirdHouseSpace}, at a particular point in time. - */ -@Value -class BirdHouseData -{ - private BirdHouseSpace space; - private int varp; - private long timestamp; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouseSpace.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouseSpace.java deleted file mode 100644 index f85a3d6a85..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouseSpace.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2018, Daniel Teo - * 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.timetracking.hunter; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.VarPlayer; - -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -enum BirdHouseSpace -{ - MEADOW_NORTH("Mushroom Meadow (North)", VarPlayer.BIRD_HOUSE_MEADOW_NORTH), - MEADOW_SOUTH("Mushroom Meadow (South)", VarPlayer.BIRD_HOUSE_MEADOW_SOUTH), - VALLEY_NORTH("Verdant Valley (Northeast)", VarPlayer.BIRD_HOUSE_VALLEY_NORTH), - VALLEY_SOUTH("Verdant Valley (Southwest)", VarPlayer.BIRD_HOUSE_VALLEY_SOUTH); - - private final String name; - private final VarPlayer varp; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouseState.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouseState.java deleted file mode 100644 index 492e30cc5b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouseState.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2018, Daniel Teo - * 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.timetracking.hunter; - -import java.awt.Color; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.client.ui.ColorScheme; - -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -enum BirdHouseState -{ - SEEDED(ColorScheme.PROGRESS_COMPLETE_COLOR), - BUILT(ColorScheme.PROGRESS_INPROGRESS_COLOR), - EMPTY(ColorScheme.MEDIUM_GRAY_COLOR), - UNKNOWN(ColorScheme.MEDIUM_GRAY_COLOR); - - private final Color color; - - /** - * Gets the {@code BirdHouseState} corresponding to the given {@code VarPlayer} value. - */ - static BirdHouseState fromVarpValue(int varp) - { - if (varp < 0 || varp > BirdHouse.values().length * 3) - { - return UNKNOWN; - } - else if (varp == 0) - { - return EMPTY; - } - else if (varp % 3 == 0) - { - return SEEDED; - } - else - { - return BUILT; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouseTabPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouseTabPanel.java deleted file mode 100644 index c8935b850a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouseTabPanel.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2018 Abex - * Copyright (c) 2018, Psikoi - * Copyright (c) 2018, Daniel Teo - * 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.timetracking.hunter; - -import java.awt.Color; -import java.time.Instant; -import java.util.ArrayList; -import java.util.List; -import net.runelite.api.ItemID; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.timetracking.TabContentPanel; -import net.runelite.client.plugins.timetracking.TimeTrackingConfig; -import net.runelite.client.plugins.timetracking.TimeablePanel; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.DynamicGridLayout; - -public class BirdHouseTabPanel extends TabContentPanel -{ - private static final Color COMPLETED_COLOR = ColorScheme.PROGRESS_COMPLETE_COLOR.darker(); - - private final ItemManager itemManager; - private final BirdHouseTracker birdHouseTracker; - private final TimeTrackingConfig config; - private final List> spacePanels; - - BirdHouseTabPanel(ItemManager itemManager, BirdHouseTracker birdHouseTracker, TimeTrackingConfig config) - { - this.itemManager = itemManager; - this.birdHouseTracker = birdHouseTracker; - this.config = config; - this.spacePanels = new ArrayList<>(); - - setLayout(new DynamicGridLayout(0, 1, 0, 0)); - setBackground(ColorScheme.DARK_GRAY_COLOR); - - boolean first = true; - for (BirdHouseSpace space : BirdHouseSpace.values()) - { - TimeablePanel panel = new TimeablePanel<>(space, space.getName(), BirdHouseTracker.BIRD_HOUSE_DURATION); - - spacePanels.add(panel); - add(panel); - - // remove the top border on the first panel - if (first) - { - first = false; - panel.setBorder(null); - } - } - } - - @Override - public int getUpdateInterval() - { - return 50; // 10 seconds - } - - @Override - public void update() - { - long unixNow = Instant.now().getEpochSecond(); - - for (TimeablePanel panel : spacePanels) - { - BirdHouseSpace space = panel.getTimeable(); - BirdHouseData data = birdHouseTracker.getBirdHouseData().get(space); - int value = -1; - long startTime = 0; - - if (data != null) - { - value = data.getVarp(); - startTime = data.getTimestamp(); - } - - BirdHouse birdHouse = BirdHouse.fromVarpValue(value); - BirdHouseState state = BirdHouseState.fromVarpValue(value); - - if (birdHouse == null) - { - itemManager.getImage(ItemID.FEATHER).addTo(panel.getIcon()); - panel.getProgress().setVisible(false); - } - else - { - itemManager.getImage(birdHouse.getItemID()).addTo(panel.getIcon()); - panel.getIcon().setToolTipText(birdHouse.getName()); - panel.getProgress().setVisible(true); - } - - panel.getProgress().setForeground(state.getColor().darker()); - - switch (state) - { - case EMPTY: - panel.getIcon().setToolTipText("Empty"); - panel.getEstimate().setText("Empty"); - break; - case BUILT: - panel.getProgress().setValue(0); - panel.getEstimate().setText("Built"); - break; - case SEEDED: - long remainingTime = startTime + BirdHouseTracker.BIRD_HOUSE_DURATION - unixNow; - if (remainingTime <= 0) - { - panel.getProgress().setValue(BirdHouseTracker.BIRD_HOUSE_DURATION); - panel.getProgress().setForeground(COMPLETED_COLOR); - panel.getEstimate().setText("Done"); - } - else - { - panel.getProgress().setValue((int) (BirdHouseTracker.BIRD_HOUSE_DURATION - remainingTime)); - panel.getEstimate().setText("Done " + getFormattedEstimate(remainingTime, config.estimateRelative())); - } - break; - default: - panel.getIcon().setToolTipText("Unknown state"); - panel.getEstimate().setText("Unknown"); - break; - } - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouseTracker.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouseTracker.java deleted file mode 100644 index ea4f542c8d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/hunter/BirdHouseTracker.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (c) 2018 Abex - * Copyright (c) 2018, Daniel Teo - * 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.timetracking.hunter; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Inject; -import com.google.inject.Singleton; -import java.time.Duration; -import java.time.Instant; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.Notifier; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.timetracking.SummaryState; -import net.runelite.client.plugins.timetracking.TimeTrackingConfig; - -@Singleton -public class BirdHouseTracker -{ - // average time taken to harvest 10 birds, in seconds - static final int BIRD_HOUSE_DURATION = (int) Duration.ofMinutes(50).getSeconds(); - - private static final ImmutableSet FOSSIL_ISLAND_REGIONS = ImmutableSet.of(14650, 14651, 14652, 14906, 14907, 15162, 15163); - - private final Client client; - private final ItemManager itemManager; - private final ConfigManager configManager; - private final TimeTrackingConfig config; - private final Notifier notifier; - - @Getter(AccessLevel.PACKAGE) - private final ConcurrentMap birdHouseData = new ConcurrentHashMap<>(); - - @Getter(AccessLevel.PUBLIC) - private SummaryState summary = SummaryState.UNKNOWN; - - /** - * The time at which all the bird houses will be ready to be dismantled, - * or {@code -1} if we have no data about any of the bird house spaces. - */ - @Getter(AccessLevel.PUBLIC) - private long completionTime = -1; - - @Inject - private BirdHouseTracker(Client client, ItemManager itemManager, ConfigManager configManager, - TimeTrackingConfig config, Notifier notifier) - { - this.client = client; - this.itemManager = itemManager; - this.configManager = configManager; - this.config = config; - this.notifier = notifier; - } - - public BirdHouseTabPanel createBirdHouseTabPanel() - { - return new BirdHouseTabPanel(itemManager, this, config); - } - - public void loadFromConfig() - { - birdHouseData.clear(); - - final String group = TimeTrackingConfig.CONFIG_GROUP + "." + client.getUsername() + "." + TimeTrackingConfig.BIRD_HOUSE; - - for (BirdHouseSpace space : BirdHouseSpace.values()) - { - String key = Integer.toString(space.getVarp().getId()); - String storedValue = configManager.getConfiguration(group, key); - - if (storedValue != null) - { - String[] parts = storedValue.split(":"); - if (parts.length == 2) - { - try - { - int varp = Integer.parseInt(parts[0]); - long timestamp = Long.parseLong(parts[1]); - birdHouseData.put(space, new BirdHouseData(space, varp, timestamp)); - } - catch (NumberFormatException e) - { - // ignored - } - } - } - } - - updateCompletionTime(); - } - - /** - * Updates tracker data if player is within range of any bird house. Returns true if any data was changed. - */ - public boolean updateData(WorldPoint location) - { - boolean changed = false; - - if (FOSSIL_ISLAND_REGIONS.contains(location.getRegionID()) && location.getPlane() == 0) - { - final Map newData = new HashMap<>(); - final long currentTime = Instant.now().getEpochSecond(); - int removalCount = 0; - - for (BirdHouseSpace space : BirdHouseSpace.values()) - { - int varp = client.getVar(space.getVarp()); - BirdHouseData oldData = birdHouseData.get(space); - int oldVarp = oldData == null ? -1 : oldData.getVarp(); - - // update data if there isn't one, or if the varp doesn't match - if (varp != oldVarp) - { - newData.put(space, new BirdHouseData(space, varp, currentTime)); - changed = true; - } - - if (varp <= 0 && oldVarp > 0) - { - removalCount++; - } - } - - // Prevent the resetting of bird house data that could occur if the varps have not been updated yet - // after the player enters the region. We assume that players would generally have 3 or 4 bird houses - // built at any time, and that dropping from 3/4 to 0 built bird houses is not normally possible. - if (removalCount > 2) - { - return false; - } - - if (changed) - { - birdHouseData.putAll(newData); - updateCompletionTime(); - saveToConfig(newData); - } - } - - return changed; - } - - /** - * Checks if the bird houses have become ready to be dismantled, - * and sends a notification if required. - */ - public boolean checkCompletion() - { - if (summary == SummaryState.IN_PROGRESS && completionTime < Instant.now().getEpochSecond()) - { - summary = SummaryState.COMPLETED; - completionTime = 0; - - if (config.birdHouseNotification()) - { - notifier.notify("Your bird houses are ready to be dismantled."); - } - - return true; - } - - return false; - } - - /** - * Updates the overall completion time of the bird houses. - * - * @see #completionTime - */ - private void updateCompletionTime() - { - if (birdHouseData.isEmpty()) - { - summary = SummaryState.UNKNOWN; - completionTime = -1; - return; - } - - boolean allEmpty = true; - long maxCompletionTime = 0; - for (BirdHouseData data : birdHouseData.values()) - { - final BirdHouseState state = BirdHouseState.fromVarpValue(data.getVarp()); - - if (state != BirdHouseState.EMPTY) - { - allEmpty = false; - } - - if (state == BirdHouseState.SEEDED) - { - maxCompletionTime = Math.max(maxCompletionTime, data.getTimestamp() + BIRD_HOUSE_DURATION); - } - } - - if (allEmpty) - { - summary = SummaryState.EMPTY; - completionTime = 0; - } - else if (maxCompletionTime <= Instant.now().getEpochSecond()) - { - summary = SummaryState.COMPLETED; - completionTime = 0; - } - else - { - summary = SummaryState.IN_PROGRESS; - completionTime = maxCompletionTime; - } - } - - private void saveToConfig(Map updatedData) - { - final String group = TimeTrackingConfig.CONFIG_GROUP + "." + client.getUsername() + "." + TimeTrackingConfig.BIRD_HOUSE; - - for (BirdHouseData data : updatedData.values()) - { - String key = Integer.toString(data.getSpace().getVarp().getId()); - configManager.setConfiguration(group, key, data.getVarp() + ":" + data.getTimestamp()); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlant.java b/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlant.java deleted file mode 100644 index 0488514d89..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlant.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Unmoon - * 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.tithefarm; - -import java.time.Duration; -import java.time.Instant; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.GameObject; -import net.runelite.api.coords.WorldPoint; - -class TitheFarmPlant -{ - private static final Duration PLANT_TIME = Duration.ofMinutes(1); - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private Instant planted; - - @Getter(AccessLevel.PACKAGE) - private final TitheFarmPlantState state; - - @Getter(AccessLevel.PACKAGE) - private final TitheFarmPlantType type; - - @Getter(AccessLevel.PACKAGE) - private final GameObject gameObject; - - @Getter(AccessLevel.PACKAGE) - private final WorldPoint worldLocation; - - TitheFarmPlant(final TitheFarmPlantState state, final TitheFarmPlantType type, final GameObject gameObject) - { - this.planted = Instant.now(); - this.state = state; - this.type = type; - this.gameObject = gameObject; - this.worldLocation = gameObject.getWorldLocation(); - } - - double getPlantTimeRelative() - { - Duration duration = Duration.between(planted, Instant.now()); - return duration.compareTo(PLANT_TIME) < 0 ? (double) duration.toMillis() / PLANT_TIME.toMillis() : 1; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlantOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlantOverlay.java deleted file mode 100644 index 0cf673b2dd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlantOverlay.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2018, Unmoon - * 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.tithefarm; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.util.HashMap; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.widgets.Widget; -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.components.ProgressPieComponent; - -@Singleton -public class TitheFarmPlantOverlay extends Overlay -{ - private final Client client; - private final TitheFarmPlugin plugin; - private final Map borders = new HashMap<>(); - private final Map fills = new HashMap<>(); - - @Inject - TitheFarmPlantOverlay(final Client client, final TitheFarmPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.plugin = plugin; - this.client = client; - } - - /** - * Updates the timer colors. - */ - public void updateConfig() - { - borders.clear(); - fills.clear(); - - final Color colorUnwateredBorder = plugin.getGetColorUnwatered(); - final Color colorUnwatered = new Color(colorUnwateredBorder.getRed(), colorUnwateredBorder.getGreen(), colorUnwateredBorder.getBlue(), 100); - borders.put(TitheFarmPlantState.UNWATERED, colorUnwateredBorder); - fills.put(TitheFarmPlantState.UNWATERED, colorUnwatered); - - final Color colorWateredBorder = plugin.getGetColorWatered(); - final Color colorWatered = new Color(colorWateredBorder.getRed(), colorWateredBorder.getGreen(), colorWateredBorder.getBlue(), 100); - borders.put(TitheFarmPlantState.WATERED, colorWateredBorder); - fills.put(TitheFarmPlantState.WATERED, colorWatered); - - final Color colorGrownBorder = plugin.getGetColorGrown(); - final Color colorGrown = new Color(colorGrownBorder.getRed(), colorGrownBorder.getGreen(), colorGrownBorder.getBlue(), 100); - borders.put(TitheFarmPlantState.GROWN, colorGrownBorder); - fills.put(TitheFarmPlantState.GROWN, colorGrown); - } - - @Override - public Dimension render(Graphics2D graphics) - { - final Widget viewport = client.getViewportWidget(); - - for (TitheFarmPlant plant : plugin.getPlants()) - { - if (plant.getState() == TitheFarmPlantState.DEAD) - { - continue; - } - - final LocalPoint localLocation = LocalPoint.fromWorld(client, plant.getWorldLocation()); - - if (localLocation == null) - { - continue; - } - - final Point canvasLocation = Perspective.localToCanvas(client, localLocation, client.getPlane()); - - if (viewport != null && canvasLocation != null) - { - final ProgressPieComponent progressPieComponent = new ProgressPieComponent(); - progressPieComponent.setPosition(canvasLocation); - progressPieComponent.setProgress(1 - plant.getPlantTimeRelative()); - progressPieComponent.setBorderColor(borders.get(plant.getState())); - progressPieComponent.setFill(fills.get(plant.getState())); - progressPieComponent.render(graphics); - } - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlantState.java b/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlantState.java deleted file mode 100644 index a1331808ba..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlantState.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2018, Unmoon - * 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.tithefarm; - -enum TitheFarmPlantState -{ - UNWATERED, - WATERED, - DEAD, - GROWN; - - public static TitheFarmPlantState getState(int objectId) - { - TitheFarmPlantType plantType = TitheFarmPlantType.getPlantType(objectId); - if (plantType == null) - { - return null; - } - - int baseId = plantType.getBaseId(); - if (objectId == baseId) - { - return GROWN; - } - - switch ((baseId - objectId) % 3) - { - case 0: - return UNWATERED; - case 2: - return WATERED; - default: - return DEAD; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlantType.java b/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlantType.java deleted file mode 100644 index 61e131aa22..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlantType.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2018, Unmoon - * 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.tithefarm; - -import com.google.common.collect.ImmutableMap; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ObjectID; - -public enum TitheFarmPlantType -{ - EMPTY("Empty", ObjectID.TITHE_PATCH, - ObjectID.TITHE_PATCH - ), - GOLOVANOVA("Golovanova", ObjectID.GOLOVANOVA_PLANT_27393, - ObjectID.GOLOVANOVA_SEEDLING, ObjectID.GOLOVANOVA_SEEDLING_27385, ObjectID.BLIGHTED_GOLOVANOVA_SEEDLING, - ObjectID.GOLOVANOVA_PLANT, ObjectID.GOLOVANOVA_PLANT_27388, ObjectID.BLIGHTED_GOLOVANOVA_PLANT, - ObjectID.GOLOVANOVA_PLANT_27390, ObjectID.GOLOVANOVA_PLANT_27391, ObjectID.BLIGHTED_GOLOVANOVA_PLANT_27392, - ObjectID.GOLOVANOVA_PLANT_27393, ObjectID.BLIGHTED_GOLOVANOVA_PLANT_27394 - ), - BOLOGANO("Bologano", ObjectID.BOLOGANO_PLANT_27404, - ObjectID.BOLOGANO_SEEDLING, ObjectID.BOLOGANO_SEEDLING_27396, ObjectID.BLIGHTED_BOLOGANO_SEEDLING, - ObjectID.BOLOGANO_PLANT, ObjectID.BOLOGANO_PLANT_27399, ObjectID.BLIGHTED_BOLOGANO_PLANT, - ObjectID.BOLOGANO_PLANT_27401, ObjectID.BOLOGANO_PLANT_27402, ObjectID.BLIGHTED_BOLOGANO_PLANT_27403, - ObjectID.BOLOGANO_PLANT_27404, ObjectID.BLIGHTED_BOLOGANO_PLANT_27405 - ), - LOGAVANO("Logavano", ObjectID.LOGAVANO_PLANT_27415, - ObjectID.LOGAVANO_SEEDLING, ObjectID.LOGAVANO_SEEDLING_27407, ObjectID.BLIGHTED_LOGAVANO_SEEDLING, - ObjectID.LOGAVANO_PLANT, ObjectID.LOGAVANO_PLANT_27410, ObjectID.BLIGHTED_LOGAVANO_PLANT, - ObjectID.LOGAVANO_PLANT_27412, ObjectID.LOGAVANO_PLANT_27413, ObjectID.BLIGHTED_LOGAVANO_PLANT_27414, - ObjectID.LOGAVANO_PLANT_27415, ObjectID.BLIGHTED_LOGAVANO_PLANT_27416 - ); - - @Getter(AccessLevel.PACKAGE) - private final String name; - @Getter(AccessLevel.PACKAGE) - private final int baseId; - @Getter(AccessLevel.PACKAGE) - private final int[] objectIds; - - private static final Map plantTypes; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (TitheFarmPlantType type : values()) - { - for (int spotId : type.getObjectIds()) - { - builder.put(spotId, type); - } - } - - plantTypes = builder.build(); - } - - TitheFarmPlantType(final String name, final int baseId, final int... objectIds) - { - this.name = name; - this.baseId = baseId; - this.objectIds = objectIds; - } - - public static TitheFarmPlantType getPlantType(int objectId) - { - return plantTypes.get(objectId); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlugin.java deleted file mode 100644 index 1de8a68ad3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPlugin.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2018, Unmoon - * 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.tithefarm; - -import com.google.inject.Provides; -import java.awt.Color; -import java.util.HashSet; -import java.util.Set; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.GameObject; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GameTick; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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; - -@Slf4j -@PluginDescriptor( - name = "Tithe Farm", - description = "Show timers for the farming patches within the Tithe Farm minigame", - tags = {"farming", "minigame", "overlay", "skilling", "timers"}, - type = PluginType.MINIGAME -) -@Singleton -public class TitheFarmPlugin extends Plugin -{ - @Inject - private OverlayManager overlayManager; - - @Inject - private TitheFarmPlantOverlay titheFarmOverlay; - - @Inject - private TitheFarmPluginConfig config; - - @Getter(AccessLevel.PACKAGE) - private final Set plants = new HashSet<>(); - - @Getter(AccessLevel.PACKAGE) - private Color getColorUnwatered; - @Getter(AccessLevel.PACKAGE) - private Color getColorWatered; - @Getter(AccessLevel.PACKAGE) - private Color getColorGrown; - - @Provides - TitheFarmPluginConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(TitheFarmPluginConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(titheFarmOverlay); - titheFarmOverlay.updateConfig(); - } - - @Override - protected void shutDown() - { - overlayManager.remove(titheFarmOverlay); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("tithefarmplugin")) - { - updateConfig(); - - titheFarmOverlay.updateConfig(); - } - } - - @Subscribe - private void onGameTick(final GameTick event) - { - plants.removeIf(plant -> plant.getPlantTimeRelative() == 1); - } - - @Subscribe - private void onGameObjectSpawned(GameObjectSpawned event) - { - GameObject gameObject = event.getGameObject(); - - TitheFarmPlantType type = TitheFarmPlantType.getPlantType(gameObject.getId()); - if (type == null) - { - return; - } - - TitheFarmPlantState state = TitheFarmPlantState.getState(gameObject.getId()); - - TitheFarmPlant newPlant = new TitheFarmPlant(state, type, gameObject); - TitheFarmPlant oldPlant = getPlantFromCollection(gameObject); - - if (oldPlant == null && newPlant.getType() != TitheFarmPlantType.EMPTY) - { - log.debug("Added plant {}", newPlant); - plants.add(newPlant); - } - else if (newPlant.getType() == TitheFarmPlantType.EMPTY) - { - log.debug("Removed plant {}", oldPlant); - plants.remove(oldPlant); - } - else if (oldPlant != null && oldPlant.getGameObject().getId() != newPlant.getGameObject().getId()) - { - if (oldPlant.getState() != TitheFarmPlantState.WATERED && newPlant.getState() == TitheFarmPlantState.WATERED) - { - log.debug("Updated plant (watered)"); - newPlant.setPlanted(oldPlant.getPlanted()); - plants.remove(oldPlant); - plants.add(newPlant); - } - else - { - log.debug("Updated plant"); - plants.remove(oldPlant); - plants.add(newPlant); - } - } - } - - private TitheFarmPlant getPlantFromCollection(GameObject gameObject) - { - WorldPoint gameObjectLocation = gameObject.getWorldLocation(); - for (TitheFarmPlant plant : plants) - { - if (gameObjectLocation.equals(plant.getWorldLocation())) - { - return plant; - } - } - return null; - } - - private void updateConfig() - { - this.getColorUnwatered = config.getColorUnwatered(); - this.getColorWatered = config.getColorWatered(); - this.getColorGrown = config.getColorGrown(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPluginConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPluginConfig.java deleted file mode 100644 index 007953b618..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tithefarm/TitheFarmPluginConfig.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2018, Unmoon - * 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.tithefarm; - -import java.awt.Color; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("tithefarmplugin") -public interface TitheFarmPluginConfig extends Config -{ - @ConfigItem( - position = 1, - keyName = "hexColorUnwatered", - name = "Unwatered plant", - description = "Color of unwatered plant timer" - ) - default Color getColorUnwatered() - { - return new Color(255, 187, 0); - } - - @ConfigItem( - position = 2, - keyName = "hexColorWatered", - name = "Watered plant", - description = "Color of watered plant timer" - ) - default Color getColorWatered() - { - return new Color(0, 153, 255); - } - - @ConfigItem( - position = 3, - keyName = "hexColorGrown", - name = "Grown plant", - description = "Color of grown plant timer" - ) - default Color getColorGrown() - { - return new Color(0, 217, 0); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tmorph/Parse.java b/runelite-client/src/main/java/net/runelite/client/plugins/tmorph/Parse.java deleted file mode 100644 index fa4ba34ec8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tmorph/Parse.java +++ /dev/null @@ -1,47 +0,0 @@ -package net.runelite.client.plugins.tmorph; - -import java.util.Arrays; -import java.util.Map; -import javax.inject.Singleton; - -@Singleton -public class Parse -{ - public static boolean parse(String value) - { - try - { - final StringBuilder sb = new StringBuilder(); - - for (String str : value.split("\n")) - { - if (!str.startsWith("//")) - { - sb.append(str).append("\n"); - } - } - final Map tmp = TMorph.getNEWLINE_SPLITTER().withKeyValueSeparator(':').split(sb); - - for (Map.Entry entry : tmp.entrySet()) - { - if (!TMorph.getKit().containsKey(entry.getValue())) - { - return false; - } - - final int[] ints = Arrays.stream(entry.getKey().split(",")).map(String::trim).mapToInt(Integer::parseInt).toArray(); - - if (ints.length <= 1) - { - return false; - } - } - - return true; - } - catch (Exception ex) - { - return false; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tmorph/TMorph.java b/runelite-client/src/main/java/net/runelite/client/plugins/tmorph/TMorph.java deleted file mode 100644 index eaeb8d7e00..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tmorph/TMorph.java +++ /dev/null @@ -1,374 +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.tmorph; - -import com.google.common.base.Splitter; -import com.google.common.collect.ImmutableMap; -import com.google.inject.Provides; -import java.awt.Color; -import java.awt.image.BufferedImage; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.Actor; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.Player; -import net.runelite.api.events.AnimationChanged; -import net.runelite.api.events.CommandExecuted; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.SpotAnimationChanged; -import net.runelite.api.kit.KitType; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.tmorph.ui.TPanel; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.util.Clipboard; -import net.runelite.client.util.ColorUtil; -import net.runelite.client.util.ImageUtil; -import org.apache.commons.lang3.ObjectUtils; - -@PluginDescriptor( - name = "TMorph", - description = "Want to wear a infernal cape? well now you can!", - tags = {"transform", "model", "item", "morph"}, - type = PluginType.UTILITY, - enabledByDefault = false -) -@Singleton -public class TMorph extends Plugin -{ - @Getter(AccessLevel.PACKAGE) - private static final Map kit; - - static - { - final ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (KitType kit : KitType.values()) - { - builder.put(kit.getName(), kit); - } - - kit = builder.build(); - } - - @Getter(AccessLevel.PUBLIC) - private static final Splitter NEWLINE_SPLITTER = Splitter - .on("\n") - .omitEmptyStrings() - .trimResults(); - - @Inject - private Client client; - - @Inject - private TMorphConfig config; - - @Inject - private EventBus eventBus; - - @Inject - private ClientToolbar clientToolbar; - - @Inject - private ClientThread clientThread; - - private TPanel panel; - private NavigationButton navButton; - private int animation; - private int globalAnimSwap; - private int globalGraphicSwap; - private int graphic; - private int targetAnimation; - private int targetGraphic; - @Setter - private Map panelMorph = new HashMap<>(); - private Map set1; - private Map set2; - private Map set3; - - @Provides - TMorphConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(TMorphConfig.class); - } - - @Override - protected void startUp() - { - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "nav.png"); - - panel = injector.getInstance(TPanel.class); - - navButton = NavigationButton.builder() - .tooltip("TMorph") - .icon(icon) - .priority(100) - .panel(panel) - .build(); - - clientToolbar.addNavigation(navButton); - - updateConfig(); - } - - @Override - protected void shutDown() - { - eventBus.unregister(this); - } - - @Subscribe - public void onCommandExecuted(CommandExecuted event) - { - final String[] args = event.getArguments(); - - if (event.getCommand().equals("tmorph")) - { - try - { - if (args[0].equals("copy")) - { - final StringBuilder sb = new StringBuilder(); - final Player player = client.getLocalPlayer(); - - if (player == null - || player.getPlayerAppearance() == null - || client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN) != null - || client.getViewportWidget() == null) - { - return; - } - - for (KitType kitType : KitType.values()) - { - if (kitType.equals(KitType.RING) || kitType.equals(KitType.AMMUNITION)) - { - continue; - } - - final int id = player.getPlayerAppearance().getEquipmentId(kitType); - - if (id == -1) - { - continue; - } - - sb.append(id); - sb.append(",-1"); - sb.append(":"); - sb.append(kitType.getName()); - sb.append("\n"); - } - client.addChatMessage( - ChatMessageType.GAMEMESSAGE, - "TMorph", - ColorUtil.prependColorTag("Your current gear has been copied to your clipboard", Color.RED), - null - ); - Clipboard.store(sb.toString()); - } - else - { - client.addChatMessage( - ChatMessageType.GAMEMESSAGE, - "TMorph", - ColorUtil.prependColorTag("Invalid syntax, do ::tmorph copy", Color.RED), - null - ); - } - } - catch (Exception e) - { - client.addChatMessage( - ChatMessageType.GAMEMESSAGE, - "TMorph", - ColorUtil.prependColorTag("Invalid syntax, do ::tmorph copy", Color.RED), - null - ); - } - } - } - - @Subscribe - public void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGIN_SCREEN) - { - clientThread.invokeLater(() -> panel.populateSlots()); - } - } - - @Subscribe - public void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals("TMorph")) - { - updateConfig(); - } - } - - @Subscribe - public void onSpotAnimationChanged(SpotAnimationChanged event) - { - final Actor actor = event.getActor(); - - if (actor.getSpotAnimation() == -1) - { - return; - } - - if (this.graphic <= 0 && this.targetGraphic <= 0 && this.globalGraphicSwap > 0) - { - actor.setSpotAnimation(this.globalGraphicSwap); - } - if (this.graphic > 0 && this.targetGraphic > 0) - { - if (actor.getSpotAnimation() == this.targetGraphic) - { - actor.setSpotAnimation(this.graphic); - } - } - } - - @Subscribe - public void onAnimationChanged(AnimationChanged event) - { - final Actor actor = event.getActor(); - - if (actor.getAnimation() == -1) - { - return; - } - - if (this.targetAnimation <= 0 && this.animation <= 0 && this.globalAnimSwap > 0) - { - actor.setAnimation(this.globalAnimSwap); - } - if (this.targetAnimation > 0 && this.animation > 0) - { - if (actor.getAnimation() == this.targetAnimation) - { - actor.setAnimation(this.animation); - } - } - } - - @Subscribe - public void onGameTick(GameTick event) - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - final Player player = client.getLocalPlayer(); - - if (player == null - || player.getPlayerAppearance() == null - || client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN) != null - || client.getViewportWidget() == null) - { - return; - } - - updateGear(panelMorph, player); - updateGear(set1, player); - updateGear(set2, player); - updateGear(set3, player); - } - - public void updateGear(Map map, Player player) - { - if (map == null || map.isEmpty() || player.getPlayerAppearance() == null) - { - return; - } - - for (Map.Entry entry : map.entrySet()) - { - if (!kit.containsKey(entry.getValue())) - { - continue; - } - - final KitType slot = kit.get(entry.getValue()); - int[] ints; - - try - { - ints = Arrays.stream(entry.getKey().split(",")).map(String::trim).mapToInt(Integer::parseInt).toArray(); - } - catch (NumberFormatException ex) - { - ints = null; - } - - if (ints == null || ints.length <= 1) - { - continue; - } - - final int item = ObjectUtils.defaultIfNull(player.getPlayerAppearance().getEquipmentId(slot), 0); - - if (item == ints[0]) - { - if (ints[1] == -1) - { - continue; - } - player.getPlayerAppearance().getEquipmentIds()[slot.getIndex()] = ints[1] + 512; - } - } - } - - private void updateConfig() - { - this.set1 = NEWLINE_SPLITTER.withKeyValueSeparator(':').split(config.set1()); - this.set2 = NEWLINE_SPLITTER.withKeyValueSeparator(':').split(config.set2()); - this.set3 = NEWLINE_SPLITTER.withKeyValueSeparator(':').split(config.set3()); - this.animation = config.animationSwap(); - this.globalAnimSwap = config.globalAnimSwap(); - this.globalGraphicSwap = config.globalGraphicSwap(); - this.graphic = config.graphicSwap(); - this.targetAnimation = config.animationTarget(); - this.targetGraphic = config.graphicTarget(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tmorph/TMorphConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/tmorph/TMorphConfig.java deleted file mode 100644 index 404fadf453..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tmorph/TMorphConfig.java +++ /dev/null @@ -1,220 +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.tmorph; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.ConfigSection; -import net.runelite.client.config.ConfigTitleSection; -import net.runelite.client.config.Title; - -@ConfigGroup("TMorph") -public interface TMorphConfig extends Config -{ - @ConfigTitleSection( - keyName = "swaps", - name = "Morphers", - description = "", - position = 1 - ) - default Title swaps() - { - return new Title(); - } - - @ConfigItem( - keyName = "mageSwap", - name = "Swap Set 1", - description = "

Proper Format is id,id:Slot" + - "
For example: 6570,21295:Cape" + - "
Valid Slots: Helmet, Cape, Amulet, Weapon, Torso, Shield, Legs, Head, Hands, Boots, Jaw, Ring, Ammo
", - titleSection = "swaps", - position = 1, - parse = true, - clazz = Parse.class, - method = "parse" - ) - default String set1() - { - return ""; - } - - @ConfigItem( - keyName = "rangeSwap", - name = "Swap Set 2", - description = "
Proper Format is id,id:Slot" + - "
For example: 6570,21295:Cape" + - "
Valid Slots: Helmet, Cape, Amulet, Weapon, Torso, Shield, Legs, Head, Hands, Boots, Jaw, Ring, Ammo
", - titleSection = "swaps", - position = 2, - parse = true, - clazz = Parse.class, - method = "parse" - ) - default String set2() - { - return ""; - } - - @ConfigItem( - keyName = "meleeSwap", - name = "Swap Set 3", - description = "
Proper Format is id,id:Slot" + - "
For example: 6570,21295:Cape" + - "
Valid Slots: Helmet, Cape, Amulet, Weapon, Torso, Shield, Legs, Head, Hands, Boots, Jaw, Ring, Ammo
", - titleSection = "swaps", - position = 3, - parse = true, - clazz = Parse.class, - method = "parse" - ) - default String set3() - { - return ""; - } - - //////////////////Experimental Functions - - @ConfigSection( - position = 4, - keyName = "experimentalSection", - name = "Experimental Functions", - description = "" - ) - default boolean experimentalSection() - { - return false; - } - - @ConfigItem( - keyName = "experimentalFunctions", - name = "Experimental Functions", - description = "May bug out in unintended ways.", - section = "experimentalSection", - position = 0 - ) - default boolean experimentalFunctions() - { - return false; - } - - @ConfigItem( - keyName = "globalAnimSwap", - name = "Global Animation Swap", - description = "DO NOT USE WITH ANIMATION SWAP BELOW", - section = "experimentalSection", - hidden = true, - unhide = "experimentalFunctions", - position = 1 - ) - default int globalAnimSwap() - { - return 0; - } - - @ConfigItem( - keyName = "animationSwap", - name = "Animation Swap", - description = "ID", - section = "experimentalSection", - hidden = true, - unhide = "experimentalFunctions", - position = 2 - ) - default int animationSwap() - { - return 0; - } - - @ConfigItem( - keyName = "animationTarget", - name = "Animation Target", - description = "ID", - section = "experimentalSection", - hidden = true, - unhide = "experimentalFunctions", - position = 3 - ) - default int animationTarget() - { - return 0; - } - - @ConfigItem( - keyName = "globalGraphicSwap", - name = "Global Graphic Swap", - description = "DO NOT USE WITH GRAPHIC SWAP BELOW", - section = "experimentalSection", - hidden = true, - unhide = "experimentalFunctions", - position = 4 - ) - default int globalGraphicSwap() - { - return 0; - } - - @ConfigItem( - keyName = "graphicSwap", - name = "Graphic Swap", - description = "ID", - section = "experimentalSection", - hidden = true, - unhide = "experimentalFunctions", - position = 5 - ) - default int graphicSwap() - { - return 0; - } - - @ConfigItem( - keyName = "graphicTarget", - name = "Graphic Target", - description = "ID", - section = "experimentalSection", - hidden = true, - unhide = "experimentalFunctions", - position = 6 - ) - default int graphicTarget() - { - return 0; - } - - @ConfigTitleSection( - keyName = "copy", - name = "
If you would like to copy your equipped" + - "
gear, type \"::tmorph copy\" in chat." + - "
This will copy your gear to your" + - "
clipboard for easy copy paste.
", - description = "", - position = 50 - ) - default Title copy() - { - return new Title(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tmorph/TmorphSet.java b/runelite-client/src/main/java/net/runelite/client/plugins/tmorph/TmorphSet.java deleted file mode 100644 index d4514c336b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tmorph/TmorphSet.java +++ /dev/null @@ -1,41 +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.tmorph; - -import lombok.Data; - -@Data -public class TmorphSet -{ - private String name; - private int helmet; - private int cape; - private int amulet; - private int weapon; - private int torso; - private int shield; - private int legs; - private int hands; - private int boots; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tmorph/ui/EquipSlot.java b/runelite-client/src/main/java/net/runelite/client/plugins/tmorph/ui/EquipSlot.java deleted file mode 100644 index 3793a2270e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tmorph/ui/EquipSlot.java +++ /dev/null @@ -1,123 +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.tmorph.ui; - -import java.awt.Component; -import java.awt.Dimension; -import java.util.LinkedHashMap; -import java.util.Map; -import javax.swing.ImageIcon; -import javax.swing.JComboBox; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.kit.KitType; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.tmorph.TMorph; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.components.ComboBoxIconEntry; -import net.runelite.client.ui.components.ComboBoxListRenderer; -import net.runelite.client.util.AsyncBufferedImage; -import net.runelite.client.util.ImageUtil; -import net.runelite.http.api.item.ItemEquipmentStats; -import net.runelite.http.api.item.ItemStats; -import org.pushingpixels.substance.internal.utils.SubstanceDropDownButton; - -@Getter -public class EquipSlot extends JComboBox -{ - private final ComboBoxIconEntry original; - private Map boxMap; - private KitType kitType; - - EquipSlot(KitType kitType) - { - super(); - this.kitType = kitType; - this.boxMap = new LinkedHashMap<>(); - setPreferredSize(new Dimension(200, 42)); - setBackground(ColorScheme.DARK_GRAY_COLOR); - setRenderer(new ComboBoxListRenderer()); - original = new ComboBoxIconEntry( - new ImageIcon(ImageUtil.getResourceStreamFromClass(TMorph.class, kitType.getName().toLowerCase() + ".png")), - kitType.getName(), - null - ); - addItem(original); - setSelectedIndex(0); - for (Component component : getComponents()) - { - if (component instanceof SubstanceDropDownButton) - { - remove(component); - } - } - } - - public void populate(Client client, ItemManager itemManager) - { - assert client.isClientThread() : "Populate must be called on client thread"; - - for (int i = 0; i < client.getItemCount(); i++) - { - ItemStats stats = itemManager.getItemStats(i, false); - - if (stats == null) - { - continue; - } - - if (!stats.isEquipable()) - { - continue; - } - - ItemEquipmentStats equipment = stats.getEquipment(); - - if (equipment == null) - { - continue; - } - - if (equipment.getSlot() != kitType.getIndex()) - { - continue; - } - - AsyncBufferedImage image = itemManager.getImage(i); - - if (image == null) - { - continue; - } - - final ComboBoxIconEntry entry = new ComboBoxIconEntry( - new ImageIcon(image), - client.getItemDefinition(i).getName(), - client.getItemDefinition(i) - ); - boxMap.put(i, entry); - addItem(entry); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tmorph/ui/TPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/tmorph/ui/TPanel.java deleted file mode 100644 index 3331a9257d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tmorph/ui/TPanel.java +++ /dev/null @@ -1,453 +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.tmorph.ui; - -import com.google.common.collect.ImmutableSet; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.awt.event.ItemEvent; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import javax.inject.Inject; -import javax.swing.Box; -import javax.swing.BoxLayout; -import static javax.swing.BoxLayout.Y_AXIS; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.border.EmptyBorder; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.ItemDefinition; -import net.runelite.api.Player; -import net.runelite.api.kit.KitType; -import static net.runelite.api.kit.KitType.AMULET; -import static net.runelite.api.kit.KitType.BOOTS; -import static net.runelite.api.kit.KitType.CAPE; -import static net.runelite.api.kit.KitType.HANDS; -import static net.runelite.api.kit.KitType.HELMET; -import static net.runelite.api.kit.KitType.LEGS; -import static net.runelite.api.kit.KitType.SHIELD; -import static net.runelite.api.kit.KitType.TORSO; -import static net.runelite.api.kit.KitType.WEAPON; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.Notifier; -import net.runelite.client.database.DatabaseManager; -import static net.runelite.client.database.data.Tables.TMORPH_SETS; -import net.runelite.client.database.data.tables.records.TmorphSetsRecord; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.tmorph.TMorph; -import net.runelite.client.plugins.tmorph.TmorphSet; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.ui.components.ComboBoxIconEntry; -import net.runelite.client.util.Clipboard; -import org.jooq.Record; -import org.jooq.Result; -import org.jooq.TableField; -import org.jooq.impl.SQLDataType; - -@Slf4j -public class TPanel extends PluginPanel -{ - private static final Set BLACKLIST = ImmutableSet.of(KitType.AMMUNITION, KitType.RING, KitType.HEAD, KitType.JAW); - - private final Client client; - private final DatabaseManager databaseManager; - private final ItemManager itemManager; - private final TMorph plugin; - private final Notifier notifier; - - private final JComboBox selector; - private final Map equipSlots; - private final Map kitToId; - private final Map setMap; - private final ExecutorService executor; - private JPanel equipPanel; - - @Inject - public TPanel( - final Client client, - final DatabaseManager databaseManager, - final ItemManager itemManager, - final TMorph plugin, - final Notifier notifier - ) - { - super(false); - this.client = client; - this.databaseManager = databaseManager; - this.itemManager = itemManager; - this.plugin = plugin; - this.notifier = notifier; - this.equipSlots = new LinkedHashMap<>(); - this.kitToId = new HashMap<>(); - this.setMap = new HashMap<>(); - this.selector = new JComboBox<>(); - this.executor = Executors.newSingleThreadExecutor(); - init(); - } - - private void init() - { - selector.addItem("Populating fields..."); - selector.setSelectedIndex(0); - selector.addActionListener((e) -> - { - String name = (String) selector.getSelectedItem(); - Result recs = databaseManager.getDsl() - .selectFrom(TMORPH_SETS) - .where(TMORPH_SETS.SET_NAME.eq(name)) - .fetch(); - - for (TmorphSetsRecord rec : recs) - { - for (Map.Entry entry : equipSlots.entrySet()) - { - int id = rec.getValue(kitToField(entry.getKey())); - EquipSlot es = entry.getValue(); - es.setSelectedItem(es.getBoxMap().getOrDefault(id, es.getOriginal())); - } - } - }); - - final JLabel title = new JLabel(); - title.setText("Tmorph Sets"); - title.setForeground(Color.WHITE); - title.setHorizontalAlignment(JLabel.CENTER); - title.setVerticalAlignment(JLabel.CENTER); - - final JPanel titleAndMarkersPanel = new JPanel(); - titleAndMarkersPanel.setLayout(new BorderLayout()); - titleAndMarkersPanel.add(title, BorderLayout.CENTER); - - final JPanel northAnchoredPanel = new JPanel(); - northAnchoredPanel.setLayout(new BoxLayout(northAnchoredPanel, Y_AXIS)); - northAnchoredPanel.setBorder(new EmptyBorder(0, 0, 10, 0)); - northAnchoredPanel.add(titleAndMarkersPanel); - northAnchoredPanel.add(Box.createRigidArea(new Dimension(0, 10))); - northAnchoredPanel.add(selector); - - final JPanel containerHolder = new JPanel(); - final JPanel containerPanel = new JPanel(); - - final JLabel caption = new JLabel(); - caption.setText("Morph Selector"); - caption.setForeground(Color.WHITE); - caption.setHorizontalAlignment(JLabel.CENTER); - caption.setVerticalAlignment(JLabel.CENTER); - - final JPanel captionPanel = new JPanel(); - captionPanel.add(caption); - - equipPanel = new JPanel(); - equipPanel.setLayout(new GridLayout(11, 1, 1, 1)); - addSlots(); - - containerPanel.setLayout(new BorderLayout()); - containerPanel.add(captionPanel, BorderLayout.NORTH); - containerPanel.add(equipPanel, BorderLayout.CENTER); - - containerHolder.add(containerPanel); - - final JPanel contentPanel = new JPanel(); - final BoxLayout contentLayout = new BoxLayout(contentPanel, Y_AXIS); - contentPanel.setLayout(contentLayout); - contentPanel.add(containerHolder); - - final JPanel contentWrapper = new JPanel(new BorderLayout()); - contentWrapper.add(Box.createGlue(), BorderLayout.CENTER); - contentWrapper.add(contentPanel, BorderLayout.NORTH); - final JScrollPane contentWrapperPane = new JScrollPane(contentWrapper); - contentWrapperPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - - setLayout(new BorderLayout()); - setBorder(new EmptyBorder(10, 10, 10, 10)); - add(northAnchoredPanel, BorderLayout.NORTH); - add(contentWrapperPane, BorderLayout.CENTER); - executor.submit(this::populateSelector); - } - - private void populateSelector() - { - if (!databaseManager.checkTableExists("TMORPH_SETS")) - { - databaseManager.getDsl().createTable(TMORPH_SETS) - .column(TMORPH_SETS.SET_NAME, SQLDataType.VARCHAR(255).nullable(false)) - .column(TMORPH_SETS.HELMET, SQLDataType.INTEGER.nullable(false)) - .column(TMORPH_SETS.CAPE, SQLDataType.INTEGER.nullable(false)) - .column(TMORPH_SETS.AMULET, SQLDataType.INTEGER.nullable(false)) - .column(TMORPH_SETS.WEAPON, SQLDataType.INTEGER.nullable(false)) - .column(TMORPH_SETS.TORSO, SQLDataType.INTEGER.nullable(false)) - .column(TMORPH_SETS.SHIELD, SQLDataType.INTEGER.nullable(false)) - .column(TMORPH_SETS.LEGS, SQLDataType.INTEGER.nullable(false)) - .column(TMORPH_SETS.HANDS, SQLDataType.INTEGER.nullable(false)) - .column(TMORPH_SETS.BOOTS, SQLDataType.INTEGER.nullable(false)) - .execute(); - } - - Result recs = databaseManager.getDsl().selectFrom(TMORPH_SETS).fetch(); - setMap.clear(); - selector.removeAllItems(); - selector.addItem("Select your set..."); - selector.setSelectedIndex(0); - - for (Record record : recs) - { - TmorphSet tmo = new TmorphSet(); - String name = record.getValue(TMORPH_SETS.SET_NAME); - tmo.setName(name); - tmo.setHelmet(record.getValue(TMORPH_SETS.HELMET)); - tmo.setCape(record.getValue(TMORPH_SETS.CAPE)); - tmo.setAmulet(record.getValue(TMORPH_SETS.AMULET)); - tmo.setWeapon(record.getValue(TMORPH_SETS.WEAPON)); - tmo.setTorso(record.getValue(TMORPH_SETS.TORSO)); - tmo.setShield(record.getValue(TMORPH_SETS.SHIELD)); - tmo.setLegs(record.getValue(TMORPH_SETS.LEGS)); - tmo.setHands(record.getValue(TMORPH_SETS.HANDS)); - tmo.setBoots(record.getValue(TMORPH_SETS.BOOTS)); - setMap.put(name, tmo); - selector.addItem(name); - } - } - - private void addSlots() - { - int i = 0; - - for (KitType kitType : KitType.values()) - { - if (BLACKLIST.contains(kitType)) - { - continue; - } - - final EquipSlot equip = new EquipSlot(kitType); - - equip.addItemListener((e) -> - { - if (e.getStateChange() == ItemEvent.SELECTED) - { - ComboBoxIconEntry combo = (ComboBoxIconEntry) e.getItem(); - - if (combo.getData() == null) - { - return; - } - - ItemDefinition def = (ItemDefinition) combo.getData(); - KitType type = null; - - for (Map.Entry entry : equipSlots.entrySet()) - { - if (entry.getValue() == e.getSource()) - { - type = entry.getKey(); - break; - } - } - - if (type == null) - { - return; - } - - if (kitToId.containsKey(type)) - { - kitToId.replace(type, def.getId()); - } - else - { - kitToId.put(type, def.getId()); - } - - if (client.getGameState() == GameState.LOGGED_IN) - { - generate(false); - } - } - }); - - equipSlots.put(kitType, equip); - equipPanel.add(equip); - i++; - } - - final JButton setButton = new JButton("Set/Copy Active Morph"); - setButton.addActionListener((e) -> plugin.setPanelMorph(generate(true))); - equipPanel.add(setButton); - - final JButton saveButton = new JButton("Save Active Morph"); - saveButton.addActionListener((e) -> - { - final String s = JOptionPane.showInputDialog(saveButton, "What would you like to name the set?"); - - if (s == null || s.isEmpty()) - { - return; - } - - Result records = databaseManager.getDsl() - .selectFrom(TMORPH_SETS) - .where(TMORPH_SETS.SET_NAME.eq(s)) - .fetch(); - - boolean exists = records.isNotEmpty(); - - if (!exists) - { - databaseManager.getDsl().insertInto(TMORPH_SETS) - .set(TMORPH_SETS.SET_NAME, s) - .set(TMORPH_SETS.HELMET, kitToId.getOrDefault(HELMET, -1)) - .set(TMORPH_SETS.CAPE, kitToId.getOrDefault(CAPE, -1)) - .set(TMORPH_SETS.AMULET, kitToId.getOrDefault(AMULET, -1)) - .set(TMORPH_SETS.WEAPON, kitToId.getOrDefault(WEAPON, -1)) - .set(TMORPH_SETS.TORSO, kitToId.getOrDefault(TORSO, -1)) - .set(TMORPH_SETS.SHIELD, kitToId.getOrDefault(SHIELD, -1)) - .set(TMORPH_SETS.LEGS, kitToId.getOrDefault(LEGS, -1)) - .set(TMORPH_SETS.HANDS, kitToId.getOrDefault(HANDS, -1)) - .set(TMORPH_SETS.BOOTS, kitToId.getOrDefault(BOOTS, -1)) - .execute(); - executor.submit(this::populateSelector); - } - else - { - databaseManager.getDsl().update(TMORPH_SETS) - .set(TMORPH_SETS.HELMET, kitToId.getOrDefault(HELMET, -1)) - .set(TMORPH_SETS.CAPE, kitToId.getOrDefault(CAPE, -1)) - .set(TMORPH_SETS.AMULET, kitToId.getOrDefault(AMULET, -1)) - .set(TMORPH_SETS.WEAPON, kitToId.getOrDefault(WEAPON, -1)) - .set(TMORPH_SETS.TORSO, kitToId.getOrDefault(TORSO, -1)) - .set(TMORPH_SETS.SHIELD, kitToId.getOrDefault(SHIELD, -1)) - .set(TMORPH_SETS.LEGS, kitToId.getOrDefault(LEGS, -1)) - .set(TMORPH_SETS.HANDS, kitToId.getOrDefault(HANDS, -1)) - .set(TMORPH_SETS.BOOTS, kitToId.getOrDefault(BOOTS, -1)) - .where(TMORPH_SETS.SET_NAME.eq(s)) - .execute(); - } - }); - equipPanel.add(saveButton); - } - - public void populateSlots() - { - for (EquipSlot slot : equipSlots.values()) - { - slot.populate(client, itemManager); - } - } - - public Map generate(boolean copy) - { - final StringBuilder sb = new StringBuilder(); - final Player player = client.getLocalPlayer(); - - if (player == null - || player.getPlayerAppearance() == null - || client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN) != null - || client.getViewportWidget() == null) - { - return new HashMap<>(); - } - - for (KitType kitType : KitType.values()) - { - if (BLACKLIST.contains(kitType)) - { - continue; - } - - final Widget widget = client.getWidget(kitType.getWidgetInfo()); - - if (widget == null || widget.getDynamicChildren() == null || widget.getDynamicChildren().length < 1) - { - continue; - } - - final int id = itemManager.canonicalize(widget.getDynamicChildren()[1].getItemId()); - final int kitId = kitToId.getOrDefault(kitType, -1); - - if (kitId == -1) - { - continue; - } - - sb.append(id); - sb.append(","); - sb.append(kitId); - sb.append(":"); - sb.append(kitType.getName()); - sb.append("\n"); - } - - final String s = sb.toString(); - - if (copy) - { - Clipboard.store(s); - notifier.notify("Saved to clipboard."); - } - - return plugin.getNEWLINE_SPLITTER() - .withKeyValueSeparator(":") - .split(s); - } - - private TableField kitToField(KitType kitType) - { - switch (kitType) - { - case HELMET: - return TMORPH_SETS.HELMET; - case CAPE: - return TMORPH_SETS.CAPE; - case AMULET: - return TMORPH_SETS.AMULET; - case WEAPON: - return TMORPH_SETS.WEAPON; - case TORSO: - return TMORPH_SETS.TORSO; - case SHIELD: - return TMORPH_SETS.SHIELD; - case LEGS: - return TMORPH_SETS.LEGS; - case HANDS: - return TMORPH_SETS.HANDS; - case BOOTS: - return TMORPH_SETS.BOOTS; - default: - return null; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tobdamagecount/DamageCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/tobdamagecount/DamageCounterPlugin.java deleted file mode 100644 index 311ac7fc5e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tobdamagecount/DamageCounterPlugin.java +++ /dev/null @@ -1,386 +0,0 @@ -/* - * Copyright (c) 2018, Bryan Chau(RSN:Laura Brehm) - * 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.tobdamagecount; - -import java.text.DecimalFormat; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Actor; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.Player; -import net.runelite.api.Skill; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.HitsplatApplied; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.PlayerDeath; -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.eventbus.Subscribe; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "ToB Damage Counter", - description = "Gives you an estimation damage on a boss and taken after the fight is done" + - "the damage will be posted in the chat", - tags = {"combat", "npcs", "tob", "damage"}, - type = PluginType.PVM, - enabledByDefault = false -) -@Singleton -public class DamageCounterPlugin extends Plugin -{ - //formatting the number for damage taken and dealt with to look beeter - private static final DecimalFormat DAMAGEFORMAT = new DecimalFormat("#,###"); - private static final double XP_RATIO = 1.3333; - private static final double BOSS_MODIFIER = 1.05; - private static final int MAIDENHP = 3500; - private static final int BLOATHP = 2000; - private static final int NYLOHP = 2500; - private static final int SOTHP = 4000; - private static final int XARPUSHP = 5080; - private static final int VERZIKHP = 8500; - private static final boolean ALIVE = true; // - private static final boolean DEAD = false; //if they're dead they cannot "recreate" the message of being alive - //locations at ToB - private static final int MAIDEN_REGION = 12613; - private static final int MAIDEN_REGION_1 = 12869; - private static final int BLOAT_REGION = 13125; - private static final int NYLOCAS_REGION = 13122; - private static final int SOTETSEG_REGION = 13123; - private static final int SOTETSEG_REGION2 = 13379; - private static final int XARPUS_REGION = 12612; - private static final int VERZIK_REGION = 12611; - private static final int[] ToB_Region = {MAIDEN_REGION, MAIDEN_REGION_1, BLOAT_REGION, NYLOCAS_REGION, - SOTETSEG_REGION, SOTETSEG_REGION2, XARPUS_REGION, VERZIK_REGION}; - //setting up the array for a check list - private static final int[] NPCARRAY = {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, NpcID.PESTILENT_BLOAT, NpcID.NYLOCAS_VASILIAS, - NpcID.NYLOCAS_VASILIAS_8355, NpcID.NYLOCAS_VASILIAS_8356, NpcID.NYLOCAS_VASILIAS_8357, NpcID.SOTETSEG, - NpcID.SOTETSEG_8388, NpcID.XARPUS, NpcID.XARPUS_8339, NpcID.XARPUS_8340, NpcID.XARPUS_8341, - NpcID.VERZIK_VITUR, NpcID.VERZIK_VITUR_8369, NpcID.VERZIK_VITUR_8370, NpcID.VERZIK_VITUR_8371, - NpcID.VERZIK_VITUR_8372, NpcID.VERZIK_VITUR_8373, NpcID.VERZIK_VITUR_8374, NpcID.VERZIK_VITUR_8375}; - private int currentWorld = -1; - private int DamageCount = 0; - private int currenthpxp = -1; // checking the current hp xp so be easier to find - private String BossName = null; //to ID the boss to calculate the damage - private int DamageTaken = 0; - private boolean status = true; //default boolean alive = true, dead = false - - @Inject - private Client client; - - @Inject - private ChatMessageManager chatMessangerManager; - - //every game tick it will go through methods - @Subscribe - private void onGameTick(GameTick tick) - { - if (client.getGameState() != GameState.LOGGED_IN) - { - ResetCounter(); - return; - } - checkInterAction(); - DamageCounting(); - currenthpxp = client.getSkillExperience(Skill.HITPOINTS); - } - - //checks for npcID and put the boss name into a string be easier to ID it - //once the boss is found it will never check it - private void checkInterAction() - { - Player localPlayer = client.getLocalPlayer(); - Actor interacting = localPlayer.getInteracting(); - if (client.getGameState() == GameState.LOGGED_IN && BossName == null && interacting instanceof NPC) - { - int interactingId = ((NPC) interacting).getId(); - String interactingName = interacting.getName(); - for (int aNPCARRAY : NPCARRAY) - { - if (aNPCARRAY == interactingId) - { - BossName = interactingName; - break; - } - } - } - } - - //if you hop it will reset the counter - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGGED_IN) - { - if (currentWorld == -1) - { - currentWorld = client.getWorld(); - } - else if (currentWorld != client.getWorld()) - { - currentWorld = client.getWorld(); - ResetCounter(); - } - } - } - - //grabbing the xp and calculating the damage - private int XPtoDamage() - { - int NewXp; - double damageOutput = 0; - int XPdrop; - if (currenthpxp != -1) - { - XPdrop = client.getSkillExperience(Skill.HITPOINTS); - NewXp = XPdrop - currenthpxp; - currenthpxp = -1; - damageOutput = NewXp / XP_RATIO; - } - //returns the damage you have done - return (int) Math.floor(damageOutput); - } - - //adding up the damage for the print message checks every tick(aka attack tick) - private void DamageCounting() - { - if (client.getLocalPlayer() == null) - { - return; - } - - Player localPlayer = client.getLocalPlayer(); - Actor interacting = localPlayer.getInteracting(); - - if (interacting == null || interacting.getName() == null) - { - return; - } - - if (client.getGameState() == GameState.LOGGED_IN && interacting instanceof NPC) - { - String interactingName = interacting.getName(); - if (interactingName.equals(BossName)) - { - DamageCount += (XPtoDamage() * BOSS_MODIFIER); - - } - } - - } - - - //will add the damage that you have taken from the current boss fight - @Subscribe - private void onHitsplatApplied(HitsplatApplied Hit) - { - if (Hit.getActor().equals(client.getLocalPlayer())) - { - DamageTaken += Hit.getHitsplat().getAmount(); - } - - } - - //will check for the monster if it died works only on ToB Bosses - /*Verzik has three phases so the program will add up all the damage and prints it into one message - because every time she phases she "dies" so making sure the counter doesn't print out the damage for phase 1, 2, - and 3. - */ - @Subscribe - private void onNpcDespawned(NpcDespawned npc) - { - NPC actor = npc.getNpc(); - if (client.getLocalPlayer() == null || actor.getName() == null) - { - return; - } - - final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, client.getLocalPlayer().getLocalLocation()); - final int playerRegionID = worldPoint == null ? 0 : worldPoint.getRegionID(); - - if (playerRegionID == 0) - { - return; - } - - double Percent = calculatePercent(playerRegionID); - if (actor.isDead() && actor.getId() == NpcID.VERZIK_VITUR_8375 && status) - { - DamagePrint(actor, Percent); - ResetCounter(); - } - else if (actor.isDead() && actor.getName().equals(BossName) && actor.getId() != NpcID.VERZIK_VITUR_8374 && - actor.getId() != NpcID.VERZIK_VITUR_8372 && actor.getId() != NpcID.VERZIK_VITUR_8370 && - status) - { - DamagePrint(actor, Percent); - ResetCounter(); - } - //will reset the counter after the boss dies and if you died during the fight - else if (actor.isDead() && actor.getName().equals(BossName) && !status) - { - ResetCounter(); - } - } - - private double calculatePercent(int id) - { - double percent = 0; - if (DamageCount != 0) - { - if (id == MAIDEN_REGION || id == MAIDEN_REGION_1) - { - percent = (DamageCount / (double) MAIDENHP) * 100; - } - else if (id == BLOAT_REGION) - { - percent = (DamageCount / (double) BLOATHP) * 100; - } - else if (id == NYLOCAS_REGION) - { - percent = (DamageCount / (double) NYLOHP) * 100; - } - else if (id == SOTETSEG_REGION || id == SOTETSEG_REGION2) - { - percent = (DamageCount / (double) SOTHP) * 100; - } - else if (id == XARPUS_REGION) - { - percent = (DamageCount / (double) XARPUSHP) * 100; - } - else if (id == VERZIK_REGION) - { - percent = (DamageCount / (double) VERZIKHP) * 100; - } - } - return percent; - } - - //just reset the counter for the next fight and status - private void ResetCounter() - { - DamageCount = 0; - DamageTaken = 0; - BossName = null; - status = ALIVE; - } - - //print out the damage after the boss have died - //prevent people from spectating to get the damage message, it is impossible for them to get damage - private void DamagePrint(NPC actor, double percent) - { - int playerCount = getPlayers(); - String MessageDamage; - if (playerCount >= 2 && playerCount <= 5) - { - if (percent >= (2.0 / playerCount) * 100) - { - MessageDamage = "[Exceptional performance] Damage dealt to " + actor.getName() + ": " - + DAMAGEFORMAT.format(DamageCount) + " (" + String.format("%.2f", percent) + "%)"; - } - else if (percent >= (1.0 / playerCount) * 100) - { - MessageDamage = "[Above-average performance] Damage dealt to " + actor.getName() + ": " - + DAMAGEFORMAT.format(DamageCount) + " (" + String.format("%.2f", percent) + "%)"; - } - else - { - MessageDamage = "[Under performance] Damage dealt to " + actor.getName() + ": " - + DAMAGEFORMAT.format(DamageCount) + " (" + String.format("%.2f", percent) + "%)"; - } - } - else - { - MessageDamage = "Damage dealt to " + actor.getName() + ": " - + DAMAGEFORMAT.format(DamageCount) + " (" + String.format("%.2f", percent) + "%)"; - } - - sendChatMessage(MessageDamage); - String MessageTaken = "Damage taken: " + DAMAGEFORMAT.format(DamageTaken) + "."; - sendChatMessage(MessageTaken); - } - - private int getPlayers() - { - List players = client.getPlayers(); - - return players.size(); - } - - //whenever you have died in tob you will get a death message with damage - // made sure the message works at ToB area or else it will message every where - @Subscribe - private void onPlayerDeath(PlayerDeath death) - { - if (client.getLocalPlayer() == null || death.getPlayer() != client.getLocalPlayer()) - { - return; - } - - String DeathMessage = "You have died! You did " + DAMAGEFORMAT.format(DamageCount) + " damage to " + BossName + "!"; - String MessageTaken = "You have taken " + DAMAGEFORMAT.format(DamageTaken) + " damage from this fight!"; - for (int value : ToB_Region) - { - final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, client.getLocalPlayer().getLocalLocation()); - final int playerRegionID = worldPoint == null ? 0 : worldPoint.getRegionID(); - if (playerRegionID == value) - { - sendChatMessage(DeathMessage); - sendChatMessage(MessageTaken); - ResetCounter(); - //status will become "dead" after you died in the fight - status = DEAD; - } - } - } - - - private void sendChatMessage(String chatMessage) - { - final String message = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append(chatMessage) - .build(); - chatMessangerManager.queue( - QueuedMessage.builder() - .type(ChatMessageType.CONSOLE) - .runeLiteFormattedMessage(message) - .build()); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchConfig.java deleted file mode 100644 index b5da132e79..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchConfig.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2018, 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.twitch; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("twitch") -public interface TwitchConfig extends Config -{ - @ConfigItem( - keyName = "username", - name = "Username", - description = "Twitch Username", - position = 0 - ) - String username(); - - @ConfigItem( - keyName = "oauth", - name = "OAuth Token", - description = "Enter your OAuth token here. This can be found at http://www.twitchapps.com/tmi/", - secret = true, - position = 1 - ) - String oauthToken(); - - @ConfigItem( - keyName = "channel", - name = "Channel", - description = "Username of Twitch chat to join", - position = 2 - ) - String channel(); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchPlugin.java deleted file mode 100644 index 89190880b7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/twitch/TwitchPlugin.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 2018, 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.twitch; - -import com.google.common.base.Strings; -import com.google.inject.Provides; -import java.time.temporal.ChronoUnit; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -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.CommandManager; -import net.runelite.client.chat.QueuedMessage; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ChatboxInput; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.twitch.irc.TwitchIRCClient; -import net.runelite.client.plugins.twitch.irc.TwitchListener; -import net.runelite.client.task.Schedule; - -@PluginDescriptor( - name = "Twitch", - description = "Integrates Twitch chat", - enabledByDefault = false, - type = PluginType.MISCELLANEOUS -) -@Slf4j -@Singleton -public class TwitchPlugin extends Plugin implements TwitchListener -{ - @Inject - private TwitchConfig twitchConfig; - - @Inject - private Client client; - - @Inject - private ChatMessageManager chatMessageManager; - - @Inject - private CommandManager commandManager; - - private TwitchIRCClient twitchIRCClient; - - @Override - protected void startUp() - { - connect(); - } - - @Override - protected void shutDown() - { - if (twitchIRCClient != null) - { - twitchIRCClient.close(); - twitchIRCClient = null; - } - } - - @Provides - TwitchConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(TwitchConfig.class); - } - - private synchronized void connect() - { - if (twitchIRCClient != null) - { - log.debug("Terminating Twitch client {}", twitchIRCClient); - twitchIRCClient.close(); - twitchIRCClient = null; - } - - if (!Strings.isNullOrEmpty(twitchConfig.username()) - && !Strings.isNullOrEmpty(twitchConfig.oauthToken()) - && !Strings.isNullOrEmpty(twitchConfig.channel())) - { - String channel = twitchConfig.channel().toLowerCase(); - if (!channel.startsWith("#")) - { - channel = "#" + channel; - } - - log.debug("Connecting to Twitch as {}", twitchConfig.username()); - - twitchIRCClient = new TwitchIRCClient( - this, - twitchConfig.username(), - twitchConfig.oauthToken(), - channel - ); - twitchIRCClient.start(); - } - } - - @Schedule(period = 30, unit = ChronoUnit.SECONDS, asynchronous = true) - public void checkClient() - { - if (twitchIRCClient != null) - { - if (twitchIRCClient.isConnected()) - { - twitchIRCClient.pingCheck(); - } - - if (!twitchIRCClient.isConnected()) - { - log.debug("Reconnecting..."); - - connect(); - } - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged configChanged) - { - if (!configChanged.getGroup().equals("twitch")) - { - return; - } - - connect(); - } - - private void addChatMessage(String sender, String message) - { - String chatMessage = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append(message) - .build(); - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.FRIENDSCHAT) - .sender("Twitch") - .name(sender) - .runeLiteFormattedMessage(chatMessage) - .timestamp((int) (System.currentTimeMillis() / 1000)) - .build()); - } - - @Override - public void privmsg(Map tags, String message) - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - String displayName = tags.get("display-name"); - addChatMessage(displayName, message); - } - - @Override - public void roomstate(Map tags) - { - log.debug("Room state: {}", tags); - } - - @Override - public void usernotice(Map tags, String message) - { - log.debug("Usernotice tags: {} message: {}", tags, message); - - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - String sysmsg = tags.get("system-msg"); - addChatMessage("[System]", sysmsg); - } - - @Subscribe - private void onChatboxInput(ChatboxInput chatboxInput) - { - String message = chatboxInput.getValue(); - if (!message.startsWith("//")) - { - return; - } - - message = message.substring(2); - if (!message.isEmpty() && twitchIRCClient != null) - { - twitchIRCClient.privmsg(message); - addChatMessage(twitchConfig.username(), message); - } - - chatboxInput.setStop(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/twitch/irc/Message.java b/runelite-client/src/main/java/net/runelite/client/plugins/twitch/irc/Message.java deleted file mode 100644 index fb7945f17e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/twitch/irc/Message.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2018, 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.twitch.irc; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; - -@Getter(AccessLevel.PACKAGE) -class Message -{ - private final Map tags = new HashMap<>(); - private String source; - private String command; - private String[] arguments; - - public static Message parse(String in) - { - Message message = new Message(); - if (in.startsWith("@")) - { - String[] tags = in.substring(1) - .split(";"); - for (String tag : tags) - { - int eq = tag.indexOf('='); - if (eq == -1) - { - continue; - } - - String key = tag.substring(0, eq); - String value = tag.substring(eq + 1) - .replace("\\:", ";") - .replace("\\s", " ") - .replace("\\\\", "\\") - .replace("\\r", "\r") - .replace("\\n", "\n"); - - message.tags.put(key, value); - } - - int sp = in.indexOf(' '); - in = in.substring(sp + 1); - } - - if (in.startsWith(":")) - { - int sp = in.indexOf(' '); - message.source = in.substring(1, sp); - - in = in.substring(sp + 1); - } - - int sp = in.indexOf(' '); - if (sp == -1) - { - message.command = in; - message.arguments = new String[0]; - return message; - } - - message.command = in.substring(0, sp); - - String args = in.substring(sp + 1); - List argList = new ArrayList<>(); - do - { - String arg; - if (args.startsWith(":")) - { - arg = args.substring(1); - sp = -1; - } - else - { - sp = args.indexOf(' '); - arg = sp == -1 ? args : args.substring(0, sp); - } - args = args.substring(sp + 1); - argList.add(arg); - } while (sp != -1); - - message.arguments = argList.toArray(new String[0]); - return message; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/twitch/irc/TwitchIRCClient.java b/runelite-client/src/main/java/net/runelite/client/plugins/twitch/irc/TwitchIRCClient.java deleted file mode 100644 index a51a38a433..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/twitch/irc/TwitchIRCClient.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (c) 2018, 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.twitch.irc; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.net.Socket; -import javax.net.SocketFactory; -import javax.net.ssl.SSLSocketFactory; -import lombok.extern.slf4j.Slf4j; - -@Slf4j -public class TwitchIRCClient extends Thread implements AutoCloseable -{ - private static final String HOST = "irc.chat.twitch.tv"; - private static final int PORT = 6697; - private static final int READ_TIMEOUT = 60000; // ms - private static final int PING_TIMEOUT = 30000; // ms - - private final TwitchListener twitchListener; - - private final String username, password; - private final String channel; - - private Socket socket; - private BufferedReader in; - private PrintWriter out; - private long last; - private boolean pingSent; - - public TwitchIRCClient(final TwitchListener twitchListener, final String username, final String password, final String channel) - { - setName("Twitch"); - this.twitchListener = twitchListener; - this.username = username; - this.password = password; - this.channel = channel; - } - - @Override - public void close() - { - try - { - socket.close(); - } - catch (IOException ex) - { - log.warn("error closing socket", ex); - } - - in = null; - out = null; - } - - @Override - public void run() - { - try - { - SocketFactory socketFactory = SSLSocketFactory.getDefault(); - socket = socketFactory.createSocket(HOST, PORT); - socket.setSoTimeout(READ_TIMEOUT); - - in = new BufferedReader(new InputStreamReader(socket.getInputStream())); - out = new PrintWriter(socket.getOutputStream()); - } - catch (IOException ex) - { - log.warn("unable to setup irc client", ex); - return; - } - - register(username, password); - join(channel); - - try - { - String line; - - while ((line = read()) != null) - { - log.debug("<- {}", line); - - last = System.currentTimeMillis(); - pingSent = false; - - Message message = Message.parse(line); - - switch (message.getCommand()) - { - case "PING": - send("PONG", message.getArguments()[0]); - break; - case "PRIVMSG": - twitchListener.privmsg(message.getTags(), - message.getArguments()[1]); - break; - case "ROOMSTATE": - twitchListener.roomstate(message.getTags()); - break; - case "USERNOTICE": - twitchListener.usernotice(message.getTags(), - message.getArguments().length > 0 ? message.getArguments()[0] : null); - break; - } - } - } - catch (IOException ex) - { - log.debug("error in twitch irc client", ex); - } - finally - { - try - { - socket.close(); - } - catch (IOException e) - { - log.warn(null, e); - } - } - } - - public boolean isConnected() - { - return socket != null && socket.isConnected() && !socket.isClosed(); - } - - public void pingCheck() - { - if (out == null) - { - // client is not connected yet - return; - } - - if (!pingSent && System.currentTimeMillis() - last >= PING_TIMEOUT) - { - ping("twitch"); - pingSent = true; - } - else if (pingSent) - { - log.debug("Ping timeout, disconnecting."); - close(); - } - } - - private void register(String username, String oauth) - { - send("CAP", "REQ", "twitch.tv/commands twitch.tv/tags"); - send("PASS", oauth); - send("NICK", username); - } - - private void join(String channel) - { - send("JOIN", channel); - } - - private void ping(String destination) - { - send("PING", destination); - } - - public void privmsg(String message) - { - send("PRIVMSG", channel, message); - } - - private void send(String command, String... args) - { - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(command); - for (int i = 0; i < args.length; ++i) - { - stringBuilder.append(' '); - if (i + 1 == args.length) - { - stringBuilder.append(':'); - } - stringBuilder.append(args[i]); - } - - log.debug("-> {}", stringBuilder.toString()); - - stringBuilder.append("\r\n"); - - out.write(stringBuilder.toString()); - out.flush(); - } - - private String read() throws IOException - { - String line = in.readLine(); - if (line == null) - { - return null; - } - int len = line.length(); - while (len > 0 && (line.charAt(len - 1) == '\r' || line.charAt(len - 1) == '\n')) - { - --len; - } - - return line.substring(0, len); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/twitch/irc/TwitchListener.java b/runelite-client/src/main/java/net/runelite/client/plugins/twitch/irc/TwitchListener.java deleted file mode 100644 index 77dec8d108..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/twitch/irc/TwitchListener.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2018, 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.twitch.irc; - -import java.util.Map; - -public interface TwitchListener -{ - void privmsg(Map tags, String message); - - void roomstate(Map tags); - - void usernotice(Map tags, String message); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/vetion/VetionOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/vetion/VetionOverlay.java deleted file mode 100644 index 0a42864ffe..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/vetion/VetionOverlay.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2019, Frosty Fridge - * 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.vetion; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.time.Duration; -import java.time.Instant; -import javax.inject.Inject; -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.components.ProgressPieComponent; - -public class VetionOverlay extends Overlay -{ - - private static final Color RED_ALPHA = new Color(Color.RED.getRed(), Color.RED.getGreen(), Color.RED.getBlue(), 100); - private static final Duration MAX_TIME = Duration.ofSeconds(9); - private final VetionPlugin plugin; - private final Client client; - - @Inject - private VetionOverlay(Client client, VetionPlugin plugin) - { - this.plugin = plugin; - this.client = client; - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D graphics) - { - plugin.getVetions().forEach((actor, timer) -> - { - LocalPoint localPos = actor.getLocalLocation(); - if (localPos != null) - { - Point position = Perspective.localToCanvas(client, localPos, client.getPlane(), - actor.getLogicalHeight() + 96); - if (position != null) - { - position = new Point(position.getX(), position.getY()); - - final ProgressPieComponent progressPie = new ProgressPieComponent(); - progressPie.setDiameter(30); - progressPie.setFill(RED_ALPHA); - progressPie.setBorderColor(Color.RED); - progressPie.setPosition(position); - - final Duration duration = Duration.between(timer, Instant.now()); - progressPie.setProgress(1 - (duration.compareTo(MAX_TIME) < 0 - ? (double) duration.toMillis() / MAX_TIME.toMillis() - : 1)); - - progressPie.render(graphics); - if (1 - duration.compareTo(MAX_TIME) < 0) - { - plugin.getVetions().remove(actor); - } - } - } - }); - - return null; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/vetion/VetionPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/vetion/VetionPlugin.java deleted file mode 100644 index 75b8d4ddeb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/vetion/VetionPlugin.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2019, Frosty Fridge - * 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.vetion; - -import java.time.Instant; -import java.util.HashMap; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Actor; -import net.runelite.api.AnimationID; -import net.runelite.api.events.AnimationChanged; -import net.runelite.client.eventbus.Subscribe; -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; - -@PluginDescriptor( - name = "Vetion Helper", - description = "Tracks Vet'ion's special attacks", - tags = {"bosses", "combat", "pve", "overlay"}, - type = PluginType.PVM, - enabledByDefault = false -) -@Singleton -public class VetionPlugin extends Plugin -{ - - @Inject - private OverlayManager overlayManager; - - @Inject - private VetionOverlay overlay; - - @Getter(AccessLevel.PACKAGE) - private Map vetions; - - @Override - protected void startUp() - { - - vetions = new HashMap<>(); - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - vetions = null; - } - - @Subscribe - private void onAnimationChanged(AnimationChanged event) - { - if (event.getActor().getAnimation() == AnimationID.VETION_EARTHQUAKE) - { - Actor vet = event.getActor(); - vetions.remove(vet, Instant.now()); - vetions.put(vet, Instant.now()); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/virtuallevels/SkillModel.java b/runelite-client/src/main/java/net/runelite/client/plugins/virtuallevels/SkillModel.java deleted file mode 100644 index dceeccde42..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/virtuallevels/SkillModel.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2018, Magic fTail - * 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.virtuallevels; - -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.ListMultimap; -import java.util.List; -import lombok.Getter; -import net.runelite.api.ModelID; -import net.runelite.api.Skill; - -@Getter -public enum SkillModel -{ - CONSTRUCTION1(Skill.CONSTRUCTION, ModelID.HAMMER, 10, 14, 669, 15, 0, 329), - CONSTRUCTION2(Skill.CONSTRUCTION, ModelID.SAW, 11, 14, 615, 111, 0, 451), - COOKING(Skill.COOKING, ModelID.COOKING_SKILL_MODEL, 31, 59, 169, 1593, 0, 963), - CRAFTING1(Skill.CRAFTING, ModelID.HAMMER, 30, 24, 418, 14, 0, 496), - CRAFTING2(Skill.CRAFTING, ModelID.CHISEL, 39, 45, 353, 18, 0, 400), - DEFENCE(Skill.DEFENCE, ModelID.STEEL_KITESHIELD, 34, 37, 337, 1074, 0, 598), - FARMING(Skill.FARMING, ModelID.WATERING_CAN, 31, 52, 118, 1278, 0, 451), - FIREMAKING(Skill.FIREMAKING, ModelID.FIREMAKING_SKILL_MODEL, 29, 55, 115, 1689, 0, 771), - FISHING(Skill.FISHING, ModelID.RAW_TUNA, 33, 30, 351, 1865, 0, 517), - FLETCHING1(Skill.FLETCHING, ModelID.STEEL_ARROW, 43, 19, 254, 1257, 0, 408), - FLETCHING2(Skill.FLETCHING, ModelID.STEEL_ARROW, 46, 44, 223, 177, 0, 444), - HERBLORE(Skill.HERBLORE, ModelID.CLEAN_HERB, 20, 35, 550, 2024, 0, 344), - HITPOINTS(Skill.HITPOINTS, ModelID.HEARTH, 35, 58, 538, 0, 0, 250), - MAGIC(Skill.MAGIC, ModelID.BLUE_WIZARD_HAT, 29, 50, 131, 1913, 0, 344), - MINING(Skill.MINING, ModelID.STEEL_PICKAXE, 38, 33, 292, 1166, 0, 413), - PRAYER(Skill.PRAYER, ModelID.PRAYER_SKILL_MODEL, 29, 27, 582, 504, 0, 505), - RANGED1(Skill.RANGED, ModelID.STEEL_ARROW, 28, 34, 206, 195, 0, 405), - RANGED2(Skill.RANGED, ModelID.SHORTBOW, 42, 17, 422, 1618, 0, 397), - RUNECRAFT(Skill.RUNECRAFT, ModelID.PURE_ESSENCE, 35, 38, 242, 1979, 0, 328), - SLAYER(Skill.SLAYER, ModelID.SLAYER_SKILL_MODEL, 34, 60, 221, 1944, 0, 649), - SMITHING(Skill.SMITHING, ModelID.ANVIL, 34, 53, 97, 1868, 0, 716), - STRENGTH(Skill.STRENGTH, ModelID.STRENGTH_SKILL_MODEL, 35, 23, 512, 14, 0, 631), - AGILITY(Skill.AGILITY, ModelID.AGILITY_SKILL_MODEL, 29, 29, 533, 2040, 0, 685), - THIEVING(Skill.THIEVING, ModelID.HIGHWAYMAN_MASK, 42, 31, 366, 55, 0, 155), - WOODCUTTING(Skill.WOODCUTTING, ModelID.WILLOW_TREE, 20, 69, 116, 1978, 0, 1800), - ATTACK1(Skill.ATTACK, ModelID.STEEL_SWORD, 65, 38, 234, 148, 0, 444), - ATTACK2(Skill.ATTACK, ModelID.STEEL_LONGSWORD, 27, 29, 198, 1419, 0, 330), - HUNTER(Skill.HUNTER, ModelID.FOOTPRINT, 45, 48, 512, 0, 0, 1000); - - private static final ListMultimap skillModels = ArrayListMultimap.create(); - - private final Skill skill; - private final int modelID; - private final int originalX; - private final int originalY; - private final int rotationX; - private final int rotationY; - private final int rotationZ; - private final int modelZoom; - - SkillModel(Skill skill, int modelID, int originalX, int originalY, int rotationX, int rotationY, int rotationZ, int modelZoom) - { - this.skill = skill; - this.modelID = modelID; - this.originalX = originalX; - this.originalY = originalY; - this.rotationX = rotationX; - this.rotationY = rotationY; - this.rotationZ = rotationZ; - this.modelZoom = modelZoom; - } - - static - { - for (SkillModel skillModel : values()) - { - skillModels.put(skillModel.skill, skillModel); - } - } - - public static List getSkillModels(Skill skill) - { - return skillModels.get(skill); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/virtuallevels/VirtualLevelsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/virtuallevels/VirtualLevelsConfig.java deleted file mode 100644 index 9028bc6fe7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/virtuallevels/VirtualLevelsConfig.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2019, Beau Mitchell - * 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.virtuallevels; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("virtuallevels") -public interface VirtualLevelsConfig extends Config -{ - @ConfigItem( - keyName = "virtualMessage", - name = "Enable level up message for virtual levels", - description = "Configures whether or not to show level up messages for virtual levels", - position = 0 - ) - default boolean virtualMessage() - { - return true; - } - - @ConfigItem( - keyName = "virtualTotalLevel", - name = "Virtual Total Level", - description = "Count virtual levels towards total level", - position = 1 - ) - default boolean virtualTotalLevel() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/virtuallevels/VirtualLevelsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/virtuallevels/VirtualLevelsPlugin.java deleted file mode 100644 index d57df705eb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/virtuallevels/VirtualLevelsPlugin.java +++ /dev/null @@ -1,419 +0,0 @@ -/* - * Copyright (c) 2018, Joshua Filby - * Copyright (c) 2018, Jordan Atwood - * Copyright (c) 2018, Magic fTail - * 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.virtuallevels; - -import com.google.inject.Provides; -import java.awt.event.KeyEvent; -import java.util.ArrayList; -import java.util.EnumMap; -import java.util.List; -import java.util.Map; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Experience; -import net.runelite.api.FontID; -import net.runelite.api.GameState; -import net.runelite.api.ScriptID; -import net.runelite.api.Skill; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.ScriptCallbackEvent; -import net.runelite.api.events.StatChanged; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.widgets.JavaScriptCallback; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.api.widgets.WidgetPositionMode; -import net.runelite.api.widgets.WidgetSizeMode; -import net.runelite.api.widgets.WidgetTextAlignment; -import net.runelite.api.widgets.WidgetType; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.events.PluginChanged; -import net.runelite.client.input.KeyListener; -import net.runelite.client.input.KeyManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; - -@PluginDescriptor( - name = "Virtual Levels", - description = "Shows virtual levels (beyond 99) and virtual skill total on the skills tab.", - tags = {"skill", "total", "max"}, - enabledByDefault = false, - type = PluginType.UTILITY -) -@Singleton -public class VirtualLevelsPlugin extends Plugin implements KeyListener -{ - private static final String TOTAL_LEVEL_TEXT_PREFIX = "Total level:
"; - private static final int X_OFFSET = 13; - private static final int Y_OFFSET = 16; - - private final Map previousXpMap = new EnumMap<>(Skill.class); - private final List skillsLeveledUp = new ArrayList<>(); - - @Inject - private VirtualLevelsConfig config; - - @Inject - private Client client; - - @Inject - private ClientThread clientThread; - - @Inject - private EventBus eventBus; - - @Inject - private KeyManager keyManager; - - private boolean loginTick = false; - private boolean closeMessage; - private boolean messageOpen; - - @Provides - VirtualLevelsConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(VirtualLevelsConfig.class); - } - - - @Override - protected void shutDown() - { - clientThread.invoke(this::simulateSkillChange); - keyManager.unregisterKeyListener(this); - } - - @Subscribe - private void onPluginChanged(PluginChanged pluginChanged) - { - // this is guaranteed to be called after the plugin has been registered by the eventbus. startUp is not. - if (pluginChanged.getPlugin() == this) - { - keyManager.registerKeyListener(this); - clientThread.invoke(this::simulateSkillChange); - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged configChanged) - { - if (!configChanged.getGroup().equals("virtuallevels")) - { - return; - } - - clientThread.invoke(this::simulateSkillChange); - } - - @Subscribe - private void onScriptCallbackEvent(ScriptCallbackEvent e) - { - final String eventName = e.getEventName(); - - final int[] intStack = client.getIntStack(); - final int intStackSize = client.getIntStackSize(); - final String[] stringStack = client.getStringStack(); - final int stringStackSize = client.getStringStackSize(); - - switch (eventName) - { - case "skillTabBaseLevel": - final int skillId = intStack[intStackSize - 2]; - final Skill skill = Skill.values()[skillId]; - final int exp = client.getSkillExperience(skill); - - // alter the local variable containing the level to show - intStack[intStackSize - 1] = Experience.getLevelForXp(exp); - break; - case "skillTabMaxLevel": - // alter max level constant - intStack[intStackSize - 1] = Experience.MAX_VIRT_LEVEL; - break; - case "skillTabTotalLevel": - if (!config.virtualTotalLevel()) - { - break; - } - int level = 0; - - for (Skill s : Skill.values()) - { - if (s == Skill.OVERALL) - { - continue; - } - - level += Experience.getLevelForXp(client.getSkillExperience(s)); - } - - stringStack[stringStackSize - 1] = TOTAL_LEVEL_TEXT_PREFIX + level; - break; - } - } - - private void simulateSkillChange() - { - // this fires widgets listening for all skill changes - for (Skill skill : Skill.values()) - { - if (skill != Skill.OVERALL) - { - client.queueChangedSkill(skill); - } - } - } - - private void buildVirtualLevelUp(Skill skill) - { - Widget chatboxContainer = client.getWidget(WidgetInfo.CHATBOX_CONTAINER); - - if (chatboxContainer == null) - { - return; - } - - String skillName = skill.getName(); - int skillLevel = Experience.getLevelForXp(client.getSkillExperience(skill)); - List skillModels = SkillModel.getSkillModels(skill); - String prefix = (skill == Skill.AGILITY || skill == Skill.ATTACK) ? "an " : "a "; - - Widget levelUpLevel = chatboxContainer.createChild(-1, WidgetType.TEXT); - Widget levelUpText = chatboxContainer.createChild(-1, WidgetType.TEXT); - Widget levelUpContinue = chatboxContainer.createChild(-1, WidgetType.TEXT); - - levelUpLevel.setText("Congratulations, you just advanced " + prefix + skillName + " level."); - levelUpLevel.setTextColor(0x000080); - levelUpLevel.setFontId(FontID.QUILL_8); - levelUpLevel.setXPositionMode(WidgetPositionMode.ABSOLUTE_TOP); - levelUpLevel.setOriginalX(73 + X_OFFSET); - levelUpLevel.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP); - levelUpLevel.setOriginalY(15 + Y_OFFSET); - levelUpLevel.setOriginalWidth(390); - levelUpLevel.setOriginalHeight(30); - levelUpLevel.setXTextAlignment(WidgetTextAlignment.CENTER); - levelUpLevel.setYTextAlignment(WidgetTextAlignment.LEFT); - levelUpLevel.setWidthMode(WidgetSizeMode.ABSOLUTE); - levelUpLevel.revalidate(); - - levelUpText.setText((skill == Skill.HITPOINTS ? "Your Hitpoints are now " + skillLevel : - "Your " + skillName + " level is now " + skillLevel) + "."); - levelUpText.setFontId(FontID.QUILL_8); - levelUpText.setXPositionMode(WidgetPositionMode.ABSOLUTE_TOP); - levelUpText.setOriginalX(73 + X_OFFSET); - levelUpText.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP); - levelUpText.setOriginalY(44 + Y_OFFSET); - levelUpText.setOriginalWidth(390); - levelUpText.setOriginalHeight(30); - levelUpText.setXTextAlignment(WidgetTextAlignment.CENTER); - levelUpText.setYTextAlignment(WidgetTextAlignment.LEFT); - levelUpText.setWidthMode(WidgetSizeMode.ABSOLUTE); - levelUpText.revalidate(); - - levelUpContinue.setText("Click here to continue"); - levelUpContinue.setTextColor(0x0000ff); - levelUpContinue.setFontId(FontID.QUILL_8); - levelUpContinue.setXPositionMode(WidgetPositionMode.ABSOLUTE_TOP); - levelUpContinue.setOriginalX(73 + X_OFFSET); - levelUpContinue.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP); - levelUpContinue.setOriginalY(74 + Y_OFFSET); - levelUpContinue.setOriginalWidth(390); - levelUpContinue.setOriginalHeight(17); - levelUpContinue.setXTextAlignment(WidgetTextAlignment.CENTER); - levelUpContinue.setYTextAlignment(WidgetTextAlignment.LEFT); - levelUpContinue.setWidthMode(WidgetSizeMode.ABSOLUTE); - levelUpContinue.setAction(0, "Continue"); - levelUpContinue.setOnOpListener((JavaScriptCallback) ev -> closeNextTick()); - levelUpContinue.setOnMouseOverListener((JavaScriptCallback) ev -> levelUpContinue.setTextColor(0xFFFFFF)); - levelUpContinue.setOnMouseLeaveListener((JavaScriptCallback) ev -> levelUpContinue.setTextColor(0x0000ff)); - levelUpContinue.setHasListener(true); - levelUpContinue.revalidate(); - - for (SkillModel skillModel : skillModels) - { - buildWidgetModel(chatboxContainer, skillModel); - } - - messageOpen = true; - } - - private void buildWidgetModel(Widget chatboxContainer, SkillModel model) - { - int iconWidth = 32; - int iconHeight = 32; - - if (model.getSkill() == Skill.CONSTRUCTION) - { - iconWidth = 49; - iconHeight = 61; - } - - Widget levelUpModel = chatboxContainer.createChild(-1, WidgetType.MODEL); - - levelUpModel.setModelId(model.getModelID()); - levelUpModel.setXPositionMode(WidgetPositionMode.ABSOLUTE_TOP); - levelUpModel.setOriginalX(model.getOriginalX() + X_OFFSET); - levelUpModel.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP); - levelUpModel.setOriginalY(model.getOriginalY() + Y_OFFSET); - levelUpModel.setOriginalWidth(iconWidth); - levelUpModel.setOriginalHeight(iconHeight); - levelUpModel.setRotationX(model.getRotationX()); - levelUpModel.setRotationY(model.getRotationY()); - levelUpModel.setRotationZ(model.getRotationZ()); - levelUpModel.setModelZoom(model.getModelZoom()); - levelUpModel.revalidate(); - } - - private void closeNextTick() - { - if (!messageOpen) - { - return; - } - - Widget levelUpContinue = client.getWidget(WidgetInfo.CHATBOX_CONTAINER).getChild(2); - - levelUpContinue.setText("Please wait..."); - - messageOpen = false; - closeMessage = true; - } - - @Subscribe - public void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGIN_SCREEN) - { - loginTick = true; - return; - } - - if (event.getGameState() != GameState.LOGGED_IN) - { - return; - } - - for (Skill skill : Skill.values()) - { - previousXpMap.put(skill, client.getSkillExperience(skill)); - } - } - - @Subscribe - public void onStatChanged(StatChanged event) - { - Skill skill = event.getSkill(); - - int xpAfter = client.getSkillExperience(skill); - int levelAfter = Experience.getLevelForXp(xpAfter); - - int xpBefore = previousXpMap.get(skill); - int levelBefore = Experience.getLevelForXp(xpBefore); - - previousXpMap.put(skill, xpAfter); - - if (!config.virtualMessage() || levelAfter < 100 || levelBefore >= levelAfter) - { - return; - } - - if (!loginTick) - { - skillsLeveledUp.add(skill); - } - } - - @Subscribe - public void onGameTick(GameTick event) - { - loginTick = false; - - if (closeMessage) - { - clientThread.invoke(() -> client.runScript( - ScriptID.MESSAGE_LAYER_CLOSE, - 1, - 1 - )); - - closeMessage = false; - } - - if (skillsLeveledUp.isEmpty()) - { - return; - } - - Widget chatboxContainer = client.getWidget(WidgetInfo.CHATBOX_CONTAINER); - - if (chatboxContainer != null && !chatboxContainer.isHidden()) - { - return; - } - - Skill skill = skillsLeveledUp.get(0); - - skillsLeveledUp.remove(skill); - - clientThread.invoke(() -> client.runScript(ScriptID.MESSAGE_LAYER_OPEN)); - clientThread.invoke(() -> buildVirtualLevelUp(skill)); - WidgetLoaded widgetLoaded = new WidgetLoaded(); - widgetLoaded.setGroupId(WidgetID.CHATBOX_GROUP_ID); - eventBus.post(WidgetLoaded.class, widgetLoaded); - } - - @Override - public void keyTyped(KeyEvent e) - { - if (e.getKeyChar() != ' ') - { - return; - } - - if (messageOpen) - { - closeNextTick(); - } - } - - @Override - public void keyPressed(KeyEvent e) - { - } - - @Override - public void keyReleased(KeyEvent e) - { - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/vorkath/AcidPathOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/vorkath/AcidPathOverlay.java deleted file mode 100644 index 027d636c5b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/vorkath/AcidPathOverlay.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2019, Infinitay - * - * 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.vorkath; - -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.Perspective; -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; - -public class AcidPathOverlay extends Overlay -{ - private static final Color ACID_SPOTS_COLOR = Color.GREEN; - private static final Color ACID_FREE_PATH_COLOR = Color.PINK; - private static final Color WOOXWALK_ATTACK_SPOT_COLOR = Color.YELLOW; - private static final Color WOOXWALK_OUT_OF_REACH_SPOT_COLOR = Color.RED; - private static final int BAR_INDICATOR_SPACER = 5; - - private final Client client; - private final VorkathPlugin plugin; - - @Inject - public AcidPathOverlay(final Client client, final VorkathPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.getVorkath() == null || plugin.getVorkath().getVorkath().getLocalLocation() == null) - { - return null; - } - - if (plugin.isIndicateAcidPools() && plugin.getAcidSpots() != null - && !plugin.getAcidSpots().isEmpty()) - { - for (WorldPoint acidWorldPoint : plugin.getAcidSpots()) - { - LocalPoint acidLocalPoint = LocalPoint.fromWorld(client, acidWorldPoint); - if (acidLocalPoint == null) - { - continue; - } - OverlayUtil.renderPolygon(graphics, Perspective.getCanvasTilePoly(client, - acidLocalPoint), ACID_SPOTS_COLOR); - } - } - - if (plugin.isIndicateAcidFreePath() && plugin.getAcidFreePath() != null - && !plugin.getAcidFreePath().isEmpty()) - { - for (WorldPoint acidFreeWorldPoint : plugin.getAcidFreePath()) - { - LocalPoint acidFreeLocalPoint = LocalPoint.fromWorld(client, acidFreeWorldPoint); - if (acidFreeLocalPoint == null) - { - continue; - } - - OverlayUtil.renderPolygon(graphics, Perspective.getCanvasTilePoly(client, - acidFreeLocalPoint), ACID_FREE_PATH_COLOR); - } - } - - if (plugin.isIndicateWooxWalkPath() && plugin.getWooxWalkPath()[0] != null - && plugin.getWooxWalkPath()[1] != null) - { - LocalPoint attackLocalPoint = LocalPoint.fromWorld(client, plugin.getWooxWalkPath()[0]); - LocalPoint outOfReachLocalPoint = LocalPoint.fromWorld(client, plugin.getWooxWalkPath()[1]); - - if (attackLocalPoint != null && outOfReachLocalPoint != null) - { - OverlayUtil.renderPolygon(graphics, Perspective.getCanvasTilePoly(client, - attackLocalPoint), Color.YELLOW); - OverlayUtil.renderPolygon(graphics, Perspective.getCanvasTilePoly(client, - outOfReachLocalPoint), Color.RED); - - if (plugin.isIndicateWooxWalkTick() && plugin.getWooxWalkBar() != null - && plugin.getWooxWalkTimer() != -1) - { - int[] xpointsAttack = { - (int) (plugin.getWooxWalkBar().getX() + plugin.getWooxWalkBar().getWidth() / 2.0 + 1), - (int) (plugin.getWooxWalkBar().getX() + plugin.getWooxWalkBar().getWidth()), - (int) (plugin.getWooxWalkBar().getX() + plugin.getWooxWalkBar().getWidth()), - (int) (plugin.getWooxWalkBar().getX() + plugin.getWooxWalkBar().getWidth() / 2 + 1) - }; - int[] xpointsOutOfReach = { - (int) plugin.getWooxWalkBar().getX(), - (int) (plugin.getWooxWalkBar().getX() + plugin.getWooxWalkBar().getWidth() / 2.0), - (int) (plugin.getWooxWalkBar().getX() + plugin.getWooxWalkBar().getWidth() / 2.0), - (int) plugin.getWooxWalkBar().getX() - }; - int[] ypointsBoth = { - (int) plugin.getWooxWalkBar().getY(), - (int) plugin.getWooxWalkBar().getY(), - (int) (plugin.getWooxWalkBar().getY() + plugin.getWooxWalkBar().getHeight()), - (int) (plugin.getWooxWalkBar().getY() + plugin.getWooxWalkBar().getHeight()) - }; - Polygon wooxWalkAttack = new Polygon(xpointsAttack, ypointsBoth, 4); - Polygon wooxWalkOutOfReach = new Polygon(xpointsOutOfReach, ypointsBoth, 4); - OverlayUtil.renderPolygon(graphics, wooxWalkAttack, WOOXWALK_ATTACK_SPOT_COLOR); - OverlayUtil.renderPolygon(graphics, wooxWalkOutOfReach, WOOXWALK_OUT_OF_REACH_SPOT_COLOR); - - long timeLeft = (System.currentTimeMillis() - plugin.getWooxWalkTimer()) % 1200; - double timeScale; - if (timeLeft <= 600) - { - timeScale = 1 - timeLeft / 600.0; - } - else - { - timeLeft -= 600; - timeScale = timeLeft / 600.0; - } - int progress = (int) Math.round(plugin.getWooxWalkBar().getWidth() * timeScale); - - int[] xpointsIndicator = { - (int) (plugin.getWooxWalkBar().getX() - plugin.getWooxWalkBar().getHeight() / 2 + progress), - (int) (plugin.getWooxWalkBar().getX() + plugin.getWooxWalkBar().getHeight() / 2 + progress), - (int) plugin.getWooxWalkBar().getX() + progress - }; - int[] ypointsIndicator = { - (int) (plugin.getWooxWalkBar().getY() - plugin.getWooxWalkBar().getHeight() - BAR_INDICATOR_SPACER), - (int) (plugin.getWooxWalkBar().getY() - plugin.getWooxWalkBar().getHeight() - BAR_INDICATOR_SPACER), - (int) (plugin.getWooxWalkBar().getY() - BAR_INDICATOR_SPACER) - }; - Polygon indicator = new Polygon(xpointsIndicator, ypointsIndicator, 3); - OverlayUtil.renderPolygon(graphics, indicator, Color.WHITE); - } - } - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/vorkath/Vorkath.java b/runelite-client/src/main/java/net/runelite/client/plugins/vorkath/Vorkath.java deleted file mode 100644 index 7feb618893..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/vorkath/Vorkath.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2019, Infinitay - * - * 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.vorkath; - -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.NPC; - -@Data -@Slf4j -public class Vorkath -{ - static final int ATTACKS_PER_SWITCH = 6; - static final int FIRE_BALL_ATTACKS = 25; - - private NPC vorkath; - private VorkathAttack lastAttack; - private Phase currentPhase; - private Phase nextPhase; - private Phase lastPhase; - private int attacksLeft; - - public Vorkath(NPC vorkath) - { - this.vorkath = vorkath; - this.attacksLeft = ATTACKS_PER_SWITCH; - this.currentPhase = Phase.UNKNOWN; - this.nextPhase = Phase.UNKNOWN; - this.lastPhase = Phase.UNKNOWN; - log.debug("[Vorkath] Created Vorkath: {}", this); - } - - /** - * Updates the existing Vorkath object depending on the new phase it is currently on - * - * @param newPhase the new phase Vorkath is current on - */ - void updatePhase(Phase newPhase) - { - Phase oldLastPhase = this.lastPhase; - Phase oldCurrentPhase = this.currentPhase; - Phase oldNextPhase = this.currentPhase; - int oldAttacksLeft = this.attacksLeft; - - this.lastPhase = this.currentPhase; - this.currentPhase = newPhase; - switch (newPhase) - { - case ACID: - this.nextPhase = Phase.FIRE_BALL; - break; - case FIRE_BALL: - this.nextPhase = Phase.SPAWN; - break; - case SPAWN: - this.nextPhase = Phase.ACID; - break; - default: - this.nextPhase = Phase.UNKNOWN; - break; - } - - if (this.currentPhase == Phase.FIRE_BALL) - { - this.attacksLeft = FIRE_BALL_ATTACKS; - } - else - { - this.attacksLeft = ATTACKS_PER_SWITCH; - } - - log.debug("[Vorkath] Update! Last Phase: {}->{}, Current Phase: {}->{}, Next Phase: {}->{}, Attacks: {}->{}", - oldLastPhase, this.lastPhase, oldCurrentPhase, this.currentPhase, oldNextPhase, this.nextPhase, oldAttacksLeft, this.attacksLeft); - } - - enum Phase - { - UNKNOWN, - ACID, - FIRE_BALL, - SPAWN - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/vorkath/VorkathAttack.java b/runelite-client/src/main/java/net/runelite/client/plugins/vorkath/VorkathAttack.java deleted file mode 100644 index d1a2ec95ea..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/vorkath/VorkathAttack.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2019, Infinitay - * - * 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.vorkath; - -import com.google.common.collect.ImmutableMap; -import java.util.Map; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.AnimationID; -import net.runelite.api.ProjectileID; - -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -public enum VorkathAttack -{ - /** - * Vorkath's melee attack (see VorkathPlugin#onAnimationChanged) - */ - SLASH_ATTACK(AnimationID.VORKATH_SLASH_ATTACK, -1), - /** - * Vorkath's dragon breath attack - */ - FIRE_BREATH(AnimationID.VORKATH_ATTACK, ProjectileID.VORKATH_DRAGONBREATH), - /** - * Vorkath's dragon breath attack causing the player's active prayers to be deactivated - */ - PRAYER_BREATH(AnimationID.VORKATH_ATTACK, ProjectileID.VORKATH_PRAYER_DISABLE), - /** - * Vorkath's dragon breath attack causing the player to become poisoned with venom - */ - VENOM_BREATH(AnimationID.VORKATH_ATTACK, ProjectileID.VORKATH_VENOM), - /** - * Vorkath's ranged attack - */ - SPIKE(AnimationID.VORKATH_ATTACK, ProjectileID.VORKATH_RANGED), - /** - * Vorkath's magic attack - */ - ICE(AnimationID.VORKATH_ATTACK, ProjectileID.VORKATH_MAGIC), - /** - * Vorkath's aoe fire bomb attack (3x3 from where player was originally standing) - */ - FIRE_BOMB(AnimationID.VORKATH_FIRE_BOMB_OR_SPAWN_ATTACK, ProjectileID.VORKATH_BOMB_AOE), - /** - * Vorkath's aoe acid attacking, spewing acid across the instance - */ - ACID(AnimationID.VORKATH_ACID_ATTACK, ProjectileID.VORKATH_POISON_POOL_AOE), - /** - * Vorkath's fire ball attack that is fired during the acid phase, almost every tick for 25(?) attacks total - */ - FIRE_BALL(AnimationID.VORKATH_ACID_ATTACK, ProjectileID.VORKATH_TICK_FIRE_AOE), - /** - * Vorkath's dragon breath attack causing the player to be frozen during Zombified Spawn phase - */ - FREEZE_BREATH(AnimationID.VORKATH_ATTACK, ProjectileID.VORKATH_ICE), - /** - * Vorkath's spawning of a Zombified Spawn - */ - ZOMBIFIED_SPAWN(AnimationID.VORKATH_FIRE_BOMB_OR_SPAWN_ATTACK, ProjectileID.VORKATH_SPAWN_AOE); - - private static final Map VORKATH_ATTACKS; - private static final Map VORKATH_BASIC_ATTACKS; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - for (VorkathAttack vorkathAttack : values()) - { - builder.put(vorkathAttack.getProjectileID(), vorkathAttack); - } - VORKATH_ATTACKS = builder.build(); - } - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - builder.put(FIRE_BREATH.getProjectileID(), FIRE_BREATH) - .put(PRAYER_BREATH.getProjectileID(), PRAYER_BREATH) - .put(VENOM_BREATH.getProjectileID(), VENOM_BREATH) - .put(SPIKE.getProjectileID(), SPIKE) - .put(ICE.getProjectileID(), ICE) - .put(FIRE_BOMB.getProjectileID(), FIRE_BOMB) - .put(FIRE_BALL.getProjectileID(), FIRE_BALL); - // FIRE_BOMB and FIRE_BALL are also basic attacks - // Although SLASH_ATTACK is a basic attack, we're going to handle it differently - VORKATH_BASIC_ATTACKS = builder.build(); - } - - private final int vorkathAnimationID; - private final int projectileID; - - /** - * @param projectileID id of projectile - * @return {@link VorkathAttack} associated with the specified projectile - */ - public static VorkathAttack getVorkathAttack(int projectileID) - { - return VORKATH_ATTACKS.get(projectileID); - } - - /** - * @param projectileID id of projectile - * @return true if the projectile id matches a {@link VorkathAttack#getProjectileID()} within {@link VorkathAttack#VORKATH_BASIC_ATTACKS}, - * false otherwise - */ - public static boolean isBasicAttack(int projectileID) - { - return VORKATH_BASIC_ATTACKS.get(projectileID) != null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/vorkath/VorkathConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/vorkath/VorkathConfig.java deleted file mode 100644 index 46a51ca8f0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/vorkath/VorkathConfig.java +++ /dev/null @@ -1,90 +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.vorkath; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("vorkath") -public interface VorkathConfig extends Config -{ - @ConfigItem( - keyName = "indicateAcidPools", - name = "Acid Pools", - description = "Indicate the acid pools", - position = 0 - ) - default boolean indicateAcidPools() - { - return false; - } - - @ConfigItem( - keyName = "indicateAcidFreePath", - name = "Acid Free Path", - description = "Indicate the most efficient acid free path", - position = 1 - ) - default boolean indicateAcidFreePath() - { - return true; - } - - @ConfigItem( - keyName = "acidFreePathMinLength", - name = "Minimum Length Acid Free Path", - description = "The minimum length of an acid free path", - position = 2, - hidden = true, - unhide = "indicateAcidFreePath" - ) - default int acidFreePathLength() - { - return 5; - } - - @ConfigItem( - keyName = "indicateWooxWalkPath", - name = "WooxWalk Path", - description = "Indicate the closest WooxWalk path", - position = 3 - ) - default boolean indicateWooxWalkPath() - { - return true; - } - - @ConfigItem( - keyName = "indicateWooxWalkTick", - name = "WooxWalk Tick", - description = "Indicate on which tile to click during each game tick", - position = 4 - ) - default boolean indicateWooxWalkTick() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/vorkath/VorkathOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/vorkath/VorkathOverlay.java deleted file mode 100644 index 7a882d527d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/vorkath/VorkathOverlay.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2019, Infinitay - * - * 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.vorkath; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.geom.Arc2D; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -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.OverlayUtil; -import net.runelite.client.util.ImageUtil; - -@Singleton -public class VorkathOverlay extends Overlay -{ - private static final Color COLOR_ICON_BACKGROUND = new Color(0, 0, 0, 128); - private static final Color COLOR_ICON_BORDER = new Color(0, 0, 0, 255); - private static final Color COLOR_ICON_BORDER_FILL = new Color(219, 175, 0, 255); - private static final int OVERLAY_ICON_DISTANCE = 30; - private static final int OVERLAY_ICON_MARGIN = 1; - private static final BufferedImage UNKNOWN; - private static final BufferedImage ACID; - private static final BufferedImage FIRE_BALL; - private static final BufferedImage SPAWN; - - static - { - UNKNOWN = ImageUtil.getResourceStreamFromClass(VorkathPlugin.class, "magerange.png"); - ACID = ImageUtil.getResourceStreamFromClass(VorkathPlugin.class, "acid.png"); - FIRE_BALL = ImageUtil.getResourceStreamFromClass(VorkathPlugin.class, "fire_strike.png"); - SPAWN = ImageUtil.getResourceStreamFromClass(VorkathPlugin.class, "ice.png"); - } - - private final Client client; - private final VorkathPlugin plugin; - - @Inject - public VorkathOverlay(final Client client, final VorkathPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_SCENE); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.getVorkath() != null) - { - final Vorkath vorkath = plugin.getVorkath(); - - final LocalPoint localLocation = vorkath.getVorkath().getLocalLocation(); - if (localLocation != null) - { - Point point = Perspective.localToCanvas(client, localLocation, client.getPlane(), vorkath.getVorkath().getLogicalHeight() + 16); - if (point != null) - { - point = new Point(point.getX(), point.getY()); - - final BufferedImage currentPhaseIcon = getIcon(vorkath); - - int totalWidth = 0; - if (currentPhaseIcon != null) - { - totalWidth = currentPhaseIcon.getWidth() * OVERLAY_ICON_MARGIN; - } - int bgPadding = 8; - int currentPosX = 0; - - if (currentPhaseIcon == null) - { - return null; - } - - OverlayUtil.setProgressIcon(graphics, point, currentPhaseIcon, totalWidth, bgPadding, currentPosX, - COLOR_ICON_BACKGROUND, OVERLAY_ICON_DISTANCE, COLOR_ICON_BORDER, COLOR_ICON_BORDER_FILL); - - final Arc2D.Double arc = new Arc2D.Double( - point.getX() - totalWidth / 2 + currentPosX - bgPadding, - point.getY() - (float) (currentPhaseIcon.getHeight() / 2) - OVERLAY_ICON_DISTANCE - bgPadding, - currentPhaseIcon.getWidth() + bgPadding * 2, - currentPhaseIcon.getHeight() + bgPadding * 2, - 90.0, - -360.0 * getAttacksLeftProgress(), - Arc2D.OPEN - ); - graphics.draw(arc); - } - } - } - - if (plugin.getZombifiedSpawn() != null) - { - OverlayUtil.renderActorOverlayImage(graphics, plugin.getZombifiedSpawn(), SPAWN, Color.green, 10); - } - - return null; - } - - /** - * @param vorkath Vorkath object - * @return image of the current phase Vorkath is on - */ - private BufferedImage getIcon(Vorkath vorkath) - { - switch (vorkath.getCurrentPhase()) - { - case UNKNOWN: - return UNKNOWN; - case ACID: - return ACID; - case FIRE_BALL: - return FIRE_BALL; - case SPAWN: - return SPAWN; - } - return null; - } - - /** - * @return number of attacks Vorkath has left in the current phase - */ - private double getAttacksLeftProgress() - { - if (plugin.getVorkath().getCurrentPhase() != Vorkath.Phase.FIRE_BALL) - { - return (double) (Vorkath.ATTACKS_PER_SWITCH - plugin.getVorkath().getAttacksLeft()) / Vorkath.ATTACKS_PER_SWITCH; - } - else - { - return (double) (Vorkath.FIRE_BALL_ATTACKS - plugin.getVorkath().getAttacksLeft()) / Vorkath.FIRE_BALL_ATTACKS; - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/vorkath/VorkathPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/vorkath/VorkathPlugin.java deleted file mode 100644 index d3a4a0943d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/vorkath/VorkathPlugin.java +++ /dev/null @@ -1,623 +0,0 @@ -/* - * Copyright (c) 2018, https://openosrs.com - * Copyright (c) 2019, Infinitay - * - * 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.vorkath; - -import com.google.inject.Inject; -import com.google.inject.Provides; -import com.google.inject.Singleton; -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -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.GameObject; -import net.runelite.api.NPC; -import net.runelite.api.ObjectID; -import net.runelite.api.Projectile; -import net.runelite.api.ProjectileID; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.AnimationChanged; -import net.runelite.api.events.ClientTick; -import net.runelite.api.events.GameObjectDespawned; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.events.ProjectileMoved; -import net.runelite.api.events.ProjectileSpawned; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -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 org.apache.commons.lang3.ArrayUtils; - -@PluginDescriptor( - name = "Vorkath Helper", - description = "Count vorkath attacks, indicate next phase, wooxwalk timer, indicate path through acid", - tags = {"combat", "overlay", "pve", "pvm"}, - type = PluginType.PVM, - enabledByDefault = false -) -@Singleton -@Slf4j -public class VorkathPlugin extends Plugin -{ - private static final int VORKATH_REGION = 9023; - - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private VorkathOverlay overlay; - - @Inject - private AcidPathOverlay acidPathOverlay; - - @Inject - private VorkathConfig config; - - @Getter(AccessLevel.PACKAGE) - private Vorkath vorkath; - - @Getter(AccessLevel.PACKAGE) - private NPC zombifiedSpawn; - - @Getter(AccessLevel.PACKAGE) - private List acidSpots = new ArrayList<>(); - - @Getter(AccessLevel.PACKAGE) - private List acidFreePath = new ArrayList<>(); - - @Getter(AccessLevel.PACKAGE) - private WorldPoint[] wooxWalkPath = new WorldPoint[2]; - - @Getter(AccessLevel.PACKAGE) - private long wooxWalkTimer = -1; - - @Getter(AccessLevel.PACKAGE) - private Rectangle wooxWalkBar; - private int lastAcidSpotsSize = 0; - - // Config values - @Getter(AccessLevel.PACKAGE) - private boolean indicateAcidPools; - @Getter(AccessLevel.PACKAGE) - private boolean indicateAcidFreePath; - @Getter(AccessLevel.PACKAGE) - private boolean indicateWooxWalkPath; - @Getter(AccessLevel.PACKAGE) - private boolean indicateWooxWalkTick; - private int acidFreePathLength; - - @Provides - VorkathConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(VorkathConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - } - - @Override - protected void shutDown() - { - reset(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("vorkath")) - { - return; - } - - updateConfig(); - } - - @Subscribe - private void onNpcSpawned(NpcSpawned event) - { - if (!isAtVorkath()) - { - return; - } - - final NPC npc = event.getNpc(); - - if (npc.getName() == null) - { - return; - } - - if (npc.getName().equals("Vorkath")) - { - vorkath = new Vorkath(npc); - overlayManager.add(overlay); - } - else if (npc.getName().equals("Zombified Spawn")) - { - zombifiedSpawn = npc; - } - } - - @Subscribe - private void onNpcDespawned(NpcDespawned event) - { - if (!isAtVorkath()) - { - return; - } - - final NPC npc = event.getNpc(); - - if (npc.getName() == null) - { - return; - } - - if (npc.getName().equals("Vorkath")) - { - reset(); - } - else if (npc.getName().equals("Zombified Spawn")) - { - zombifiedSpawn = null; - } - } - - @Subscribe - private void onProjectileSpawned(ProjectileSpawned event) - { - if (!isAtVorkath() || vorkath == null) - { - return; - } - - final Projectile proj = event.getProjectile(); - final VorkathAttack vorkathAttack = VorkathAttack.getVorkathAttack(proj.getId()); - - if (vorkathAttack != null) - { - if (VorkathAttack.isBasicAttack(vorkathAttack.getProjectileID()) && vorkath.getAttacksLeft() > 0) - { - vorkath.setAttacksLeft(vorkath.getAttacksLeft() - 1); - } - else if (vorkathAttack == VorkathAttack.ACID) - { - vorkath.updatePhase(Vorkath.Phase.ACID); - vorkath.setAttacksLeft(0); - } - else if (vorkathAttack == VorkathAttack.FIRE_BALL) - { - vorkath.updatePhase(Vorkath.Phase.FIRE_BALL); - vorkath.setAttacksLeft(vorkath.getAttacksLeft() - 1); - } - else if (vorkathAttack == VorkathAttack.FREEZE_BREATH || vorkathAttack == VorkathAttack.ZOMBIFIED_SPAWN) - { - vorkath.updatePhase(Vorkath.Phase.SPAWN); - vorkath.setAttacksLeft(0); - } - else - { - vorkath.updatePhase(vorkath.getNextPhase()); - vorkath.setAttacksLeft(vorkath.getAttacksLeft() - 1); - } - - log.debug("[Vorkath ({})] {}", vorkathAttack, vorkath); - vorkath.setLastAttack(vorkathAttack); - } - } - - @Subscribe - private void onProjectileMoved(ProjectileMoved event) - { - if (!isAtVorkath()) - { - return; - } - - final Projectile proj = event.getProjectile(); - final LocalPoint loc = event.getPosition(); - - if (proj.getId() == ProjectileID.VORKATH_POISON_POOL_AOE) - { - addAcidSpot(WorldPoint.fromLocal(client, loc)); - } - } - - @Subscribe - private void onGameObjectSpawned(GameObjectSpawned event) - { - if (!isAtVorkath()) - { - return; - } - - final GameObject obj = event.getGameObject(); - - if (obj.getId() == ObjectID.ACID_POOL || obj.getId() == ObjectID.ACID_POOL_32000) - { - addAcidSpot(obj.getWorldLocation()); - } - } - - @Subscribe - private void onGameObjectDespawned(GameObjectDespawned event) - { - if (!isAtVorkath()) - { - return; - } - - final GameObject obj = event.getGameObject(); - - if (obj.getId() == ObjectID.ACID_POOL || obj.getId() == ObjectID.ACID_POOL_32000) - { - acidSpots.remove(obj.getWorldLocation()); - } - } - - @Subscribe - private void onAnimationChanged(AnimationChanged event) - { - if (!isAtVorkath()) - { - return; - } - - final Actor actor = event.getActor(); - - if (isAtVorkath() && vorkath != null && actor.equals(vorkath.getVorkath()) - && actor.getAnimation() == VorkathAttack.SLASH_ATTACK.getVorkathAnimationID()) - { - if (vorkath.getAttacksLeft() > 0) - { - vorkath.setAttacksLeft(vorkath.getAttacksLeft() - 1); - } - else - { - vorkath.updatePhase(vorkath.getNextPhase()); - vorkath.setAttacksLeft(vorkath.getAttacksLeft() - 1); - } - log.debug("[Vorkath (SLASH_ATTACK)] {}", vorkath); - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - if (!isAtVorkath()) - { - return; - } - - // Update the acid free path every tick to account for player movement - if (this.indicateAcidFreePath && !acidSpots.isEmpty()) - { - calculateAcidFreePath(); - } - - // Start the timer when the player walks into the WooxWalk zone - if (this.indicateWooxWalkPath && this.indicateWooxWalkTick && wooxWalkPath[0] != null && wooxWalkPath[1] != null) - { - final WorldPoint playerLoc = client.getLocalPlayer().getWorldLocation(); - - if (playerLoc.getX() == wooxWalkPath[0].getX() && playerLoc.getY() == wooxWalkPath[0].getY() - && playerLoc.getPlane() == wooxWalkPath[0].getPlane()) - { - if (wooxWalkTimer == -1) - { - wooxWalkTimer = System.currentTimeMillis() - 400; - } - } - else if (playerLoc.getX() == wooxWalkPath[1].getX() && playerLoc.getY() == wooxWalkPath[1].getY() - && playerLoc.getPlane() == wooxWalkPath[1].getPlane()) - { - if (wooxWalkTimer == -1) - { - wooxWalkTimer = System.currentTimeMillis() - 1000; - } - } - else if (wooxWalkTimer != -1) - { - wooxWalkTimer = -1; - } - } - } - - @Subscribe - private void onClientTick(ClientTick event) - { - if (acidSpots.size() != lastAcidSpotsSize) - { - if (acidSpots.size() == 0) - { - overlayManager.remove(acidPathOverlay); - acidFreePath.clear(); - Arrays.fill(wooxWalkPath, null); - wooxWalkTimer = -1; - } - else - { - if (this.indicateAcidFreePath) - { - calculateAcidFreePath(); - } - if (this.indicateWooxWalkPath) - { - calculateWooxWalkPath(); - } - - overlayManager.add(acidPathOverlay); - } - - lastAcidSpotsSize = acidSpots.size(); - } - } - - /** - * @return true if the player is in the Vorkath region, false otherwise - */ - private boolean isAtVorkath() - { - return ArrayUtils.contains(client.getMapRegions(), VORKATH_REGION); - } - - private void addAcidSpot(WorldPoint acidSpotLocation) - { - if (!acidSpots.contains(acidSpotLocation)) - { - acidSpots.add(acidSpotLocation); - } - } - - private void calculateAcidFreePath() - { - acidFreePath.clear(); - - if (vorkath == null) - { - return; - } - - final int[][][] directions = { - { - {0, 1}, {0, -1} // Positive and negative Y - }, - { - {1, 0}, {-1, 0} // Positive and negative X - } - }; - - List bestPath = new ArrayList<>(); - double bestClicksRequired = 99; - - final WorldPoint playerLoc = client.getLocalPlayer().getWorldLocation(); - final WorldPoint vorkLoc = vorkath.getVorkath().getWorldLocation(); - final int maxX = vorkLoc.getX() + 14; - final int minX = vorkLoc.getX() - 8; - final int maxY = vorkLoc.getY() - 1; - final int minY = vorkLoc.getY() - 8; - - // Attempt to search an acid free path, beginning at a location - // adjacent to the player's location (including diagonals) - for (int x = -1; x < 2; x++) - { - for (int y = -1; y < 2; y++) - { - final WorldPoint baseLocation = new WorldPoint(playerLoc.getX() + x, - playerLoc.getY() + y, playerLoc.getPlane()); - - if (acidSpots.contains(baseLocation) || baseLocation.getY() < minY || baseLocation.getY() > maxY) - { - continue; - } - - // Search in X and Y direction - for (int d = 0; d < directions.length; d++) - { - // Calculate the clicks required to start walking on the path - double currentClicksRequired = Math.abs(x) + Math.abs(y); - if (currentClicksRequired < 2) - { - currentClicksRequired += Math.abs(y * directions[d][0][0]) + Math.abs(x * directions[d][0][1]); - } - if (d == 0) - { - // Prioritize a path in the X direction (sideways) - currentClicksRequired += 0.5; - } - - List currentPath = new ArrayList<>(); - currentPath.add(baseLocation); - - // Positive X (first iteration) or positive Y (second iteration) - for (int i = 1; i < 25; i++) - { - final WorldPoint testingLocation = new WorldPoint(baseLocation.getX() + i * directions[d][0][0], - baseLocation.getY() + i * directions[d][0][1], baseLocation.getPlane()); - - if (acidSpots.contains(testingLocation) || testingLocation.getY() < minY || testingLocation.getY() > maxY - || testingLocation.getX() < minX || testingLocation.getX() > maxX) - { - break; - } - - currentPath.add(testingLocation); - } - - // Negative X (first iteration) or positive Y (second iteration) - for (int i = 1; i < 25; i++) - { - final WorldPoint testingLocation = new WorldPoint(baseLocation.getX() + i * directions[d][1][0], - baseLocation.getY() + i * directions[d][1][1], baseLocation.getPlane()); - - if (acidSpots.contains(testingLocation) || testingLocation.getY() < minY || testingLocation.getY() > maxY - || testingLocation.getX() < minX || testingLocation.getX() > maxX) - { - break; - } - - currentPath.add(testingLocation); - } - - if (currentPath.size() >= this.acidFreePathLength && currentClicksRequired < bestClicksRequired - || (currentClicksRequired == bestClicksRequired && currentPath.size() > bestPath.size())) - { - bestPath = currentPath; - bestClicksRequired = currentClicksRequired; - } - } - } - } - - if (bestClicksRequired != 99) - { - acidFreePath = bestPath; - } - } - - private void calculateWooxWalkPath() - { - wooxWalkTimer = -1; - - updateWooxWalkBar(); - - if (client.getLocalPlayer() == null || vorkath.getVorkath() == null) - { - return; - } - - final WorldPoint playerLoc = client.getLocalPlayer().getWorldLocation(); - final WorldPoint vorkLoc = vorkath.getVorkath().getWorldLocation(); - - final int maxX = vorkLoc.getX() + 14; - final int minX = vorkLoc.getX() - 8; - final int baseX = playerLoc.getX(); - final int baseY = vorkLoc.getY() - 5; - final int middleX = vorkLoc.getX() + 3; - - // Loop through the arena tiles in the x-direction and - // alternate between positive and negative x direction - for (int i = 0; i < 50; i++) - { - // Make sure we always choose the spot closest to - // the middle of the arena - int directionRemainder = 0; - if (playerLoc.getX() < middleX) - { - directionRemainder = 1; - } - - int deviation = (int) Math.floor(i / 2.0); - if (i % 2 == directionRemainder) - { - deviation = -deviation; - } - - final WorldPoint attackLocation = new WorldPoint(baseX + deviation, baseY, playerLoc.getPlane()); - final WorldPoint outOfRangeLocation = new WorldPoint(baseX + deviation, baseY - 1, playerLoc.getPlane()); - - if (acidSpots.contains(attackLocation) || acidSpots.contains(outOfRangeLocation) - || attackLocation.getX() < minX || attackLocation.getX() > maxX) - { - continue; - } - - wooxWalkPath[0] = attackLocation; - wooxWalkPath[1] = outOfRangeLocation; - - break; - } - } - - private void updateWooxWalkBar() - { - // Update the WooxWalk tick indicator's dimensions - // based on the canvas dimensions - final Widget exp = client.getWidget(WidgetInfo.EXPERIENCE_TRACKER); - - if (exp == null) - { - return; - } - - final Rectangle screen = exp.getBounds(); - - int width = (int) Math.floor(screen.getWidth() / 2.0); - if (width % 2 == 1) - { - width++; - } - int height = (int) Math.floor(width / 20.0); - if (height % 2 == 1) - { - height++; - } - final int x = (int) Math.floor(screen.getX() + width / 2.0); - final int y = (int) Math.floor(screen.getY() + screen.getHeight() - 2 * height); - wooxWalkBar = new Rectangle(x, y, width, height); - } - - private void updateConfig() - { - this.indicateAcidPools = config.indicateAcidPools(); - this.indicateAcidFreePath = config.indicateAcidFreePath(); - this.indicateWooxWalkPath = config.indicateWooxWalkPath(); - this.indicateWooxWalkTick = config.indicateWooxWalkTick(); - this.acidFreePathLength = config.acidFreePathLength(); - } - - private void reset() - { - overlayManager.remove(overlay); - overlayManager.remove(acidPathOverlay); - vorkath = null; - acidSpots.clear(); - acidFreePath.clear(); - Arrays.fill(wooxWalkPath, null); - wooxWalkTimer = -1; - zombifiedSpawn = null; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/whalewatchers/WhaleWatchersConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/whalewatchers/WhaleWatchersConfig.java deleted file mode 100644 index 6e3ec4863c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/whalewatchers/WhaleWatchersConfig.java +++ /dev/null @@ -1,76 +0,0 @@ -package net.runelite.client.plugins.whalewatchers; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("WhaleWatchers") -public interface WhaleWatchersConfig extends Config -{ - - @ConfigItem( - position = 1, - keyName = "protectItemWarning", - name = "Protect Item Warning", - description = "Warns you when you are skulled and don't have protect item turned on." - ) - default boolean protectItemWarning() - { - return false; - } - - @ConfigItem( - position = 2, - keyName = "lessObnoxiousProtWarning", - name = "Less Obnoxious Protect Item Warning", - description = "Replaces the overlay with thick border and text with a less obtrusive overlay with a thin border and no text" - ) - default boolean lessObnoxiousProtWarning() - { - return false; - } - - @ConfigItem( - position = 3, - keyName = "showDamageCounter", - name = "Damage Counter", - description = "Shows damage you've done and damage your opponent has done to you while in a fight" - ) - default boolean showDamageCounter() - { - return true; - } - - @ConfigItem( - position = 4, - keyName = "smiteableWarning", - name = "Smite Warning", - description = "Displays a warning overlay when your prayer is at a smiteable level" - ) - default boolean smiteableWarning() - { - return true; - } - - @ConfigItem( - position = 5, - keyName = "gloryWarning", - name = "Glory Warning", - description = "Displays a warning box while you are wearing an uncharged glory" - ) - default boolean gloryWarning() - { - return true; - } - - @ConfigItem( - position = 5, - keyName = "pneckBreak", - name = "Phoenix Necklace Break Sound", - description = "play a sound notification when your phoenix necklace breaks" - ) - default boolean pneckBreak() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/whalewatchers/WhaleWatchersGloryOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/whalewatchers/WhaleWatchersGloryOverlay.java deleted file mode 100644 index 94241f0c8c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/whalewatchers/WhaleWatchersGloryOverlay.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019. PKLite - * 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 following authors: - * - * PKLite discord: https://discord.gg/Dp3HuFM - * Written by PKLite(ST0NEWALL, others) , 2019 - * - ******************************************************************************/ -package net.runelite.client.plugins.whalewatchers; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.ItemID; -import net.runelite.client.game.ItemManager; -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.ImageComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; -import net.runelite.client.util.AsyncBufferedImage; - -@Singleton -public class WhaleWatchersGloryOverlay extends Overlay -{ - private final WhaleWatchersPlugin plugin; - private final PanelComponent panelComponent; - - @Inject - private ItemManager itemManager; - - @Inject - public WhaleWatchersGloryOverlay(final WhaleWatchersPlugin plugin) - { - this.plugin = plugin; - setLayer(OverlayLayer.ABOVE_WIDGETS); - setPriority(OverlayPriority.HIGH); - setPosition(OverlayPosition.DETACHED); - panelComponent = new PanelComponent(); - } - - @Override - public Dimension render(Graphics2D graphics) - { - panelComponent.getChildren().clear(); - if (plugin.isDisplayGloryOverlay()) - { - panelComponent.setBackgroundColor(Color.lightGray); - final AsyncBufferedImage gloryImage = itemManager.getImage(ItemID.AMULET_OF_GLORY); - - panelComponent.getChildren().add(TitleComponent.builder() - .text("Uncharged Glory") - .color(Color.BLACK) - .build()); - - panelComponent.getChildren().add(new ImageComponent(gloryImage)); - } - - return panelComponent.render(graphics); - } -} 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 deleted file mode 100644 index 79e27928d8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/whalewatchers/WhaleWatchersOverlay.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019. PKLite - * 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 following authors: - * - * PKLite discord: https://discord.gg/Dp3HuFM - * Written by PKLite(ST0NEWALL, others) , 2019 - * - ******************************************************************************/ -package net.runelite.client.plugins.whalewatchers; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.MenuOpcode; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -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.ComponentOrientation; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -/** - * The overlay for the Damage Counter - */ - -@Singleton -public class WhaleWatchersOverlay extends Overlay -{ - private final Client client; - private final WhaleWatchersPlugin plugin; - private final PanelComponent panelComponent; - private String lastOpponent = "-"; - - - @Inject - public WhaleWatchersOverlay(final Client client, final WhaleWatchersPlugin plugin) - { - OverlayMenuEntry resetMenuEntry = new OverlayMenuEntry(MenuOpcode.RUNELITE_OVERLAY, - "Reset", "Damage Counter"); - this.getMenuEntries().add(resetMenuEntry); - this.client = client; - this.plugin = plugin; - setLayer(OverlayLayer.ABOVE_WIDGETS); - setPriority(OverlayPriority.HIGHEST); - setPosition(OverlayPosition.TOP_LEFT); - this.setPreferredPosition(OverlayPosition.TOP_LEFT); - panelComponent = new PanelComponent(); - } - - @Override - public Dimension render(Graphics2D graphics) - { - panelComponent.getChildren().clear(); - - if (plugin.inCombat && plugin.isShowDamageCounter()) - { - panelComponent.setOrientation(ComponentOrientation.HORIZONTAL); - panelComponent.setWrapping(5); - - lastOpponent = client.getLocalPlayer().getInteracting() != null ? - client.getLocalPlayer().getInteracting().getName() : lastOpponent; - - String damageTaken = "Damage Taken: " + plugin.damageTaken; - String damageDealt = "Damage Dealt: " + plugin.damageDone; - - panelComponent.getChildren().add(TitleComponent.builder() - .text(lastOpponent) - .build()); - - panelComponent.getChildren().add(TitleComponent.builder() - .text(damageDealt) - .build()); - - panelComponent.getChildren().add(TitleComponent.builder() - .text(damageTaken) - .build()); - } - else - { - panelComponent.getChildren().clear(); - } - - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/whalewatchers/WhaleWatchersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/whalewatchers/WhaleWatchersPlugin.java deleted file mode 100644 index c163110a76..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/whalewatchers/WhaleWatchersPlugin.java +++ /dev/null @@ -1,329 +0,0 @@ - -/* - * ****************************************************************************** - * * Copyright (c) 2019 openosrs - * * 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 - * * openosrs Discord: https://discord.gg/Q7wFtCe - * * openosrs website: https://openosrs.com - * ***************************************************************************** - */ - -package net.runelite.client.plugins.whalewatchers; - -import com.google.inject.Provides; -import java.util.EnumSet; -import java.util.Objects; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.InventoryID; -import net.runelite.api.ItemID; -import net.runelite.api.MenuOpcode; -import net.runelite.api.Skill; -import net.runelite.api.SkullIcon; -import net.runelite.api.VarPlayer; -import net.runelite.api.Varbits; -import net.runelite.api.WorldType; -import static net.runelite.api.WorldType.isPvpWorld; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.HitsplatApplied; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.kit.KitType; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.events.OverlayMenuClicked; -import net.runelite.client.game.Sound; -import net.runelite.client.game.SoundManager; -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 org.apache.commons.lang3.ObjectUtils; - -@PluginDescriptor( - name = "Whale Watchers", - description = "A Plugin to save help whales in the wild", - tags = {"whale watchers", "whale", "protect item", "warning", "pklite", "pneck"}, - type = PluginType.PVP, - enabledByDefault = false -) - -@Singleton -public class WhaleWatchersPlugin extends Plugin -{ - private static final String BROKEN_PNECK_MESSAGE = "Your phoenix necklace heals you, but is destroyed in the process."; - boolean protectItemOverlay = false; - int damageDone = 0; - int damageTaken = 0; - boolean inCombat = false; - - @Inject - private Client client; - - @Inject - private WhaleWatchersConfig config; - - @Inject - private WhaleWatchersOverlay overlay; - - @Inject - private WhaleWatchersProtOverlay whaleWatchersProtOverlay; - - @Inject - private WhaleWatchersSmiteableOverlay whaleWatchersSmiteableOverlay; - - @Inject - private WhaleWatchersGloryOverlay whaleWatchersGloryOverlay; - - @Inject - private OverlayManager overlayManager; - - @Inject - private SoundManager soundManager; - - private int tickCountdown = 0; - @Getter(AccessLevel.PACKAGE) - private boolean displaySmiteOverlay; - @Getter(AccessLevel.PACKAGE) - private boolean displayGloryOverlay; - @Getter(AccessLevel.PACKAGE) - private boolean protectItemWarning; - @Getter(AccessLevel.PACKAGE) - private boolean lessObnoxiousProtWarning; - @Getter(AccessLevel.PACKAGE) - private boolean showDamageCounter; - private boolean smiteableWarning; - private boolean gloryWarning; - private boolean pneckBreak; - - @Provides - WhaleWatchersConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(WhaleWatchersConfig.class); - } - - @Subscribe - private void onOverlayMenuClicked(OverlayMenuClicked event) - { - if (event.getOverlay().equals(overlay) && event.getEntry().getOption().equals("Reset")) - { - resetDamageCounter(); - } - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - overlayManager.add(whaleWatchersProtOverlay); - overlayManager.add(whaleWatchersSmiteableOverlay); - overlayManager.add(whaleWatchersGloryOverlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - overlayManager.remove(whaleWatchersProtOverlay); - overlayManager.remove(whaleWatchersSmiteableOverlay); - overlayManager.remove(whaleWatchersGloryOverlay); - resetDamageCounter(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("WhaleWatchers")) - { - return; - } - - updateConfig(); - - if (!this.protectItemWarning) - { - protectItemOverlay = false; - } - if (!this.gloryWarning) - { - displayGloryOverlay = false; - } - if (!this.smiteableWarning) - { - displaySmiteOverlay = false; - } - } - - @Subscribe - private void onChatMessage(ChatMessage event) - { - if (this.pneckBreak && event.getType() == ChatMessageType.GAMEMESSAGE && event.getMessage().equals(BROKEN_PNECK_MESSAGE)) - { - soundManager.playSound(Sound.BREAK); - } - } - - @Subscribe - private void onHitsplatApplied(HitsplatApplied event) - { - if (this.showDamageCounter) - { - if (!(event.getActor() == client.getLocalPlayer() || - event.getActor() == client.getLocalPlayer().getInteracting())) - { - return; - } - if (isAttackingPlayer() || inCombat) - { - inCombat = true; - if (event.getActor() == client.getLocalPlayer()) - { - damageTaken += event.getHitsplat().getAmount(); - } - if (event.getActor() == client.getLocalPlayer().getInteracting()) - { - damageDone += event.getHitsplat().getAmount(); - } - } - } - } - - @Subscribe - private void onItemContainerChanged(ItemContainerChanged event) - { - if (this.gloryWarning && event.getItemContainer() == client.getItemContainer(InventoryID.EQUIPMENT)) - { - final int amuletID = ObjectUtils.defaultIfNull(client.getLocalPlayer() - .getPlayerAppearance().getEquipmentId(KitType.AMULET), 0); - displayGloryOverlay = amuletID == ItemID.AMULET_OF_GLORY; - } - else - { - displayGloryOverlay = false; - } - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked event) - { - if (this.showDamageCounter && event.getMenuOpcode().equals(MenuOpcode.SPELL_CAST_ON_PLAYER)) - { - inCombat = true; - } - } - - @Subscribe - private void onVarbitChanged(VarbitChanged event) - { - if (this.showDamageCounter && client.getVar(VarPlayer.ATTACKING_PLAYER) == -1 && inCombat) - { - tickCountdown = 10; - } - - if (this.protectItemWarning) - { - try - { - final SkullIcon skullIcon = Objects.requireNonNull(client.getLocalPlayer().getSkullIcon()); - final EnumSet worldTypes = client.getWorldType(); - if (WorldType.isHighRiskWorld(worldTypes)) - { - protectItemOverlay = false; - return; - } - if (skullIcon.equals(SkullIcon.SKULL)) - { - if (WorldType.isPvpWorld(worldTypes) || WorldType.isDeadmanWorld(worldTypes) || - client.getVar(Varbits.IN_WILDERNESS) == 1) - { - protectItemOverlay = client.getRealSkillLevel(Skill.PRAYER) > 25 && - client.getVar(Varbits.PRAYER_PROTECT_ITEM) == 0; - } - else - { - protectItemOverlay = false; - } - } - } - catch (NullPointerException e) - { - // local player isn't skulled - } - - } - } - - @Subscribe - private void onGameTick(GameTick event) - { - if (this.showDamageCounter && tickCountdown > 0 && tickCountdown < 11) - { - tickCountdown--; - if (tickCountdown == 1) - { - inCombat = false; - resetDamageCounter(); - return; - } - } - if (this.smiteableWarning && (client.getVar(Varbits.IN_WILDERNESS) == 1 || isPvpWorld(client.getWorldType()))) - { - if (client.getLocalPlayer().getSkullIcon() != null && client.getLocalPlayer().getSkullIcon().equals(SkullIcon.SKULL)) - { - final int currentHealth = client.getLocalPlayer().getHealth(); - final int currentPrayer = client.getBoostedSkillLevel(Skill.PRAYER); - displaySmiteOverlay = currentPrayer <= (Math.ceil(currentHealth / 4)); - } - else - { - displaySmiteOverlay = false; - } - } - else - { - displaySmiteOverlay = false; - } - } - - /** - * Checks to see if client is attacking another player - * - * @return returns true if they are, false otherwise - */ - private boolean isAttackingPlayer() - { - if (client.getVar(Varbits.IN_WILDERNESS) == 1 && client.getLocalPlayer().getInteracting() != null) - { - return true; - } - int varp = client.getVar(VarPlayer.ATTACKING_PLAYER); - return varp != -1; - } - - private void resetDamageCounter() - { - damageTaken = 0; - damageDone = 0; - } - - private void updateConfig() - { - this.protectItemWarning = config.protectItemWarning(); - this.lessObnoxiousProtWarning = config.lessObnoxiousProtWarning(); - this.showDamageCounter = config.showDamageCounter(); - this.smiteableWarning = config.smiteableWarning(); - this.gloryWarning = config.gloryWarning(); - this.pneckBreak = config.pneckBreak(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/whalewatchers/WhaleWatchersProtOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/whalewatchers/WhaleWatchersProtOverlay.java deleted file mode 100644 index 7f461c8e23..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/whalewatchers/WhaleWatchersProtOverlay.java +++ /dev/null @@ -1,79 +0,0 @@ - -/* - * ****************************************************************************** - * * Copyright (c) 2019 openosrs - * * 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 - * * openosrs Discord: https://discord.gg/Q7wFtCe - * * openosrs website: https://openosrs.com - * ***************************************************************************** - */ - -package net.runelite.client.plugins.whalewatchers; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.Stroke; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import net.runelite.api.Point; -import net.runelite.client.ui.FontManager; -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; - -@Singleton -public class WhaleWatchersProtOverlay extends Overlay -{ - - private final Client client; - private final WhaleWatchersPlugin plugin; - - @Inject - public WhaleWatchersProtOverlay(final Client client, final WhaleWatchersPlugin plugin) - { - this.client = client; - this.plugin = plugin; - setLayer(OverlayLayer.ABOVE_WIDGETS); - setPriority(OverlayPriority.HIGH); - setPosition(OverlayPosition.DYNAMIC); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.protectItemOverlay && plugin.isProtectItemWarning()) - { - Rectangle rectangle = new Rectangle(); - rectangle.setBounds(client.getCanvas().getBounds()); - rectangle.setLocation(client.getCanvas().getLocation()); - Stroke oldStroke = graphics.getStroke(); - if (plugin.isLessObnoxiousProtWarning()) - { - graphics.setStroke(new BasicStroke(3)); - } - else - { - graphics.setStroke(new BasicStroke(10)); - } - graphics.setColor(Color.RED); - graphics.draw(rectangle); - if (!plugin.isLessObnoxiousProtWarning()) - { - Font font = FontManager.getRunescapeBoldFont().deriveFont(Font.BOLD, 72); - graphics.setFont(font); - OverlayUtil.renderTextLocation(graphics, new Point((int) rectangle.getCenterX() - 50, font.getSize()), "Protect item prayer disabled!!!", Color.red); - } - graphics.setStroke(oldStroke); - } - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/whalewatchers/WhaleWatchersSmiteableOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/whalewatchers/WhaleWatchersSmiteableOverlay.java deleted file mode 100644 index 4a5b434900..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/whalewatchers/WhaleWatchersSmiteableOverlay.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019. PKLite - * 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 following authors: - * - * PKLite discord: https://discord.gg/Dp3HuFM - * Written by PKLite(ST0NEWALL, others) , 2019 - * - ******************************************************************************/ - -package net.runelite.client.plugins.whalewatchers; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -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.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -/** - * The overlay for the smiteable warning - */ -@Singleton -public class WhaleWatchersSmiteableOverlay extends Overlay -{ - private final WhaleWatchersPlugin plugin; - private final PanelComponent panelComponent; - - - @Inject - public WhaleWatchersSmiteableOverlay(final WhaleWatchersPlugin plugin) - { - this.plugin = plugin; - setLayer(OverlayLayer.ABOVE_WIDGETS); - setPriority(OverlayPriority.HIGH); - setPosition(OverlayPosition.BOTTOM_RIGHT); - panelComponent = new PanelComponent(); - } - - @Override - public Dimension render(Graphics2D graphics) - { - String subText = "You could be smited in 1 tick"; - panelComponent.getChildren().clear(); - if (plugin.isDisplaySmiteOverlay()) - { - panelComponent.setBackgroundColor(Color.WHITE); - panelComponent.getChildren().add(TitleComponent.builder() - .text("LOW PRAYER WARNING") - .color(Color.BLACK) - .build()); - panelComponent.getChildren().add(TitleComponent.builder() - .text(subText) - .color(Color.BLACK) - .build()); - - panelComponent.setPreferredSize(new Dimension(graphics.getFontMetrics().stringWidth(subText) - + 20, 0)); - } - else - { - panelComponent.getChildren().clear(); - } - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java deleted file mode 100644 index 868d8b2a83..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiPlugin.java +++ /dev/null @@ -1,425 +0,0 @@ -/* - * 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.wiki; - -import javax.inject.Inject; -import javax.inject.Provider; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.MenuEntry; -import net.runelite.api.MenuOpcode; -import net.runelite.api.NPC; -import net.runelite.api.NPCDefinition; -import net.runelite.api.ObjectDefinition; -import net.runelite.api.SpriteID; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.WidgetHiddenChanged; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.JavaScriptCallback; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetConfig; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.api.widgets.WidgetPositionMode; -import net.runelite.api.widgets.WidgetType; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.util.LinkBrowser; -import okhttp3.HttpUrl; -import org.apache.commons.lang3.StringUtils; -import org.jetbrains.annotations.Nullable; - -@Slf4j -@PluginDescriptor( - name = "Wiki", - description = "Adds a Wiki button that takes you to the OSRS Wiki", - type = PluginType.UTILITY -) -public class WikiPlugin extends Plugin -{ - private static final int[] QUESTLIST_WIDGET_IDS = new int[] - { - WidgetInfo.QUESTLIST_FREE_CONTAINER.getId(), - WidgetInfo.QUESTLIST_MEMBERS_CONTAINER.getId(), - WidgetInfo.QUESTLIST_MINIQUEST_CONTAINER.getId(), - }; - - static final HttpUrl WIKI_BASE = HttpUrl.parse("https://oldschool.runescape.wiki"); - static final HttpUrl WIKI_API = WIKI_BASE.newBuilder().addPathSegments("api.php").build(); - static final String UTM_SOURCE_KEY = "utm_source"; - static final String UTM_SOURCE_VALUE = "runelite"; - - private static final String MENUOP_GUIDE = "Guide"; - private static final String MENUOP_QUICKGUIDE = "Quick Guide"; - private static final String MENUOP_WIKI = "Wiki"; - - @Inject - private SpriteManager spriteManager; - - @Inject - private ClientThread clientThread; - - @Inject - private Client client; - - @Inject - private ItemManager itemManager; - - @Inject - private Provider wikiSearchChatboxTextInputProvider; - - private Widget icon; - - private boolean wikiSelected = false; - - @Override - public void startUp() - { - clientThread.invokeLater(this::addWidgets); - } - - @Override - public void shutDown() - { - clientThread.invokeLater(() -> - { - Widget minimapOrbs = client.getWidget(WidgetInfo.MINIMAP_ORBS); - if (minimapOrbs == null) - { - return; - } - Widget[] children = minimapOrbs.getChildren(); - if (children == null || children.length < 1) - { - return; - } - children[0] = null; - - Widget vanilla = client.getWidget(WidgetInfo.MINIMAP_WIKI_BANNER); - if (vanilla != null) - { - vanilla.setHidden(false); - } - - onDeselect(); - client.setSpellSelected(false); - }); - } - - @Subscribe - private void onWidgetLoaded(WidgetLoaded l) - { - if (l.getGroupId() == WidgetID.MINIMAP_GROUP_ID) - { - addWidgets(); - } - } - - private void addWidgets() - { - Widget minimapOrbs = client.getWidget(WidgetInfo.MINIMAP_ORBS); - if (minimapOrbs == null) - { - return; - } - - Widget vanilla = client.getWidget(WidgetInfo.MINIMAP_WIKI_BANNER); - if (vanilla != null) - { - vanilla.setHidden(true); - } - - icon = minimapOrbs.createChild(0, WidgetType.GRAPHIC); - icon.setSpriteId(SpriteID.WIKI_DESELECTED); - icon.setOriginalX(0); - icon.setOriginalY(0); - icon.setXPositionMode(WidgetPositionMode.ABSOLUTE_RIGHT); - icon.setYPositionMode(WidgetPositionMode.ABSOLUTE_BOTTOM); - icon.setOriginalWidth(40); - icon.setOriginalHeight(14); - icon.setTargetVerb("Lookup"); - icon.setName("Wiki"); - icon.setClickMask(WidgetConfig.USE_GROUND_ITEM | WidgetConfig.USE_ITEM | WidgetConfig.USE_NPC - | WidgetConfig.USE_OBJECT | WidgetConfig.USE_WIDGET); - icon.setNoClickThrough(true); - icon.setOnTargetEnterListener((JavaScriptCallback) ev -> - { - wikiSelected = true; - icon.setSpriteId(SpriteID.WIKI_SELECTED); - client.setAllWidgetsAreOpTargetable(true); - }); - icon.setAction(5, "Search"); // Start at option 5 so the target op is ontop - icon.setOnOpListener((JavaScriptCallback) ev -> - { - if (ev.getOp() == 6) - { - openSearchInput(); - } - }); - // This doesn't always run because we cancel the menuop - icon.setOnTargetLeaveListener((JavaScriptCallback) ev -> onDeselect()); - icon.revalidate(); - } - - @Subscribe - private void onWidgetHiddenChanged(WidgetHiddenChanged ev) - { - if (ev.getWidget().getId() == WidgetInfo.MINIMAP_WIKI_BANNER.getId()) - { - ev.getWidget().setHidden(true); - } - } - - private void onDeselect() - { - client.setAllWidgetsAreOpTargetable(false); - - wikiSelected = false; - if (icon != null) - { - icon.setSpriteId(SpriteID.WIKI_DESELECTED); - } - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked ev) - { - if (ev.getMenuOpcode() == MenuOpcode.RUNELITE) - { - checkQuestClicked(ev); - } - - if (!wikiSelected) - { - return; - } - - onDeselect(); - client.setSpellSelected(false); - ev.consume(); - - String type; - int id; - String name; - WorldPoint location; - - switch (ev.getMenuOpcode()) - { - case RUNELITE: - case CANCEL: - return; - case ITEM_USE_ON_WIDGET: - case SPELL_CAST_ON_GROUND_ITEM: - { - type = "item"; - id = itemManager.canonicalize(ev.getIdentifier()); - name = itemManager.getItemDefinition(id).getName(); - location = null; - break; - } - case SPELL_CAST_ON_NPC: - { - type = "npc"; - NPC npc = client.getCachedNPCs()[ev.getIdentifier()]; - NPCDefinition nc = npc.getTransformedDefinition(); - id = nc.getId(); - name = nc.getName(); - location = npc.getWorldLocation(); - break; - } - case SPELL_CAST_ON_GAME_OBJECT: - { - type = "object"; - ObjectDefinition lc = client.getObjectDefinition(ev.getIdentifier()); - if (lc.getImpostorIds() != null) - { - lc = lc.getImpostor(); - } - id = lc.getId(); - name = lc.getName(); - location = WorldPoint.fromScene(client, ev.getParam0(), ev.getParam1(), client.getPlane()); - break; - } - case SPELL_CAST_ON_WIDGET: - { - Widget w = getWidget(ev.getParam1(), ev.getParam0()); - - if (w.getType() == WidgetType.GRAPHIC && w.getItemId() != -1) - { - type = "item"; - id = itemManager.canonicalize(w.getItemId()); - name = itemManager.getItemDefinition(id).getName(); - location = null; - break; - } - } - // fallthrough - default: - log.info("Unknown menu option: {} {} {}", ev, ev.getMenuOpcode(), ev.getMenuOpcode() == MenuOpcode.CANCEL); - return; - } - - name = Text.removeTags(name); - HttpUrl.Builder urlBuilder = WIKI_BASE.newBuilder(); - urlBuilder.addPathSegments("w/Special:Lookup") - .addQueryParameter("type", type) - .addQueryParameter("id", "" + id) - .addQueryParameter("name", name) - .addQueryParameter(UTM_SOURCE_KEY, UTM_SOURCE_VALUE); - - if (location != null) - { - urlBuilder.addQueryParameter("x", "" + location.getX()) - .addQueryParameter("y", "" + location.getY()) - .addQueryParameter("plane", "" + location.getPlane()); - } - - HttpUrl url = urlBuilder.build(); - - LinkBrowser.browse(url.toString()); - } - - private void checkQuestClicked(MenuOptionClicked ev) - { - boolean quickguide = false; - switch (ev.getOption()) - { - case MENUOP_QUICKGUIDE: - quickguide = true; - //fallthrough; - case MENUOP_GUIDE: - ev.consume(); - String quest = Text.removeTags(ev.getTarget()); - HttpUrl.Builder ub = WIKI_BASE.newBuilder() - .addPathSegment("w") - .addPathSegment(quest) - .addQueryParameter(UTM_SOURCE_KEY, UTM_SOURCE_VALUE); - if (quickguide) - { - ub.addPathSegment("Quick_guide"); - } - LinkBrowser.browse(ub.build().toString()); - break; - case MENUOP_WIKI: - LinkBrowser.browse(WIKI_BASE.newBuilder() - .addPathSegment("w") - .addPathSegment(Text.removeTags(ev.getTarget())) - .addQueryParameter(UTM_SOURCE_KEY, UTM_SOURCE_VALUE) - .build().toString()); - } - } - - private void openSearchInput() - { - wikiSearchChatboxTextInputProvider.get() - .build(); - } - - @Subscribe - private void onMenuEntryAdded(MenuEntryAdded event) - { - int widgetIndex = event.getParam0(); - int widgetID = event.getParam1(); - - if (wikiSelected && event.getOpcode() == MenuOpcode.SPELL_CAST_ON_WIDGET.getId()) - { - Widget w = getWidget(widgetID, widgetIndex); - if (!(w.getType() == WidgetType.GRAPHIC && w.getItemId() != -1)) - { - // we don't support this widget - // remove the last SPELL_CAST_ON_WIDGET; we can't blindly remove the top action because some other - // plugin might have added something on this same event, and we probably shouldn't remove that instead - MenuEntry[] menuEntries = client.getMenuEntries(); - for (int i = menuEntries.length - 1; i >= 0; i--) - { - if (menuEntries[i].getOpcode() == MenuOpcode.SPELL_CAST_ON_WIDGET.getId()) - { - menuEntries[i] = null; - client.setMenuEntries(menuEntries); - break; - } - } - } - } - - if (WidgetInfo.TO_GROUP(widgetID) == WidgetInfo.SKILLS_CONTAINER.getGroupId() - && event.getOption().contains("View")) - { - Widget w = getWidget(widgetID, widgetIndex); - if (w.getParentId() != WidgetInfo.SKILLS_CONTAINER.getId()) - { - return; - } - - String action = firstAction(w); - if (action == null) - { - return; - } - - client.insertMenuItem( - MENUOP_WIKI, - action.replace("View ", "").replace("Guide ", ""), - MenuOpcode.RUNELITE.getId(), - 0, - widgetIndex, - widgetID, - false - ); - } - } - - private Widget getWidget(int wid, int index) - { - Widget w = client.getWidget(WidgetInfo.TO_GROUP(wid), WidgetInfo.TO_CHILD(wid)); - if (index != -1) - { - w = w.getChild(index); - } - return w; - } - - @Nullable - private static String firstAction(Widget widget) - { - for (String action : widget.getActions()) - { - if (StringUtils.isNotEmpty(action)) - { - return action; - } - } - - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSearchChatboxTextInput.java b/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSearchChatboxTextInput.java deleted file mode 100644 index 78b6113e23..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wiki/WikiSearchChatboxTextInput.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * 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.wiki; - -import com.google.common.collect.ImmutableList; -import com.google.common.reflect.TypeToken; -import com.google.gson.Gson; -import com.google.gson.JsonArray; -import com.google.gson.JsonParseException; -import com.google.gson.JsonParser; -import com.google.inject.Inject; -import java.awt.event.KeyEvent; -import java.io.IOException; -import java.util.List; -import java.util.concurrent.Future; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import javax.inject.Named; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.widgets.JavaScriptCallback; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetPositionMode; -import net.runelite.api.widgets.WidgetSizeMode; -import net.runelite.api.widgets.WidgetTextAlignment; -import net.runelite.api.widgets.WidgetType; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.game.chatbox.ChatboxPanelManager; -import net.runelite.client.game.chatbox.ChatboxTextInput; -import net.runelite.client.util.LinkBrowser; -import net.runelite.http.api.RuneLiteAPI; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.Response; -import org.jetbrains.annotations.NotNull; - -@Slf4j -public class WikiSearchChatboxTextInput extends ChatboxTextInput -{ - private static final int LINE_HEIGHT = 20; - private static final int CHATBOX_HEIGHT = 120; - private static final int MAX_NUM_PREDICTIONS = (CHATBOX_HEIGHT / LINE_HEIGHT) - 2; // 1 title, 1 edit - - private static final int PREDICTION_DEBOUNCE_DELAY_MS = 200; - - private final ChatboxPanelManager chatboxPanelManager; - private final Gson gson = new Gson(); - - private Future runningRequest = null; - private List predictions = ImmutableList.of(); - - private int selectedPrediction = -1; - private String offPrediction = null; - - @Inject - public WikiSearchChatboxTextInput(final ChatboxPanelManager chatboxPanelManager, final ClientThread clientThread, final ScheduledExecutorService scheduledExecutorService, @Named("developerMode") final boolean developerMode) - { - super(chatboxPanelManager, clientThread); - this.chatboxPanelManager = chatboxPanelManager; - - lines(1); - prompt("OSRS Wiki Search"); - onDone(string -> - { - if (string != null && string.length() > 0) - { - search(string); - } - }); - onChanged(searchString -> - { - selectedPrediction = -1; - Future rr = runningRequest; - if (rr != null) - { - rr.cancel(false); - } - if (searchString.length() <= 1) - { - runningRequest = null; - clientThread.invokeLater(() -> - { - predictions = ImmutableList.of(); - update(); - }); - return; - } - runningRequest = scheduledExecutorService.schedule(() -> - { - HttpUrl url = WikiPlugin.WIKI_API.newBuilder() - .addQueryParameter("action", "opensearch") - .addQueryParameter("search", searchString) - .addQueryParameter("redirects", "resolve") - .addQueryParameter("format", "json") - .addQueryParameter("warningsaserror", Boolean.toString(developerMode)) - .build(); - - Request req = new Request.Builder() - .url(url) - .build(); - - RuneLiteAPI.CLIENT.newCall(req).enqueue(new Callback() - { - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) - { - log.warn("error searching wiki", e); - } - - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException - { - String body = response.body().string(); - try - { - JsonArray jar = new JsonParser().parse(body).getAsJsonArray(); - List apredictions = gson.fromJson(jar.get(1), new TypeToken>() {}.getType()); - - if (apredictions.size() > MAX_NUM_PREDICTIONS) - { - apredictions = apredictions.subList(0, MAX_NUM_PREDICTIONS); - } - - final List bpredictions = apredictions; - - clientThread.invokeLater(() -> - { - predictions = bpredictions; - update(); - }); - } - catch (JsonParseException | IllegalStateException | IndexOutOfBoundsException e) - { - log.warn("error parsing wiki response {}", body, e); - } - finally - { - response.close(); - } - } - }); - - runningRequest = null; - }, PREDICTION_DEBOUNCE_DELAY_MS, TimeUnit.MILLISECONDS); - }); - } - - @Override - protected void update() - { - Widget container = chatboxPanelManager.getContainerWidget(); - container.deleteAllChildren(); - - Widget promptWidget = container.createChild(-1, WidgetType.TEXT); - promptWidget.setText(getPrompt()); - promptWidget.setTextColor(0x800000); - promptWidget.setFontId(getFontID()); - promptWidget.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER); - promptWidget.setOriginalX(0); - promptWidget.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP); - promptWidget.setOriginalY(5); - promptWidget.setOriginalHeight(LINE_HEIGHT); - promptWidget.setXTextAlignment(WidgetTextAlignment.CENTER); - promptWidget.setYTextAlignment(WidgetTextAlignment.CENTER); - promptWidget.setWidthMode(WidgetSizeMode.MINUS); - promptWidget.revalidate(); - - buildEdit(0, 5 + LINE_HEIGHT, container.getWidth(), LINE_HEIGHT); - - Widget separator = container.createChild(-1, WidgetType.LINE); - separator.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER); - separator.setOriginalX(0); - separator.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP); - separator.setOriginalY(4 + (LINE_HEIGHT * 2)); - separator.setOriginalHeight(0); - separator.setOriginalWidth(16); - separator.setWidthMode(WidgetSizeMode.MINUS); - separator.revalidate(); - - for (int i = 0; i < predictions.size(); i++) - { - String pred = predictions.get(i); - int y = 6 + (LINE_HEIGHT * (2 + i)); - - Widget bg = container.createChild(-1, WidgetType.RECTANGLE); - bg.setTextColor(0x4444DD); - bg.setFilled(true); - bg.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER); - bg.setOriginalX(1); - bg.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP); - bg.setOriginalY(y); - bg.setOriginalHeight(LINE_HEIGHT); - bg.setOriginalWidth(16); - bg.setWidthMode(WidgetSizeMode.MINUS); - bg.revalidate(); - bg.setName("" + pred); - bg.setAction(0, "Open"); - bg.setHasListener(true); - bg.setOnOpListener((JavaScriptCallback) ev -> search(pred)); - - Widget text = container.createChild(-1, WidgetType.TEXT); - text.setText(pred); - text.setFontId(getFontID()); - text.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER); - text.setOriginalX(0); - text.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP); - text.setOriginalY(y); - text.setOriginalHeight(LINE_HEIGHT); - text.setXTextAlignment(WidgetTextAlignment.CENTER); - text.setYTextAlignment(WidgetTextAlignment.CENTER); - text.setWidthMode(WidgetSizeMode.MINUS); - text.revalidate(); - - if (i == selectedPrediction) - { - text.setTextColor(0xFFFFFF); - } - else - { - bg.setOpacity(255); - text.setTextColor(0x000000); - bg.setOnMouseRepeatListener((JavaScriptCallback) ev -> text.setTextColor(0xFFFFFF)); - bg.setOnMouseLeaveListener((JavaScriptCallback) ev -> text.setTextColor(0x000000)); - } - } - } - - @Override - public void keyPressed(KeyEvent ev) - { - switch (ev.getKeyCode()) - { - case KeyEvent.VK_UP: - ev.consume(); - if (selectedPrediction > -1) - { - selectedPrediction--; - if (selectedPrediction == -1) - { - value(offPrediction); - } - else - { - value(predictions.get(selectedPrediction)); - } - } - break; - case KeyEvent.VK_DOWN: - ev.consume(); - - if (selectedPrediction == -1) - { - offPrediction = getValue(); - } - - selectedPrediction++; - if (selectedPrediction >= predictions.size()) - { - selectedPrediction = predictions.size() - 1; - } - - if (selectedPrediction != -1) - { - value(predictions.get(selectedPrediction)); - } - break; - default: - super.keyPressed(ev); - } - } - - private void search(String search) - { - LinkBrowser.browse(WikiPlugin.WIKI_BASE.newBuilder() - .addQueryParameter("search", search) - .addQueryParameter(WikiPlugin.UTM_SOURCE_KEY, WikiPlugin.UTM_SOURCE_VALUE) - .build() - .toString()); - chatboxPanelManager.close(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wildernesslocations/WildernessLocationsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/wildernesslocations/WildernessLocationsConfig.java deleted file mode 100644 index aa81aec5f1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wildernesslocations/WildernessLocationsConfig.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019 openosrs - * 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 - * openosrs Discord: https://discord.gg/Q7wFtCe - * openosrs website: https://openosrs.com - ******************************************************************************/ - -package net.runelite.client.plugins.wildernesslocations; - -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.Keybind; - -@ConfigGroup("wildernesslocations") -public interface WildernessLocationsConfig extends Config -{ - - @ConfigItem( - keyName = "drawOverlay", - name = "Draw Overlay", - description = "Configure drawing wilderness locations overlay", - position = 1 - ) - default boolean drawOverlay() - { - return true; - } - - @ConfigItem( - keyName = "pvpWorld", - name = "PvP World", - description = "When enabled, shows location when anywhere in a PvP World", - position = 2 - ) - default boolean pvpWorld() - { - return true; - } - - @ConfigItem( - keyName = "keybind", - name = "Send to CC", - description = "Configure button to send current location to CC", - position = 3 - ) - default Keybind keybind() - { - return Keybind.NOT_SET; - } - - @ConfigItem( - keyName = "worldMapNames", - name = "Show Loc Names World Map", - description = "Toggles whether or not Wilderness Location names are shown on the World Map", - position = 4 - ) - default boolean worldMapOverlay() - { - return true; - } - - @ConfigItem( - keyName = "outlineLocations", - name = "Outline Locations", - description = "Draws an outline for the area of each location in the wilderness", - position = 5 - ) - default boolean outlineLocations() - { - return false; - } - - @ConfigItem( - keyName = "mapOverlayColor", - name = "World Map Color", - description = "The color for the names and outlines of the locations on the World Map", - position = 6 - ) - default Color mapOverlayColor() - { - return Color.cyan; - } - - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wildernesslocations/WildernessLocationsMapOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/wildernesslocations/WildernessLocationsMapOverlay.java deleted file mode 100644 index 037e1903ee..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wildernesslocations/WildernessLocationsMapOverlay.java +++ /dev/null @@ -1,228 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019 openosrs - * 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 - * openosrs Discord: https://discord.gg/Q7wFtCe - * openosrs website: https://openosrs.com - ******************************************************************************/ - -package net.runelite.client.plugins.wildernesslocations; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.geom.Area; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.Point; -import net.runelite.api.RenderOverview; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.game.WorldLocation; -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; - -public class WildernessLocationsMapOverlay extends Overlay -{ - private final Client client; - private final WildernessLocationsPlugin plugin; - - @Inject - private WildernessLocationsMapOverlay(Client client, WildernessLocationsPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGH); - setLayer(OverlayLayer.ABOVE_MAP); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isWorldMapOverlay()) - { - return null; - } - drawWildLocations(graphics); - return null; - } - - - /** - * Draws the names of the wilderness WorldLocations on the World Map - * - * @param graphics - Overlay graphics - */ - private void drawWildLocations(Graphics2D graphics) - { - final Widget widget = client.getWidget(WidgetInfo.WORLD_MAP_VIEW); - if (widget == null) - { - return; - } - - final Rectangle worldMapRectangle = widget.getBounds(); - final Rectangle canvasBounds = client.getCanvas().getBounds(); - canvasBounds.setLocation(0, 0); - - graphics.setClip(worldMapRectangle); - - for (WorldLocation worldLocation : WorldLocation.getWildernessLocations()) - { - final int x1 = worldLocation.getWorldArea().getX(); - final int x2 = worldLocation.getWorldArea().getX() + worldLocation.getWorldArea().getWidth(); - final int y1 = worldLocation.getWorldArea().getY(); - final int y2 = worldLocation.getWorldArea().getY() + worldLocation.getWorldArea().getHeight(); - final int plane = worldLocation.getWorldArea().getPlane(); - final Point point = mapWorldPointToGraphicsPoint(new WorldPoint(x1, y1, plane)); - final Point point1 = mapWorldPointToGraphicsPoint(new WorldPoint(x2, y2, plane)); - if (point == null || point1 == null) - { - continue; - } - int width = point1.getX() - point.getX(); - int height = point.getY() - point1.getY(); - - - Rectangle rectangle = new Rectangle(point.getX(), point.getY(), width, height); - - // These would be unreadable unless font color is black - if (worldLocation.equals(WorldLocation.ICE_GATE) || worldLocation.equals(WorldLocation.ICE_ROCK)) - { - graphics.setColor(Color.BLACK); - if (plugin.isWorldMapNames()) - { - graphics.drawString(worldLocation.getName(), point.getX(), point1.getY()); - } - if (plugin.isOutlineLocations()) - { - graphics.draw(rectangle); - } - } - else - { - graphics.setColor(plugin.getMapOverlayColor()); - if (plugin.isWorldMapNames()) - { - graphics.drawString(worldLocation.getName(), point.getX(), point.getY()); - } - if (plugin.isOutlineLocations()) - { - graphics.draw(rectangle); - } - } - } - } - - - /** - * Get the screen coordinates for a WorldPoint on the world map - * - * @param worldPoint WorldPoint to get screen coordinates of - * @return Point of screen coordinates of the center of the world point - */ - private Point mapWorldPointToGraphicsPoint(WorldPoint worldPoint) - { - RenderOverview ro = client.getRenderOverview(); - - if (!ro.getWorldMapData().surfaceContainsPosition(worldPoint.getX(), worldPoint.getY())) - { - return null; - } - - float pixelsPerTile = ro.getWorldMapZoom(); - - Widget map = client.getWidget(WidgetInfo.WORLD_MAP_VIEW); - if (map != null) - { - Rectangle worldMapRect = map.getBounds(); - - int widthInTiles = (int) Math.ceil(worldMapRect.getWidth() / pixelsPerTile); - int heightInTiles = (int) Math.ceil(worldMapRect.getHeight() / pixelsPerTile); - - Point worldMapPosition = ro.getWorldMapPosition(); - - //Offset in tiles from anchor sides - int yTileMax = worldMapPosition.getY() - heightInTiles / 2; - int yTileOffset = (yTileMax - worldPoint.getY() - 1) * -1; - int xTileOffset = worldPoint.getX() + widthInTiles / 2 - worldMapPosition.getX(); - - int xGraphDiff = ((int) (xTileOffset * pixelsPerTile)); - int yGraphDiff = (int) (yTileOffset * pixelsPerTile); - - //Center on tile. - yGraphDiff -= pixelsPerTile - Math.ceil(pixelsPerTile / 2); - xGraphDiff += pixelsPerTile - Math.ceil(pixelsPerTile / 2); - - yGraphDiff = worldMapRect.height - yGraphDiff; - yGraphDiff += (int) worldMapRect.getY(); - xGraphDiff += (int) worldMapRect.getX(); - - return new Point(xGraphDiff, yGraphDiff); - } - return null; - } - - /** - * Gets a clip area which excludes the area of widgets which overlay the world map. - * - * @param baseRectangle The base area to clip from - * @return An {@link Area} representing baseRectangle, with the area - * of visible widgets overlaying the world map clipped from it. - */ - public Area getWorldMapClipArea(Rectangle baseRectangle) - { - final Widget overview = client.getWidget(WidgetInfo.WORLD_MAP_OVERVIEW_MAP); - final Widget surfaceSelector = client.getWidget(WidgetInfo.WORLD_MAP_SURFACE_SELECTOR); - - Area clipArea = new Area(baseRectangle); - - if (overview != null && !overview.isHidden()) - { - clipArea.subtract(new Area(overview.getBounds())); - } - - if (surfaceSelector != null && !surfaceSelector.isHidden()) - { - clipArea.subtract(new Area(surfaceSelector.getBounds())); - } - - return clipArea; - } - - private Point clipToRectangle(Point drawPoint, Rectangle mapDisplayRectangle) - { - int clippedX = drawPoint.getX(); - - if (drawPoint.getX() < mapDisplayRectangle.getX()) - { - clippedX = (int) mapDisplayRectangle.getX(); - } - - if (drawPoint.getX() > mapDisplayRectangle.getX() + mapDisplayRectangle.getWidth()) - { - clippedX = (int) (mapDisplayRectangle.getX() + mapDisplayRectangle.getWidth()); - } - - int clippedY = drawPoint.getY(); - - if (drawPoint.getY() < mapDisplayRectangle.getY()) - { - clippedY = (int) mapDisplayRectangle.getY(); - } - - if (drawPoint.getY() > mapDisplayRectangle.getY() + mapDisplayRectangle.getHeight()) - { - clippedY = (int) (mapDisplayRectangle.getY() + mapDisplayRectangle.getHeight()); - } - - return new Point(clippedX, clippedY); - } - -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wildernesslocations/WildernessLocationsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/wildernesslocations/WildernessLocationsOverlay.java deleted file mode 100644 index 3a87600da7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wildernesslocations/WildernessLocationsOverlay.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2019. PKLite - All Rights Reserved - * Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited. - * Proprietary and confidential. Refer to PKLite License file for more information on - * full terms of this copyright and to determine what constitutes authorized use. - * Written by PKLite(ST0NEWALL, others) , 2019 - * - */ - -package net.runelite.client.plugins.wildernesslocations; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -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.TextComponent; - -@Singleton -public class WildernessLocationsOverlay extends Overlay -{ - private final WildernessLocationsPlugin plugin; - private final TextComponent textComponent; - - @Inject - public WildernessLocationsOverlay(final WildernessLocationsPlugin plugin) - { - this.plugin = plugin; - setLayer(OverlayLayer.ABOVE_WIDGETS); - setPriority(OverlayPriority.HIGH); - setPosition(OverlayPosition.BOTTOM_RIGHT); - textComponent = new TextComponent(); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.isRenderLocation() && plugin.isDrawOverlay()) - { - textComponent.setText(plugin.getLocationString()); - return textComponent.render(graphics); - } - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wildernesslocations/WildernessLocationsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/wildernesslocations/WildernessLocationsPlugin.java deleted file mode 100644 index d62adba23a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wildernesslocations/WildernessLocationsPlugin.java +++ /dev/null @@ -1,228 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019 openosrs - * 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 - * openosrs Discord: https://discord.gg/Q7wFtCe - * openosrs website: https://openosrs.com - ******************************************************************************/ - -package net.runelite.client.plugins.wildernesslocations; - -import com.google.inject.Provides; -import java.awt.Color; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.Player; -import net.runelite.api.ScriptID; -import net.runelite.api.VarClientStr; -import net.runelite.api.Varbits; -import net.runelite.api.WorldType; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.VarClientStrChanged; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.config.Keybind; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.WorldLocation; -import net.runelite.client.input.KeyManager; -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.HotkeyListener; - -@Slf4j -@PluginDescriptor( - name = "Wild Locations", - description = "Indicates the players current location in the wild", - tags = {"Wildy", "Wilderness Location", "location", "loc", "pvp", "pklite"}, - type = PluginType.PVP, - enabledByDefault = false -) -@Singleton -public class WildernessLocationsPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - OverlayManager overlayManager; - - @Inject - private WildernessLocationsOverlay overlay = new WildernessLocationsOverlay(this); - - @Getter(AccessLevel.PACKAGE) - private boolean renderLocation; - - @Getter(AccessLevel.PACKAGE) - private String locationString = ""; - - @Inject - private ClientThread clientThread; - - @Inject - private WildernessLocationsConfig wildyConfig; - - @Inject - private KeyManager keyManager; - - @Inject - private WildernessLocationsMapOverlay wildernessLocationsMapOverlay; - - private String oldChat = ""; - private int currentCooldown = 0; - private WorldPoint worldPoint = null; - - private final HotkeyListener hotkeyListener = new HotkeyListener(() -> this.keybind) - { - @Override - public void hotkeyPressed() - { - sendLocToCC(); - } - }; - - @Getter(AccessLevel.PACKAGE) - private boolean drawOverlay; - private boolean pvpWorld; - private Keybind keybind; - @Getter(AccessLevel.PACKAGE) - private boolean worldMapNames; - @Getter(AccessLevel.PACKAGE) - private Color mapOverlayColor; - @Getter(AccessLevel.PACKAGE) - private boolean outlineLocations; - @Getter(AccessLevel.PACKAGE) - private boolean worldMapOverlay; - - - @Provides - WildernessLocationsConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(WildernessLocationsConfig.class); - } - - @Override - protected void startUp() - { - - updateConfig(); - - overlayManager.add(overlay); - overlayManager.add(wildernessLocationsMapOverlay); - keyManager.registerKeyListener(hotkeyListener); - } - - private void updateConfig() - { - this.drawOverlay = wildyConfig.drawOverlay(); - this.pvpWorld = wildyConfig.pvpWorld(); - this.keybind = wildyConfig.keybind(); - this.worldMapNames = wildyConfig.worldMapOverlay(); - this.mapOverlayColor = wildyConfig.mapOverlayColor(); - this.outlineLocations = wildyConfig.outlineLocations(); - this.worldMapOverlay = this.worldMapNames || this.outlineLocations; - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("wildernesslocations")) - { - return; - } - - updateConfig(); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - overlayManager.remove(wildernessLocationsMapOverlay); - keyManager.unregisterKeyListener(hotkeyListener); - } - - @Subscribe - private void onGameTick(GameTick event) - { - if (currentCooldown != 0) - { - currentCooldown--; - } - - renderLocation = (client.getVar(Varbits.IN_WILDERNESS) == 1 || (this.pvpWorld && WorldType.isAllPvpWorld(client.getWorldType()))); - - if (renderLocation) - { - final Player player = client.getLocalPlayer(); - if (player != null && player.getWorldLocation() != worldPoint) - { - locationString = WorldLocation.location(client.getLocalPlayer().getWorldLocation()); - worldPoint = client.getLocalPlayer().getWorldLocation(); - } - } - else - { - worldPoint = null; - locationString = ""; - } - } - - @Subscribe - private void onVarClientStrChanged(VarClientStrChanged varClient) - { - String newChat = client.getVar(VarClientStr.CHATBOX_TYPED_TEXT); - if (varClient.getIndex() == VarClientStr.CHATBOX_TYPED_TEXT.getIndex() && !newChat.equals(oldChat)) - { - oldChat = newChat; - } - } - - private boolean inClanChat() - { - return client.getWidget(WidgetInfo.CLAN_CHAT_TITLE) != null; - } - - private void sendMessage(String text) - { - int mode = 0; - if (inClanChat() && text.startsWith("/")) - { - mode = 2; - } - int finalMode = mode; - Runnable r = () -> - { - String cached = oldChat; - client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, text); - client.runScript(ScriptID.CHATBOX_INPUT, finalMode, text); - oldChat = cached; - client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, oldChat); - }; - clientThread.invoke(r); - } - - private void sendLocToCC() - { - if (currentCooldown != 0) - { - return; - } - String location = getLocationString(); - if (location.equals("")) - { - return; - } - sendMessage("/World: " + client.getWorld() + " Location: " + location); - currentCooldown = 30; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtActivity.java b/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtActivity.java deleted file mode 100644 index bf81e101be..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtActivity.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2018, terminatusx - * Copyright (c) 2018, 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.wintertodt; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -enum WintertodtActivity -{ - IDLE("IDLE"), - WOODCUTTING("Woodcutting"), - FLETCHING("Fletching"), - FEEDING_BRAZIER("Feeding"), - FIXING_BRAZIER("Fixing"), - LIGHTING_BRAZIER("Lighting"); - - private final String actionString; -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtConfig.java deleted file mode 100644 index 6b1adb7e9d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtConfig.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2018, terminatusx - * Copyright (c) 2018, 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.wintertodt; - -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.Range; -import net.runelite.client.plugins.wintertodt.config.WintertodtNotifyMode; - -@ConfigGroup("wintertodt") -public interface WintertodtConfig extends Config -{ - @ConfigItem( - position = 1, - keyName = "notifyCondition", - name = "Notify When", - description = "Configures when to send notifications" - ) - default WintertodtNotifyMode notifyCondition() - { - return WintertodtNotifyMode.ONLY_WHEN_INTERRUPTED; - } - - @ConfigItem( - position = 2, - keyName = "damageNotificationColor", - name = "Damage Notification Color", - description = "Color of damage notification text in chat" - ) - default Color damageNotificationColor() - { - return Color.CYAN; - } - - @ConfigItem( - position = 3, - keyName = "roundNotification", - name = "Wintertodt round notification", - description = "Notifies you before the round starts (in seconds)" - ) - @Range( - max = 60 - ) - default int roundNotification() - { - return 5; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtInterruptType.java b/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtInterruptType.java deleted file mode 100644 index 582cf55ed6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtInterruptType.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2018, terminatusx - * Copyright (c) 2018, 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.wintertodt; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -enum WintertodtInterruptType -{ - COLD("Damaged by Wintertodt Cold"), - SNOWFALL("Damaged by Wintertodt Snowfall"), - BRAZIER("Brazier Shattered"), - INVENTORY_FULL("Inventory full of Bruma Roots"), - OUT_OF_ROOTS("Out of Bruma Roots"), - FIXED_BRAZIER("Fixed Brazier"), - LIT_BRAZIER("Lit Brazier"), - BRAZIER_WENT_OUT("Brazier went out"); - - private final String interruptSourceString; -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtOverlay.java deleted file mode 100644 index 7093d610b9..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtOverlay.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2018, terminatusx - * Copyright (c) 2018, 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.wintertodt; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.Skill; -import static net.runelite.client.plugins.wintertodt.WintertodtPlugin.WINTERTODT_KINDLING_MULTIPLIER; -import static net.runelite.client.plugins.wintertodt.WintertodtPlugin.WINTERTODT_ROOTS_MULTIPLIER; -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.TableAlignment; -import net.runelite.client.ui.overlay.components.table.TableComponent; -import net.runelite.client.util.ColorUtil; - -@Singleton -class WintertodtOverlay extends Overlay -{ - @Inject - private Client client; - - private final WintertodtPlugin plugin; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - private WintertodtOverlay(final WintertodtPlugin plugin) - { - super(plugin); - this.plugin = plugin; - setPosition(OverlayPosition.BOTTOM_LEFT); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Wintertodt overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!plugin.isInWintertodt()) - { - return null; - } - - panelComponent.getChildren().clear(); - panelComponent.setPreferredSize(new Dimension(180, 0)); - - panelComponent.getChildren().add(TitleComponent.builder() - .text("Points in inventory") - .color(Color.WHITE) - .build()); - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - tableComponent.addRow(ColorUtil.prependColorTag("Status:", Color.WHITE), ColorUtil.prependColorTag(plugin.getCurrentActivity().getActionString(), plugin.getCurrentActivity() == WintertodtActivity.IDLE ? Color.RED : Color.GREEN)); - - int firemakingLvl = client.getRealSkillLevel(Skill.FIREMAKING); - - int rootsScore = plugin.getNumRoots() * WINTERTODT_ROOTS_MULTIPLIER; - int rootsXp = plugin.getNumRoots() * Math.round(2 + (3 * firemakingLvl)); - - tableComponent.addRow(ColorUtil.prependColorTag("Roots:", Color.WHITE), ColorUtil.prependColorTag(rootsScore + " pts (" + rootsXp + " xp)", plugin.getNumRoots() > 0 ? Color.GREEN : Color.RED)); - - int kindlingScore = plugin.getNumKindling() * WINTERTODT_KINDLING_MULTIPLIER; - long kindlingXp = plugin.getNumKindling() * Math.round(3.8 * firemakingLvl); - - tableComponent.addRow(ColorUtil.prependColorTag("Kindling:", Color.WHITE), ColorUtil.prependColorTag(kindlingScore + " pts (" + kindlingXp + " xp)", plugin.getNumKindling() > 0 ? Color.GREEN : Color.RED)); - tableComponent.addRow(ColorUtil.prependColorTag("Total:", Color.WHITE), ColorUtil.prependColorTag((rootsScore + kindlingScore) + " pts (" + (rootsXp + kindlingXp) + " xp)", (rootsScore + kindlingScore > 0) ? Color.GREEN : Color.RED)); - - 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/wintertodt/WintertodtPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtPlugin.java deleted file mode 100644 index 206f8774e1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtPlugin.java +++ /dev/null @@ -1,482 +0,0 @@ -/* - * Copyright (c) 2018, terminatusx - * Copyright (c) 2018, 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.wintertodt; - -import com.google.inject.Provides; -import java.awt.Color; -import java.time.Duration; -import java.time.Instant; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import static net.runelite.api.AnimationID.*; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import static net.runelite.api.ItemID.BRUMA_KINDLING; -import static net.runelite.api.ItemID.BRUMA_ROOT; -import net.runelite.api.MessageNode; -import net.runelite.api.Player; -import net.runelite.api.Varbits; -import net.runelite.api.events.AnimationChanged; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.VarbitChanged; -import net.runelite.client.Notifier; -import net.runelite.client.chat.ChatMessageManager; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.wintertodt.config.WintertodtNotifyMode; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.util.ColorUtil; - -@PluginDescriptor( - name = "Wintertodt", - description = "Show helpful information for the Wintertodt boss", - tags = {"minigame", "firemaking", "boss"}, - type = PluginType.MINIGAME -) -@Slf4j -@Singleton -public class WintertodtPlugin extends Plugin -{ - private static final int WINTERTODT_REGION = 6462; - - static final int WINTERTODT_ROOTS_MULTIPLIER = 10; - static final int WINTERTODT_KINDLING_MULTIPLIER = 25; - - @Inject - private Notifier notifier; - - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private WintertodtOverlay overlay; - - @Inject - private WintertodtConfig config; - - @Inject - private ChatMessageManager chatMessageManager; - - @Getter(AccessLevel.PACKAGE) - private WintertodtActivity currentActivity = WintertodtActivity.IDLE; - - @Getter(AccessLevel.PACKAGE) - private int numRoots; - - @Getter(AccessLevel.PACKAGE) - private int numKindling; - - @Getter(AccessLevel.PACKAGE) - private boolean isInWintertodt; - - private Instant lastActionTime; - - private int previousTimerValue; - private WintertodtNotifyMode notifyCondition; - private Color damageNotificationColor; - - @Provides - WintertodtConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(WintertodtConfig.class); - } - - @Override - protected void startUp() - { - this.notifyCondition = config.notifyCondition(); - this.damageNotificationColor = config.damageNotificationColor(); - - reset(); - overlayManager.add(overlay); - } - - @Override - protected void shutDown() throws Exception - { - super.shutDown(); - - overlayManager.remove(overlay); - reset(); - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("wintertodt")) - { - return; - } - - this.notifyCondition = config.notifyCondition(); - this.damageNotificationColor = config.damageNotificationColor(); - } - - private void reset() - { - numRoots = 0; - numKindling = 0; - currentActivity = WintertodtActivity.IDLE; - lastActionTime = null; - } - - private boolean isInWintertodtRegion() - { - if (client.getLocalPlayer() != null) - { - return client.getLocalPlayer().getWorldLocation().getRegionID() == WINTERTODT_REGION; - } - - return false; - } - - @Subscribe - private void onGameTick(GameTick gameTick) - { - if (!isInWintertodtRegion()) - { - if (isInWintertodt) - { - log.debug("Left Wintertodt!"); - reset(); - } - - isInWintertodt = false; - return; - } - - if (!isInWintertodt) - { - reset(); - log.debug("Entered Wintertodt!"); - } - isInWintertodt = true; - - checkActionTimeout(); - } - - @Subscribe - void onVarbitChanged(VarbitChanged varbitChanged) - { - int timerValue = client.getVar(Varbits.WINTERTODT_TIMER); - if (timerValue != previousTimerValue) - { - int timeToNotify = config.roundNotification(); - if (timeToNotify > 0) - { - int timeInSeconds = timerValue * 30 / 50; - int prevTimeInSeconds = previousTimerValue * 30 / 50; - - log.debug("Seconds left until round start: {}", timeInSeconds); - - if (prevTimeInSeconds > timeToNotify && timeInSeconds <= timeToNotify) - { - notifier.notify("Wintertodt round is about to start"); - } - } - - previousTimerValue = timerValue; - } - } - - private void checkActionTimeout() - { - if (currentActivity == WintertodtActivity.IDLE) - { - return; - } - - int currentAnimation = client.getLocalPlayer() != null ? client.getLocalPlayer().getAnimation() : -1; - if (currentAnimation != IDLE || lastActionTime == null) - { - return; - } - - Duration actionTimeout = Duration.ofSeconds(3); - Duration sinceAction = Duration.between(lastActionTime, Instant.now()); - - if (sinceAction.compareTo(actionTimeout) >= 0) - { - log.debug("Activity timeout!"); - currentActivity = WintertodtActivity.IDLE; - } - } - - @Subscribe - private void onChatMessage(ChatMessage chatMessage) - { - if (!isInWintertodt) - { - return; - } - - ChatMessageType chatMessageType = chatMessage.getType(); - - if (chatMessageType != ChatMessageType.GAMEMESSAGE && chatMessageType != ChatMessageType.SPAM) - { - return; - } - - MessageNode messageNode = chatMessage.getMessageNode(); - final WintertodtInterruptType interruptType; - - if (messageNode.getValue().startsWith("The cold of")) - { - interruptType = WintertodtInterruptType.COLD; - } - else if (messageNode.getValue().startsWith("The freezing cold attack")) - { - interruptType = WintertodtInterruptType.SNOWFALL; - } - else if (messageNode.getValue().startsWith("The brazier is broken and shrapnel")) - { - interruptType = WintertodtInterruptType.BRAZIER; - } - else if (messageNode.getValue().startsWith("You have run out of bruma roots")) - { - interruptType = WintertodtInterruptType.OUT_OF_ROOTS; - } - else if (messageNode.getValue().startsWith("Your inventory is too full")) - { - interruptType = WintertodtInterruptType.INVENTORY_FULL; - } - else if (messageNode.getValue().startsWith("You fix the brazier")) - { - interruptType = WintertodtInterruptType.FIXED_BRAZIER; - } - else if (messageNode.getValue().startsWith("You light the brazier")) - { - interruptType = WintertodtInterruptType.LIT_BRAZIER; - } - else if (messageNode.getValue().startsWith("The brazier has gone out.")) - { - interruptType = WintertodtInterruptType.BRAZIER_WENT_OUT; - } - else - { - return; - } - - boolean wasInterrupted = false; - boolean wasDamaged = false; - boolean neverNotify = false; - - switch (interruptType) - { - case COLD: - case BRAZIER: - case SNOWFALL: - wasDamaged = true; - - // Recolor message for damage notification - messageNode.setRuneLiteFormatMessage(ColorUtil.wrapWithColorTag(messageNode.getValue(), this.damageNotificationColor)); - chatMessageManager.update(messageNode); - client.refreshChat(); - - // all actions except woodcutting are interrupted from damage - if (currentActivity != WintertodtActivity.WOODCUTTING) - { - wasInterrupted = true; - } - - break; - case INVENTORY_FULL: - case OUT_OF_ROOTS: - case BRAZIER_WENT_OUT: - wasInterrupted = true; - break; - case LIT_BRAZIER: - case FIXED_BRAZIER: - wasInterrupted = true; - neverNotify = true; - break; - } - - if (!neverNotify) - { - boolean shouldNotify = false; - - switch (this.notifyCondition) - { - case ONLY_WHEN_INTERRUPTED: - if (wasInterrupted) - { - shouldNotify = true; - } - break; - case WHEN_DAMAGED: - if (wasDamaged) - { - shouldNotify = true; - } - break; - case EITHER: - shouldNotify = true; - break; - } - - if (shouldNotify) - { - notifyInterrupted(interruptType, wasInterrupted); - } - } - - if (wasInterrupted) - { - currentActivity = WintertodtActivity.IDLE; - } - } - - private void notifyInterrupted(WintertodtInterruptType interruptType, boolean wasActivityInterrupted) - { - final StringBuilder str = new StringBuilder(); - - str.append("Wintertodt: "); - - if (wasActivityInterrupted) - { - str.append(currentActivity.getActionString()); - str.append(" interrupted! "); - } - - str.append(interruptType.getInterruptSourceString()); - - String notification = str.toString(); - log.debug("Sending notification: {}", notification); - notifier.notify(notification); - } - - @Subscribe - private void onAnimationChanged(final AnimationChanged event) - { - if (!isInWintertodt) - { - return; - } - - final Player local = client.getLocalPlayer(); - - if (event.getActor() != local) - { - return; - } - - final int animId = local.getAnimation(); - switch (animId) - { - case WOODCUTTING_BRONZE: - case WOODCUTTING_IRON: - case WOODCUTTING_STEEL: - case WOODCUTTING_BLACK: - case WOODCUTTING_MITHRIL: - case WOODCUTTING_ADAMANT: - case WOODCUTTING_RUNE: - case WOODCUTTING_DRAGON: - case WOODCUTTING_INFERNAL: - case WOODCUTTING_3A_AXE: - case WOODCUTTING_CRYSTAL: - setActivity(WintertodtActivity.WOODCUTTING); - break; - - case FLETCHING_BOW_CUTTING: - setActivity(WintertodtActivity.FLETCHING); - break; - - case LOOKING_INTO: - setActivity(WintertodtActivity.FEEDING_BRAZIER); - break; - - case FIREMAKING: - setActivity(WintertodtActivity.LIGHTING_BRAZIER); - break; - - case CONSTRUCTION: - setActivity(WintertodtActivity.FIXING_BRAZIER); - break; - } - } - - @Subscribe - private void onItemContainerChanged(ItemContainerChanged event) - { - final ItemContainer container = event.getItemContainer(); - - if (!isInWintertodt || container != client.getItemContainer(InventoryID.INVENTORY)) - { - return; - } - - final Item[] inv = container.getItems(); - - numRoots = 0; - numKindling = 0; - - for (Item item : inv) - { - switch (item.getId()) - { - case BRUMA_ROOT: - ++numRoots; - break; - case BRUMA_KINDLING: - ++numKindling; - break; - } - } - - //If we're currently fletching but there are no more roots, go ahead and abort fletching immediately - if (numRoots == 0 && currentActivity == WintertodtActivity.FLETCHING) - { - currentActivity = WintertodtActivity.IDLE; - } - //Otherwise, if we're currently feeding the brazier but we've run out of both roots and kindling, abort the feeding activity - else if (numRoots == 0 && numKindling == 0 && currentActivity == WintertodtActivity.FEEDING_BRAZIER) - { - currentActivity = WintertodtActivity.IDLE; - } - } - - private void setActivity(WintertodtActivity action) - { - currentActivity = action; - lastActionTime = Instant.now(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/config/WintertodtNotifyMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/config/WintertodtNotifyMode.java deleted file mode 100644 index e5c54b7be6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/config/WintertodtNotifyMode.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, terminatusx - * Copyright (c) 2018, 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.wintertodt.config; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter(AccessLevel.PACKAGE) -@RequiredArgsConstructor -public enum WintertodtNotifyMode -{ - NONE("None"), - WHEN_DAMAGED("Damage Taken"), - ONLY_WHEN_INTERRUPTED("Action Interrupted"), - EITHER("Either"); - - private final String name; - - @Override - public String toString() - { - return name; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/Axe.java b/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/Axe.java deleted file mode 100644 index fd75fdd546..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/Axe.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2018, Mantautas Jurksa - * 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.woodcutting; - -import com.google.common.collect.ImmutableMap; -import java.util.Map; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import static net.runelite.api.AnimationID.*; -import static net.runelite.api.ItemID.*; - -@AllArgsConstructor -@Getter(AccessLevel.PACKAGE) -enum Axe -{ - BRONZE(WOODCUTTING_BRONZE, BRONZE_AXE), - IRON(WOODCUTTING_IRON, IRON_AXE), - STEEL(WOODCUTTING_STEEL, STEEL_AXE), - BLACK(WOODCUTTING_BLACK, BLACK_AXE), - MITHRIL(WOODCUTTING_MITHRIL, MITHRIL_AXE), - ADAMANT(WOODCUTTING_ADAMANT, ADAMANT_AXE), - RUNE(WOODCUTTING_RUNE, RUNE_AXE), - DRAGON(WOODCUTTING_DRAGON, DRAGON_AXE), - INFERNAL(WOODCUTTING_INFERNAL, INFERNAL_AXE), - THIRDAGE(WOODCUTTING_3A_AXE, _3RD_AGE_AXE), - CRYSTAL(WOODCUTTING_CRYSTAL, CRYSTAL_AXE); - - private final Integer animId; - private final Integer itemId; - - private static final Map AXE_ANIM_IDS; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (Axe axe : values()) - { - builder.put(axe.animId, axe); - } - - AXE_ANIM_IDS = builder.build(); - } - - static Axe findAxeByAnimId(int animId) - { - return AXE_ANIM_IDS.get(animId); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/Tree.java b/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/Tree.java deleted file mode 100644 index 94105988b5..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/Tree.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2018, Mantautas Jurksa - * 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.woodcutting; - -import com.google.common.collect.ImmutableMap; -import java.time.Duration; -import java.util.Map; -import javax.annotation.Nullable; -import lombok.Getter; -import net.runelite.api.ObjectID; -import static net.runelite.api.ObjectID.MAGIC_TREE_10834; -import static net.runelite.api.NullObjectID.NULL_10835; -import static net.runelite.api.ObjectID.MAHOGANY; -import static net.runelite.api.ObjectID.MAHOGANY_36688; -import static net.runelite.api.ObjectID.MAPLE_TREE_10832; -import static net.runelite.api.ObjectID.MAPLE_TREE_36681; -import static net.runelite.api.ObjectID.OAK_10820; -import static net.runelite.api.ObjectID.OAK_TREE_4540; -import static net.runelite.api.ObjectID.REDWOOD_29670; -import static net.runelite.api.ObjectID.TEAK; -import static net.runelite.api.ObjectID.TEAK_36686; -import static net.runelite.api.ObjectID.TREE; -import static net.runelite.api.ObjectID.TREE_1277; -import static net.runelite.api.ObjectID.TREE_1278; -import static net.runelite.api.ObjectID.TREE_1279; -import static net.runelite.api.ObjectID.TREE_1280; -import static net.runelite.api.ObjectID.WILLOW; -import static net.runelite.api.ObjectID.WILLOW_10829; -import static net.runelite.api.ObjectID.WILLOW_10831; -import static net.runelite.api.ObjectID.WILLOW_10833; -import static net.runelite.api.ObjectID.YEW; -import static net.runelite.api.NullObjectID.NULL_10823; -import static net.runelite.api.ObjectID.YEW_36683; - -@Getter -enum Tree -{ - REGULAR_TREE(null, TREE, TREE_1277, TREE_1278, TREE_1279, TREE_1280), - OAK_TREE(Duration.ofMillis(8500), ObjectID.OAK_TREE, OAK_TREE_4540, OAK_10820), - WILLOW_TREE(Duration.ofMillis(8500), WILLOW, WILLOW_10829, WILLOW_10831, WILLOW_10833), - MAPLE_TREE(Duration.ofSeconds(35), ObjectID.MAPLE_TREE, MAPLE_TREE_10832, MAPLE_TREE_36681) - { - @Override - Duration getRespawnTime(int region) - { - return region == MISCELLANIA_REGION ? Duration.ofMillis(8500) : super.respawnTime; - } - }, - TEAK_TREE(Duration.ofMillis(8500), TEAK, TEAK_36686), - MAHOGANY_TREE(Duration.ofMillis(8500), MAHOGANY, MAHOGANY_36688), - YEW_TREE(Duration.ofMinutes(1), YEW, NULL_10823, YEW_36683), - MAGIC_TREE(Duration.ofMinutes(2), MAGIC_TREE_10834, NULL_10835), - REDWOOD(Duration.ofMinutes(2), ObjectID.REDWOOD, REDWOOD_29670); - - @Nullable - private final Duration respawnTime; - private final int[] treeIds; - - Tree(Duration respawnTime, int... treeIds) - { - this.respawnTime = respawnTime; - this.treeIds = treeIds; - } - - private static final int MISCELLANIA_REGION = 10044; - private static final Map TREES; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (Tree tree : values()) - { - for (int treeId : tree.treeIds) - { - builder.put(treeId, tree); - } - } - - TREES = builder.build(); - } - - Duration getRespawnTime(int region) - { - return respawnTime; - } - - static Tree findTree(int objectId) - { - return TREES.get(objectId); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/TreeRespawn.java b/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/TreeRespawn.java deleted file mode 100644 index ef05dc67b0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/TreeRespawn.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2019, Adam - * Copyright (c) 2019, David - * 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.woodcutting; - -import java.time.Instant; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.coords.WorldPoint; - -@AllArgsConstructor -@Getter -class TreeRespawn -{ - private final Tree tree; - private final int lenX; - private final int lenY; - private final WorldPoint worldLocation; - private final Instant startTime; - private final int respawnTime; - - boolean isExpired() - { - return Instant.now().isAfter(startTime.plusMillis(respawnTime)); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingConfig.java deleted file mode 100644 index 74c1f50830..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingConfig.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.woodcutting; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("woodcutting") -public interface WoodcuttingConfig extends Config -{ - @ConfigItem( - position = 1, - keyName = "statTimeout", - name = "Reset stats (minutes)", - description = "Configures the time until statistic is reset. Also configures when tree indicator is hidden" - ) - default int statTimeout() - { - return 5; - } - - @ConfigItem( - position = 2, - keyName = "showNestNotification", - name = "Bird nest notification", - description = "Configures whether to notify you of a bird nest spawn" - ) - default boolean showNestNotification() - { - return true; - } - - @ConfigItem( - position = 3, - keyName = "showWoodcuttingStats", - name = "Show session stats", - description = "Configures whether to display woodcutting session stats" - ) - default boolean showWoodcuttingStats() - { - return true; - } - - @ConfigItem( - position = 4, - keyName = "showRedwoods", - name = "Show Redwood trees", - description = "Configures whether to show a indicator for redwood trees" - ) - default boolean showRedwoodTrees() - { - return true; - } - - @ConfigItem( - position = 5, - keyName = "showGPEarned", - name = "Show GP earned", - description = "Configures whether to show amount of gp earned by chopping trees" - ) - default boolean showGPEarned() - { - return false; - } - - @ConfigItem( - position = 6, - keyName = "showRespawnTimers", - name = "Show respawn timers", - description = "Configures whether to display the respawn timer overlay" - ) - default boolean showRespawnTimers() - { - return true; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingOverlay.java deleted file mode 100644 index d01629003f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingOverlay.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.woodcutting; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.Skill; -import net.runelite.client.plugins.xptracker.XpTrackerService; -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.TableAlignment; -import net.runelite.client.ui.overlay.components.table.TableComponent; - -@Singleton -class WoodcuttingOverlay extends Overlay -{ - static final String WOODCUTTING_RESET = "Reset"; - - private final Client client; - private final WoodcuttingPlugin plugin; - private final WoodcuttingConfig config; - private final XpTrackerService xpTrackerService; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - private WoodcuttingOverlay(Client client, WoodcuttingPlugin plugin, WoodcuttingConfig config, XpTrackerService xpTrackerService) - { - super(plugin); - setPosition(OverlayPosition.TOP_LEFT); - this.client = client; - this.plugin = plugin; - this.config = config; - this.xpTrackerService = xpTrackerService; - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Woodcutting overlay")); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY, WOODCUTTING_RESET, "Woodcutting overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!config.showWoodcuttingStats()) - { - return null; - } - - WoodcuttingSession session = plugin.getSession(); - if (session == null) - { - return null; - } - - panelComponent.getChildren().clear(); - - Axe axe = plugin.getAxe(); - if (axe != null && axe.getAnimId() == client.getLocalPlayer().getAnimation()) - { - panelComponent.getChildren().add(TitleComponent.builder() - .text("Woodcutting") - .color(Color.GREEN) - .build()); - } - else - { - panelComponent.getChildren().add(TitleComponent.builder() - .text("NOT woodcutting") - .color(Color.RED) - .build()); - } - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - int actions = xpTrackerService.getActions(Skill.WOODCUTTING); - if (actions > 0) - { - tableComponent.addRow("Logs cut:", Integer.toString(actions)); - - if (config.showGPEarned()) - { - tableComponent.addRow("GP earned:", Integer.toString((plugin.getGpEarned()))); - } - - if (actions > 2) - { - tableComponent.addRow("Logs/hr:", Integer.toString(xpTrackerService.getActionsHr(Skill.WOODCUTTING))); - } - } - - 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/woodcutting/WoodcuttingPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingPlugin.java deleted file mode 100644 index 3cd457ed51..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingPlugin.java +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.woodcutting; - -import com.google.inject.Provides; -import java.time.Duration; -import java.time.Instant; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.regex.Pattern; -import javax.inject.Inject; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.ItemID; -import net.runelite.api.MenuOpcode; -import net.runelite.api.Player; -import net.runelite.api.Point; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.AnimationChanged; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameObjectChanged; -import net.runelite.api.events.GameObjectDespawned; -import net.runelite.api.events.GameObjectSpawned; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.client.Notifier; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.OverlayMenuClicked; -import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDependency; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.xptracker.XpTrackerPlugin; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.ui.overlay.OverlayMenuEntry; - -@PluginDescriptor( - name = "Woodcutting", - description = "Show woodcutting statistics and/or bird nest notifications", - tags = {"birds", "nest", "notifications", "overlay", "skilling", "wc"}, - enabledByDefault = false, - type = PluginType.SKILLING -) -@PluginDependency(XpTrackerPlugin.class) -@Slf4j -public class WoodcuttingPlugin extends Plugin -{ - private static final Pattern WOOD_CUT_PATTERN = Pattern.compile("You get (?:some|an)[\\w ]+(?:logs?|mushrooms)\\."); - - @Getter - private final Set treeObjects = new HashSet<>(); - - @Getter(AccessLevel.PACKAGE) - private final List respawns = new ArrayList<>(); - - @Inject - private Notifier notifier; - - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private WoodcuttingOverlay overlay; - - @Inject - private WoodcuttingTreesOverlay treesOverlay; - - @Inject - private WoodcuttingConfig config; - - @Inject - private ItemManager itemManager; - - @Getter - private WoodcuttingSession session; - - @Getter - private Axe axe; - - private boolean recentlyLoggedIn; - private int treeTypeID; - @Getter(AccessLevel.PACKAGE) - private int gpEarned; - private int currentPlane; - - @Provides - WoodcuttingConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(WoodcuttingConfig.class); - } - - @Override - protected void startUp() throws Exception - { - overlayManager.add(overlay); - overlayManager.add(treesOverlay); - } - - @Override - protected void shutDown() throws Exception - { - overlayManager.remove(overlay); - overlayManager.remove(treesOverlay); - respawns.clear(); - treeObjects.clear(); - session = null; - axe = null; - } - - @Subscribe - private void onOverlayMenuClicked(OverlayMenuClicked overlayMenuClicked) - { - OverlayMenuEntry overlayMenuEntry = overlayMenuClicked.getEntry(); - if (overlayMenuEntry.getMenuOpcode() == MenuOpcode.RUNELITE_OVERLAY - && overlayMenuClicked.getEntry().getOption().equals(WoodcuttingOverlay.WOODCUTTING_RESET) - && overlayMenuClicked.getOverlay() == overlay) - { - session = null; - } - } - - @Subscribe - private void onGameTick(GameTick gameTick) - { - recentlyLoggedIn = false; - currentPlane = client.getPlane(); - - respawns.removeIf(TreeRespawn::isExpired); - - if (session == null || session.getLastLogCut() == null) - { - return; - } - - Duration statTimeout = Duration.ofMinutes(config.statTimeout()); - Duration sinceCut = Duration.between(session.getLastLogCut(), Instant.now()); - - if (sinceCut.compareTo(statTimeout) >= 0) - { - session = null; - axe = null; - } - } - - @Subscribe - void onChatMessage(ChatMessage event) - { - if (event.getType() == ChatMessageType.SPAM || event.getType() == ChatMessageType.GAMEMESSAGE) - { - if (WOOD_CUT_PATTERN.matcher(event.getMessage()).matches()) - { - if (session == null) - { - session = new WoodcuttingSession(); - gpEarned = 0; - } - - session.setLastLogCut(); - - typeOfLogCut(event.getMessage()); - gpEarned += itemManager.getItemPrice(treeTypeID); - } - - if (event.getMessage().contains("A bird's nest falls out of the tree") && config.showNestNotification()) - { - notifier.notify("A bird nest has spawned!"); - } - } - } - - @Subscribe - private void onGameObjectSpawned(final GameObjectSpawned event) - { - GameObject gameObject = event.getGameObject(); - Tree tree = Tree.findTree(gameObject.getId()); - - if (tree == Tree.REDWOOD) - { - treeObjects.add(gameObject); - } - } - - @Subscribe - private void onGameObjectDespawned(final GameObjectDespawned event) - { - final GameObject object = event.getGameObject(); - - Tree tree = Tree.findTree(object.getId()); - if (tree != null) - { - if (tree.getRespawnTime() != null && !recentlyLoggedIn && currentPlane == object.getPlane()) - { - Point max = object.getSceneMaxLocation(); - Point min = object.getSceneMinLocation(); - int lenX = max.getX() - min.getX(); - int lenY = max.getY() - min.getY(); - log.debug("Adding respawn timer for {} tree at {}", tree, object.getLocalLocation()); - - final int region = client.getLocalPlayer().getWorldLocation().getRegionID(); - TreeRespawn treeRespawn = new TreeRespawn(tree, lenX, lenY, WorldPoint.fromScene(client, min.getX(), min.getY(), client.getPlane()), Instant.now(), (int) tree.getRespawnTime(region).toMillis()); - respawns.add(treeRespawn); - } - - if (tree == Tree.REDWOOD) - { - treeObjects.remove(event.getGameObject()); - } - } - } - - @Subscribe - private void onGameObjectChanged(final GameObjectChanged event) - { - treeObjects.remove(event.getGameObject()); - } - - @Subscribe - private void onGameStateChanged(final GameStateChanged event) - { - switch (event.getGameState()) - { - case HOPPING: - respawns.clear(); - case LOADING: - treeObjects.clear(); - break; - case LOGGED_IN: - // After login trees that are depleted will be changed, - // wait for the next game tick before watching for - // trees to despawn - recentlyLoggedIn = true; - break; - } - } - - @Subscribe - private void onAnimationChanged(final AnimationChanged event) - { - Player local = client.getLocalPlayer(); - - if (event.getActor() != local) - { - return; - } - - int animId = local.getAnimation(); - Axe axe = Axe.findAxeByAnimId(animId); - if (axe != null) - { - this.axe = axe; - } - } - - private void typeOfLogCut(String message) - { - if (message.contains("mushrooms.")) - { - return; //TO DO Add valuation for scullicep mushroom cutting. - } - else if (message.contains("oak")) - { - treeTypeID = ItemID.OAK_LOGS; - } - else if (message.contains("willow")) - { - treeTypeID = ItemID.WILLOW_LOGS; - } - else if (message.contains("yew")) - { - treeTypeID = ItemID.YEW_LOGS; - } - else if (message.contains("redwood")) - { - treeTypeID = ItemID.REDWOOD_LOGS; - } - else if (message.contains("magic")) - { - treeTypeID = ItemID.MAGIC_LOGS; - } - else if (message.contains("teak")) - { - treeTypeID = ItemID.TEAK_LOGS; - } - else if (message.contains("mahogany")) - { - treeTypeID = ItemID.MAHOGANY_LOGS; - } - else if (message.contains("maple")) - { - treeTypeID = ItemID.MAPLE_LOGS; - } - else - { - treeTypeID = ItemID.LOGS; - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingSession.java b/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingSession.java deleted file mode 100644 index aaf2919c01..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingSession.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2017, Seth - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.woodcutting; - -import java.time.Instant; - -class WoodcuttingSession -{ - private Instant lastLogCut; - - void setLastLogCut() - { - lastLogCut = Instant.now(); - } - - Instant getLastLogCut() - { - return lastLogCut; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingTreesOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingTreesOverlay.java deleted file mode 100644 index 1e23f1af9c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/woodcutting/WoodcuttingTreesOverlay.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * Copyright (c) 2018, Adam - * Copyright (c) 2019, David - * 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.woodcutting; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.time.Instant; -import java.util.List; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.coords.LocalPoint; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayUtil; -import net.runelite.client.ui.overlay.components.ProgressPieComponent; - -class WoodcuttingTreesOverlay extends Overlay -{ - private final Client client; - private final WoodcuttingConfig config; - private final ItemManager itemManager; - private final WoodcuttingPlugin plugin; - - @Inject - private WoodcuttingTreesOverlay(final Client client, final WoodcuttingConfig config, final ItemManager itemManager, final WoodcuttingPlugin plugin) - { - this.client = client; - this.config = config; - this.itemManager = itemManager; - this.plugin = plugin; - setLayer(OverlayLayer.ABOVE_SCENE); - setPosition(OverlayPosition.DYNAMIC); - } - - @Override - public Dimension render(Graphics2D graphics) - { - renderAxes(graphics); - renderTimers(graphics); - return null; - } - - private void renderAxes(Graphics2D graphics) - { - if (plugin.getSession() == null || !config.showRedwoodTrees()) - { - return; - } - - Axe axe = plugin.getAxe(); - if (axe == null) - { - return; - } - - for (GameObject treeObject : plugin.getTreeObjects()) - { - if (treeObject.getWorldLocation().distanceTo(client.getLocalPlayer().getWorldLocation()) <= 12) - { - OverlayUtil.renderImageLocation(client, graphics, treeObject.getLocalLocation(), itemManager.getImage(axe.getItemId()), 120); - } - } - } - - private void renderTimers(Graphics2D graphics) - { - List respawns = plugin.getRespawns(); - if (respawns.isEmpty() || !config.showRespawnTimers()) - { - return; - } - - Instant now = Instant.now(); - for (TreeRespawn treeRespawn : respawns) - { - LocalPoint minLocation = LocalPoint.fromWorld(client, treeRespawn.getWorldLocation()); - if (minLocation == null) - { - continue; - } - - LocalPoint centeredLocation = new LocalPoint( - minLocation.getX() + treeRespawn.getLenX() * Perspective.LOCAL_HALF_TILE_SIZE, - minLocation.getY() + treeRespawn.getLenY() * Perspective.LOCAL_HALF_TILE_SIZE); - float percent = (now.toEpochMilli() - treeRespawn.getStartTime().toEpochMilli()) / (float) treeRespawn.getRespawnTime(); - Point point = Perspective.localToCanvas(client, centeredLocation, client.getPlane()); - if (point == null || percent > 1.0f) - { - continue; - } - - ProgressPieComponent ppc = new ProgressPieComponent(); - ppc.setBorderColor(Color.ORANGE); - ppc.setFill(Color.YELLOW); - ppc.setPosition(point); - ppc.setProgress(percent); - ppc.render(graphics); - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/SubscriptionFilterMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/SubscriptionFilterMode.java deleted file mode 100644 index b95a41a468..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/SubscriptionFilterMode.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2019, Shawn - * 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.worldhopper; - -public enum SubscriptionFilterMode -{ - BOTH, - FREE, - MEMBERS -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperConfig.java deleted file mode 100644 index ec876d916e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperConfig.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2018, Lotto - * Copyright (c) 2019, gregg1494 - * 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.worldhopper; - -import java.awt.event.InputEvent; -import java.awt.event.KeyEvent; -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(WorldHopperConfig.GROUP) -public interface WorldHopperConfig extends Config -{ - String GROUP = "worldhopper"; - - @ConfigItem( - keyName = "previousKey", - name = "Quick-hop previous", - description = "When you press this key you'll hop to the previous world", - position = 0 - ) - default Keybind previousKey() - { - return new Keybind(KeyEvent.VK_LEFT, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK); - } - - @ConfigItem( - keyName = "nextKey", - name = "Quick-hop next", - description = "When you press this key you'll hop to the next world", - position = 1 - ) - default Keybind nextKey() - { - return new Keybind(KeyEvent.VK_RIGHT, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK); - } - - @ConfigItem( - keyName = "quickhopOutOfDanger", - name = "Quick-hop out of dangerous worlds", - description = "Don't hop to a PVP/high risk world when quick-hopping", - position = 2 - ) - default boolean quickhopOutOfDanger() - { - return true; - } - - @ConfigItem( - keyName = "showSidebar", - name = "Show world hopper sidebar", - description = "Show sidebar containing all worlds that mimics in-game interface", - position = 3 - ) - default boolean showSidebar() - { - return true; - } - - @ConfigItem( - keyName = "ping", - name = "Show world ping", - description = "Shows ping to each game world", - position = 4 - ) - default boolean ping() - { - return true; - } - - @ConfigItem( - keyName = "showMessage", - name = "Show world hop message in chat", - description = "Shows what world is being hopped to in the chat", - position = 5 - ) - default boolean showWorldHopMessage() - { - return true; - } - - @ConfigItem( - keyName = "menuOption", - name = "Show Hop-to menu option", - description = "Adds Hop-to menu option to the friends list and clan members list", - position = 6 - ) - default boolean menuOption() - { - return true; - } - - @ConfigItem( - keyName = "removePVPWorld", - name = "Remove Hop-to menu option (PVP)", - description = "Removes Hop-to menu option for PVP worlds", - position = 7 - ) - default boolean removePVPWorld() - { - return false; - } - - @ConfigItem( - keyName = "removeBHWorld", - name = "Remove Hop-to menu option (BH)", - description = "Removes Hop-to menu option for Bounty Hunter worlds", - position = 8 - ) - default boolean removeBHWorld() - { - return false; - } - - @ConfigItem( - keyName = "subscriptionFilter", - name = "Show subscription types", - description = "Only show free worlds, member worlds, or both types of worlds in sidebar", - position = 9 - ) - default SubscriptionFilterMode subscriptionFilter() - { - return SubscriptionFilterMode.BOTH; - } - - @ConfigItem( - keyName = "displayPing", - name = "Display current ping", - description = "Displays ping to current game world", - position = 10 - ) - default boolean displayPing() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPingOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPingOverlay.java deleted file mode 100644 index 1839b14ddd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPingOverlay.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2019, gregg1494 - * 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.worldhopper; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.Point; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -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; - -class WorldHopperPingOverlay extends Overlay -{ - private static final int Y_OFFSET = 11; - private static final int X_OFFSET = 1; - - private final Client client; - private final WorldHopperPlugin worldHopperPlugin; - - @Inject - private WorldHopperPingOverlay(Client client, WorldHopperPlugin worldHopperPlugin) - { - this.client = client; - this.worldHopperPlugin = worldHopperPlugin; - setLayer(OverlayLayer.ABOVE_WIDGETS); - setPriority(OverlayPriority.HIGH); - setPosition(OverlayPosition.DYNAMIC); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!worldHopperPlugin.isDisplayPing()) - { - return null; - } - - final int ping = worldHopperPlugin.getCurrentPing(); - if (ping < 0) - { - return null; - } - - final String text = ping + " ms"; - final int textWidth = graphics.getFontMetrics().stringWidth(text); - final int textHeight = graphics.getFontMetrics().getAscent() - graphics.getFontMetrics().getDescent(); - - // Adjust ping offset for logout button - Widget logoutButton = client.getWidget(WidgetInfo.RESIZABLE_MINIMAP_LOGOUT_BUTTON); - int xOffset = X_OFFSET; - if (logoutButton != null && !logoutButton.isHidden()) - { - xOffset += logoutButton.getWidth(); - } - - final int width = (int) client.getRealDimensions().getWidth(); - final Point point = new Point(width - textWidth - xOffset, textHeight + Y_OFFSET); - OverlayUtil.renderTextLocation(graphics, point, text, Color.YELLOW); - - return null; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPlugin.java deleted file mode 100644 index 292e138d95..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPlugin.java +++ /dev/null @@ -1,885 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * Copyright (c) 2018, Lotto - * Copyright (c) 2019, gregg1494 - * 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.worldhopper; - -import com.google.common.base.Stopwatch; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ObjectArrays; -import com.google.inject.Provides; -import java.awt.image.BufferedImage; -import java.time.Duration; -import java.time.Instant; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.swing.SwingUtilities; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.ChatMessageType; -import net.runelite.api.ChatPlayer; -import net.runelite.api.ClanMember; -import net.runelite.api.Client; -import net.runelite.api.Friend; -import net.runelite.api.GameState; -import net.runelite.api.MenuEntry; -import net.runelite.api.MenuOpcode; -import net.runelite.api.Varbits; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.PlayerMenuOptionClicked; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.events.WorldListLoad; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.WidgetInfo; -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.config.Keybind; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.events.WorldsFetch; -import net.runelite.client.game.WorldService; -import net.runelite.client.input.KeyManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.util.ExecutorServiceExceptionLogger; -import net.runelite.client.util.HotkeyListener; -import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.WorldUtil; -import net.runelite.client.util.ping.Ping; -import net.runelite.http.api.worlds.World; -import net.runelite.http.api.worlds.WorldResult; -import net.runelite.http.api.worlds.WorldType; -import org.apache.commons.lang3.ArrayUtils; - -@PluginDescriptor( - name = "World Hopper", - description = "Allows you to quickly hop worlds", - type = PluginType.UTILITY -) -@Slf4j -@Singleton -public class WorldHopperPlugin extends Plugin -{ - private static final int WORLD_FETCH_TIMER = 10; - private static final int REFRESH_THROTTLE = 60_000; // ms - private static final int TICK_THROTTLE = (int) Duration.ofMinutes(10).toMillis(); - - private static final int DISPLAY_SWITCHER_MAX_ATTEMPTS = 3; - - private static final String HOP_TO = "Hop-to"; - private static final String KICK_OPTION = "Kick"; - private static final ImmutableList BEFORE_OPTIONS = ImmutableList.of("Add friend", "Remove friend", KICK_OPTION); - private static final ImmutableList AFTER_OPTIONS = ImmutableList.of("Message"); - - @Inject - private Client client; - - @Inject - private ConfigManager configManager; - - @Inject - private ClientToolbar clientToolbar; - - @Inject - private KeyManager keyManager; - - @Inject - private ChatMessageManager chatMessageManager; - - @Inject - private WorldHopperConfig config; - - @Inject - private OverlayManager overlayManager; - - @Inject - private WorldHopperPingOverlay worldHopperOverlay; - - @Inject - private WorldService worldService; - - private ScheduledExecutorService hopperExecutorService; - - private NavigationButton navButton; - private WorldSwitcherPanel panel; - - private net.runelite.api.World quickHopTargetWorld; - private int displaySwitcherAttempts = 0; - - @Getter(AccessLevel.PACKAGE) - private int lastWorld; - - private int favoriteWorld1, favoriteWorld2; - - private ScheduledFuture pingFuture, currPingFuture; - private int currentWorld; - private Instant lastFetch; - - private Keybind previousKey; - private Keybind nextKey; - private boolean quickhopOutOfDanger; - private boolean showSidebar; - private boolean ping; - private boolean showWorldHopMessage; - private SubscriptionFilterMode subscriptionFilter; - private boolean menuOption; - private boolean removePVPWorld; - private boolean removeBHWorld; - @Getter(AccessLevel.PACKAGE) - private boolean displayPing; - - @Getter(AccessLevel.PACKAGE) - private int currentPing; - - private final Map storedPings = new HashMap<>(); - - private final HotkeyListener previousKeyListener = new HotkeyListener(() -> this.previousKey) - { - @Override - public void hotkeyPressed() - { - hop(true); - } - }; - private final HotkeyListener nextKeyListener = new HotkeyListener(() -> this.nextKey) - { - @Override - public void hotkeyPressed() - { - hop(false); - } - }; - - @Provides - WorldHopperConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(WorldHopperConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - currentPing = -1; - - keyManager.registerKeyListener(previousKeyListener); - keyManager.registerKeyListener(nextKeyListener); - - panel = new WorldSwitcherPanel(this); - - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(WorldHopperPlugin.class, "icon.png"); - - navButton = NavigationButton.builder() - .tooltip("World Switcher") - .icon(icon) - .priority(3) - .panel(panel) - .build(); - - if (this.showSidebar) - { - clientToolbar.addNavigation(navButton); - } - - overlayManager.add(worldHopperOverlay); - - panel.setFilterMode(this.subscriptionFilter); - - // The plugin has its own executor for pings, as it blocks for a long time - hopperExecutorService = new ExecutorServiceExceptionLogger(Executors.newSingleThreadScheduledExecutor()); - // Run the first-run ping - hopperExecutorService.execute(this::pingInitialWorlds); - - // Give some initial delay - this won't run until after pingInitialWorlds finishes from tick() anyway - pingFuture = hopperExecutorService.scheduleWithFixedDelay(this::pingNextWorld, 15, 3, TimeUnit.SECONDS); - currPingFuture = hopperExecutorService.scheduleWithFixedDelay(this::pingCurrentWorld, 15, 1, TimeUnit.SECONDS); - - // populate initial world list - updateList(); - } - - @Override - protected void shutDown() - { - pingFuture.cancel(true); - pingFuture = null; - - currPingFuture.cancel(true); - currPingFuture = null; - - overlayManager.remove(worldHopperOverlay); - - keyManager.unregisterKeyListener(previousKeyListener); - keyManager.unregisterKeyListener(nextKeyListener); - - clientToolbar.removeNavigation(navButton); - - hopperExecutorService.shutdown(); - hopperExecutorService = null; - } - - @Subscribe - private void onConfigChanged(final ConfigChanged event) - { - if (event.getGroup().equals(WorldHopperConfig.GROUP)) - { - updateConfig(); - - switch (event.getKey()) - { - case "showSidebar": - if (this.showSidebar) - { - clientToolbar.addNavigation(navButton); - } - else - { - clientToolbar.removeNavigation(navButton); - } - break; - case "ping": - if (this.ping) - { - SwingUtilities.invokeLater(() -> panel.showPing()); - } - else - { - SwingUtilities.invokeLater(() -> panel.hidePing()); - } - break; - case "subscriptionFilter": - panel.setFilterMode(this.subscriptionFilter); - updateList(); - break; - } - } - } - - private void setFavoriteConfig(int world) - { - configManager.setConfiguration(WorldHopperConfig.GROUP, "favorite_" + world, true); - } - - private boolean isFavoriteConfig(int world) - { - Boolean favorite = configManager.getConfiguration(WorldHopperConfig.GROUP, "favorite_" + world, Boolean.class); - return favorite != null && favorite; - } - - private void clearFavoriteConfig(int world) - { - configManager.unsetConfiguration(WorldHopperConfig.GROUP, "favorite_" + world); - panel.resetAllFavoriteMenus(); - } - - boolean isFavorite(World world) - { - int id = world.getId(); - return id == favoriteWorld1 || id == favoriteWorld2 || isFavoriteConfig(id); - } - - int getCurrentWorld() - { - return client.getWorld(); - } - - void hopTo(World world) - { - hop(world.getId()); - } - - void addToFavorites(World world) - { - log.debug("Adding world {} to favorites", world.getId()); - setFavoriteConfig(world.getId()); - panel.updateFavoriteMenu(world.getId(), true); - } - - void removeFromFavorites(World world) - { - log.debug("Removing world {} from favorites", world.getId()); - clearFavoriteConfig(world.getId()); - panel.updateFavoriteMenu(world.getId(), false); - } - - @Subscribe - private void onVarbitChanged(VarbitChanged varbitChanged) - { - int old1 = favoriteWorld1; - int old2 = favoriteWorld2; - - favoriteWorld1 = client.getVar(Varbits.WORLDHOPPER_FAVROITE_1); - favoriteWorld2 = client.getVar(Varbits.WORLDHOPPER_FAVROITE_2); - - if (old1 != favoriteWorld1 || old2 != favoriteWorld2) - { - SwingUtilities.invokeLater(panel::updateList); - } - } - - @Subscribe - private void onMenuEntryAdded(MenuEntryAdded event) - { - if (!this.menuOption) - { - return; - } - - int groupId = WidgetInfo.TO_GROUP(event.getParam1()); - String option = event.getOption(); - - if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() || groupId == WidgetInfo.CLAN_CHAT.getGroupId()) - { - boolean after; - - if (AFTER_OPTIONS.contains(option)) - { - after = true; - } - else if (BEFORE_OPTIONS.contains(option)) - { - after = false; - } - else - { - return; - } - - // Don't add entry if user is offline - ChatPlayer player = getChatPlayerFromName(event.getTarget()); - WorldResult worldResult = worldService.getWorlds(); - - if (player == null || player.getWorld() == 0 || player.getWorld() == client.getWorld() - || worldResult == null) - { - return; - } - - World currentWorld = worldResult.findWorld(client.getWorld()); - World targetWorld = worldResult.findWorld(player.getWorld()); - if ((targetWorld == null || currentWorld == null) - || (this.removePVPWorld && !currentWorld.getTypes().contains(WorldType.PVP) && targetWorld.getTypes().contains(WorldType.PVP)) - || (this.removeBHWorld && !currentWorld.getTypes().contains(WorldType.BOUNTY) && targetWorld.getTypes().contains(WorldType.BOUNTY))) - { - // Disable Hop-to a PVP world & BH world from a regular world - return; - } - - - final MenuEntry hopTo = new MenuEntry(); - hopTo.setOption(HOP_TO); - hopTo.setTarget(event.getTarget()); - hopTo.setOpcode(MenuOpcode.RUNELITE.getId()); - hopTo.setParam0(event.getParam0()); - hopTo.setParam1(event.getParam1()); - - insertMenuEntry(hopTo, client.getMenuEntries(), after); - } - } - - private void insertMenuEntry(MenuEntry newEntry, MenuEntry[] entries, boolean after) - { - MenuEntry[] newMenu = ObjectArrays.concat(entries, newEntry); - - if (after) - { - int menuEntryCount = newMenu.length; - ArrayUtils.swap(newMenu, menuEntryCount - 1, menuEntryCount - 2); - } - - client.setMenuEntries(newMenu); - } - - @Subscribe - private void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event) - { - if (!event.getMenuOption().equals(HOP_TO)) - { - return; - } - - ChatPlayer player = getChatPlayerFromName(event.getMenuTarget()); - - if (player != null) - { - hop(player.getWorld()); - } - } - - @Subscribe - private void onGameStateChanged(GameStateChanged gameStateChanged) - { - // If the player has disabled the side bar plugin panel, do not update the UI - if (this.showSidebar && gameStateChanged.getGameState() == GameState.LOGGED_IN) - { - if (lastWorld != client.getWorld()) - { - int newWorld = client.getWorld(); - panel.switchCurrentHighlight(newWorld, lastWorld); - lastWorld = newWorld; - } - } - } - - @Subscribe - private void onWorldListLoad(WorldListLoad worldListLoad) - { - if (!this.showSidebar) - { - return; - } - - Map worldData = new HashMap<>(); - - for (net.runelite.api.World w : worldListLoad.getWorlds()) - { - worldData.put(w.getId(), w.getPlayerCount()); - } - - panel.updateListData(worldData); - this.lastFetch = Instant.now(); // This counts as a fetch as it updates populations - } - - void refresh() - { - Instant now = Instant.now(); - if (lastFetch != null && now.toEpochMilli() - lastFetch.toEpochMilli() < REFRESH_THROTTLE) - { - log.debug("Throttling world refresh"); - return; - } - - lastFetch = now; - worldService.refresh(); - } - - @Subscribe - public void onWorldsFetch(WorldsFetch worldsFetch) - { - updateList(); - } - - /** - * This method ONLY updates the list's UI, not the actual world list and data it displays. - */ - private void updateList() - { - WorldResult worldResult = worldService.getWorlds(); - if (worldResult != null) - { - SwingUtilities.invokeLater(() -> panel.populate(worldResult.getWorlds())); - } - } - - private void hop(boolean previous) - { - WorldResult worldResult = worldService.getWorlds(); - if (worldResult == null || client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - World currentWorld = worldResult.findWorld(client.getWorld()); - - if (currentWorld == null) - { - return; - } - - EnumSet currentWorldTypes = currentWorld.getTypes().clone(); - // Make it so you always hop out of PVP and high risk worlds - if (this.quickhopOutOfDanger) - { - currentWorldTypes.remove(WorldType.PVP); - currentWorldTypes.remove(WorldType.HIGH_RISK); - currentWorldTypes.remove(WorldType.BOUNTY); - } - // Don't regard these worlds as a type that must be hopped between - currentWorldTypes.remove(WorldType.SKILL_TOTAL); - currentWorldTypes.remove(WorldType.LAST_MAN_STANDING); - - List worlds = worldResult.getWorlds(); - - int worldIdx = worlds.indexOf(currentWorld); - int totalLevel = client.getTotalLevel(); - - World world; - do - { - /* - Get the previous or next world in the list, - starting over at the other end of the list - if there are no more elements in the - current direction of iteration. - */ - if (previous) - { - worldIdx--; - - if (worldIdx < 0) - { - worldIdx = worlds.size() - 1; - } - } - else - { - worldIdx++; - - if (worldIdx >= worlds.size()) - { - worldIdx = 0; - } - } - - world = worlds.get(worldIdx); - - EnumSet types = world.getTypes().clone(); - - types.remove(WorldType.BOUNTY); - // Treat LMS world like casual world - types.remove(WorldType.LAST_MAN_STANDING); - - if (types.contains(WorldType.SKILL_TOTAL)) - { - try - { - int totalRequirement = Integer.parseInt(world.getActivity().substring(0, world.getActivity().indexOf(" "))); - - if (totalLevel >= totalRequirement) - { - types.remove(WorldType.SKILL_TOTAL); - } - } - catch (NumberFormatException ex) - { - log.warn("Failed to parse total level requirement for target world", ex); - } - } - - // Break out if we've found a good world to hop to - if (currentWorldTypes.equals(types)) - { - break; - } - } - while (world != currentWorld); - - if (world == currentWorld) - { - String chatMessage = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Couldn't find a world to quick-hop to.") - .build(); - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.CONSOLE) - .runeLiteFormattedMessage(chatMessage) - .build()); - } - else - { - hop(world.getId()); - } - } - - private void hop(int worldId) - { - WorldResult worldResult = worldService.getWorlds(); - // Don't try to hop if the world doesn't exist - World world = worldResult.findWorld(worldId); - if (world == null) - { - return; - } - - final net.runelite.api.World rsWorld = client.createWorld(); - rsWorld.setActivity(world.getActivity()); - rsWorld.setAddress(world.getAddress()); - rsWorld.setId(world.getId()); - rsWorld.setPlayerCount(world.getPlayers()); - rsWorld.setLocation(world.getLocation()); - rsWorld.setTypes(WorldUtil.toWorldTypes(world.getTypes())); - - if (client.getGameState() == GameState.LOGIN_SCREEN) - { - // on the login screen we can just change the world by ourselves - client.changeWorld(rsWorld); - return; - } - - if (this.showWorldHopMessage) - { - String chatMessage = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Quick-hopping to World ") - .append(ChatColorType.HIGHLIGHT) - .append(Integer.toString(world.getId())) - .append(ChatColorType.NORMAL) - .append("..") - .build(); - - chatMessageManager - .queue(QueuedMessage.builder() - .type(ChatMessageType.CONSOLE) - .runeLiteFormattedMessage(chatMessage) - .build()); - } - - quickHopTargetWorld = rsWorld; - displaySwitcherAttempts = 0; - } - - @Subscribe - private void onGameTick(GameTick event) - { - if (quickHopTargetWorld == null) - { - return; - } - - if (client.getWidget(WidgetInfo.WORLD_SWITCHER_LIST) == null) - { - client.openWorldHopper(); - - if (++displaySwitcherAttempts >= DISPLAY_SWITCHER_MAX_ATTEMPTS) - { - String chatMessage = new ChatMessageBuilder() - .append(ChatColorType.NORMAL) - .append("Failed to quick-hop after ") - .append(ChatColorType.HIGHLIGHT) - .append(Integer.toString(displaySwitcherAttempts)) - .append(ChatColorType.NORMAL) - .append(" attempts.") - .build(); - - chatMessageManager - .queue(QueuedMessage.builder() - .type(ChatMessageType.CONSOLE) - .runeLiteFormattedMessage(chatMessage) - .build()); - - resetQuickHopper(); - } - } - else - { - client.hopToWorld(quickHopTargetWorld); - resetQuickHopper(); - } - } - - @Subscribe - private void onChatMessage(ChatMessage event) - { - if (event.getType() != ChatMessageType.GAMEMESSAGE) - { - return; - } - - if (event.getMessage().equals("Please finish what you're doing before using the World Switcher.")) - { - resetQuickHopper(); - } - } - - private void resetQuickHopper() - { - displaySwitcherAttempts = 0; - quickHopTargetWorld = null; - } - - private ChatPlayer getChatPlayerFromName(String name) - { - String cleanName = Text.removeTags(name); - - // Search clan members first, because if a friend is in the clan chat but their private - // chat is 'off', then the hop-to option will not get shown in the menu (issue #5679). - ClanMember[] clanMembers = client.getClanMembers(); - - if (clanMembers != null) - { - for (ClanMember clanMember : clanMembers) - { - if (clanMember != null && clanMember.getUsername().equals(cleanName)) - { - return clanMember; - } - } - } - - Friend[] friends = client.getFriends(); - - if (friends != null) - { - for (Friend friend : friends) - { - if (friend != null && friend.getName().equals(cleanName)) - { - return friend; - } - } - } - - return null; - } - - /** - * Ping all worlds. This takes a long time and is only run on first run. - */ - private void pingInitialWorlds() - { - WorldResult worldResult = worldService.getWorlds(); - if (worldResult == null || !this.showSidebar || !this.ping) - { - return; - } - - Stopwatch stopwatch = Stopwatch.createStarted(); - - for (World world : worldResult.getWorlds()) - { - int ping = ping(world); - SwingUtilities.invokeLater(() -> panel.updatePing(world.getId(), ping)); - } - - stopwatch.stop(); - - log.debug("Done pinging worlds in {}", stopwatch.elapsed()); - } - - private void updateConfig() - { - this.previousKey = config.previousKey(); - this.nextKey = config.nextKey(); - this.quickhopOutOfDanger = config.quickhopOutOfDanger(); - this.showSidebar = config.showSidebar(); - this.ping = config.ping(); - this.showWorldHopMessage = config.showWorldHopMessage(); - this.subscriptionFilter = config.subscriptionFilter(); - this.displayPing = config.displayPing(); - this.menuOption = config.menuOption(); - this.removePVPWorld = config.removePVPWorld(); - this.removeBHWorld = config.removeBHWorld(); - } - - /** - * Ping the next world - */ - private void pingNextWorld() - { - WorldResult worldResult = worldService.getWorlds(); - if (worldResult == null || !this.showSidebar || !this.ping) - { - return; - } - - List worlds = worldResult.getWorlds(); - if (worlds.isEmpty()) - { - return; - } - - if (currentWorld >= worlds.size()) - { - // Wrap back around - currentWorld = 0; - } - - World world = worlds.get(currentWorld++); - - // If we are displaying the ping overlay, there is a separate scheduled task for the current world - boolean displayPing = this.displayPing && client.getGameState() == GameState.LOGGED_IN; - if (displayPing && client.getWorld() == world.getId()) - { - return; - } - - int ping = ping(world); - log.trace("Ping for world {} is: {}", world.getId(), ping); - SwingUtilities.invokeLater(() -> panel.updatePing(world.getId(), ping)); - } - - /** - * Ping the current world for the ping overlay - */ - private void pingCurrentWorld() - { - WorldResult worldResult = worldService.getWorlds(); - // There is no reason to ping the current world if not logged in, as the overlay doesn't draw - if (worldResult == null || !this.displayPing || client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - final World currentWorld = worldResult.findWorld(client.getWorld()); - if (currentWorld == null) - { - log.debug("unable to find current world: {}", client.getWorld()); - return; - } - - currentPing = ping(currentWorld); - log.trace("Ping for current world is: {}", currentPing); - - SwingUtilities.invokeLater(() -> panel.updatePing(currentWorld.getId(), currentPing)); - } - - Integer getStoredPing(World world) - { - if (!this.ping) - { - return null; - } - - return storedPings.get(world.getId()); - } - - private int ping(World world) - { - int ping = Ping.ping(world); - storedPings.put(world.getId(), ping); - return ping; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldSwitcherPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldSwitcherPanel.java deleted file mode 100644 index 28e5d58d70..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldSwitcherPanel.java +++ /dev/null @@ -1,411 +0,0 @@ -/* - * Copyright (c) 2018, Psikoi - * 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.worldhopper; - -import com.google.common.collect.Ordering; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import lombok.AccessLevel; -import lombok.Setter; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.DynamicGridLayout; -import net.runelite.client.ui.PluginPanel; -import net.runelite.http.api.worlds.World; -import net.runelite.http.api.worlds.WorldType; - -class WorldSwitcherPanel extends PluginPanel -{ - private static final Color ODD_ROW = new Color(44, 44, 44); - - private static final int WORLD_COLUMN_WIDTH = 60; - private static final int PLAYERS_COLUMN_WIDTH = 40; - private static final int PING_COLUMN_WIDTH = 47; - - private final JPanel listContainer = new JPanel(); - - private WorldTableHeader worldHeader; - private WorldTableHeader playersHeader; - private WorldTableHeader activityHeader; - private WorldTableHeader pingHeader; - - private WorldOrder orderIndex = WorldOrder.WORLD; - private boolean ascendingOrder = true; - - private final ArrayList rows = new ArrayList<>(); - private final WorldHopperPlugin plugin; - @Setter(AccessLevel.PACKAGE) - private SubscriptionFilterMode filterMode; - - WorldSwitcherPanel(WorldHopperPlugin plugin) - { - this.plugin = plugin; - - setBorder(null); - setLayout(new DynamicGridLayout(0, 1)); - - JPanel headerContainer = buildHeader(); - - listContainer.setLayout(new GridLayout(0, 1)); - - add(headerContainer); - add(listContainer); - } - - void switchCurrentHighlight(int newWorld, int lastWorld) - { - for (WorldTableRow row : rows) - { - if (row.getWorld().getId() == newWorld) - { - row.recolour(true); - } - else if (row.getWorld().getId() == lastWorld) - { - row.recolour(false); - } - } - } - - void updateListData(Map worldData) - { - for (WorldTableRow worldTableRow : rows) - { - World world = worldTableRow.getWorld(); - Integer playerCount = worldData.get(world.getId()); - if (playerCount != null) - { - worldTableRow.updatePlayerCount(playerCount); - } - } - - // If the list is being ordered by player count, then it has to be re-painted - // to properly display the new data - if (orderIndex == WorldOrder.PLAYERS) - { - updateList(); - } - } - - void updatePing(int world, int ping) - { - for (WorldTableRow worldTableRow : rows) - { - if (worldTableRow.getWorld().getId() == world) - { - worldTableRow.setPing(ping); - - // If the panel is sorted by ping, re-sort it - if (orderIndex == WorldOrder.PING) - { - updateList(); - } - break; - } - } - } - - void hidePing() - { - for (WorldTableRow worldTableRow : rows) - { - worldTableRow.hidePing(); - } - } - - void showPing() - { - for (WorldTableRow worldTableRow : rows) - { - worldTableRow.showPing(); - } - } - - void updateList() - { - rows.sort((r1, r2) -> - { - switch (orderIndex) - { - case PING: - // Leave worlds with unknown ping at the bottom - return getCompareValue(r1, r2, row -> - { - int ping = row.getPing(); - return ping > 0 ? ping : null; - }); - case WORLD: - return getCompareValue(r1, r2, row -> row.getWorld().getId()); - case PLAYERS: - return getCompareValue(r1, r2, WorldTableRow::getUpdatedPlayerCount); - case ACTIVITY: - // Leave empty activity worlds on the bottom of the list - return getCompareValue(r1, r2, row -> - { - String activity = row.getWorld().getActivity(); - return !activity.equals("-") ? activity : null; - }); - default: - return 0; - } - }); - - rows.sort((r1, r2) -> - { - boolean b1 = plugin.isFavorite(r1.getWorld()); - boolean b2 = plugin.isFavorite(r2.getWorld()); - return Boolean.compare(b2, b1); - }); - - listContainer.removeAll(); - - for (int i = 0; i < rows.size(); i++) - { - WorldTableRow row = rows.get(i); - row.setBackground(i % 2 == 0 ? ODD_ROW : ColorScheme.DARK_GRAY_COLOR); - listContainer.add(row); - } - - listContainer.revalidate(); - listContainer.repaint(); - } - - private int getCompareValue(WorldTableRow row1, WorldTableRow row2, Function compareByFn) - { - Ordering ordering = Ordering.natural(); - if (!ascendingOrder) - { - ordering = ordering.reverse(); - } - ordering = ordering.nullsLast(); - return ordering.compare(compareByFn.apply(row1), compareByFn.apply(row2)); - } - - void updateFavoriteMenu(int world, boolean favorite) - { - for (WorldTableRow row : rows) - { - if (row.getWorld().getId() == world) - { - row.setFavoriteMenu(favorite); - } - } - } - - void resetAllFavoriteMenus() - { - for (WorldTableRow row : rows) - { - row.setFavoriteMenu(false); - } - - } - - void populate(List worlds) - { - rows.clear(); - - for (int i = 0; i < worlds.size(); i++) - { - World world = worlds.get(i); - - switch (filterMode) - { - case FREE: - if (world.getTypes().contains(WorldType.MEMBERS)) - { - continue; - } - break; - case MEMBERS: - if (!world.getTypes().contains(WorldType.MEMBERS)) - { - continue; - } - break; - } - - rows.add(buildRow(world, i % 2 == 0, world.getId() == plugin.getCurrentWorld() && plugin.getLastWorld() != 0, plugin.isFavorite(world))); - } - - updateList(); - } - - private void orderBy(WorldOrder order) - { - pingHeader.highlight(false, ascendingOrder); - worldHeader.highlight(false, ascendingOrder); - playersHeader.highlight(false, ascendingOrder); - activityHeader.highlight(false, ascendingOrder); - - switch (order) - { - case PING: - pingHeader.highlight(true, ascendingOrder); - break; - case WORLD: - worldHeader.highlight(true, ascendingOrder); - break; - case PLAYERS: - playersHeader.highlight(true, ascendingOrder); - break; - case ACTIVITY: - activityHeader.highlight(true, ascendingOrder); - break; - } - - orderIndex = order; - updateList(); - } - - /** - * Builds the entire table header. - */ - private JPanel buildHeader() - { - JPanel header = new JPanel(new BorderLayout()); - JPanel leftSide = new JPanel(new BorderLayout()); - JPanel rightSide = new JPanel(new BorderLayout()); - - pingHeader = new WorldTableHeader("Ping", orderIndex == WorldOrder.PING, ascendingOrder, plugin::refresh); - pingHeader.setPreferredSize(new Dimension(PING_COLUMN_WIDTH, 0)); - pingHeader.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - if (SwingUtilities.isRightMouseButton(mouseEvent)) - { - return; - } - ascendingOrder = orderIndex != WorldOrder.PING || !ascendingOrder; - orderBy(WorldOrder.PING); - } - }); - - worldHeader = new WorldTableHeader("World", orderIndex == WorldOrder.WORLD, ascendingOrder, plugin::refresh); - worldHeader.setPreferredSize(new Dimension(WORLD_COLUMN_WIDTH, 0)); - worldHeader.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - if (SwingUtilities.isRightMouseButton(mouseEvent)) - { - return; - } - ascendingOrder = orderIndex != WorldOrder.WORLD || !ascendingOrder; - orderBy(WorldOrder.WORLD); - } - }); - - playersHeader = new WorldTableHeader("#", orderIndex == WorldOrder.PLAYERS, ascendingOrder, plugin::refresh); - playersHeader.setPreferredSize(new Dimension(PLAYERS_COLUMN_WIDTH, 0)); - playersHeader.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - if (SwingUtilities.isRightMouseButton(mouseEvent)) - { - return; - } - ascendingOrder = orderIndex != WorldOrder.PLAYERS || !ascendingOrder; - orderBy(WorldOrder.PLAYERS); - } - }); - - activityHeader = new WorldTableHeader("Activity", orderIndex == WorldOrder.ACTIVITY, ascendingOrder, plugin::refresh); - activityHeader.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent mouseEvent) - { - if (SwingUtilities.isRightMouseButton(mouseEvent)) - { - return; - } - ascendingOrder = orderIndex != WorldOrder.ACTIVITY || !ascendingOrder; - orderBy(WorldOrder.ACTIVITY); - } - }); - - leftSide.add(worldHeader, BorderLayout.WEST); - leftSide.add(playersHeader, BorderLayout.CENTER); - - rightSide.add(activityHeader, BorderLayout.CENTER); - rightSide.add(pingHeader, BorderLayout.EAST); - - header.add(leftSide, BorderLayout.WEST); - header.add(rightSide, BorderLayout.CENTER); - - return header; - } - - /** - * Builds a table row, that displays the world's information. - */ - private WorldTableRow buildRow(World world, boolean stripe, boolean current, boolean favorite) - { - WorldTableRow row = new WorldTableRow(world, current, favorite, plugin.getStoredPing(world), - plugin::hopTo, - (world12, add) -> - { - if (add) - { - plugin.addToFavorites(world12); - } - else - { - plugin.removeFromFavorites(world12); - } - - updateList(); - } - ); - row.setBackground(stripe ? ODD_ROW : ColorScheme.DARK_GRAY_COLOR); - return row; - } - - /** - * Enumerates the multiple ordering options for the world list. - */ - private enum WorldOrder - { - WORLD, - PLAYERS, - ACTIVITY, - PING - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableHeader.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableHeader.java deleted file mode 100644 index bc15a087fe..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableHeader.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2018, Psikoi - * 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.worldhopper; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.image.BufferedImage; -import javax.annotation.Nonnull; -import javax.inject.Singleton; -import javax.swing.BorderFactory; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.border.CompoundBorder; -import javax.swing.border.EmptyBorder; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.util.ImageUtil; - -@Singleton -class WorldTableHeader extends JPanel -{ - private static final ImageIcon ARROW_UP; - private static final ImageIcon HIGHLIGHT_ARROW_DOWN; - private static final ImageIcon HIGHLIGHT_ARROW_UP; - - private static final Color ARROW_COLOR = ColorScheme.LIGHT_GRAY_COLOR; - private static final Color HIGHLIGHT_COLOR = ColorScheme.BRAND_BLUE; - - static - { - final BufferedImage arrowDown = ImageUtil.getResourceStreamFromClass(WorldHopperPlugin.class, "arrow_down.png"); - final BufferedImage arrowUp = ImageUtil.rotateImage(arrowDown, Math.PI); - final BufferedImage arrowUpFaded = ImageUtil.luminanceOffset(arrowUp, -80); - ARROW_UP = new ImageIcon(arrowUpFaded); - - final BufferedImage highlightArrowDown = ImageUtil.fillImage(arrowDown, HIGHLIGHT_COLOR); - final BufferedImage highlightArrowUp = ImageUtil.fillImage(arrowUp, HIGHLIGHT_COLOR); - HIGHLIGHT_ARROW_DOWN = new ImageIcon(highlightArrowDown); - HIGHLIGHT_ARROW_UP = new ImageIcon(highlightArrowUp); - } - - private final JLabel textLabel = new JLabel(); - private final JLabel arrowLabel = new JLabel(); - // Determines if this header column is being used to order the list - private boolean ordering = false; - - WorldTableHeader(String title, boolean ordered, boolean ascending, @Nonnull Runnable onRefresh) - { - setLayout(new BorderLayout(5, 0)); - setBorder(new CompoundBorder( - BorderFactory.createMatteBorder(0, 0, 0, 1, ColorScheme.MEDIUM_GRAY_COLOR), - new EmptyBorder(0, 5, 0, 2))); - setBackground(ColorScheme.SCROLL_TRACK_COLOR); - - addMouseListener(new MouseAdapter() - { - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - textLabel.setForeground(HIGHLIGHT_COLOR); - if (!ordering) - { - arrowLabel.setIcon(HIGHLIGHT_ARROW_UP); - } - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - if (!ordering) - { - textLabel.setForeground(ARROW_COLOR); - arrowLabel.setIcon(ARROW_UP); - } - } - }); - - textLabel.setText(title); - textLabel.setFont(FontManager.getRunescapeSmallFont()); - - final JMenuItem refresh = new JMenuItem("Refresh worlds"); - refresh.addActionListener(e -> - onRefresh.run()); - - final JPopupMenu popupMenu = new JPopupMenu(); - popupMenu.setBorder(new EmptyBorder(5, 5, 5, 5)); - popupMenu.add(refresh); - - textLabel.setComponentPopupMenu(popupMenu); - setComponentPopupMenu(popupMenu); - - highlight(ordered, ascending); - - add(textLabel, BorderLayout.WEST); - add(arrowLabel, BorderLayout.EAST); - } - - /** - * The labels inherit the parent's mouse listeners. - */ - @Override - public void addMouseListener(MouseListener mouseListener) - { - super.addMouseListener(mouseListener); - textLabel.addMouseListener(mouseListener); - arrowLabel.addMouseListener(mouseListener); - } - - /** - * If this column header is being used to order, then it should be - * highlighted, changing it's font color and icon. - */ - public void highlight(boolean on, boolean ascending) - { - ordering = on; - arrowLabel.setIcon(on ? (ascending ? HIGHLIGHT_ARROW_DOWN : HIGHLIGHT_ARROW_UP) : ARROW_UP); - textLabel.setForeground(on ? HIGHLIGHT_COLOR : ARROW_COLOR); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableRow.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableRow.java deleted file mode 100644 index 8b45a44549..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableRow.java +++ /dev/null @@ -1,349 +0,0 @@ -/* - * Copyright (c) 2018, Psikoi - * 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.worldhopper; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.function.BiConsumer; -import java.util.function.Consumer; -import javax.inject.Singleton; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.border.EmptyBorder; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.client.ui.FontManager; -import net.runelite.client.util.ImageUtil; -import net.runelite.http.api.worlds.World; -import net.runelite.http.api.worlds.WorldType; - -@Singleton -class WorldTableRow extends JPanel -{ - private static final ImageIcon FLAG_AUS; - private static final ImageIcon FLAG_UK; - private static final ImageIcon FLAG_US; - private static final ImageIcon FLAG_GER; - - private static final int WORLD_COLUMN_WIDTH = 60; - private static final int PLAYERS_COLUMN_WIDTH = 40; - private static final int PING_COLUMN_WIDTH = 35; - - private static final Color CURRENT_WORLD = new Color(66, 227, 17); - private static final Color UNAVAILABLE_WORLD = Color.GRAY.darker().darker(); - private static final Color DANGEROUS_WORLD = new Color(251, 62, 62); - private static final Color TOURNAMENT_WORLD = new Color(79, 145, 255); - private static final Color MEMBERS_WORLD = new Color(210, 193, 53); - private static final Color FREE_WORLD = new Color(200, 200, 200); - private static final Color LEAGUE_WORLD = new Color(157, 237, 1); - - static - { - FLAG_AUS = new ImageIcon(ImageUtil.getResourceStreamFromClass(WorldHopperPlugin.class, "flag_aus.png")); - FLAG_UK = new ImageIcon(ImageUtil.getResourceStreamFromClass(WorldHopperPlugin.class, "flag_uk.png")); - FLAG_US = new ImageIcon(ImageUtil.getResourceStreamFromClass(WorldHopperPlugin.class, "flag_us.png")); - FLAG_GER = new ImageIcon(ImageUtil.getResourceStreamFromClass(WorldHopperPlugin.class, "flag_ger.png")); - } - - private final JMenuItem favoriteMenuOption = new JMenuItem(); - - private JLabel worldField; - private JLabel playerCountField; - private JLabel activityField; - private JLabel pingField; - private BiConsumer onFavorite; - - @Getter(AccessLevel.PACKAGE) - private final World world; - - @Getter(AccessLevel.PACKAGE) - private int updatedPlayerCount; - - private int ping; - - private Color lastBackground; - - WorldTableRow(World world, boolean current, boolean favorite, Integer ping, Consumer onSelect, BiConsumer onFavorite) - { - this.world = world; - this.onFavorite = onFavorite; - this.updatedPlayerCount = world.getPlayers(); - - setLayout(new BorderLayout()); - setBorder(new EmptyBorder(2, 0, 2, 0)); - - addMouseListener(new MouseAdapter() - { - @Override - public void mouseClicked(MouseEvent mouseEvent) - { - if (mouseEvent.getClickCount() == 2) - { - if (onSelect != null) - { - onSelect.accept(world); - } - } - } - - @Override - public void mousePressed(MouseEvent mouseEvent) - { - if (mouseEvent.getClickCount() == 2) - { - setBackground(getBackground().brighter()); - } - } - - @Override - public void mouseReleased(MouseEvent mouseEvent) - { - if (mouseEvent.getClickCount() == 2) - { - setBackground(getBackground().darker()); - } - } - - @Override - public void mouseEntered(MouseEvent mouseEvent) - { - WorldTableRow.this.lastBackground = getBackground(); - setBackground(getBackground().brighter()); - } - - @Override - public void mouseExited(MouseEvent mouseEvent) - { - setBackground(lastBackground); - } - }); - - setFavoriteMenu(favorite); - - final JPopupMenu popupMenu = new JPopupMenu(); - popupMenu.setBorder(new EmptyBorder(5, 5, 5, 5)); - popupMenu.add(favoriteMenuOption); - - setComponentPopupMenu(popupMenu); - - JPanel leftSide = new JPanel(new BorderLayout()); - JPanel rightSide = new JPanel(new BorderLayout()); - leftSide.setOpaque(false); - rightSide.setOpaque(false); - - JPanel worldField = buildWorldField(); - worldField.setPreferredSize(new Dimension(WORLD_COLUMN_WIDTH, 0)); - worldField.setOpaque(false); - - JPanel pingField = buildPingField(ping); - pingField.setPreferredSize(new Dimension(PING_COLUMN_WIDTH, 0)); - pingField.setOpaque(false); - - JPanel playersField = buildPlayersField(); - playersField.setPreferredSize(new Dimension(PLAYERS_COLUMN_WIDTH, 0)); - playersField.setOpaque(false); - - JPanel activityField = buildActivityField(); - activityField.setBorder(new EmptyBorder(5, 5, 5, 5)); - activityField.setOpaque(false); - - recolour(current); - - leftSide.add(worldField, BorderLayout.WEST); - leftSide.add(playersField, BorderLayout.CENTER); - rightSide.add(activityField, BorderLayout.CENTER); - rightSide.add(pingField, BorderLayout.EAST); - - add(leftSide, BorderLayout.WEST); - add(rightSide, BorderLayout.CENTER); - } - - void setFavoriteMenu(boolean favorite) - { - String favoriteAction = favorite ? - "Remove " + world.getId() + " from favorites" : - "Add " + world.getId() + " to favorites"; - - favoriteMenuOption.setText(favoriteAction); - - for (ActionListener listener : favoriteMenuOption.getActionListeners()) - { - favoriteMenuOption.removeActionListener(listener); - } - - favoriteMenuOption.addActionListener(e -> - onFavorite.accept(world, !favorite)); - } - - void updatePlayerCount(int playerCount) - { - this.updatedPlayerCount = playerCount; - playerCountField.setText(String.valueOf(playerCount)); - } - - void setPing(int ping) - { - this.ping = ping; - pingField.setText(ping <= 0 ? "-" : Integer.toString(ping)); - } - - void hidePing() - { - pingField.setText("-"); - } - - void showPing() - { - setPing(ping); // to update pingField - } - - int getPing() - { - return ping; - } - - public void recolour(boolean current) - { - playerCountField.setForeground(current ? CURRENT_WORLD : Color.WHITE); - pingField.setForeground(current ? CURRENT_WORLD : Color.WHITE); - - if (current) - { - activityField.setForeground(CURRENT_WORLD); - worldField.setForeground(CURRENT_WORLD); - return; - } - else if (world.getTypes().contains(WorldType.PVP) - || world.getTypes().contains(WorldType.HIGH_RISK) - || world.getTypes().contains(WorldType.DEADMAN)) - { - activityField.setForeground(DANGEROUS_WORLD); - } - else if (world.getTypes().contains(WorldType.LEAGUE)) - { - activityField.setForeground(LEAGUE_WORLD); - } - else if (world.getTypes().contains(WorldType.TOURNAMENT)) - { - activityField.setForeground(TOURNAMENT_WORLD); - } - else - { - activityField.setForeground(Color.WHITE); - } - - worldField.setForeground(world.getTypes().contains(WorldType.MEMBERS) ? MEMBERS_WORLD : FREE_WORLD); - } - - /** - * Builds the players list field (containing the amount of players logged in that world). - */ - private JPanel buildPlayersField() - { - JPanel column = new JPanel(new BorderLayout()); - column.setBorder(new EmptyBorder(0, 5, 0, 5)); - - playerCountField = new JLabel(world.getPlayers() + ""); - playerCountField.setFont(FontManager.getRunescapeSmallFont()); - - column.add(playerCountField, BorderLayout.WEST); - - return column; - } - - private JPanel buildPingField(Integer ping) - { - JPanel column = new JPanel(new BorderLayout()); - column.setBorder(new EmptyBorder(0, 5, 0, 5)); - - pingField = new JLabel("-"); - pingField.setFont(FontManager.getRunescapeSmallFont()); - - column.add(pingField, BorderLayout.EAST); - - if (ping != null) - { - setPing(ping); - } - - return column; - } - - /** - * Builds the activity list field (containing that world's activity/theme). - */ - private JPanel buildActivityField() - { - JPanel column = new JPanel(new BorderLayout()); - column.setBorder(new EmptyBorder(0, 5, 0, 5)); - - activityField = new JLabel(world.getActivity()); - activityField.setFont(FontManager.getRunescapeSmallFont()); - - column.add(activityField, BorderLayout.WEST); - - return column; - } - - /** - * Builds the world list field (containing the country's flag and the world index). - */ - private JPanel buildWorldField() - { - JPanel column = new JPanel(new BorderLayout(7, 0)); - column.setBorder(new EmptyBorder(0, 5, 0, 5)); - - worldField = new JLabel(world.getId() + ""); - - JLabel flag = new JLabel(getFlag(world.getLocation())); - - column.add(flag, BorderLayout.WEST); - column.add(worldField, BorderLayout.CENTER); - - return column; - } - - private ImageIcon getFlag(int locationId) - { - switch (locationId) - { - case 0: - return FLAG_US; - case 1: - return FLAG_UK; - case 3: - return FLAG_AUS; - default: - return FLAG_GER; - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/AgilityShortcutPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/AgilityShortcutPoint.java deleted file mode 100644 index 1629b53351..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/AgilityShortcutPoint.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2018, Morgan Lewis - * 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.client.plugins.worldmap; - -import java.awt.image.BufferedImage; -import net.runelite.client.game.AgilityShortcut; -import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; - -class AgilityShortcutPoint extends WorldMapPoint -{ - AgilityShortcutPoint(AgilityShortcut data, BufferedImage icon, boolean showTooltip) - { - super(data.getWorldMapLocation(), icon); - - if (showTooltip) - { - setTooltip(data.getTooltip()); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FairyRingLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FairyRingLocation.java deleted file mode 100644 index c5fb7ac05c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FairyRingLocation.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2018, Morgan Lewis - * 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.client.plugins.worldmap; - -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.coords.WorldPoint; - -@Getter(AccessLevel.PACKAGE) -enum FairyRingLocation -{ - AIR("AIR", new WorldPoint(2699, 3249, 0)), - AIQ("AIQ", new WorldPoint(2995, 3112, 0)), - AJR("AJR", new WorldPoint(2779, 3615, 0)), - AJS("AJS", new WorldPoint(2499, 3898, 0)), - AKQ("AKQ", new WorldPoint(2318, 3617, 0)), - AKS("AKS", new WorldPoint(2570, 2958, 0)), - ALP("ALP", new WorldPoint(2502, 3638, 0)), - ALQ("ALQ", new WorldPoint(3598, 3496, 0)), - ALS("ALS", new WorldPoint(2643, 3497, 0)), - BIP("BIP", new WorldPoint(3409, 3326, 0)), - BIQ("BIQ", new WorldPoint(3248, 3095, 0)), - BIS("BIS", new WorldPoint(2635, 3268, 0)), - BJS("BJS", new WorldPoint(2147, 3069, 0)), - BKP("BKP", new WorldPoint(2384, 3037, 0)), - BKR("BKR", new WorldPoint(3468, 3433, 0)), - BLP("BLP", new WorldPoint(2432, 5127, 0)), - BLR("BLR", new WorldPoint(2739, 3353, 0)), - CIP("CIP", new WorldPoint(2512, 3886, 0)), - CIR("CIR", new WorldPoint(1303, 3762, 0)), - CIQ("CIQ", new WorldPoint(2527, 3129, 0)), - CJR("CJR", new WorldPoint(2704, 3578, 0)), - CKR("CKR", new WorldPoint(2800, 3005, 0)), - CKS("CKS", new WorldPoint(3446, 3472, 0)), - CLP("CLP", new WorldPoint(3081, 3208, 0)), - CLS("CLS", new WorldPoint(2681, 3083, 0)), - DIP("DIP", new WorldPoint(3039, 4757, 0)), - DIS("DIS", new WorldPoint(3109, 3149, 0)), - DJP("DJP", new WorldPoint(2657, 3232, 0)), - DJR("DJR", new WorldPoint(1452, 3659, 0)), - DKP("DKP", new WorldPoint(2899, 3113, 0)), - DKR("DKR", new WorldPoint(3126, 3496, 0)), - DKS("DKS", new WorldPoint(2743, 3721, 0)), - DLQ("DLQ", new WorldPoint(3422, 3018, 0)), - DLR("DLR", new WorldPoint(2212, 3101, 0)), - CIS("CIS", new WorldPoint(1638, 3868, 0)), - CLR("CLR", new WorldPoint(2737, 2739, 0)), - ZANARIS("Zanaris", new WorldPoint(2411, 4436, 0)); - - private final String code; - private final WorldPoint location; - - FairyRingLocation(String code, WorldPoint location) - { - this.code = code; - this.location = location; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FairyRingPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FairyRingPoint.java deleted file mode 100644 index ef4e55da92..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FairyRingPoint.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2018, Morgan Lewis - * 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.client.plugins.worldmap; - -import java.awt.image.BufferedImage; -import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; - -class FairyRingPoint extends WorldMapPoint -{ - FairyRingPoint(FairyRingLocation data, BufferedImage icon, boolean showTooltip) - { - super(data.getLocation(), icon); - - if (showTooltip) - { - setTooltip("Fairy Ring - " + data.getCode()); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FarmingPatchLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FarmingPatchLocation.java deleted file mode 100644 index 6534fa1df7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FarmingPatchLocation.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2018, Torkel Velure - * 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.client.plugins.worldmap; - -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.coords.WorldPoint; - -@Getter(AccessLevel.PACKAGE) -enum FarmingPatchLocation -{ - ALLOTMENT("Allotment", - new WorldPoint(3793, 2836, 0), - new WorldPoint(1269, 3730, 0) - ), - ALLOTMENT_FLOWER("Allotment/Flower", new WorldPoint(3289, 6100, 0)), - ALLOTMENT_HERB_FLOWER("Allotment/Herb/Flower", - new WorldPoint(1809, 3490, 0), - new WorldPoint(3598, 3524, 0), - new WorldPoint(3052, 3309, 0), - new WorldPoint(2810, 3462, 0), - new WorldPoint(2663, 3375, 0) - ), - ANIMA_HERB("Anima/Herb", new WorldPoint(1235, 3724, 0)), - BELLADONNA("Belladonna", new WorldPoint(3084, 3356, 0)), - BUSH("Bush", - new WorldPoint(2938, 3223, 0), - new WorldPoint(2589, 3862, 0), - new WorldPoint(3182, 3356, 0), - new WorldPoint(2615, 3224, 0) - ), - BUSH_FLOWER("Bush/Flower", new WorldPoint(1259, 3729, 0)), - CACTUS("Cactus", - new WorldPoint(3313, 3201, 0), - new WorldPoint(1264, 3745, 0) - ), - CALQUAT("Calquat", new WorldPoint(2793, 3099, 0)), - CELASTRUS_FRUIT_TREE("Celastrus/Fruit Tree", - new WorldPoint(1242, 3755, 0) - ), - CRYSTAL_TREE("Crystal Tree", - new WorldPoint(3292, 6120, 0) - ), - FRUIT_TREE("Fruit Tree", - new WorldPoint(2487, 3181, 0), - new WorldPoint(2343, 3160, 0), - new WorldPoint(2472, 3445, 0), - new WorldPoint(2858, 3432, 0), - new WorldPoint(2765, 3211, 0) - ), - GRAPES("Grapes", new WorldPoint(1807, 3555, 0)), - HARDWOOD("Hardwood", - new WorldPoint(3707, 3838, 0) - ), - HERB("Herb", - new WorldPoint(3789, 2840, 0), - new WorldPoint(2847, 3933, 0), - new WorldPoint(2828, 3696, 0) - ), - HESPORI("Hespori", new WorldPoint(1182, 10068, 0)), - HOPS("Hops", - new WorldPoint(2572, 3102, 0), - new WorldPoint(2661, 3523, 0), - new WorldPoint(3224, 3313, 0), - new WorldPoint(3812, 3334, 0) - ), - MUSHROOM("Mushroom", new WorldPoint(3449, 3471, 0)), - REDWOOD("Redwood", new WorldPoint(1233, 3754, 0)), - SEAWEED("Seaweed", new WorldPoint(3730, 10271, 0)), - SPIRIT_TREE("Spirit Tree", - new WorldPoint(3056, 3259, 0), - new WorldPoint(1690, 3540, 0), - new WorldPoint(3614, 3856, 0), - new WorldPoint(2799, 3205, 0), - new WorldPoint(1254, 3753, 0) - ), - TREE("Tree", - new WorldPoint(3226, 3457, 0), - new WorldPoint(2933, 3436, 0), - new WorldPoint(3189, 3233, 0), - new WorldPoint(2434, 3418, 0), - new WorldPoint(3005, 3375, 0), - new WorldPoint(1234, 3736, 0) - ); - - private final String tooltip; - private final WorldPoint[] locations; - - FarmingPatchLocation(String description, WorldPoint... locations) - { - this.tooltip = "Farming patch - " + description; - this.locations = locations; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FarmingPatchPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FarmingPatchPoint.java deleted file mode 100644 index 79b380c220..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/FarmingPatchPoint.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2018, Torkel Velure - * 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.client.plugins.worldmap; - -import java.awt.image.BufferedImage; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; - -class FarmingPatchPoint extends WorldMapPoint -{ - FarmingPatchPoint(WorldPoint point, String tooltip, BufferedImage icon) - { - super(point, icon); - setTooltip(tooltip); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigameLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigameLocation.java deleted file mode 100644 index bce8b35aea..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigameLocation.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2018, Magic fTail - * 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.client.plugins.worldmap; - -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.coords.WorldPoint; - -@Getter(AccessLevel.PACKAGE) -enum MinigameLocation -{ - BARBARIAN_ASSAULT("Barbarian Assault", new WorldPoint(2531, 3569, 0)), - BURGH_DE_ROTT_RAMBLE("Burgh de Rott Ramble", new WorldPoint(3434, 3487, 0)), - CASTLE_WARS("Castle Wars", new WorldPoint(2439, 3092, 0)), - DUEL_ARENA("Duel Arena", new WorldPoint(3313, 3238, 0)), - MAGE_ARENA("Mage Arena", new WorldPoint(3095, 3957, 0)), - NIGHTMARE_ZONE("Nightmare Zone", new WorldPoint(2606, 3115, 0)), - PEST_CONTROL_NOVICE("Pest Control Novice", new WorldPoint(2660, 2637, 0)), - PEST_CONTROL_INTERMEDIATE("Pest Control Intermediate", new WorldPoint(2638, 2641, 0)), - PEST_CONTROL_VETERAN("Pest Control Veteran", new WorldPoint(2632, 2648, 0)), - TEMPLE_TREKKING("Temple Trekking", new WorldPoint(3479, 3240, 0)), - TZHAAR_FIGHT_CAVE("TzHaar Fight Cave", new WorldPoint(2437, 5168, 0)), - TZHAAR_FIGHT_PIT("TzHaar Fight Pit", new WorldPoint(2398, 5177, 0)), - LAST_MAN_STANDING("Last Man Standing", new WorldPoint(3403, 3177, 0)), - INFERNO("Inferno", new WorldPoint(2495, 5118, 0)), - BRIMHAVEN_AGILITY_ARENA("Brimhaven Agility Arena", new WorldPoint(2809, 3191, 0)), - FISHING_TRAWLER("Fishing Trawler", new WorldPoint(2667, 3163, 0)), - GNOME_BALL("Gnome Ball", new WorldPoint(2381, 3488, 0)), - GNOME_RESTAURANT("Gnome Restaurant", new WorldPoint(2436, 3502, 0)), - IMPETUOUS_IMPULSES("Impetuous Impulses", new WorldPoint(2425, 4445, 0)), - MAGE_TRAINING_ARENA("Mage Training Arena", new WorldPoint(3362, 3318, 0)), - PYRAMID_PLUNDER("Pyramid Plunder", new WorldPoint(3288, 2787, 0)), - RANGING_GUILD("Ranging Guild", new WorldPoint(2671, 3419, 0)), - ROGUES_DEN("Rogues' Den", new WorldPoint(2905, 3537, 0)), - SORCERESSS_GARDEN("Sorceress's Garden", new WorldPoint(3285, 3180, 0)), - TROUBLE_BREWING("Trouble Brewing", new WorldPoint(3811, 3021, 0)), - VOLCANIC_MINE("Volcanic Mine", new WorldPoint(3812, 3810, 0)), - TAI_BWO_WANNAI_CLEANUP("Tai Bwo Wannai Cleanup", new WorldPoint(2795, 3066, 0)), - BURTHORPE_GAMES_ROOM("Burthorpe Games Room", new WorldPoint(2900, 3565, 0)), - RAT_PITS_PORT_SARIM("Rat Pits", new WorldPoint(3015, 3232, 0)), - RAT_PITS_VARROCK("Rat Pits", new WorldPoint(3266, 3400, 0)), - RAT_PITS_ARDOUGNE("Rat Pits", new WorldPoint(2561, 3318, 0)), - RAT_PITS_KELDAGRIM("Rat Pits", new WorldPoint(2913, 10188, 0)), - TEARS_OF_GUTHIX("Tears of Guthix", new WorldPoint(3257, 9517, 0)), - CLAN_WARS_1("Clan Wars", new WorldPoint(3349, 3164, 0)), - CLAN_WARS_2("Clan Wars", new WorldPoint(3365, 3175, 0)), - CLAN_WARS_3("Clan Wars", new WorldPoint(3374, 3159, 0)), - ANIMATION_ROOM("Animation Room", new WorldPoint(2853, 3537, 0)), - DUMMY_ROOM("Dummy Room", new WorldPoint(2857, 3551, 0)), - CATAPULT_ROOM("Catapult Room", new WorldPoint(2842, 3545, 0)), - SHOT_PUT_ROOM("Shot Put Room", new WorldPoint(2863, 3550, 0)), - THE_GAUNTLET("The Gauntlet", new WorldPoint(3223, 12505, 1)); - - private final String tooltip; - private final WorldPoint location; - - MinigameLocation(String tooltip, WorldPoint location) - { - this.tooltip = tooltip; - this.location = location; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigamePoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigamePoint.java deleted file mode 100644 index bd670aa023..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/MinigamePoint.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2018, Magic fTail - * 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.client.plugins.worldmap; - -import java.awt.image.BufferedImage; -import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; - -class MinigamePoint extends WorldMapPoint -{ - MinigamePoint(MinigameLocation data, BufferedImage icon) - { - super(data.getLocation(), icon); - setTooltip(data.getTooltip()); - } -} \ No newline at end of file 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 deleted file mode 100644 index b011533537..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (c) 2018, John James Hamilton - * 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.client.plugins.worldmap; - -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Quest; -import net.runelite.api.coords.WorldPoint; - -// 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(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_PHOENIX_GANG(Quest.SHIELD_OF_ARRAV, new WorldPoint(3208, 3495, 0)), - SHIELD_OF_ARRAV_BLACK_ARM_GANG(Quest.SHIELD_OF_ARRAV, new WorldPoint(3208, 3392, 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(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(1699, 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(1781, 3570, 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)), - THE_FREMENNIK_EXILES(Quest.THE_FREMENNIK_EXILES, new WorldPoint(2658, 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(2618, 3691, 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_END_PART_I(Quest.MOURNINGS_END_PART_I, new WorldPoint(2289, 3149, 0)), - MOURNINGS_END_PART_II(Quest.MOURNINGS_END_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)), - 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_SONG_OF_THE_ELVES(new Quest[]{Quest.PLAGUE_CITY, Quest.SONG_OF_THE_ELVES}, 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.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)), - 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(AccessLevel.PACKAGE) - private final WorldPoint location; - - @Getter(AccessLevel.PACKAGE) - private final Quest[] quests; - - QuestStartLocation(Quest[] quests, WorldPoint location) - { - 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 deleted file mode 100644 index ca70fd4410..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartPoint.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2018, John James Hamilton - * 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.client.plugins.worldmap; - -import java.awt.image.BufferedImage; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; - -class QuestStartPoint extends WorldMapPoint -{ - QuestStartPoint(WorldPoint location, BufferedImage icon, String tooltip) - { - super(location, icon); - setTooltip(tooltip); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java deleted file mode 100644 index 4f34aa8cf8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (c) 2018, Spedwards - * 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.client.plugins.worldmap; - -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.coords.WorldPoint; - -@Getter(AccessLevel.PACKAGE) -enum RareTreeLocation -{ - WILLOW("Willow tree", 30, - // Kandarin - new WorldPoint(2710, 3510, 0)), - - TEAK("Teak tree", 35, - // Ape Atoll - new WorldPoint(2774, 2697, 0), - - // Desert - new WorldPoint(3510, 3073, 0), - - // Mos Le'Harmless - new WorldPoint(3832, 3067, 0), - - // Karamja - new WorldPoint(2837, 2907, 0), - new WorldPoint(2899, 2897, 0), - - // Feldip Hills - new WorldPoint(2333, 3049, 0), - - // Prifddinas - new WorldPoint(3309, 6123, 0)), - - SWAYING("Swaying tree", 40, - // The Fremennik Trials - new WorldPoint(2738, 3639, 0)), - - MATURE_JUNIPER("Mature juniper tree", 42, - // Zeah - new WorldPoint(1690, 3524, 0)), - - MAPLE("Maple tree", 45, - // Zeah - new WorldPoint(1231, 3704, 0), - new WorldPoint(1293, 3756, 0), - new WorldPoint(1640, 3496, 0), - new WorldPoint(1613, 3494, 0), - new WorldPoint(1560, 3636, 0), - new WorldPoint(1646, 3590, 0), - - // Miscellania - new WorldPoint(2550, 3869, 0), - - // Kandarin - new WorldPoint(2712, 3382, 0), - new WorldPoint(2720, 3465, 0), - new WorldPoint(2726, 3501, 0), - new WorldPoint(2728, 3481, 0), - new WorldPoint(2748, 3466, 0), - new WorldPoint(2710, 3570, 0), - - // Prifddinas - new WorldPoint(2209, 3427, 0), - new WorldPoint(3233, 6179, 0)), - - MAHOGANY("Mahogany tree", 50, - // Zeah - new WorldPoint(1237, 3770, 0), - - // Ape Atoll - new WorldPoint(2716, 2710, 0), - new WorldPoint(2725, 2735, 0), - - // Mos Le'Harmless - new WorldPoint(3824, 3053, 0), - - // Karamja - new WorldPoint(2946, 2908, 0), - - // Prifddinas - new WorldPoint(3301, 6129, 0)), - - TEAK_MAHOGANY("Teak/Mahogany trees", 50, - // Miscellania - new WorldPoint(2602, 3895, 0), - - // Mos Le'Harmless - new WorldPoint(3810, 3058, 0), - - // Karamja - new WorldPoint(2821, 3084, 0)), - - YEW("Yew tree", 60, - // Zeah - new WorldPoint(1217, 3688, 0), - new WorldPoint(1353, 3731, 0), - new WorldPoint(1529, 3452, 0), - new WorldPoint(1591, 3421, 0), - new WorldPoint(1647, 3508, 0), - new WorldPoint(1621, 3512, 0), - new WorldPoint(1593, 3491, 0), - new WorldPoint(1583, 3499, 0), - new WorldPoint(1696, 3554, 0), - new WorldPoint(1625, 3677, 0), - new WorldPoint(1625, 3669, 0), - new WorldPoint(1642, 3683, 0), - new WorldPoint(1642, 3663, 0), - new WorldPoint(1642, 3533, 0), - new WorldPoint(1671, 3657, 0), - new WorldPoint(1680, 3657, 0), - - // Tirannwn - new WorldPoint(2217, 3141, 0), - - // Prifddinas - new WorldPoint(3288, 6066, 0), - new WorldPoint(3305, 6032, 0), - - // Kandarin - new WorldPoint(2315, 3610, 0), - new WorldPoint(2331, 3514, 0), - new WorldPoint(2358, 3510, 0), - new WorldPoint(2360, 3471, 0), - new WorldPoint(2434, 3432, 0), - new WorldPoint(2493, 3396, 0), - new WorldPoint(2494, 3490, 0), - new WorldPoint(2733, 3334, 0), - new WorldPoint(2757, 3431, 0), - new WorldPoint(2714, 3460, 0), - - // Asgarnia - new WorldPoint(2995, 3312, 0), - new WorldPoint(3018, 3316, 0), - new WorldPoint(3041, 3320, 0), - new WorldPoint(3052, 3272, 0), - new WorldPoint(2931, 3231, 0), - - // Misthalin - new WorldPoint(3085, 3481, 0), - new WorldPoint(3085, 3469, 0), - new WorldPoint(3146, 3255, 0), - new WorldPoint(3151, 3231, 0), - new WorldPoint(3165, 3220, 0), - new WorldPoint(3184, 3227, 0), - new WorldPoint(3251, 3364, 0), - new WorldPoint(3204, 3504, 0), - new WorldPoint(3208, 3500, 0), - new WorldPoint(3221, 3503, 0), - new WorldPoint(3248, 3473, 0), - new WorldPoint(3266, 3494, 0), - new WorldPoint(3270, 3471, 0), - new WorldPoint(3304, 3470, 0), - new WorldPoint(3249, 3202, 0), - - // Morytania - new WorldPoint(3674, 3447, 0), - new WorldPoint(3684, 3385, 0), - - // Zanaris - new WorldPoint(2412, 4464, 0), - new WorldPoint(2465, 4427, 0), - new WorldPoint(2491, 4426, 0)), - - MAPLE_YEW("Maple/Yew trees", 60, - // Feldip Hills - new WorldPoint(2476, 2893, 0)), - - SULLIUSCEP("Sulliuscep", 65, - // Fossil Island - new WorldPoint(3662, 3802, 0), - new WorldPoint(3662, 3781, 0), - new WorldPoint(3677, 3806, 0), - new WorldPoint(3677, 3733, 0), - new WorldPoint(3682, 3775, 0), - new WorldPoint(3682, 3758, 0)), - - MAGIC("Magic tree", 75, - // Zeah - new WorldPoint(1373, 3821, 0), - new WorldPoint(1389, 3821, 0), - new WorldPoint(1610, 3443, 0), - new WorldPoint(1578, 3488, 0), - new WorldPoint(1685, 3740, 0), - new WorldPoint(1681, 3689, 0), - new WorldPoint(1751, 3564, 0), - new WorldPoint(1796, 3600, 0), - - // Misthalin - new WorldPoint(3355, 3312, 0), - new WorldPoint(3368, 3312, 0), - - // Tirannwn - new WorldPoint(2284, 3141, 0), - - // Prifddinas - new WorldPoint(3229, 6101, 0), - - // Kandarin - new WorldPoint(2371, 3427, 0), - new WorldPoint(2432, 3411, 0), - new WorldPoint(2490, 3414, 0), - new WorldPoint(2704, 3397, 0), - new WorldPoint(2695, 3423, 0), - - // Feldip Hills - new WorldPoint(2443, 2845, 0), - - // Wilderness - new WorldPoint(3175, 3931, 0)), - - REDWOOD("Redwood tree", 90, - // Zeah - new WorldPoint(1569, 3493, 0), - new WorldPoint(1569, 3483, 0)); - - private final String tooltip; - private final WorldPoint[] locations; - private final int levelReq; - - RareTreeLocation(String description, int level, WorldPoint... locations) - { - this.tooltip = description + " - Level " + level; - this.locations = locations; - this.levelReq = level; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreePoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreePoint.java deleted file mode 100644 index ce48f4cafd..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreePoint.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2018, Spedwards - * 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.client.plugins.worldmap; - -import java.awt.image.BufferedImage; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; - -class RareTreePoint extends WorldMapPoint -{ - RareTreePoint(WorldPoint point, String tooltip, BufferedImage icon, boolean showTooltip) - { - super(point, icon); - - if (showTooltip) - { - setTooltip(tooltip); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RunecraftingAltarLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RunecraftingAltarLocation.java deleted file mode 100644 index 49e1604800..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RunecraftingAltarLocation.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2019, Dava96 - * 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.client.plugins.worldmap; - -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.coords.WorldPoint; - -@Getter(AccessLevel.PACKAGE) -enum RunecraftingAltarLocation -{ - AIR_ALTAR("Air Altar", 1, new WorldPoint(2985, 3293, 0), "air_altar_icon.png"), - MIND_ALTAR("Mind Altar", 2, new WorldPoint(2982, 3514, 0), "mind_altar_icon.png"), - WATER_ALTAR("Water Altar", 5, new WorldPoint(3185, 3165, 0), "water_altar_icon.png"), - EARTH_ALTAR("Earth Altar", 9, new WorldPoint(3306, 3474, 0), "earth_altar_icon.png"), - FIRE_ALTAR("Fire Altar", 14, new WorldPoint(3313, 3255, 0), "fire_altar_icon.png"), - BODY_ALTAR("Body Altar", 20, new WorldPoint(3053, 3445, 0), "body_altar_icon.png"), - COSMIC_ALTAR("Cosmic Altar", 27, new WorldPoint(2408, 4377, 0), "cosmic_altar_icon.png"), - CHAOS_ALTAR("Chaos Altar", 35, new WorldPoint(3060, 3591, 0), "chaos_altar_icon.png"), - ASTRAL_ALTAR("Astral Altar", 40, new WorldPoint(2158, 3864, 0), "astral_altar_icon.png"), - NATURE_ALTAR("Nature Altar", 44, new WorldPoint(2869, 3019, 0), "nature_altar_icon.png"), - LAW_ALTAR("Law Altar", 54, new WorldPoint(2858, 3381, 0), "law_altar_icon.png"), - DEATH_ALTAR("Death Altar", 65, new WorldPoint(1860, 4639, 0), "death_altar_icon.png"), - BLOOD_ALTAR("Blood Altar", 77, new WorldPoint(1716, 3827, 0), "blood_altar_icon.png"), - SOUL_ALTAR("Soul Altar", 90, new WorldPoint(1814, 3856, 0), "soul_altar_icon.png"), - WRATH_ALTAR("Wrath Altar", 95, new WorldPoint(2446, 2825, 0), "wrath_altar_icon.png"); - - private final String tooltip; - private final WorldPoint location; - private final int levelReq; - private final String iconPath; - - RunecraftingAltarLocation(String description, int level, WorldPoint location, String iconPath) - { - this.tooltip = description + " - Level " + level; - this.location = location; - this.levelReq = level; - this.iconPath = iconPath; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RunecraftingAltarPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RunecraftingAltarPoint.java deleted file mode 100644 index 11cdad457f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RunecraftingAltarPoint.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2019, Dava96 - * 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.client.plugins.worldmap; - -import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; -import net.runelite.client.util.ImageUtil; - -class RunecraftingAltarPoint extends WorldMapPoint -{ - RunecraftingAltarPoint(RunecraftingAltarLocation point) - { - super(point.getLocation(), WorldMapPlugin.BLANK_ICON); - setImage(ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, point.getIconPath())); - setTooltip(point.getTooltip()); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TeleportLocationData.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TeleportLocationData.java deleted file mode 100644 index 88cb4d2204..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TeleportLocationData.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (c) 2018, Morgan Lewis - * 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.client.plugins.worldmap; - -import java.awt.image.BufferedImage; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.util.ImageUtil; - -@Getter(AccessLevel.PACKAGE) -enum TeleportLocationData -{ - VARROCK(TeleportType.NORMAL_MAGIC, "Varrock", 25, new WorldPoint(3213, 3424, 0), "varrock_teleport_icon.png"), - VARROCK_GE(TeleportType.NORMAL_MAGIC, "Varrock GE", 25, new WorldPoint(3164, 3478, 0), "varrock_teleport_icon.png"), - LUMBRIDGE(TeleportType.NORMAL_MAGIC, "Lumbridge", 31, new WorldPoint(3222, 3218, 0), "lumbridge_teleport_icon.png"), - FALADOR(TeleportType.NORMAL_MAGIC, "Falador", 37, new WorldPoint(2965, 3381, 0), "falador_teleport_icon.png"), - CAMELOT(TeleportType.NORMAL_MAGIC, "Camelot", 45, new WorldPoint(2757, 3477, 0), "camelot_teleport_icon.png"), - CAMELOT_BANK(TeleportType.NORMAL_MAGIC, "Camelot Bank", 45, new WorldPoint(2726, 3485, 0), "camelot_teleport_icon.png"), - ARDOUGNE(TeleportType.NORMAL_MAGIC, "Ardougne", 51, new WorldPoint(2664, 3306, 0), "ardougne_teleport_icon.png"), - WATCHTOWER(TeleportType.NORMAL_MAGIC, "Watchtower", 58, new WorldPoint(2547, 3114, 0), "watchtower_teleport_icon.png"), - WATCHTOWER_YANILLE(TeleportType.NORMAL_MAGIC, "Watchtower Yanille", 58, new WorldPoint(2584, 3097, 0), "watchtower_teleport_icon.png"), - TROLLHEIM(TeleportType.NORMAL_MAGIC, "Trollheim", 61, new WorldPoint(2891, 3678, 0), "trollheim_teleport_icon.png"), - APE_ATOLL(TeleportType.NORMAL_MAGIC, "Ape Atoll", 64, new WorldPoint(2796, 2791, 0), "ape_atoll_teleport_icon.png"), - KOUREND(TeleportType.NORMAL_MAGIC, "Kourend", 69, new WorldPoint(1643, 3672, 0), "kourend_teleport_icon.png"), - PADDEWWA(TeleportType.ANCIENT_MAGICKS, "Paddewwa", 54, new WorldPoint(3097, 9880, 0), "paddewwa_teleport_icon.png"), - SENNTISTEN(TeleportType.ANCIENT_MAGICKS, "Senntisten", 60, new WorldPoint(3319, 3336, 0), "senntisten_teleport_icon.png"), - KHARYRLL(TeleportType.ANCIENT_MAGICKS, "Kharyrll", 66, new WorldPoint(3494, 3473, 0), "kharyrll_teleport_icon.png"), - LASSAR(TeleportType.ANCIENT_MAGICKS, "Lassar", 72, new WorldPoint(3002, 3472, 0), "lassar_teleport_icon.png"), - DAREEYAK(TeleportType.ANCIENT_MAGICKS, "Dareeyak", 78, new WorldPoint(2969, 3695, 0), "dareeyak_teleport_icon.png"), - CARRALLANGAR(TeleportType.ANCIENT_MAGICKS, "Carrallangar", 84, new WorldPoint(3157, 3667, 0), "carrallangar_teleport_icon.png"), - ANNAKARL(TeleportType.ANCIENT_MAGICKS, "Annakarl", 90, new WorldPoint(3288, 3888, 0), "annakarl_teleport_icon.png"), - GHORROCK(TeleportType.ANCIENT_MAGICKS, "Ghorrock", 96, new WorldPoint(2977, 3872, 0), "ghorrock_teleport_icon.png"), - MOONCLAN(TeleportType.LUNAR_MAGIC, "Moonclan", 69, new WorldPoint(2113, 3915, 0), "moonclan_teleport_icon.png"), - OURANIA(TeleportType.LUNAR_MAGIC, "Ourania", 71, new WorldPoint(2468, 3246, 0), "ourania_teleport_icon.png"), - WATERBIRTH(TeleportType.LUNAR_MAGIC, "Waterbirth", 72, new WorldPoint(2546, 3755, 0), "waterbirth_teleport_icon.png"), - BARBARIAN(TeleportType.LUNAR_MAGIC, "Barbarian", 75, new WorldPoint(2543, 3568, 0), "barbarian_teleport_icon.png"), - KHAZARD(TeleportType.LUNAR_MAGIC, "Khazard", 78, new WorldPoint(2636, 3167, 0), "khazard_teleport_icon.png"), - FISHING_GUILD(TeleportType.LUNAR_MAGIC, "Fishing Guild", 85, new WorldPoint(2612, 3391, 0), "fishing_guild_teleport_icon.png"), - CATHERBY(TeleportType.LUNAR_MAGIC, "Catherby", 87, new WorldPoint(2802, 3449, 0), "catherby_teleport_icon.png"), - ICE_PLATEAU(TeleportType.LUNAR_MAGIC, "Ice Plateau", 89, new WorldPoint(2973, 3939, 0), "ice_plateau_teleport_icon.png"), - LUMBRIDGE_GRAVEYARD(TeleportType.ARCEUUS_MAGIC, "Lumbridge Graveyard", 6, new WorldPoint(3241, 3194, 0), "lumbridge_graveyard_teleport_icon.png"), - DRAYNOR_MANOR(TeleportType.ARCEUUS_MAGIC, "Draynor Manor", 17, new WorldPoint(3108, 3352, 0), "draynor_manor_teleport_icon.png"), - BATTLEFRONT(TeleportType.ARCEUUS_MAGIC, "Battlefront", 23, new WorldPoint(1349, 3739, 0), "battlefront_teleport_icon.png"), - MIND_ALTAR(TeleportType.ARCEUUS_MAGIC, "Mind Altar", 28, new WorldPoint(2979, 3509, 0), "mind_altar_teleport_icon.png"), - SALVE_GRAVEYARD(TeleportType.ARCEUUS_MAGIC, "Salve Graveyard", 40, new WorldPoint(3433, 3461, 0), "salve_graveyard_teleport_icon.png"), - FENKENSTRAINS_CASTLE(TeleportType.ARCEUUS_MAGIC, "Fenkenstrain's Castle", 48, new WorldPoint(3548, 3528, 0), "fenkenstrains_castle_teleport_icon.png"), - WEST_ARDOUGNE(TeleportType.ARCEUUS_MAGIC, "West Ardougne", 61, new WorldPoint(2500, 3291, 0), "west_ardougne_teleport_icon.png"), - HARMONY_ISLAND(TeleportType.ARCEUUS_MAGIC, "Harmony Island", 65, new WorldPoint(3797, 2866, 0), "harmony_island_teleport_icon.png"), - CEMETERY(TeleportType.ARCEUUS_MAGIC, "Cemetery", 71, new WorldPoint(2978, 3763, 0), "cemetery_teleport_icon.png"), - BARROWS(TeleportType.ARCEUUS_MAGIC, "Barrows", 83, new WorldPoint(3565, 3315, 0), "barrows_teleport_icon.png"), - APE_ATOLL_ARCEUUS(TeleportType.ARCEUUS_MAGIC, "Ape Atoll", 90, new WorldPoint(2770, 2703, 0), "ape_atoll_teleport_icon_arceuus.png"), - - // Jewellery - BARBARIAN_ASSAULT(TeleportType.JEWELLERY, "Games Necklace", "Barbarian Assault", new WorldPoint(2520, 3571, 0), "games_necklace_teleport_icon.png"), - BURTHORPE_GAMES_ROOM(TeleportType.JEWELLERY, "Games Necklace", "Burthorpe Games Room", new WorldPoint(2898, 3554, 0), "games_necklace_teleport_icon.png"), - TEARS_OF_GUTHIX(TeleportType.JEWELLERY, "Games Necklace", "Tears of Guthix", new WorldPoint(3245, 9500, 0), "games_necklace_teleport_icon.png"), - CORPOREAL_BEAST(TeleportType.JEWELLERY, "Games Necklace", "Corporeal Beast", new WorldPoint(2967, 4384, 0), "games_necklace_teleport_icon.png"), - WINTERTODT_CAMP(TeleportType.JEWELLERY, "Games Necklace", "Wintertodt Camp", new WorldPoint(1624, 3938, 0), "games_necklace_teleport_icon.png"), - DUEL_ARENA(TeleportType.JEWELLERY, "Ring of Dueling", "Duel Arena", new WorldPoint(3315, 3235, 0), "ring_of_dueling_teleport_icon.png"), - CLAN_WARS(TeleportType.JEWELLERY, "Ring of Dueling", "Clan Wars", new WorldPoint(3387, 3158, 0), "ring_of_dueling_teleport_icon.png"), - CASTLE_WARS(TeleportType.JEWELLERY, "Ring of Dueling", "Castle Wars", new WorldPoint(2441, 3091, 0), "ring_of_dueling_teleport_icon.png"), - WARRIORS_GUILD(TeleportType.JEWELLERY, "Combat Bracelet", "Warriors' Guild", new WorldPoint(2883, 3549, 0), "combat_bracelet_teleport_icon.png"), - CHAMPIONS_GUILD(TeleportType.JEWELLERY, "Combat Bracelet", "Champions' Guild", new WorldPoint(3189, 3368, 0), "combat_bracelet_teleport_icon.png"), - EDGEVILLE_MONASTERY(TeleportType.JEWELLERY, "Combat Bracelet", "Edgeville Monastery", new WorldPoint(3053, 3487, 0), "combat_bracelet_teleport_icon.png"), - RANGING_GUILD(TeleportType.JEWELLERY, "Combat Bracelet", "Ranging Guild", new WorldPoint(2654, 3441, 0), "combat_bracelet_teleport_icon.png"), - FISHING_GUILD_NECK(TeleportType.JEWELLERY, "Skills Necklace", "Fishing Guild", new WorldPoint(2613, 3390, 0), "skills_necklace_teleport_icon.png"), - MINING_GUILD(TeleportType.JEWELLERY, "Skills Necklace", "Mining Guild", new WorldPoint(3049, 9762, 0), "skills_necklace_teleport_icon.png"), - CRAFTING_GUILD(TeleportType.JEWELLERY, "Skills Necklace", "Crafting Guild", new WorldPoint(2934, 3294, 0), "skills_necklace_teleport_icon.png"), - COOKING_GUILD(TeleportType.JEWELLERY, "Skills Necklace", "Cooking Guild", new WorldPoint(3145, 3438, 0), "skills_necklace_teleport_icon.png"), - WOODCUTTING_GUILD(TeleportType.JEWELLERY, "Skills Necklace", "Woodcutting Guild", new WorldPoint(1662, 3505, 0), "skills_necklace_teleport_icon.png"), - FARMING_GUILD(TeleportType.JEWELLERY, "Skills Necklace", "Farming Guild", new WorldPoint(1249, 3717, 0), "skills_necklace_teleport_icon.png"), - EDGEVILLE(TeleportType.JEWELLERY, "Amulet of Glory", "Edgeville", new WorldPoint(3087, 3496, 0), "amulet_of_glory_teleport_icon.png"), - KARAMJA(TeleportType.JEWELLERY, "Amulet of Glory", "Karamja", new WorldPoint(2918, 3176, 0), "amulet_of_glory_teleport_icon.png"), - DRAYNOR_VILLAGE(TeleportType.JEWELLERY, "Amulet of Glory", "Draynor Village", new WorldPoint(3105, 3251, 0), "amulet_of_glory_teleport_icon.png"), - AL_KHARID(TeleportType.JEWELLERY, "Amulet of Glory", "Al-Kharid", new WorldPoint(3293, 3163, 0), "amulet_of_glory_teleport_icon.png"), - MISCELLANIA(TeleportType.JEWELLERY, "Ring of Wealth", "Miscellania", new WorldPoint(2535, 3862, 0), "ring_of_wealth_teleport_icon.png"), - GRAND_EXCHANGE(TeleportType.JEWELLERY, "Ring of Wealth", "Grand Exchange", new WorldPoint(3162, 3480, 0), "ring_of_wealth_teleport_icon.png"), - FALADOR_PARK(TeleportType.JEWELLERY, "Ring of Wealth", "Falador Park", new WorldPoint(2995, 3375, 0), "ring_of_wealth_teleport_icon.png"), - DONDAKAN(TeleportType.JEWELLERY, "Ring of Wealth", "Dondakan", new WorldPoint(2831, 10165, 0), "ring_of_wealth_teleport_icon.png"), - SLAYER_TOWER(TeleportType.JEWELLERY, "Slayer Ring", "Slayer Tower", new WorldPoint(3429, 3531, 0), "slayer_ring_teleport_icon.png"), - FREMENNIK_SLAYER_DUNGEON(TeleportType.JEWELLERY, "Slayer Ring", "Fremennik Slayer Dungeon", new WorldPoint(2800, 9998, 0), "slayer_ring_teleport_icon.png"), - TARNS_LAIR(TeleportType.JEWELLERY, "Slayer Ring", "Tarn's Lair", new WorldPoint(3187, 4601, 0), "slayer_ring_teleport_icon.png"), - STRONGHOLD_SLAYER_CAVE(TeleportType.JEWELLERY, "Slayer Ring", "Stronghold Slayer Cave", new WorldPoint(2433, 3421, 0), "slayer_ring_teleport_icon.png"), - DARK_BEASTS(TeleportType.JEWELLERY, "Slayer Ring", "Dark Beasts", new WorldPoint(2028, 4638, 0), "slayer_ring_teleport_icon.png"), - DIGSITE(TeleportType.JEWELLERY, "Digsite Pendant", "Digsite", new WorldPoint(3339, 3445, 0), "digsite_pendant_teleport_icon.png"), - HOUSE_ON_THE_HILL(TeleportType.JEWELLERY, "Digsite Pendant", "House on the Hill", new WorldPoint(3763, 3869, 0), "digsite_pendant_teleport_icon.png"), - LITHKREN(TeleportType.JEWELLERY, "Digsite Pendant", "Lithkren", new WorldPoint(3547, 10456, 0), "digsite_pendant_teleport_icon.png"), - WIZARDS_TOWER(TeleportType.JEWELLERY, "Necklace of Passage", "Wizards' Tower", new WorldPoint(3114, 3181, 0), "necklace_of_passage_teleport_icon.png"), - JORRALS_OUTPOST(TeleportType.JEWELLERY, "Necklace of Passage", "Jorral's Outpost", new WorldPoint(2431, 3348, 0), "necklace_of_passage_teleport_icon.png"), - DESERT_EAGLE_STATION(TeleportType.JEWELLERY, "Necklace of Passage", "Desert eagle station of the eagle transport system", new WorldPoint(3406, 3157, 0), "necklace_of_passage_teleport_icon.png"), - CHAOS_TEMPLE(TeleportType.JEWELLERY, "Burning Amulet", "Chaos Temple (lvl 15)", new WorldPoint(3234, 3637, 0), "burning_amulet_teleport_icon.png"), - BANDIT_CAMP(TeleportType.JEWELLERY, "Burning Amulet", "Bandit Camp (lvl 17)", new WorldPoint(3038, 3651, 0), "burning_amulet_teleport_icon.png"), - LAVA_MAZE(TeleportType.JEWELLERY, "Burning Amulet", "Lava Maze (lvl 41)", new WorldPoint(3028, 3840, 0), "burning_amulet_teleport_icon.png"), - - // Misc - XERICS_LOOKOUT(TeleportType.OTHER, "Xeric's Talisman", "Xeric's Lookout", new WorldPoint(1576, 3528, 0), "xerics_talisman_teleport_icon.png"), - XERICS_GLADE(TeleportType.OTHER, "Xeric's Talisman", "Xeric's Glade", new WorldPoint(1754, 3564, 0), "xerics_talisman_teleport_icon.png"), - XERICS_INFERNO(TeleportType.OTHER, "Xeric's Talisman", "Xeric's Inferno", new WorldPoint(1504, 3819, 0), "xerics_talisman_teleport_icon.png"), - XERICS_HEART(TeleportType.OTHER, "Xeric's Talisman", "Xeric's Heart", new WorldPoint(1641, 3670, 0), "xerics_talisman_teleport_icon.png"), - XERICS_HONOUR(TeleportType.OTHER, "Xeric's Talisman", "Xeric's Honour", new WorldPoint(1254, 3559, 0), "xerics_talisman_teleport_icon.png"), - STRONGHOLD_OF_SECURITY(TeleportType.OTHER, "Skull Sceptre", "Stronghold of Security", new WorldPoint(3081, 3421, 0), "skull_sceptre_teleport_icon.png"), - MYTHS_GUILD(TeleportType.OTHER, "Mythical Cape", "Myth's Guild", new WorldPoint(2458, 2851, 0), "mythical_cape_teleport_icon.png"), - ECTOFUNTUS(TeleportType.OTHER, "Ectophial", "Ectofuntus", new WorldPoint(3660, 3522, 0), "ectophial_teleport_icon.png"), - CHAMPIONS_GUILD_CHRONICLE(TeleportType.OTHER, "Chronicle", "Champions' Guild", new WorldPoint(3202, 3357, 0), "chronicle_teleport_icon.png"), - GRAND_TREE(TeleportType.OTHER, "Royal Seed Pod", "Grand Tree", new WorldPoint(2465, 3495, 0), "royal_seed_pod_teleport_icon.png"), - RELLEKKKA_LYRE(TeleportType.OTHER, "Enchanted Lyre", "Rellekka", new WorldPoint(2664, 3643, 0), "enchanted_lyre_teleport_icon.png"), - WATERBIRTH_ISLAND_LYRE(TeleportType.OTHER, "Enchanted Lyre", "Waterbirth Island", new WorldPoint(2550, 3756, 0), "enchanted_lyre_teleport_icon.png"), - NEITIZNOT_LYRE(TeleportType.OTHER, "Enchanted Lyre", "Neitiznot", new WorldPoint(2336, 3801, 0), "enchanted_lyre_teleport_icon.png"), - JATIZSO_LYRE(TeleportType.OTHER, "Enchanted Lyre", "Jatizso", new WorldPoint(2409, 3809, 0), "enchanted_lyre_teleport_icon.png"), - WEISS_ICY_BASALT(TeleportType.OTHER, "Icy Basalt", "Weiss", new WorldPoint(2846, 3940, 0), "icy_basalt_teleport_icon.png"), - TROLL_STRONGHOLD_STONY_BASALT(TeleportType.OTHER, "Stony Basalt", "Troll Stronghold (with 73 Agility)", new WorldPoint(2838, 3693, 0), "stony_basalt_teleport_icon.png"), - TROLL_STRONGHOLD_STONY_BASALT_OUTSIDE(TeleportType.OTHER, "Stony Basalt", "Troll Stronghold", new WorldPoint(2844, 3693, 0), "stony_basalt_teleport_icon.png"), - KHAREDSTS_MEMOIRS_HOSIDIUS(TeleportType.OTHER, "Kharedst's Memoirs", "Lunch by the Lancalliums (Hosidius)", new WorldPoint(1713, 3612, 0), "kharedsts_memoirs_teleport_icon.png"), - KHAREDSTS_MEMOIRS_PISCARILIUS(TeleportType.OTHER, "Kharedst's Memoirs", "The Fisher's Flute (Piscarilius)", new WorldPoint(1802, 3748, 0), "kharedsts_memoirs_teleport_icon.png"), - KHAREDSTS_MEMOIRS_SHAYZIEN(TeleportType.OTHER, "Kharedst's Memoirs", "History and Hearsay (Shayzien)", new WorldPoint(1476, 3580, 0), "kharedsts_memoirs_teleport_icon.png"), - KHAREDSTS_MEMOIRS_LOVAKENGJ(TeleportType.OTHER, "Kharedst's Memoirs", "Jewelry of Jubilation (Lovakengj)", new WorldPoint(1544, 3762, 0), "kharedsts_memoirs_teleport_icon.png"), - KHAREDSTS_MEMOIRS_ARCEUUS(TeleportType.OTHER, "Kharedst's Memoirs", "A Dark Disposition (Arceuus)", new WorldPoint(1680, 3746, 0), "kharedsts_memoirs_teleport_icon.png"), - PHARAOHS_SCEPTRE_JALSAVRAH(TeleportType.OTHER, "Pharaoh's Sceptre", "Jalsavrah (Pyramid Plunder)", new WorldPoint(3288, 2795, 0), "pharaohs_sceptre_teleport_icon.png"), - PHARAOHS_SCEPTRE_JALEUSTROPHOS(TeleportType.OTHER, "Pharaoh's Sceptre", "Jaleustrophos (Agility Pyramid)", new WorldPoint(3341, 2827, 0), "pharaohs_sceptre_teleport_icon.png"), - PHARAOHS_SCEPTRE_JALDRAOCHT(TeleportType.OTHER, "Pharaoh's Sceptre", "Jaldraocht (Desert Treasure Pyramid)", new WorldPoint(3232, 2897, 0), "pharaohs_sceptre_teleport_icon.png"), - CAMULET_TEMPLE(TeleportType.OTHER, "Camulet", "Enakhra's Temple", new WorldPoint(3190, 2923, 0), "camulet_teleport_icon.png"), - TELEPORT_CRYSTAL_LLETYA(TeleportType.OTHER, "Teleport crystal", "Lletya", new WorldPoint(2330, 3172, 0), "teleport_crystal_icon.png"), - TELEPORT_CRYSTAL_PRIFDDINAS(TeleportType.OTHER, "Teleport crystal", "Prifddinas", new WorldPoint(3264, 6065, 0), "teleport_crystal_icon.png"), - - // Wilderness - OBELISK_13(TeleportType.OTHER, "Obelisk", "13", new WorldPoint(3156, 3620, 0), "obelisk_icon.png"), - OBELISK_19(TeleportType.OTHER, "Obelisk", "19", new WorldPoint(3227, 3667, 0), "obelisk_icon.png"), - OBELISK_27(TeleportType.OTHER, "Obelisk", "27", new WorldPoint(3035, 3732, 0), "obelisk_icon.png"), - OBELISK_35(TeleportType.OTHER, "Obelisk", "35", new WorldPoint(3106, 3794, 0), "obelisk_icon.png"), - OBELISK_44(TeleportType.OTHER, "Obelisk", "44", new WorldPoint(2980, 3866, 0), "obelisk_icon.png"), - OBELISK_50(TeleportType.OTHER, "Obelisk", "50", new WorldPoint(3307, 3916, 0), "obelisk_icon.png"), - WILDERNESS_CRABS_TELEPORT(TeleportType.OTHER, "Wilderness crabs teleport", new WorldPoint(3348, 3783, 0), "wilderness_crabs_teleport_icon.png"), - CANOE_WILDERNESS(TeleportType.OTHER, "Canoe (No departure)", "35", new WorldPoint(3141, 3796, 0), "transportation_icon.png"), - - // Achievement Diary - ARDOUGNE_CLOAK_MONASTERY(TeleportType.OTHER, "Ardougne Cloak", "Monastery", new WorldPoint(2606, 3222, 0), "ardougne_cloak_icon.png"), - ARDOUGNE_CLOAK_FARM(TeleportType.OTHER, "Ardougne Cloak", "Farm", new WorldPoint(2673, 3375, 0), "ardougne_cloak_icon.png"), - EXPLORERS_RING(TeleportType.OTHER, "Explorer's Ring", new WorldPoint(3052, 3292, 0), "explorers_ring_icon.png"), - KARAMJA_GLOVES_GEM_MINE(TeleportType.OTHER, "Karamja Gloves", "Gem Mine (Underground)", new WorldPoint(2827, 2997, 0), "karamja_gloves_icon.png"), - KARAMJA_GLOVES_DURADEL(TeleportType.OTHER, "Karamja Gloves", "Duradel", new WorldPoint(2870, 2981, 0), "karamja_gloves_icon.png"), - DESERT_AMULET_NARDAH(TeleportType.OTHER, "Desert Amulet", "Nardah", new WorldPoint(3432, 2914, 0), "desert_amulet_icon.png"), - DESERT_AMULKT_KALPHITE_CAVE(TeleportType.OTHER, "Desert Amulet", "Kalphite Cave", new WorldPoint(3322, 3122, 0), "desert_amulet_icon.png"), - MORYTANIA_LEGS_SLIME_PIT(TeleportType.OTHER, "Morytania Legs", "Slime Pit (Underground)", new WorldPoint(3654, 3516, 0), "morytania_legs_icon.png"), - MORYTANIA_LEGS_BURGH_DE_ROTT(TeleportType.OTHER, "Morytania Legs", "Burgh de Rott", new WorldPoint(3482, 3231, 0), "morytania_legs_icon.png"), - FREMENNIK_SEA_BOOTS(TeleportType.OTHER, "Fremennik Sea Boots", new WorldPoint(2640, 3675, 0), "fremennik_boots_icon.png"), - KANDARIN_HEADGEAR(TeleportType.OTHER, "Kandarin Headgear", new WorldPoint(2729, 3411, 0), "kandarin_headgear_icon.png"), - WILDERNESS_SWORD(TeleportType.OTHER, "Wilderness Sword", new WorldPoint(3377, 3891, 0), "wilderness_sword_icon.png"), - WESTERN_BANNER(TeleportType.OTHER, "Western Banner", new WorldPoint(2329, 3685, 0), "western_banner_icon.png"), - RADAS_BLESSING_MOUNT_KARUULM(TeleportType.OTHER, "Rada's Blessing", new WorldPoint(1311, 3795, 0), "radas_blessing_icon.png"), - RADAS_BLESSING_WOODLANG(TeleportType.OTHER, "Rada's Blessing", new WorldPoint(1553, 3454, 0), "radas_blessing_icon.png"), - - // Scrolls - DIGSITE_SCROLL(TeleportType.SCROLL, "Digsite Teleport", new WorldPoint(3324, 3412, 0), "scroll_teleport_icon.png"), - IORWERTH_CAMP_SCROLL(TeleportType.SCROLL, "Iorwerth Camp Teleport", new WorldPoint(2193, 3257, 0), "scroll_teleport_icon.png"), - FELDIP_HILLS_SCROLL(TeleportType.SCROLL, "Feldip Hills Teleport", new WorldPoint(2542, 2925, 0), "scroll_teleport_icon.png"), - LUMBERYARD_SCROLL(TeleportType.SCROLL, "Lumberyard Teleport", new WorldPoint(3303, 3487, 0), "scroll_teleport_icon.png"), - LUNAR_ISLE_SCROLL(TeleportType.SCROLL, "Lunar Isle Teleport", new WorldPoint(2093, 3912, 0), "scroll_teleport_icon.png"), - MORTTON_SCROLL(TeleportType.SCROLL, "Mort'ton", new WorldPoint(3489, 3288, 0), "scroll_teleport_icon.png"), - MOS_LEHARMLESS_SCROLL(TeleportType.SCROLL, "Mos Le'Harmless Teleport", new WorldPoint(3701, 2996, 0), "scroll_teleport_icon.png"), - NARDAH_SCROLL(TeleportType.SCROLL, "Nardah Teleport", new WorldPoint(3421, 2917, 0), "scroll_teleport_icon.png"), - PEST_CONTROL_SCROLL(TeleportType.SCROLL, "Pest Control Teleport", new WorldPoint(2657, 2660, 0), "scroll_teleport_icon.png"), - PISCATORIS_SCROLL(TeleportType.SCROLL, "Piscatoris Teleport", new WorldPoint(2339, 3648, 0), "scroll_teleport_icon.png"), - TAI_BWO_WANNAI_SCROLL(TeleportType.SCROLL, "Tai Bwo Wannai Teleport", new WorldPoint(2788, 3066, 0), "scroll_teleport_icon.png"), - ZULANDRA_SCROLL(TeleportType.SCROLL, "Zul-Andra Teleport", new WorldPoint(2197, 3056, 0), "scroll_teleport_icon.png"), - KEY_MASTER_SCROLL(TeleportType.SCROLL, "Key Master Teleport", new WorldPoint(2686, 9882, 0), "scroll_teleport_icon.png"), - REVENANT_CAVE_SCROLL(TeleportType.SCROLL, "Revenant Cave Teleport", new WorldPoint(3127, 3833, 0), "scroll_teleport_icon.png"); - - private final TeleportType type; - private final String tooltip; - private final WorldPoint location; - private final String iconPath; - private BufferedImage image; - - BufferedImage getImage() - { - if (image == null) - { - try - { - image = ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, this.getIconPath()); - } - catch (RuntimeException e) - { - return WorldMapPlugin.BLANK_ICON; - } - } - - return image; - } - - TeleportLocationData(TeleportType type, String destination, int magicLevel, WorldPoint location, String iconPath) - { - this.type = type; - this.tooltip = type.getPrefix() + " " + destination + " - lvl " + magicLevel; - this.location = location; - this.iconPath = iconPath; - } - - TeleportLocationData(TeleportType type, String item, String destination, WorldPoint location, String iconPath) - { - this.type = type; - this.tooltip = item + " - " + destination; - this.location = location; - this.iconPath = iconPath; - } - - TeleportLocationData(TeleportType type, String item, WorldPoint location, String iconPath) - { - this.type = type; - this.tooltip = item; - this.location = location; - this.iconPath = iconPath; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TeleportPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TeleportPoint.java deleted file mode 100644 index abc13418e2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TeleportPoint.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2018, Morgan Lewis - * 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.client.plugins.worldmap; - -import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; - -class TeleportPoint extends WorldMapPoint -{ - TeleportPoint(TeleportLocationData data) - { - super(data.getLocation(), data.getImage()); - setTooltip(data.getTooltip()); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TeleportType.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TeleportType.java deleted file mode 100644 index 3a23b9d2eb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TeleportType.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, Morgan Lewis - * 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.client.plugins.worldmap; - -import lombok.AccessLevel; -import lombok.Getter; - -@Getter(AccessLevel.PACKAGE) -public enum TeleportType -{ - NORMAL_MAGIC(""), - ANCIENT_MAGICKS("Ancient - "), - LUNAR_MAGIC("Lunar - "), - ARCEUUS_MAGIC("Arceuus - "), - JEWELLERY("Jewellery - "), - SCROLL(""), - OTHER(""); - - private String prefix; - - TeleportType(String prefix) - { - this.prefix = prefix; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPoint.java deleted file mode 100644 index f4942c1b99..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPoint.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2019, Kyle Sergio - * Copyright (c) 2019, Bryce Altomare - * Copyright (c) 2019, Kyle Stead - * 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.client.plugins.worldmap; - -import java.awt.image.BufferedImage; -import net.runelite.api.coords.WorldPoint; -import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; - -class TransportationPoint extends WorldMapPoint -{ - TransportationPoint(TransportationPointLocation data, BufferedImage icon) - { - super(data.getLocation(), icon); - final WorldPoint target = data.getTarget(); - if (target != null) - { - setTarget(target); - setJumpOnClick(true); - } - setTooltip(data.getTooltip()); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java deleted file mode 100644 index e7851427df..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright (c) 2019, Kyle Sergio - * Copyright (c) 2019, Bryce Altomare - * Copyright (c) 2019, Kyle Stead - * 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.client.plugins.worldmap; - -import javax.annotation.Nullable; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.runelite.api.coords.WorldPoint; - -@Getter(AccessLevel.PACKAGE) -@AllArgsConstructor -enum TransportationPointLocation -{ - //Ships - ARDOUGNE_TO_BRIMHAVEN("Ship to Brimhaven / Rimmington", new WorldPoint(2675, 3275, 0)), - ARDOUGNE_TO_FISHINGPLAT("Ship to Fishing Platform", new WorldPoint(2722, 3304, 0), new WorldPoint(2779, 3271, 0)), - BRIMHAVEN_TO_ARDOUGNE("Ship to Ardougne / Rimmington", new WorldPoint(2772, 3234, 0)), - RIMMINGTON_TO_ARDOUGNE("Ship to Ardougne / Brimhaven", new WorldPoint(2915, 3224, 0)), - CATHERBY_TO_KEEP_LE_FAYE("Ship to Keep Le Faye", new WorldPoint(2804, 3421, 0), new WorldPoint(2769, 3402, 0)), - CORSAIR_TO_RIMMINGTON("Ship to Rimmington", new WorldPoint(2577, 2839, 0), new WorldPoint(2909, 3227, 0)), - DRAGONTOOTH_TO_PHASMATYS("Ship to Port Phasmatys", new WorldPoint(3791, 3561, 0), new WorldPoint(3703, 3487, 0)), - DIGSITE_TO_FOSSIL("Ship to Fossil Island", new WorldPoint(3361, 3448, 0), new WorldPoint(3723, 3807, 0)), - ENTRANA_TO_PORTSARIM("Ship to Port Sarim", new WorldPoint(2833, 3334, 0), new WorldPoint(3046, 3233, 0)), - FISHINGPLAT_TO_ARDOUGNE("Ship to Ardougne", new WorldPoint(2779, 3271, 0), new WorldPoint(2722, 3304, 0)), - HARMLESS_TO_PORT_PHASMATYS("Ship to Port Phasmatys", new WorldPoint(3682, 2951, 0), new WorldPoint(3709, 3497, 0)), - ICEBERG_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2657, 3988, 0), new WorldPoint(2707, 3735, 0)), - ISLAND_OF_STONE_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2470, 3994, 0), new WorldPoint(2621, 3692, 0)), - ISLAND_TO_APE_ATOLL("Ship to Ape Atoll", new WorldPoint(2891, 2726, 0), new WorldPoint(2802, 2706, 0)), - JATIZSO_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2420, 3780, 0), new WorldPoint(2639, 3710, 0)), - KARAMJA_TO_PORT_SARIM("Ship to Port Sarim", new WorldPoint(2955, 3145, 0), new WorldPoint(3029, 3218, 0)), - KARAMJA_TO_PORT_KHAZARD("Ship to Port Khazard", new WorldPoint(2763, 2957, 0), new WorldPoint(2653, 3166, 0)), - LANDSEND_TO_PORTSARIM_PORTPISCARILIUS("Ship to Port Sarim/Port Piscarilius", new WorldPoint(1503, 3398, 0)), - LUNAR_ISLE_TO_PIRATES_COVE("Ship to Pirates' Cove", new WorldPoint(2137, 3899, 0), new WorldPoint(2223, 3796, 0)), - MISCELLANIA_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2579, 3846, 0), new WorldPoint(2627, 3692, 0)), - NEITIZNOT_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2310, 3779, 0), new WorldPoint(2639, 3710, 0)), - PESTCONTROL_TO_PORTSARIM("Ship to Port Sarim", new WorldPoint(2659, 2675, 0), new WorldPoint(3039, 3201, 0)), - PIRATES_COVE_TO_LUNAR_ISLE("Ship to Lunar Isle", new WorldPoint(2223, 3796, 0), new WorldPoint(2137, 3899, 0)), - PIRATES_COVE_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2212, 3794, 0), new WorldPoint(2620, 3695, 0)), - PORT_PHASMATYS_TO_DRAGONTOOTH("Ship to Dragontooth Island", new WorldPoint(3703, 3487, 0), new WorldPoint(3791, 3561, 0)), - PORT_PHASMATYS_TO_HARMLESS("Ship to Mos Le'Harmless", new WorldPoint(3709, 3497, 0), new WorldPoint(3682, 2951, 0)), - PORT_PISCARILIUS_TO_PORTSARIM_LANDSEND("Ship to Port Sarim/Land's End", new WorldPoint(1823, 3692, 0)), - PORTSARIM_TO_GREAT_KOUREND("Ship to Great Kourend", new WorldPoint(3054, 3244, 0), new WorldPoint(1823, 3692, 0)), - PORTSARIM_TO_ENTRANA("Ship to Entrana", new WorldPoint(3046, 3233, 0), new WorldPoint(2833, 3334, 0)), - PORTSARIM_TO_KARAMJA("Ship to Karamja", new WorldPoint(3029, 3218, 0), new WorldPoint(2955, 3144, 0)), - PORTSARIM_TO_CRANDOR("Ship to Crandor", new WorldPoint(3045, 3205, 0), new WorldPoint(2839, 3261, 0)), - PORTSARIM_TO_PEST_CONTROL("Ship to Pest Control", new WorldPoint(3039, 3201, 0), new WorldPoint(2659, 2675, 0)), - RELLEKKA_TO_JATIZSO_NEITIZNOT("Ship to Jatizso/Neitiznot", new WorldPoint(2639, 3710, 0)), - RELLEKKA_TO_MISCELLANIA("Ship to Miscellania", new WorldPoint(2627, 3692, 0), new WorldPoint(2579, 3846, 0)), - RELLEKKA_TO_PIRATES_COVE("Ship to Pirates' Cove", new WorldPoint(2620, 3695, 0), new WorldPoint(2212, 3794, 0)), - RELLEKKA_TO_WATERBIRTH("Ship to Waterbirth", new WorldPoint(2618, 3685, 0), new WorldPoint(2549, 3758, 0)), - RELLEKKA_TO_WEISS_ICEBERG("Ship to Weiss/Iceberg", new WorldPoint(2707, 3735, 0)), - RELLEKKA_TO_UNGAEL("Ship to Ungael", new WorldPoint(2638, 3698, 0), new WorldPoint(2276, 4034, 0)), - RIMMINGTON_TO_CORSAIR_COVE("Ship to Corsair Cove", new WorldPoint(2909, 3227, 0), new WorldPoint(2577, 2839, 0)), - WATERBIRTH_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2549, 3758, 0), new WorldPoint(2618, 3685, 0)), - WEISS_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2847, 3967, 0), new WorldPoint(2707, 3735, 0)), - UNGAEL_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2276, 4034, 0), new WorldPoint(2638, 3698, 0)), - - //Row Boats - ROW_BOAT_BATTLEFRONT("Rowboat to Molch/Molch Island/Shayzien", new WorldPoint(1383, 3663, 0)), - ROW_BOAT_BRAIN_DEATH("Rowboat to Port Phasmatys", new WorldPoint(2161, 5117, 0), new WorldPoint(3680, 3538, 0)), - ROW_BOAT_BURGH_DE_ROTT("Rowboat to Meiyerditch", new WorldPoint(3522, 3168, 0), new WorldPoint(3589, 3172, 0)), - ROW_BOAT_CRABCLAW("Rowboat to Hosidius", new WorldPoint(1780, 3417, 0), new WorldPoint(1779, 3457, 0)), - ROW_BOAT_DIVING_ISLAND("Rowboat to Barge/Camp/North of Island", new WorldPoint(3764, 3901, 0)), - ROW_BOAT_FISHING_GUILD("Rowboat to Hemenster", new WorldPoint(2598, 3426, 0), new WorldPoint(2613, 3439, 0)), - ROW_BOAT_GNOME_STRONGHOLD("Rowboat to Fishing Colony", new WorldPoint(2368, 3487, 0), new WorldPoint(2356, 3641, 0)), - ROW_BOAT_FISHING_COLONY("Rowboat to Gnome Stronghold", new WorldPoint(2356, 3641, 0), new WorldPoint(2368, 3487, 0)), - ROW_BOAT_HEMENSTER("Rowboat to Fishing Guild", new WorldPoint(2613, 3439, 0), new WorldPoint(2598, 3426, 0)), - ROW_BOAT_HOSIDIUS("Rowboat to Crabclaw Isle", new WorldPoint(1779, 3457, 0), new WorldPoint(1780, 3417, 0)), - ROW_BOAT_LITHKREN("Rowboat to Mushroom Forest", new WorldPoint(3582, 3973, 0), new WorldPoint(3659, 3849, 0)), - ROW_BOAT_LUMBRIDGE("Rowboat to Misthalin Mystery", new WorldPoint(3238, 3141, 0)), - ROW_BOAT_MOLCH("Rowboat to Molch Island/Shayzien/Battlefront", new WorldPoint(1343, 3646, 0)), - ROW_BOAT_MOLCH_ISLAND("Rowboat to Molch/Shayzien/Battlefront", new WorldPoint(1368, 3641, 0)), - ROW_BOAT_MORT("Rowboat to Mort Myre", new WorldPoint(3518, 3284, 0), new WorldPoint(3498, 3380, 0)), - ROW_BOAT_MORT_SWAMP("Rowboat to Mort'ton", new WorldPoint(3498, 3380, 0), new WorldPoint(3518, 3284, 0)), - ROW_BOAT_MUSEUM_CAMP("Rowboat to Barge/Digsite/North of Island", new WorldPoint(3723, 3807, 0)), - ROW_BOAT_MUSHROOM_FOREST_WEST("Rowboat to Lithkren", new WorldPoint(3659, 3849, 0), new WorldPoint(3582, 3973, 0)), - ROW_BOAT_MUSHROOM_FOREST_NE("Rowboat to Barge/Camp/Sea", new WorldPoint(3733, 3894, 0)), - ROW_BOAT_PORT_PHASMATYS_NORTH("Rowboat to Slepe", new WorldPoint(3670, 3545, 0), new WorldPoint(3661, 3279, 0)), - ROW_BOAT_PORT_PHASMATYS_EAST("Rowboat to Braindeath Island", new WorldPoint(3680, 3538, 0), new WorldPoint(2161, 5117, 0)), - ROW_BOAT_SHAYZIEN("Rowboat to Molch/Molch Island/Battlefront", new WorldPoint(1405, 3612, 0)), - ROW_BOAT_SLEPE("Rowboat to Port Phasmatys", new WorldPoint(3661, 3279, 0), new WorldPoint(3670, 3545, 0)), - OGRE_BOAT_FELDIP("Ogre Boat to Karamja", new WorldPoint(2653, 2964, 0), new WorldPoint(2757, 3085, 0)), - OGRE_BOAT_KARAMJA("Ogre Boat to Feldip", new WorldPoint(2757, 3085, 0), new WorldPoint(2653, 2964, 0)), - - //Charter ships - CHARTER_BRIMHAVEN("Charter Ship", new WorldPoint(2760, 3238, 0)), - CHARTER_CATHERBY("Charter Ship", new WorldPoint(2791, 3415, 0)), - CHARTER_CORSAIR_("Charter Ship", new WorldPoint(2589, 2851, 0)), - CHARTER_KARAMJA_NORTH("Charter Ship", new WorldPoint(2954, 3158, 0)), - CHARTER_KARAMJA_EAST("Charter Ship", new WorldPoint(2999, 3032, 0)), - CHARTER_KHAZARD("Charter Ship", new WorldPoint(2673, 3143, 0)), - CHARTER_MOSLE_HARMLESS("Charter Ship", new WorldPoint(3669, 2931, 0)), - CHARTER_PORT_PHASMATYS("Charter Ship", new WorldPoint(3702, 3503, 0)), - CHARTER_PORTSARIM("Charter Ship", new WorldPoint(3037, 3191, 0)), - CHARTER_TYRAS("Charter Ship", new WorldPoint(2141, 3123, 0)), - CHARTER_PRIFDDINAS("Charter Ship", new WorldPoint(2156, 3331, 0)), - CHARTER_PRIFDDINAS_INSTANCE("Charter Ship", new WorldPoint(3180, 6083, 0)), - - //Minecarts/Carts - MINE_CART_ARCEUUS("Minecart", new WorldPoint(1673, 3832, 0)), - MINE_CART_GRANDEXCHANGE("Minecart to Keldagrim", new WorldPoint(3139, 3504, 0)), - MINE_CART_HOSIDIUS("Minecart", new WorldPoint(1656, 3542, 0)), - MINE_CART_KELDAGRIM("Minecart", new WorldPoint(2908, 10170, 0)), - MINE_CART_LOVAKENGJ("Minecart", new WorldPoint(1524, 3721, 0)), - MINE_CART_PORT_PISCARILIUS("Minecart", new WorldPoint(1760, 3708, 0)), - MINE_CART_QUIDAMORTEM("Minecart", new WorldPoint(1253, 3550, 0)), - MINE_CART_SHAYZIEN("Minecart", new WorldPoint(1586, 3622, 0)), - MINE_CART_TAVERLEY_UNDERGROUND("Minecart", new WorldPoint(2874, 9870, 0)), - CART_TO_BRIMHAVEN("Cart to Brimhaven", new WorldPoint(2833, 2958, 0), new WorldPoint(2780, 3214, 0)), - CART_TO_SHILO("Cart to Shilo", new WorldPoint(2780, 3214, 0), new WorldPoint(2833, 2958, 0)), - - //Canoes - CANOE_BARBVILLAGE("Canoe", new WorldPoint(3111, 3409, 0)), - CANOE_CHAMPIONSGUILD("Canoe", new WorldPoint(3202, 3344, 0)), - CANOE_EDGEVILLE("Canoe", new WorldPoint(3130, 3509, 0)), - CANOE_LUMBRIDGE("Canoe", new WorldPoint(3241, 3238, 0)), - - //Gnome Gliders - GNOME_GLIDER_KHARID("Gnome Glider", new WorldPoint(3278, 3213, 0)), - GNOME_GLIDER_APE_ATOLL("Gnome Glider", new WorldPoint(2712, 2804, 0)), - GNOME_GLIDER_KARAMJA("Gnome Glider", new WorldPoint(2971, 2974, 0)), - GNOME_GLIDER_FELDIP("Gnome Glider", new WorldPoint(2540, 2969, 0)), - GNOME_GLIDER_GNOMESTRONGHOLD("Gnome Glider", new WorldPoint(2460, 3502, 0)), - GNOME_GLIDER_WHITEWOLF("Gnome Glider", new WorldPoint(2845, 3501, 0)), - - //Balloons - BALLOON_VARROCK("Hot Air Balloon", new WorldPoint(3298, 3480, 0)), - BALLOON_YANILLE("Hot Air Balloon", new WorldPoint(2458, 3108, 0)), - BALLOON_GNOMESTRONGHOLD("Hot Air Balloon", new WorldPoint(2478, 3459, 0)), - BALLOON_TAVERLEY("Hot Air Balloon", new WorldPoint(2936, 3422, 0)), - BALLOON_FALADOR("Hot Air Balloon", new WorldPoint(2921, 3301, 0)), - - //Spirit Tree - SPIRITTREE_ARDOUGNE("Spirit Tree", new WorldPoint(2554, 3259, 0)), - SPIRITTREE_CORSAIR("Spirit Tree", new WorldPoint(2485, 2850, 0)), - SPIRITTREE_GNOMESTRONGHOLD("Spirit Tree", new WorldPoint(2459, 3446, 0)), - SPIRITTREE_GNOMEVILLAGE("Spirit Tree", new WorldPoint(2538, 3166, 0)), - SPIRITTREE_GRANDEXCHANGE("Spirit Tree", new WorldPoint(3184, 3510, 0)), - SPIRITTREE_PRIFDDINAS("Spirit Tree", new WorldPoint(3274, 6124, 0)), - - //Carpets - CARPET_KHARID("Carpet to Bedabin/Pollnivneach/Uzer", new WorldPoint(3311, 3107, 0)), - CARPET_BEDABIN("Carpet to Shantay Pass", new WorldPoint(3183, 3042, 0), new WorldPoint(3311, 3107, 0)), - CARPET_POLLNIVNEACH_NORTH("Carpet to Shantay Pass", new WorldPoint(3351, 3001, 0), new WorldPoint(3311, 3107, 0)), - CARPET_POLLNIVNEACH_SOUTH("Carpet to Nardah/Sophanem/Menaphos", new WorldPoint(3345, 2943, 0)), - CARPET_NARDAH("Carpet to Pollnivneach", new WorldPoint(3399, 2916, 0), new WorldPoint(3345, 2943, 0)), - CARPET_SOPHANEM("Carpet to Pollnivneach", new WorldPoint(3288, 2814, 0), new WorldPoint(3345, 2943, 0)), - CARPET_MENAPHOS("Carpet to Pollnivneach", new WorldPoint(3244, 2812, 0), new WorldPoint(3345, 2943, 0)), - CARPET_UZER("Carpet to Shantay Pass", new WorldPoint(3468, 3111, 0), new WorldPoint(3311, 3107, 0)), - - //Teleports - TELEPORT_ARCHIVE_FROM_ARCEUUS("Teleport to Library Archive", new WorldPoint(1623, 3808, 0)), - TELEPORT_HARMLESS_FROM_HARMONY("Teleport to Mos Le'Harmless", new WorldPoint(3784, 2828, 0)), - TELEPORT_RUNE_ARDOUGNE("Teleport to Rune Essence", new WorldPoint(2681, 3325, 0)), - TELEPORT_RUNE_YANILLE("Teleport to Rune Essence", new WorldPoint(2592, 3089, 0)), - TELEPORT_SORCERESS_GARDEN("Teleport to Sorceress's Garden", new WorldPoint(3320, 3141, 0)), - TELEPORT_PRIFDDINAS_LIBRARY("Teleport to Prifddinas Library", new WorldPoint(3254, 6082, 2)), - - //Other - ALTER_KOUREND_UNDERGROUND("Altar to Skotizo", new WorldPoint(1662, 10047, 0)), - FAIRY_RING_ZANARIS_TO_KHARID("Fairy Ring to Al Kharid", new WorldPoint(2483, 4471, 0)), - FAIRY_RING_ZANARIS_TO_SHACK("Fairy Ring to Shack", new WorldPoint(2451, 4471, 0)), - MOUNTAIN_GUIDE_QUIDAMORTEM("Mountain Guide", new WorldPoint(1275, 3559, 0)), - MOUNTAIN_GUIDE_WALL("Mountain Guide", new WorldPoint(1400, 3538, 0)), - MUSHTREE_MUSHROOM_FOREST("Mushtree", new WorldPoint(3674, 3871, 0)), - MUSHTREE_TAR_SWAMP("Mushtree", new WorldPoint(3676, 3755, 0)), - MUSHTREE_VERDANT_VALLEY("Mushtree", new WorldPoint(3757, 3756, 0)), - MYTHS_GUILD_PORTAL("Portal to Guilds", new WorldPoint(2456, 2856, 0)), - TRAIN_KELDAGRIM("Railway Station", new WorldPoint(2941, 10179, 0)), - WILDERNESS_LEVER_ARDOUGNE("Wilderness Lever", new WorldPoint(2559, 3309, 0)), - WILDERNESS_LEVER_EDGEVILLE("Wilderness Lever", new WorldPoint(3088, 3474, 0)), - WILDERNESS_LEVER_WILDERNESS("Wilderness Lever", new WorldPoint(3154, 3924, 0)); - - private final String tooltip; - private final WorldPoint location; - @Nullable - private final WorldPoint target; - - TransportationPointLocation(String tooltip, WorldPoint worldPoint) - { - this(tooltip, worldPoint, null); - } -} 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 deleted file mode 100644 index 4070a77b1a..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapConfig.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (c) 2018, Morgan Lewis - * 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.client.plugins.worldmap; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup(WorldMapPlugin.CONFIG_KEY) -public interface WorldMapConfig extends Config -{ - @ConfigItem( - keyName = WorldMapPlugin.CONFIG_KEY_FAIRY_RING_TOOLTIPS, - name = "Show fairy ring codes in tooltip", - description = "Display the code for fairy rings in the icon tooltip", - position = 1 - ) - default boolean fairyRingTooltips() - { - return true; - } - - @ConfigItem( - keyName = WorldMapPlugin.CONFIG_KEY_FAIRY_RING_ICON, - name = "Show fairy ring travel icon", - description = "Override the travel icon for fairy rings", - position = 2 - ) - default boolean fairyRingIcon() - { - return true; - } - - @ConfigItem( - keyName = WorldMapPlugin.CONFIG_KEY_AGILITY_SHORTCUT_TOOLTIPS, - name = "Show agility level requirement", - description = "Display the required Agility level in the icon tooltip", - position = 3 - ) - default boolean agilityShortcutTooltips() - { - return true; - } - - @ConfigItem( - keyName = WorldMapPlugin.CONFIG_KEY_AGILITY_SHORTCUT_LEVEL_ICON, - name = "Indicate inaccessible shortcuts", - description = "Indicate shortcuts you do not have the level to use on the icon", - position = 4 - ) - default boolean agilityShortcutLevelIcon() - { - return true; - } - - @ConfigItem( - keyName = WorldMapPlugin.CONFIG_KEY_NORMAL_TELEPORT_ICON, - name = "Show Standard Spellbook destinations", - description = "Show icons at the destinations for teleports in the Standard Spellbook", - position = 5 - ) - default boolean normalTeleportIcon() - { - return true; - } - - @ConfigItem( - keyName = WorldMapPlugin.CONFIG_KEY_MINIGAME_TOOLTIP, - name = "Show minigame name in tooltip", - description = "Display the name of the minigame in the icon tooltip", - position = 6 - ) - default boolean minigameTooltip() - { - return true; - } - - @ConfigItem( - keyName = WorldMapPlugin.CONFIG_KEY_ANCIENT_TELEPORT_ICON, - name = "Show Ancient Magicks destinations", - description = "Show icons at the destinations for teleports in the Ancient Spellbook", - position = 7 - ) - default boolean ancientTeleportIcon() - { - return true; - } - - @ConfigItem( - keyName = WorldMapPlugin.CONFIG_KEY_LUNAR_TELEPORT_ICON, - name = "Show Lunar Spellbook destinations", - description = "Show icons at the destinations for teleports in the Lunar Spellbook", - position = 8 - ) - default boolean lunarTeleportIcon() - { - return true; - } - - @ConfigItem( - keyName = WorldMapPlugin.CONFIG_KEY_ARCEUUS_TELEPORT_ICON, - name = "Show Arceuus Spellbook destinations", - description = "Show icons at the destinations for teleports in the Arceuus Spellbook", - position = 9 - ) - default boolean arceuusTeleportIcon() - { - return true; - } - - @ConfigItem( - keyName = WorldMapPlugin.CONFIG_KEY_JEWELLERY_TELEPORT_ICON, - name = "Show jewellery teleport locations", - description = "Show icons at the destinations for teleports from jewellery", - position = 10 - ) - default boolean jewelleryTeleportIcon() - { - return true; - } - - @ConfigItem( - keyName = WorldMapPlugin.CONFIG_KEY_SCROLL_TELEPORT_ICON, - name = "Show teleport scroll locations", - description = "Show icons at the destinations for teleports from scrolls", - position = 11 - ) - default boolean scrollTeleportIcon() - { - return true; - } - - @ConfigItem( - keyName = WorldMapPlugin.CONFIG_KEY_MISC_TELEPORT_ICON, - name = "Show misc teleport locations", - description = "Show icons at the destinations for miscellaneous teleport items", - position = 12 - ) - default boolean miscellaneousTeleportIcon() - { - return true; - } - - @ConfigItem( - keyName = WorldMapPlugin.CONFIG_KEY_QUEST_START_TOOLTIPS, - name = "Show quest names and status", - description = "Indicates the names of quests and shows completion status", - position = 13 - ) - default boolean questStartTooltips() - { - return true; - } - - @ConfigItem( - keyName = WorldMapPlugin.CONFIG_KEY_FARMING_PATCH_TOOLTIPS, - name = "Show farming patch type", - description = "Display the type of farming patches in the icon tooltip", - position = 14 - ) - default boolean farmingPatchTooltips() - { - return true; - } - - @ConfigItem( - keyName = WorldMapPlugin.CONFIG_KEY_RARE_TREE_TOOLTIPS, - name = "Show rare tree type", - description = "Display the type of rare tree in the icon tooltip", - position = 15 - ) - default boolean rareTreeTooltips() - { - return true; - } - - @ConfigItem( - keyName = WorldMapPlugin.CONFIG_KEY_RARE_TREE_LEVEL_ICON, - name = "Indicate unavailable trees", - description = "Indicate rare trees you do not have the level to cut on the icon", - position = 16 - ) - default boolean rareTreeLevelIcon() - { - return true; - } - - @ConfigItem( - keyName = WorldMapPlugin.CONFIG_KEY_TRANSPORATION_TELEPORT_TOOLTIPS, - name = "Show transporation tooltips", - description = "Indicates types and destinations of Transporation", - position = 17 - ) - default boolean transportationTeleportTooltips() - { - return true; - } - - @ConfigItem( - keyName = WorldMapPlugin.CONFIG_KEY_RUNECRAFTING_ALTAR_ICON, - name = "Show runecrafting altar locations", - description = "Show the icons of runecrafting altars", - position = 18 - ) - default boolean runecraftingAltarIcon() - { - return true; - } -} \ No newline at end of file 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 deleted file mode 100644 index d54a54262e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapPlugin.java +++ /dev/null @@ -1,435 +0,0 @@ -/* - * Copyright (c) 2018, Morgan Lewis - * 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.client.plugins.worldmap; - -import com.google.inject.Inject; -import com.google.inject.Provides; -import java.awt.image.BufferedImage; -import java.util.Arrays; -import java.util.concurrent.ScheduledExecutorService; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.Quest; -import net.runelite.api.QuestState; -import net.runelite.api.Skill; -import net.runelite.api.events.StatChanged; -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.events.ConfigChanged; -import net.runelite.client.game.AgilityShortcut; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.ui.overlay.worldmap.WorldMapPointManager; -import net.runelite.client.util.ImageUtil; - -@PluginDescriptor( - name = "World Map", - description = "Enhance the world map to display additional information", - tags = {"agility", "fairy", "farming", "rings", "teleports"}, - type = PluginType.UTILITY -) -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"; - static final String CONFIG_KEY_FAIRY_RING_ICON = "fairyRingIcon"; - static final String CONFIG_KEY_AGILITY_SHORTCUT_TOOLTIPS = "agilityShortcutTooltips"; - static final String CONFIG_KEY_AGILITY_SHORTCUT_LEVEL_ICON = "agilityShortcutIcon"; - static final String CONFIG_KEY_NORMAL_TELEPORT_ICON = "standardSpellbookIcon"; - static final String CONFIG_KEY_ANCIENT_TELEPORT_ICON = "ancientSpellbookIcon"; - static final String CONFIG_KEY_LUNAR_TELEPORT_ICON = "lunarSpellbookIcon"; - static final String CONFIG_KEY_ARCEUUS_TELEPORT_ICON = "arceuusSpellbookIcon"; - static final String CONFIG_KEY_JEWELLERY_TELEPORT_ICON = "jewelleryIcon"; - static final String CONFIG_KEY_SCROLL_TELEPORT_ICON = "scrollIcon"; - static final String CONFIG_KEY_MISC_TELEPORT_ICON = "miscellaneousTeleportIcon"; - static final String CONFIG_KEY_QUEST_START_TOOLTIPS = "questStartTooltips"; - static final String CONFIG_KEY_MINIGAME_TOOLTIP = "minigameTooltip"; - static final String CONFIG_KEY_FARMING_PATCH_TOOLTIPS = "farmingpatchTooltips"; - static final String CONFIG_KEY_RARE_TREE_TOOLTIPS = "rareTreeTooltips"; - static final String CONFIG_KEY_RARE_TREE_LEVEL_ICON = "rareTreeIcon"; - static final String CONFIG_KEY_TRANSPORATION_TELEPORT_TOOLTIPS = "transportationTooltips"; - static final String CONFIG_KEY_RUNECRAFTING_ALTAR_ICON = "runecraftingAltarIcon"; - - static - { - //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); - final BufferedImage fairyTravelIcon = ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, "fairy_ring_travel.png"); - FAIRY_TRAVEL_ICON.getGraphics().drawImage(fairyTravelIcon, 1, 1, null); - - 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; - - @Inject - private WorldMapPointManager worldMapPointManager; - - @Inject - private ScheduledExecutorService executor; - - private int agilityLevel = 0; - private int woodcuttingLevel = 0; - - private boolean fairyRingTooltips; - private boolean fairyRingIcon; - private boolean agilityShortcutTooltips; - private boolean agilityShortcutLevelIcon; - private boolean normalTeleportIcon; - private boolean minigameTooltip; - private boolean ancientTeleportIcon; - private boolean lunarTeleportIcon; - private boolean arceuusTeleportIcon; - private boolean jewelleryTeleportIcon; - private boolean scrollTeleportIcon; - private boolean miscellaneousTeleportIcon; - private boolean questStartTooltips; - private boolean farmingPatchTooltips; - private boolean rareTreeTooltips; - private boolean rareTreeLevelIcon; - private boolean transportationTeleportTooltips; - - @Provides - WorldMapConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(WorldMapConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - agilityLevel = client.getRealSkillLevel(Skill.AGILITY); - woodcuttingLevel = client.getRealSkillLevel(Skill.WOODCUTTING); - updateShownIcons(); - } - - @Override - protected void shutDown() - { - worldMapPointManager.removeIf(FairyRingPoint.class::isInstance); - worldMapPointManager.removeIf(AgilityShortcutPoint.class::isInstance); - worldMapPointManager.removeIf(QuestStartPoint.class::isInstance); - worldMapPointManager.removeIf(TeleportPoint.class::isInstance); - worldMapPointManager.removeIf(TransportationPoint.class::isInstance); - worldMapPointManager.removeIf(MinigamePoint.class::isInstance); - worldMapPointManager.removeIf(FarmingPatchPoint.class::isInstance); - worldMapPointManager.removeIf(RareTreePoint.class::isInstance); - worldMapPointManager.removeIf(RunecraftingAltarPoint.class::isInstance); - agilityLevel = 0; - woodcuttingLevel = 0; - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals(CONFIG_KEY)) - { - return; - } - - updateConfig(); - updateShownIcons(); - } - - @Subscribe - private void onStatChanged(StatChanged statChanged) - { - switch (statChanged.getSkill()) - { - case AGILITY: - { - int newAgilityLevel = statChanged.getLevel(); - if (newAgilityLevel != agilityLevel) - { - agilityLevel = newAgilityLevel; - updateAgilityIcons(); - } - break; - } - case WOODCUTTING: - { - int newWoodcutLevel = statChanged.getLevel(); - if (newWoodcutLevel != woodcuttingLevel) - { - woodcuttingLevel = newWoodcutLevel; - updateRareTreeIcons(); - } - break; - } - } - } - - @Subscribe - private 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); - - if (this.agilityShortcutLevelIcon || this.agilityShortcutTooltips) - { - Arrays.stream(AgilityShortcut.values()) - .filter(value -> value.getWorldMapLocation() != null) - .map(value -> new AgilityShortcutPoint(value, - agilityLevel > 0 && this.agilityShortcutLevelIcon && value.getLevel() > agilityLevel ? NOPE_ICON : BLANK_ICON, - this.agilityShortcutTooltips)) - .forEach(worldMapPointManager::add); - } - } - - private void updateRareTreeIcons() - { - worldMapPointManager.removeIf(RareTreePoint.class::isInstance); - - if (this.rareTreeLevelIcon || this.rareTreeTooltips) - { - Arrays.stream(RareTreeLocation.values()).forEach(rareTree -> - Arrays.stream(rareTree.getLocations()) - .map(point -> new RareTreePoint(point, - rareTree.getTooltip(), - woodcuttingLevel > 0 && this.rareTreeLevelIcon && - rareTree.getLevelReq() > woodcuttingLevel ? NOPE_ICON : BLANK_ICON, - this.rareTreeTooltips)) - .forEach(worldMapPointManager::add)); - } - } - - private void updateShownIcons() - { - updateAgilityIcons(); - updateRareTreeIcons(); - updateQuestStartPointIcons(); - - worldMapPointManager.removeIf(FairyRingPoint.class::isInstance); - if (this.fairyRingIcon || this.fairyRingTooltips) - { - Arrays.stream(FairyRingLocation.values()) - .map(value -> new FairyRingPoint(value, - this.fairyRingIcon ? FAIRY_TRAVEL_ICON : BLANK_ICON, - this.fairyRingTooltips)) - .forEach(worldMapPointManager::add); - } - - worldMapPointManager.removeIf(MinigamePoint.class::isInstance); - if (this.minigameTooltip) - { - Arrays.stream(MinigameLocation.values()) - .map(value -> new MinigamePoint(value, BLANK_ICON)) - .forEach(worldMapPointManager::add); - } - - worldMapPointManager.removeIf(TransportationPoint.class::isInstance); - if (this.transportationTeleportTooltips) - { - Arrays.stream(TransportationPointLocation.values()) - .map(value -> new TransportationPoint(value, BLANK_ICON)) - .forEach((worldMapPointManager::add)); - } - - worldMapPointManager.removeIf(FarmingPatchPoint.class::isInstance); - if (this.farmingPatchTooltips) - { - Arrays.stream(FarmingPatchLocation.values()).forEach(location -> - Arrays.stream(location.getLocations()) - .map(point -> new FarmingPatchPoint(point, location.getTooltip(), BLANK_ICON)) - .forEach(worldMapPointManager::add) - ); - } - - worldMapPointManager.removeIf(TeleportPoint.class::isInstance); - // This next part gets 142 icons from disk, and does so on the EDT (at first run) - Arrays.stream(TeleportLocationData.values()) - .filter(data -> - { - switch (data.getType()) - { - case NORMAL_MAGIC: - return this.normalTeleportIcon; - case ANCIENT_MAGICKS: - return this.ancientTeleportIcon; - case LUNAR_MAGIC: - return this.lunarTeleportIcon; - case ARCEUUS_MAGIC: - return this.arceuusTeleportIcon; - case JEWELLERY: - return this.jewelleryTeleportIcon; - case SCROLL: - return this.scrollTeleportIcon; - case OTHER: - return this.miscellaneousTeleportIcon; - default: - return false; - } - }).map(TeleportPoint::new) - .forEach(worldMapPointManager::add); - - worldMapPointManager.removeIf(RunecraftingAltarPoint.class::isInstance); - if (config.runecraftingAltarIcon()) - { - Arrays.stream(RunecraftingAltarLocation.values()) - .map(RunecraftingAltarPoint::new) - .forEach(worldMapPointManager::add); - } - } - - private void updateQuestStartPointIcons() - { - worldMapPointManager.removeIf(QuestStartPoint.class::isInstance); - - if (!this.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 (Quest value : quests) - { - if (value.getState(client) != QuestState.FINISHED) - { - quest = value; - 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); - } - - private void updateConfig() - { - this.fairyRingTooltips = config.fairyRingTooltips(); - this.fairyRingIcon = config.fairyRingIcon(); - this.agilityShortcutTooltips = config.agilityShortcutTooltips(); - this.agilityShortcutLevelIcon = config.agilityShortcutLevelIcon(); - this.normalTeleportIcon = config.normalTeleportIcon(); - this.minigameTooltip = config.minigameTooltip(); - this.ancientTeleportIcon = config.ancientTeleportIcon(); - this.lunarTeleportIcon = config.lunarTeleportIcon(); - this.arceuusTeleportIcon = config.arceuusTeleportIcon(); - this.jewelleryTeleportIcon = config.jewelleryTeleportIcon(); - this.scrollTeleportIcon = config.scrollTeleportIcon(); - this.miscellaneousTeleportIcon = config.miscellaneousTeleportIcon(); - this.questStartTooltips = config.questStartTooltips(); - this.farmingPatchTooltips = config.farmingPatchTooltips(); - this.rareTreeTooltips = config.rareTreeTooltips(); - this.rareTreeLevelIcon = config.rareTreeLevelIcon(); - this.transportationTeleportTooltips = config.transportationTeleportTooltips(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobe.java b/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobe.java deleted file mode 100644 index 68ffee0499..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobe.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2017, Steve - * 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.xpglobes; - -import java.time.Instant; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; -import net.runelite.api.Skill; - -@Getter(AccessLevel.PACKAGE) -@Setter(AccessLevel.PACKAGE) -@AllArgsConstructor -class XpGlobe -{ - private Skill skill; - private int currentXp; - private int currentLevel; - private Instant time; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesConfig.java deleted file mode 100644 index ba8eb1dfd8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesConfig.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) 2017, Steve - * 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.xpglobes; - -import java.awt.Color; -import net.runelite.client.config.Alpha; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("xpglobes") -public interface XpGlobesConfig extends Config -{ - @ConfigItem( - keyName = "enableTooltips", - name = "Enable Tooltips", - description = "Configures whether or not to show tooltips", - position = 0 - ) - default boolean enableTooltips() - { - return true; - } - - @ConfigItem( - keyName = "showXpLeft", - name = "Show XP Left", - description = "Shows XP Left inside the globe tooltip box", - position = 1 - ) - default boolean showXpLeft() - { - return true; - } - - @ConfigItem( - keyName = "showActionsLeft", - name = "Show actions left", - description = "Shows the number of actions left inside the globe tooltip box", - position = 2 - ) - default boolean showActionsLeft() - { - return true; - } - - @ConfigItem( - keyName = "showXpHour", - name = "Show XP/hr", - description = "Shows XP per hour inside the globe tooltip box", - position = 3 - ) - default boolean showXpHour() - { - return true; - } - - @ConfigItem( - keyName = "hideMaxed", - name = "Hide maxed skills", - description = "Stop globes from showing up for level 99 skills ", - position = 4 - ) - default boolean hideMaxed() - { - return false; - } - - @ConfigItem( - keyName = "Time to level", - name = "Display TTL", - description = "Displays time left to level", - position = 5 - ) - default boolean enableTimeToLevel() - { - return true; - } - - @ConfigItem( - keyName = "enableCustomArcColor", - name = "Enable custom arc color", - description = "Enables the custom coloring of the globe's arc instead of using the skill's default color.", - position = 6 - ) - default boolean enableCustomArcColor() - { - return false; - } - - @Alpha - @ConfigItem( - keyName = "Progress arc color", - name = "Progress arc color", - description = "Change the color of the progress arc in the xp orb", - position = 7 - ) - default Color progressArcColor() - { - return Color.ORANGE; - } - - @Alpha - @ConfigItem( - keyName = "Progress orb outline color", - name = "Progress orb outline color", - description = "Change the color of the progress orb outline", - position = 8 - ) - default Color progressOrbOutLineColor() - { - return Color.BLACK; - } - - @Alpha - @ConfigItem( - keyName = "Progress orb background color", - name = "Progress orb background color", - description = "Change the color of the progress orb background", - position = 9 - ) - default Color progressOrbBackgroundColor() - { - return new Color(128, 128, 128, 127); - } - - @ConfigItem( - keyName = "Progress arc width", - name = "Progress arc width", - description = "Change the stroke width of the progress arc", - position = 10 - ) - default int progressArcStrokeWidth() - { - return 2; - } - - @ConfigItem( - keyName = "Orb size", - name = "Size of orbs", - description = "Change the size of the xp orbs", - position = 11 - ) - default int xpOrbSize() - { - return 40; - } - - @ConfigItem( - keyName = "Orb duration", - name = "Duration of orbs", - description = "Change the duration the xp orbs are visible", - position = 12 - ) - default int xpOrbDuration() - { - return 10; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesOverlay.java deleted file mode 100644 index c8e2eb4fcb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesOverlay.java +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright (c) 2017, Steve - * 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.xpglobes; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FontMetrics; -import java.awt.Graphics2D; -import java.awt.Rectangle; -import java.awt.RenderingHints; -import java.awt.Stroke; -import java.awt.geom.Arc2D; -import java.awt.geom.Ellipse2D; -import java.awt.image.BufferedImage; -import java.text.DecimalFormat; -import java.time.Instant; -import java.util.Comparator; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Client; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.Point; -import net.runelite.client.game.SkillIconManager; -import net.runelite.client.plugins.xptracker.XpActionType; -import net.runelite.client.plugins.xptracker.XpTrackerService; -import net.runelite.client.ui.SkillColor; -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.OverlayUtil; -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; -import net.runelite.client.util.ColorUtil; - -@Singleton -public class XpGlobesOverlay extends Overlay -{ - private static final int MINIMUM_STEP = 10; - private static final int PROGRESS_RADIUS_START = 90; - private static final int PROGRESS_RADIUS_REMAINDER = 0; - private static final int TOOLTIP_RECT_SIZE_X = 150; - private static final Color DARK_OVERLAY_COLOR = new Color(0, 0, 0, 180); - - private final Client client; - private final XpGlobesPlugin plugin; - private final XpTrackerService xpTrackerService; - private final PanelComponent xpTooltip = new PanelComponent(); - private final SkillIconManager iconManager; - - @Inject - private XpGlobesOverlay( - final Client client, - final XpGlobesPlugin plugin, - final XpTrackerService xpTrackerService, - final SkillIconManager iconManager) - { - super(plugin); - this.iconManager = iconManager; - this.client = client; - this.plugin = plugin; - - this.xpTrackerService = xpTrackerService; - setPosition(OverlayPosition.TOP_CENTER); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "XP Globes overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - final int queueSize = plugin.getXpGlobesSize(); - if (queueSize == 0) - { - return null; - } - - final List sortedXpGlobes = plugin.getXpGlobes(); - sortedXpGlobes.sort(Comparator.comparing(XpGlobe::getSkill)); - - int curDrawX = 0; - for (final XpGlobe xpGlobe : sortedXpGlobes) - { - int startXp = xpTrackerService.getStartGoalXp(xpGlobe.getSkill()); - int goalXp = xpTrackerService.getEndGoalXp(xpGlobe.getSkill()); - renderProgressCircle(graphics, xpGlobe, startXp, goalXp, curDrawX, 0, getBounds()); - curDrawX += MINIMUM_STEP + plugin.getXpOrbSize(); - } - - // Get width of markers - final int markersLength = (queueSize * (plugin.getXpOrbSize())) + ((MINIMUM_STEP) * (queueSize - 1)); - return new Dimension(markersLength, plugin.getXpOrbSize()); - } - - private double getSkillProgress(int startXp, int currentXp, int goalXp) - { - double xpGained = currentXp - startXp; - double xpGoal = goalXp - startXp; - - return ((xpGained / xpGoal) * 100); - } - - private double getSkillProgressRadius(int startXp, int currentXp, int goalXp) - { - return -(3.6 * getSkillProgress(startXp, currentXp, goalXp)); //arc goes backwards - } - - private void renderProgressCircle(Graphics2D graphics, XpGlobe skillToDraw, int startXp, int goalXp, int x, int y, Rectangle bounds) - { - double radiusCurrentXp = getSkillProgressRadius(startXp, skillToDraw.getCurrentXp(), goalXp); - double radiusToGoalXp = 360; //draw a circle - - Ellipse2D backgroundCircle = drawEllipse(graphics, x, y); - - drawSkillImage(graphics, skillToDraw, x, y); - - Point mouse = client.getMouseCanvasPosition(); - int mouseX = mouse.getX() - bounds.x; - int mouseY = mouse.getY() - bounds.y; - - // If mouse is hovering the globe - if (backgroundCircle.contains(mouseX, mouseY)) - { - // Fill a darker overlay circle - graphics.setColor(DARK_OVERLAY_COLOR); - graphics.fill(backgroundCircle); - - drawProgressLabel(graphics, skillToDraw, startXp, goalXp, x, y); - - if (plugin.isEnableTooltips()) - { - drawTooltip(graphics, skillToDraw, goalXp, backgroundCircle); - } - } - - graphics.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); - - drawProgressArc( - graphics, - x, y, - plugin.getXpOrbSize(), plugin.getXpOrbSize(), - PROGRESS_RADIUS_REMAINDER, radiusToGoalXp, - 5, - plugin.getProgressOrbOutLineColor() - ); - drawProgressArc( - graphics, - x, y, - plugin.getXpOrbSize(), plugin.getXpOrbSize(), - PROGRESS_RADIUS_START, radiusCurrentXp, - plugin.getProgressArcStrokeWidth(), - plugin.isEnableCustomArcColor() ? plugin.getProgressArcColor() : SkillColor.find(skillToDraw.getSkill()).getColor()); - } - - private void drawProgressLabel(Graphics2D graphics, XpGlobe globe, int startXp, int goalXp, int x, int y) - { - if (goalXp <= globe.getCurrentXp()) - { - return; - } - - // Convert to int just to limit the decimal cases - String progress = (int) (getSkillProgress(startXp, globe.getCurrentXp(), goalXp)) + "%"; - - final FontMetrics metrics = graphics.getFontMetrics(); - int drawX = x + (plugin.getXpOrbSize() / 2) - (metrics.stringWidth(progress) / 2); - int drawY = y + (plugin.getXpOrbSize() / 2) + (metrics.getHeight() / 2) - metrics.getMaxDescent(); - - OverlayUtil.renderTextLocation(graphics, new Point(drawX, drawY), progress, Color.WHITE); - } - - private void drawProgressArc(Graphics2D graphics, int x, int y, int w, int h, double radiusStart, double radiusEnd, int strokeWidth, Color color) - { - Stroke stroke = graphics.getStroke(); - graphics.setStroke(new BasicStroke(strokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); - graphics.setColor(color); - graphics.draw(new Arc2D.Double( - x, y, - w, h, - radiusStart, radiusEnd, - Arc2D.OPEN)); - graphics.setStroke(stroke); - } - - private Ellipse2D drawEllipse(Graphics2D graphics, int x, int y) - { - graphics.setColor(plugin.getProgressOrbBackgroundColor()); - Ellipse2D ellipse = new Ellipse2D.Double(x, y, plugin.getXpOrbSize(), plugin.getXpOrbSize()); - graphics.fill(ellipse); - graphics.draw(ellipse); - return ellipse; - } - - private void drawSkillImage(Graphics2D graphics, XpGlobe xpGlobe, int x, int y) - { - BufferedImage skillImage = iconManager.getSkillImage(xpGlobe.getSkill()); - - if (skillImage == null) - { - return; - } - - graphics.drawImage( - skillImage, - x + (plugin.getXpOrbSize() / 2) - (skillImage.getWidth() / 2), - y + (plugin.getXpOrbSize() / 2) - (skillImage.getHeight() / 2), - null - ); - } - - private void drawTooltip(Graphics2D graphics, XpGlobe mouseOverSkill, int goalXp, Ellipse2D drawnGlobe) - { - //draw tooltip under the globe of the mouse location - int x = (int) drawnGlobe.getX() - (TOOLTIP_RECT_SIZE_X / 2) + (plugin.getXpOrbSize() / 2); - int y = (int) drawnGlobe.getY() + plugin.getXpOrbSize() + 10; - - // reset the timer on XpGlobe to prevent it from disappearing while hovered over it - mouseOverSkill.setTime(Instant.now()); - - String skillName = mouseOverSkill.getSkill().getName(); - String skillLevel = Integer.toString(mouseOverSkill.getCurrentLevel()); - - DecimalFormat decimalFormat = new DecimalFormat("###,###,###"); - String skillCurrentXp = decimalFormat.format(mouseOverSkill.getCurrentXp()); - - xpTooltip.getChildren().clear(); - xpTooltip.setPreferredLocation(new java.awt.Point(x, y)); - xpTooltip.setPreferredSize(new Dimension(TOOLTIP_RECT_SIZE_X, 0)); - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - tableComponent.addRow(skillName, skillLevel); - tableComponent.addRow(ColorUtil.prependColorTag("Current XP:", Color.ORANGE), skillCurrentXp); - - if (goalXp > mouseOverSkill.getCurrentXp()) - { - XpActionType xpActionType = xpTrackerService.getActionType(mouseOverSkill.getSkill()); - - if (plugin.isShowActionsLeft()) - { - int actionsLeft = xpTrackerService.getActionsLeft(mouseOverSkill.getSkill()); - if (actionsLeft != Integer.MAX_VALUE) - { - String actionsLeftString = decimalFormat.format(actionsLeft); - - tableComponent.addRow(ColorUtil.prependColorTag(xpActionType.getLabel() + " left:", Color.ORANGE), actionsLeftString); - } - } - - if (plugin.isShowXpLeft()) - { - int xpLeft = goalXp - mouseOverSkill.getCurrentXp(); - String skillXpToLvl = decimalFormat.format(xpLeft); - tableComponent.addRow(ColorUtil.prependColorTag("XP left:", Color.ORANGE), skillXpToLvl); - } - - if (plugin.isShowXpHour()) - { - int xpHr = xpTrackerService.getXpHr(mouseOverSkill.getSkill()); - if (xpHr != 0) - { - String xpHrString = decimalFormat.format(xpHr); - tableComponent.addRow(ColorUtil.prependColorTag("XP per hour:", Color.ORANGE), xpHrString); - } - } - - if (plugin.isEnableTimeToLevel()) - { - String timeLeft = xpTrackerService.getTimeTillGoal(mouseOverSkill.getSkill()); - tableComponent.addRow(ColorUtil.prependColorTag("TimeLeft:", Color.ORANGE), timeLeft); - } - } - - xpTooltip.getChildren().add(tableComponent); - - xpTooltip.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesPlugin.java deleted file mode 100644 index 2ecbaa93cb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesPlugin.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright (c) 2017, Steve - * 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.xpglobes; - -import com.google.inject.Provides; -import java.awt.Color; -import java.time.Instant; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Experience; -import net.runelite.api.Skill; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.StatChanged; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDependency; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.xptracker.XpTrackerPlugin; -import net.runelite.client.task.Schedule; -import net.runelite.client.ui.overlay.OverlayManager; - -@PluginDescriptor( - name = "XP Globes", - description = "Show XP globes for the respective skill when gaining XP", - tags = {"experience", "levels", "overlay"}, - enabledByDefault = false, - type = PluginType.UTILITY -) -@Singleton -@PluginDependency(XpTrackerPlugin.class) -public class XpGlobesPlugin extends Plugin -{ - private static final int MAXIMUM_SHOWN_GLOBES = 5; - - private XpGlobe[] globeCache = new XpGlobe[Skill.values().length - 1]; //overall does not trigger xp change event - - @Getter - private final List xpGlobes = new ArrayList<>(); - - @Inject - private XpGlobesConfig config; - - @Inject - private OverlayManager overlayManager; - - @Inject - private XpGlobesOverlay overlay; - - @Getter(AccessLevel.PACKAGE) - private boolean enableTooltips; - private boolean hideMaxed; - @Getter(AccessLevel.PACKAGE) - private boolean enableTimeToLevel; - @Getter(AccessLevel.PACKAGE) - private boolean showXpHour; - @Getter(AccessLevel.PACKAGE) - private boolean showActionsLeft; - @Getter(AccessLevel.PACKAGE) - private boolean showXpLeft; - @Getter(AccessLevel.PACKAGE) - private boolean enableCustomArcColor; - @Getter(AccessLevel.PACKAGE) - private Color progressArcColor; - @Getter(AccessLevel.PACKAGE) - private Color progressOrbOutLineColor; - @Getter(AccessLevel.PACKAGE) - private Color progressOrbBackgroundColor; - @Getter(AccessLevel.PACKAGE) - private int progressArcStrokeWidth; - @Getter(AccessLevel.PACKAGE) - private int xpOrbSize; - private int xpOrbDuration; - - @Provides - XpGlobesConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(XpGlobesConfig.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - overlayManager.add(overlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(overlay); - } - - @Subscribe - private void onStatChanged(StatChanged statChanged) - { - Skill skill = statChanged.getSkill(); - int currentXp = statChanged.getXp(); - int currentLevel = statChanged.getLevel(); - int skillIdx = skill.ordinal(); - XpGlobe cachedGlobe = globeCache[skillIdx]; - - // ExperienceChanged event occurs when stats drain/boost check we have an change to actual xp - if (cachedGlobe != null && (cachedGlobe.getCurrentXp() >= currentXp)) - { - return; - } - - if (this.hideMaxed && currentLevel >= Experience.MAX_REAL_LEVEL) - { - return; - } - - if (cachedGlobe != null) - { - cachedGlobe.setSkill(skill); - cachedGlobe.setCurrentXp(currentXp); - cachedGlobe.setCurrentLevel(currentLevel); - cachedGlobe.setTime(Instant.now()); - this.addXpGlobe(globeCache[skillIdx], MAXIMUM_SHOWN_GLOBES); - } - else - { - // dont draw non cached globes, this is triggered on login to setup all of the initial values - globeCache[skillIdx] = new XpGlobe(skill, currentXp, currentLevel, Instant.now()); - } - } - - private void addXpGlobe(XpGlobe xpGlobe, int maxLength) - { - //remove the old globe, allowing it to be readded as the most recent (right) side when drawn - xpGlobes.remove(xpGlobe); - if (getXpGlobesSize() >= maxLength) - { - xpGlobes.remove(0); - } - xpGlobes.add(xpGlobe); - } - - int getXpGlobesSize() - { - return xpGlobes.size(); - } - - @Schedule( - period = 1, - unit = ChronoUnit.SECONDS - ) - public void removeExpiredXpGlobes() - { - if (!xpGlobes.isEmpty()) - { - Instant currentTime = Instant.now(); - for (Iterator it = xpGlobes.iterator(); it.hasNext(); ) - { - XpGlobe globe = it.next(); - Instant globeCreationTime = globe.getTime(); - if (currentTime.isBefore(globeCreationTime.plusSeconds(this.xpOrbDuration))) - { - //if a globe is not expired, stop checking newer globes - return; - } - it.remove(); - } - } - } - - private void resetGlobeState() - { - xpGlobes.clear(); - globeCache = new XpGlobe[Skill.values().length - 1]; - } - - @Subscribe - private void onGameStateChanged(GameStateChanged event) - { - switch (event.getGameState()) - { - case HOPPING: - case LOGGING_IN: - resetGlobeState(); - break; - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("xpglobes")) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.enableTooltips = config.enableTooltips(); - this.hideMaxed = config.hideMaxed(); - this.enableTimeToLevel = config.enableTimeToLevel(); - this.enableCustomArcColor = config.enableCustomArcColor(); - this.progressArcColor = config.progressArcColor(); - this.progressOrbOutLineColor = config.progressOrbOutLineColor(); - this.progressOrbBackgroundColor = config.progressOrbBackgroundColor(); - this.progressArcStrokeWidth = config.progressArcStrokeWidth(); - this.xpOrbSize = config.xpOrbSize(); - this.xpOrbDuration = config.xpOrbDuration(); - this.showXpLeft = config.showXpLeft(); - this.showActionsLeft = config.showActionsLeft(); - this.showXpHour = config.showXpHour(); - - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpAction.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpAction.java deleted file mode 100644 index 4831c47cbf..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpAction.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.xptracker; - -import lombok.Data; - -@Data -class XpAction -{ - private int actions = 0; - private boolean actionsHistoryInitialized = false; - private int[] actionExps = new int[10]; - private int actionExpIndex = 0; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpActionType.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpActionType.java deleted file mode 100644 index c73a9c6c12..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpActionType.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.xptracker; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter(AccessLevel.PUBLIC) -@AllArgsConstructor -public enum XpActionType -{ - EXPERIENCE("Actions"), - ACTOR_HEALTH("Kills"); - - private final String label; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java deleted file mode 100644 index 0df05e899c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java +++ /dev/null @@ -1,370 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * Copyright (c) 2018, Psikoi - * 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.xptracker; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.math.RoundingMode; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.SwingConstants; -import javax.swing.SwingUtilities; -import javax.swing.border.EmptyBorder; -import javax.swing.event.PopupMenuEvent; -import javax.swing.event.PopupMenuListener; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Client; -import net.runelite.api.Experience; -import net.runelite.api.Skill; -import net.runelite.client.game.SkillIconManager; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.DynamicGridLayout; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.SkillColor; -import net.runelite.client.ui.components.ProgressBar; -import net.runelite.client.util.ColorUtil; -import net.runelite.client.util.LinkBrowser; -import net.runelite.client.util.QuantityFormatter; - -class XpInfoBox extends JPanel -{ - private static final DecimalFormat TWO_DECIMAL_FORMAT = new DecimalFormat("0.00"); - - static - { - TWO_DECIMAL_FORMAT.setRoundingMode(RoundingMode.DOWN); - } - - // Templates - private static final String HTML_TOOL_TIP_TEMPLATE = - "%s %s done
" - + "%s %s/hr
" - + "%s till goal lvl"; - private static final String HTML_LABEL_TEMPLATE = - "%s%s"; - - private static final String REMOVE_STATE = "Remove from canvas"; - private static final String ADD_STATE = "Add to canvas"; - - // Instance members - private final JPanel panel; - private final XpTrackerPlugin plugin; - - @Getter(AccessLevel.PACKAGE) - private final Skill skill; - - /* The tracker's wrapping container */ - private final JPanel container = new JPanel(); - - /* Contains the skill icon */ - private final JPanel skillWrapper = new JPanel(); - - /* Contains all the skill information (exp gained, per hour, etc) */ - private final JPanel statsPanel = new JPanel(); - - private final JPanel progressWrapper = new JPanel(); - private final ProgressBar progressBar = new ProgressBar(); - - private final JLabel expGained = new JLabel(); - private final JLabel expHour = new JLabel(); - private final JLabel expLeft = new JLabel(); - private final JLabel actionsLeft = new JLabel(); - private final JMenuItem pauseSkill = new JMenuItem("Pause"); - private final JMenuItem canvasItem = new JMenuItem(ADD_STATE); - - private boolean paused = false; - - private Style style = Style.FULL; - - private enum Style - { - FULL, - SIMPLE - } - - XpInfoBox(XpTrackerPlugin xpTrackerPlugin, Client client, JPanel panel, Skill skill, SkillIconManager iconManager) - { - this.plugin = xpTrackerPlugin; - this.panel = panel; - this.skill = skill; - - setLayout(new BorderLayout()); - setBorder(new EmptyBorder(5, 0, 0, 0)); - - container.setLayout(new BorderLayout()); - container.setBackground(ColorScheme.DARKER_GRAY_COLOR); - - // Create open xp tracker menu - final JMenuItem openXpTracker = new JMenuItem("Open online tracker"); - openXpTracker.addActionListener(e -> LinkBrowser.browse(XpPanel.buildXpTrackerUrl(client.getLocalPlayer(), skill))); - - // Create reset menu - final JMenuItem reset = new JMenuItem("Reset"); - reset.addActionListener(e -> xpTrackerPlugin.resetSkillState(skill)); - - // Create reset others menu - final JMenuItem resetOthers = new JMenuItem("Reset others"); - resetOthers.addActionListener(e -> xpTrackerPlugin.resetOtherSkillState(skill)); - - // Create reset others menu - pauseSkill.addActionListener(e -> xpTrackerPlugin.pauseSkill(skill, !paused)); - - // Create popup menu - final JPopupMenu popupMenu = new JPopupMenu(); - popupMenu.setBorder(new EmptyBorder(5, 5, 5, 5)); - popupMenu.add(openXpTracker); - popupMenu.add(reset); - popupMenu.add(resetOthers); - popupMenu.add(pauseSkill); - popupMenu.add(canvasItem); - popupMenu.addPopupMenuListener(new PopupMenuListener() - { - @Override - public void popupMenuWillBecomeVisible(PopupMenuEvent popupMenuEvent) - { - canvasItem.setText(xpTrackerPlugin.hasOverlay(skill) ? REMOVE_STATE : ADD_STATE); - } - - @Override - public void popupMenuWillBecomeInvisible(PopupMenuEvent popupMenuEvent) - { - } - - @Override - public void popupMenuCanceled(PopupMenuEvent popupMenuEvent) - { - } - }); - - skillWrapper.setBackground(ColorScheme.DARKER_GRAY_COLOR); - skillWrapper.setLayout(new BorderLayout()); - skillWrapper.setBorder(new EmptyBorder(0, 5, 0, 0)); - - canvasItem.addActionListener(e -> - { - if (canvasItem.getText().equals(REMOVE_STATE)) - { - xpTrackerPlugin.removeOverlay(skill); - } - else - { - xpTrackerPlugin.addOverlay(skill); - } - }); - - JLabel skillIcon = new JLabel(new ImageIcon(iconManager.getSkillImage(skill))); - skillIcon.setHorizontalAlignment(SwingConstants.CENTER); - skillIcon.setVerticalAlignment(SwingConstants.CENTER); - skillIcon.setPreferredSize(new Dimension(30, 30)); - - skillWrapper.add(skillIcon, BorderLayout.NORTH); - - statsPanel.setLayout(new DynamicGridLayout(2, 2)); - statsPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - statsPanel.setBorder(new EmptyBorder(6, 5, 0, 2)); - - expGained.setFont(FontManager.getRunescapeSmallFont()); - expHour.setFont(FontManager.getRunescapeSmallFont()); - expLeft.setFont(FontManager.getRunescapeSmallFont()); - actionsLeft.setFont(FontManager.getRunescapeSmallFont()); - - statsPanel.add(expGained); - statsPanel.add(expLeft); - statsPanel.add(expHour); - statsPanel.add(actionsLeft); - - progressWrapper.setBackground(ColorScheme.DARKER_GRAY_COLOR); - progressWrapper.setLayout(new BorderLayout()); - - progressBar.setMaximumValue(100); - progressBar.setBackground(new Color(61, 56, 49)); - progressBar.setForeground(SkillColor.find(skill).getColor()); - progressBar.setDimmedText("Paused"); - - progressWrapper.add(progressBar, BorderLayout.NORTH); - - container.setComponentPopupMenu(popupMenu); - progressBar.setComponentPopupMenu(popupMenu); - - MouseListener mouseListener = new MouseAdapter() - { - @Override - public void mouseClicked(MouseEvent e) - { - if (SwingUtilities.isLeftMouseButton(e)) - { - toggleStyle(); - } - } - }; - container.addMouseListener(mouseListener); - progressBar.addMouseListener(mouseListener); - - add(container, BorderLayout.NORTH); - } - - private void setStyle(Style style) - { - container.removeAll(); - - if (style == Style.SIMPLE) - { - progressWrapper.setBorder(new EmptyBorder(7, 7, 7, 7)); - container.add(skillWrapper, BorderLayout.WEST); - container.add(progressWrapper, BorderLayout.CENTER); - } - else - { - progressWrapper.setBorder(new EmptyBorder(4, 7, 7, 7)); - container.add(skillWrapper, BorderLayout.WEST); - container.add(statsPanel, BorderLayout.CENTER); - container.add(progressWrapper, BorderLayout.SOUTH); - } - - panel.revalidate(); - this.style = style; - } - - void reset() - { - canvasItem.setText(ADD_STATE); - container.remove(statsPanel); - panel.remove(this); - panel.revalidate(); - } - - void update(boolean updated, boolean paused, XpSnapshotSingle xpSnapshotSingle) - { - SwingUtilities.invokeLater(() -> rebuildAsync(updated, paused, xpSnapshotSingle)); - } - - private void rebuildAsync(boolean updated, boolean skillPaused, XpSnapshotSingle xpSnapshotSingle) - { - if (updated) - { - if (getParent() != panel) - { - panel.add(this); - setStyle(style); - } - - paused = skillPaused; - - // Update information labels - expGained.setText(htmlLabel("XP Gained: ", xpSnapshotSingle.getXpGainedInSession())); - expLeft.setText(htmlLabel("XP Left: ", xpSnapshotSingle.getXpRemainingToGoal())); - actionsLeft.setText(htmlLabel(xpSnapshotSingle.getActionType().getLabel() + ": ", xpSnapshotSingle.getActionsRemainingToGoal())); - - // Update progress bar - progressBar.setValue((int) xpSnapshotSingle.getSkillProgressToGoal()); - progressBar.setCenterLabel(TWO_DECIMAL_FORMAT.format(xpSnapshotSingle.getSkillProgressToGoal()) + "%"); - progressBar.setLeftLabel("Lvl. " + xpSnapshotSingle.getStartLevel()); - progressBar.setRightLabel(xpSnapshotSingle.getEndGoalXp() == Experience.MAX_SKILL_XP - ? "200M" - : "Lvl. " + xpSnapshotSingle.getEndLevel()); - - // Add intermediate level positions to progressBar - if (plugin.isShowIntermediateLevels() && xpSnapshotSingle.getEndLevel() - xpSnapshotSingle.getStartLevel() > 1) - { - final List positions = new ArrayList<>(); - - for (int level = xpSnapshotSingle.getStartLevel() + 1; level < xpSnapshotSingle.getEndLevel(); level++) - { - double relativeStartExperience = Experience.getXpForLevel(level) - xpSnapshotSingle.getStartGoalXp(); - double relativeEndExperience = xpSnapshotSingle.getEndGoalXp() - xpSnapshotSingle.getStartGoalXp(); - positions.add((int) (relativeStartExperience / relativeEndExperience * 100)); - } - - progressBar.setPositions(positions); - } - else - { - progressBar.setPositions(Collections.emptyList()); - } - - progressBar.setToolTipText(String.format( - HTML_TOOL_TIP_TEMPLATE, - xpSnapshotSingle.getActionsInSession(), - xpSnapshotSingle.getActionType().getLabel(), - xpSnapshotSingle.getActionsPerHour(), - xpSnapshotSingle.getActionType().getLabel(), - xpSnapshotSingle.getTimeTillGoal())); - - progressBar.setDimmed(skillPaused); - - progressBar.repaint(); - } - else if (!paused && skillPaused) - { - // React to the skill state now being paused - progressBar.setDimmed(true); - progressBar.repaint(); - paused = true; - pauseSkill.setText("Unpause"); - } - else if (paused && !skillPaused) - { - // React to the skill being unpaused (without update) - progressBar.setDimmed(false); - progressBar.repaint(); - paused = false; - pauseSkill.setText("Pause"); - } - - // Update exp per hour separately, every time (not only when there's an update) - expHour.setText(htmlLabel("XP/Hour: ", xpSnapshotSingle.getXpPerHour())); - } - - private void toggleStyle() - { - if (style == Style.FULL) - { - setStyle(Style.SIMPLE); - } - else - { - setStyle(Style.FULL); - } - } - - static String htmlLabel(String key, int value) - { - String valueStr = QuantityFormatter.quantityToRSDecimalStack(value, true); - return String.format(HTML_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR), key, valueStr); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBoxOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBoxOverlay.java deleted file mode 100644 index 68fac3b3a2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBoxOverlay.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2018, Jasper Ketelaar - * 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.xptracker; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.image.BufferedImage; -import lombok.AccessLevel; -import lombok.Getter; -import net.runelite.api.Experience; -import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG; -import net.runelite.api.Skill; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.SkillColor; -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.components.ComponentOrientation; -import net.runelite.client.ui.overlay.components.ImageComponent; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.ProgressBarComponent; -import net.runelite.client.ui.overlay.components.SplitComponent; -import net.runelite.client.util.QuantityFormatter; - -class XpInfoBoxOverlay extends Overlay -{ - private static final int PANEL_PREFERRED_WIDTH = 150; - private static final int BORDER_SIZE = 2; - private static final int XP_AND_PROGRESS_BAR_GAP = 2; - private static final int XP_AND_ICON_GAP = 4; - private static final Rectangle XP_AND_ICON_COMPONENT_BORDER = new Rectangle(2, 1, 4, 0); - - private final PanelComponent panel = new PanelComponent(); - private final PanelComponent iconXpSplitPanel = new PanelComponent(); - private final XpTrackerPlugin plugin; - - @Getter(AccessLevel.PACKAGE) - private final Skill skill; - private final BufferedImage icon; - - XpInfoBoxOverlay( - XpTrackerPlugin plugin, - Skill skill, - BufferedImage icon) - { - super(plugin); - this.plugin = plugin; - this.skill = skill; - this.icon = icon; - panel.setBorder(new Rectangle(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE)); - panel.setGap(new Point(0, XP_AND_PROGRESS_BAR_GAP)); - panel.setPreferredSize(new Dimension(PANEL_PREFERRED_WIDTH, 0)); - iconXpSplitPanel.setBorder(XP_AND_ICON_COMPONENT_BORDER); - iconXpSplitPanel.setBackgroundColor(null); - iconXpSplitPanel.setPreferredSize(new Dimension(PANEL_PREFERRED_WIDTH, 0)); - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "XP Tracker overlay")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - panel.getChildren().clear(); - iconXpSplitPanel.getChildren().clear(); - - //Setting the font to rs small font so that the overlay isn't huge - graphics.setFont(FontManager.getRunescapeSmallFont()); - - final XpSnapshotSingle snapshot = plugin.getSkillSnapshot(skill); - - final String leftStr; - final int rightNum; - - switch (plugin.getOnScreenDisplayMode()) - { - case ACTIONS_DONE: - leftStr = snapshot.getActionType().getLabel() + " Done"; - rightNum = snapshot.getActionsInSession(); - break; - case ACTIONS_LEFT: - leftStr = snapshot.getActionType().getLabel() + " Left"; - rightNum = snapshot.getActionsRemainingToGoal(); - break; - case XP_LEFT: - leftStr = "XP Left"; - rightNum = snapshot.getXpRemainingToGoal(); - break; - case XP_GAINED: - default: - leftStr = "XP Gained"; - rightNum = snapshot.getXpGainedInSession(); - break; - } - - final LineComponent xpLine = LineComponent.builder() - .left(leftStr + ":") - .right(QuantityFormatter.quantityToRSDecimalStack(rightNum, true)) - .build(); - - final String bottemLeftStr; - final int bottomRightNum; - - switch (plugin.getOnScreenDisplayModeBottom()) - { - case ACTIONS_HOUR: - bottemLeftStr = snapshot.getActionType().getLabel() + "/Hour"; - bottomRightNum = snapshot.getActionsPerHour(); - break; - case XP_HOUR: - default: - bottemLeftStr = "XP/Hour"; - bottomRightNum = snapshot.getXpPerHour(); - break; - } - - final LineComponent xpLineBottom = LineComponent.builder() - .left(bottemLeftStr + ":") - .right(QuantityFormatter.quantityToRSDecimalStack(bottomRightNum, true)) - .build(); - - final SplitComponent xpSplit = SplitComponent.builder() - .first(xpLine) - .second(xpLineBottom) - .orientation(ComponentOrientation.VERTICAL) - .build(); - - final ImageComponent imageComponent = new ImageComponent(icon); - final SplitComponent iconXpSplit = SplitComponent.builder() - .first(imageComponent) - .second(xpSplit) - .orientation(ComponentOrientation.HORIZONTAL) - .gap(new Point(XP_AND_ICON_GAP, 0)) - .build(); - - iconXpSplitPanel.getChildren().add(iconXpSplit); - - final ProgressBarComponent progressBarComponent = new ProgressBarComponent(); - - progressBarComponent.setBackgroundColor(new Color(61, 56, 49)); - progressBarComponent.setForegroundColor(SkillColor.find(skill).getColor()); - - progressBarComponent.setLeftLabel(String.valueOf(snapshot.getStartLevel())); - progressBarComponent.setRightLabel(snapshot.getEndGoalXp() == Experience.MAX_SKILL_XP - ? "200M" - : String.valueOf(snapshot.getEndLevel())); - - progressBarComponent.setValue(snapshot.getSkillProgressToGoal()); - - panel.getChildren().add(iconXpSplitPanel); - panel.getChildren().add(progressBarComponent); - - return panel.render(graphics); - } - - @Override - public String getName() - { - return super.getName() + skill.getName(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPanel.java deleted file mode 100644 index 5634dc9ee0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPanel.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright (c) 2017, Cameron - * Copyright (c) 2018, Psikoi - * 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.xptracker; - -import java.awt.BorderLayout; -import java.awt.GridLayout; -import java.util.HashMap; -import java.util.Map; -import javax.swing.BoxLayout; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.SwingUtilities; -import javax.swing.border.EmptyBorder; -import net.runelite.api.Actor; -import net.runelite.api.Client; -import net.runelite.api.Skill; -import net.runelite.client.game.SkillIconManager; -import net.runelite.client.ui.ColorScheme; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.PluginPanel; -import net.runelite.client.ui.components.PluginErrorPanel; -import net.runelite.client.util.LinkBrowser; -import okhttp3.HttpUrl; - -class XpPanel extends PluginPanel -{ - private final Map infoBoxes = new HashMap<>(); - - private final JLabel overallExpGained = new JLabel(XpInfoBox.htmlLabel("Gained: ", 0)); - private final JLabel overallExpHour = new JLabel(XpInfoBox.htmlLabel("Per hour: ", 0)); - - private final JPanel overallPanel = new JPanel(); - - /* This displays the "No exp gained" text */ - private final PluginErrorPanel errorPanel = new PluginErrorPanel(); - - XpPanel(XpTrackerPlugin xpTrackerPlugin, Client client, SkillIconManager iconManager) - { - super(); - - setBorder(new EmptyBorder(6, 6, 6, 6)); - setBackground(ColorScheme.DARK_GRAY_COLOR); - setLayout(new BorderLayout()); - - final JPanel layoutPanel = new JPanel(); - BoxLayout boxLayout = new BoxLayout(layoutPanel, BoxLayout.Y_AXIS); - layoutPanel.setLayout(boxLayout); - add(layoutPanel, BorderLayout.NORTH); - - overallPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); - overallPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); - overallPanel.setLayout(new BorderLayout()); - overallPanel.setVisible(false); // this will only become visible when the player gets exp - - // Create open xp tracker menu - final JMenuItem openXpTracker = new JMenuItem("Open online tracker"); - openXpTracker.addActionListener(e -> LinkBrowser.browse(XpPanel.buildXpTrackerUrl(client.getLocalPlayer(), Skill.OVERALL))); - - // Create reset all menu - final JMenuItem reset = new JMenuItem("Reset All"); - reset.addActionListener(e -> xpTrackerPlugin.resetAndInitState()); - - // Create pause all menu - final JMenuItem pauseAll = new JMenuItem("Pause All"); - pauseAll.addActionListener(e -> xpTrackerPlugin.pauseAllSkills(true)); - - // Create unpause all menu - final JMenuItem unpauseAll = new JMenuItem("Unpause All"); - unpauseAll.addActionListener(e -> xpTrackerPlugin.pauseAllSkills(false)); - - - // Create popup menu - final JPopupMenu popupMenu = new JPopupMenu(); - popupMenu.setBorder(new EmptyBorder(5, 5, 5, 5)); - popupMenu.add(openXpTracker); - popupMenu.add(reset); - popupMenu.add(pauseAll); - popupMenu.add(unpauseAll); - overallPanel.setComponentPopupMenu(popupMenu); - - final JLabel overallIcon = new JLabel(new ImageIcon(iconManager.getSkillImage(Skill.OVERALL))); - - final JPanel overallInfo = new JPanel(); - overallInfo.setBackground(ColorScheme.DARKER_GRAY_COLOR); - overallInfo.setLayout(new GridLayout(2, 1)); - overallInfo.setBorder(new EmptyBorder(0, 10, 0, 0)); - - overallExpGained.setFont(FontManager.getRunescapeSmallFont()); - overallExpHour.setFont(FontManager.getRunescapeSmallFont()); - - overallInfo.add(overallExpGained); - overallInfo.add(overallExpHour); - - overallPanel.add(overallIcon, BorderLayout.WEST); - overallPanel.add(overallInfo, BorderLayout.CENTER); - - - final JPanel infoBoxPanel = new JPanel(); - infoBoxPanel.setLayout(new BoxLayout(infoBoxPanel, BoxLayout.Y_AXIS)); - layoutPanel.add(overallPanel); - layoutPanel.add(infoBoxPanel); - - for (Skill skill : Skill.values()) - { - if (skill == Skill.OVERALL) - { - break; - } - infoBoxes.put(skill, new XpInfoBox(xpTrackerPlugin, client, infoBoxPanel, skill, iconManager)); - } - - errorPanel.setContent("Exp trackers", "You have not gained experience yet."); - add(errorPanel); - } - - static String buildXpTrackerUrl(final Actor player, final Skill skill) - { - if (player == null) - { - return ""; - } - - return new HttpUrl.Builder() - .scheme("https") - .host("runelite.net") - .addPathSegment("xp") - .addPathSegment("show") - .addPathSegment(skill.getName().toLowerCase()) - .addPathSegment(player.getName()) - .addPathSegment("1week") - .addPathSegment("now") - .build() - .toString(); - } - - void resetAllInfoBoxes() - { - infoBoxes.forEach((skill, xpInfoBox) -> xpInfoBox.reset()); - } - - void resetSkill(Skill skill) - { - XpInfoBox xpInfoBox = infoBoxes.get(skill); - if (xpInfoBox != null) - { - xpInfoBox.reset(); - } - } - - void updateSkillExperience(boolean updated, boolean paused, Skill skill, XpSnapshotSingle xpSnapshotSingle) - { - final XpInfoBox xpInfoBox = infoBoxes.get(skill); - - if (xpInfoBox != null) - { - xpInfoBox.update(updated, paused, xpSnapshotSingle); - } - } - - void updateTotal(XpSnapshotSingle xpSnapshotTotal) - { - // if player has gained exp and hasn't switched displays yet, hide error panel and show overall info - if (xpSnapshotTotal.getXpGainedInSession() > 0 && !overallPanel.isVisible()) - { - overallPanel.setVisible(true); - remove(errorPanel); - } - else if (xpSnapshotTotal.getXpGainedInSession() == 0 && overallPanel.isVisible()) - { - overallPanel.setVisible(false); - add(errorPanel); - } - - SwingUtilities.invokeLater(() -> rebuildAsync(xpSnapshotTotal)); - } - - private void rebuildAsync(XpSnapshotSingle xpSnapshotTotal) - { - overallExpGained.setText(XpInfoBox.htmlLabel("Gained: ", xpSnapshotTotal.getXpGainedInSession())); - overallExpHour.setText(XpInfoBox.htmlLabel("Per hour: ", xpSnapshotTotal.getXpPerHour())); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPauseState.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPauseState.java deleted file mode 100644 index 194c890c42..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPauseState.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2018, Levi - * 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.xptracker; - -import java.util.EnumMap; -import java.util.Map; -import net.runelite.api.Skill; - -class XpPauseState -{ - // Internal state - private final Map skillPauses = new EnumMap<>(Skill.class); - private boolean cachedIsLoggedIn = false; - - boolean pauseSkill(Skill skill) - { - return findPauseState(skill).manualPause(); - } - - boolean unpauseSkill(Skill skill) - { - return findPauseState(skill).unpause(); - } - - boolean isPaused(Skill skill) - { - return findPauseState(skill).isPaused(); - } - - void tickXp(Skill skill, long currentXp, int pauseAfterMinutes) - { - final XpPauseStateSingle state = findPauseState(skill); - - if (state.getXp() != currentXp) - { - state.xpChanged(currentXp); - } - else if (pauseAfterMinutes > 0) - { - final long now = System.currentTimeMillis(); - final int pauseAfterMillis = pauseAfterMinutes * 60 * 1000; - final long lastChangeMillis = state.getLastChangeMillis(); - // When config.pauseSkillAfter is 0, it is effectively disabled - if (lastChangeMillis != 0 && (now - lastChangeMillis) >= pauseAfterMillis) - { - state.timeout(); - } - } - } - - void tickLogout(boolean pauseOnLogout, boolean loggedIn) - { - // Deduplicated login and logout calls - if (!cachedIsLoggedIn && loggedIn) - { - cachedIsLoggedIn = true; - - for (Skill skill : Skill.values()) - { - findPauseState(skill).login(); - } - } - else if (cachedIsLoggedIn && !loggedIn) - { - cachedIsLoggedIn = false; - - // If configured, then let the pause state know to pause with reason: logout - if (pauseOnLogout) - { - for (Skill skill : Skill.values()) - { - findPauseState(skill).logout(); - } - } - } - } - - private XpPauseStateSingle findPauseState(Skill skill) - { - return skillPauses.computeIfAbsent(skill, XpPauseStateSingle::new); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPauseStateSingle.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPauseStateSingle.java deleted file mode 100644 index ce5750650e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpPauseStateSingle.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2018, Levi - * 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.xptracker; - -import java.util.EnumSet; -import java.util.Set; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.api.Skill; - -@RequiredArgsConstructor -class XpPauseStateSingle -{ - @Getter(AccessLevel.PACKAGE) - private final Skill skill; - private final Set pauseReasons = EnumSet.noneOf(XpPauseReason.class); - @Getter(AccessLevel.PACKAGE) - private long lastChangeMillis; - @Getter(AccessLevel.PACKAGE) - private long xp; - - boolean isPaused() - { - return !pauseReasons.isEmpty(); - } - - boolean login() - { - return pauseReasons.remove(XpPauseReason.PAUSED_LOGOUT); - } - - boolean logout() - { - return pauseReasons.add(XpPauseReason.PAUSED_LOGOUT); - } - - boolean timeout() - { - return pauseReasons.add(XpPauseReason.PAUSED_TIMEOUT); - } - - boolean manualPause() - { - return pauseReasons.add(XpPauseReason.PAUSE_MANUAL); - } - - boolean xpChanged(long xp) - { - this.xp = xp; - this.lastChangeMillis = System.currentTimeMillis(); - return clearAll(); - } - - boolean unpause() - { - this.lastChangeMillis = System.currentTimeMillis(); - return clearAll(); - } - - private boolean clearAll() - { - if (pauseReasons.isEmpty()) - { - return false; - } - - pauseReasons.clear(); - return true; - } - - private enum XpPauseReason - { - PAUSE_MANUAL, - PAUSED_LOGOUT, - PAUSED_TIMEOUT - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpSnapshotSingle.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpSnapshotSingle.java deleted file mode 100644 index bb7f8a5ef7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpSnapshotSingle.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2018, Levi - * 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.xptracker; - -import lombok.Builder; -import lombok.Value; - -@Builder -@Value -class XpSnapshotSingle -{ - private XpActionType actionType; - private int startLevel; - private int endLevel; - private int startGoalXp; - private int endGoalXp; - private int xpGainedInSession; - private int xpRemainingToGoal; - private int xpPerHour; - private double skillProgressToGoal; - private int actionsInSession; - private int actionsRemainingToGoal; - private int actionsPerHour; - private String timeTillGoal; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpState.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpState.java deleted file mode 100644 index 848724ef2f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpState.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (c) 2018, Levi - * 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.xptracker; - -import java.util.Arrays; -import java.util.EnumMap; -import java.util.Map; -import lombok.NonNull; -import net.runelite.api.NPC; -import net.runelite.api.Skill; - -/** - * Internal state for the XpTrackerPlugin - *

- * Note: This class's operations are not currently synchronized. - * It is intended to be called by the XpTrackerPlugin on the client thread. - */ -class XpState -{ - private static final double DEFAULT_XP_MODIFIER = 4.0; - private static final double SHARED_XP_MODIFIER = DEFAULT_XP_MODIFIER / 3.0; - private final Map xpSkills = new EnumMap<>(Skill.class); - private NPC interactedNPC; - - /** - * Destroys all internal state, however any XpSnapshotSingle or XpSnapshotTotal remain unaffected. - */ - void reset() - { - xpSkills.clear(); - } - - /** - * Resets a single skill - * - * @param skill Skill to reset - * @param currentXp Current XP to set to, if unknown set to -1 - */ - void resetSkill(Skill skill, long currentXp) - { - xpSkills.remove(skill); - xpSkills.put(skill, new XpStateSingle(skill, currentXp)); - } - - /** - * Updates a skill with the current known XP. - * When the result of this operation is XpUpdateResult.UPDATED, the UI should be updated accordingly. - * This is to distinguish events that reload all the skill's current values (such as world hopping) - * and also first-login when the skills are not initialized (the start XP will be -1 in this case). - * - * @param skill Skill to update - * @param currentXp Current known XP for this skill - * @param goalStartXp Possible XP start goal - * @param goalEndXp Possible XP end goal - * @return Whether or not the skill has been initialized, there was no change, or it has been updated - */ - XpUpdateResult updateSkill(Skill skill, long currentXp, int goalStartXp, int goalEndXp) - { - XpStateSingle state = getSkill(skill); - - if (state.getStartXp() == -1) - { - if (currentXp >= 0) - { - initializeSkill(skill, currentXp); - return XpUpdateResult.INITIALIZED; - } - else - { - return XpUpdateResult.NO_CHANGE; - } - } - else - { - long startXp = state.getStartXp(); - int gainedXp = state.getXpGained(); - - if (startXp + gainedXp > currentXp) - { - // Reinitialize with lesser currentXp, this can happen with negative xp lamps - initializeSkill(skill, currentXp); - return XpUpdateResult.INITIALIZED; - } - else - { - return state.update(currentXp, goalStartXp, goalEndXp) ? XpUpdateResult.UPDATED : XpUpdateResult.NO_CHANGE; - } - } - } - - private double getCombatXPModifier(Skill skill) - { - if (skill == Skill.HITPOINTS) - { - return SHARED_XP_MODIFIER; - } - - return DEFAULT_XP_MODIFIER; - } - - /** - * Updates skill with average actions based on currently interacted NPC. - * - * @param skill experience gained skill - * @param npc currently interacted NPC - * @param npcHealth health of currently interacted NPC - */ - void updateNpcExperience(Skill skill, NPC npc, int npcHealth) - { - if (npc == null || npc.getCombatLevel() <= 0 || npcHealth == -1) - { - return; - } - - final XpStateSingle state = getSkill(skill); - final int actionExp = (int) (npcHealth * getCombatXPModifier(skill)); - final XpAction action = state.getXpAction(XpActionType.ACTOR_HEALTH); - - if (action.isActionsHistoryInitialized()) - { - action.getActionExps()[action.getActionExpIndex()] = actionExp; - - if (interactedNPC != npc) - { - action.setActionExpIndex((action.getActionExpIndex() + 1) % action.getActionExps().length); - } - } - else - { - // So we have a decent average off the bat, lets populate all values with what we see. - Arrays.fill(action.getActionExps(), actionExp); - - action.setActionsHistoryInitialized(true); - } - - interactedNPC = npc; - state.setActionType(XpActionType.ACTOR_HEALTH); - } - - /** - * Update number of actions performed for skill (e.g amount of kills in this case) if last interacted - * NPC died - * - * @param skill skill to update actions for - * @param npc npc that just died - * @param npcHealth max health of npc that just died - * @return UPDATED in case new kill was successfully added - */ - XpUpdateResult updateNpcKills(Skill skill, NPC npc, int npcHealth) - { - XpStateSingle state = getSkill(skill); - - if (state.getXpGained() <= 0 || npcHealth == -1 || npc != interactedNPC) - { - return XpUpdateResult.NO_CHANGE; - } - - final XpAction xpAction = state.getXpAction(XpActionType.ACTOR_HEALTH); - xpAction.setActions(xpAction.getActions() + 1); - return xpAction.isActionsHistoryInitialized() ? XpUpdateResult.UPDATED : XpUpdateResult.NO_CHANGE; - } - - void tick(Skill skill, long delta) - { - getSkill(skill).tick(delta); - } - - /** - * Forcefully initialize a skill with a known start XP from the current XP. - * This is used in resetAndInitState by the plugin. It should not result in showing the XP in the UI. - * - * @param skill Skill to initialize - * @param currentXp Current known XP for the skill - */ - void initializeSkill(Skill skill, long currentXp) - { - xpSkills.put(skill, new XpStateSingle(skill, currentXp)); - } - - boolean isInitialized(Skill skill) - { - XpStateSingle xpStateSingle = xpSkills.get(skill); - return xpStateSingle != null && xpStateSingle.getStartXp() != -1; - } - - @NonNull - XpStateSingle getSkill(Skill skill) - { - return xpSkills.computeIfAbsent(skill, (s) -> new XpStateSingle(s, -1)); - } - - /** - * Obtain an immutable snapshot of the provided skill - * intended for use with the UI which operates on another thread - * - * @param skill Skill to obtain the snapshot for - * @return An immutable snapshot of the specified skill for this session since first login or last reset - */ - @NonNull - XpSnapshotSingle getSkillSnapshot(Skill skill) - { - return getSkill(skill).snapshot(); - } - - /** - * Obtain an immutable snapshot of the provided skill - * intended for use with the UI which operates on another thread - * - * @return An immutable snapshot of total information for this session since first login or last reset - */ - @NonNull - XpSnapshotSingle getTotalSnapshot() - { - return getSkill(Skill.OVERALL).snapshot(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpStateSingle.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpStateSingle.java deleted file mode 100644 index dfdba537a6..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpStateSingle.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (c) 2017, Cameron - * Copyright (c) 2018, Levi - * 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.xptracker; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Experience; -import net.runelite.api.Skill; - -@Slf4j -class XpStateSingle -{ - private final Skill skill; - private final Map actions = new HashMap<>(); - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private long startXp; - - @Getter(AccessLevel.PACKAGE) - private int xpGained = 0; - - @Setter - private XpActionType actionType = XpActionType.EXPERIENCE; - - private long skillTime = 0; - private int startLevelExp = 0; - private int endLevelExp = 0; - - XpStateSingle(Skill skill, long startXp) - { - this.skill = skill; - this.startXp = startXp; - } - - XpAction getXpAction(final XpActionType type) - { - actions.putIfAbsent(type, new XpAction()); - return actions.get(type); - } - - long getCurrentXp() - { - return startXp + xpGained; - } - - private int getActionsHr() - { - return toHourly(getXpAction(actionType).getActions()); - } - - private int toHourly(int value) - { - return (int) ((1.0 / (getTimeElapsedInSeconds() / 3600.0)) * value); - } - - private long getTimeElapsedInSeconds() - { - // If the skill started just now, we can divide by near zero, this results in odd behavior. - // To prevent that, pretend the skill has been active for a minute (60 seconds) - // This will create a lower estimate for the first minute, - // but it isn't ridiculous like saying 2 billion XP per hour. - return Math.max(60, skillTime / 1000); - } - - private int getXpRemaining() - { - return endLevelExp - (int) getCurrentXp(); - } - - private int getActionsRemaining() - { - final XpAction action = getXpAction(actionType); - - if (action.isActionsHistoryInitialized()) - { - long xpRemaining = getXpRemaining() * action.getActionExps().length; - long totalActionXp = 0; - - for (int actionXp : action.getActionExps()) - { - totalActionXp += actionXp; - } - - // Let's not divide by zero (or negative) - if (totalActionXp > 0) - { - // Make sure to account for the very last action at the end - long remainder = xpRemaining % totalActionXp; - long quotient = xpRemaining / totalActionXp; - return Math.toIntExact(quotient + (remainder > 0 ? 1 : 0)); - } - } - - return Integer.MAX_VALUE; - } - - private double getSkillProgress() - { - double xpGained = getCurrentXp() - startLevelExp; - double xpGoal = endLevelExp - startLevelExp; - return (xpGained / xpGoal) * 100; - } - - private String getTimeTillLevel() - { - long seconds = getTimeElapsedInSeconds(); - - if (seconds <= 0 || xpGained <= 0) - { - // Infinity symbol - return "\u221e"; - } - - // formula is xpRemaining / xpPerSecond - // xpPerSecond being xpGained / seconds - // This can be simplified so division is only done once and we can work in whole numbers! - long remainingSeconds = (getXpRemaining() * seconds) / xpGained; - - // Java 8 doesn't have good duration / period objects to represent spans of time that can be formatted - // Rather than importing another dependency like joda time (which is practically built into java 10) - // below will be a custom formatter that handles spans larger than 1 day - - long durationDays = remainingSeconds / (24 * 60 * 60); - long durationHours = (remainingSeconds % (24 * 60 * 60)) / (60 * 60); - long durationMinutes = (remainingSeconds % (60 * 60)) / 60; - long durationSeconds = remainingSeconds % 60; - - if (durationDays > 1) - { - return String.format("%d days %02d:%02d:%02d", durationDays, durationHours, durationMinutes, durationSeconds); - } - else if (durationDays == 1) - { - return String.format("1 day %02d:%02d:%02d", durationHours, durationMinutes, durationSeconds); - } - else if (durationHours > 0) - { - return String.format("%02d:%02d:%02d", durationHours, durationMinutes, durationSeconds); - } - - // Minutes and seconds will always be present - return String.format("%02d:%02d", durationMinutes, durationSeconds); - } - - - private int getXpHr() - { - return toHourly(xpGained); - } - - boolean update(long currentXp, int goalStartXp, int goalEndXp) - { - if (startXp == -1) - { - log.warn("Attempted to update skill state " + skill + " but was not initialized with current xp"); - return false; - } - - long originalXp = xpGained + startXp; - int actionExp = (int) (currentXp - originalXp); - - // No experience gained - if (actionExp == 0) - { - return false; - } - - // Update EXPERIENCE action - final XpAction action = getXpAction(XpActionType.EXPERIENCE); - - if (action.isActionsHistoryInitialized()) - { - action.getActionExps()[action.getActionExpIndex()] = actionExp; - } - else - { - // populate all values in our action history array with this first value that we see - // so the average value of our action history starts out as this first value we see - Arrays.fill(action.getActionExps(), actionExp); - - action.setActionsHistoryInitialized(true); - } - - action.setActionExpIndex((action.getActionExpIndex() + 1) % action.getActionExps().length); - action.setActions(action.getActions() + 1); - - // Calculate experience gained - xpGained = (int) (currentXp - startXp); - - // Determine XP goals, overall has no goals - if (skill != Skill.OVERALL) - { - if (goalStartXp < 0 || currentXp > goalEndXp) - { - startLevelExp = Experience.getXpForLevel(Experience.getLevelForXp((int) currentXp)); - } - else - { - startLevelExp = goalStartXp; - } - - if (goalEndXp <= 0 || currentXp > goalEndXp) - { - int currentLevel = Experience.getLevelForXp((int) currentXp); - endLevelExp = currentLevel + 1 <= Experience.MAX_VIRT_LEVEL - ? Experience.getXpForLevel(currentLevel + 1) - : Experience.MAX_SKILL_XP; - } - else - { - endLevelExp = goalEndXp; - } - } - - return true; - } - - public void tick(long delta) - { - // Don't tick skills that have not gained XP or have been reset. - if (xpGained <= 0) - { - return; - } - skillTime += delta; - } - - XpSnapshotSingle snapshot() - { - return XpSnapshotSingle.builder() - .startLevel(Experience.getLevelForXp(startLevelExp)) - .endLevel(Experience.getLevelForXp(endLevelExp)) - .xpGainedInSession(xpGained) - .xpRemainingToGoal(getXpRemaining()) - .xpPerHour(getXpHr()) - .skillProgressToGoal(getSkillProgress()) - .actionType(actionType) - .actionsInSession(getXpAction(actionType).getActions()) - .actionsRemainingToGoal(getActionsRemaining()) - .actionsPerHour(getActionsHr()) - .timeTillGoal(getTimeTillLevel()) - .startGoalXp(startLevelExp) - .endGoalXp(endLevelExp) - .build(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerConfig.java deleted file mode 100644 index 9f4cedef32..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerConfig.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2018, Levi - * 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.xptracker; - -import lombok.AllArgsConstructor; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("xpTracker") -public interface XpTrackerConfig extends Config -{ - @AllArgsConstructor - enum OnScreenDisplayMode - { - XP_GAINED, - XP_LEFT, - ACTIONS_DONE, - ACTIONS_LEFT - } - - @AllArgsConstructor - enum OnScreenDisplayModeBottom - { - XP_HOUR, - ACTIONS_HOUR, - } - - @ConfigItem( - position = 0, - keyName = "hideMaxed", - name = "Hide maxed skills", - description = "Stop globes from showing up for level 99 skills " - ) - default boolean hideMaxed() - { - return false; - } - - @ConfigItem( - position = 1, - keyName = "logoutPausing", - name = "Pause on Logout", - description = "Configures whether skills should pause on logout" - ) - default boolean pauseOnLogout() - { - return false; - } - - @ConfigItem( - position = 2, - keyName = "intermediateLevelMarkers", - name = "Show intermediate level markers", - description = "Marks intermediate levels on the progressbar" - ) - default boolean showIntermediateLevels() - { - return false; - } - - @ConfigItem( - position = 3, - keyName = "pauseSkillAfter", - name = "Auto pause after", - description = "Configures how many minutes passes before pausing a skill while in game and there's no XP, 0 means disabled" - ) - default int pauseSkillAfter() - { - return 0; - } - - @ConfigItem( - position = 4, - keyName = "skillTabOverlayMenuOptions", - name = "Add skill tab canvas menu option", - description = "Configures whether a menu option to show/hide canvas XP trackers will be added to skills on the skill tab" - ) - default boolean skillTabOverlayMenuOptions() - { - return true; - } - - @ConfigItem( - position = 5, - keyName = "onScreenDisplayMode", - name = "On-screen tracker display mode (top)", - description = "Configures the information displayed in the first line of on-screen XP overlays" - ) - default OnScreenDisplayMode onScreenDisplayMode() - { - return OnScreenDisplayMode.XP_GAINED; - } - - @ConfigItem( - position = 6, - keyName = "onScreenDisplayModeBottom", - name = "On-screen tracker display mode (bottom)", - description = "Configures the information displayed in the second line of on-screen XP overlays" - ) - default OnScreenDisplayModeBottom onScreenDisplayModeBottom() - { - return OnScreenDisplayModeBottom.XP_HOUR; - } -} 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 deleted file mode 100644 index e31c30fef0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java +++ /dev/null @@ -1,773 +0,0 @@ -/* - * Copyright (c) 2017, Cameron - * Copyright (c) 2018, Levi - * 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.xptracker; - -import com.google.common.annotations.VisibleForTesting; -import static com.google.common.base.MoreObjects.firstNonNull; -import com.google.common.collect.ImmutableList; -import com.google.inject.Binder; -import com.google.inject.Provides; -import java.awt.image.BufferedImage; -import java.time.temporal.ChronoUnit; -import java.util.Arrays; -import java.util.EnumSet; -import java.util.List; -import java.util.Objects; -import javax.inject.Inject; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Actor; -import net.runelite.api.Client; -import net.runelite.api.Experience; -import net.runelite.api.GameState; -import net.runelite.api.MenuEntry; -import net.runelite.api.MenuOpcode; -import net.runelite.api.NPC; -import net.runelite.api.Player; -import net.runelite.api.Skill; -import net.runelite.api.VarPlayer; -import net.runelite.api.WorldType; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.MenuEntryAdded; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.StatChanged; -import net.runelite.api.util.Text; -import net.runelite.api.widgets.WidgetID; -import static net.runelite.api.widgets.WidgetInfo.TO_GROUP; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.game.NPCManager; -import net.runelite.client.game.SkillIconManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import static net.runelite.client.plugins.xptracker.XpWorldType.NORMAL; -import net.runelite.client.task.Schedule; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.NavigationButton; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.util.ImageUtil; -import net.runelite.http.api.xp.XpClient; - -@PluginDescriptor( - name = "XP Tracker", - description = "Enable the XP Tracker panel", - tags = {"experience", "levels", "panel"}, - type = PluginType.UTILITY -) -@Slf4j -public class XpTrackerPlugin extends Plugin -{ - /** - * Amount of EXP that must be gained for an update to be submitted. - */ - private static final int XP_THRESHOLD = 10_000; - - private static final String MENUOP_ADD_CANVAS_TRACKER = "Add to canvas"; - private static final String MENUOP_REMOVE_CANVAS_TRACKER = "Remove from canvas"; - - private static final List COMBAT = ImmutableList.of( - Skill.ATTACK, - Skill.STRENGTH, - Skill.DEFENCE, - Skill.RANGED, - Skill.HITPOINTS, - Skill.MAGIC); - - @Inject - private ClientToolbar clientToolbar; - - @Inject - private Client client; - - @Inject - private SkillIconManager skillIconManager; - - @Inject - private XpTrackerConfig xpTrackerConfig; - - @Inject - private NPCManager npcManager; - - @Inject - private OverlayManager overlayManager; - - private NavigationButton navButton; - @Setter(AccessLevel.PACKAGE) - @VisibleForTesting - private XpPanel xpPanel; - private XpWorldType lastWorldType; - private String lastUsername; - private long lastTickMillis = 0; - private boolean fetchXp; // fetch lastXp for the online xp tracker - private long lastXp = 0; - private boolean initializeTracker; - - private final XpClient xpClient = new XpClient(); - private final XpState xpState = new XpState(); - private final XpPauseState xpPauseState = new XpPauseState(); - - private boolean hideMaxed; - private boolean pauseOnLogout; - @Getter(AccessLevel.PACKAGE) - private boolean showIntermediateLevels; - private int pauseSkillAfter; - @Getter(AccessLevel.PACKAGE) - private XpTrackerConfig.OnScreenDisplayMode onScreenDisplayMode; - @Getter(AccessLevel.PACKAGE) - private XpTrackerConfig.OnScreenDisplayModeBottom onScreenDisplayModeBottom; - - @Provides - XpTrackerConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(XpTrackerConfig.class); - } - - @Override - public void configure(Binder binder) - { - binder.bind(XpTrackerService.class).to(XpTrackerServiceImpl.class); - } - - @Override - protected void startUp() - { - updateConfig(); - - xpPanel = new XpPanel(this, client, skillIconManager); - - final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "/skill_icons/overall.png"); - - navButton = NavigationButton.builder() - .tooltip("XP Tracker") - .icon(icon) - .priority(2) - .panel(xpPanel) - .build(); - - clientToolbar.addNavigation(navButton); - - // Initialize the tracker & last xp if already logged in - fetchXp = true; - initializeTracker = true; - } - - @Override - protected void shutDown() - { - overlayManager.removeIf(e -> e instanceof XpInfoBoxOverlay); - xpState.reset(); - clientToolbar.removeNavigation(navButton); - } - - @Subscribe - void onGameStateChanged(GameStateChanged event) - { - GameState state = event.getGameState(); - if (state == GameState.LOGGED_IN) - { - // LOGGED_IN is triggered between region changes too. - // Check that the username changed or the world type changed. - XpWorldType type = worldSetToType(client.getWorldType()); - - if (!Objects.equals(client.getUsername(), lastUsername) || lastWorldType != type) - { - // Reset - log.debug("World change: {} -> {}, {} -> {}", - lastUsername, client.getUsername(), - firstNonNull(lastWorldType, ""), - firstNonNull(type, "")); - - lastUsername = client.getUsername(); - // xp is not available until after login is finished, so fetch it on the next gametick - fetchXp = true; - lastWorldType = type; - resetState(); - // Must be set from hitting the LOGGING_IN or HOPPING case below - assert initializeTracker; - } - } - else if (state == GameState.LOGGING_IN || state == GameState.HOPPING) - { - initializeTracker = true; - } - else if (state == GameState.LOGIN_SCREEN) - { - Player local = client.getLocalPlayer(); - if (local == null) - { - return; - } - - String username = local.getName(); - if (username == null) - { - return; - } - - long totalXp = client.getOverallExperience(); - // Don't submit xptrack unless xp threshold is reached - if (Math.abs(totalXp - lastXp) > XP_THRESHOLD) - { - xpClient.update(username); - lastXp = totalXp; - } - } - } - - private XpWorldType worldSetToType(EnumSet types) - { - XpWorldType xpType = NORMAL; - for (WorldType type : types) - { - XpWorldType t = XpWorldType.of(type); - if (t != NORMAL) - { - xpType = t; - } - } - return xpType; - } - - /** - * Adds an overlay to the canvas for tracking a specific skill. - * - * @param skill the skill for which the overlay should be added - */ - void addOverlay(Skill skill) - { - removeOverlay(skill); - overlayManager.add(new XpInfoBoxOverlay(this, skill, skillIconManager.getSkillImage(skill))); - } - - /** - * Removes an overlay from the overlayManager if it's present. - * - * @param skill the skill for which the overlay should be removed. - */ - void removeOverlay(Skill skill) - { - overlayManager.removeIf(e -> e instanceof XpInfoBoxOverlay && ((XpInfoBoxOverlay) e).getSkill() == skill); - } - - /** - * Check if there is an overlay on the canvas for the skill. - * - * @param skill the skill which should have an overlay. - * @return true if the skill has an overlay. - */ - boolean hasOverlay(final Skill skill) - { - return overlayManager.anyMatch(o -> o instanceof XpInfoBoxOverlay && ((XpInfoBoxOverlay) o).getSkill() == skill); - } - - /** - * Reset internal state and re-initialize all skills with XP currently cached by the RS client - * This is called by the user manually clicking resetSkillState in the UI. - * It reloads the current skills from the client after resetting internal state. - */ - void resetAndInitState() - { - resetState(); - - for (Skill skill : Skill.values()) - { - long currentXp; - if (skill == Skill.OVERALL) - { - currentXp = client.getOverallExperience(); - } - else - { - currentXp = client.getSkillExperience(skill); - } - - xpState.initializeSkill(skill, currentXp); - removeOverlay(skill); - } - } - - /** - * Throw out everything, the user has chosen a different account or world type. - * This resets both the internal state and UI elements - */ - private void resetState() - { - xpState.reset(); - xpPanel.resetAllInfoBoxes(); - xpPanel.updateTotal(new XpSnapshotSingle.XpSnapshotSingleBuilder().build()); - overlayManager.removeIf(e -> e instanceof XpInfoBoxOverlay); - } - - /** - * Reset an individual skill with the client's current known state of the skill - * Will also clear the skill from the UI. - * - * @param skill Skill to reset - */ - void resetSkillState(Skill skill) - { - int currentXp = client.getSkillExperience(skill); - xpState.resetSkill(skill, currentXp); - xpPanel.resetSkill(skill); - removeOverlay(skill); - } - - /** - * Reset all skills except for the one provided - * - * @param skill Skill to ignore during reset - */ - void resetOtherSkillState(Skill skill) - { - for (Skill s : Skill.values()) - { - // Overall is not reset from resetting individual skills - if (skill != s && s != Skill.OVERALL) - { - resetSkillState(s); - } - } - } - - @Subscribe - void onStatChanged(StatChanged statChanged) - { - final Skill skill = statChanged.getSkill(); - final int currentXp = statChanged.getXp(); - final int currentLevel = statChanged.getLevel(); - final VarPlayer startGoal = startGoalVarpForSkill(skill); - final VarPlayer endGoal = endGoalVarpForSkill(skill); - final int startGoalXp = startGoal != null ? client.getVar(startGoal) : -1; - final int endGoalXp = endGoal != null ? client.getVar(endGoal) : -1; - - if (initializeTracker) - { - // This is the XP sync on login, wait until after login to begin counting - return; - } - - if (this.hideMaxed && currentLevel >= Experience.MAX_REAL_LEVEL) - { - return; - } - - final XpStateSingle state = xpState.getSkill(skill); - state.setActionType(XpActionType.EXPERIENCE); - - final Actor interacting = client.getLocalPlayer().getInteracting(); - if (interacting instanceof NPC && COMBAT.contains(skill)) - { - final NPC npc = (NPC) interacting; - xpState.updateNpcExperience(skill, npc, npcManager.getHealth(npc.getId())); - } - - final XpUpdateResult updateResult = xpState.updateSkill(skill, currentXp, startGoalXp, endGoalXp); - xpPanel.updateSkillExperience(updateResult == XpUpdateResult.UPDATED, xpPauseState.isPaused(skill), skill, xpState.getSkillSnapshot(skill)); - - // Also update the total experience - xpState.updateSkill(Skill.OVERALL, client.getOverallExperience(), -1, -1); - xpPanel.updateTotal(xpState.getTotalSnapshot()); - } - - @Subscribe - private void onNpcDespawned(NpcDespawned event) - { - final NPC npc = event.getNpc(); - - if (!npc.isDead()) - { - return; - } - - for (Skill skill : COMBAT) - { - 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)); - } - - xpPanel.updateTotal(xpState.getTotalSnapshot()); - } - - @Subscribe - void onGameTick(GameTick event) - { - if (initializeTracker) - { - initializeTracker = false; - - // Check for xp gained while logged out - for (Skill skill : Skill.values()) - { - if (skill == Skill.OVERALL || !xpState.isInitialized(skill)) - { - continue; - } - - XpStateSingle skillState = xpState.getSkill(skill); - final int currentXp = client.getSkillExperience(skill); - if (skillState.getCurrentXp() != currentXp) - { - if (currentXp < skillState.getCurrentXp()) - { - log.debug("Xp is going backwards! {} {} -> {}", skill, skillState.getCurrentXp(), currentXp); - resetState(); - break; - } - - log.debug("Skill xp for {} changed when offline: {} -> {}", skill, skillState.getCurrentXp(), currentXp); - // Offset start xp for offline gains - long diff = currentXp - skillState.getCurrentXp(); - skillState.setStartXp(skillState.getStartXp() + diff); - } - } - - // Initialize the tracker with the initial xp if not already initialized - for (Skill skill : Skill.values()) - { - if (skill == Skill.OVERALL) - { - continue; - } - - if (!xpState.isInitialized(skill)) - { - final int currentXp = client.getSkillExperience(skill); - // goal exps are not necessary for skill initialization - XpUpdateResult xpUpdateResult = xpState.updateSkill(skill, currentXp, -1, -1); - assert xpUpdateResult == XpUpdateResult.INITIALIZED; - } - } - - // Initialize the overall xp - if (!xpState.isInitialized(Skill.OVERALL)) - { - long overallXp = client.getOverallExperience(); - log.debug("Initializing XP tracker with {} overall exp", overallXp); - xpState.initializeSkill(Skill.OVERALL, overallXp); - } - } - - if (fetchXp) - { - lastXp = client.getOverallExperience(); - fetchXp = false; - } - - rebuildSkills(); - } - - @Subscribe - private void onMenuEntryAdded(final MenuEntryAdded event) - { - int widgetID = event.getParam1(); - - if (TO_GROUP(widgetID) != WidgetID.SKILLS_GROUP_ID - || !event.getOption().startsWith("View") - || !xpTrackerConfig.skillTabOverlayMenuOptions()) - { - return; - } - - // Get skill from menu option, eg. "View Attack guide" - final String skillText = event.getOption().split(" ")[1]; - final Skill skill = Skill.valueOf(Text.removeTags(skillText).toUpperCase()); - - MenuEntry[] menuEntries = client.getMenuEntries(); - menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1); - - MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry(); - menuEntry.setTarget(skillText); - menuEntry.setOption(hasOverlay(skill) ? MENUOP_REMOVE_CANVAS_TRACKER : MENUOP_ADD_CANVAS_TRACKER); - menuEntry.setParam0(event.getParam0()); - menuEntry.setParam1(widgetID); - menuEntry.setOpcode(MenuOpcode.RUNELITE.getId()); - - client.setMenuEntries(menuEntries); - } - - @Subscribe - private void onMenuOptionClicked(MenuOptionClicked event) - { - if (event.getMenuOpcode().getId() != MenuOpcode.RUNELITE.getId() - || TO_GROUP(event.getParam1()) != WidgetID.SKILLS_GROUP_ID) - { - return; - } - - final Skill skill; - try - { - skill = Skill.valueOf(Text.removeTags(event.getTarget()).toUpperCase()); - } - catch (IllegalArgumentException ex) - { - log.debug(null, ex); - return; - } - - switch (event.getOption()) - { - case MENUOP_ADD_CANVAS_TRACKER: - addOverlay(skill); - break; - case MENUOP_REMOVE_CANVAS_TRACKER: - removeOverlay(skill); - break; - } - } - - XpStateSingle getSkillState(Skill skill) - { - return xpState.getSkill(skill); - } - - XpSnapshotSingle getSkillSnapshot(Skill skill) - { - return xpState.getSkillSnapshot(skill); - } - - private static VarPlayer startGoalVarpForSkill(final Skill skill) - { - switch (skill) - { - case ATTACK: - return VarPlayer.ATTACK_GOAL_START; - case MINING: - return VarPlayer.MINING_GOAL_START; - case WOODCUTTING: - return VarPlayer.WOODCUTTING_GOAL_START; - case DEFENCE: - return VarPlayer.DEFENCE_GOAL_START; - case MAGIC: - return VarPlayer.MAGIC_GOAL_START; - case RANGED: - return VarPlayer.RANGED_GOAL_START; - case HITPOINTS: - return VarPlayer.HITPOINTS_GOAL_START; - case AGILITY: - return VarPlayer.AGILITY_GOAL_START; - case STRENGTH: - return VarPlayer.STRENGTH_GOAL_START; - case PRAYER: - return VarPlayer.PRAYER_GOAL_START; - case SLAYER: - return VarPlayer.SLAYER_GOAL_START; - case FISHING: - return VarPlayer.FISHING_GOAL_START; - case RUNECRAFT: - return VarPlayer.RUNECRAFT_GOAL_START; - case HERBLORE: - return VarPlayer.HERBLORE_GOAL_START; - case FIREMAKING: - return VarPlayer.FIREMAKING_GOAL_START; - case CONSTRUCTION: - return VarPlayer.CONSTRUCTION_GOAL_START; - case HUNTER: - return VarPlayer.HUNTER_GOAL_START; - case COOKING: - return VarPlayer.COOKING_GOAL_START; - case FARMING: - return VarPlayer.FARMING_GOAL_START; - case CRAFTING: - return VarPlayer.CRAFTING_GOAL_START; - case SMITHING: - return VarPlayer.SMITHING_GOAL_START; - case THIEVING: - return VarPlayer.THIEVING_GOAL_START; - case FLETCHING: - return VarPlayer.FLETCHING_GOAL_START; - default: - return null; - } - } - - private static VarPlayer endGoalVarpForSkill(final Skill skill) - { - switch (skill) - { - case ATTACK: - return VarPlayer.ATTACK_GOAL_END; - case MINING: - return VarPlayer.MINING_GOAL_END; - case WOODCUTTING: - return VarPlayer.WOODCUTTING_GOAL_END; - case DEFENCE: - return VarPlayer.DEFENCE_GOAL_END; - case MAGIC: - return VarPlayer.MAGIC_GOAL_END; - case RANGED: - return VarPlayer.RANGED_GOAL_END; - case HITPOINTS: - return VarPlayer.HITPOINTS_GOAL_END; - case AGILITY: - return VarPlayer.AGILITY_GOAL_END; - case STRENGTH: - return VarPlayer.STRENGTH_GOAL_END; - case PRAYER: - return VarPlayer.PRAYER_GOAL_END; - case SLAYER: - return VarPlayer.SLAYER_GOAL_END; - case FISHING: - return VarPlayer.FISHING_GOAL_END; - case RUNECRAFT: - return VarPlayer.RUNECRAFT_GOAL_END; - case HERBLORE: - return VarPlayer.HERBLORE_GOAL_END; - case FIREMAKING: - return VarPlayer.FIREMAKING_GOAL_END; - case CONSTRUCTION: - return VarPlayer.CONSTRUCTION_GOAL_END; - case HUNTER: - return VarPlayer.HUNTER_GOAL_END; - case COOKING: - return VarPlayer.COOKING_GOAL_END; - case FARMING: - return VarPlayer.FARMING_GOAL_END; - case CRAFTING: - return VarPlayer.CRAFTING_GOAL_END; - case SMITHING: - return VarPlayer.SMITHING_GOAL_END; - case THIEVING: - return VarPlayer.THIEVING_GOAL_END; - case FLETCHING: - return VarPlayer.FLETCHING_GOAL_END; - default: - return null; - } - } - - @Schedule( - period = 1, - unit = ChronoUnit.SECONDS - ) - public void tickSkillTimes() - { - // Adjust unpause states - for (Skill skill : Skill.values()) - { - long skillExperience; - if (skill == Skill.OVERALL) - { - skillExperience = client.getOverallExperience(); - } - else - { - skillExperience = client.getSkillExperience(skill); - } - - xpPauseState.tickXp(skill, skillExperience, this.pauseSkillAfter); - } - - final boolean loggedIn; - switch (client.getGameState()) - { - case LOGIN_SCREEN: - case LOGGING_IN: - case LOGIN_SCREEN_AUTHENTICATOR: - loggedIn = false; - break; - default: - loggedIn = true; - break; - } - xpPauseState.tickLogout(this.pauseOnLogout, loggedIn); - - if (lastTickMillis == 0) - { - lastTickMillis = System.currentTimeMillis(); - return; - } - - final long nowMillis = System.currentTimeMillis(); - final long tickDelta = nowMillis - lastTickMillis; - lastTickMillis = nowMillis; - - for (Skill skill : Skill.values()) - { - if (!xpPauseState.isPaused(skill)) - { - xpState.tick(skill, tickDelta); - } - } - - rebuildSkills(); - } - - private void rebuildSkills() - { - // Rebuild calculated values like xp/hr in panel - for (Skill skill : Skill.values()) - { - xpPanel.updateSkillExperience(false, xpPauseState.isPaused(skill), skill, xpState.getSkillSnapshot(skill)); - } - - xpPanel.updateTotal(xpState.getTotalSnapshot()); - } - - void pauseSkill(Skill skill, boolean pause) - { - if (pause ? xpPauseState.pauseSkill(skill) : xpPauseState.unpauseSkill(skill)) - { - xpPanel.updateSkillExperience(false, xpPauseState.isPaused(skill), skill, xpState.getSkillSnapshot(skill)); - } - } - - void pauseAllSkills(boolean pause) - { - for (Skill skill : Skill.values()) - { - pauseSkill(skill, pause); - } - } - - @Subscribe - private void onConfigChanged(ConfigChanged event) - { - if (!event.getGroup().equals("xpTracker")) - { - return; - } - - updateConfig(); - } - - private void updateConfig() - { - this.hideMaxed = xpTrackerConfig.hideMaxed(); - this.pauseOnLogout = xpTrackerConfig.pauseOnLogout(); - this.showIntermediateLevels = xpTrackerConfig.showIntermediateLevels(); - this.pauseSkillAfter = xpTrackerConfig.pauseSkillAfter(); - this.onScreenDisplayMode = xpTrackerConfig.onScreenDisplayMode(); - this.onScreenDisplayModeBottom = xpTrackerConfig.onScreenDisplayModeBottom(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerService.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerService.java deleted file mode 100644 index 9d8c248b50..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerService.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2018, 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.xptracker; - -import net.runelite.api.Skill; - -public interface XpTrackerService -{ - /** - * Get the number of actions done - */ - int getActions(Skill skill); - - /** - * Get the number of actions per hour - */ - int getActionsHr(Skill skill); - - /** - * Get the number of actions remaining - */ - int getActionsLeft(Skill skill); - - /** - * Get the action type - */ - XpActionType getActionType(Skill skill); - - /** - * Get the amount of xp per hour - */ - int getXpHr(Skill skill); - - /** - * Get the start goal XP - */ - int getStartGoalXp(Skill skill); - - /** - * Get the amount of XP left until goal level - */ - int getEndGoalXp(Skill skill); - - /** - * Get the amount of time left until goal level - */ - String getTimeTillGoal(Skill skill); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerServiceImpl.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerServiceImpl.java deleted file mode 100644 index 0c31b85ba2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerServiceImpl.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2018, 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.xptracker; - -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.api.Skill; - -@Singleton -class XpTrackerServiceImpl implements XpTrackerService -{ - private final XpTrackerPlugin plugin; - - @Inject - XpTrackerServiceImpl(XpTrackerPlugin plugin) - { - this.plugin = plugin; - } - - @Override - public int getActions(Skill skill) - { - return plugin.getSkillSnapshot(skill).getActionsInSession(); - } - - @Override - public int getActionsHr(Skill skill) - { - return plugin.getSkillSnapshot(skill).getActionsPerHour(); - } - - @Override - public int getActionsLeft(Skill skill) - { - return plugin.getSkillSnapshot(skill).getActionsRemainingToGoal(); - } - - @Override - public XpActionType getActionType(Skill skill) - { - return plugin.getSkillSnapshot(skill).getActionType(); - } - - @Override - public int getXpHr(Skill skill) - { - return plugin.getSkillSnapshot(skill).getXpPerHour(); - } - - @Override - public int getStartGoalXp(Skill skill) - { - return plugin.getSkillSnapshot(skill).getStartGoalXp(); - } - - @Override - public int getEndGoalXp(Skill skill) - { - return plugin.getSkillSnapshot(skill).getEndGoalXp(); - } - - @Override - public String getTimeTillGoal(Skill skill) - { - return plugin.getSkillSnapshot(skill).getTimeTillGoal(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpUpdateResult.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpUpdateResult.java deleted file mode 100644 index fde5e08470..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpUpdateResult.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2018, Levi - * 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.xptracker; - -enum XpUpdateResult -{ - NO_CHANGE, - INITIALIZED, - UPDATED, -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpWorldType.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpWorldType.java deleted file mode 100644 index b998a2f8b0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpWorldType.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2018, 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.xptracker; - -import net.runelite.api.WorldType; - -enum XpWorldType -{ - NORMAL, - TOURNEY, - DMM, - LEAGUE; - - static XpWorldType of(WorldType type) - { - switch (type) - { - case TOURNAMENT: - return TOURNEY; - case DEADMAN: - return DMM; - case LEAGUE: - return LEAGUE; - default: - return NORMAL; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xtea/XteaPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/xtea/XteaPlugin.java deleted file mode 100644 index a9e04be440..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xtea/XteaPlugin.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2017, 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.xtea; - -import java.io.IOException; -import java.util.HashMap; -import javax.inject.Inject; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.events.GameStateChanged; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.http.api.xtea.XteaClient; - -@PluginDescriptor( - name = "Xtea", - hidden = true -) -@Slf4j -public class XteaPlugin extends Plugin -{ - private final XteaClient xteaClient = new XteaClient(); - - private HashMap xteas; - { - try - { - xteas = xteaClient.get(); - } - catch (IOException e) - { - e.printStackTrace(); - } - } - - @Inject - private Client client; - - @Subscribe - private void onGameStateChanged(GameStateChanged gameStateChanged) - { - if (gameStateChanged.getGameState() != GameState.LOGGED_IN) - { - return; - } - - int[] regions = client.getMapRegions(); - int[][] xteaKeys = client.getXteaKeys(); - - for (int idx = 0; idx < regions.length; ++idx) - { - int region = regions[idx]; - int[] keys = xteaKeys[idx]; - - if (xteas.get(region) != null) - { - continue; - } - - xteas.put(region, keys); - - log.debug("Region {} keys {}, {}, {}, {}", region, keys[0], keys[1], keys[2], keys[3]); - - //Don't post non encrypted regions - if (keys[0] == 0 && keys[1] == 0 && keys[2] == 0 && keys[3] == 0) - { - continue; - } - - xteaClient.submit(region, keys); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/Step.java b/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/Step.java deleted file mode 100644 index 91b1103607..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/Step.java +++ /dev/null @@ -1,11 +0,0 @@ -package net.runelite.client.plugins.zalcano; - -enum Step -{ - IDLE, - MINE, - SMELT, - RUNECRAFT, - THROW, - MINE_ZALCANO -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoConfig.java deleted file mode 100644 index aa011828a0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoConfig.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * - * * 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.zalcano; - -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.ConfigTitleSection; -import net.runelite.client.config.Title; - -@ConfigGroup("zalcano") -public interface ZalcanoConfig extends Config -{ - - @ConfigTitleSection( - keyName = "zalcanoTitle", - name = "Zalcano", - description = "", - position = 0 - ) - default Title zalcanoTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "highlightZalcanoHull", - name = "Highlight Zalcano", - description = "Highlight Zalcano\'s convex hull.", - titleSection = "zalcanoTitle", - position = 1 - ) - default boolean highlightZalcanoHull() - { - return false; - } - - @ConfigItem( - keyName = "zalcanoHullColor", - name = "Color for highlight", - description = "", - titleSection = "zalcanoTitle", - position = 2 - ) - default Color zalcanoHullColor() - { - return new Color(255, 25, 0); - } - - @ConfigTitleSection( - keyName = "zalcanoAoesTitle", - name = "Area of Effect", - description = "", - position = 3 - ) - default Title zalcanoAoesTitle() - { - return new Title(); - } - - @ConfigItem( - keyName = "showAoeZalcanoWakeup", - name = "Zalcano Wakeup", - description = "Shows an AOE warning for Zalcano waking back up.", - titleSection = "zalcanoAoesTitle", - position = 4 - ) - default boolean showAoeZalcanoWakeup() - { - return true; - } - - @ConfigItem( - keyName = "showAoeForRockfall", - name = "Small Rocks", - description = "Shows an AOE warning for the rocks that fall occasionally.", - titleSection = "zalcanoAoesTitle", - position = 5 - ) - default boolean showAoeForRockfall() - { - return true; - } - - @ConfigItem( - keyName = "showAoeForRedSymbols", - name = "Red Symbols", - description = "Shows an AOE warning for the 3x3 red symbols that appear.", - titleSection = "zalcanoAoesTitle", - position = 6 - ) - default boolean showAoeForRedSymbols() - { - return true; - } - - @ConfigItem( - keyName = "highlightMiningSpot", - name = "Mining spot", - description = "Highlights the glowing rock and warns you if Zalcano attacks it.", - titleSection = "zalcanoAoesTitle", - position = 7 - ) - default boolean highlightMiningSpot() - { - return true; - } - - @ConfigTitleSection( - keyName = "helperTitle", - name = "Helpers", - description = "", - position = 8 - ) - default Title helperTitle() - { - return new Title(); - } - - /** - * TODO: improve helper - */ - @ConfigItem( - keyName = "showSteps", - name = "Show Step", - description = "", - titleSection = "helperTitle", - position = 9, - hidden = true //hidden until fully functional - ) - default boolean showSteps() - { - return false; - } - - @ConfigItem( - keyName = "showAoeZalcanoMineable", - name = "Zalcano Mineable", - description = "Highlights Zalcano if she is mineable.", - titleSection = "helperTitle", - position = 10 - ) - default boolean showAoeZalcanoMineable() - { - return true; - } - - @ConfigItem( - keyName = "highlightGolem", - name = "Highlight Golem", - description = "Highlights the Golem that Zalcano spawns in.", - titleSection = "helperTitle", - position = 11 - ) - default boolean highlightGolem() - { - return true; - } - - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoOverlay.java deleted file mode 100644 index 2a3478279b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoOverlay.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * - * * 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.zalcano; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.Shape; -import java.util.List; -import javax.inject.Inject; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.AnimationID; -import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.GraphicsObject; -import net.runelite.api.Perspective; -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.OverlayPriority; -import net.runelite.client.ui.overlay.OverlayUtil; - -/** - * some ids - * 9049 = zalcano npc id 8439 wakeup animation 8437 mineable stage - * 1727 = rocks falling graphics object id - * 1728 = red projectile flying into rock - *

- * 36192 + anim 8448 = glowing rock - *

- * 36199 red circle - * 36200 blue circle - *

- * golem id = 9051 - *

- * 23905, 23906, 23907 - */ -@Slf4j -public class ZalcanoOverlay extends Overlay -{ - - private final ZalcanoPlugin plugin; - private final ZalcanoConfig config; - private final ZalcanoUtil util; - private final Client client; - - @Inject - ZalcanoOverlay(final ZalcanoPlugin plugin, final ZalcanoConfig config, final ZalcanoUtil util, final Client client) - { - super(plugin); - this.plugin = plugin; - this.config = config; - this.util = util; - this.client = client; - - setLayer(OverlayLayer.ABOVE_SCENE); - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGH); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (!util.isInZalcanoRegion()) - { - return null; - } - - if (config.showAoeForRockfall()) - { - renderBadTiles(graphics); - } - if (config.showAoeForRedSymbols()) - { - renderRedSymbols(graphics); - } - if (config.highlightMiningSpot()) - { - renderRockToMine(graphics); - } - if (config.highlightGolem()) - { - renderGolem(graphics); - } - if (config.highlightZalcanoHull()) - { - renderZalcano(graphics); - } - - //has their own configs within this method - renderZalcanoAnimations(graphics); - - return null; - } - - private void renderBadTiles(Graphics2D graphics) - { - List rockFall = util.getRockfall(); - - if (rockFall != null) - { - for (GraphicsObject graphicsObject : rockFall) - { - WorldPoint worldPoint = WorldPoint.fromLocal(client, graphicsObject.getLocation()); - OverlayUtil.drawTiles(graphics, client, worldPoint, client.getLocalPlayer().getWorldLocation(), Color.RED, 2, 150, 50); - } - } - } - - private void renderRedSymbols(Graphics2D graphics) - { - List symbolsToRender = util.getRedSymbols(); - - if (symbolsToRender != null) - { - for (GameObject gameObject : symbolsToRender) - { - final LocalPoint loc = gameObject.getLocalLocation(); - final Polygon poly = Perspective.getCanvasTileAreaPoly(client, loc, 3); - if (poly != null) - { - OverlayUtil.renderPolygon(graphics, poly, new Color(249, 47, 30)); - } - } - } - } - - private void renderRockToMine(Graphics2D graphics) - { - GameObject glowingRock = util.getGlowingRock(); - - if (glowingRock != null) - { - final Polygon poly = Perspective.getCanvasTileAreaPoly(client, glowingRock.getLocalLocation(), !util.projectileExists() ? 2 : 4); - - if (poly != null) - { - final Color green = new Color(140, 255, 60); - OverlayUtil.renderPolygon(graphics, poly, !util.projectileExists() ? green : Color.RED); - OverlayUtil.renderTextLocation(graphics, glowingRock.getCanvasLocation(), !util.projectileExists() ? ZalcanoUtil.mine : ZalcanoUtil.warning, !util.projectileExists() ? green : Color.RED); - } - } - } - - private void renderGolem(Graphics2D graphics) - { - if (plugin.getGolem() != null) - { - Shape hull = plugin.getGolem().getConvexHull(); - if (hull != null) - { - OverlayUtil.renderPolygon(graphics, hull, new Color(206, 41, 231)); - } - - } - } - - private void renderZalcano(Graphics2D graphics) - { - if (plugin.getZalcano() != null) - { - Shape hull = plugin.getZalcano().getConvexHull(); - if (hull != null) - { - OverlayUtil.renderPolygon(graphics, hull, config.zalcanoHullColor()); - } - - } - } - - private void renderZalcanoAnimations(Graphics2D graphics) - { - if (plugin.getZalcano() != null) - { - switch (plugin.getZalcano().getAnimation()) - { - case AnimationID.ZALCANO_KNOCKED_DOWN: - if (config.showAoeZalcanoMineable()) - { - renderZalcanoMineable(graphics); - } - break; - case AnimationID.ZALCANO_WAKEUP: - if (config.showAoeZalcanoWakeup()) - { - renderZalcanoWakeup(graphics); - } - break; - } - } - } - - private void renderZalcanoMineable(Graphics2D graphics) - { - renderZalcanoAOE(graphics, 4, ZalcanoUtil.mine, Color.GREEN); - } - - private void renderZalcanoWakeup(Graphics2D graphics) - { - renderZalcanoAOE(graphics, 6, ZalcanoUtil.warning, Color.RED); - } - - private void renderZalcanoAOE(Graphics2D graphics, int polySize, String text, Color color) - { - Polygon poly = Perspective.getCanvasTileAreaPoly(client, plugin.getZalcano().getLocalLocation(), polySize); - if (poly != null) - { - OverlayUtil.renderPolygon(graphics, poly, color); - OverlayUtil.renderTextLocation(graphics, plugin.getZalcano().getCanvasTextLocation(graphics, text, plugin.getZalcano().getLogicalHeight() / 2), text, color); - } - } - - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoPlugin.java deleted file mode 100644 index fd8316f840..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoPlugin.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * - * * 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.zalcano; - -import com.google.inject.Binder; -import com.google.inject.Inject; -import com.google.inject.Provides; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.AnimationID; -import net.runelite.api.Client; -import net.runelite.api.ItemID; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.api.kit.KitType; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.EventBus; -import net.runelite.client.eventbus.Subscribe; -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; - -@PluginDescriptor( - name = "Zalcano", - description = "Highlights Zalcano AOEs and useful stuff", - tags = {"zalcano", "aoe", "prifddinas", "elf", "boss"}, - type = PluginType.PVM -) -@Slf4j -public class ZalcanoPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private ZalcanoConfig config; - - @Inject - private ZalcanoUtil util; - - @Inject - private ZalcanoOverlay overlay; - - @Inject - private ZalcanoStepsOverlay stepsOverlay; - - @Inject - private OverlayManager overlayManager; - - @Inject - private EventBus eventBus; - - @Setter(AccessLevel.PACKAGE) - @Getter(AccessLevel.PACKAGE) - private NPC zalcano; - - @Getter(AccessLevel.PACKAGE) - private NPC golem; - - @Getter(AccessLevel.PACKAGE) - @Setter(AccessLevel.PACKAGE) - private Step step; - - private int ores = 0; - - @Provides - ZalcanoConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(ZalcanoConfig.class); - } - - @Override - protected void startUp() - { - eventBus.subscribe(GameTick.class, "regionchecker", this::onGameTickCheckRegion); - } - - @Override - protected void shutDown() - { - eventBus.unregister("regionchecker"); - overlayManager.remove(overlay); - overlayManager.remove(stepsOverlay); - } - - @Override - public void configure(Binder binder) - { - } - - private void onGameTickCheckRegion(GameTick gameTick) - { - if (util.isInZalcanoRegion()) - { - log.debug("region check complete loading other events"); - - util.manuallyFindZalcano(); //this is here because the new subscribed npcspawn doesn't catch a pre existing zalcano - - overlayManager.add(overlay); - overlayManager.add(stepsOverlay); - - eventBus.unregister("regionchecker"); - } - } - - @Subscribe - private void onNpcSpawned(NpcSpawned npcSpawned) - { - switch (npcSpawned.getNpc().getId()) - { - case NpcID.ZALCANO: - log.debug("zalcano spawned"); - zalcano = npcSpawned.getNpc(); - break; - case NpcID.GOLEM_9051: - log.debug("golem spawned"); - golem = npcSpawned.getNpc(); - break; - } - } - - @Subscribe - private void onNpcDespawned(NpcDespawned npcDespawned) - { - switch (npcDespawned.getNpc().getId()) - { - case NpcID.ZALCANO: - zalcano = null; - break; - case NpcID.GOLEM_9051: - golem = null; - break; - } - } - - //23905 //ore - //23906 //smelted - //23907 //runecrafted ore - - /** - * This event switches steps based on different conditions (inaccurate) - * TODO: improve this. until then its option is disabled in the config - * - * @param gameTick - */ - @Subscribe - private void gameTickStepMachine(GameTick gameTick) - { - if (!config.showSteps()) - { - return; - } - - if (getZalcano() != null) - { - if (getZalcano().getAnimation() == AnimationID.ZALCANO_KNOCKED_DOWN) //zalcano got knocked down - { - setStep(Step.MINE_ZALCANO); - return; - } - } - if (util.countItemInInventory(ItemID.TEPHRA) < 3 && util.countItemInInventory(ItemID.REFINED_TEPHRA) < 3 && util.countStackInInventory(ItemID.IMBUED_TEPHRA) < 3) - { - if (client.getLocalPlayer().getPlayerAppearance().getEquipmentId(KitType.WEAPON) == ItemID.IMBUED_TEPHRA) - { - setStep(Step.THROW); - return; - } - if (getZalcano() != null && util.countItemInInventory(ItemID.REFINED_TEPHRA) == 0 && util.countItemInInventory(ItemID.IMBUED_TEPHRA) == 0) - { - setStep(Step.MINE); - return; - } - } - if (util.countItemInInventory(ItemID.TEPHRA) >= 3) - { - setStep(Step.SMELT); - return; - } - if (util.countItemInInventory(ItemID.REFINED_TEPHRA) >= 3 && ores == 0) - { - setStep(Step.RUNECRAFT); - return; - } - if (util.countStackInInventory(ItemID.IMBUED_TEPHRA) >= 3) - { - setStep(Step.THROW); - return; - } - setStep(Step.IDLE); - } - - @Subscribe - private void gameTickOreListener(GameTick gameTick) - { - if (!config.showSteps()) - { - return; - } - ores = util.countItemInInventory(ItemID.TEPHRA); - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoStepsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoStepsOverlay.java deleted file mode 100644 index 16256c215f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoStepsOverlay.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * - * * 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.zalcano; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import net.runelite.api.Client; -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; - -public class ZalcanoStepsOverlay extends Overlay -{ - private final Client client; - private final ZalcanoPlugin plugin; - private final ZalcanoConfig config; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - ZalcanoStepsOverlay(final Client client, final ZalcanoPlugin plugin, final ZalcanoConfig config) - { - super(plugin); - setPosition(OverlayPosition.TOP_LEFT); - this.client = client; - this.config = config; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (client.getLocalPlayer().getWorldLocation().getRegionID() == 12126 && config.showSteps()) - { - panelComponent.getChildren().clear(); - - panelComponent.getChildren().add(TitleComponent.builder() - .text("Step: " + plugin.getStep().name()) - .color(Color.CYAN) - .build()); - - return panelComponent.render(graphics); - } - return null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoUtil.java b/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoUtil.java deleted file mode 100644 index 06117a27ef..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zalcano/ZalcanoUtil.java +++ /dev/null @@ -1,236 +0,0 @@ -/* - * - * * 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.zalcano; - -import java.util.ArrayList; -import java.util.List; -import javax.inject.Inject; -import net.runelite.api.AnimationID; -import net.runelite.api.Client; -import net.runelite.api.Constants; -import net.runelite.api.DynamicObject; -import net.runelite.api.Entity; -import net.runelite.api.GameObject; -import net.runelite.api.GraphicsObject; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.ObjectID; -import net.runelite.api.Projectile; -import net.runelite.api.ProjectileID; -import net.runelite.api.Tile; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.api.widgets.WidgetItem; - -public class ZalcanoUtil -{ - - private final Client client; - private final ZalcanoPlugin plugin; - - static final String mine = "MINE"; - static final String warning = "GET BACK"; - private static final int ZALCANO_REGION = 12126; - - @Inject - ZalcanoUtil(Client client, ZalcanoPlugin plugin) - { - this.client = client; - this.plugin = plugin; - } - - boolean isInZalcanoRegion() - { - return client.getLocalPlayer().getWorldLocation().getRegionID() == ZALCANO_REGION; - } - - - boolean projectileExists() - { - for (Projectile projectile : client.getProjectiles()) - { - if (projectile != null) - { - if (projectile.getId() == ProjectileID.ZALCANO_PROJECTILE) - { - return true; - } - } - } - return false; - } - - //this should be a project-wide standard - private List getGameObjects() - { - List gameObjectArrayList = new ArrayList<>(); - - for (int x = 0; x < Constants.SCENE_SIZE; x++) - { - for (int y = 0; y < Constants.SCENE_SIZE; y++) - { - Tile tile = client.getScene().getTiles()[client.getPlane()][x][y]; - - if (tile.getGameObjects() != null) - { - for (GameObject gameObject : tile.getGameObjects()) - { - if (gameObject != null) //im aware this can still give null objects - { - gameObjectArrayList.add(gameObject); - } - } - } - } - } - return gameObjectArrayList; - } - - GameObject getGlowingRock() - { - for (GameObject gameObject : getGameObjects()) - { - if (gameObject != null) - { - if (gameObject.getId() == ObjectID.ROCK_FORMATION_GLOWING) - { - if (client.getLocalPlayer().getLocalLocation().distanceTo(gameObject.getLocalLocation()) <= 2400) - { - Entity entity = gameObject.getEntity(); - if (entity instanceof DynamicObject) - { - if (((DynamicObject) entity).getAnimationID() == AnimationID.ZALCANO_ROCK_GLOWING) - { - return gameObject; - } - } - } - } - } - } - return null; - } - - List getRedSymbols() - { - List list = new ArrayList<>(); - for (GameObject gameObject : getGameObjects()) - { - if (gameObject != null) - { - if (gameObject.getId() == ObjectID.DEMONIC_SYMBOL) - { - if (client.getLocalPlayer().getLocalLocation().distanceTo(gameObject.getLocalLocation()) <= 2400) - { - Entity entity = gameObject.getEntity(); - if (entity instanceof DynamicObject) - { - list.add(gameObject); - } - } - } - } - } - return list.size() > 0 ? list : null; - } - - List getRockfall() - { - List list = new ArrayList<>(); - for (GraphicsObject graphicsObject : client.getGraphicsObjects()) - { - if (graphicsObject != null) - { - if (graphicsObject.getId() == 1727/*<-- not sure where to add that*/) - { - list.add(graphicsObject); - } - } - } - return list.size() > 0 ? list : null; - } - - int countItemInInventory(int itemID) - { - int i = 0; - Widget widget = client.getWidget(WidgetInfo.INVENTORY); - for (WidgetItem widgetItem : widget.getWidgetItems()) - { - if (widgetItem.getId() == itemID) - { - i++; - } - } - return i; - } - - /** - * Courtesy of OP - * - * @param itemId - * @return - */ - int countStackInInventory(int itemId) - { - ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); - if (inventory != null) - { - Item[] items = inventory.getItems(); - for (int i = 0; i < 28; ++i) - { - if (i < items.length) - { - Item item = items[i]; - if (item.getId() >= 0 && item.getId() == itemId) - { - return item.getQuantity(); - } - } - } - } - return 0; - } - - void manuallyFindZalcano() - { - for (NPC npc : client.getNpcs()) - { - if (npc != null) - { - if (npc.getId() == NpcID.ZALCANO) - { - plugin.setZalcano(npc); - } - } - } - } - - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/ImagePanelComponent.java b/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/ImagePanelComponent.java deleted file mode 100644 index bb7bf6a80e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/ImagePanelComponent.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * Copyright (c) 2017, Adam - * Copyright (c) 2017, Devin French - * 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.zulrah; - -import com.google.common.base.Strings; -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.awt.image.BufferedImage; -import javax.annotation.Nullable; -import javax.inject.Singleton; -import lombok.AccessLevel; -import lombok.Setter; -import net.runelite.client.ui.overlay.RenderableEntity; -import net.runelite.client.ui.overlay.components.BackgroundComponent; - -@Singleton -public class ImagePanelComponent implements RenderableEntity -{ - private static final int TOP_BORDER = 3; - private static final int SIDE_BORDER = 6; - private static final int BOTTOM_BORDER = 6; - private static final int SEPARATOR = 4; - - @Setter(AccessLevel.PUBLIC) - @Nullable - private String title; - - @Setter(AccessLevel.PACKAGE) - private Color titleColor = Color.WHITE; - - @Setter(AccessLevel.PUBLIC) - private Color backgroundColor = new Color(70, 61, 50, 156); - - @Setter(AccessLevel.PUBLIC) - private BufferedImage image; - - @Setter(AccessLevel.PACKAGE) - private Point position = new Point(); - - @Override - public Dimension render(Graphics2D graphics) - { - final Dimension dimension = new Dimension(); - final FontMetrics metrics = graphics.getFontMetrics(); - int height = TOP_BORDER + (Strings.isNullOrEmpty(title) ? 0 : metrics.getHeight()) - + SEPARATOR + image.getHeight() + BOTTOM_BORDER; - int width = Math.max(Strings.isNullOrEmpty(title) ? 0 : metrics.stringWidth(title), image.getWidth()) + SIDE_BORDER * 2; - dimension.setSize(width, height); - - if (dimension.height == 0) - { - return null; - } - - // Calculate panel dimensions - int y = position.y + TOP_BORDER + metrics.getHeight(); - - // Render background - final BackgroundComponent backgroundComponent = new BackgroundComponent(); - backgroundComponent.setBackgroundColor(backgroundColor); - backgroundComponent.setRectangle(new Rectangle(position.x, position.y, dimension.width, dimension.height)); - backgroundComponent.render(graphics); - - // Render title - if (!Strings.isNullOrEmpty(title)) - { - final TextComponent titleComponent = new TextComponent(); - titleComponent.setText(title); - titleComponent.setColor(titleColor); - titleComponent.setPosition(new Point(position.x + (width - metrics.stringWidth(title)) / 2, y)); - titleComponent.render(graphics); - y += SEPARATOR; - } - - // Render image - graphics.drawImage(image, position.x + (width - image.getWidth()) / 2, y, null); - - return dimension; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/TextComponent.java b/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/TextComponent.java deleted file mode 100644 index ed0e737ef2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/TextComponent.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * Copyright (c) 2017, Adam - * Copyright (c) 2017, Devin French - * 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.zulrah; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FontMetrics; -import java.awt.Graphics2D; -import java.awt.Point; -import lombok.AccessLevel; -import lombok.Setter; -import net.runelite.client.ui.overlay.RenderableEntity; - -public class TextComponent implements RenderableEntity -{ - @Setter(AccessLevel.PACKAGE) - private String text; - - @Setter(AccessLevel.PACKAGE) - private Point position = new Point(); - - @Setter(AccessLevel.PACKAGE) - private Color color = Color.WHITE; - - @Override - public Dimension render(Graphics2D graphics) - { - // Draw shadow - graphics.setColor(Color.BLACK); - graphics.drawString(text, position.x + 1, position.y + 1); - - // Draw actual text - graphics.setColor(color); - graphics.drawString(text, position.x, position.y); - - final FontMetrics fontMetrics = graphics.getFontMetrics(); - return new Dimension(fontMetrics.stringWidth(text), fontMetrics.getHeight()); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/ZulrahConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/ZulrahConfig.java deleted file mode 100644 index 539a15cbc8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/ZulrahConfig.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * Copyright (c) 2017, Adam - * Copyright (c) 2017, Devin French - * 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.zulrah; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("zulrah") - -public interface ZulrahConfig extends Config -{ - @ConfigItem( - keyName = "sounds", - name = "Sounds Enabled", - description = "Configures whether client sounds are enabled for zulrah" - ) - default boolean sounds() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/ZulrahInstance.java b/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/ZulrahInstance.java deleted file mode 100644 index a7faac13e3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/ZulrahInstance.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * Copyright (c) 2017, Adam - * Copyright (c) 2017, Devin French - * 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.zulrah; - -import javax.annotation.Nullable; -import net.runelite.api.NPC; -import net.runelite.api.Prayer; -import net.runelite.api.coords.LocalPoint; -import net.runelite.client.plugins.zulrah.patterns.ZulrahPattern; -import net.runelite.client.plugins.zulrah.phase.StandLocation; -import net.runelite.client.plugins.zulrah.phase.ZulrahLocation; -import net.runelite.client.plugins.zulrah.phase.ZulrahPhase; -import net.runelite.client.plugins.zulrah.phase.ZulrahType; - -public class ZulrahInstance -{ - private static final ZulrahPhase NO_PATTERN_MAGIC_PHASE = new ZulrahPhase( - ZulrahLocation.NORTH, - ZulrahType.MAGIC, - false, - StandLocation.PILLAR_WEST_OUTSIDE, - Prayer.PROTECT_FROM_MAGIC - ); - private static final ZulrahPhase NO_PATTERN_RANGE_PHASE = new ZulrahPhase( - ZulrahLocation.NORTH, - ZulrahType.RANGE, - false, - StandLocation.TOP_EAST, - Prayer.PROTECT_FROM_MISSILES - ); - private static final ZulrahPhase PATTERN_A_OR_B_RANGE_PHASE = new ZulrahPhase( - ZulrahLocation.NORTH, - ZulrahType.RANGE, - false, - StandLocation.PILLAR_WEST_OUTSIDE, - Prayer.PROTECT_FROM_MISSILES - ); - - private final LocalPoint startLocation; - private ZulrahPattern pattern; - private int stage; - private ZulrahPhase phase; - - ZulrahInstance(final NPC zulrah) - { - this.startLocation = zulrah.getLocalLocation(); - } - - public LocalPoint getStartLocation() - { - return startLocation; - } - - public ZulrahPattern getPattern() - { - return pattern; - } - - public void setPattern(ZulrahPattern pattern) - { - this.pattern = pattern; - } - - int getStage() - { - return stage; - } - - void nextStage() - { - ++stage; - } - - public void reset() - { - pattern = null; - stage = 0; - } - - @Nullable - public ZulrahPhase getPhase() - { - ZulrahPhase patternPhase = null; - if (pattern != null) - { - patternPhase = pattern.get(stage); - } - return patternPhase != null ? patternPhase : phase; - } - - public void setPhase(ZulrahPhase phase) - { - this.phase = phase; - } - - @Nullable - public ZulrahPhase getNextPhase() - { - if (pattern != null) - { - return pattern.get(stage + 1); - } - else if (phase != null) - { - ZulrahType type = phase.getType(); - StandLocation standLocation = phase.getStandLocation(); - if (type == ZulrahType.MELEE) - { - return standLocation == StandLocation.TOP_EAST ? NO_PATTERN_MAGIC_PHASE : NO_PATTERN_RANGE_PHASE; - } - if (type == ZulrahType.MAGIC) - { - return standLocation == StandLocation.TOP_EAST ? NO_PATTERN_RANGE_PHASE : PATTERN_A_OR_B_RANGE_PHASE; - } - } - return null; - } -} 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 deleted file mode 100644 index db50e8bc04..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/ZulrahPlugin.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * 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 - * 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.zulrah; - -import com.google.inject.Provides; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.AccessLevel; -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; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.game.Sound; -import net.runelite.client.game.SoundManager; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.PluginType; -import net.runelite.client.plugins.zulrah.overlays.ZulrahCurrentPhaseOverlay; -import net.runelite.client.plugins.zulrah.overlays.ZulrahNextPhaseOverlay; -import net.runelite.client.plugins.zulrah.overlays.ZulrahOverlay; -import net.runelite.client.plugins.zulrah.overlays.ZulrahPrayerOverlay; -import net.runelite.client.plugins.zulrah.patterns.ZulrahPattern; -import net.runelite.client.plugins.zulrah.patterns.ZulrahPatternA; -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.ui.overlay.OverlayManager; - -@PluginDescriptor( - name = "Zulrah Helper", - description = "Shows tiles on where to stand during the phases and what prayer to use.", - tags = {"zulrah", "boss", "helper"}, - type = PluginType.PVM, - enabledByDefault = false -) -@Slf4j -@Singleton -public class ZulrahPlugin extends Plugin -{ - private static final ZulrahPattern[] patterns = new ZulrahPattern[] - { - new ZulrahPatternA(), - new ZulrahPatternB(), - new ZulrahPatternC(), - new ZulrahPatternD() - }; - - @Getter(AccessLevel.PACKAGE) - 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) - { - return configManager.getConfig(ZulrahConfig.class); - } - - @Override - protected void startUp() - { - - overlayManager.add(currentPhaseOverlay); - overlayManager.add(nextPhaseOverlay); - overlayManager.add(zulrahPrayerOverlay); - overlayManager.add(zulrahOverlay); - } - - @Override - protected void shutDown() - { - overlayManager.remove(currentPhaseOverlay); - overlayManager.remove(nextPhaseOverlay); - overlayManager.remove(zulrahPrayerOverlay); - overlayManager.remove(zulrahOverlay); - zulrah = null; - instance = null; - } - - @Subscribe - private void onGameTick(GameTick event) - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - if (zulrah == null) - { - if (instance != null) - { - log.debug("Zulrah encounter has ended."); - instance = null; - } - return; - } - - if (instance == null) - { - instance = new ZulrahInstance(zulrah); - log.debug("Zulrah encounter has started."); - } - - ZulrahPhase currentPhase = ZulrahPhase.valueOf(zulrah, instance.getStartLocation()); - - if (instance.getPhase() == null) - { - instance.setPhase(currentPhase); - } - else if (!instance.getPhase().equals(currentPhase)) - { - ZulrahPhase previousPhase = instance.getPhase(); - instance.setPhase(currentPhase); - instance.nextStage(); - - log.debug("Zulrah phase has moved from {} -> {}, stage: {}", previousPhase, currentPhase, instance.getStage()); - } - - ZulrahPattern pattern = instance.getPattern(); - - if (pattern == null) - { - int potential = 0; - ZulrahPattern potentialPattern = null; - - for (ZulrahPattern p : patterns) - { - if (p.stageMatches(instance.getStage(), instance.getPhase())) - { - potential++; - potentialPattern = p; - } - } - - if (potential == 1) - { - log.debug("Zulrah pattern identified: {}", potentialPattern); - - instance.setPattern(potentialPattern); - } - } - else if (pattern.canReset(instance.getStage()) && (instance.getPhase() == null || instance.getPhase().equals(pattern.get(0)))) - { - log.debug("Zulrah pattern has reset."); - - instance.reset(); - } - } - - @Subscribe - private void onAnimationChanged(AnimationChanged event) - { - if (instance == null) - { - return; - } - - ZulrahPhase currentPhase = instance.getPhase(); - ZulrahPhase nextPhase = instance.getNextPhase(); - - if (currentPhase == null || nextPhase == null) - { - return; - } - - final Actor actor = event.getActor(); - - if (config.sounds() && zulrah != null && zulrah.equals(actor) && zulrah.getAnimation() == AnimationID.ZULRAH_PHASE) - { - Prayer prayer = nextPhase.getPrayer(); - - if (prayer == null) - { - return; - } - - switch (prayer) - { - case PROTECT_FROM_MAGIC: - soundManager.playSound(Sound.PRAY_MAGIC); - break; - case PROTECT_FROM_MISSILES: - soundManager.playSound(Sound.PRAY_RANGED); - break; - } - } - } - - @Subscribe - private void onNpcSpawned(NpcSpawned event) - { - NPC npc = event.getNpc(); - if (npc != null && npc.getName() != null && - npc.getName().toLowerCase().contains("zulrah")) - { - zulrah = npc; - } - } - - @Subscribe - private void onNpcDespawned(NpcDespawned event) - { - NPC npc = event.getNpc(); - if (npc != null && npc.getName() != null && - npc.getName().toLowerCase().contains("zulrah")) - { - zulrah = null; - } - } - - public ZulrahInstance getInstance() - { - return instance; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/overlays/ZulrahCurrentPhaseOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/overlays/ZulrahCurrentPhaseOverlay.java deleted file mode 100644 index 26c37887e8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/overlays/ZulrahCurrentPhaseOverlay.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * Copyright (c) 2017, Adam - * Copyright (c) 2017, Devin French - * 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.zulrah.overlays; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.client.plugins.zulrah.ImagePanelComponent; -import net.runelite.client.plugins.zulrah.ZulrahInstance; -import net.runelite.client.plugins.zulrah.ZulrahPlugin; -import net.runelite.client.plugins.zulrah.phase.ZulrahPhase; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; - -@Singleton -public class ZulrahCurrentPhaseOverlay extends Overlay -{ - private final ZulrahPlugin plugin; - - @Inject - ZulrahCurrentPhaseOverlay(final ZulrahPlugin plugin) - { - setPosition(OverlayPosition.BOTTOM_RIGHT); - setPriority(OverlayPriority.HIGH); - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - ZulrahInstance instance = plugin.getInstance(); - - if (instance == null) - { - return null; - } - - ZulrahPhase currentPhase = instance.getPhase(); - if (currentPhase == null) - { - return null; - } - - String pattern = instance.getPattern() != null ? instance.getPattern().toString() : "Unknown"; - String title = currentPhase.isJad() ? "JAD PHASE" : pattern; - Color backgroundColor = currentPhase.getColor(); - BufferedImage zulrahImage = ZulrahImageManager.getZulrahBufferedImage(currentPhase.getType()); - ImagePanelComponent imagePanelComponent = new ImagePanelComponent(); - imagePanelComponent.setTitle(title); - imagePanelComponent.setBackgroundColor(backgroundColor); - imagePanelComponent.setImage(zulrahImage); - return imagePanelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/overlays/ZulrahImageManager.java b/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/overlays/ZulrahImageManager.java deleted file mode 100644 index b181acc041..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/overlays/ZulrahImageManager.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * Copyright (c) 2017, Adam - * Copyright (c) 2017, Devin French - * 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.zulrah.overlays; - -import java.awt.image.BufferedImage; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Prayer; -import net.runelite.client.plugins.zulrah.ZulrahPlugin; -import net.runelite.client.plugins.zulrah.phase.ZulrahType; -import net.runelite.client.util.ImageUtil; - -@Slf4j -class ZulrahImageManager -{ - private static final BufferedImage[] zulrahBufferedImages = new BufferedImage[3]; - private static final BufferedImage[] smallZulrahBufferedImages = new BufferedImage[3]; - private static final BufferedImage[] prayerBufferedImages = new BufferedImage[2]; - - static BufferedImage getZulrahBufferedImage(ZulrahType type) - { - switch (type) - { - case RANGE: - if (zulrahBufferedImages[0] == null) - { - zulrahBufferedImages[0] = getBufferedImage("zulrah_range.png"); - } - return zulrahBufferedImages[0]; - case MAGIC: - if (zulrahBufferedImages[1] == null) - { - zulrahBufferedImages[1] = getBufferedImage("zulrah_magic.png"); - } - return zulrahBufferedImages[1]; - case MELEE: - if (zulrahBufferedImages[2] == null) - { - zulrahBufferedImages[2] = getBufferedImage("zulrah_melee.png"); - } - return zulrahBufferedImages[2]; - } - return null; - } - - static BufferedImage getSmallZulrahBufferedImage(ZulrahType type) - { - switch (type) - { - case RANGE: - if (smallZulrahBufferedImages[0] == null) - { - smallZulrahBufferedImages[0] = getBufferedImage("zulrah_range.png"); - } - return smallZulrahBufferedImages[0]; - case MAGIC: - if (smallZulrahBufferedImages[1] == null) - { - smallZulrahBufferedImages[1] = getBufferedImage("zulrah_magic.png"); - } - return smallZulrahBufferedImages[1]; - case MELEE: - if (smallZulrahBufferedImages[2] == null) - { - smallZulrahBufferedImages[2] = getBufferedImage("zulrah_melee.png"); - } - return smallZulrahBufferedImages[2]; - } - return null; - } - - static BufferedImage getProtectionPrayerBufferedImage(Prayer prayer) - { - switch (prayer) - { - case PROTECT_FROM_MAGIC: - if (prayerBufferedImages[0] == null) - { - prayerBufferedImages[0] = getBufferedImage("protect_from_magic.png"); - } - return prayerBufferedImages[0]; - case PROTECT_FROM_MISSILES: - if (prayerBufferedImages[1] == null) - { - prayerBufferedImages[1] = getBufferedImage("protect_from_missiles.png"); - } - return prayerBufferedImages[1]; - } - return null; - } - - private static BufferedImage getBufferedImage(String path) - { - return ImageUtil.getResourceStreamFromClass(ZulrahPlugin.class, path); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/overlays/ZulrahNextPhaseOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/overlays/ZulrahNextPhaseOverlay.java deleted file mode 100644 index ca9903302d..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/overlays/ZulrahNextPhaseOverlay.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * Copyright (c) 2017, Adam - * Copyright (c) 2017, Devin French - * 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.zulrah.overlays; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.client.plugins.zulrah.ImagePanelComponent; -import net.runelite.client.plugins.zulrah.ZulrahInstance; -import net.runelite.client.plugins.zulrah.ZulrahPlugin; -import net.runelite.client.plugins.zulrah.phase.ZulrahPhase; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; - -@Singleton -public class ZulrahNextPhaseOverlay extends Overlay -{ - private final ZulrahPlugin plugin; - - @Inject - ZulrahNextPhaseOverlay(final ZulrahPlugin plugin) - { - setPosition(OverlayPosition.BOTTOM_RIGHT); - setPriority(OverlayPriority.HIGH); - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - ZulrahInstance instance = plugin.getInstance(); - - if (instance == null) - { - return null; - } - - ZulrahPhase nextPhase = instance.getNextPhase(); - if (nextPhase == null) - { - return null; - } - - Color backgroundColor = nextPhase.getColor(); - BufferedImage zulrahImage = ZulrahImageManager.getSmallZulrahBufferedImage(nextPhase.getType()); - ImagePanelComponent imagePanelComponent = new ImagePanelComponent(); - imagePanelComponent.setTitle("Next"); - imagePanelComponent.setBackgroundColor(backgroundColor); - imagePanelComponent.setImage(zulrahImage); - return imagePanelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/overlays/ZulrahOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/overlays/ZulrahOverlay.java deleted file mode 100644 index 3d9e5eac0e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/overlays/ZulrahOverlay.java +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * Copyright (c) 2017, Adam - * Copyright (c) 2017, Devin French - * 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.zulrah.overlays; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FontMetrics; -import java.awt.Graphics2D; -import java.awt.Polygon; -import java.awt.image.BufferedImage; -import javax.annotation.Nullable; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -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.plugins.zulrah.ZulrahInstance; -import net.runelite.client.plugins.zulrah.ZulrahPlugin; -import net.runelite.client.plugins.zulrah.phase.ZulrahPhase; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; - -@Slf4j -@Singleton -public class ZulrahOverlay extends Overlay -{ - private static final Color TILE_BORDER_COLOR = new Color(0, 0, 0, 100); - private static final Color NEXT_TEXT_COLOR = new Color(255, 255, 255, 100); - - private final Client client; - private final ZulrahPlugin plugin; - - @Inject - ZulrahOverlay(final @Nullable Client client, final ZulrahPlugin plugin) - { - setPosition(OverlayPosition.DYNAMIC); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - ZulrahInstance instance = plugin.getInstance(); - - if (instance == null) - { - return null; - } - - ZulrahPhase currentPhase = instance.getPhase(); - ZulrahPhase nextPhase = instance.getNextPhase(); - if (currentPhase == null) - { - log.debug("Current phase is NULL"); - return null; - } - - LocalPoint startTile = instance.getStartLocation(); - if (nextPhase != null && currentPhase.getStandLocation() == nextPhase.getStandLocation()) - { - drawStandTiles(graphics, startTile, currentPhase, nextPhase); - } - else - { - drawStandTile(graphics, startTile, currentPhase, false); - drawStandTile(graphics, startTile, nextPhase, true); - } - drawZulrahTileMinimap(graphics, startTile, currentPhase, false); - drawZulrahTileMinimap(graphics, startTile, nextPhase, true); - - return null; - } - - private void drawStandTiles(Graphics2D graphics, LocalPoint startTile, ZulrahPhase currentPhase, ZulrahPhase nextPhase) - { - LocalPoint localTile = currentPhase.getStandTile(startTile); - Polygon northPoly = getCanvasTileNorthPoly(client, localTile); - Polygon southPoly = getCanvasTileSouthPoly(client, localTile); - Polygon poly = Perspective.getCanvasTilePoly(client, localTile); - Point textLoc = Perspective.getCanvasTextLocation(client, graphics, localTile, "Stand / Next", 0); - if (northPoly != null && southPoly != null && poly != null && textLoc != null) - { - Color northColor = currentPhase.getColor(); - Color southColor = nextPhase.getColor(); - graphics.setColor(northColor); - graphics.fillPolygon(northPoly); - graphics.setColor(southColor); - graphics.fillPolygon(southPoly); - graphics.setColor(TILE_BORDER_COLOR); - graphics.setStroke(new BasicStroke(2)); - graphics.drawPolygon(poly); - graphics.setColor(NEXT_TEXT_COLOR); - graphics.drawString("Stand / Next", textLoc.getX(), textLoc.getY()); - } - if (nextPhase.isJad()) - { - BufferedImage jadPrayerImg = ZulrahImageManager.getProtectionPrayerBufferedImage(nextPhase.getPrayer()); - if (jadPrayerImg != null) - { - Point imageLoc = Perspective.getCanvasImageLocation(client, localTile, jadPrayerImg, 0); - if (imageLoc != null) - { - graphics.drawImage(jadPrayerImg, imageLoc.getX(), imageLoc.getY(), null); - } - } - } - } - - private void drawStandTile(Graphics2D graphics, LocalPoint startTile, ZulrahPhase phase, boolean next) - { - if (phase == null) - { - log.debug("phase null"); - return; - } - - LocalPoint localTile = phase.getStandTile(startTile); - Polygon poly = Perspective.getCanvasTilePoly(client, localTile); - Color color = phase.getColor(); - if (poly != null) - { - graphics.setColor(TILE_BORDER_COLOR); - graphics.setStroke(new BasicStroke(2)); - graphics.drawPolygon(poly); - graphics.setColor(color); - graphics.fillPolygon(poly); - Point textLoc = Perspective.getCanvasTextLocation(client, graphics, localTile, (next) ? "Next" : "Stand", 0); - if (textLoc != null) - { - graphics.setColor(NEXT_TEXT_COLOR); - graphics.drawString((next) ? "Next" : "Stand", textLoc.getX(), textLoc.getY()); - } - } - else - { - log.debug("poly null"); - } - - if (phase.isJad()) - { - BufferedImage jadPrayerImg = ZulrahImageManager.getProtectionPrayerBufferedImage(phase.getPrayer()); - if (jadPrayerImg != null) - { - Point imageLoc = Perspective.getCanvasImageLocation(client, localTile, jadPrayerImg, 0); - if (imageLoc != null) - { - graphics.drawImage(jadPrayerImg, imageLoc.getX(), imageLoc.getY(), null); - } - } - } - } - - private void drawZulrahTileMinimap(Graphics2D graphics, LocalPoint startTile, ZulrahPhase phase, boolean next) - { - if (phase == null) - { - return; - } - LocalPoint zulrahLocalTile = phase.getZulrahTile(startTile); - Point zulrahMinimapPoint = Perspective.localToMinimap(client, zulrahLocalTile); - Color color = phase.getColor(); - graphics.setColor(color); - if (zulrahMinimapPoint != null) - { - graphics.fillOval(zulrahMinimapPoint.getX() - 2, zulrahMinimapPoint.getY() - 2, 4, 4); - } - graphics.setColor(TILE_BORDER_COLOR); - graphics.setStroke(new BasicStroke(1)); - if (zulrahMinimapPoint != null) - { - graphics.drawOval(zulrahMinimapPoint.getX() - 2, zulrahMinimapPoint.getY() - 2, 4, 4); - } - if (next) - { - graphics.setColor(NEXT_TEXT_COLOR); - FontMetrics fm = graphics.getFontMetrics(); - if (zulrahMinimapPoint != null) - { - graphics.drawString("Next", zulrahMinimapPoint.getX() - fm.stringWidth("Next") / 2, zulrahMinimapPoint.getY() - 2); - } - } - } - - private Polygon getCanvasTileNorthPoly(Client client, LocalPoint localLocation) - { - int plane = client.getPlane(); - int halfTile = Perspective.LOCAL_TILE_SIZE / 2; - - Point p1 = Perspective.localToCanvas(client, new LocalPoint(localLocation.getX() - halfTile, localLocation.getY() - halfTile), plane); - Point p2 = Perspective.localToCanvas(client, new LocalPoint(localLocation.getX() - halfTile, localLocation.getY() + halfTile), plane); - Point p3 = Perspective.localToCanvas(client, new LocalPoint(localLocation.getX() + halfTile, localLocation.getY() + halfTile), plane); - - if (p1 == null || p2 == null || p3 == null) - { - return null; - } - - Polygon poly = new Polygon(); - poly.addPoint(p1.getX(), p1.getY()); - poly.addPoint(p2.getX(), p2.getY()); - poly.addPoint(p3.getX(), p3.getY()); - - return poly; - } - - private Polygon getCanvasTileSouthPoly(Client client, LocalPoint localLocation) - { - int plane = client.getPlane(); - int halfTile = Perspective.LOCAL_TILE_SIZE / 2; - - Point p1 = Perspective.localToCanvas(client, new LocalPoint(localLocation.getX() - halfTile, localLocation.getY() - halfTile), plane); - Point p2 = Perspective.localToCanvas(client, new LocalPoint(localLocation.getX() + halfTile, localLocation.getY() + halfTile), plane); - Point p3 = Perspective.localToCanvas(client, new LocalPoint(localLocation.getX() + halfTile, localLocation.getY() - halfTile), plane); - - if (p1 == null || p2 == null || p3 == null) - { - return null; - } - - Polygon poly = new Polygon(); - poly.addPoint(p1.getX(), p1.getY()); - poly.addPoint(p2.getX(), p2.getY()); - poly.addPoint(p3.getX(), p3.getY()); - - return poly; - } - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/overlays/ZulrahPrayerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/overlays/ZulrahPrayerOverlay.java deleted file mode 100644 index cd3315f1fe..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/overlays/ZulrahPrayerOverlay.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * Copyright (c) 2017, Adam - * Copyright (c) 2017, Devin French - * 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.zulrah.overlays; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import javax.annotation.Nullable; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.Prayer; -import net.runelite.client.plugins.zulrah.ImagePanelComponent; -import net.runelite.client.plugins.zulrah.ZulrahInstance; -import net.runelite.client.plugins.zulrah.ZulrahPlugin; -import net.runelite.client.plugins.zulrah.phase.ZulrahPhase; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.OverlayPriority; - -@Singleton -@Slf4j -public class ZulrahPrayerOverlay extends Overlay -{ - private final Client client; - private final ZulrahPlugin plugin; - - @Inject - ZulrahPrayerOverlay(final @Nullable Client client, final ZulrahPlugin plugin) - { - setPosition(OverlayPosition.BOTTOM_RIGHT); - setPriority(OverlayPriority.MED); - this.client = client; - this.plugin = plugin; - } - - @Override - public Dimension render(Graphics2D graphics) - { - ZulrahInstance instance = plugin.getInstance(); - - if (instance == null) - { - return null; - } - - ZulrahPhase currentPhase = instance.getPhase(); - if (currentPhase == null) - { - return null; - } - - Prayer prayer = currentPhase.isJad() ? null : currentPhase.getPrayer(); - if (prayer == null) - { - return null; - } - - BufferedImage prayerImage = ZulrahImageManager.getProtectionPrayerBufferedImage(prayer); - ImagePanelComponent imagePanelComponent = new ImagePanelComponent(); - imagePanelComponent.setTitle((!client.isPrayerActive(prayer)) ? "Switch!" : "Prayer"); - imagePanelComponent.setImage(prayerImage); - return imagePanelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/patterns/ZulrahPattern.java b/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/patterns/ZulrahPattern.java deleted file mode 100644 index 74f89b05d4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/patterns/ZulrahPattern.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * Copyright (c) 2017, Adam - * Copyright (c) 2017, Devin French - * 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.zulrah.patterns; - -import java.util.ArrayList; -import java.util.List; -import net.runelite.api.Prayer; -import net.runelite.client.plugins.zulrah.phase.StandLocation; -import net.runelite.client.plugins.zulrah.phase.ZulrahLocation; -import net.runelite.client.plugins.zulrah.phase.ZulrahPhase; -import net.runelite.client.plugins.zulrah.phase.ZulrahType; - -public abstract class ZulrahPattern -{ - private final List pattern = new ArrayList<>(); - - final void add(ZulrahLocation loc, ZulrahType type, StandLocation standLocation, Prayer prayer) - { - add(loc, type, standLocation, false, prayer); - } - - final void addJad(ZulrahLocation loc, ZulrahType type, StandLocation standLocation, Prayer prayer) - { - add(loc, type, standLocation, true, prayer); - } - - private void add(ZulrahLocation loc, ZulrahType type, StandLocation standLocation, boolean jad, Prayer prayer) - { - pattern.add(new ZulrahPhase(loc, type, jad, standLocation, prayer)); - } - - public ZulrahPhase get(int index) - { - if (index >= pattern.size()) - { - return null; - } - - return pattern.get(index); - } - - public boolean stageMatches(int index, ZulrahPhase instance) - { - ZulrahPhase patternInstance = get(index); - return patternInstance != null && patternInstance.equals(instance); - } - - public boolean canReset(int index) - { - return index >= pattern.size(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/patterns/ZulrahPatternA.java b/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/patterns/ZulrahPatternA.java deleted file mode 100644 index 887236f321..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/patterns/ZulrahPatternA.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * Copyright (c) 2017, Adam - * Copyright (c) 2017, Devin French - * 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.zulrah.patterns; - -import net.runelite.api.Prayer; -import net.runelite.client.plugins.zulrah.phase.StandLocation; -import net.runelite.client.plugins.zulrah.phase.ZulrahLocation; -import net.runelite.client.plugins.zulrah.phase.ZulrahType; - -public class ZulrahPatternA extends ZulrahPattern -{ - public ZulrahPatternA() - { - add(ZulrahLocation.NORTH, ZulrahType.RANGE, StandLocation.TOP_EAST, null); - add(ZulrahLocation.NORTH, ZulrahType.MELEE, StandLocation.TOP_EAST, null); - add(ZulrahLocation.NORTH, ZulrahType.MAGIC, StandLocation.PILLAR_WEST_INSIDE, Prayer.PROTECT_FROM_MAGIC); - add(ZulrahLocation.SOUTH, ZulrahType.RANGE, StandLocation.PILLAR_WEST_INSIDE, Prayer.PROTECT_FROM_MISSILES); - add(ZulrahLocation.NORTH, ZulrahType.MELEE, StandLocation.PILLAR_WEST_INSIDE, null); - add(ZulrahLocation.WEST, ZulrahType.MAGIC, StandLocation.PILLAR_WEST_INSIDE, Prayer.PROTECT_FROM_MAGIC); - add(ZulrahLocation.SOUTH, ZulrahType.RANGE, StandLocation.PILLAR_EAST_OUTSIDE, null); - add(ZulrahLocation.SOUTH, ZulrahType.MAGIC, StandLocation.SOUTH_WEST, Prayer.PROTECT_FROM_MAGIC); - addJad(ZulrahLocation.WEST, ZulrahType.RANGE, StandLocation.TOP_WEST, Prayer.PROTECT_FROM_MISSILES); - add(ZulrahLocation.NORTH, ZulrahType.MELEE, StandLocation.TOP_WEST, null); - } - - @Override - public String toString() - { - return "Pattern A"; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/patterns/ZulrahPatternB.java b/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/patterns/ZulrahPatternB.java deleted file mode 100644 index 20a9a560a0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/patterns/ZulrahPatternB.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.runelite.client.plugins.zulrah.patterns; - -import net.runelite.api.Prayer; -import net.runelite.client.plugins.zulrah.phase.StandLocation; -import net.runelite.client.plugins.zulrah.phase.ZulrahLocation; -import net.runelite.client.plugins.zulrah.phase.ZulrahType; - -public class ZulrahPatternB extends ZulrahPattern -{ - public ZulrahPatternB() - { - add(ZulrahLocation.NORTH, ZulrahType.RANGE, StandLocation.TOP_EAST, null); - add(ZulrahLocation.NORTH, ZulrahType.MELEE, StandLocation.TOP_EAST, null); - add(ZulrahLocation.NORTH, ZulrahType.MAGIC, StandLocation.PILLAR_WEST_OUTSIDE, Prayer.PROTECT_FROM_MAGIC); - add(ZulrahLocation.WEST, ZulrahType.RANGE, StandLocation.PILLAR_WEST_OUTSIDE, null); - add(ZulrahLocation.SOUTH, ZulrahType.MAGIC, StandLocation.PILLAR_WEST_INSIDE, Prayer.PROTECT_FROM_MAGIC); // optional phase - add(ZulrahLocation.NORTH, ZulrahType.MELEE, StandLocation.PILLAR_WEST_INSIDE, null); - add(ZulrahLocation.EAST, ZulrahType.RANGE, StandLocation.SOUTH_EAST, Prayer.PROTECT_FROM_MISSILES); - add(ZulrahLocation.SOUTH, ZulrahType.MAGIC, StandLocation.SOUTH_WEST, Prayer.PROTECT_FROM_MAGIC); - addJad(ZulrahLocation.WEST, ZulrahType.RANGE, StandLocation.TOP_WEST, Prayer.PROTECT_FROM_MISSILES); - add(ZulrahLocation.NORTH, ZulrahType.MELEE, StandLocation.TOP_WEST, null); - } - - @Override - public String toString() - { - return "Pattern B"; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/patterns/ZulrahPatternC.java b/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/patterns/ZulrahPatternC.java deleted file mode 100644 index 893ffcaff4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/patterns/ZulrahPatternC.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * Copyright (c) 2017, Adam - * Copyright (c) 2017, Devin French - * 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.zulrah.patterns; - -import net.runelite.api.Prayer; -import net.runelite.client.plugins.zulrah.phase.StandLocation; -import net.runelite.client.plugins.zulrah.phase.ZulrahLocation; -import net.runelite.client.plugins.zulrah.phase.ZulrahType; - -public class ZulrahPatternC extends ZulrahPattern -{ - public ZulrahPatternC() - { - add(ZulrahLocation.NORTH, ZulrahType.RANGE, StandLocation.TOP_EAST, null); - add(ZulrahLocation.EAST, ZulrahType.RANGE, StandLocation.TOP_EAST, Prayer.PROTECT_FROM_MISSILES); - add(ZulrahLocation.NORTH, ZulrahType.MELEE, StandLocation.TOP_WEST, null); - add(ZulrahLocation.WEST, ZulrahType.MAGIC, StandLocation.WEST, Prayer.PROTECT_FROM_MAGIC); - add(ZulrahLocation.SOUTH, ZulrahType.RANGE, StandLocation.SOUTH_EAST, Prayer.PROTECT_FROM_MISSILES); - add(ZulrahLocation.EAST, ZulrahType.MAGIC, StandLocation.PILLAR_EAST_OUTSIDE, Prayer.PROTECT_FROM_MAGIC); - add(ZulrahLocation.NORTH, ZulrahType.RANGE, StandLocation.PILLAR_WEST_OUTSIDE, null); - add(ZulrahLocation.WEST, ZulrahType.RANGE, StandLocation.PILLAR_WEST_OUTSIDE, Prayer.PROTECT_FROM_MISSILES); - add(ZulrahLocation.NORTH, ZulrahType.MAGIC, StandLocation.TOP_EAST, Prayer.PROTECT_FROM_MAGIC); - addJad(ZulrahLocation.EAST, ZulrahType.MAGIC, StandLocation.TOP_EAST, Prayer.PROTECT_FROM_MAGIC); - add(ZulrahLocation.NORTH, ZulrahType.MAGIC, StandLocation.TOP_EAST, null); - } - - @Override - public String toString() - { - return "Pattern C"; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/patterns/ZulrahPatternD.java b/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/patterns/ZulrahPatternD.java deleted file mode 100644 index bed503e24f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/patterns/ZulrahPatternD.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * Copyright (c) 2017, Adam - * Copyright (c) 2017, Devin French - * 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.zulrah.patterns; - -import net.runelite.api.Prayer; -import net.runelite.client.plugins.zulrah.phase.StandLocation; -import net.runelite.client.plugins.zulrah.phase.ZulrahLocation; -import net.runelite.client.plugins.zulrah.phase.ZulrahType; - -public class ZulrahPatternD extends ZulrahPattern -{ - public ZulrahPatternD() - { - add(ZulrahLocation.NORTH, ZulrahType.RANGE, StandLocation.TOP_EAST, null); - add(ZulrahLocation.EAST, ZulrahType.MAGIC, StandLocation.TOP_EAST, Prayer.PROTECT_FROM_MAGIC); - add(ZulrahLocation.SOUTH, ZulrahType.RANGE, StandLocation.PILLAR_WEST_INSIDE, Prayer.PROTECT_FROM_MISSILES); - add(ZulrahLocation.WEST, ZulrahType.MAGIC, StandLocation.PILLAR_WEST_INSIDE, Prayer.PROTECT_FROM_MAGIC); - add(ZulrahLocation.NORTH, ZulrahType.MELEE, StandLocation.PILLAR_EAST_OUTSIDE, null); - add(ZulrahLocation.EAST, ZulrahType.RANGE, StandLocation.PILLAR_EAST_OUTSIDE, Prayer.PROTECT_FROM_MISSILES); - add(ZulrahLocation.SOUTH, ZulrahType.RANGE, StandLocation.PILLAR_WEST_OUTSIDE, null); - add(ZulrahLocation.WEST, ZulrahType.MAGIC, StandLocation.PILLAR_WEST_OUTSIDE, Prayer.PROTECT_FROM_MAGIC); - add(ZulrahLocation.NORTH, ZulrahType.RANGE, StandLocation.TOP_EAST, Prayer.PROTECT_FROM_MISSILES); - add(ZulrahLocation.NORTH, ZulrahType.MAGIC, StandLocation.TOP_EAST, Prayer.PROTECT_FROM_MAGIC); - addJad(ZulrahLocation.EAST, ZulrahType.MAGIC, StandLocation.TOP_EAST, Prayer.PROTECT_FROM_MAGIC); - add(ZulrahLocation.NORTH, ZulrahType.MAGIC, StandLocation.TOP_EAST, null); - } - - @Override - public String toString() - { - return "Pattern D"; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/phase/StandLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/phase/StandLocation.java deleted file mode 100644 index 6f2a757472..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/phase/StandLocation.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * Copyright (c) 2017, Devin French - * 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.zulrah.phase; - -public enum StandLocation -{ - WEST, - EAST, - SOUTH, - SOUTH_WEST, - SOUTH_EAST, - TOP_EAST, - TOP_WEST, - PILLAR_WEST_INSIDE, - PILLAR_WEST_OUTSIDE, - PILLAR_EAST_INSIDE, - PILLAR_EAST_OUTSIDE -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/phase/ZulrahLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/phase/ZulrahLocation.java deleted file mode 100644 index ce5ab0fa94..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/phase/ZulrahLocation.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * Copyright (c) 2017, Devin French - * 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.zulrah.phase; - -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.coords.LocalPoint; - -@Slf4j -public enum ZulrahLocation -{ - NORTH, SOUTH, EAST, WEST; - - public static ZulrahLocation valueOf(LocalPoint start, LocalPoint current) - { - int dx = start.getX() - current.getX(); - int dy = start.getY() - current.getY(); - if (dx == -10 * 128 && dy == 2 * 128) - { - return ZulrahLocation.EAST; - } - else if (dx == 10 * 128 && dy == 2 * 128) - { - return ZulrahLocation.WEST; - } - else if (dx == 0 && dy == 11 * 128) - { - return ZulrahLocation.SOUTH; - } - else if (dx == 0 && dy == 0) - { - return ZulrahLocation.NORTH; - } - else - { - log.debug("Unknown Zulrah location dx: {}, dy: {}", dx, dy); - return null; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/phase/ZulrahPhase.java b/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/phase/ZulrahPhase.java deleted file mode 100644 index db61a78fdc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/phase/ZulrahPhase.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * Copyright (c) 2017, Devin French - * 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.zulrah.phase; - -import java.awt.Color; -import net.runelite.api.NPC; -import net.runelite.api.Prayer; -import net.runelite.api.coords.LocalPoint; - -public class ZulrahPhase -{ - private static final Color RANGE_COLOR = new Color(150, 255, 0, 100); - private static final Color MAGIC_COLOR = new Color(20, 170, 200, 100); - private static final Color MELEE_COLOR = new Color(180, 50, 20, 100); - private static final Color JAD_COLOR = new Color(255, 115, 0, 100); - - private final ZulrahLocation zulrahLocation; - private final ZulrahType type; - private final boolean jad; - private final StandLocation standLocation; - private final Prayer prayer; - - public ZulrahPhase(ZulrahLocation zulrahLocation, ZulrahType type, boolean jad, StandLocation standLocation, Prayer prayer) - { - this.zulrahLocation = zulrahLocation; - this.type = type; - this.jad = jad; - this.standLocation = standLocation; - this.prayer = prayer; - } - - public static ZulrahPhase valueOf(NPC zulrah, LocalPoint start) - { - ZulrahLocation zulrahLocation = ZulrahLocation.valueOf(start, zulrah.getLocalLocation()); - ZulrahType zulrahType = ZulrahType.valueOf(zulrah.getId()); - if (zulrahLocation == null || zulrahType == null) - { - return null; - } - StandLocation standLocation = zulrahType == ZulrahType.MAGIC ? StandLocation.PILLAR_WEST_OUTSIDE : StandLocation.TOP_EAST; - Prayer prayer = zulrahType == ZulrahType.MAGIC ? Prayer.PROTECT_FROM_MAGIC : null; - return new ZulrahPhase(zulrahLocation, zulrahType, false, standLocation, prayer); - } - - @Override - public String toString() - { - return "ZulrahPhase{" + - "zulrahLocation=" + zulrahLocation + - ", type=" + type + - ", jad=" + jad + - ", standLocation=" + standLocation + - ", prayer=" + prayer + - '}'; - } - - // world location - public LocalPoint getZulrahTile(LocalPoint startTile) - { - // NORTH doesn't need changing because it is the start - switch (zulrahLocation) - { - case SOUTH: - return new LocalPoint(startTile.getX(), startTile.getY() - (11 * 128)); - case EAST: - return new LocalPoint(startTile.getX() + (10 * 128), startTile.getY() - (2 * 128)); - case WEST: - return new LocalPoint(startTile.getX() - (10 * 128), startTile.getY() - (2 * 128)); - } - return startTile; - } - - // world location - public LocalPoint getStandTile(LocalPoint startTile) - { - switch (standLocation) - { - case WEST: - return new LocalPoint(startTile.getX() - (5 * 128), startTile.getY()); - case EAST: - return new LocalPoint(startTile.getX() + (5 * 128), startTile.getY() - (2 * 128)); - case SOUTH: - return new LocalPoint(startTile.getX(), startTile.getY() - (6 * 128)); - case SOUTH_WEST: - return new LocalPoint(startTile.getX() - (4 * 128), startTile.getY() - (4 * 128)); - case SOUTH_EAST: - return new LocalPoint(startTile.getX() + (2 * 128), startTile.getY() - (6 * 128)); - case TOP_EAST: - return new LocalPoint(startTile.getX() + (6 * 128), startTile.getY() + (2 * 128)); - case TOP_WEST: - return new LocalPoint(startTile.getX() - (4 * 128), startTile.getY() + (3 * 128)); - case PILLAR_WEST_INSIDE: - return new LocalPoint(startTile.getX() - (4 * 128), startTile.getY() - (3 * 128)); - case PILLAR_WEST_OUTSIDE: - return new LocalPoint(startTile.getX() - (5 * 128), startTile.getY() - (3 * 128)); - case PILLAR_EAST_INSIDE: - return new LocalPoint(startTile.getX() + (4 * 128), startTile.getY() - (3 * 128)); - case PILLAR_EAST_OUTSIDE: - return new LocalPoint(startTile.getX() + (4 * 128), startTile.getY() - (4 * 128)); - } - return startTile; - } - - public ZulrahType getType() - { - return type; - } - - public boolean isJad() - { - return jad; - } - - public StandLocation getStandLocation() - { - return standLocation; - } - - public Prayer getPrayer() - { - return prayer; - } - - @Override - public boolean equals(Object obj) - { - if (this == obj) - { - return true; - } - if (obj == null || getClass() != obj.getClass()) - { - return false; - } - ZulrahPhase other = (ZulrahPhase) obj; - return this.jad == other.jad && this.zulrahLocation == other.zulrahLocation && this.type == other.type; - } - - public Color getColor() - { - if (jad) - { - return JAD_COLOR; - } - else - { - switch (type) - { - case RANGE: - return RANGE_COLOR; - case MAGIC: - return MAGIC_COLOR; - case MELEE: - return MELEE_COLOR; - } - } - return RANGE_COLOR; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/phase/ZulrahType.java b/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/phase/ZulrahType.java deleted file mode 100644 index 60b6bfb9fb..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/phase/ZulrahType.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2017, Aria - * Copyright (c) 2017, Devin French - * 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.zulrah.phase; - -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.NpcID; - -@Slf4j -public enum ZulrahType -{ - RANGE, MAGIC, MELEE; - - private static final int ZULRAH_RANGE = NpcID.ZULRAH; - private static final int ZULRAH_MELEE = NpcID.ZULRAH_2043; - private static final int ZULRAH_MAGIC = NpcID.ZULRAH_2044; - - public static ZulrahType valueOf(int zulrahId) - { - switch (zulrahId) - { - case ZULRAH_RANGE: - return ZulrahType.RANGE; - case ZULRAH_MELEE: - return ZulrahType.MELEE; - case ZULRAH_MAGIC: - return ZulrahType.MAGIC; - } - log.debug("Unknown Zulrah Id: {}", zulrahId); - return null; - } -} diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/account/login_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/account/login_icon.png deleted file mode 100644 index 66792abe26..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/account/login_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/account/logout_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/account/logout_icon.png deleted file mode 100644 index 863394a335..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/account/logout_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/banktags/tabs/down-arrow.png b/runelite-client/src/main/resources/net/runelite/client/plugins/banktags/tabs/down-arrow.png deleted file mode 100644 index b9f98803c0..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/banktags/tabs/down-arrow.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/banktags/tabs/incinerator.png b/runelite-client/src/main/resources/net/runelite/client/plugins/banktags/tabs/incinerator.png deleted file mode 100644 index 87047a0782..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/banktags/tabs/incinerator.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/banktags/tabs/new-tab.png b/runelite-client/src/main/resources/net/runelite/client/plugins/banktags/tabs/new-tab.png deleted file mode 100644 index d2a1a0c8cf..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/banktags/tabs/new-tab.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/banktags/tabs/tag-tab-active.png b/runelite-client/src/main/resources/net/runelite/client/plugins/banktags/tabs/tag-tab-active.png deleted file mode 100644 index 7e95f0f09a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/banktags/tabs/tag-tab-active.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/banktags/tabs/tag-tab.png b/runelite-client/src/main/resources/net/runelite/client/plugins/banktags/tabs/tag-tab.png deleted file mode 100644 index 815f15f3b6..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/banktags/tabs/tag-tab.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/banktags/tabs/up-arrow.png b/runelite-client/src/main/resources/net/runelite/client/plugins/banktags/tabs/up-arrow.png deleted file mode 100644 index 2b2ed9a4c3..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/banktags/tabs/up-arrow.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/barbarianassault/clock.png b/runelite-client/src/main/resources/net/runelite/client/plugins/barbarianassault/clock.png deleted file mode 100644 index c0f39269e1..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/barbarianassault/clock.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/barbarianassault/fighter.png b/runelite-client/src/main/resources/net/runelite/client/plugins/barbarianassault/fighter.png deleted file mode 100644 index dc3f909ee1..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/barbarianassault/fighter.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/barbarianassault/healer.png b/runelite-client/src/main/resources/net/runelite/client/plugins/barbarianassault/healer.png deleted file mode 100644 index 1938a5abdc..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/barbarianassault/healer.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/barbarianassault/ranger.png b/runelite-client/src/main/resources/net/runelite/client/plugins/barbarianassault/ranger.png deleted file mode 100644 index 662fa27e51..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/barbarianassault/ranger.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/barbarianassault/runner.png b/runelite-client/src/main/resources/net/runelite/client/plugins/barbarianassault/runner.png deleted file mode 100644 index 0b0ab46b9a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/barbarianassault/runner.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/buffed.png b/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/buffed.png deleted file mode 100644 index e325dab318..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/buffed.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/buffedSmall.png b/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/buffedSmall.png deleted file mode 100644 index b204e0c54d..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/buffedSmall.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/debuffed.png b/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/debuffed.png deleted file mode 100644 index f1fe2a758b..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/debuffed.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/debuffedSmall.png b/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/debuffedSmall.png deleted file mode 100644 index 9afe14a537..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/boosts/debuffedSmall.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/bronzeman/item_unlocked.png b/runelite-client/src/main/resources/net/runelite/client/plugins/bronzeman/item_unlocked.png deleted file mode 100644 index a29840aacf..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/bronzeman/item_unlocked.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/cluescrolls/emote.png b/runelite-client/src/main/resources/net/runelite/client/plugins/cluescrolls/emote.png deleted file mode 100644 index 22d496a28c..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/cluescrolls/emote.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/customclientresizing/confirm_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/customclientresizing/confirm_icon.png deleted file mode 100644 index 0a60af0872..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/customclientresizing/confirm_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/customclientresizing/delete_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/customclientresizing/delete_icon.png deleted file mode 100644 index 18b67f23f3..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/customclientresizing/delete_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/customclientresizing/invisible_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/customclientresizing/invisible_icon.png deleted file mode 100644 index a52cbfe0a7..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/customclientresizing/invisible_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/customclientresizing/panel_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/customclientresizing/panel_icon.png deleted file mode 100644 index 01e73df506..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/customclientresizing/panel_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/customclientresizing/visible_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/customclientresizing/visible_icon.png deleted file mode 100644 index 5c4232c808..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/customclientresizing/visible_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-armadyl-godsword.png b/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-armadyl-godsword.png deleted file mode 100644 index 090a7f1688..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-armadyl-godsword.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-bandos-godsword.png b/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-bandos-godsword.png deleted file mode 100644 index 35c461811d..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-bandos-godsword.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-dragon-dagger-p.png b/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-dragon-dagger-p.png deleted file mode 100644 index 86f1751afa..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-dragon-dagger-p.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-dragon-dagger.png b/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-dragon-dagger.png deleted file mode 100644 index 9a59c1753c..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-dragon-dagger.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-dragon-scimitar.png b/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-dragon-scimitar.png deleted file mode 100644 index b1a4bd230c..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-dragon-scimitar.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-mouse.png b/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-mouse.png deleted file mode 100644 index 93614a72d2..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-mouse.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-rs3-gold.png b/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-rs3-gold.png deleted file mode 100644 index ee89a5b05a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-rs3-gold.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-rs3-silver.png b/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-rs3-silver.png deleted file mode 100644 index 7415625a2f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-rs3-silver.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-saradomin-godsword.png b/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-saradomin-godsword.png deleted file mode 100644 index 5cec961365..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-saradomin-godsword.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-skill-specs.png b/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-skill-specs.png deleted file mode 100644 index 468dc4bdf7..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-skill-specs.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-trout.png b/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-trout.png deleted file mode 100644 index b32ddf0ea1..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-trout.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-zamorak-godsword.png b/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-zamorak-godsword.png deleted file mode 100644 index 0917c41b90..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/cursor-zamorak-godsword.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/specs-rage.wav b/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/specs-rage.wav deleted file mode 100644 index eb9c7b82c4..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/customcursor/specs-rage.wav and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/devtools/devtools_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/devtools/devtools_icon.png deleted file mode 100644 index f2f319dbed..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/devtools/devtools_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/discord/discord.png b/runelite-client/src/main/resources/net/runelite/client/plugins/discord/discord.png deleted file mode 100644 index 2474cfb868..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/discord/discord.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/LICENSE b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/LICENSE deleted file mode 100644 index 9e2a9503a0..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/LICENSE +++ /dev/null @@ -1 +0,0 @@ -The images in this folder are derivatives of "twemoji" (https://github.com/twitter/twemoji) by "Twitter, Inc", used under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). The derivatives are licensed under the same license. \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/alien.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/alien.png deleted file mode 100644 index 12b5cbca06..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/alien.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/blush.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/blush.png deleted file mode 100644 index ed24b9dbd5..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/blush.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/broken_heart.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/broken_heart.png deleted file mode 100644 index e2859dba83..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/broken_heart.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/cat.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/cat.png deleted file mode 100644 index e3e3538d6e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/cat.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/confused.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/confused.png deleted file mode 100644 index d959e8398c..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/confused.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/cooking.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/cooking.png deleted file mode 100644 index e4a0e27005..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/cooking.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/cowboy.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/cowboy.png deleted file mode 100644 index ed6f1f0363..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/cowboy.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/crab.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/crab.png deleted file mode 100644 index b4a48a1167..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/crab.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/cry.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/cry.png deleted file mode 100644 index d13487b948..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/cry.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/dancer.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/dancer.png deleted file mode 100644 index 0b12afc22a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/dancer.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/dog.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/dog.png deleted file mode 100644 index 03c0a78f01..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/dog.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/eggplant.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/eggplant.png deleted file mode 100644 index f235821f5a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/eggplant.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/expressionless.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/expressionless.png deleted file mode 100644 index 1796dfd73e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/expressionless.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/eyes.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/eyes.png deleted file mode 100644 index 21bb1e8efc..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/eyes.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/facepalm.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/facepalm.png deleted file mode 100644 index 00c3ddb525..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/facepalm.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/fire.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/fire.png deleted file mode 100644 index 6d11acee7a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/fire.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/fish.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/fish.png deleted file mode 100644 index c836cb5ac6..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/fish.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/flushed.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/flushed.png deleted file mode 100644 index 9afe0d1488..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/flushed.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/fork_and_knife.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/fork_and_knife.png deleted file mode 100644 index f82589d6c3..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/fork_and_knife.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/frowning2.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/frowning2.png deleted file mode 100644 index d0de7f47a4..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/frowning2.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/grinning.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/grinning.png deleted file mode 100644 index 1c2d82ebd5..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/grinning.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/heart_eyes.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/heart_eyes.png deleted file mode 100644 index 8e025d4ed0..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/heart_eyes.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/hearts.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/hearts.png deleted file mode 100644 index 0582043360..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/hearts.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/hugging.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/hugging.png deleted file mode 100644 index 4c3f94b269..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/hugging.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/hushed.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/hushed.png deleted file mode 100644 index 388f4f8721..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/hushed.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/innocent.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/innocent.png deleted file mode 100644 index a77d4f5ac2..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/innocent.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/joy.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/joy.png deleted file mode 100644 index 2d4ded730a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/joy.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/kissing.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/kissing.png deleted file mode 100644 index c4040f250f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/kissing.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/neutral_face.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/neutral_face.png deleted file mode 100644 index 6ba2512285..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/neutral_face.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/ok_hand.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/ok_hand.png deleted file mode 100644 index 99c51e94b0..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/ok_hand.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/open_mouth.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/open_mouth.png deleted file mode 100644 index b6f009127e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/open_mouth.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/party_popper.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/party_popper.png deleted file mode 100644 index 9bac2f0392..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/party_popper.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/persevere.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/persevere.png deleted file mode 100644 index afe426b889..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/persevere.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/pile_of_poo.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/pile_of_poo.png deleted file mode 100644 index e9e83eda20..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/pile_of_poo.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/rage.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/rage.png deleted file mode 100644 index e3e64935d7..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/rage.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/scream.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/scream.png deleted file mode 100644 index 7c1fa0cb34..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/scream.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/see_no_evil.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/see_no_evil.png deleted file mode 100644 index 8ee29a9fb3..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/see_no_evil.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/slight_frown.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/slight_frown.png deleted file mode 100644 index 1b0666d2c5..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/slight_frown.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/slight_smile.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/slight_smile.png deleted file mode 100644 index d39cf23163..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/slight_smile.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/smile.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/smile.png deleted file mode 100644 index 557bdb8f12..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/smile.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/smiling_imp.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/smiling_imp.png deleted file mode 100644 index 63794794d3..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/smiling_imp.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/sob.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/sob.png deleted file mode 100644 index 1ddd81f279..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/sob.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/stuck_out_tongue.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/stuck_out_tongue.png deleted file mode 100644 index 92843ef1e9..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/stuck_out_tongue.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/stuck_out_tongue_closed_eyes.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/stuck_out_tongue_closed_eyes.png deleted file mode 100644 index 380ab6b8e0..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/stuck_out_tongue_closed_eyes.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/sunglasses.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/sunglasses.png deleted file mode 100644 index 0c790e10e1..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/sunglasses.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/sweat.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/sweat.png deleted file mode 100644 index cf40fea206..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/sweat.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/thinking.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/thinking.png deleted file mode 100644 index 309caf9c8b..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/thinking.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/thumbsdown.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/thumbsdown.png deleted file mode 100644 index 570187cf73..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/thumbsdown.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/thumbsup.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/thumbsup.png deleted file mode 100644 index 610c3ee976..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/thumbsup.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/triumph.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/triumph.png deleted file mode 100644 index 71f4927cbe..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/triumph.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/unamused.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/unamused.png deleted file mode 100644 index 5dd59bcc01..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/unamused.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/wave.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/wave.png deleted file mode 100644 index 1a747c8fc7..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/wave.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/wink.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/wink.png deleted file mode 100644 index b56b3cd5e0..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/wink.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/yum.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/yum.png deleted file mode 100644 index 21bdb0a00f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/yum.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/zipper_mouth.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/zipper_mouth.png deleted file mode 100644 index ecad41ede6..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/zipper_mouth.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/zzz.png b/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/zzz.png deleted file mode 100644 index 3072dfc9f1..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/emojis/zzz.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/equipmentinspector/normal.png b/runelite-client/src/main/resources/net/runelite/client/plugins/equipmentinspector/normal.png deleted file mode 100644 index 613f95e46d..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/equipmentinspector/normal.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/feed/icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/feed/icon.png deleted file mode 100644 index 40c046d833..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/feed/icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/feed/osrs.png b/runelite-client/src/main/resources/net/runelite/client/plugins/feed/osrs.png deleted file mode 100644 index f1eef592ad..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/feed/osrs.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/feed/runelite.png b/runelite-client/src/main/resources/net/runelite/client/plugins/feed/runelite.png deleted file mode 100644 index cbe9361b40..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/feed/runelite.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/freezetimers/freeze.png b/runelite-client/src/main/resources/net/runelite/client/plugins/freezetimers/freeze.png deleted file mode 100644 index 12b6928900..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/freezetimers/freeze.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/freezetimers/freezeimmune.png b/runelite-client/src/main/resources/net/runelite/client/plugins/freezetimers/freezeimmune.png deleted file mode 100644 index bdfa3c9445..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/freezetimers/freezeimmune.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/freezetimers/teleblock.png b/runelite-client/src/main/resources/net/runelite/client/plugins/freezetimers/teleblock.png deleted file mode 100644 index b04586b676..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/freezetimers/teleblock.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/freezetimers/teleblockimmune.png b/runelite-client/src/main/resources/net/runelite/client/plugins/freezetimers/teleblockimmune.png deleted file mode 100644 index 79514a7d3c..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/freezetimers/teleblockimmune.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/freezetimers/veng.png b/runelite-client/src/main/resources/net/runelite/client/plugins/freezetimers/veng.png deleted file mode 100644 index 3d652e504f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/freezetimers/veng.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gauntlet/protect_from_magic.png b/runelite-client/src/main/resources/net/runelite/client/plugins/gauntlet/protect_from_magic.png deleted file mode 100644 index b71e1d395f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/gauntlet/protect_from_magic.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gauntlet/protect_from_missiles.png b/runelite-client/src/main/resources/net/runelite/client/plugins/gauntlet/protect_from_missiles.png deleted file mode 100644 index 210e0ff6d6..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/gauntlet/protect_from_missiles.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common.glsl deleted file mode 100644 index 55c3b9e6c3..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common.glsl +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2018, 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. - */ - -#include to_screen.glsl - -/* - * Rotate a vertex by a given orientation in JAU - */ -ivec4 rotate(ivec4 vertex, int orientation) { - ivec2 sinCos = sinCosTable[orientation]; - int s = sinCos.x; - int c = sinCos.y; - int x = vertex.z * s + vertex.x * c >> 16; - int z = vertex.z * c - vertex.x * s >> 16; - return ivec4(x, vertex.y, z, vertex.w); -} - -/* - * Calculate the distance to a vertex given the camera angle - */ -int distance(ivec4 vertex, int cameraYaw, int cameraPitch) { - int yawSin = int(65536.0f * sin(cameraYaw * UNIT)); - int yawCos = int(65536.0f * cos(cameraYaw * UNIT)); - - int pitchSin = int(65536.0f * sin(cameraPitch * UNIT)); - int pitchCos = int(65536.0f * cos(cameraPitch * UNIT)); - - int j = vertex.z * yawCos - vertex.x * yawSin >> 16; - int l = vertex.y * pitchSin + j * pitchCos >> 16; - - return l; -} - -/* - * Calculate the distance to a face - */ -int face_distance(ivec4 vA, ivec4 vB, ivec4 vC, int cameraYaw, int cameraPitch) { - int dvA = distance(vA, cameraYaw, cameraPitch); - int dvB = distance(vB, cameraYaw, cameraPitch); - int dvC = distance(vC, cameraYaw, cameraPitch); - int faceDistance = (dvA + dvB + dvC) / 3; - return faceDistance; -} - -/* - * Test if a face is visible (not backward facing) - */ -bool face_visible(ivec4 vA, ivec4 vB, ivec4 vC, ivec4 position, int cameraYaw, int cameraPitch, int centerX, int centerY, int zoom) { - // Move model to scene location, and account for camera offset - ivec4 cameraPos = ivec4(cameraX, cameraY, cameraZ, 0); - vA += position - cameraPos; - vB += position - cameraPos; - vC += position - cameraPos; - - vec3 sA = toScreen(vA.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); - vec3 sB = toScreen(vB.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); - vec3 sC = toScreen(vC.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); - - return (sA.x - sB.x) * (sC.y - sB.y) - (sC.x - sB.x) * (sA.y - sB.y) > 0; -} diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common_func.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common_func.glsl deleted file mode 100644 index cde151872a..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common_func.glsl +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2018, 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. - */ - -#include to_screen.glsl - -/* - * Rotate a vertex by a given orientation in JAU - */ -ivec4 rotate(ivec4 vertex, int orientation) { - ivec2 sinCos = sinCosTable[orientation]; - int s = sinCos.x; - int c = sinCos.y; - int x = vertex.z * s + vertex.x * c >> 16; - int z = vertex.z * c - vertex.x * s >> 16; - return ivec4(x, vertex.y, z, vertex.w); -} - -/* - * Calculate the distance to a vertex given the camera angle - */ -int distance(ivec4 vertex, int cameraYaw, int cameraPitch) { - int yawSin = int(65536.0f * sin(cameraYaw * UNIT)); - int yawCos = int(65536.0f * cos(cameraYaw * UNIT)); - - int pitchSin = int(65536.0f * sin(cameraPitch * UNIT)); - int pitchCos = int(65536.0f * cos(cameraPitch * UNIT)); - - int j = vertex.z * yawCos - vertex.x * yawSin >> 16; - int l = vertex.y * pitchSin + j * pitchCos >> 16; - - return l; -} - -/* - * Calculate the distance to a face - */ -int face_distance(ivec4 vA, ivec4 vB, ivec4 vC, int cameraYaw, int cameraPitch) { - int dvA = distance(vA, cameraYaw, cameraPitch); - int dvB = distance(vB, cameraYaw, cameraPitch); - int dvC = distance(vC, cameraYaw, cameraPitch); - int faceDistance = (dvA + dvB + dvC) / 3; - return faceDistance; -} - -/* - * Test if a face is visible (not backward facing) - */ -bool face_visible(ivec4 vA, ivec4 vB, ivec4 vC, ivec4 position, int cameraYaw, int cameraPitch, int centerX, int centerY, int zoom) { - // Move model to scene location, and account for camera offset - ivec4 cameraPos = ivec4(cameraX, cameraY, cameraZ, 0); - vA += position - cameraPos; - vB += position - cameraPos; - vC += position - cameraPos; - - vec3 sA = toScreen(vA.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); - vec3 sB = toScreen(vB.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); - vec3 sC = toScreen(vC.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom); - - return (sA.x - sB.x) * (sC.y - sB.y) - (sC.x - sB.x) * (sA.y - sB.y) > 0; -} \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp.glsl deleted file mode 100644 index 1045bed629..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp.glsl +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2018, 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. - */ - -#include version_header - -shared int totalNum[12]; // number of faces with a given priority -shared int totalDistance[12]; // sum of distances to faces of a given priority - -shared int totalMappedNum[18]; // number of faces with a given adjusted priority - -shared int min10; // minimum distance to a face of priority 10 -shared int dfs[4096]; // packed face id and distance - -#include comp_common.glsl - -layout(local_size_x = 1024) in; - -#include common_func.glsl -#include priority_render.glsl - -void main() { - uint groupId = gl_WorkGroupID.x; - uint localId = gl_LocalInvocationID.x * 4; - modelinfo minfo = ol[groupId]; - int length = minfo.length; - - if (localId == 0) { - min10 = 1600; - for (int i = 0; i < 12; ++i) { - totalNum[i] = 0; - totalDistance[i] = 0; - } - for (int i = 0; i < 18; ++i) { - totalMappedNum[i] = 0; - } - } - - memoryBarrierShared(); - barrier(); - - int prio1, dis1, prio1Adj; - ivec4 vA1, vA2, vA3; - - int prio2, dis2, prio2Adj; - ivec4 vB1, vB2, vB3; - - int prio3, dis3, prio3Adj; - ivec4 vC1, vC2, vC3; - - int prio4, dis4, prio4Adj; - ivec4 vD1, vD2, vD3; - - get_face(localId, minfo, cameraYaw, cameraPitch, centerX, centerY, zoom, prio1, dis1, vA1, vA2, vA3); - get_face(localId + 1, minfo, cameraYaw, cameraPitch, centerX, centerY, zoom, prio2, dis2, vB1, vB2, vB3); - get_face(localId + 2, minfo, cameraYaw, cameraPitch, centerX, centerY, zoom, prio3, dis3, vC1, vC2, vC3); - get_face(localId + 3, minfo, cameraYaw, cameraPitch, centerX, centerY, zoom, prio4, dis4, vD1, vD2, vD3); - - memoryBarrierShared(); - barrier(); - - int idx1 = map_face_priority(localId, minfo, prio1, dis1, prio1Adj); - int idx2 = map_face_priority(localId + 1, minfo, prio2, dis2, prio2Adj); - int idx3 = map_face_priority(localId + 2, minfo, prio3, dis3, prio3Adj); - int idx4 = map_face_priority(localId + 3, minfo, prio4, dis4, prio4Adj); - - memoryBarrierShared(); - barrier(); - - insert_dfs(localId , minfo, prio1Adj, dis1, idx1); - insert_dfs(localId + 1, minfo, prio2Adj, dis2, idx2); - insert_dfs(localId + 2, minfo, prio3Adj, dis3, idx3); - insert_dfs(localId + 3, minfo, prio4Adj, dis4, idx4); - - memoryBarrierShared(); - barrier(); - - sort_and_insert(localId , minfo, prio1Adj, dis1, vA1, vA2, vA3); - sort_and_insert(localId + 1, minfo, prio2Adj, dis2, vB1, vB2, vB3); - sort_and_insert(localId + 2, minfo, prio3Adj, dis3, vC1, vC2, vC3); - sort_and_insert(localId + 3, minfo, prio4Adj, dis4, vD1, vD2, vD3); -} \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp_common.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp_common.glsl deleted file mode 100644 index c527a942c3..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp_common.glsl +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2018, 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. - */ - - #define PI 3.1415926535897932384626433832795f - #define UNIT PI / 1024.0f - - layout(std140) uniform uniforms { - int cameraYaw; - int cameraPitch; - int centerX; - int centerY; - int zoom; - int cameraX; - int cameraY; - int cameraZ; - ivec2 sinCosTable[2048]; - }; - - struct modelinfo { - int offset; // offset into buffer - int uvOffset; // offset into uv buffer - int length; // length in faces - int idx; // write idx in target buffer - int flags; // radius, orientation - int x; // scene position x - int y; // scene position y - int z; // scene position z - }; - - layout(std430, binding = 0) readonly buffer modelbuffer_in { - modelinfo ol[]; - }; - - layout(std430, binding = 1) readonly buffer vertexbuffer_in { - ivec4 vb[]; - }; - - layout(std430, binding = 2) readonly buffer tempvertexbuffer_in { - ivec4 tempvb[]; - }; - - layout(std430, binding = 3) writeonly buffer vertex_out { - ivec4 vout[]; - }; - - layout(std430, binding = 4) writeonly buffer uv_out { - vec4 uvout[]; - }; - - layout(std430, binding = 5) readonly buffer uvbuffer_in { - vec4 uv[]; - }; - - layout(std430, binding = 6) readonly buffer tempuvbuffer_in { - vec4 tempuv[]; - }; \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp_small.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp_small.glsl deleted file mode 100644 index 462da4b45b..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp_small.glsl +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2018, 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. - */ - -#include version_header - -shared int totalNum[12]; // number of faces with a given priority -shared int totalDistance[12]; // sum of distances to faces of a given priority - -shared int totalMappedNum[18]; // number of faces with a given adjusted priority - -shared int min10; // minimum distance to a face of priority 10 -shared int dfs[512]; // packed face id and distance - -#include comp_common.glsl - -layout(local_size_x = 512) in; - -#include common_func.glsl -#include priority_render.glsl - -void main() { - uint groupId = gl_WorkGroupID.x; - uint localId = gl_LocalInvocationID.x; - modelinfo minfo = ol[groupId]; - - if (localId == 0) { - min10 = 1600; - for (int i = 0; i < 12; ++i) { - totalNum[i] = 0; - totalDistance[i] = 0; - } - for (int i = 0; i < 18; ++i) { - totalMappedNum[i] = 0; - } - } - - memoryBarrierShared(); - barrier(); - - int prio1, dis1, prio1Adj; - ivec4 vA1, vA2, vA3; - - get_face(localId, minfo, cameraYaw, cameraPitch, centerX, centerY, zoom, prio1, dis1, vA1, vA2, vA3); - - memoryBarrierShared(); - barrier(); - - int idx1 = map_face_priority(localId, minfo, prio1, dis1, prio1Adj); - - memoryBarrierShared(); - barrier(); - - insert_dfs(localId, minfo, prio1Adj, dis1, idx1); - - memoryBarrierShared(); - barrier(); - - sort_and_insert(localId, minfo, prio1Adj, dis1, vA1, vA2, vA3); -} \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp_unordered.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp_unordered.glsl deleted file mode 100644 index ae3a8d26e0..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/comp_unordered.glsl +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2018, 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. - */ - -#include version_header - -#include comp_common.glsl - -layout(local_size_x = 6) in; - -#include common_func.glsl - -void main() { - uint groupId = gl_WorkGroupID.x; - uint localId = gl_LocalInvocationID.x; - modelinfo minfo = ol[groupId]; - - int offset = minfo.offset; - int length = minfo.length; - int outOffset = minfo.idx; - int uvOffset = minfo.uvOffset; - int flags = minfo.flags; - int orientation = flags & 0x7ff; - ivec4 pos = ivec4(minfo.x, minfo.y, minfo.z, 0); - - if (localId >= length) { - return; - } - - uint ssboOffset = localId; - ivec4 thisA, thisB, thisC; - - // Grab triangle vertices from the correct buffer - if (flags < 0) { - thisA = vb[offset + ssboOffset * 3 ]; - thisB = vb[offset + ssboOffset * 3 + 1]; - thisC = vb[offset + ssboOffset * 3 + 2]; - } else { - thisA = tempvb[offset + ssboOffset * 3 ]; - thisB = tempvb[offset + ssboOffset * 3 + 1]; - thisC = tempvb[offset + ssboOffset * 3 + 2]; - } - - ivec4 thisrvA = rotate(thisA, orientation); - ivec4 thisrvB = rotate(thisB, orientation); - ivec4 thisrvC = rotate(thisC, orientation); - - uint myOffset = localId; - - // position vertices in scene and write to out buffer - vout[outOffset + myOffset * 3] = pos + thisrvA; - vout[outOffset + myOffset * 3 + 1] = pos + thisrvB; - vout[outOffset + myOffset * 3 + 2] = pos + thisrvC; - - if (uvOffset < 0) { - uvout[outOffset + myOffset * 3] = vec4(0, 0, 0, 0); - uvout[outOffset + myOffset * 3 + 1] = vec4(0, 0, 0, 0); - uvout[outOffset + myOffset * 3 + 2] = vec4(0, 0, 0, 0); - } else if (flags >= 0) { - uvout[outOffset + myOffset * 3] = tempuv[uvOffset + localId * 3]; - uvout[outOffset + myOffset * 3 + 1] = tempuv[uvOffset + localId * 3 + 1]; - uvout[outOffset + myOffset * 3 + 2] = tempuv[uvOffset + localId * 3 + 2]; - } else { - uvout[outOffset + myOffset * 3] = uv[uvOffset + localId * 3]; - uvout[outOffset + myOffset * 3 + 1] = uv[uvOffset + localId * 3 + 1]; - uvout[outOffset + myOffset * 3 + 2] = uv[uvOffset + localId * 3 + 2]; - } -} \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/frag.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/frag.glsl deleted file mode 100644 index 8bf3f58522..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/frag.glsl +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2018, 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. - */ -#version 330 - -uniform sampler2DArray textures; -uniform vec2 textureOffsets[64]; -uniform float brightness; -uniform float smoothBanding; -uniform vec4 fogColor; -uniform bool ambientLighting; -vec3 mixedColor; - -in vec4 Color; -centroid in float fHsl; -in vec4 fUv; -in float fogAmount; - -out vec4 FragColor; - -#include hsl_to_rgb.glsl - -void main() { - float n = fUv.x; - - int hsl = int(fHsl); - vec3 rgb = hslToRgb(hsl) * smoothBanding + Color.rgb * (1.f - smoothBanding); - vec4 smoothColor = vec4(rgb, Color.a); - - if (n > 0.0) { - n -= 1.0; - int textureIdx = int(n); - - vec2 uv = fUv.yz; - vec2 animatedUv = uv + textureOffsets[textureIdx]; - - vec4 textureColor = texture(textures, vec3(animatedUv, n)); - vec4 textureColorBrightness = pow(textureColor, vec4(brightness, brightness, brightness, 1.0f)); - - smoothColor = textureColorBrightness * smoothColor; - } - if(ambientLighting == true) { - mixedColor = mix(smoothColor.rgb, vec3((fogColor.r-fogColor.r/10),(fogColor.g-fogColor.g/10),(fogColor.b-fogColor.b/10)), fogAmount); - mixedColor = mixedColor+vec3(fogColor.r/10, fogColor.g/10, fogColor.b/10); - } - if(ambientLighting == false) { - mixedColor = mix(smoothColor.rgb, fogColor.rgb, fogAmount); - } - FragColor = vec4(mixedColor, smoothColor.a); -} diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/fragui.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/fragui.glsl deleted file mode 100644 index b002a853f0..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/fragui.glsl +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2018, 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. - */ -#version 330 - -uniform sampler2D tex; - -#define SAMPLING_DEFAULT 0 -#define SAMPLING_MITCHELL 1 -#define SAMPLING_CATROM 2 -#define SAMPLING_XBR 3 -uniform int samplingMode; -uniform ivec2 sourceDimensions; -uniform ivec2 targetDimensions; - -#include scale/bicubic.glsl -#include scale/xbr_lv2_frag.glsl - -in vec2 TexCoord; -in XBRTable xbrTable; - -out vec4 FragColor; - -void main() { - vec4 c; - - if (samplingMode == SAMPLING_DEFAULT) { - c = texture(tex, TexCoord); - } else if (samplingMode == SAMPLING_CATROM || samplingMode == SAMPLING_MITCHELL) { - c = textureCubic(tex, TexCoord, samplingMode); - } else if (samplingMode == SAMPLING_XBR) { - c = textureXBR(tex, TexCoord, xbrTable, ceil(1.0 * targetDimensions.x / sourceDimensions.x)); - } - - FragColor = c; -} diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/geom.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/geom.glsl deleted file mode 100644 index 0f7f1bad23..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/geom.glsl +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2018, 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. - */ - -#version 330 - -#define PI 3.1415926535897932384626433832795f -#define UNIT PI / 1024.0f - -layout(triangles) in; -layout(triangle_strip, max_vertices = 3) out; - -layout(std140) uniform uniforms { - int cameraYaw; - int cameraPitch; - int centerX; - int centerY; - int zoom; - int cameraX; - int cameraY; - int cameraZ; - ivec2 sinCosTable[2048]; -}; - -uniform mat4 projectionMatrix; - -in ivec3 vPosition[]; -in vec4 vColor[]; -in float vHsl[]; -in vec4 vUv[]; -in float vFogAmount[]; - -out vec4 Color; -centroid out float fHsl; -out vec4 fUv; -out float fogAmount; - -#include to_screen.glsl - -void main() { - ivec3 cameraPos = ivec3(cameraX, cameraY, cameraZ); - vec3 screenA = toScreen(vPosition[0] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom); - vec3 screenB = toScreen(vPosition[1] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom); - vec3 screenC = toScreen(vPosition[2] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom); - - if (-screenA.z < 50 || -screenB.z < 50 || -screenC.z < 50) { - // the client does not draw a triangle if any vertex distance is <50 - return; - } - - vec4 tmp = vec4(screenA.xyz, 1.0); - Color = vColor[0]; - fHsl = vHsl[0]; - fUv = vUv[0]; - fogAmount = vFogAmount[0]; - gl_Position = projectionMatrix * tmp; - EmitVertex(); - - tmp = vec4(screenB.xyz, 1.0); - Color = vColor[1]; - fHsl = vHsl[1]; - fUv = vUv[1]; - fogAmount = vFogAmount[1]; - gl_Position = projectionMatrix * tmp; - EmitVertex(); - - tmp = vec4(screenC.xyz, 1.0); - Color = vColor[2]; - fHsl = vHsl[2]; - fUv = vUv[2]; - fogAmount = vFogAmount[2]; - gl_Position = projectionMatrix * tmp; - EmitVertex(); - - EndPrimitive(); -} diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/hsl_to_rgb.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/hsl_to_rgb.glsl deleted file mode 100644 index 762d1ea591..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/hsl_to_rgb.glsl +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2018, 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. - */ - -vec3 hslToRgb(int hsl) { - int var5 = hsl / 128; - float var6 = float(var5 >> 3) / 64.0f + 0.0078125f; - float var8 = float(var5 & 7) / 8.0f + 0.0625f; - - int var10 = hsl % 128; - - float var11 = float(var10) / 128.0f; - float var13 = var11; - float var15 = var11; - float var17 = var11; - - if(var8 != 0.0f) { - float var19; - if(var11 < 0.5f) { - var19 = var11 * (1.0f + var8); - } else { - var19 = var11 + var8 - var11 * var8; - } - - float var21 = 2.0f * var11 - var19; - float var23 = var6 + 0.3333333333333333f; - if(var23 > 1.0f) { - var23 -= 1.f; - } - - float var27 = var6 - 0.3333333333333333f; - if(var27 < 0.0f) { - var27 += 1.f; - } - - if(6.0f * var23 < 1.0f) { - var13 = var21 + (var19 - var21) * 6.0f * var23; - } else if(2.0f * var23 < 1.0f) { - var13 = var19; - } else if(3.0f * var23 < 2.0f) { - var13 = var21 + (var19 - var21) * (0.6666666666666666f - var23) * 6.0f; - } else { - var13 = var21; - } - - if(6.0f * var6 < 1.0f) { - var15 = var21 + (var19 - var21) * 6.0f * var6; - } else if(2.0f * var6 < 1.0f) { - var15 = var19; - } else if(3.0f * var6 < 2.0f) { - var15 = var21 + (var19 - var21) * (0.6666666666666666f - var6) * 6.0f; - } else { - var15 = var21; - } - - if(6.0f * var27 < 1.0f) { - var17 = var21 + (var19 - var21) * 6.0f * var27; - } else if(2.0f * var27 < 1.0f) { - var17 = var19; - } else if(3.0f * var27 < 2.0f) { - var17 = var21 + (var19 - var21) * (0.6666666666666666f - var27) * 6.0f; - } else { - var17 = var21; - } - } - - vec3 rgb = vec3( - pow(var13, brightness), - pow(var15, brightness), - pow(var17, brightness) - ); - - // I don't think we actually need this - if (rgb == vec3(0, 0, 0)) { - rgb = vec3(0, 0, 1/255.f); - } - - return rgb; -} \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/priority_render.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/priority_render.glsl deleted file mode 100644 index 865b32e645..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/priority_render.glsl +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright (c) 2018, 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. - */ - -// Calculate adjusted priority for a face with a given priority, distance, and -// model global min10 and face distance averages. This allows positioning faces -// with priorities 10/11 into the correct 'slots' resulting in 18 possible -// adjusted priorities -int priority_map(int p, int distance, int _min10, int avg1, int avg2, int avg3) { - // (10, 11) 0 1 2 (10, 11) 3 4 (10, 11) 5 6 7 8 9 (10, 11) - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 - switch (p) { - case 0: return 2; - case 1: return 3; - case 2: return 4; - case 3: return 7; - case 4: return 8; - case 5: return 11; - case 6: return 12; - case 7: return 13; - case 8: return 14; - case 9: return 15; - case 10: - if (distance > avg1) { - return 0; - } else if (distance > avg2) { - return 5; - } else if (distance > avg3) { - return 9; - } else { - return 16; - } - case 11: - if (distance > avg1 && _min10 > avg1) { - return 1; - } else if (distance > avg2 && (_min10 > avg1 || _min10 > avg2)) { - return 6; - } else if (distance > avg3 && (_min10 > avg1 || _min10 > avg2 || _min10 > avg3)) { - return 10; - } else { - return 17; - } - default: - return -1; - } - return -1; -} - -// calculate the number of faces with a lower adjusted priority than -// the given adjusted priority -int count_prio_offset(int priority) { - int total = 0; - switch (priority) { - case 17: - total += totalMappedNum[16]; - case 16: - total += totalMappedNum[15]; - case 15: - total += totalMappedNum[14]; - case 14: - total += totalMappedNum[13]; - case 13: - total += totalMappedNum[12]; - case 12: - total += totalMappedNum[11]; - case 11: - total += totalMappedNum[10]; - case 10: - total += totalMappedNum[9]; - case 9: - total += totalMappedNum[8]; - case 8: - total += totalMappedNum[7]; - case 7: - total += totalMappedNum[6]; - case 6: - total += totalMappedNum[5]; - case 5: - total += totalMappedNum[4]; - case 4: - total += totalMappedNum[3]; - case 3: - total += totalMappedNum[2]; - case 2: - total += totalMappedNum[1]; - case 1: - total += totalMappedNum[0]; - case 0: - return total; - } - return total; -} - -void get_face(uint localId, modelinfo minfo, int cameraYaw, int cameraPitch, int centerX, int centerY, int zoom, - out int prio, out int dis, out ivec4 o1, out ivec4 o2, out ivec4 o3) { - int offset = minfo.offset; - int length = minfo.length; - int flags = minfo.flags; - int radius = (flags & 0x7fffffff) >> 12; - int orientation = flags & 0x7ff; - ivec4 pos = ivec4(minfo.x, minfo.y, minfo.z, 0); - - uint ssboOffset; - - if (localId < length) { - ssboOffset = localId; - } else { - ssboOffset = 0; - } - - ivec4 thisA; - ivec4 thisB; - ivec4 thisC; - - // Grab triangle vertices from the correct buffer - if (flags < 0) { - thisA = vb[offset + ssboOffset * 3 ]; - thisB = vb[offset + ssboOffset * 3 + 1]; - thisC = vb[offset + ssboOffset * 3 + 2]; - } else { - thisA = tempvb[offset + ssboOffset * 3 ]; - thisB = tempvb[offset + ssboOffset * 3 + 1]; - thisC = tempvb[offset + ssboOffset * 3 + 2]; - } - - ivec4 thisrvA; - ivec4 thisrvB; - ivec4 thisrvC; - - int thisPriority, thisDistance; - - if (localId < length) { - // rotate for model orientation - thisrvA = rotate(thisA, orientation); - thisrvB = rotate(thisB, orientation); - thisrvC = rotate(thisC, orientation); - - // calculate distance to face - thisPriority = (thisA.w >> 16) & 0xff; // all vertices on the face have the same priority - if (radius == 0) { - thisDistance = 0; - } else { - thisDistance = face_distance(thisrvA, thisrvB, thisrvC, cameraYaw, cameraPitch) + radius; - } - - // if the face is not culled, it is calculated into priority distance averages - if (face_visible(thisrvA, thisrvB, thisrvC, pos, cameraYaw, cameraPitch, centerX, centerY, zoom)) { - atomicAdd(totalNum[thisPriority], 1); - atomicAdd(totalDistance[thisPriority], thisDistance); - - // calculate minimum distance to any face of priority 10 for positioning the 11 faces later - if (thisPriority == 10) { - atomicMin(min10, thisDistance); - } - } - - o1 = thisrvA; - o2 = thisrvB; - o3 = thisrvC; - - prio = thisPriority; - dis = thisDistance; - } else { - prio = 0; - dis = 0; - } -} - -int map_face_priority(uint localId, modelinfo minfo, int thisPriority, int thisDistance, out int prio) { - int length = minfo.length; - - // Compute average distances for 0/2, 3/4, and 6/8 - - int adjPrio; - int prioIdx; - - if (localId < length) { - int avg1 = 0; - int avg2 = 0; - int avg3 = 0; - - if (totalNum[1] > 0 || totalNum[2] > 0) { - avg1 = (totalDistance[1] + totalDistance[2]) / (totalNum[1] + totalNum[2]); - } - - if (totalNum[3] > 0 || totalNum[4] > 0) { - avg2 = (totalDistance[3] + totalDistance[4]) / (totalNum[3] + totalNum[4]); - } - - if (totalNum[6] > 0 || totalNum[8] > 0) { - avg3 = (totalDistance[6] + totalDistance[8]) / (totalNum[6] + totalNum[8]); - } - - int _min10 = min10; - adjPrio = priority_map(thisPriority, thisDistance, _min10, avg1, avg2, avg3); - - int prioIdx = atomicAdd(totalMappedNum[adjPrio], 1); - - prio = adjPrio; - - return prioIdx; - } - - return 0; -} - -void insert_dfs(uint localId, modelinfo minfo, int adjPrio, int distance, int prioIdx) { - int length = minfo.length; - - if (localId < length) { - // calculate base offset into dfs based on number of faces with a lower priority - int baseOff = count_prio_offset(adjPrio); - // store into face array offset array by unique index - dfs[baseOff + prioIdx] = (int(localId) << 16) | distance; - } -} - -void sort_and_insert(uint localId, modelinfo minfo, int thisPriority, int thisDistance, ivec4 thisrvA, ivec4 thisrvB, ivec4 thisrvC) { - /* compute face distance */ - int length = minfo.length; - int outOffset = minfo.idx; - int uvOffset = minfo.uvOffset; - int flags = minfo.flags; - ivec4 pos = ivec4(minfo.x, minfo.y, minfo.z, 0); - - int start, end, myOffset; - if (localId < length) { - const int priorityOffset = count_prio_offset(thisPriority); - const int numOfPriority = totalMappedNum[thisPriority]; - start = priorityOffset; // index of first face with this priority - end = priorityOffset + numOfPriority; // index of last face with this priority - myOffset = priorityOffset; - } else { - start = end = myOffset = 0; - } - - if (localId < length) { - // we only have to order faces against others of the same priority - // calculate position this face will be in - for (int i = start; i < end; ++i) { - int d1 = dfs[i]; - int theirId = d1 >> 16; - int theirDistance = d1 & 0xffff; - - // the closest faces draw last, so have the highest index - // if two faces have the same distance, the one with the - // higher id draws last - if ((theirDistance > thisDistance) - || (theirDistance == thisDistance && theirId < localId)) { - ++myOffset; - } - } - - // position vertices in scene and write to out buffer - vout[outOffset + myOffset * 3] = pos + thisrvA; - vout[outOffset + myOffset * 3 + 1] = pos + thisrvB; - vout[outOffset + myOffset * 3 + 2] = pos + thisrvC; - - if (uvOffset < 0) { - uvout[outOffset + myOffset * 3] = vec4(0, 0, 0, 0); - uvout[outOffset + myOffset * 3 + 1] = vec4(0, 0, 0, 0); - uvout[outOffset + myOffset * 3 + 2] = vec4(0, 0, 0, 0); - } else if (flags >= 0) { - uvout[outOffset + myOffset * 3] = tempuv[uvOffset + localId * 3]; - uvout[outOffset + myOffset * 3 + 1] = tempuv[uvOffset + localId * 3 + 1]; - uvout[outOffset + myOffset * 3 + 2] = tempuv[uvOffset + localId * 3 + 2]; - } else { - uvout[outOffset + myOffset * 3] = uv[uvOffset + localId * 3]; - uvout[outOffset + myOffset * 3 + 1] = uv[uvOffset + localId * 3 + 1]; - uvout[outOffset + myOffset * 3 + 2] = uv[uvOffset + localId * 3 + 2]; - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/scale/bicubic.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/scale/bicubic.glsl deleted file mode 100644 index 52901db107..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/scale/bicubic.glsl +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2019 logarrhythmic - * 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. - */ - -// General case cubic filter -float cubic_custom(float x, float b, float c) { - /* A generalized cubic filter as described by Mitchell and Netravali is defined by the piecewise equation: - * if abs(x) < 1 - * y = 1/6 * ( (12 - 9b - 6c) * abs(x)^3 + (-18 + 12b + 6c) * abs(x)^2 + (6 - 2b) ) - * if abs(x) >= 1 and < 2 - * y = 1/6 * ( (-1b - 6c) * abs(x)^3 + (6b + 30c) * abs(x)^2 + (-12b - 48c) * abs(x) + (8b + 24c) ) - * otherwise - * y = 0 - * This produces a bell curve centered on 0 with a width of 2. - */ - - float t = abs(x); // absolute value of the x coordinate - float t2 = t * t; // t squared - float t3 = t * t * t; // t cubed - - if (t < 1) { // This part defines the [-1,1] region of the curve. - return 1.0/6 * ((12 - 9 * b - 6 * c) * t3 + (-18 + 12 * b + 6 * c) * t2 + (6 - 2 * b)); - } else if (t < 2) { // This part defines the [-2,-1] and [1,2] regions. - return 1.0/6 * ((-1 * b - 6 * c) * t3 + (6 * b + 30 * c) * t2 + (-12 * b - 48 * c) * t + (8 * b + 24 * c)); - } - - // Outside of [-2,2], the value is 0. - return float(0); -} - -// Cubic filter with Catmull-Rom parameters -float catmull_rom(float x) { - /* - * Generally favorable results in image upscaling are given by a cubic filter with the values b = 0 and c = 0.5. - * This is known as the Catmull-Rom filter, and it closely approximates Jinc upscaling with Lanczos input values. - * Placing these values into the piecewise equation gives us a more compact representation of: - * y = 1.5 * abs(x)^3 - 2.5 * abs(x)^2 + 1 // abs(x) < 1 - * y = -0.5 * abs(x)^3 + 2.5 * abs(x)^2 - 4 * abs(x) + 2 // 1 <= abs(x) < 2 - */ - - float t = abs(x); - float t2 = t * t; - float t3 = t * t * t; - - if (t < 1) { - return 1.5 * t3 - 2.5 * t2 + 1; - } else if (t < 2) { - return -0.5 * t3 + 2.5 * t2 - 4 * t + 2; - } - - return float(0); -} - -float mitchell(float x) { - /* - * This is another cubic filter with less aggressive sharpening than Catmull-Rom, which some users may prefer. - * B = 1/3, C = 1/3. - */ - - float t = abs(x); - float t2 = t * t; - float t3 = t * t * t; - - if (t < 1) { - return 7.0/6 * t3 + -2 * t2 + 8.0/9; - } else if (t < 2) { - return -7.0/18 * t3 + 2 * t2 - 10.0/3 * t + 16.0/9; - } - - return float(0); -} - -#define CR_AR_STRENGTH 0.9 - -#define FLT_MAX 3.402823466e+38 -#define FLT_MIN 1.175494351e-38 - -// Calculates the distance between two points -float d(vec2 pt1, vec2 pt2) { - vec2 v = pt2 - pt1; - return sqrt(dot(v,v)); -} - -// Samples a texture using a 4x4 kernel. -vec4 textureCubic(sampler2D sampler, vec2 texCoords, int mode){ - vec2 texSize = textureSize(sampler, 0); - vec2 texelSize = 1.0 / texSize; - texCoords *= texSize; - texCoords -= 0.5; - - vec4 nSum = vec4( 0.0, 0.0, 0.0, 0.0 ); - vec4 nDenom = vec4( 0.0, 0.0, 0.0, 0.0 ); - - ivec2 texelCoords = ivec2(floor(texCoords)); - vec2 coordFract = fract(texCoords); - - vec4 c; - - if (mode == SAMPLING_CATROM) { - // catrom benefits from anti-ringing, which requires knowledge of the minimum and maximum samples in the kernel - vec4 min_sample = vec4(FLT_MAX); - vec4 max_sample = vec4(FLT_MIN); - for (int m = -1; m <= 2; m++) { - for (int n = -1; n <= 2; n++) { - // get the raw texel, bypassing any other filters - vec4 vecData = texelFetch(sampler, texelCoords + ivec2(m, n), 0); - - // update min and max as we go - min_sample = min(min_sample, vecData); - max_sample = max(max_sample, vecData); - - // calculate weight based on distance of the current texel offset from the sub-texel position of the sampling location - float w = catmull_rom( d(vec2(m, n), coordFract) ); - - // build the weighted average - nSum += vecData * w; - nDenom += w; - } - } - // calculate weighted average - c = nSum / nDenom; - - // store value before anti-ringing - vec4 aux = c; - // anti-ringing: clamp the color value so that it cannot exceed values already present in the kernel area - c = clamp(c, min_sample, max_sample); - // mix according to anti-ringing strength - c = mix(aux, c, CR_AR_STRENGTH); - } else if (mode == SAMPLING_MITCHELL) { - for (int m = -1; m <= 2; m++) { - for (int n = -1; n <= 2; n++) { - // get the raw texel, bypassing any other filters - vec4 vecData = texelFetch(sampler, texelCoords + ivec2(m, n), 0); - - // calculate weight based on distance of the current texel offset from the sub-texel position of the sampling location - float w = mitchell( d(vec2(m, n), coordFract) ); - - // build the weighted average - nSum += vecData * w; - nDenom += w; - } - } - // calculate weighted average - c = nSum / nDenom; - } - - // return the weighted average - return c; -} diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/scale/xbr_lv2_common.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/scale/xbr_lv2_common.glsl deleted file mode 100644 index bf8c406b29..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/scale/xbr_lv2_common.glsl +++ /dev/null @@ -1,36 +0,0 @@ -/* - Hyllian's xBR-lv2 Shader - - Copyright (C) 2011-2016 Hyllian - sergiogdb@gmail.com - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - - Incorporates some of the ideas from SABR shader. Thanks to Joshua Street. -*/ - -struct XBRTable { - vec2 texCoord; - vec4 t1; - vec4 t2; - vec4 t3; - vec4 t4; - vec4 t5; - vec4 t6; - vec4 t7; -}; \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/scale/xbr_lv2_frag.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/scale/xbr_lv2_frag.glsl deleted file mode 100644 index 1abdf6a99f..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/scale/xbr_lv2_frag.glsl +++ /dev/null @@ -1,232 +0,0 @@ -/* - Hyllian's xBR-lv2 Shader - - Copyright (C) 2011-2016 Hyllian - sergiogdb@gmail.com - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - - Incorporates some of the ideas from SABR shader. Thanks to Joshua Street. -*/ - -// PARAMETERS // -// Uncomment just one of the four params below to choose the corner detection -//#define CORNER_A -//#define CORNER_B -#define CORNER_C -//#define CORNER_D - -#define XBR_Y_WEIGHT 50.0 // involved in preserving small details if small_details = 1, otherwise unused -#define XBR_EQ_THRESHOLD 9.0 // equality threshold for comparisons -//#define XBR_LV1_COEFFICIENT 0.5 // unused, probably left over from a previous iteration -#define XBR_LV2_COEFFICIENT 2.0 // moves the step in a step function at one point during blending -#define small_details 1.0 // 0 or 1, switches logic in a few spots to help preserve small details -// END PARAMETERS // - -#define mul(a,b) (b*a) -#define lv2_cf XBR_LV2_COEFFICIENT -#ifndef CORNER_A -#define SMOOTH_TIPS -#endif - -//const float coef = 2.0; // unused -const vec3 rgbw = vec3(14.352, 28.176, 5.472); // rgb weights -//const vec4 eq_threshold = vec4(15.0, 15.0, 15.0, 15.0); // unused - -const vec4 Ao = vec4( 1.0, -1.0, -1.0, 1.0 ); -const vec4 Bo = vec4( 1.0, 1.0, -1.0,-1.0 ); -const vec4 Co = vec4( 1.5, 0.5, -0.5, 0.5 ); -const vec4 Ax = vec4( 1.0, -1.0, -1.0, 1.0 ); -const vec4 Bx = vec4( 0.5, 2.0, -0.5,-2.0 ); -const vec4 Cx = vec4( 1.0, 1.0, -0.5, 0.0 ); -const vec4 Ay = vec4( 1.0, -1.0, -1.0, 1.0 ); -const vec4 By = vec4( 2.0, 0.5, -2.0,-0.5 ); -const vec4 Cy = vec4( 2.0, 0.0, -1.0, 0.5 ); -const vec4 Ci = vec4(0.25, 0.25, 0.25, 0.25); - -const vec3 Y = vec3(0.2126, 0.7152, 0.0722); // rec.709 luma weights - -// Difference between vector components. -vec4 df(vec4 A, vec4 B) { - return vec4(abs(A-B)); -} - -// Compare two vectors and return their components are different. -vec4 diff(vec4 A, vec4 B) { - return vec4(notEqual(A, B)); -} - -// Determine if two vector components are equal based on a threshold. -vec4 eq(vec4 A, vec4 B) { - return (step(df(A, B), vec4(XBR_EQ_THRESHOLD))); -} - -// Determine if two vector components are NOT equal based on a threshold. -vec4 neq(vec4 A, vec4 B) { - return (vec4(1.0, 1.0, 1.0, 1.0) - eq(A, B)); -} - -// Weighted distance. -vec4 wd(vec4 a, vec4 b, vec4 c, vec4 d, vec4 e, vec4 f, vec4 g, vec4 h) { - return (df(a,b) + df(a,c) + df(d,e) + df(d,f) + 4.0*df(g,h)); -} - -vec4 weighted_distance(vec4 a, vec4 b, vec4 c, vec4 d, vec4 e, vec4 f, vec4 g, vec4 h, vec4 i, vec4 j, vec4 k, vec4 l) { - return (df(a,b) + df(a,c) + df(d,e) + df(d,f) + df(i,j) + df(k,l) + 2.0*df(g,h)); -} - -float c_df(vec3 c1, vec3 c2) { - vec3 df = abs(c1 - c2); - return df.r + df.g + df.b; -} - -#include scale/xbr_lv2_common.glsl - -// xBR-level2 upscaler. Level 2 means it detects edges in 2 directions, instead of just 1 in the most basic form of the algorithm. -// This improves quality by a good bit without adding too much complexity compared to available level-3 and level-4 algorithms. -vec4 textureXBR(sampler2D image, vec2 texCoord, XBRTable t, float scale) { - vec4 delta = vec4(1.0/scale, 1.0/scale, 1.0/scale, 1.0/scale); - vec4 delta_l = vec4(0.5/scale, 1.0/scale, 0.5/scale, 1.0/scale); - vec4 delta_u = delta_l.yxwz; - - vec2 textureDimensions = textureSize(image, 0); - - vec4 edri, edr, edr_l, edr_u, px; // px = pixel, edr = edge detection rule - vec4 irlv0, irlv1, irlv2l, irlv2u, block_3d; - vec4 fx, fx_l, fx_u; // inequations of straight lines. - - vec2 fp = fract(texCoord*textureDimensions); - - // A1 B1 C1 - // A0 A B C C4 - // D0 D E F F4 - // G0 G H I I4 - // G5 H5 I5 - vec4 A1 = texture(image, t.t1.xw ); - vec4 B1 = texture(image, t.t1.yw ); - vec4 C1 = texture(image, t.t1.zw ); - vec4 A = texture(image, t.t2.xw ); - vec4 B = texture(image, t.t2.yw ); - vec4 C = texture(image, t.t2.zw ); - vec4 D = texture(image, t.t3.xw ); - vec4 E = texture(image, t.t3.yw ); - vec4 F = texture(image, t.t3.zw ); - vec4 G = texture(image, t.t4.xw ); - vec4 H = texture(image, t.t4.yw ); - vec4 I = texture(image, t.t4.zw ); - vec4 G5 = texture(image, t.t5.xw ); - vec4 H5 = texture(image, t.t5.yw ); - vec4 I5 = texture(image, t.t5.zw ); - vec4 A0 = texture(image, t.t6.xy ); - vec4 D0 = texture(image, t.t6.xz ); - vec4 G0 = texture(image, t.t6.xw ); - vec4 C4 = texture(image, t.t7.xy ); - vec4 F4 = texture(image, t.t7.xz ); - vec4 I4 = texture(image, t.t7.xw ); - - vec4 b = vec4(dot(B.xyz ,rgbw), dot(D.xyz ,rgbw), dot(H.xyz ,rgbw), dot(F.xyz ,rgbw)); - vec4 c = vec4(dot(C.xyz ,rgbw), dot(A.xyz ,rgbw), dot(G.xyz ,rgbw), dot(I.xyz ,rgbw)); - vec4 d = b.yzwx; - vec4 e = vec4(dot(E.xyz,rgbw)); - vec4 f = b.wxyz; - vec4 g = c.zwxy; - vec4 h = b.zwxy; - vec4 i = c.wxyz; - - vec4 i4, i5, h5, f4; - - float y_weight = XBR_Y_WEIGHT; - - if (small_details < 0.5) { - i4 = vec4(dot(I4.xyz,rgbw), dot(C1.xyz,rgbw), dot(A0.xyz,rgbw), dot(G5.xyz,rgbw)); - i5 = vec4(dot(I5.xyz,rgbw), dot(C4.xyz,rgbw), dot(A1.xyz,rgbw), dot(G0.xyz,rgbw)); - h5 = vec4(dot(H5.xyz,rgbw), dot(F4.xyz,rgbw), dot(B1.xyz,rgbw), dot(D0.xyz,rgbw)); - } else { - i4 = mul(mat4x3(I4.xyz, C1.xyz, A0.xyz, G5.xyz), y_weight * Y); - i5 = mul(mat4x3(I5.xyz, C4.xyz, A1.xyz, G0.xyz), y_weight * Y); - h5 = mul(mat4x3(H5.xyz, F4.xyz, B1.xyz, D0.xyz), y_weight * Y); - } - - // These inequations define the line below which interpolation occurs. - fx = (Ao*fp.y+Bo*fp.x); - fx_l = (Ax*fp.y+Bx*fp.x); - fx_u = (Ay*fp.y+By*fp.x); - - // corner detection - irlv1 = irlv0 = diff(e,f) * diff(e,h); - #ifdef CORNER_B - irlv1 = (irlv0 * ( neq(f,b) * neq(h,d) + eq(e,i) * neq(f,i4) * neq(h,i5) + eq(e,g) + eq(e,c) ) ); - #endif - #ifdef CORNER_D - vec4 c1 = i4.yzwx; - vec4 g0 = i5.wxyz; - irlv1 = (irlv0 * ( neq(f,b) * neq(h,d) + eq(e,i) * neq(f,i4) * neq(h,i5) + eq(e,g) + eq(e,c) ) * (diff(f,f4) * diff(f,i) + diff(h,h5) * diff(h,i) + diff(h,g) + diff(f,c) + eq(b,c1) * eq(d,g0))); - #endif - #ifdef CORNER_C - irlv1 = (irlv0 * ( neq(f,b) * neq(f,c) + neq(h,d) * neq(h,g) + eq(e,i) * (neq(f,f4) * neq(f,i4) + neq(h,h5) * neq(h,i5)) + eq(e,g) + eq(e,c)) ); - #endif - - // corner detection in the other direction - irlv2l = diff(e,g) * diff(d,g); - irlv2u = diff(e,c) * diff(b,c); - - vec4 fx45i = clamp((fx + delta -Co - Ci)/(2.0*delta ), 0.0, 1.0); - vec4 fx45 = clamp((fx + delta -Co )/(2.0*delta ), 0.0, 1.0); - vec4 fx30 = clamp((fx_l + delta_l -Cx )/(2.0*delta_l), 0.0, 1.0); - vec4 fx60 = clamp((fx_u + delta_u -Cy )/(2.0*delta_u), 0.0, 1.0); - - vec4 wd1, wd2; - if (small_details < 0.5) { - wd1 = wd( e, c, g, i, h5, f4, h, f); - wd2 = wd( h, d, i5, f, i4, b, e, i); - } else { - wd1 = weighted_distance( e, c, g, i, f4, h5, h, f, b, d, i4, i5); - wd2 = weighted_distance( h, d, i5, f, b, i4, e, i, g, h5, c, f4); - } - - edri = step(wd1, wd2) * irlv0; - edr = step(wd1 + vec4(0.1, 0.1, 0.1, 0.1), wd2) * step(vec4(0.5, 0.5, 0.5, 0.5), irlv1); - edr_l = step( lv2_cf*df(f,g), df(h,c) ) * irlv2l * edr; - edr_u = step( lv2_cf*df(h,c), df(f,g) ) * irlv2u * edr; - - fx45 = edr * fx45; - fx30 = edr_l * fx30; - fx60 = edr_u * fx60; - fx45i = edri * fx45i; - - px = step(df(e,f), df(e,h)); - - #ifdef SMOOTH_TIPS - vec4 maximos = max(max(fx30, fx60), max(fx45, fx45i)); - #endif - #ifndef SMOOTH_TIPS - vec4 maximos = max(max(fx30, fx60), fx45); - #endif - - vec4 res1 = E; - res1 = mix(res1, mix(H, F, px.x), maximos.x); - res1 = mix(res1, mix(B, D, px.z), maximos.z); - - vec4 res2 = E; - res2 = mix(res2, mix(F, B, px.y), maximos.y); - res2 = mix(res2, mix(D, H, px.w), maximos.w); - - vec4 res = mix(res1, res2, step(c_df(E.xyz, res1.xyz), c_df(E.xyz, res2.xyz))); - - return res; -} \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/scale/xbr_lv2_vert.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/scale/xbr_lv2_vert.glsl deleted file mode 100644 index d138d18433..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/scale/xbr_lv2_vert.glsl +++ /dev/null @@ -1,53 +0,0 @@ -/* - Hyllian's xBR-lv2 Shader - - Copyright (C) 2011-2016 Hyllian - sergiogdb@gmail.com - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - - Incorporates some of the ideas from SABR shader. Thanks to Joshua Street. -*/ - -#include scale/xbr_lv2_common.glsl - -XBRTable xbr_vert(vec2 texCoord, ivec2 sourceDimensions) { - float dx = (1.0/sourceDimensions.x); - float dy = (1.0/sourceDimensions.y); - - // Define coordinates to optimize later fetching of adjacent pixels - // A1 B1 C1 - // A0 A B C C4 - // D0 D E F F4 - // G0 G H I I4 - // G5 H5 I5 - XBRTable tab = XBRTable( - texCoord, - texCoord.xxxy + vec4( -dx, 0, dx,-2.0*dy), // A1 B1 C1 - texCoord.xxxy + vec4( -dx, 0, dx, -dy), // A B C - texCoord.xxxy + vec4( -dx, 0, dx, 0), // D E F - texCoord.xxxy + vec4( -dx, 0, dx, dy), // G H I - texCoord.xxxy + vec4( -dx, 0, dx, 2.0*dy), // G5 H5 I5 - texCoord.xyyy + vec4(-2.0*dx,-dy, 0, dy), // A0 D0 G0 - texCoord.xyyy + vec4( 2.0*dx,-dy, 0, dy) // C4 F4 I4 - ); - - tab.texCoord.x *= 1.00000001; - - return tab; -} \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/to_screen.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/to_screen.glsl deleted file mode 100644 index 1e9e63428d..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/to_screen.glsl +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2018, 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. - */ - -/* - * Convert a vertex to screen space - */ -vec3 toScreen(ivec3 vertex, int cameraYaw, int cameraPitch, int centerX, int centerY, int zoom) { - float yawSin = sin(cameraYaw * UNIT); - float yawCos = cos(cameraYaw * UNIT); - - float pitchSin = sin(cameraPitch * UNIT); - float pitchCos = cos(cameraPitch * UNIT); - - float rotatedX = (vertex.z * yawSin) + (vertex.x * yawCos); - float rotatedZ = (vertex.z * yawCos) - (vertex.x * yawSin); - - float var13 = (vertex.y * pitchCos) - (rotatedZ * pitchSin); - float var12 = (vertex.y * pitchSin) + (rotatedZ * pitchCos); - - float x = rotatedX * zoom / var12 + centerX; - float y = var13 * zoom / var12 + centerY; - float z = -var12; // in OpenGL depth is negative - - return vec3(x, y, z); -} diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/vert.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/vert.glsl deleted file mode 100644 index 9e61fc7cb0..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/vert.glsl +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2018, 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. - */ - -#version 330 - -#define TILE_SIZE 128 - -#define FOG_SCENE_EDGE_MIN TILE_SIZE -#define FOG_SCENE_EDGE_MAX (103 * TILE_SIZE) - -layout (location = 0) in ivec4 VertexPosition; -layout (location = 1) in vec4 uv; - -layout(std140) uniform uniforms { - int cameraYaw; - int cameraPitch; - int centerX; - int centerY; - int zoom; - int cameraX; - int cameraY; - int cameraZ; - ivec2 sinCosTable[2048]; -}; - -uniform float brightness; -uniform int useFog; -uniform float fogDepth; -uniform float fogCornerRadius; -uniform float fogDensity; -uniform int drawDistance; - -out ivec3 vPosition; -out vec4 vColor; -out float vHsl; -out vec4 vUv; -out float vFogAmount; - -#include hsl_to_rgb.glsl - -float fogFactorCurved(const float dist, const float start, const float end, const float accel) { - return 1.0 - pow(clamp((dist - start) / (end - start), 0.0, 1.0), accel); -} - -// Returns the distance to the closest edge -float minEdgeDistance(vec3 v1, vec4 bounds){ - return min(min(v1.x - bounds.x, bounds.y - v1.x), min(v1.z - bounds.z, bounds.w - v1.z)); -} - -float roundedRectangleFunction(vec3 v1, vec4 bounds, float cornerRadius){ - float minXDistance = min(v1.x - bounds.x, bounds.y - v1.x); - float minZDistance = min(v1.z - bounds.z, bounds.w - v1.z); - - if (minXDistance < cornerRadius && minZDistance < cornerRadius) - { - return cornerRadius - sqrt( pow(minXDistance - cornerRadius, 2) + pow(minZDistance - cornerRadius, 2) ); - } - else - { - return min(minXDistance, minZDistance); - } -} - -void main() -{ - ivec3 vertex = VertexPosition.xyz; - int ahsl = VertexPosition.w; - int hsl = ahsl & 0xffff; - float a = float(ahsl >> 24 & 0xff) / 255.f; - - vec3 rgb = hslToRgb(hsl); - - vPosition = vertex; - vColor = vec4(rgb, 1.f - a); - vHsl = float(hsl); - vUv = uv; - - int fogWest = max(FOG_SCENE_EDGE_MIN, cameraX - drawDistance); - int fogEast = min(FOG_SCENE_EDGE_MAX, cameraX + drawDistance - TILE_SIZE); - int fogSouth = max(FOG_SCENE_EDGE_MIN, cameraZ - drawDistance); - int fogNorth = min(FOG_SCENE_EDGE_MAX, cameraZ + drawDistance - TILE_SIZE); - - float fogDistance = roundedRectangleFunction(vPosition, vec4(fogWest, fogEast, fogSouth, fogNorth), fogCornerRadius); - vFogAmount = fogFactorCurved(fogDistance, 0, fogDepth, fogDensity) * useFog; -} \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/vertui.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/vertui.glsl deleted file mode 100644 index 02bc315e86..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/vertui.glsl +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2018, 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. - */ -#version 330 - -#define SAMPLING_DEFAULT 0 -#define SAMPLING_MITCHELL 1 -#define SAMPLING_CATROM 2 -#define SAMPLING_XBR 3 -uniform int samplingMode; -uniform ivec2 sourceDimensions; -uniform ivec2 targetDimensions; - -#include scale/xbr_lv2_vert.glsl - -layout (location = 0) in vec3 aPos; -layout (location = 1) in vec2 aTexCoord; - -out vec2 TexCoord; -out XBRTable xbrTable; - -void main() -{ - gl_Position = vec4(aPos, 1.0); - TexCoord = aTexCoord; - - if (samplingMode == SAMPLING_XBR) - xbrTable = xbr_vert(TexCoord, sourceDimensions); -} diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/grandexchange/ge_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/grandexchange/ge_icon.png deleted file mode 100644 index c92e3978d5..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/grandexchange/ge_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/grandexchange/ge_limits.json b/runelite-client/src/main/resources/net/runelite/client/plugins/grandexchange/ge_limits.json deleted file mode 100644 index 4cf59280db..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/grandexchange/ge_limits.json +++ /dev/null @@ -1 +0,0 @@ -{"2":7000,"6":70,"8":70,"10":70,"12":70,"28":15,"30":15,"36":40,"39":10000,"40":10000,"41":10000,"42":10000,"43":10000,"44":10000,"45":11000,"46":11000,"47":11000,"48":10000,"50":10000,"52":7000,"53":7000,"54":10000,"56":10000,"58":10000,"60":10000,"62":10000,"64":10000,"66":10000,"68":10000,"70":10000,"72":10000,"91":10000,"93":10000,"95":10000,"97":10000,"99":10000,"101":10000,"103":10000,"105":10000,"107":10000,"109":10000,"111":10000,"113":2000,"115":2000,"117":2000,"119":2000,"121":2000,"123":2000,"125":2000,"127":2000,"129":2000,"131":2000,"133":2000,"135":2000,"137":2000,"139":2000,"141":2000,"143":2000,"145":2000,"147":2000,"149":2000,"151":2000,"153":2000,"155":2000,"157":2000,"159":2000,"161":2000,"163":2000,"165":2000,"167":2000,"169":2000,"171":2000,"173":2000,"175":2000,"177":2000,"179":2000,"181":2000,"183":2000,"185":2000,"187":2000,"189":2000,"191":2000,"193":2000,"197":2000,"199":13000,"201":13000,"203":13000,"205":13000,"207":11000,"209":13000,"211":13000,"213":13000,"215":11000,"217":11000,"219":11000,"221":13000,"223":13000,"225":13000,"227":13000,"229":13000,"231":13000,"233":40,"235":13000,"237":13000,"239":13000,"241":13000,"243":13000,"245":11000,"247":13000,"249":13000,"251":13000,"253":13000,"255":13000,"257":11000,"259":13000,"261":13000,"263":13000,"265":11000,"267":11000,"269":11000,"272":15,"273":15,"288":15,"299":18000,"301":40,"303":40,"305":40,"307":40,"309":40,"311":40,"313":8000,"314":13000,"315":6000,"317":15000,"319":15000,"321":13000,"325":6000,"327":15000,"329":6000,"331":15000,"333":6000,"335":15000,"339":6000,"341":15000,"345":15000,"347":6000,"349":15000,"351":6000,"353":15000,"355":6000,"359":15000,"361":6000,"363":15000,"365":6000,"371":15000,"373":6000,"377":15000,"379":6000,"383":15000,"385":10000,"389":15000,"391":10000,"395":15000,"397":10000,"401":13000,"403":13000,"405":50,"407":11000,"411":11000,"413":11000,"426":150,"428":150,"434":13000,"436":13000,"438":13000,"440":13000,"442":13000,"444":13000,"447":13000,"449":4500,"451":4500,"453":13000,"464":2000,"526":3000,"528":3000,"530":3000,"532":3000,"534":3000,"536":7500,"538":125,"540":125,"542":125,"544":125,"546":125,"548":125,"554":20000,"555":20000,"556":20000,"557":20000,"558":12000,"559":12000,"560":10000,"561":12000,"562":12000,"563":12000,"564":12000,"565":10000,"566":10000,"567":10000,"569":10000,"571":10000,"573":10000,"575":10000,"577":125,"579":125,"581":125,"590":40,"592":13000,"596":40,"621":18000,"626":150,"628":150,"630":150,"632":150,"634":150,"636":150,"638":150,"640":150,"642":150,"644":150,"646":150,"648":150,"650":150,"652":150,"654":150,"656":150,"658":150,"660":150,"662":150,"664":150,"712":2000,"740":150,"751":150,"753":15,"800":7000,"801":7000,"802":7000,"803":7000,"804":11000,"805":11000,"806":7000,"807":7000,"808":7000,"809":7000,"810":11000,"811":11000,"812":7000,"813":7000,"814":7000,"815":7000,"816":11000,"817":11000,"819":13000,"820":13000,"821":13000,"822":13000,"823":11000,"824":11000,"825":7000,"826":7000,"827":7000,"828":7000,"829":11000,"830":11000,"831":7000,"832":7000,"833":7000,"834":7000,"835":11000,"836":7000,"837":125,"839":18000,"841":18000,"843":18000,"845":18000,"847":18000,"849":18000,"851":18000,"853":18000,"855":18000,"857":18000,"859":18000,"861":18000,"863":7000,"864":7000,"865":7000,"866":7000,"867":11000,"868":11000,"869":7000,"870":7000,"871":7000,"872":7000,"873":7000,"874":7000,"875":11000,"876":7000,"877":7000,"878":11000,"879":11000,"880":11000,"881":7000,"882":7000,"883":7000,"884":7000,"885":7000,"886":7000,"887":7000,"888":7000,"889":7000,"890":11000,"891":11000,"892":11000,"893":11000,"946":40,"948":18000,"950":18000,"952":40,"954":250,"958":18000,"960":13000,"962":50,"970":13000,"972":13000,"973":13000,"975":15,"981":5,"983":15,"985":11000,"987":11000,"989":11000,"991":11000,"993":11000,"1005":150,"1007":150,"1009":150,"1011":150,"1013":150,"1015":150,"1017":125,"1019":150,"1021":150,"1023":150,"1025":150,"1027":150,"1029":150,"1031":150,"1033":15,"1035":15,"1038":5,"1040":5,"1042":5,"1044":5,"1046":5,"1048":5,"1050":5,"1053":5,"1055":5,"1057":5,"1059":125,"1061":125,"1063":125,"1065":125,"1067":125,"1069":125,"1071":125,"1073":125,"1075":125,"1077":125,"1079":70,"1081":125,"1083":125,"1085":125,"1087":125,"1089":125,"1091":125,"1093":70,"1095":125,"1097":125,"1099":125,"1101":125,"1103":125,"1105":125,"1107":125,"1109":125,"1111":125,"1113":70,"1115":125,"1117":125,"1119":125,"1121":125,"1123":125,"1125":125,"1127":70,"1129":125,"1131":125,"1133":125,"1135":125,"1137":125,"1139":125,"1141":125,"1143":125,"1145":125,"1147":70,"1149":8,"1151":125,"1153":125,"1155":125,"1157":125,"1159":125,"1161":125,"1163":70,"1165":125,"1167":125,"1169":125,"1171":125,"1173":125,"1175":125,"1177":125,"1179":125,"1181":125,"1183":125,"1185":70,"1187":70,"1189":125,"1191":125,"1193":125,"1195":125,"1197":125,"1199":125,"1201":70,"1203":125,"1205":125,"1207":125,"1209":125,"1211":125,"1213":70,"1215":70,"1217":125,"1219":125,"1221":125,"1223":125,"1225":125,"1227":125,"1229":70,"1231":70,"1233":125,"1237":125,"1239":125,"1241":125,"1243":125,"1245":125,"1247":70,"1249":70,"1251":125,"1253":125,"1255":125,"1257":125,"1259":125,"1261":70,"1263":70,"1265":40,"1267":40,"1269":40,"1271":40,"1273":40,"1275":40,"1277":125,"1279":125,"1281":125,"1283":125,"1285":125,"1287":125,"1289":70,"1291":125,"1293":125,"1295":125,"1297":125,"1299":125,"1301":125,"1303":70,"1305":70,"1307":125,"1309":125,"1311":125,"1313":125,"1315":125,"1317":125,"1319":70,"1321":125,"1323":125,"1325":125,"1327":125,"1329":125,"1331":125,"1333":70,"1335":125,"1337":125,"1339":125,"1341":125,"1343":125,"1345":125,"1347":70,"1349":40,"1351":40,"1353":40,"1355":40,"1357":40,"1359":40,"1361":40,"1363":125,"1365":125,"1367":125,"1369":125,"1371":125,"1373":70,"1375":125,"1377":70,"1379":125,"1381":125,"1383":125,"1385":125,"1387":125,"1389":125,"1391":11000,"1393":18000,"1395":18000,"1397":18000,"1399":18000,"1401":18000,"1403":18000,"1405":18000,"1407":18000,"1420":125,"1422":125,"1424":125,"1426":125,"1428":125,"1430":125,"1432":70,"1434":70,"1436":20000,"1438":11000,"1440":11000,"1442":11000,"1444":11000,"1446":11000,"1448":11000,"1452":11000,"1454":11000,"1456":11000,"1462":11000,"1464":18000,"1465":2000,"1470":11000,"1472":11000,"1474":11000,"1476":11000,"1478":5,"1487":13000,"1511":15000,"1513":12000,"1515":12000,"1517":15000,"1519":15000,"1521":15000,"1523":250,"1539":13000,"1540":125,"1550":11000,"1552":15,"1573":15,"1592":40,"1595":40,"1597":40,"1599":40,"1601":11000,"1603":13000,"1605":13000,"1607":13000,"1609":13000,"1611":13000,"1613":11000,"1615":11000,"1617":10000,"1619":10000,"1621":10000,"1623":10000,"1625":10000,"1627":10000,"1629":10000,"1631":10000,"1635":18000,"1637":10000,"1639":10000,"1641":10000,"1643":10000,"1645":10000,"1654":18000,"1656":18000,"1658":18000,"1660":18000,"1662":18000,"1664":10000,"1673":18000,"1675":10000,"1677":10000,"1679":10000,"1681":10000,"1683":10000,"1692":18000,"1694":10000,"1696":10000,"1698":10000,"1700":10000,"1702":10000,"1704":10000,"1712":10000,"1714":10000,"1716":10000,"1718":125,"1720":10000,"1722":10000,"1724":125,"1725":125,"1727":125,"1729":125,"1731":125,"1733":40,"1734":18000,"1735":40,"1737":13000,"1739":13000,"1741":13000,"1743":13000,"1745":13000,"1747":11000,"1749":11000,"1751":13000,"1753":13000,"1755":40,"1757":40,"1759":13000,"1761":13000,"1763":150,"1765":150,"1767":150,"1769":150,"1771":150,"1773":150,"1775":13000,"1777":13000,"1779":13000,"1781":13000,"1783":13000,"1785":40,"1787":10000,"1789":10000,"1791":10000,"1793":11000,"1794":15,"1823":2000,"1831":10000,"1833":150,"1835":150,"1837":150,"1841":15,"1854":18000,"1859":11000,"1861":11000,"1865":11000,"1869":11000,"1871":11000,"1873":11000,"1875":11000,"1877":11000,"1879":11000,"1881":11000,"1883":10000,"1885":10000,"1887":40,"1891":6000,"1897":6000,"1905":2000,"1907":2000,"1909":2000,"1911":2000,"1913":2000,"1915":2000,"1917":2000,"1919":10000,"1921":13000,"1923":13000,"1925":13000,"1927":13000,"1929":13000,"1931":13000,"1933":13000,"1935":13000,"1937":13000,"1939":13000,"1941":13000,"1942":13000,"1944":13000,"1947":13000,"1949":150,"1951":13000,"1953":13000,"1955":13000,"1957":13000,"1959":50,"1961":50,"1963":13000,"1965":6000,"1969":50,"1971":6000,"1973":13000,"1975":13000,"1978":2000,"1980":13000,"1982":13000,"1985":13000,"1987":13000,"1989":50,"1993":6000,"2003":10000,"2007":11000,"2011":10000,"2015":13000,"2017":13000,"2019":13000,"2021":13000,"2023":15,"2025":40,"2026":13000,"2028":2000,"2030":2000,"2032":2000,"2034":2000,"2036":2000,"2038":2000,"2040":2000,"2048":2000,"2054":2000,"2064":2000,"2074":2000,"2080":2000,"2084":2000,"2092":2000,"2102":13000,"2104":13000,"2106":13000,"2108":13000,"2110":13000,"2112":13000,"2114":13000,"2116":13000,"2118":13000,"2120":13000,"2122":13000,"2124":13000,"2126":13000,"2128":13000,"2130":13000,"2132":13000,"2134":13000,"2136":13000,"2138":13000,"2140":6000,"2142":6000,"2150":13000,"2152":13000,"2162":13000,"2164":40,"2165":40,"2166":40,"2167":15,"2169":13000,"2171":13000,"2185":6000,"2187":6000,"2191":6000,"2195":6000,"2205":6000,"2209":6000,"2213":6000,"2217":6000,"2219":6000,"2221":6000,"2223":6000,"2225":6000,"2227":6000,"2229":6000,"2231":6000,"2233":6000,"2235":6000,"2237":6000,"2239":6000,"2241":6000,"2243":6000,"2253":6000,"2255":6000,"2259":6000,"2277":6000,"2281":6000,"2283":11000,"2289":10000,"2293":10000,"2297":10000,"2301":10000,"2307":13000,"2309":6000,"2313":500,"2315":13000,"2317":13000,"2319":13000,"2321":13000,"2323":10000,"2325":15,"2327":10000,"2337":15,"2341":15,"2343":15,"2347":40,"2349":10000,"2351":10000,"2353":10000,"2355":10000,"2357":10000,"2359":10000,"2361":10000,"2363":10000,"2366":50,"2368":50,"2370":13000,"2389":13000,"2390":13000,"2428":2000,"2430":2000,"2432":2000,"2434":2000,"2436":2000,"2438":2000,"2440":2000,"2442":2000,"2444":2000,"2446":2000,"2448":2000,"2450":2000,"2452":2000,"2454":2000,"2456":2000,"2458":2000,"2460":150,"2462":150,"2464":150,"2466":150,"2468":150,"2470":150,"2472":150,"2474":150,"2476":150,"2481":11000,"2483":10000,"2485":11000,"2511":15000,"2513":70,"2514":15000,"2516":13000,"2487":125,"2489":70,"2491":70,"2493":125,"2495":70,"2497":70,"2499":125,"2501":70,"2503":70,"2505":13000,"2507":11000,"2509":11000,"2520":150,"2522":150,"2524":150,"2526":150,"2530":3000,"2550":10000,"2552":10000,"2568":10000,"2570":10000,"2572":10000,"2577":8,"2579":8,"2581":8,"2583":8,"2585":8,"2587":8,"2589":8,"2591":8,"2593":8,"2595":8,"2597":8,"2599":8,"2601":8,"2603":8,"2605":8,"2607":8,"2609":8,"2611":8,"2613":8,"2615":8,"2617":8,"2619":8,"2621":8,"2623":8,"2625":8,"2627":8,"2629":8,"2631":4,"2633":4,"2635":4,"2637":4,"2639":4,"2641":4,"2643":4,"2645":4,"2647":4,"2649":4,"2651":4,"2653":8,"2655":8,"2657":8,"2659":8,"2661":8,"2663":8,"2665":8,"2667":8,"2669":8,"2671":8,"2673":8,"2675":8,"2859":13000,"2861":7000,"2862":13000,"2864":7000,"2865":7000,"2866":7000,"2876":13000,"2878":6000,"2890":70,"2894":150,"2896":150,"2898":150,"2900":150,"2902":150,"2904":150,"2906":150,"2908":150,"2910":150,"2912":150,"2914":150,"2916":150,"2918":150,"2920":150,"2922":150,"2924":150,"2926":150,"2928":150,"2930":150,"2932":150,"2934":150,"2936":150,"2938":150,"2940":150,"2942":150,"2955":2000,"2961":15,"2970":13000,"2972":13000,"2974":13000,"2976":40,"2997":4,"2998":13000,"3000":11000,"3002":10000,"3004":10000,"3008":2000,"3010":2000,"3012":2000,"3014":2000,"3016":2000,"3018":2000,"3020":2000,"3022":2000,"3024":2000,"3026":2000,"3028":2000,"3030":2000,"3032":2000,"3034":2000,"3036":2000,"3038":2000,"3040":2000,"3042":2000,"3044":2000,"3046":2000,"3049":13000,"3051":11000,"3053":8,"3054":8,"3093":7000,"3094":7000,"3095":125,"3096":125,"3097":125,"3098":125,"3099":125,"3100":125,"3101":70,"3105":15,"3107":15,"3122":70,"3123":7500,"3125":3000,"3138":11000,"3140":70,"3142":13000,"3144":10000,"3147":10000,"3157":15,"3159":15,"3162":15,"3179":3000,"3180":3000,"3181":3000,"3182":3000,"3183":3000,"3185":3000,"3186":3000,"3187":3000,"3188":40,"3190":125,"3192":125,"3194":125,"3196":125,"3198":125,"3200":125,"3202":70,"3204":70,"3211":13000,"3216":15,"3226":13000,"3228":6000,"3239":13000,"3325":11000,"3327":150,"3329":150,"3331":150,"3333":150,"3335":150,"3337":150,"3339":150,"3341":150,"3343":150,"3345":13000,"3347":13000,"3349":13000,"3351":13000,"3353":13000,"3355":13000,"3357":13000,"3359":13000,"3361":13000,"3363":13000,"3365":13000,"3367":13000,"3369":6000,"3371":6000,"3373":6000,"3379":13000,"3381":6000,"3385":70,"3387":70,"3389":70,"3391":70,"3393":70,"3396":7500,"3398":7500,"3400":7500,"3402":7500,"3404":7500,"3406":10000,"3408":2000,"3410":2000,"3412":2000,"3414":2000,"3420":10000,"3422":10000,"3424":10000,"3426":10000,"3428":10000,"3430":2000,"3432":2000,"3434":2000,"3436":2000,"3438":11000,"3440":11000,"3442":11000,"3444":11000,"3446":11000,"3448":11000,"3470":11000,"3472":8,"3473":8,"3474":8,"3475":8,"3476":8,"3477":8,"3478":8,"3479":8,"3480":8,"3481":8,"3483":8,"3485":8,"3486":8,"3488":8,"3678":40,"3711":2000,"3749":70,"3751":70,"3753":70,"3755":70,"3759":150,"3761":150,"3763":150,"3765":150,"3767":150,"3769":150,"3771":150,"3773":150,"3775":150,"3777":150,"3779":150,"3781":150,"3783":150,"3785":150,"3787":150,"3789":150,"3791":150,"3793":150,"3795":150,"3797":150,"3799":150,"3801":2000,"3803":2000,"3827":5,"3828":5,"3829":5,"3830":5,"3831":5,"3832":5,"3833":5,"3834":5,"3835":5,"3836":5,"3837":5,"3838":5,"3853":10000,"4012":6000,"4014":6000,"4016":6000,"4087":70,"4089":125,"4091":125,"4093":125,"4095":125,"4097":125,"4099":70,"4101":70,"4103":70,"4105":70,"4107":70,"4109":70,"4111":70,"4113":70,"4115":70,"4117":70,"4119":125,"4121":125,"4123":125,"4125":125,"4127":125,"4129":125,"4131":70,"4151":70,"4153":70,"4156":40,"4161":8000,"4162":40,"4164":70,"4166":70,"4168":70,"4170":70,"4178":70,"4180":70,"4207":70,"4212":70,"4213":70,"4224":70,"4235":70,"4298":15,"4242":2000,"4243":2000,"4245":2000,"4246":2000,"4287":13000,"4289":13000,"4291":6000,"4293":6000,"4300":15,"4302":15,"4304":15,"4306":15,"4308":15,"4310":15,"4315":150,"4317":150,"4319":150,"4321":150,"4323":150,"4325":150,"4327":150,"4329":150,"4331":150,"4333":150,"4335":150,"4337":150,"4339":150,"4341":150,"4343":150,"4345":150,"4347":150,"4349":150,"4351":150,"4353":150,"4355":150,"4357":150,"4359":150,"4361":150,"4363":150,"4365":150,"4367":150,"4369":150,"4371":150,"4373":150,"4375":150,"4377":150,"4379":150,"4381":150,"4383":150,"4385":150,"4387":150,"4389":150,"4391":150,"4393":150,"4395":150,"4397":150,"4399":150,"4401":150,"4403":150,"4405":150,"4407":150,"4409":150,"4411":150,"4413":150,"4417":2000,"4419":2000,"4421":2000,"4423":2000,"4436":15,"4438":100,"4440":15,"4456":13000,"4458":13000,"4460":13000,"4498":250,"4517":6000,"4522":40,"4524":40,"4525":10000,"4527":10000,"4529":40,"4532":40,"4535":10000,"4537":40,"4539":40,"4540":10000,"4542":10000,"4544":10000,"4546":10000,"4548":10000,"4551":125,"4550":10000,"4561":10000,"4580":8,"4582":8,"4585":70,"4587":70,"4591":15,"4593":15,"4595":15,"4600":125,"4608":15,"4627":2000,"4668":15,"4675":70,"4682":125,"4683":125,"4684":15,"4687":15,"4689":15,"4692":11000,"4694":12000,"4695":12000,"4696":12000,"4697":12000,"4698":12000,"4699":12000,"4708":15,"4710":15,"4712":15,"4714":15,"4716":15,"4718":15,"4720":15,"4722":15,"4724":15,"4726":15,"4728":15,"4730":15,"4732":15,"4734":15,"4736":15,"4738":15,"4703":11000,"4740":11000,"4745":15,"4747":15,"4749":15,"4751":15,"4753":15,"4755":15,"4757":15,"4759":15,"4773":11000,"4778":11000,"4783":11000,"4788":11000,"4793":11000,"4798":11000,"4803":11000,"4812":3000,"4819":13000,"4820":13000,"4821":13000,"4822":13000,"4823":13000,"4824":13000,"4825":10000,"4827":70,"4830":7500,"4832":7500,"4834":7500,"4842":2000,"4844":2000,"4846":2000,"4848":2000,"4838":2000,"4840":10000,"4850":3000,"4860":15,"4866":15,"4872":15,"4878":15,"4884":15,"4890":15,"4896":15,"4902":15,"4908":15,"4914":15,"4920":15,"4926":15,"4932":15,"4938":15,"4944":15,"4950":15,"4956":15,"4962":15,"4968":15,"4974":15,"4980":15,"4986":15,"4992":15,"4998":15,"5001":13000,"5003":10000,"5013":4,"5014":4,"5016":4,"5018":4,"5024":150,"5026":150,"5028":150,"5030":150,"5032":150,"5034":150,"5036":150,"5038":150,"5040":150,"5042":150,"5044":150,"5046":150,"5048":150,"5050":150,"5052":150,"5075":11000,"5096":600,"5097":600,"5098":200,"5099":600,"5100":600,"5101":600,"5102":600,"5103":600,"5104":200,"5105":200,"5106":200,"5280":200,"5281":200,"5282":200,"5283":200,"5284":200,"5285":200,"5286":200,"5287":200,"5288":200,"5289":200,"5290":200,"5291":600,"5292":600,"5293":600,"5294":600,"5295":200,"5296":600,"5297":600,"5298":200,"5299":200,"5300":200,"5301":200,"5302":200,"5303":200,"5304":200,"5305":600,"5306":600,"5307":600,"5308":600,"5309":600,"5310":600,"5311":200,"5312":200,"5313":200,"5314":200,"5315":200,"5316":200,"5318":600,"5319":600,"5320":600,"5321":200,"5322":600,"5323":600,"5324":600,"5325":40,"5329":40,"5331":40,"5341":40,"5343":40,"5345":150,"5350":10000,"5352":10000,"5354":600,"5370":200,"5371":200,"5372":200,"5373":200,"5374":200,"5376":10000,"5386":600,"5396":600,"5406":200,"5416":600,"5418":10000,"5438":600,"5458":600,"5478":600,"5496":200,"5497":200,"5498":200,"5499":200,"5500":200,"5501":200,"5502":200,"5503":200,"5504":11000,"5516":40,"5521":10000,"5523":40,"5525":10000,"5527":40,"5529":40,"5531":40,"5533":40,"5535":40,"5537":40,"5539":40,"5541":40,"5543":40,"5547":40,"5574":125,"5575":125,"5576":125,"5616":7000,"5617":7000,"5618":7000,"5619":7000,"5620":11000,"5621":11000,"5622":7000,"5623":7000,"5624":7000,"5625":7000,"5626":11000,"5627":11000,"5628":7000,"5629":7000,"5630":7000,"5631":7000,"5632":7000,"5633":11000,"5634":11000,"5635":7000,"5636":7000,"5637":7000,"5638":7000,"5639":7000,"5640":11000,"5641":11000,"5642":7000,"5643":7000,"5644":7000,"5645":7000,"5646":11000,"5647":11000,"5648":7000,"5649":7000,"5650":7000,"5651":7000,"5652":11000,"5653":11000,"5654":7000,"5655":7000,"5656":7000,"5657":7000,"5658":7000,"5659":7000,"5660":7000,"5661":7000,"5662":7000,"5663":7000,"5664":7000,"5665":7000,"5666":7000,"5667":7000,"5668":125,"5670":125,"5672":125,"5674":125,"5676":125,"5678":70,"5680":70,"5682":125,"5686":125,"5688":125,"5690":125,"5692":125,"5694":125,"5696":70,"5698":70,"5700":125,"5704":125,"5706":125,"5708":125,"5710":125,"5712":125,"5714":70,"5716":70,"5718":125,"5720":125,"5722":125,"5724":125,"5726":125,"5728":70,"5730":70,"5734":8,"5736":8,"5601":40,"5602":15,"5603":40,"5605":40,"5607":13000,"5738":11000,"5739":2000,"5741":2000,"5743":2000,"5745":2000,"5747":2000,"5749":2000,"5751":2000,"5753":2000,"5755":2000,"5757":2000,"5759":2000,"5761":2000,"5763":2000,"5765":2000,"5767":11000,"5769":10000,"5777":2000,"5785":2000,"5793":2000,"5801":2000,"5809":2000,"5817":2000,"5825":2000,"5833":2000,"5841":2000,"5849":2000,"5857":2000,"5865":2000,"5873":2000,"5881":2000,"5889":2000,"5897":2000,"5905":2000,"5913":2000,"5921":2000,"5929":2000,"5931":13000,"5933":11000,"5935":11000,"5937":2000,"5940":2000,"5943":4000,"5945":4000,"5947":4000,"5949":4000,"5952":4000,"5954":4000,"5956":4000,"5958":4000,"5968":600,"5970":11000,"5972":11000,"5974":11000,"5980":11000,"5982":11000,"5984":11000,"5986":11000,"5988":11000,"5992":11000,"5994":11000,"5996":11000,"5998":11000,"6000":11000,"6002":11000,"6004":11000,"6006":11000,"6008":11000,"6010":600,"6012":600,"6014":600,"6016":11000,"6018":11000,"6032":600,"6034":600,"6036":2000,"6038":11000,"6043":11000,"6045":11000,"6047":11000,"6049":11000,"6051":11000,"6055":600,"6061":11000,"6062":11000,"6123":10000,"6128":70,"6129":70,"6130":70,"6131":70,"6133":70,"6135":70,"6137":70,"6139":70,"6141":70,"6143":125,"6145":125,"6147":125,"6149":125,"6151":125,"6153":125,"6155":11000,"6157":11000,"6159":11000,"6161":11000,"6163":11000,"6165":11000,"6167":11000,"6169":11000,"6171":11000,"6173":11000,"6209":40,"6211":11000,"6213":11000,"6215":125,"6235":125,"6237":125,"6257":125,"6259":125,"6279":125,"6281":100,"6283":100,"6285":100,"6287":13000,"6289":13000,"6291":13000,"6293":6000,"6295":6000,"6297":6000,"6299":6000,"6303":6000,"6305":13000,"6306":18000,"6311":5,"6313":15,"6315":15,"6317":15,"6319":100,"6322":125,"6324":125,"6326":125,"6328":125,"6330":125,"6332":11000,"6333":13000,"6335":150,"6337":150,"6339":150,"6341":150,"6343":150,"6345":150,"6347":150,"6349":150,"6351":150,"6353":150,"6355":150,"6357":150,"6359":150,"6361":150,"6363":150,"6365":150,"6367":150,"6369":150,"6371":150,"6373":150,"6375":150,"6377":150,"6379":150,"6382":150,"6384":150,"6386":150,"6388":150,"6390":150,"6392":150,"6394":150,"6396":150,"6398":150,"6400":150,"6402":150,"6404":150,"6406":150,"6408":125,"6410":125,"6412":125,"6414":125,"6416":125,"6418":125,"6420":125,"6422":20000,"6424":20000,"6426":20000,"6428":20000,"6430":12000,"6432":10000,"6434":12000,"6436":12000,"6438":12000,"6468":2000,"6470":50,"6472":50,"6474":50,"6476":50,"6522":11000,"6523":70,"6524":70,"6525":70,"6526":70,"6527":70,"6528":70,"6562":8,"6563":8,"6568":70,"6571":11000,"6573":11000,"6575":10000,"6577":10000,"6579":10000,"6581":10000,"6583":70,"6585":8,"6587":125,"6589":125,"6591":125,"6593":125,"6595":125,"6597":125,"6599":125,"6601":125,"6603":125,"6605":125,"6607":125,"6609":125,"6611":125,"6613":125,"6615":125,"6617":125,"6619":125,"6621":125,"6623":125,"6625":125,"6627":125,"6629":125,"6631":125,"6633":125,"6667":100,"6681":100,"6685":2000,"6687":2000,"6689":2000,"6691":2000,"6693":11000,"6697":11000,"6701":13000,"6703":13000,"6705":13000,"6722":4,"6724":8,"6729":7500,"6731":8,"6733":8,"6735":8,"6737":8,"6739":40,"6750":15,"6752":15,"6760":8,"6762":8,"6764":8,"6794":6000,"6797":40,"6809":70,"6812":7500,"6814":18000,"6889":15,"6891":15,"6893":125,"6894":125,"6895":125,"6896":13000,"6897":70,"6903":11000,"6908":125,"6910":125,"6912":70,"6914":70,"6916":125,"6918":125,"6920":125,"6922":125,"6924":125,"6926":10000,"6959":150,"6962":6000,"6967":8,"6971":100,"6973":100,"6975":100,"6977":100,"6979":100,"6981":100,"6983":100,"7051":40,"7054":13000,"7056":13000,"7058":13000,"7060":13000,"7062":13000,"7064":13000,"7066":13000,"7068":13000,"7070":13000,"7072":13000,"7074":13000,"7076":13000,"7078":13000,"7080":13000,"7082":13000,"7084":13000,"7086":13000,"7088":11000,"7110":150,"7112":150,"7114":150,"7155":250,"7156":40,"7116":150,"7122":150,"7124":150,"7126":150,"7128":150,"7130":150,"7132":150,"7134":150,"7136":150,"7138":150,"7158":8,"7159":70,"7162":15,"7168":13000,"7170":11000,"7176":13000,"7178":10000,"7186":13000,"7188":10000,"7196":13000,"7198":10000,"7206":13000,"7208":10000,"7216":13000,"7218":10000,"7223":6000,"7225":11000,"7228":6000,"7319":4,"7321":4,"7323":4,"7325":4,"7327":4,"7329":150,"7330":150,"7331":150,"7332":70,"7334":70,"7336":70,"7338":70,"7340":70,"7342":70,"7344":70,"7346":70,"7348":70,"7350":70,"7352":70,"7354":70,"7356":70,"7358":70,"7360":70,"7362":8,"7364":8,"7366":8,"7368":8,"7370":8,"7372":8,"7374":8,"7376":8,"7378":8,"7380":8,"7382":8,"7384":8,"7386":4,"7388":4,"7390":4,"7392":4,"7394":4,"7396":4,"7398":8,"7399":8,"7400":8,"7416":50,"7418":50,"7433":50,"7435":50,"7437":50,"7439":50,"7441":50,"7443":50,"7445":50,"7447":50,"7449":50,"7451":50,"7466":15,"7468":15,"7521":6000,"7523":6000,"7524":6000,"7525":6000,"7526":6000,"7548":600,"7550":600,"7552":7000,"7554":20000,"7556":20000,"7558":20000,"7560":12000,"7562":600,"7566":11000,"7568":10000,"7650":13000,"7660":2000,"7662":2000,"7664":2000,"7666":2000,"7668":8,"7676":125,"7728":13000,"7730":2000,"7731":2000,"7733":2000,"7734":2000,"7736":2000,"7737":2000,"7740":2000,"7742":10000,"7744":2000,"7748":2000,"7750":2000,"7752":2000,"7754":500,"7759":150,"7761":150,"7763":150,"7765":150,"7767":150,"7769":150,"7771":150,"7801":13000,"7919":10000,"7928":50,"7929":50,"7930":50,"7931":50,"7932":50,"7933":50,"7936":20000,"7939":7500,"7944":13000,"7946":13000,"7957":150,"8007":10000,"8008":10000,"8009":10000,"8010":10000,"8011":10000,"8012":10000,"8013":10000,"8014":10000,"8015":10000,"8016":10000,"8017":10000,"8018":10000,"8019":10000,"8020":10000,"8021":10000,"8031":500,"8032":500,"8033":500,"8034":500,"8035":500,"8038":500,"8039":500,"8040":500,"8041":500,"8042":500,"8043":500,"8044":500,"8045":500,"8046":500,"8047":500,"8048":500,"8049":500,"8050":500,"8051":500,"8052":500,"8053":500,"8054":500,"8108":500,"8109":500,"8110":500,"8111":500,"8112":500,"8113":500,"8114":500,"8115":500,"8116":500,"8117":500,"8118":500,"8119":500,"8120":500,"8121":500,"8203":10000,"8204":10000,"8205":10000,"8206":10000,"8207":10000,"8208":10000,"8209":10000,"8210":600,"8214":600,"8239":500,"8240":500,"8241":2000,"8243":2000,"8247":500,"8248":500,"8282":125,"8283":10000,"8310":500,"8311":500,"8312":500,"8313":500,"8314":500,"8315":500,"8320":500,"8321":500,"8351":500,"8352":500,"8353":500,"8417":10000,"8419":10000,"8421":10000,"8423":10000,"8425":10000,"8427":10000,"8429":10000,"8431":10000,"8433":10000,"8435":10000,"8437":10000,"8439":10000,"8441":10000,"8443":10000,"8445":10000,"8447":10000,"8449":10000,"8451":10000,"8453":10000,"8455":10000,"8457":10000,"8459":10000,"8461":10000,"8496":500,"8498":500,"8500":500,"8502":500,"8504":500,"8506":500,"8508":500,"8510":500,"8512":500,"8514":500,"8516":500,"8518":500,"8520":2000,"8524":2000,"8522":500,"8526":500,"8528":500,"8530":500,"8532":500,"8548":500,"8550":500,"8552":500,"8554":500,"8556":500,"8558":500,"8560":500,"8562":500,"8564":500,"8566":500,"8568":500,"8570":500,"8572":500,"8574":500,"8576":500,"8578":500,"8580":500,"8582":500,"8584":500,"8586":500,"8588":500,"8590":500,"8592":500,"8594":500,"8596":500,"8598":500,"8600":500,"8602":500,"8604":500,"8606":500,"8608":500,"8610":500,"8612":500,"8614":500,"8616":500,"8618":500,"8620":500,"8622":500,"8624":500,"8626":500,"8628":500,"8714":70,"8716":70,"8718":70,"8720":70,"8722":70,"8724":70,"8726":70,"8728":70,"8730":70,"8732":70,"8734":70,"8736":70,"8738":70,"8740":70,"8742":70,"8744":70,"8746":125,"8748":125,"8750":125,"8752":125,"8754":125,"8756":125,"8758":125,"8760":125,"8762":125,"8764":125,"8766":125,"8768":125,"8770":125,"8772":125,"8774":125,"8776":125,"8778":13000,"8780":13000,"8782":13000,"8784":11000,"8786":11000,"8788":11000,"8790":13000,"8792":11000,"8794":40,"8837":13000,"8872":70,"8874":70,"8876":70,"8878":70,"8880":70,"8882":11000,"8901":70,"8921":70,"8924":150,"8925":150,"8926":150,"8927":150,"8928":150,"8936":150,"8938":150,"9003":15,"9004":15,"9026":13000,"9028":13000,"9030":13000,"9032":13000,"9034":13000,"9036":13000,"9038":13000,"9040":13000,"9042":13000,"9044":50,"9050":10000,"9052":6000,"9075":10000,"9086":13000,"9140":7000,"9141":7000,"9142":7000,"9143":11000,"9144":11000,"9145":11000,"9174":125,"9177":125,"9179":125,"9181":125,"9183":70,"9185":70,"9187":11000,"9188":11000,"9189":11000,"9190":11000,"9191":11000,"9192":11000,"9193":11000,"9194":11000,"9236":11000,"9238":11000,"9239":11000,"9240":11000,"9241":11000,"9242":11000,"9243":11000,"9244":11000,"9245":11000,"9287":11000,"9288":11000,"9289":11000,"9290":11000,"9291":11000,"9292":11000,"9294":11000,"9295":11000,"9296":11000,"9297":11000,"9298":11000,"9299":11000,"9301":11000,"9302":11000,"9303":11000,"9304":11000,"9305":11000,"9306":11000,"9336":11000,"9337":11000,"9338":11000,"9339":11000,"9340":11000,"9341":11000,"9342":11000,"9375":13000,"9377":13000,"9378":13000,"9379":13000,"9380":13000,"9381":13000,"9382":13000,"9416":11000,"9418":11000,"9419":11000,"9420":10000,"9423":10000,"9425":10000,"9427":10000,"9429":10000,"9431":10000,"9434":40,"9436":13000,"9438":11000,"9440":10000,"9442":10000,"9444":10000,"9446":10000,"9448":10000,"9450":10000,"9452":10000,"9454":10000,"9457":10000,"9459":10000,"9461":10000,"9463":10000,"9465":10000,"9469":15,"9470":4,"9472":4,"9475":10000,"9487":2000,"9489":2000,"9508":2000,"9510":2000,"9512":2000,"9514":2000,"9516":2000,"9518":2000,"9520":2000,"9522":40,"9524":40,"9527":6000,"9529":6000,"9531":6000,"9533":6000,"9538":6000,"9540":6000,"9542":6000,"9544":6000,"9547":6000,"9549":6000,"9553":6000,"9629":150,"9634":150,"9636":150,"9638":150,"9640":150,"9642":150,"9644":150,"9666":70,"9668":70,"9670":70,"9691":20000,"9693":20000,"9695":20000,"9697":12000,"9699":20000,"9672":70,"9674":70,"9676":70,"9678":70,"9729":70,"9731":70,"9733":70,"9735":13000,"9736":13000,"9739":2000,"9741":2000,"9743":2000,"9745":2000,"9817":500,"9818":500,"9819":500,"9820":500,"9821":500,"9826":500,"9827":500,"9828":500,"9829":500,"9831":500,"9833":500,"9834":500,"9836":500,"9837":500,"9838":500,"9839":500,"9840":500,"9843":500,"9844":500,"9845":500,"9846":500,"9847":500,"9848":500,"9849":500,"9850":500,"9851":500,"9852":500,"9853":500,"9854":500,"9855":500,"9856":500,"9857":500,"9858":500,"9859":500,"9860":500,"9861":500,"9862":500,"9863":500,"9864":500,"9865":500,"9866":500,"9867":500,"9976":7000,"9977":7000,"9978":11000,"9980":6000,"9986":11000,"9988":6000,"9994":8000,"9996":8000,"9998":2000,"10000":2000,"10002":2000,"10004":2000,"10006":250,"10008":250,"10010":125,"10012":40,"10014":125,"10016":125,"10018":125,"10020":125,"10025":250,"10029":40,"10031":250,"10033":7000,"10034":7000,"10035":150,"10037":150,"10039":150,"10041":150,"10043":150,"10045":150,"10047":150,"10049":150,"10051":150,"10053":150,"10055":150,"10057":150,"10059":150,"10061":150,"10063":150,"10065":150,"10067":150,"10069":125,"10071":125,"10073":125,"10074":125,"10075":8000,"10077":125,"10079":125,"10081":125,"10083":125,"10085":125,"10087":8000,"10088":8000,"10089":8000,"10090":8000,"10091":8000,"10093":10000,"10095":10000,"10097":10000,"10099":10000,"10101":10000,"10103":10000,"10105":10000,"10107":10000,"10109":10000,"10111":10000,"10113":10000,"10115":10000,"10117":100,"10119":10000,"10121":10000,"10123":10000,"10125":10000,"10127":10000,"10129":40,"10132":150,"10134":100,"10136":6000,"10138":13000,"10142":7000,"10143":7000,"10144":7000,"10145":11000,"10146":125,"10147":125,"10148":125,"10149":125,"10150":40,"10156":70,"10158":11000,"10159":11000,"10280":8,"10282":8,"10284":8,"10286":70,"10288":70,"10290":70,"10292":70,"10294":70,"10296":70,"10298":70,"10300":70,"10302":70,"10304":70,"10306":70,"10308":70,"10310":70,"10312":70,"10314":70,"10316":4,"10318":4,"10320":4,"10322":4,"10324":4,"10326":150,"10327":150,"10330":8,"10332":8,"10334":8,"10336":8,"10338":8,"10340":8,"10342":8,"10344":8,"10346":8,"10348":8,"10350":8,"10352":8,"10354":5,"10362":5,"10364":5,"10366":5,"10368":8,"10370":8,"10372":8,"10374":8,"10376":8,"10378":8,"10380":8,"10382":8,"10384":8,"10386":8,"10388":8,"10390":8,"10392":4,"10394":4,"10396":4,"10398":4,"10400":4,"10402":4,"10404":4,"10406":4,"10408":4,"10410":4,"10412":4,"10414":4,"10416":4,"10418":4,"10420":4,"10422":4,"10424":4,"10426":4,"10428":4,"10430":4,"10432":4,"10434":4,"10436":4,"10438":4,"10440":8,"10442":8,"10444":8,"10446":8,"10448":8,"10450":8,"10452":8,"10454":8,"10456":8,"10458":8,"10460":8,"10462":8,"10464":8,"10466":8,"10468":8,"10470":8,"10472":8,"10474":8,"10476":10000,"10486":10000,"10496":15,"10564":70,"10589":70,"10601":125,"10602":70,"10603":70,"10604":70,"10605":125,"10606":70,"10613":70,"10614":70,"10618":125,"10622":150,"10623":150,"10624":150,"10625":150,"10626":150,"10627":150,"10628":150,"10634":125,"10636":70,"10638":150,"10663":125,"10664":125,"10665":70,"10666":70,"10667":70,"10668":70,"10669":70,"10670":70,"10671":70,"10672":70,"10673":70,"10674":70,"10675":70,"10676":70,"10677":70,"10678":70,"10679":70,"10680":8,"10681":8,"10688":8,"10689":8,"10690":8,"10691":8,"10692":4,"10693":4,"10694":4,"10695":4,"10696":8,"10697":8,"10698":8,"10699":70,"10700":70,"10701":70,"10702":70,"10703":70,"10704":70,"10705":70,"10706":70,"10707":70,"10708":70,"10709":70,"10710":70,"10711":70,"10712":70,"10713":70,"10719":5,"10731":4,"10736":5,"10738":5,"10740":4,"10744":4,"10746":4,"10758":4,"10760":4,"10762":4,"10764":4,"10766":4,"10776":8,"10780":8,"10782":8,"10784":8,"10786":8,"10788":8,"10796":8,"10798":8,"10800":8,"10802":4,"10804":4,"10806":4,"10808":11000,"10810":11000,"10812":11000,"10814":13000,"10816":11000,"10818":13000,"10820":13000,"10822":70,"10824":70,"10826":70,"10828":70,"10891":15,"10925":2000,"10927":2000,"10929":2000,"10931":2000,"10937":11000,"10952":40,"10954":70,"10956":70,"10958":70,"10973":10000,"10978":13000,"10981":11000,"10999":15,"11027":50,"11028":50,"11029":50,"11030":50,"11037":8,"11046":250,"11061":8,"11065":40,"11068":18000,"11069":18000,"11071":10000,"11072":10000,"11074":10000,"11076":10000,"11078":10000,"11079":10000,"11085":10000,"11087":10000,"11088":10000,"11090":10000,"11092":10000,"11094":10000,"11095":10000,"11105":10000,"11113":10000,"11115":10000,"11118":10000,"11126":10000,"11128":70,"11130":10000,"11132":10000,"11133":70,"11200":50,"11205":15,"11212":11000,"11227":11000,"11228":11000,"11229":11000,"11230":11000,"11231":11000,"11232":11000,"11233":11000,"11234":11000,"11235":8,"11237":10000,"11238":18000,"11240":18000,"11242":18000,"11244":18000,"11246":18000,"11248":18000,"11250":18000,"11252":18000,"11254":18000,"11256":18000,"11283":8,"11260":13000,"11280":150,"11284":8,"11286":5,"11324":13000,"11326":13000,"11328":13000,"11330":13000,"11332":13000,"11334":8000,"11335":8,"11367":125,"11369":125,"11371":125,"11373":125,"11375":125,"11377":70,"11379":125,"11382":125,"11384":125,"11386":125,"11389":125,"11391":125,"11393":125,"11396":125,"11398":125,"11400":125,"11403":125,"11405":125,"11407":125,"11410":125,"11412":125,"11414":70,"11417":70,"11419":70,"11429":2000,"11431":2000,"11433":2000,"11435":2000,"11437":2000,"11439":2000,"11441":2000,"11443":2000,"11445":2000,"11447":2000,"11449":2000,"11451":2000,"11453":2000,"11455":2000,"11457":2000,"11459":2000,"11461":2000,"11463":2000,"11465":2000,"11467":2000,"11469":2000,"11471":2000,"11473":2000,"11475":2000,"11477":2000,"11479":2000,"11481":2000,"11483":2000,"11485":2000,"11487":2000,"11489":2000,"11491":2000,"11493":2000,"11495":2000,"11497":2000,"11499":2000,"11501":2000,"11503":2000,"11505":2000,"11507":2000,"11509":2000,"11511":2000,"11513":2000,"11515":2000,"11517":2000,"11519":2000,"11521":2000,"11523":2000,"11686":20000,"11687":20000,"11688":20000,"11689":20000,"11690":12000,"11691":12000,"11692":10000,"11693":12000,"11694":12000,"11695":12000,"11696":12000,"11697":10000,"11698":10000,"11699":10000,"11700":7000,"11701":7000,"11702":7000,"11703":7000,"11785":8,"11787":8,"11789":8,"11791":8,"11798":10000,"11802":8,"11804":8,"11806":8,"11808":8,"11810":10000,"11812":10000,"11814":10000,"11816":10000,"11818":11000,"11820":11000,"11822":11000,"11824":8,"11826":8,"11828":8,"11830":8,"11832":8,"11834":8,"11836":8,"11838":8,"11840":70,"11874":7000,"11875":7000,"11876":7000,"11889":8,"11902":70,"11905":8,"11908":8,"11920":40,"11924":8,"11926":8,"11928":10000,"11929":10000,"11930":10000,"11931":10000,"11932":10000,"11933":10000,"11934":15000,"11936":10000,"11940":8000,"11943":7500,"11951":2000,"11953":2000,"11955":2000,"11957":2000,"11959":11000,"11960":2000,"11962":2000,"11964":5,"11968":10000,"11972":10000,"11978":10000,"11980":10000,"11990":4,"11992":11000,"11994":11000,"11998":8,"12000":8,"12002":8,"12004":70,"12007":4,"12193":8,"12195":8,"12197":8,"12199":8,"12201":8,"12203":8,"12205":4,"12207":4,"12209":4,"12211":4,"12213":4,"12215":4,"12217":4,"12219":4,"12221":4,"12223":4,"12225":4,"12227":4,"12229":4,"12231":4,"12233":4,"12235":4,"12237":4,"12239":4,"12241":4,"12243":4,"12245":4,"12247":4,"12249":4,"12251":4,"12253":8,"12255":8,"12257":8,"12259":8,"12261":8,"12263":8,"12265":8,"12267":8,"12269":8,"12271":8,"12273":8,"12275":8,"12277":8,"12279":8,"12281":8,"12283":8,"12285":8,"12287":8,"12289":8,"12291":8,"12293":8,"12295":8,"12297":4,"12299":4,"12301":4,"12303":4,"12305":4,"12307":4,"12309":4,"12311":4,"12313":4,"12315":4,"12317":4,"12319":4,"12321":4,"12323":4,"12325":4,"12327":8,"12329":8,"12331":8,"12333":8,"12335":4,"12337":4,"12339":4,"12341":4,"12343":4,"12345":4,"12347":4,"12349":4,"12351":4,"12353":4,"12355":4,"12357":8,"12359":4,"12361":4,"12363":4,"12365":4,"12367":4,"12369":4,"12371":4,"12373":4,"12375":4,"12377":4,"12379":4,"12381":8,"12383":8,"12385":8,"12387":8,"12389":8,"12391":8,"12393":4,"12395":4,"12397":4,"12399":4,"12402":10000,"12403":10000,"12404":10000,"12405":10000,"12406":10000,"12407":10000,"12408":10000,"12409":10000,"12410":10000,"12411":10000,"12412":150,"12422":8,"12424":8,"12426":8,"12428":4,"12430":4,"12432":4,"12434":4,"12437":8,"12439":4,"12441":4,"12443":4,"12445":4,"12447":4,"12449":4,"12451":4,"12453":4,"12455":4,"12460":8,"12462":8,"12464":8,"12466":8,"12468":8,"12470":8,"12472":8,"12474":8,"12476":8,"12478":8,"12480":8,"12482":8,"12484":8,"12486":8,"12488":8,"12490":8,"12492":8,"12494":8,"12496":8,"12498":8,"12500":8,"12502":8,"12504":8,"12506":8,"12508":8,"12510":8,"12512":8,"12514":4,"12516":4,"12518":4,"12520":4,"12522":4,"12524":4,"12526":4,"12528":4,"12530":4,"12532":4,"12534":4,"12536":4,"12538":4,"12540":4,"12596":4,"12598":4,"12601":8,"12603":8,"12605":8,"12613":5,"12614":5,"12615":5,"12616":5,"12617":5,"12618":5,"12619":5,"12620":5,"12621":5,"12622":5,"12623":5,"12624":5,"12625":2000,"12627":2000,"12629":2000,"12631":2000,"12633":2000,"12635":2000,"12640":11000,"12642":10000,"12695":2000,"12697":2000,"12699":2000,"12701":2000,"12746":18000,"12756":18000,"12757":4,"12759":4,"12761":4,"12763":4,"12765":8,"12766":8,"12767":8,"12768":8,"12769":4,"12771":4,"12775":10000,"12776":10000,"12777":10000,"12778":10000,"12779":10000,"12780":10000,"12781":10000,"12782":10000,"12783":10000,"12786":10000,"12789":50,"12798":50,"12800":50,"12802":50,"12806":8,"12807":8,"12804":50,"12817":8,"12819":5,"12821":8,"12823":5,"12825":8,"12827":5,"12829":8,"12831":8,"12833":5,"12846":5,"12848":70,"12849":50,"12851":8,"12863":40,"12865":125,"12867":125,"12869":70,"12871":70,"12873":8,"12875":8,"12877":8,"12879":8,"12881":8,"12883":8,"12885":5,"12900":8,"12902":8,"12905":2000,"12907":2000,"12909":2000,"12911":2000,"12913":2000,"12915":2000,"12917":2000,"12919":2000,"12922":5,"12924":8,"12927":5,"12929":8,"12932":5,"12934":30000,"12936":4,"12938":10000,"12960":8,"12962":8,"12964":8,"12966":8,"12968":8,"12970":8,"12972":8,"12974":8,"12976":8,"12978":8,"12980":8,"12982":8,"12984":8,"12986":8,"12988":8,"12990":8,"12992":8,"12994":8,"12996":8,"12998":8,"13000":8,"13002":8,"13004":8,"13006":8,"13008":8,"13010":8,"13012":8,"13014":8,"13016":8,"13018":8,"13020":8,"13022":8,"13024":8,"13026":8,"13028":8,"13030":8,"13032":8,"13034":8,"13036":8,"13038":8,"13040":8,"13042":8,"13044":8,"13046":8,"13048":8,"13050":8,"13052":8,"13054":8,"13056":8,"13058":8,"13060":8,"13062":8,"13064":2000,"13066":2000,"13149":5,"13151":5,"13153":5,"13155":5,"13157":5,"13159":5,"13161":8,"13163":8,"13165":8,"13167":8,"13169":8,"13171":8,"13173":5,"13175":5,"13190":100,"13227":15,"13229":15,"13231":15,"13233":5,"13235":15,"13237":15,"13239":15,"13245":4,"13256":5,"13263":8,"13265":8,"13267":8,"13269":8,"13271":8,"13277":4,"13383":13000,"13385":125,"13387":125,"13389":125,"13391":13000,"13421":13000,"13431":8000,"13439":15000,"13441":10000,"13448":3000,"13451":3000,"13454":3000,"13457":3000,"13460":3000,"13463":3000,"13466":3000,"13469":3000,"13472":3000,"13475":3000,"13478":3000,"13481":7500,"13484":7500,"13487":7500,"13490":7500,"13493":7500,"13496":3000,"13499":3000,"13502":7500,"13505":7500,"13508":3000,"13511":7500,"13573":13000,"13576":8,"13652":8,"13657":200,"16888":70,"16890":70,"19478":8,"19481":8,"19484":11000,"19486":11000,"19492":10000,"19488":11000,"19490":11000,"19493":11000,"19496":10000,"19501":10000,"19529":11000,"19532":10000,"19535":70,"19538":10000,"19541":8,"19544":10000,"19547":70,"19550":10000,"19553":8,"19559":8,"19570":10000,"19572":10000,"19574":10000,"19576":10000,"19578":10000,"19580":10000,"19582":10000,"19584":7000,"19586":8,"19589":8,"19592":8,"19595":8,"19598":8,"19601":8,"19604":8,"19607":8,"19610":8,"19613":10000,"19615":10000,"19617":10000,"19619":10000,"19621":10000,"19623":10000,"19625":10000,"19627":10000,"19629":10000,"19631":10000,"19653":100,"19656":13000,"19662":10000,"19665":13000,"19669":12000,"19672":11000,"19701":4,"19707":5,"19724":4,"19727":4,"19912":4,"19915":4,"19918":8,"19921":8,"19924":8,"19927":8,"19930":8,"19933":8,"19936":8,"19943":4,"19946":4,"19949":4,"19952":4,"19955":4,"19958":4,"19961":4,"19964":4,"19967":4,"19970":4,"19973":4,"19976":4,"19979":4,"19982":4,"19985":4,"19988":125,"19991":4,"19994":8,"19997":4,"20002":4,"20005":4,"20008":4,"20011":40,"20014":40,"20017":4,"20020":4,"20023":4,"20026":4,"20029":4,"20032":4,"20035":70,"20038":70,"20041":70,"20044":70,"20047":70,"20050":70,"20053":4,"20056":4,"20059":4,"20062":4,"20065":4,"20068":4,"20071":4,"20074":4,"20077":4,"20080":4,"20083":4,"20086":4,"20089":4,"20092":4,"20095":4,"20098":4,"20101":4,"20104":4,"20107":4,"20110":4,"20113":4,"20116":4,"20119":4,"20122":4,"20125":4,"20128":70,"20131":70,"20134":70,"20137":70,"20140":70,"20143":4,"20146":70,"20149":70,"20152":70,"20155":70,"20158":70,"20161":70,"20166":125,"20169":125,"20172":125,"20175":125,"20178":125,"20181":125,"20184":125,"20187":125,"20190":125,"20193":125,"20196":125,"20199":4,"20202":4,"20205":4,"20208":4,"20211":4,"20214":4,"20217":4,"20220":5,"20223":5,"20226":5,"20229":5,"20232":5,"20235":5,"20238":10000,"20240":4,"20243":4,"20246":4,"20251":4,"20254":4,"20257":4,"20260":4,"20263":4,"20266":4,"20269":4,"20272":125,"20275":40,"20278":40,"20376":8,"20379":8,"20382":8,"20385":8,"20388":11000,"20393":2000,"20394":2000,"20395":2000,"20396":2000,"20401":18000,"20402":70,"20403":18000,"20405":70,"20406":70,"20407":70,"20408":8,"20415":125,"20416":125,"20421":70,"20422":70,"20425":125,"20426":125,"20428":70,"20429":70,"20431":70,"20433":4,"20436":4,"20439":4,"20442":4,"20517":125,"20520":125,"20547":13000,"20548":2000,"20549":2000,"20550":2000,"20551":2000,"20552":70,"20553":125,"20554":70,"20555":70,"20556":125,"20557":70,"20558":18000,"20559":8,"20560":70,"20561":125,"20562":125,"20568":70,"20571":70,"20572":70,"20573":70,"20574":125,"20575":125,"20576":8,"20577":8,"20578":15,"20579":125,"20580":125,"20584":5,"20585":125,"20586":10000,"20587":250,"20590":5,"20593":8,"20595":125,"20600":11000,"20716":15,"20718":11000,"20724":8,"20727":70,"20730":8,"20733":8,"20736":8,"20739":8,"20749":11000,"20756":125,"20782":8,"20784":8,"20785":8,"20849":11000,"20997":8,"21000":8,"21003":8,"21006":8,"21009":70,"21012":8,"21015":8,"21018":8,"21021":8,"21024":8,"21028":5,"21034":5,"21043":8,"21047":5,"21049":5,"21060":8,"21079":5,"21081":10000,"21084":10000,"21087":10000,"21090":10000,"21093":10000,"21096":10000,"21099":10000,"21102":10000,"21105":10000,"21108":10000,"21111":10000,"21114":10000,"21117":10000,"21120":10000,"21123":10000,"21126":100,"21129":10000,"21140":10000,"21143":10000,"21146":10000,"21157":10000,"21160":10000,"21163":200,"21166":10000,"21177":10000,"21180":10000,"21183":10000,"21202":50,"21205":8,"21206":70,"21207":11000,"21257":500,"21270":8,"21279":5,"21298":70,"21301":70,"21304":70,"21316":11000,"21318":11000,"21320":7000,"21322":7000,"21324":7000,"21326":11000,"21332":11000,"21334":11000,"21336":11000,"21338":11000,"21347":13000,"21350":10000,"21352":10000,"21387":100,"21477":200,"21480":200,"21483":600,"21486":200,"21488":200,"21490":600,"21504":11000,"21512":250,"21515":250,"21518":250,"21521":250,"21543":13000,"21545":13000,"21555":30000,"21622":13000,"21626":100,"21633":8,"21634":8,"21637":5,"21643":70,"21646":70,"21649":125,"21652":100,"21684":13000,"21690":10000,"21730":5,"21733":8,"21736":8,"21739":70,"21742":8,"21745":4,"21754":11000,"21802":10000,"21804":11000,"21807":18000,"21810":18000,"21813":18000,"21817":10000,"21820":30000,"21838":125,"21873":10000,"21880":10000,"21882":8,"21885":8,"21892":70,"21895":70,"21902":70,"21905":11000,"21918":10000,"21921":10000,"21924":11000,"21926":11000,"21928":11000,"21930":13000,"21932":11000,"21934":11000,"21936":11000,"21938":11000,"21940":11000,"21942":11000,"21944":11000,"21946":11000,"21948":11000,"21950":11000,"21952":10000,"21955":11000,"21957":11000,"21959":11000,"21961":11000,"21963":11000,"21965":11000,"21967":11000,"21969":11000,"21971":11000,"21973":11000,"21975":11000,"21978":2000,"21981":2000,"21984":2000,"21987":2000,"21994":2000,"21997":2000,"22002":8,"22003":8,"22006":5,"22095":13000,"22097":50,"22100":50,"22103":50,"22106":4,"22111":8,"22118":11000,"22121":40,"22127":125,"22129":125,"22131":125,"22133":125,"22135":125,"22137":125,"22139":125,"22141":125,"22143":125,"22145":125,"22147":125,"22149":125,"22151":125,"22153":125,"22155":125,"22157":125,"22124":7500,"22192":250,"22195":250,"22198":250,"22201":250,"22204":250,"22208":10000,"22209":2000,"22212":2000,"22215":2000,"22218":2000,"22221":2000,"22224":2000,"22231":4,"22236":4,"22239":4,"22246":4,"22251":125,"22254":125,"22257":125,"22260":125,"22263":125,"22266":125,"22269":125,"22272":125,"22275":125,"22278":125,"22281":125,"22284":125,"22290":8,"22294":8,"22296":8,"22299":18000,"22302":18000,"22305":18000,"22324":8,"22326":8,"22372":100,"22405":13000,"22408":10000,"22327":8,"22328":8,"22368":8,"22430":2000,"22438":5,"22443":10000,"22446":13000,"22449":2000,"22452":2000,"22455":2000,"22458":2000,"22461":2000,"22464":2000,"22467":2000,"22470":2000,"22477":8,"22481":8,"22486":8,"22542":8,"22547":8,"22552":8,"22557":8,"22593":10000,"22595":10000,"22597":10000,"22599":10000,"22601":10000,"22603":10000,"22665":8,"22731":70,"22734":70,"22737":70,"22740":70,"22743":70,"22780":7500,"22783":7500,"22786":7500,"22789":10000,"22795":10000,"22804":11000,"22806":7000,"22808":7000,"22810":7000,"22812":11000,"22814":11000,"22818":13000,"22826":13000,"22829":13000,"22832":13000,"22835":13000,"22856":200,"22859":200,"22866":200,"22869":200,"22871":200,"22873":200,"22877":200,"22879":200,"22887":600,"22929":11000,"22932":600,"22935":12000,"22949":10000,"22951":70,"22954":70,"22957":15,"22960":70,"22963":70,"22966":15,"22975":8,"22978":8,"22983":15,"22988":15,"22994":5,"22999":50,"23002":50,"23037":125,"23047":70,"23050":70,"23053":70,"23056":70,"23059":70,"23064":4,"23110":70,"23113":70,"23116":70,"23119":70,"23124":8,"23185":4,"23188":8,"23191":8,"23194":8,"23197":8,"23200":8,"23203":8,"23206":8,"23209":8,"23212":8,"23215":8,"23218":8,"23221":8,"23224":8,"23227":4,"23232":4,"23237":4,"23242":8,"23246":8,"23249":8,"23252":4,"23255":4,"23258":8,"23261":8,"23264":8,"23267":8,"23270":4,"23273":4,"23276":4,"23279":4,"23282":4,"23285":4,"23288":4,"23291":4,"23294":4,"23297":4,"23300":4,"23303":4,"23306":4,"23309":4,"23312":4,"23315":4,"23318":4,"23321":4,"23324":4,"23327":4,"23330":70,"23332":70,"23334":70,"23336":4,"23339":4,"23342":8,"23345":8,"23348":4,"23351":8,"23354":5,"23357":18000,"23360":100,"23363":8,"23366":70,"23369":70,"23372":70,"23375":70,"23378":70,"23381":8,"23384":8,"23387":10000,"23389":8,"23392":8,"23395":8,"23398":8,"23401":8,"23404":8,"23407":4,"23410":4,"23413":4,"23489":11000,"23533":10000,"23543":2000,"23545":2000,"23547":2000,"23549":2000,"23551":2000,"23553":2000,"23555":2000,"23557":2000,"23559":2000,"23561":2000,"23563":2000,"23565":2000,"23567":2000,"23569":2000,"23571":2000,"23573":2000,"23575":2000,"23577":2000,"23579":2000,"23581":2000,"23583":2000,"23585":2000,"23587":2000,"23589":2000,"23595":8,"23599":8,"23601":70,"23613":8,"23626":8,"23628":8,"23630":8,"23640":8,"23642":8,"23644":15,"23646":8,"23648":11000,"23649":11000,"23654":8,"22610":10,"22613":10,"22622":10,"22634":100,"22636":100,"22647":10,"23499":11000,"23517":100,"23522":70,"23525":4,"23528":70,"23839":13000,"23865":40,"23879":13000,"23685":2000,"23688":2000,"23691":2000,"23694":2000,"23697":2000,"23700":2000,"23703":2000,"23706":2000,"23709":2000,"23712":2000,"23715":2000,"23718":2000,"23721":2000,"23724":2000,"23727":2000,"23730":2000,"23733":2000,"23736":2000,"23739":2000,"23742":2000,"23745":2000,"23748":2000,"23751":2000,"23754":2000} \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/abyssal_sire.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/abyssal_sire.png deleted file mode 100644 index 3e41077561..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/abyssal_sire.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/alchemical_hydra.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/alchemical_hydra.png deleted file mode 100644 index 3032e57ec4..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/alchemical_hydra.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/barrows_chests.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/barrows_chests.png deleted file mode 100644 index ba5c55efae..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/barrows_chests.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/bryophyta.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/bryophyta.png deleted file mode 100644 index 8cebd91ecf..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/bryophyta.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/callisto.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/callisto.png deleted file mode 100644 index 6f307a26d5..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/callisto.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/cerberus.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/cerberus.png deleted file mode 100644 index 4f7ef937cd..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/cerberus.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chambers_of_xeric.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chambers_of_xeric.png deleted file mode 100644 index a7240d11f0..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chambers_of_xeric.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chambers_of_xeric_challenge_mode.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chambers_of_xeric_challenge_mode.png deleted file mode 100644 index c298966a16..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chambers_of_xeric_challenge_mode.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chaos_elemental.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chaos_elemental.png deleted file mode 100644 index cc36114993..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chaos_elemental.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chaos_fanatic.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chaos_fanatic.png deleted file mode 100644 index 73e680aef6..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chaos_fanatic.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/commander_zilyana.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/commander_zilyana.png deleted file mode 100644 index e207d7e791..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/commander_zilyana.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/corporeal_beast.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/corporeal_beast.png deleted file mode 100644 index cd113c8ad9..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/corporeal_beast.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/crazy_archaeologist.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/crazy_archaeologist.png deleted file mode 100644 index 53d758bf8e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/crazy_archaeologist.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_prime.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_prime.png deleted file mode 100644 index 6b5543b5e1..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_prime.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_rex.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_rex.png deleted file mode 100644 index fc2bcbc3a0..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_rex.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_supreme.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_supreme.png deleted file mode 100644 index 044291cc4a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_supreme.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/deranged_archaeologist.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/deranged_archaeologist.png deleted file mode 100644 index 8dfae8c2fb..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/deranged_archaeologist.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/general_graardor.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/general_graardor.png deleted file mode 100644 index 1d8e4334fa..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/general_graardor.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/giant_mole.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/giant_mole.png deleted file mode 100644 index f814bbd2d5..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/giant_mole.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/grotesque_guardians.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/grotesque_guardians.png deleted file mode 100644 index 98606aed11..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/grotesque_guardians.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/hespori.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/hespori.png deleted file mode 100644 index dffc71404c..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/hespori.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kalphite_queen.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kalphite_queen.png deleted file mode 100644 index a6b77f9426..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kalphite_queen.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/king_black_dragon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/king_black_dragon.png deleted file mode 100644 index 3bc8a77466..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/king_black_dragon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kraken.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kraken.png deleted file mode 100644 index c42e5d3fc9..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kraken.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kreearra.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kreearra.png deleted file mode 100644 index 74b9eae788..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kreearra.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kril_tsutsaroth.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kril_tsutsaroth.png deleted file mode 100644 index dfe129ae77..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kril_tsutsaroth.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/mimic.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/mimic.png deleted file mode 100644 index 3d2c0a4606..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/mimic.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/obor.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/obor.png deleted file mode 100644 index 8c9ea13036..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/obor.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/sarachnis.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/sarachnis.png deleted file mode 100644 index e74c398976..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/sarachnis.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/scorpia.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/scorpia.png deleted file mode 100644 index eeb6310454..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/scorpia.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/skotizo.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/skotizo.png deleted file mode 100644 index cd96bbcca0..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/skotizo.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/the_corrupted_gauntlet.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/the_corrupted_gauntlet.png deleted file mode 100644 index 9553dde2c1..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/the_corrupted_gauntlet.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/the_gauntlet.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/the_gauntlet.png deleted file mode 100644 index e34fbe3d15..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/the_gauntlet.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/theatre_of_blood.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/theatre_of_blood.png deleted file mode 100644 index 0d05a8ab1e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/theatre_of_blood.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/thermonuclear_smoke_devil.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/thermonuclear_smoke_devil.png deleted file mode 100644 index 7869a9a817..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/thermonuclear_smoke_devil.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/tzkal_zuk.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/tzkal_zuk.png deleted file mode 100644 index 8b3262cd8b..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/tzkal_zuk.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/tztok_jad.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/tztok_jad.png deleted file mode 100644 index 6ccee5515e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/tztok_jad.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/venenatis.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/venenatis.png deleted file mode 100644 index df08980743..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/venenatis.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/vetion.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/vetion.png deleted file mode 100644 index 383d30a119..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/vetion.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/vorkath.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/vorkath.png deleted file mode 100644 index 03bcc75ed4..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/vorkath.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/wintertodt.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/wintertodt.png deleted file mode 100644 index eb1d8f47bb..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/wintertodt.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/zalcano.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/zalcano.png deleted file mode 100644 index c4d6e21be0..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/zalcano.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/zulrah.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/zulrah.png deleted file mode 100644 index 83d939a1ac..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/zulrah.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/deadman.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/deadman.png deleted file mode 100644 index 09869ea0e1..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/deadman.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/hardcore_ironman.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/hardcore_ironman.png deleted file mode 100644 index b3d30a1f94..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/hardcore_ironman.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/hiscore.gif b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/hiscore.gif deleted file mode 100644 index 8f9b2eae4f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/hiscore.gif and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/ironman.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/ironman.png deleted file mode 100644 index f3416561f0..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/ironman.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/league.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/league.png deleted file mode 100644 index b9473db512..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/league.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/normal.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/normal.png deleted file mode 100644 index 5f16680aa4..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/normal.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/overall.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/overall.png deleted file mode 100644 index 50e4458e8e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/overall.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/ultimate_ironman.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/ultimate_ironman.png deleted file mode 100644 index 2511b4395f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/ultimate_ironman.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1017.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1017.png deleted file mode 100644 index 68c1ec8860..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1017.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1018.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1018.png deleted file mode 100644 index ba6284804a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1018.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1019.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1019.png deleted file mode 100644 index 1f046b785b..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1019.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1020.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1020.png deleted file mode 100644 index 5e6ebc74af..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1020.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1021.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1021.png deleted file mode 100644 index e72b210679..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1021.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1022.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1022.png deleted file mode 100644 index c2feb84e75..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1022.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1023.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1023.png deleted file mode 100644 index 5e267ff095..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1023.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1024.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1024.png deleted file mode 100644 index 73807e0afe..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1024.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1025.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1025.png deleted file mode 100644 index ac3b9f40c3..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1025.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1031.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1031.png deleted file mode 100644 index 667809026a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1031.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1032.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1032.png deleted file mode 100644 index 97d23f1803..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1032.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1033.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1033.png deleted file mode 100644 index d5a76d21d4..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1033.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1034.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1034.png deleted file mode 100644 index eaf5cc4fc3..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1034.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1035.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1035.png deleted file mode 100644 index 278f4a2665..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1035.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1036.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1036.png deleted file mode 100644 index 0f80cecdcd..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1036.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1037.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1037.png deleted file mode 100644 index a34dc2fedc..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1037.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1038.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1038.png deleted file mode 100644 index af34ca7d71..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1038.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1039.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1039.png deleted file mode 100644 index 1a5a8fbe2e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1039.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1053.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1053.png deleted file mode 100644 index 3fe0611693..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1053.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1182.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1182.png deleted file mode 100644 index c710825a82..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1182.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1299.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1299.png deleted file mode 100644 index b6ab5f6e4f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1299.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1414.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1414.png deleted file mode 100644 index dcbc2fce14..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1414.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1441.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1441.png deleted file mode 100644 index 4c43d934c8..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1441.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1583.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1583.png deleted file mode 100644 index 44598b0045..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1583.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1584.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1584.png deleted file mode 100644 index a53f4023fd..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1584.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1611.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1611.png deleted file mode 100644 index 09f9f3fd93..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1611.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/168.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/168.png deleted file mode 100644 index 213614c064..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/168.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/169.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/169.png deleted file mode 100644 index 45d3152faf..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/169.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1702.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1702.png deleted file mode 100644 index 45949408ed..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1702.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1703.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1703.png deleted file mode 100644 index 82bf0f56c7..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1703.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1711.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1711.png deleted file mode 100644 index b12d622eff..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/1711.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/201.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/201.png deleted file mode 100644 index 71a08936f6..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/201.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/773.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/773.png deleted file mode 100644 index 56115c3fb6..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/773.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/776.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/776.png deleted file mode 100644 index d8dd8b896f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/776.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/780.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/780.png deleted file mode 100644 index 01bac7217d..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/780.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/782.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/782.png deleted file mode 100644 index 2ec4943a11..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/782.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/783.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/783.png deleted file mode 100644 index 5c8a278511..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/783.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/788.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/788.png deleted file mode 100644 index 961431d158..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/788.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/789.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/789.png deleted file mode 100644 index 5a113d775d..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/789.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/790.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/790.png deleted file mode 100644 index 83e707354e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/790.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/791.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/791.png deleted file mode 100644 index 7651b5394b..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/791.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/792.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/792.png deleted file mode 100644 index 12ff9f9ebb..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/792.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/898.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/898.png deleted file mode 100644 index c7c206c329..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/898.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/900.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/900.png deleted file mode 100644 index 80c3b83fc8..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/900.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/901.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/901.png deleted file mode 100644 index c9da35a111..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/901.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/902.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/902.png deleted file mode 100644 index f9d3d1bcde..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/902.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/904.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/904.png deleted file mode 100644 index 511655feac..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/904.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/907.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/907.png deleted file mode 100644 index 823b4ffcf5..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/907.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/908.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/908.png deleted file mode 100644 index 4a7bcc240a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/908.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/909.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/909.png deleted file mode 100644 index fa04dc22b4..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/909.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/910.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/910.png deleted file mode 100644 index 601d9edc34..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/910.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1026.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1026.png deleted file mode 100644 index 24ea7793fe..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1026.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1027.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1027.png deleted file mode 100644 index 1e9f5dfdde..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1027.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1028.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1028.png deleted file mode 100644 index 69728c780d..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1028.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1029.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1029.png deleted file mode 100644 index 2ab1efdb23..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1029.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1030_bottom_left.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1030_bottom_left.png deleted file mode 100644 index 6c73703482..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1030_bottom_left.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1030_bottom_middle.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1030_bottom_middle.png deleted file mode 100644 index 5870287503..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1030_bottom_middle.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1030_bottom_right.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1030_bottom_right.png deleted file mode 100644 index 2ae201fd1b..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1030_bottom_right.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1030_top_left.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1030_top_left.png deleted file mode 100644 index 2e21f2fa3f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1030_top_left.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1030_top_middle.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1030_top_middle.png deleted file mode 100644 index e0e45dbc0a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1030_top_middle.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1030_top_right.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1030_top_right.png deleted file mode 100644 index b96a7a733b..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2005/widget/1030_top_right.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1026.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1026.png deleted file mode 100644 index 2410a1bf74..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1026.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1027.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1027.png deleted file mode 100644 index 6213895b23..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1027.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1028.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1028.png deleted file mode 100644 index 2410a1bf74..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1028.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1029.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1029.png deleted file mode 100644 index 6213895b23..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1029.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1030.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1030.png deleted file mode 100644 index e168208974..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1030.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1032.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1032.png deleted file mode 100644 index a49fce3af1..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1032.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1033.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1033.png deleted file mode 100644 index a9ade86c55..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1033.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1034.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1034.png deleted file mode 100644 index 486de7d267..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1034.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1035.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1035.png deleted file mode 100644 index 5bf3550d27..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1035.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1036.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1036.png deleted file mode 100644 index b7447301f1..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1036.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1037.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1037.png deleted file mode 100644 index df3e68d8eb..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1037.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1038.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1038.png deleted file mode 100644 index 48fea5f6a8..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1038.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1039.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1039.png deleted file mode 100644 index 236a4676ec..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1039.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1071.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1071.png deleted file mode 100644 index a7f93c8a47..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1071.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1072.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1072.png deleted file mode 100644 index 2141f67c17..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1072.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1173.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1173.png deleted file mode 100644 index bbe981e6bb..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1173.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1174.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1174.png deleted file mode 100644 index 0900f05360..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1174.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1175.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1175.png deleted file mode 100644 index a32b80d2fd..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1175.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1176.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1176.png deleted file mode 100644 index d580139820..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1176.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1177.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1177.png deleted file mode 100644 index 5620867d3f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1177.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1180.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1180.png deleted file mode 100644 index af7e7ea2b2..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1180.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1181.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1181.png deleted file mode 100644 index c060160c5f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1181.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1182.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1182.png deleted file mode 100644 index 1bc75669e4..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1182.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1196.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1196.png deleted file mode 100644 index ac572c1882..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1196.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1197.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1197.png deleted file mode 100644 index b8ff55b23b..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1197.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1198.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1198.png deleted file mode 100644 index ac572c1882..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1198.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1199.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1199.png deleted file mode 100644 index b8ff55b23b..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1199.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1438.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1438.png deleted file mode 100644 index c41e23b5ca..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1438.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1439.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1439.png deleted file mode 100644 index fca91df35e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1439.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1440.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1440.png deleted file mode 100644 index c395c40f39..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/1440.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/168.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/168.png deleted file mode 100644 index 97d42146b8..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/168.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/197.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/197.png deleted file mode 100644 index d7ca3ddc39..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/197.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/198.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/198.png deleted file mode 100644 index b29b0dac0d..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/198.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/199.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/199.png deleted file mode 100644 index 3d1479a41a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/199.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/200.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/200.png deleted file mode 100644 index 8806b812bb..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/200.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/201.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/201.png deleted file mode 100644 index 12a57c9c72..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/201.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/202.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/202.png deleted file mode 100644 index 3c50ed7a32..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/202.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/203.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/203.png deleted file mode 100644 index 15dfae9ccc..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/203.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/204.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/204.png deleted file mode 100644 index 386ca95760..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/204.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/205.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/205.png deleted file mode 100644 index 33100dfb56..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/205.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/206.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/206.png deleted file mode 100644 index 9f48193d36..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/206.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/207.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/207.png deleted file mode 100644 index eb330a9a94..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/207.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/208.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/208.png deleted file mode 100644 index fb0708af19..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/208.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/209.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/209.png deleted file mode 100644 index 909aad5078..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/209.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/210.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/210.png deleted file mode 100644 index d5a9e0d64e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/210.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/211.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/211.png deleted file mode 100644 index 2262dcc6bc..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/211.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/212.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/212.png deleted file mode 100644 index 61c2f1a84b..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/212.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/213.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/213.png deleted file mode 100644 index eec0622a15..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/213.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/214.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/214.png deleted file mode 100644 index 988b1f3913..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/214.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/215.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/215.png deleted file mode 100644 index d002d1825f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/215.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/216.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/216.png deleted file mode 100644 index f9ef87d4ae..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/216.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/217.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/217.png deleted file mode 100644 index 5749f8503c..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/217.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/220.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/220.png deleted file mode 100644 index e737570516..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/220.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/221.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/221.png deleted file mode 100644 index 94fad41924..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/221.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/539.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/539.png deleted file mode 100644 index 3eb47c1235..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/539.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/540.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/540.png deleted file mode 100644 index e8a95e6ebe..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/540.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/541.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/541.png deleted file mode 100644 index 3eb47c1235..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/541.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/542.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/542.png deleted file mode 100644 index a7553a8979..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/542.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/780.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/780.png deleted file mode 100644 index aeb5c2c2ab..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/780.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/782.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/782.png deleted file mode 100644 index aa2fcb1443..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/782.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/783.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/783.png deleted file mode 100644 index 05ef7f2fac..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/783.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/898.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/898.png deleted file mode 100644 index 217ca4096f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/898.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/900.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/900.png deleted file mode 100644 index 4fc45e1f2e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/900.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/901.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/901.png deleted file mode 100644 index 0aa808d800..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/901.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/902.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/902.png deleted file mode 100644 index a7dfed212c..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/902.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/904.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/904.png deleted file mode 100644 index 0cb0b55f7d..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/904.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/907.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/907.png deleted file mode 100644 index 021c8edb26..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/907.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/908.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/908.png deleted file mode 100644 index 64beab911a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/908.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/909.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/909.png deleted file mode 100644 index 2484747f6e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/909.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/910.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/910.png deleted file mode 100644 index f233eb8f3e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/910.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/back_30px.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/back_30px.png deleted file mode 100644 index 89e37c75bd..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/back_30px.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/back_90px.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/back_90px.png deleted file mode 100644 index c609c99d4e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/back_90px.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/front_30px.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/front_30px.png deleted file mode 100644 index 54da07dc63..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/front_30px.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/front_90px.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/front_90px.png deleted file mode 100644 index b7cc3e38b7..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/front_90px.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/block.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/block.png deleted file mode 100644 index 77517eb945..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/block.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/damage1.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/damage1.png deleted file mode 100644 index 5163433cfa..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/damage1.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/damage2.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/damage2.png deleted file mode 100644 index 9c5d8e4a7f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/damage2.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/damage3.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/damage3.png deleted file mode 100644 index fca8c97531..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/damage3.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/damage4.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/damage4.png deleted file mode 100644 index 8ad76ba881..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/damage4.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/disease1.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/disease1.png deleted file mode 100644 index 4525368ed4..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/disease1.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/disease2.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/disease2.png deleted file mode 100644 index a6a6fc7aae..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/disease2.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/disease3.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/disease3.png deleted file mode 100644 index c62bdea52f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/disease3.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/disease4.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/disease4.png deleted file mode 100644 index 61ac7f13d8..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/disease4.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/heal1.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/heal1.png deleted file mode 100644 index df99aab44a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/heal1.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/heal2.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/heal2.png deleted file mode 100644 index 0d59e3e7c2..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/heal2.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/heal3.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/heal3.png deleted file mode 100644 index 6bdad62f76..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/heal3.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/heal4.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/heal4.png deleted file mode 100644 index 2968fe46af..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/heal4.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/poison1.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/poison1.png deleted file mode 100644 index 373ea5038b..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/poison1.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/poison2.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/poison2.png deleted file mode 100644 index 8f26519510..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/poison2.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/poison3.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/poison3.png deleted file mode 100644 index b8ae782a2d..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/poison3.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/poison4.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/poison4.png deleted file mode 100644 index b46fa29075..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/poison4.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/shield1.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/shield1.png deleted file mode 100644 index 2f1434d1a2..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/shield1.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/shield2.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/shield2.png deleted file mode 100644 index f3f5a41bfa..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/shield2.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/shield3.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/shield3.png deleted file mode 100644 index d196aadc51..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/shield3.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/shield4.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/shield4.png deleted file mode 100644 index fa90ba6bfb..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/shield4.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/venom1.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/venom1.png deleted file mode 100644 index 1c245fc4ba..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/venom1.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/venom2.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/venom2.png deleted file mode 100644 index 173ddada59..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/venom2.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/venom3.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/venom3.png deleted file mode 100644 index aab10a7893..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/venom3.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/venom4.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/venom4.png deleted file mode 100644 index 5d2162afcb..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/hitsplat/venom4.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/0.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/0.png deleted file mode 100644 index b817c474c0..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/0.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/1.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/1.png deleted file mode 100644 index a6add2616d..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/1.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/2.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/2.png deleted file mode 100644 index 015b85e5a0..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/2.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/3.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/3.png deleted file mode 100644 index e62c91b16c..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/3.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/4.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/4.png deleted file mode 100644 index 695cc03088..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/4.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/5.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/5.png deleted file mode 100644 index f69f4eb430..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/5.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/6.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/6.png deleted file mode 100644 index 0d156b6a17..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/6.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/7.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/7.png deleted file mode 100644 index c17114ae82..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/rs3/cross_sprites/7.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/add_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/add_icon.png deleted file mode 100644 index c16a645f37..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/add_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/back_arrow_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/back_arrow_icon.png deleted file mode 100644 index ee2d075347..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/back_arrow_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/delete_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/delete_icon.png deleted file mode 100644 index 18b67f23f3..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/delete_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/export_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/export_icon.png deleted file mode 100644 index fb328bc295..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/export_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/filter_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/filter_icon.png deleted file mode 100644 index f71cd1e09e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/filter_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/highlight_color_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/highlight_color_icon.png deleted file mode 100644 index fb9b6816e5..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/highlight_color_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/highlight_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/highlight_icon.png deleted file mode 100644 index 7122914035..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/highlight_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/import_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/import_icon.png deleted file mode 100644 index 20e531ecd4..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/import_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/inventorysetups_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/inventorysetups_icon.png deleted file mode 100644 index 70e415beec..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/inventorysetups_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/remove_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/remove_icon.png deleted file mode 100644 index 3f4915d041..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/remove_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/stack_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/stack_icon.png deleted file mode 100644 index f0dfe5ed3d..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/stack_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/unordered_highlight_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/unordered_highlight_icon.png deleted file mode 100644 index 1c5313eed9..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/unordered_highlight_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/update_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/update_icon.png deleted file mode 100644 index f489b449f7..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/update_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/variation_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/variation_icon.png deleted file mode 100644 index 83b937eb39..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/variation_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/visible_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/visible_icon.png deleted file mode 100644 index 5c4232c808..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/inventorysetups/visible_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/kourendlibrary/panel_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/kourendlibrary/panel_icon.png deleted file mode 100644 index cb450287cc..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/kourendlibrary/panel_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/leaguechaticons/league_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/leaguechaticons/league_icon.png deleted file mode 100644 index 41e4487120..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/leaguechaticons/league_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/back_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/back_icon.png deleted file mode 100644 index 96b9200f60..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/back_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/collapsed.png b/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/collapsed.png deleted file mode 100644 index 449f68ae6c..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/collapsed.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/delete-white.png b/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/delete-white.png deleted file mode 100644 index 014cf20850..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/delete-white.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/expanded.png b/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/expanded.png deleted file mode 100644 index df41d71bc9..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/expanded.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/grouped_loot_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/grouped_loot_icon.png deleted file mode 100644 index 5827719316..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/grouped_loot_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/invisible_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/invisible_icon.png deleted file mode 100644 index a52cbfe0a7..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/invisible_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/panel_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/panel_icon.png deleted file mode 100644 index ac88ed20fe..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/panel_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/single_loot_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/single_loot_icon.png deleted file mode 100644 index 6c2214da99..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/single_loot_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/visible_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/visible_icon.png deleted file mode 100644 index 5c4232c808..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/loottracker/visible_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/notes/add_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/notes/add_icon.png deleted file mode 100644 index 343c3dce0c..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/notes/add_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/notes/notes_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/notes/notes_icon.png deleted file mode 100644 index 9b2625aeb7..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/notes/notes_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/openosrs/externalmanager_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/openosrs/externalmanager_icon.png new file mode 100644 index 0000000000..7cb7e2502c Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/openosrs/externalmanager_icon.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/customclientresizing/add_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/openosrs/externals/add_icon.png similarity index 100% rename from runelite-client/src/main/resources/net/runelite/client/plugins/customclientresizing/add_icon.png rename to runelite-client/src/main/resources/net/runelite/client/plugins/openosrs/externals/add_icon.png diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/openosrs/externals/config_back_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/openosrs/externals/config_back_icon.png new file mode 100644 index 0000000000..42c78a7e5e Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/openosrs/externals/config_back_icon.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/customclientresizing/cancel_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/openosrs/externals/delete_icon.png similarity index 100% rename from runelite-client/src/main/resources/net/runelite/client/plugins/customclientresizing/cancel_icon.png rename to runelite-client/src/main/resources/net/runelite/client/plugins/openosrs/externals/delete_icon.png diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/playerindicators/agility.png b/runelite-client/src/main/resources/net/runelite/client/plugins/playerindicators/agility.png deleted file mode 100644 index 42d1d93d07..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/playerindicators/agility.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/playerindicators/no-agility.png b/runelite-client/src/main/resources/net/runelite/client/plugins/playerindicators/no-agility.png deleted file mode 100644 index 3f4915d041..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/playerindicators/no-agility.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/playerindicators/skull.png b/runelite-client/src/main/resources/net/runelite/client/plugins/playerindicators/skull.png deleted file mode 100644 index 09869ea0e1..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/playerindicators/skull.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/altar.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/altar.png deleted file mode 100644 index ddc3b4a6b5..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/altar.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/annakarl.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/annakarl.png deleted file mode 100644 index 08059d17e4..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/annakarl.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/ardougne.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/ardougne.png deleted file mode 100644 index cfd9db0b2c..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/ardougne.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/camelot.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/camelot.png deleted file mode 100644 index d9bc6d7061..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/camelot.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/carrallangar.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/carrallangar.png deleted file mode 100644 index 41b91276d3..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/carrallangar.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/catherby.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/catherby.png deleted file mode 100644 index 1400309f10..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/catherby.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/digsitependant.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/digsitependant.png deleted file mode 100644 index 9be6e9c5e8..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/digsitependant.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/exitportal.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/exitportal.png deleted file mode 100644 index acba75424a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/exitportal.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/falador.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/falador.png deleted file mode 100644 index 08193d6a2d..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/falador.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/fishingguild.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/fishingguild.png deleted file mode 100644 index 9b9fab7a26..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/fishingguild.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/ghorrock.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/ghorrock.png deleted file mode 100644 index da4926c429..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/ghorrock.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/glory.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/glory.png deleted file mode 100644 index 9556973f5b..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/glory.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/jewellery.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/jewellery.png deleted file mode 100644 index 23e68a25d6..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/jewellery.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/kharyll.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/kharyll.png deleted file mode 100644 index 8d0b228a6e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/kharyll.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/kourend.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/kourend.png deleted file mode 100644 index 22264b2b6e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/kourend.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/lumbridge.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/lumbridge.png deleted file mode 100644 index c5a8502a79..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/lumbridge.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/lunarisle.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/lunarisle.png deleted file mode 100644 index f0042898fd..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/lunarisle.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/marim.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/marim.png deleted file mode 100644 index 6f018e7ef3..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/marim.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/pool.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/pool.png deleted file mode 100644 index 0a7f28ea24..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/pool.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/portalnexus.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/portalnexus.png deleted file mode 100644 index 15f6626c3b..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/portalnexus.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/repair.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/repair.png deleted file mode 100644 index f8d594374d..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/repair.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/senntisten.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/senntisten.png deleted file mode 100644 index 3bb300bc95..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/senntisten.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/spellbook.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/spellbook.png deleted file mode 100644 index bd3ff43703..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/spellbook.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/transportation.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/transportation.png deleted file mode 100644 index b5648c0ca1..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/transportation.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/trollheim.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/trollheim.png deleted file mode 100644 index 31ffe765fb..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/trollheim.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/varrock.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/varrock.png deleted file mode 100644 index 3a109a8858..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/varrock.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/waterbirth.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/waterbirth.png deleted file mode 100644 index a49327b3ff..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/waterbirth.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/xericstalisman.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/xericstalisman.png deleted file mode 100644 index cb21c4e067..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/xericstalisman.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/yanille.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/yanille.png deleted file mode 100644 index 4a61cdeb80..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/yanille.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poison/1067-DISEASE.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poison/1067-DISEASE.png deleted file mode 100644 index f2ff5ac911..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poison/1067-DISEASE.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poison/1067-POISON.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poison/1067-POISON.png deleted file mode 100644 index a4b05c1ca1..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poison/1067-POISON.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poison/1067-VENOM.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poison/1067-VENOM.png deleted file mode 100644 index df6816bb74..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/poison/1067-VENOM.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/prayer/back.png b/runelite-client/src/main/resources/net/runelite/client/plugins/prayer/back.png deleted file mode 100644 index 76773682c4..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/prayer/back.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/prayer/front.png b/runelite-client/src/main/resources/net/runelite/client/plugins/prayer/front.png deleted file mode 100644 index d8df9d8bfe..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/prayer/front.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/profiles/delete_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/profiles/delete_icon.png deleted file mode 100644 index 18b67f23f3..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/profiles/delete_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/profiles/profiles_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/profiles/profiles_icon.png deleted file mode 100644 index a733eaf4a1..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/profiles/profiles_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/pvptools/skull.png b/runelite-client/src/main/resources/net/runelite/client/plugins/pvptools/skull.png deleted file mode 100644 index 09869ea0e1..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/pvptools/skull.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/raids/instancereloadhelper.png b/runelite-client/src/main/resources/net/runelite/client/plugins/raids/instancereloadhelper.png deleted file mode 100644 index 13109b4b26..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/raids/instancereloadhelper.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/add_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/add_icon.png deleted file mode 100644 index 343c3dce0c..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/add_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/border_color_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/border_color_icon.png deleted file mode 100644 index 92d6306429..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/border_color_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/cancel_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/cancel_icon.png deleted file mode 100644 index 3f4915d041..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/cancel_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/confirm_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/confirm_icon.png deleted file mode 100644 index 0a60af0872..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/confirm_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/delete_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/delete_icon.png deleted file mode 100644 index 18b67f23f3..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/delete_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/fill_color_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/fill_color_icon.png deleted file mode 100644 index fb9b6816e5..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/fill_color_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/invisible_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/invisible_icon.png deleted file mode 100644 index a52cbfe0a7..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/invisible_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/opacity_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/opacity_icon.png deleted file mode 100644 index 89be73b769..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/opacity_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/panel_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/panel_icon.png deleted file mode 100644 index 02003fe828..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/panel_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/visible_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/visible_icon.png deleted file mode 100644 index 5c4232c808..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/screenmarkers/visible_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/screenshot/screenshot.png b/runelite-client/src/main/resources/net/runelite/client/plugins/screenshot/screenshot.png deleted file mode 100644 index c760c83945..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/screenshot/screenshot.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/banked.png b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/banked.png deleted file mode 100644 index 5256088e5f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/banked.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/calc.png b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/calc.png deleted file mode 100644 index caba2d7b4a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/calc.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_agility.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_agility.json deleted file mode 100644 index cc490c113f..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_agility.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "actions": [ - { - "level": 1, - "icon": 2150, - "name": "Gnome Stronghold", - "xp": 86.5 - }, - { - "level": 10, - "icon": 11849, - "name": "Draynor Village Rooftop", - "xp": 120 - }, - { - "level": 20, - "icon": 11849, - "name": "Al Kharid Rooftop", - "xp": 180 - }, - { - "level": 30, - "icon": 11849, - "name": "Varrock Rooftop", - "xp": 238 - }, - { - "level": 30, - "icon": 10595, - "name": "Penguin Agility Course", - "xp": 540 - }, - { - "level": 35, - "icon": 1365, - "name": "Barbarian Outpost", - "xp": 152.5 - }, - { - "level": 40, - "icon": 11849, - "name": "Canifis Rooftop", - "xp": 240 - }, - { - "level": 48, - "icon": 4026, - "name": "Ape Atoll", - "xp": 580 - }, - { - "level": 50, - "icon": 11849, - "name": "Falador Rooftop", - "xp": 440 - }, - { - "level": 52, - "icon": 964, - "name": "Wilderness Agility Course", - "xp": 571 - }, - { - "level": 60, - "icon": 11849, - "name": "Seers' Village Rooftop", - "xp": 570 - }, - { - "level": 60, - "icon": 4179, - "name": "Werewolf Agility Course", - "xp": 730 - }, - { - "level": 70, - "icon": 11849, - "name": "Pollnivneach Rooftop", - "xp": 890 - }, - { - "level": 75, - "icon": 23962, - "name": "Prifddinas Agility Course", - "xp": 1337 - }, - { - "level": 80, - "icon": 11849, - "name": "Rellekka Rooftop", - "xp": 780 - }, - { - "level": 90, - "icon": 11849, - "name": "Ardougne Rooftop", - "xp": 793 - } - ] -} \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_construction.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_construction.json deleted file mode 100644 index 6d615d5d4d..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_construction.json +++ /dev/null @@ -1,988 +0,0 @@ -{ - "actions": [ - { - "level": 1, - "icon": 8168, - "name": "Exit Portal", - "xp": 100 - }, - { - "level": 1, - "icon": 960, - "name": "Plank", - "xp": 29 - }, - { - "level": 1, - "icon": 8778, - "name": "Oak Plank", - "xp": 60 - }, - { - "level": 1, - "icon": 8780, - "name": "Teak Plank", - "xp": 90 - }, - { - "level": 1, - "icon": 8782, - "name": "Mahogany Plank", - "xp": 140 - }, - { - "level": 1, - "icon": 8180, - "name": "Plant", - "xp": 31 - }, - { - "level": 1, - "icon": 8186, - "name": "Fern", - "xp": 31 - }, - { - "level": 1, - "icon": 8189, - "name": "Short Plant", - "xp": 31 - }, - { - "level": 1, - "icon": 8183, - "name": "Dock Leaf", - "xp": 31 - }, - { - "level": 1, - "icon": 8309, - "name": "Crude Wooden Chair", - "xp": 58 - }, - { - "level": 2, - "icon": 8316, - "name": "Brown Rug", - "xp": 30 - }, - { - "level": 2, - "icon": 8322, - "name": "Torn Curtains", - "xp": 132 - }, - { - "level": 3, - "icon": 8325, - "name": "Clay Fireplace", - "xp": 30 - }, - { - "level": 4, - "icon": 8319, - "name": "Wooden Bookcase", - "xp": 115 - }, - { - "level": 5, - "icon": 8216, - "name": "Firepit", - "xp": 40 - }, - { - "level": 5, - "icon": 8236, - "name": "Cat Blanket", - "xp": 15 - }, - { - "level": 5, - "icon": 8169, - "name": "Decorative Rock", - "xp": 100 - }, - { - "level": 5, - "icon": 8173, - "name": "Tree", - "xp": 31 - }, - { - "level": 6, - "icon": 8181, - "name": "Small Fern", - "xp": 70 - }, - { - "level": 6, - "icon": 8184, - "name": "Thistle", - "xp": 70 - }, - { - "level": 6, - "icon": 8187, - "name": "Bush", - "xp": 70 - }, - { - "level": 6, - "icon": 8187, - "name": "Large Leaf Bush", - "xp": 70 - }, - { - "level": 6, - "icon": 8223, - "name": "Wooden Shelves 1", - "xp": 87 - }, - { - "level": 7, - "icon": 8230, - "name": "Pump and Drain", - "xp": 100 - }, - { - "level": 7, - "icon": 8239, - "name": "Beer Barrel", - "xp": 87 - }, - { - "level": 8, - "icon": 8310, - "name": "Wooden Chair", - "xp": 87 - }, - { - "level": 9, - "icon": 8233, - "name": "Wooden Larder", - "xp": 228 - }, - { - "level": 10, - "icon": 8115, - "name": "Wood Dining Table", - "xp": 115 - }, - { - "level": 10, - "icon": 8170, - "name": "Pond", - "xp": 100 - }, - { - "level": 10, - "icon": 8174, - "name": "Nice Tree", - "xp": 44 - }, - { - "level": 10, - "icon": 8108, - "name": "Wooden Bench", - "xp": 115 - }, - { - "level": 11, - "icon": 8217, - "name": "Firepit with Hook", - "xp": 60 - }, - { - "level": 12, - "icon": 8185, - "name": "Reeds", - "xp": 100 - }, - { - "level": 12, - "icon": 8186, - "name": "Fern", - "xp": 70 - }, - { - "level": 12, - "icon": 8240, - "name": "Cider Barrel", - "xp": 91 - }, - { - "level": 12, - "icon": 8224, - "name": "Wooden Shelves 2", - "xp": 147 - }, - { - "level": 12, - "icon": 8115, - "name": "Wood Table", - "xp": 87 - }, - { - "level": 12, - "icon": 8191, - "name": "Huge Plant", - "xp": 100 - }, - { - "level": 12, - "icon": 8188, - "name": "Tall Plant", - "xp": 100 - }, - { - "level": 13, - "icon": 8317, - "name": "Rug", - "xp": 60 - }, - { - "level": 14, - "icon": 8311, - "name": "Rocking Chair", - "xp": 87 - }, - { - "level": 15, - "icon": 8171, - "name": "Imp Statue", - "xp": 150 - }, - { - "level": 15, - "icon": 8175, - "name": "Oak Tree", - "xp": 70 - }, - { - "level": 16, - "icon": 8102, - "name": "Oak Decoration", - "xp": 120 - }, - { - "level": 17, - "icon": 8218, - "name": "Firepit with Pot", - "xp": 80 - }, - { - "level": 18, - "icon": 8323, - "name": "Curtains", - "xp": 225 - }, - { - "level": 18, - "icon": 1905, - "name": "Asgarnian Ale", - "xp": 184 - }, - { - "level": 19, - "icon": 8237, - "name": "Cat Basket", - "xp": 58 - }, - { - "level": 19, - "icon": 8312, - "name": "Oak Chair", - "xp": 120 - }, - { - "level": 20, - "icon": 8031, - "name": "Wooden Bed", - "xp": 117 - }, - { - "level": 20, - "icon": 8038, - "name": "Shoe Box", - "xp": 58 - }, - { - "level": 21, - "icon": 8045, - "name": "Shaving Stand", - "xp": 30 - }, - { - "level": 22, - "icon": 8116, - "name": "Oak Table", - "xp": 240 - }, - { - "level": 22, - "icon": 8109, - "name": "Oak Bench", - "xp": 240 - }, - { - "level": 23, - "icon": 8225, - "name": "Wooden Shelves 3", - "xp": 147 - }, - { - "level": 24, - "icon": 8219, - "name": "Small Oven", - "xp": 80 - }, - { - "level": 25, - "icon": 8052, - "name": "Oak Clock", - "xp": 142 - }, - { - "level": 26, - "icon": 1909, - "name": "Greenman's Ale", - "xp": 184 - }, - { - "level": 26, - "icon": 8313, - "name": "Oak Armchair", - "xp": 180 - }, - { - "level": 26, - "icon": 8099, - "name": "Rope Bell-Pull", - "xp": 64 - }, - { - "level": 27, - "icon": 8231, - "name": "Pump and Tub", - "xp": 200 - }, - { - "level": 27, - "icon": 8039, - "name": "Oak Drawers", - "xp": 120 - }, - { - "level": 29, - "icon": 8320, - "name": "Oak Bookcase", - "xp": 180 - }, - { - "level": 29, - "icon": 8220, - "name": "Large Oven", - "xp": 100 - }, - { - "level": 29, - "icon": 8046, - "name": "Oak Shaving Stand", - "xp": 61 - }, - { - "level": 30, - "icon": 8176, - "name": "Willow Tree", - "xp": 100 - }, - { - "level": 30, - "icon": 8032, - "name": "Oak Bed", - "xp": 210 - }, - { - "level": 31, - "icon": 8110, - "name": "Carved Oak Bench", - "xp": 240 - }, - { - "level": 31, - "icon": 8117, - "name": "Carved Oak Table", - "xp": 360 - }, - { - "level": 32, - "icon": 8118, - "name": "Oak Table", - "xp": 180 - }, - { - "level": 32, - "icon": 8023, - "name": "Boxing Ring", - "xp": 420 - }, - { - "level": 33, - "icon": 8234, - "name": "Oak Larder", - "xp": 480 - }, - { - "level": 33, - "icon": 8238, - "name": "Cushioned Basket", - "xp": 58 - }, - { - "level": 33, - "icon": 8326, - "name": "Stone Fireplace", - "xp": 40 - }, - { - "level": 34, - "icon": 8221, - "name": "Steel Range", - "xp": 120 - }, - { - "level": 34, - "icon": 8226, - "name": "Oak Shelves 1", - "xp": 240 - }, - { - "level": 34, - "icon": 8028, - "name": "Glove Rack", - "xp": 120 - }, - { - "level": 34, - "icon": 8033, - "name": "Large Oak Bed", - "xp": 330 - }, - { - "level": 35, - "icon": 8314, - "name": "Teak Armchair", - "xp": 180 - }, - { - "level": 36, - "icon": 1911, - "name": "Dragon Bitter", - "xp": 224 - }, - { - "level": 36, - "icon": 8103, - "name": "Teak Decoration", - "xp": 180 - }, - { - "level": 37, - "icon": 8100, - "name": "Bell-Pull", - "xp": 120 - }, - { - "level": 37, - "icon": 8047, - "name": "Oak Dresser", - "xp": 121 - }, - { - "level": 38, - "icon": 8112, - "name": "Teak Bench", - "xp": 360 - }, - { - "level": 38, - "icon": 8118, - "name": "Teak Table", - "xp": 360 - }, - { - "level": 39, - "icon": 8040, - "name": "Oak Wardrobe", - "xp": 180 - }, - { - "level": 40, - "icon": 8034, - "name": "Teak Bed", - "xp": 300 - }, - { - "level": 40, - "icon": 8321, - "name": "Mahogany Bookcase", - "xp": 420 - }, - { - "level": 40, - "icon": 8334, - "name": "Oak Lectern", - "xp": 60 - }, - { - "level": 40, - "icon": 8324, - "name": "Opulent Curtains", - "xp": 315 - }, - { - "level": 41, - "icon": 8024, - "name": "Fencing Ring", - "xp": 570 - }, - { - "level": 41, - "icon": 8341, - "name": "Globe", - "xp": 180 - }, - { - "level": 42, - "icon": 8222, - "name": "Fancy Range", - "xp": 160 - }, - { - "level": 42, - "icon": 8351, - "name": "Crystal Ball", - "xp": 280 - }, - { - "level": 43, - "icon": 8354, - "name": "Alchemical Chart", - "xp": 30 - }, - { - "level": 43, - "icon": 8235, - "name": "Teak larder", - "xp": 750 - }, - { - "level": 44, - "icon": 8348, - "name": "Wooden Telescope", - "xp": 121 - }, - { - "level": 44, - "icon": 8029, - "name": "Weapons Rack", - "xp": 180 - }, - { - "level": 44, - "icon": 8112, - "name": "Carved Teak Bench", - "xp": 360 - }, - { - "level": 45, - "icon": 8227, - "name": "Oak Shelves 2", - "xp": 240 - }, - { - "level": 45, - "icon": 8119, - "name": "Carved Teak Table", - "xp": 600 - }, - { - "level": 45, - "icon": 8035, - "name": "Large Teak Bed", - "xp": 480 - }, - { - "level": 45, - "icon": 8177, - "name": "Maple Tree", - "xp": 122 - }, - { - "level": 46, - "icon": 8048, - "name": "Teak Dresser", - "xp": 181 - }, - { - "level": 47, - "icon": 8232, - "name": "Sink", - "xp": 300 - }, - { - "level": 47, - "icon": 8335, - "name": "Eagle Lectern", - "xp": 120 - }, - { - "level": 47, - "icon": 8336, - "name": "Demon Lectern", - "xp": 120 - }, - { - "level": 47, - "icon": 21913, - "name": "Mounted Mythical Cape", - "xp": 370 - }, - { - "level": 48, - "icon": 5755, - "name": "Chef's Delight", - "xp": 224 - }, - { - "level": 50, - "icon": 8328, - "name": "Teak Portal", - "xp": 270 - }, - { - "level": 50, - "icon": 8315, - "name": "Mahogany Armchair", - "xp": 280 - }, - { - "level": 50, - "icon": 8342, - "name": "Ornamental Globe", - "xp": 270 - }, - { - "level": 50, - "icon": 8331, - "name": "Teleport Focus", - "xp": 40 - }, - { - "level": 51, - "icon": 8041, - "name": "Teak Drawers", - "xp": 180 - }, - { - "level": 51, - "icon": 8025, - "name": "Combat Ring", - "xp": 630 - }, - { - "level": 52, - "icon": 8118, - "name": "Teak Kitchen Table", - "xp": 270 - }, - { - "level": 52, - "icon": 8113, - "name": "Mahogany Bench", - "xp": 560 - }, - { - "level": 52, - "icon": 8120, - "name": "Mahogany Table", - "xp": 840 - }, - { - "level": 53, - "icon": 8036, - "name": "4-Poster Bed", - "xp": 450 - }, - { - "level": 54, - "icon": 8030, - "name": "Extra Weapons Rack", - "xp": 440 - }, - { - "level": 54, - "icon": 8352, - "name": "Elemental Sphere", - "xp": 580 - }, - { - "level": 55, - "icon": 8053, - "name": "Teak Clock", - "xp": 202 - }, - { - "level": 56, - "icon": 8104, - "name": "Gilded Decoration", - "xp": 1020 - }, - { - "level": 56, - "icon": 8049, - "name": "Fancy Teak Dresser", - "xp": 182 - }, - { - "level": 56, - "icon": 8228, - "name": "Teak Shelves 1", - "xp": 330 - }, - { - "level": 57, - "icon": 8337, - "name": "Teak Eagle Lectern", - "xp": 180 - }, - { - "level": 57, - "icon": 8338, - "name": "Teak Demon Lectern", - "xp": 180 - }, - { - "level": 59, - "icon": 8154, - "name": "Limestone attack stone", - "xp": 200 - }, - { - "level": 59, - "icon": 8343, - "name": "Lunar Globe", - "xp": 570 - }, - { - "level": 60, - "icon": 8037, - "name": "Gilded 4-Poster Bed", - "xp": 1330 - }, - { - "level": 60, - "icon": 8101, - "name": "Posh Bell-Pull", - "xp": 420 - }, - { - "level": 60, - "icon": 8178, - "name": "Yew Tree", - "xp": 141 - }, - { - "level": 61, - "icon": 8114, - "name": "Gilded Bench", - "xp": 1760 - }, - { - "level": 63, - "icon": 8042, - "name": "Teak Wardrobe", - "xp": 270 - }, - { - "level": 63, - "icon": 8327, - "name": "Marble Fireplace", - "xp": 500 - }, - { - "level": 63, - "icon": 8355, - "name": "Astronomical Chart", - "xp": 45 - }, - { - "level": 64, - "icon": 8349, - "name": "Teak Telescope", - "xp": 181 - }, - { - "level": 64, - "icon": 8050, - "name": "Mahogany Dresser", - "xp": 281 - }, - { - "level": 65, - "icon": 8329, - "name": "Mahogany Portal", - "xp": 420 - }, - { - "level": 65, - "icon": 8332, - "name": "Greater Focus", - "xp": 500 - }, - { - "level": 65, - "icon": 8318, - "name": "Opulent Rug", - "xp": 360 - }, - { - "level": 66, - "icon": 20649, - "name": "Teak Garden Bench", - "xp": 540 - }, - { - "level": 66, - "icon": 8353, - "name": "Crystal of Power", - "xp": 890 - }, - { - "level": 67, - "icon": 8229, - "name": "Teak Shelves 2", - "xp": 930 - }, - { - "level": 67, - "icon": 8338, - "name": "Mahogany Demon Lectern", - "xp": 580 - }, - { - "level": 67, - "icon": 8338, - "name": "Mahogany Eagle Lectern", - "xp": 580 - }, - { - "level": 68, - "icon": 8344, - "name": "Celestial Globe", - "xp": 570 - }, - { - "level": 70, - "icon": 8172, - "name": "Dungeon Entrance", - "xp": 500 - }, - { - "level": 71, - "icon": 8026, - "name": "Ranging Pedestals", - "xp": 720 - }, - { - "level": 72, - "icon": 8121, - "name": "Opulent Table", - "xp": 3100 - }, - { - "level": 74, - "icon": 8122, - "name": "Oak Door", - "xp": 600 - }, - { - "level": 74, - "icon": 8051, - "name": "Gilded Dresser", - "xp": 582 - }, - { - "level": 75, - "icon": 8043, - "name": "Mahogany Wardrobe", - "xp": 420 - }, - { - "level": 75, - "icon": 8179, - "name": "Magic Tree", - "xp": 223 - }, - { - "level": 77, - "icon": 8341, - "name": "Armillary Globe", - "xp": 960 - }, - { - "level": 80, - "icon": 8330, - "name": "Marble Portal", - "xp": 1500 - }, - { - "level": 80, - "icon": 8333, - "name": "Scrying Pool", - "xp": 2000 - }, - { - "level": 81, - "icon": 8027, - "name": "Balance Beam", - "xp": 1000 - }, - { - "level": 83, - "icon": 8356, - "name": "Infernal Chart", - "xp": 60 - }, - { - "level": 84, - "icon": 8350, - "name": "Mahogany Telescope", - "xp": 281 - }, - { - "level": 85, - "icon": 8054, - "name": "Gilded Clock", - "xp": 602 - }, - { - "level": 86, - "icon": 8346, - "name": "Small Orrery", - "xp": 1320 - }, - { - "level": 87, - "icon": 8044, - "name": "Gilded Wardrobe", - "xp": 720 - }, - { - "level": 95, - "icon": 8347, - "name": "Large Orrery", - "xp": 1420 - } - ] -} diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_cooking.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_cooking.json deleted file mode 100644 index 6ddb07cbaf..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_cooking.json +++ /dev/null @@ -1,718 +0,0 @@ -{ - "actions": [ - { - "level": 1, - "icon": 9436, - "name": "Sinew", - "xp": 3 - }, - { - "level": 1, - "icon": 315, - "name": "Shrimps", - "xp": 30 - }, - { - "level": 1, - "icon": 2140, - "name": "Cooked Chicken", - "xp": 30 - }, - { - "level": 1, - "icon": 2142, - "name": "Cooked Meat", - "xp": 30 - }, - { - "level": 1, - "icon": 3228, - "name": "Cooked Rabbit", - "xp": 30 - }, - { - "level": 1, - "icon": 319, - "name": "Anchovies", - "xp": 30 - }, - { - "level": 1, - "icon": 325, - "name": "Sardine", - "xp": 40 - }, - { - "level": 1, - "icon": 3146, - "name": "Poison Karambwan", - "xp": 80 - }, - { - "level": 1, - "icon": 1861, - "name": "Ugthanki Meat", - "xp": 40 - }, - { - "level": 1, - "icon": 2309, - "name": "Bread", - "xp": 40 - }, - { - "level": 5, - "icon": 347, - "name": "Herring", - "xp": 50 - }, - { - "level": 6, - "icon": 2084, - "name": "Fruit Blast", - "xp": 50 - }, - { - "level": 7, - "icon": 6701, - "name": "Baked Potato", - "xp": 15 - }, - { - "level": 8, - "icon": 2048, - "name": "Pineapple Punch", - "xp": 70 - }, - { - "level": 9, - "icon": 7072, - "name": "Spicy Sauce", - "xp": 25 - }, - { - "level": 10, - "icon": 355, - "name": "Mackerel", - "xp": 60 - }, - { - "level": 10, - "icon": 2325, - "name": "Redberry Pie", - "xp": 78 - }, - { - "level": 10, - "icon": 2217, - "name": "Toad Crunchies", - "xp": 100 - }, - { - "level": 11, - "icon": 7062, - "name": "Chilli Con Carne", - "xp": 55 - }, - { - "level": 11, - "icon": 9980, - "name": "Roast Bird Meat", - "xp": 62.5 - }, - { - "level": 12, - "icon": 3369, - "name": "Thin Snail Meat", - "xp": 70 - }, - { - "level": 12, - "icon": 2213, - "name": "Spicy Crunchies", - "xp": 100 - }, - { - "level": 13, - "icon": 7078, - "name": "Scrambled Egg", - "xp": 50 - }, - { - "level": 14, - "icon": 5763, - "name": "Cider", - "xp": 182 - }, - { - "level": 14, - "icon": 2205, - "name": "Worm Crunchies", - "xp": 104 - }, - { - "level": 15, - "icon": 333, - "name": "Trout", - "xp": 70 - }, - { - "level": 16, - "icon": 6293, - "name": "Spider on stick", - "xp": 80 - }, - { - "level": 16, - "icon": 6295, - "name": "Spider on shaft", - "xp": 80 - }, - { - "level": 16, - "icon": 7223, - "name": "Roast Rabbit", - "xp": 72.5 - }, - { - "level": 16, - "icon": 2209, - "name": "Chocchip crunchies", - "xp": 100 - }, - { - "level": 17, - "icon": 3371, - "name": "Lean Snail Meat", - "xp": 80 - }, - { - "level": 18, - "icon": 339, - "name": "Cod", - "xp": 75 - }, - { - "level": 18, - "icon": 2054, - "name": "Wizard Blizzard", - "xp": 110 - }, - { - "level": 19, - "icon": 1913, - "name": "Dwarven Stout", - "xp": 215 - }, - { - "level": 20, - "icon": 2080, - "name": "Short Green Guy", - "xp": 120 - }, - { - "level": 20, - "icon": 2327, - "name": "Meat Pie", - "xp": 110 - }, - { - "level": 20, - "icon": 351, - "name": "Pike", - "xp": 80 - }, - { - "level": 20, - "icon": 712, - "name": "Cup of tea", - "xp": 52 - }, - { - "level": 21, - "icon": 9988, - "name": "Roast Beast Meat", - "xp": 82.5 - }, - { - "level": 21, - "icon": 7521, - "name": "Cooked Crab Meat", - "xp": 100 - }, - { - "level": 21, - "icon": 2130, - "name": "Pot of cream", - "xp": 18 - }, - { - "level": 22, - "icon": 3373, - "name": "Fat Snail Meat", - "xp": 95 - }, - { - "level": 23, - "icon": 7064, - "name": "Egg And Tomato", - "xp": 50 - }, - { - "level": 24, - "icon": 1905, - "name": "Asgarnian Ale", - "xp": 248 - }, - { - "level": 25, - "icon": 329, - "name": "Salmon", - "xp": 90 - }, - { - "level": 25, - "icon": 2003, - "name": "Stew", - "xp": 117 - }, - { - "level": 25, - "icon": 2277, - "name": "Fruit Batta", - "xp": 150 - }, - { - "level": 26, - "icon": 2255, - "name": "Toad Batta", - "xp": 152 - }, - { - "level": 27, - "icon": 2253, - "name": "Worm Batta", - "xp": 154 - }, - { - "level": 28, - "icon": 2281, - "name": "Vegetable Batta", - "xp": 156 - }, - { - "level": 28, - "icon": 5988, - "name": "Sweetcorn", - "xp": 104 - }, - { - "level": 28, - "icon": 3381, - "name": "Cooked Slimy Eel", - "xp": 95 - }, - { - "level": 29, - "icon": 7170, - "name": "Mud Pie", - "xp": 128 - }, - { - "level": 29, - "icon": 1909, - "name": "Greenman's ale", - "xp": 281 - }, - { - "level": 29, - "icon": 2259, - "name": "Cheese and Tomato Batta", - "xp": 158 - }, - { - "level": 30, - "icon": 361, - "name": "Tuna", - "xp": 100 - }, - { - "level": 30, - "icon": 2323, - "name": "Apple Pie", - "xp": 130 - }, - { - "level": 30, - "icon": 2191, - "name": "Worm Hole", - "xp": 170 - }, - { - "level": 30, - "icon": 3144, - "name": "Cooked Karambwan", - "xp": 190 - }, - { - "level": 30, - "icon": 2878, - "name": "Roasted Chompy", - "xp": 100 - }, - { - "level": 31, - "icon": 7530, - "name": "Fishcake", - "xp": 100 - }, - { - "level": 32, - "icon": 2092, - "name": "Drunk Dragon", - "xp": 160 - }, - { - "level": 33, - "icon": 2074, - "name": "Choc Saturday", - "xp": 170 - }, - { - "level": 34, - "icon": 7178, - "name": "Garden Pie", - "xp": 138 - }, - { - "level": 34, - "icon": 1907, - "name": "Wizard's mind bomb", - "xp": 314 - }, - { - "level": 35, - "icon": 1993, - "name": "Jug Of Wine", - "xp": 200 - }, - { - "level": 35, - "icon": 2289, - "name": "Plain Pizza", - "xp": 143 - }, - { - "level": 35, - "icon": 10136, - "name": "Rainbow Fish", - "xp": 110 - }, - { - "level": 35, - "icon": 2195, - "name": "Veg ball", - "xp": 175 - }, - { - "level": 37, - "icon": 2064, - "name": "Blurberry Special", - "xp": 180 - }, - { - "level": 38, - "icon": 5003, - "name": "Cave Eel", - "xp": 115 - }, - { - "level": 38, - "icon": 6697, - "name": "Pat of butter", - "xp": 40.5 - }, - { - "level": 39, - "icon": 1911, - "name": "Dragon Bitter", - "xp": 347 - }, - { - "level": 39, - "icon": 6703, - "name": "Potato with butter", - "xp": 40 - }, - { - "level": 40, - "icon": 379, - "name": "Lobster", - "xp": 120 - }, - { - "level": 40, - "icon": 1891, - "name": "Cake", - "xp": 180 - }, - { - "level": 40, - "icon": 2187, - "name": "Tangled toad's legs", - "xp": 185 - }, - { - "level": 41, - "icon": 7054, - "name": "Chilli Potato", - "xp": 165.5 - }, - { - "level": 41, - "icon": 7568, - "name": "Cooked Jubbly", - "xp": 160 - }, - { - "level": 42, - "icon": 2185, - "name": "Chocolate Bomb", - "xp": 190 - }, - { - "level": 42, - "icon": 7084, - "name": "Fried Onions", - "xp": 60 - }, - { - "level": 43, - "icon": 365, - "name": "Bass", - "xp": 130 - }, - { - "level": 44, - "icon": 2955, - "name": "Moonlight Mead", - "xp": 380 - }, - { - "level": 45, - "icon": 373, - "name": "Swordfish", - "xp": 140 - }, - { - "level": 45, - "icon": 2293, - "name": "Meat Pizza", - "xp": 169 - }, - { - "level": 46, - "icon": 7082, - "name": "Fried Mushrooms", - "xp": 60 - }, - { - "level": 47, - "icon": 7188, - "name": "Fish Pie", - "xp": 164 - }, - { - "level": 47, - "icon": 6705, - "name": "Potato with cheese", - "xp": 40 - }, - { - "level": 48, - "icon": 1985, - "name": "Cheese", - "xp": 64 - }, - { - "level": 49, - "icon": 5751, - "name": "Axeman's folly", - "xp": 413 - }, - { - "level": 50, - "icon": 2343, - "name": "Cooked Oomlie Wrap", - "xp": 30 - }, - { - "level": 50, - "icon": 1897, - "name": "Chocolate Cake", - "xp": 210 - }, - { - "level": 51, - "icon": 7056, - "name": "Egg Potato", - "xp": 195.5 - }, - { - "level": 52, - "icon": 19662, - "name": "Botanical Pie", - "xp": 180 - }, - { - "level": 53, - "icon": 2149, - "name": "Lava Eel", - "xp": 30 - }, - { - "level": 54, - "icon": 5755, - "name": "Chef's Delight", - "xp": 446 - }, - { - "level": 55, - "icon": 2297, - "name": "Anchovy Pizza", - "xp": 182 - }, - { - "level": 57, - "icon": 7066, - "name": "Mushroom & onion", - "xp": 120 - }, - { - "level": 58, - "icon": 1883, - "name": "Ugthanki Kebab (Fresh)", - "xp": 80 - }, - { - "level": 58, - "icon": 1865, - "name": "Pitta Bread", - "xp": 40 - }, - { - "level": 59, - "icon": 5759, - "name": "Slayer's respite", - "xp": 479 - }, - { - "level": 60, - "icon": 2011, - "name": "Curry", - "xp": 280 - }, - { - "level": 60, - "icon": 21690, - "name": "Mushroom Pie", - "xp": 200 - }, - { - "level": 62, - "icon": 7946, - "name": "Monkfish", - "xp": 150 - }, - { - "level": 64, - "icon": 7058, - "name": "Mushroom Potato", - "xp": 270.5 - }, - { - "level": 65, - "icon": 2301, - "name": "Pineapple Pizza", - "xp": 188 - }, - { - "level": 65, - "icon": 245, - "name": "Wine of Zamorak", - "xp": 200 - }, - { - "level": 67, - "icon": 7068, - "name": "Tuna And Corn", - "xp": 204 - }, - { - "level": 68, - "icon": 7060, - "name": "Tuna Potato", - "xp": 309.5 - }, - { - "level": 70, - "icon": 7198, - "name": "Admiral Pie", - "xp": 210 - }, - { - "level": 72, - "icon": 13339, - "name": "Sacred Eel", - "xp": 109 - }, - { - "level": 73, - "icon": 22795, - "name": "Dragonfruit Pie", - "xp": 220 - }, - { - "level": 80, - "icon": 385, - "name": "Shark", - "xp": 210 - }, - { - "level": 82, - "icon": 397, - "name": "Sea Turtle", - "xp": 211.3 - }, - { - "level": 84, - "icon": 13441, - "name": "Anglerfish", - "xp": 230 - }, - { - "level": 85, - "icon": 7208, - "name": "Wild Pie", - "xp": 240 - }, - { - "level": 90, - "icon": 11936, - "name": "Dark Crab", - "xp": 215 - }, - { - "level": 91, - "icon": 391, - "name": "Manta Ray", - "xp": 216.3 - }, - { - "level": 95, - "icon": 7218, - "name": "Summer Pie", - "xp": 260 - } - ] -} \ No newline at end of file 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 deleted file mode 100644 index 3df88b7ab5..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_crafting.json +++ /dev/null @@ -1,742 +0,0 @@ -{ - "actions": [ - { - "level": 1, - "icon": 1759, - "name": "Ball Of Wool", - "xp": 2.5 - }, - { - "level": 1, - "icon": 1059, - "name": "Leather Gloves", - "xp": 13.8 - }, - { - "level": 1, - "icon": 1609, - "name": "Opal", - "xp": 15 - }, - { - "level": 1, - "icon": 21081, - "name": "Opal Ring", - "xp": 10 - }, - { - "level": 1, - "icon": 1775, - "name": "Molten Glass", - "xp": 20 - }, - { - "level": 1, - "icon": 1919, - "name": "Beer Glass", - "xp": 17.5 - }, - { - "level": 4, - "icon": 4527, - "name": "Empty Candle Lantern", - "xp": 19 - }, - { - "level": 5, - "icon": 1635, - "name": "Gold Ring", - "xp": 15 - }, - { - "level": 5, - "icon": 21512, - "name": "Bird House", - "xp": 15 - }, - { - "level": 6, - "icon": 1654, - "name": "Gold Necklace", - "xp": 20 - }, - { - "level": 7, - "icon": 1061, - "name": "Leather Boots", - "xp": 16.3 - }, - { - "level": 7, - "icon": 11068, - "name": "Gold Bracelet", - "xp": 25 - }, - { - "level": 8, - "icon": 1673, - "name": "Gold Amulet (U)", - "xp": 30 - }, - { - "level": 9, - "icon": 1167, - "name": "Cowl", - "xp": 18.5 - }, - { - "level": 10, - "icon": 9438, - "name": "Crossbow String", - "xp": 15 - }, - { - "level": 10, - "icon": 1777, - "name": "Bow String", - "xp": 15 - }, - { - "level": 11, - "icon": 1063, - "name": "Leather Vambraces", - "xp": 22 - }, - { - "level": 12, - "icon": 4525, - "name": "Empty Oil Lamp", - "xp": 25 - }, - { - "level": 13, - "icon": 1611, - "name": "Jade", - "xp": 20 - }, - { - "level": 13, - "icon": 21084, - "name": "Jade Ring", - "xp": 32 - }, - { - "level": 14, - "icon": 1129, - "name": "Leather Body", - "xp": 25 - }, - { - "level": 15, - "icon": 21515, - "name": "Oak Bird House", - "xp": 20 - }, - { - "level": 16, - "icon": 1613, - "name": "Red Topaz", - "xp": 25 - }, - { - "level": 16, - "icon": 21087, - "name": "Topaz Ring", - "xp": 35 - }, - { - "level": 16, - "icon": 1718, - "name": "Holy Symbol", - "xp": 50 - }, - { - "level": 16, - "icon": 21090, - "name": "Opal Necklace", - "xp": 35 - }, - { - "level": 17, - "icon": 1724, - "name": "Unholy Symbol", - "xp": 50 - }, - { - "level": 18, - "icon": 1095, - "name": "Leather Chaps", - "xp": 27 - }, - { - "level": 19, - "icon": 6038, - "name": "Magic String", - "xp": 30 - }, - { - "level": 20, - "icon": 1637, - "name": "Sapphire Ring", - "xp": 40 - }, - { - "level": 20, - "icon": 1607, - "name": "Sapphire", - "xp": 50 - }, - { - "level": 21, - "icon": 5418, - "name": "Empty Sack", - "xp": 38 - }, - { - "level": 22, - "icon": 1656, - "name": "Sapphire Necklace", - "xp": 55 - }, - { - "level": 22, - "icon": 21117, - "name": "Opal Bracelet", - "xp": 45 - }, - { - "level": 23, - "icon": 11071, - "name": "Sapphire Bracelet", - "xp": 60 - }, - { - "level": 23, - "icon": 5525, - "name": "Tiara", - "xp": 52.5 - }, - { - "level": 24, - "icon": 1675, - "name": "Sapphire Amulet (U)", - "xp": 65 - }, - { - "level": 25, - "icon": 21093, - "name": "Jade Necklace", - "xp": 54 - }, - { - "level": 25, - "icon": 21518, - "name": "Willow Bird House", - "xp": 25 - }, - { - "level": 26, - "icon": 6209, - "name": "Drift Net", - "xp": 55 - }, - { - "level": 27, - "icon": 1605, - "name": "Emerald", - "xp": 67.5 - }, - { - "level": 27, - "icon": 1639, - "name": "Emerald Ring", - "xp": 55 - }, - { - "level": 27, - "icon": 21099, - "name": "Opal Amulet (U)", - "xp": 55 - }, - { - "level": 28, - "icon": 1131, - "name": "Hardleather Body", - "xp": 35 - }, - { - "level": 29, - "icon": 1658, - "name": "Emerald Necklace", - "xp": 60 - }, - { - "level": 29, - "icon": 21120, - "name": "Jade Bracelet", - "xp": 60 - }, - { - "level": 30, - "icon": 11076, - "name": "Emerald Bracelet", - "xp": 65 - }, - { - "level": 30, - "icon": 954, - "name": "Rope", - "xp": 25 - }, - { - "level": 31, - "icon": 1677, - "name": "Emerald Amulet (U)", - "xp": 70 - }, - { - "level": 32, - "icon": 10077, - "name": "Spiky Vambraces", - "xp": 6 - }, - { - "level": 32, - "icon": 21096, - "name": "Topaz Necklace", - "xp": 70 - }, - { - "level": 33, - "icon": 229, - "name": "Vial", - "xp": 35 - }, - { - "level": 34, - "icon": 1603, - "name": "Ruby", - "xp": 85 - }, - { - "level": 34, - "icon": 1641, - "name": "Ruby Ring", - "xp": 70 - }, - { - "level": 34, - "icon": 21102, - "name": "Jade Amulet (U)", - "xp": 70 - }, - { - "level": 35, - "icon": 6235, - "name": "Broodoo shield", - "xp": 100 - }, - { - "level": 35, - "icon": 21521, - "name": "Teak Bird House", - "xp": 30 - }, - { - "level": 36, - "icon": 5376, - "name": "Basket", - "xp": 56 - }, - { - "level": 38, - "icon": 1169, - "name": "Coif", - "xp": 37 - }, - { - "level": 38, - "icon": 21123, - "name": "Topaz Bracelet", - "xp": 75 - }, - { - "level": 40, - "icon": 1660, - "name": "Ruby Necklace", - "xp": 75 - }, - { - "level": 41, - "icon": 22269, - "name": "Hard leather shield", - "xp": 70 - }, - { - "level": 42, - "icon": 11085, - "name": "Ruby Bracelet", - "xp": 80 - }, - { - "level": 42, - "icon": 6668, - "name": "Fishbowl", - "xp": 42.5 - }, - { - "level": 43, - "icon": 1601, - "name": "Diamond", - "xp": 107.5 - }, - { - "level": 43, - "icon": 1643, - "name": "Diamond Ring", - "xp": 85 - }, - { - "level": 45, - "icon": 21105, - "name": "Topaz Amulet (U)", - "xp": 80 - }, - { - "level": 45, - "icon": 6328, - "name": "Snakeskin boots", - "xp": 30 - }, - { - "level": 45, - "icon": 22192, - "name": "Maple Bird House", - "xp": 35 - }, - { - "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, - "name": "Lantern Lens", - "xp": 55 - }, - { - "level": 50, - "icon": 1679, - "name": "Ruby Amulet (U)", - "xp": 85 - }, - { - "level": 50, - "icon": 22195, - "name": "Mahogany Bird House", - "xp": 40 - }, - { - "level": 51, - "icon": 6324, - "name": "Snakeskin chaps", - "xp": 50 - }, - { - "level": 53, - "icon": 6322, - "name": "Snakeskin body", - "xp": 55 - }, - { - "level": 54, - "icon": 1395, - "name": "Water Battlestaff", - "xp": 100 - }, - { - "level": 55, - "icon": 1645, - "name": "Dragonstone Ring", - "xp": 100 - }, - { - "level": 55, - "icon": 1615, - "name": "Dragonstone", - "xp": 137.5 - }, - { - "level": 56, - "icon": 1662, - "name": "Diamond Necklace", - "xp": 90 - }, - { - "level": 56, - "icon": 22272, - "name": "Snakeskin shield", - "xp": 100 - }, - { - "level": 57, - "icon": 1065, - "name": "Green D'hide Vamb", - "xp": 62 - }, - { - "level": 58, - "icon": 11092, - "name": "Diamond Bracelet", - "xp": 95 - }, - { - "level": 58, - "icon": 1399, - "name": "Earth Battlestaff", - "xp": 112.5 - }, - { - "level": 60, - "icon": 1099, - "name": "Green D'hide Chaps", - "xp": 124 - }, - { - "level": 60, - "icon": 22198, - "name": "Yew Bird House", - "xp": 45 - }, - { - "level": 62, - "icon": 1393, - "name": "Fire Battlestaff", - "xp": 125 - }, - { - "level": 62, - "icon": 22275, - "name": "Green D'hide Shield", - "xp": 124 - }, - { - "level": 63, - "icon": 1135, - "name": "Green D'hide Body", - "xp": 186 - }, - { - "level": 66, - "icon": 1397, - "name": "Air Battlestaff", - "xp": 137.5 - }, - { - "level": 66, - "icon": 2487, - "name": "Blue D'hide Vamb", - "xp": 70 - }, - { - "level": 67, - "icon": 6575, - "name": "Onyx Ring", - "xp": 115 - }, - { - "level": 67, - "icon": 6573, - "name": "Onyx", - "xp": 167.5 - }, - { - "level": 68, - "icon": 2493, - "name": "Blue D'hide Chaps", - "xp": 140 - }, - { - "level": 69, - "icon": 22278, - "name": "Blue D'hide Shield", - "xp": 140 - }, - { - "level": 70, - "icon": 1681, - "name": "Diamond Amulet (U)", - "xp": 100 - }, - { - "level": 71, - "icon": 2499, - "name": "Blue D'hide Body", - "xp": 210 - }, - { - "level": 72, - "icon": 1664, - "name": "Dragonstone Necklace", - "xp": 105 - }, - { - "level": 73, - "icon": 2489, - "name": "Red D'hide Vamb", - "xp": 78 - }, - { - "level": 74, - "icon": 11115, - "name": "Dragonstone Bracelet", - "xp": 110 - }, - { - "level": 75, - "icon": 2495, - "name": "Red D'hide Chaps", - "xp": 156 - }, - { - "level": 75, - "icon": 22201, - "name": "Magic Bird House", - "xp": 50 - }, - { - "level": 76, - "icon": 22281, - "name": "Red D'hide Shield", - "xp": 156 - }, - { - "level": 77, - "icon": 2501, - "name": "Red D'hide Body", - "xp": 234 - }, - { - "level": 79, - "icon": 2491, - "name": "Black D'hide Vamb", - "xp": 86 - }, - { - "level": 80, - "icon": 1683, - "name": "Dragonstone Amulet (U)", - "xp": 150 - }, - { - "level": 82, - "icon": 2497, - "name": "Black D'hide Chaps", - "xp": 172 - }, - { - "level": 82, - "icon": 6577, - "name": "Onyx Necklace", - "xp": 120 - }, - { - "level": 83, - "icon": 21338, - "name": "Amethyst Bolt Tips", - "xp": 60 - }, - { - "level": 83, - "icon": 22284, - "name": "Black D'hide Shield", - "xp": 172 - }, - { - "level": 84, - "icon": 2503, - "name": "Black D'hide Body", - "xp": 258 - }, - { - "level": 84, - "icon": 11130, - "name": "Onyx Bracelet", - "xp": 125 - }, - { - "level": 85, - "icon": 21350, - "name": "Amethyst Arrowtips", - "xp": 60 - }, - { - "level": 87, - "icon": 21352, - "name": "Amethyst Javelin Heads", - "xp": 60 - }, - { - "level": 87, - "icon": 10973, - "name": "Light Orb", - "xp": 70 - }, - { - "level": 89, - "icon": 19538, - "name": "Zenyte Ring", - "xp": 150 - }, - { - "level": 89, - "icon": 19493, - "name": "Zenyte", - "xp": 200 - }, - { - "level": 90, - "icon": 6579, - "name": "Onyx Amulet (U)", - "xp": 165 - }, - { - "level": 90, - "icon": 22204, - "name": "Redwood Bird House", - "xp": 55 - }, - { - "level": 92, - "icon": 19535, - "name": "Zenyte Necklace", - "xp": 165 - }, - { - "level": 95, - "icon": 19492, - "name": "Zenyte Bracelet", - "xp": 180 - }, - { - "level": 98, - "icon": 19501, - "name": "Zenyte Amulet (U)", - "xp": 200 - } - ] -} \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_farming.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_farming.json deleted file mode 100644 index 805b2b365c..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_farming.json +++ /dev/null @@ -1,292 +0,0 @@ -{ - "bonuses": [ - { - "name": "Farmer's Outfit (+2.5%)", - "value": 0.025 - } - ], - "actions": [ - { - "level": 1, - "icon": 1942, - "name": "Potatoes", - "xp": 8 - }, - { - "level": 5, - "icon": 1957, - "name": "Onions", - "xp": 10 - }, - { - "level": 7, - "icon": 1965, - "name": "Cabbages", - "xp": 10 - }, - { - "level": 9, - "icon": 249, - "name": "Guam Leaf", - "xp": 11 - }, - { - "level": 12, - "icon": 1982, - "name": "Tomatoes", - "xp": 12.5 - }, - { - "level": 14, - "icon": 251, - "name": "Marrentill", - "xp": 13.5 - }, - { - "level": 15, - "icon": 1521, - "name": "Oak Tree", - "xp": 481.3 - }, - { - "level": 19, - "icon": 253, - "name": "Tarromin", - "xp": 16 - }, - { - "level": 20, - "icon": 5986, - "name": "Sweetcorn", - "xp": 17 - }, - { - "level": 23, - "icon": 21504, - "name": "Giant seaweed", - "xp": 21 - }, - { - "level": 26, - "icon": 255, - "name": "Harralander", - "xp": 21.5 - }, - { - "level": 26, - "icon": 225, - "name": "Limpwurt Plant", - "xp": 40 - }, - { - "level": 27, - "icon": 1955, - "name": "Apple Tree", - "xp": 1221.5 - }, - { - "level": 29, - "icon": 3261, - "name": "Goutweed", - "xp": 105 - }, - { - "level": 30, - "icon": 1519, - "name": "Willow Tree", - "xp": 1481.5 - }, - { - "level": 31, - "icon": 5504, - "name": "Strawberries", - "xp": 26 - }, - { - "level": 32, - "icon": 257, - "name": "Ranarr Weed", - "xp": 27 - }, - { - "level": 33, - "icon": 1963, - "name": "Banana Tree", - "xp": 1778.5 - }, - { - "level": 35, - "icon": 6333, - "name": "Teak Tree", - "xp": 7315 - }, - { - "level": 38, - "icon": 2998, - "name": "Toadflax", - "xp": 34 - }, - { - "level": 39, - "icon": 2108, - "name": "Orange Tree", - "xp": 2505.7 - }, - { - "level": 42, - "icon": 5970, - "name": "Curry Tree", - "xp": 2946.9 - }, - { - "level": 44, - "icon": 259, - "name": "Irit Leaf", - "xp": 43 - }, - { - "level": 45, - "icon": 1517, - "name": "Maple Tree", - "xp": 3448.4 - }, - { - "level": 47, - "icon": 5982, - "name": "Watermelons", - "xp": 49 - }, - { - "level": 50, - "icon": 261, - "name": "Avantoe", - "xp": 54.5 - }, - { - "level": 51, - "icon": 2114, - "name": "Pineapple Plant", - "xp": 4662.7 - }, - { - "level": 55, - "icon": 6332, - "name": "Mahogany Tree", - "xp": 15783 - }, - { - "level": 56, - "icon": 263, - "name": "Kwuarm", - "xp": 69 - }, - { - "level": 57, - "icon": 5972, - "name": "Papaya Tree", - "xp": 6218.4 - }, - { - "level": 58, - "icon": 22932, - "name": "White lily", - "xp": 292 - }, - { - "level": 60, - "icon": 1515, - "name": "Yew Tree", - "xp": 7150.9 - }, - { - "level": 61, - "icon": 231, - "name": "Snape grass", - "xp": 82 - }, - { - "level": 62, - "icon": 3000, - "name": "Snapdragon", - "xp": 87.5 - }, - { - "level": 65, - "icon": 23044, - "name": "Hespori", - "xp": 12662 - }, - { - "level": 67, - "icon": 265, - "name": "Cadantine", - "xp": 106.5 - }, - { - "level": 68, - "icon": 5974, - "name": "Palm Tree", - "xp": 10260.6 - }, - { - "level": 72, - "icon": 5980, - "name": "Calquat Tree", - "xp": 12225.5 - }, - { - "level": 73, - "icon": 2481, - "name": "Lantadyme", - "xp": 134.5 - }, - { - "level": 74, - "icon": 23962, - "name": "Crystal Tree", - "xp": 13366 - }, - { - "level": 75, - "icon": 1513, - "name": "Magic Tree", - "xp": 13913.8 - }, - { - "level": 79, - "icon": 267, - "name": "Dwarf Weed", - "xp": 170.5 - }, - { - "level": 81, - "icon": 22929, - "name": "Dragonfruit Tree", - "xp": 17895 - }, - { - "level": 83, - "icon": 6063, - "name": "Spirit Tree", - "xp": 19501.3 - }, - { - "level": 85, - "icon": 22935, - "name": "Celastrus Tree", - "xp": 14334 - }, - { - "level": 85, - "icon": 269, - "name": "Torstol", - "xp": 199.5 - }, - { - "level": 90, - "icon": 19669, - "name": "Redwood Tree", - "xp": 22680 - } - ] -} \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_firemaking.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_firemaking.json deleted file mode 100644 index 8bc6eaf7b4..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_firemaking.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "bonuses": [ - { - "name": "Pyromancer Outfit (+2.5%)", - "value": 0.025 - } - ], - "actions": [ - { - "level": 1, - "icon": 1511, - "name": "Logs", - "xp": 40 - }, - { - "level": 1, - "icon": 2862, - "name": "Achey Tree Logs", - "xp": 40 - }, - { - "level": 15, - "icon": 1521, - "name": "Oak Logs", - "xp": 60 - }, - { - "level": 30, - "icon": 1519, - "name": "Willow Logs", - "xp": 90 - }, - { - "level": 35, - "icon": 6333, - "name": "Teak Logs", - "xp": 105 - }, - { - "level": 42, - "icon": 10810, - "name": "Arctic Pine Logs", - "xp": 125 - }, - { - "level": 45, - "icon": 1517, - "name": "Maple Logs", - "xp": 135 - }, - { - "level": 50, - "icon": 6332, - "name": "Mahogany Logs", - "xp": 157.5 - }, - { - "level": 60, - "icon": 1515, - "name": "Yew Logs", - "xp": 202.5 - }, - { - "level": 75, - "icon": 1513, - "name": "Magic Logs", - "xp": 303.8 - }, - { - "level": 90, - "icon": 19669, - "name": "Redwood Logs", - "xp": 350 - } - ] -} \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_fishing.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_fishing.json deleted file mode 100644 index f55759fece..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_fishing.json +++ /dev/null @@ -1,190 +0,0 @@ -{ - "bonuses": [ - { - "name": "Anglers Outfit (+2.5%)", - "value": 0.025 - } - ], - "actions": [ - { - "level": 1, - "icon": 317, - "name": "Raw Shrimps", - "xp": 10 - }, - { - "level": 5, - "icon": 327, - "name": "Raw Sardine", - "xp": 20 - }, - { - "level": 5, - "icon": 3150, - "name": "Raw Karambwanji", - "xp": 5 - }, - { - "level": 10, - "icon": 345, - "name": "Raw Herring", - "xp": 30 - }, - { - "level": 15, - "icon": 321, - "name": "Raw Anchovies", - "xp": 40 - }, - { - "level": 16, - "icon": 353, - "name": "Raw Mackerel", - "xp": 20 - }, - { - "level": 20, - "icon": 335, - "name": "Raw Trout", - "xp": 50 - }, - { - "level": 23, - "icon": 341, - "name": "Raw Cod", - "xp": 45 - }, - { - "level": 25, - "icon": 349, - "name": "Raw Pike", - "xp": 60 - }, - { - "level": 28, - "icon": 3379, - "name": "Raw Slimy Eel", - "xp": 65 - }, - { - "level": 30, - "icon": 331, - "name": "Raw Salmon", - "xp": 70 - }, - { - "level": 35, - "icon": 359, - "name": "Raw Tuna", - "xp": 80 - }, - { - "level": 38, - "icon": 10138, - "name": "Raw Rainbow Fish", - "xp": 80 - }, - { - "level": 38, - "icon": 5001, - "name": "Raw Cave Eel", - "xp": 80 - }, - { - "level": 40, - "icon": 377, - "name": "Raw Lobster", - "xp": 90 - }, - { - "level": 46, - "icon": 363, - "name": "Raw Bass", - "xp": 100 - }, - { - "level": 48, - "icon": 11328, - "name": "Leaping Trout", - "xp": 50 - }, - { - "level": 50, - "icon": 371, - "name": "Raw Swordfish", - "xp": 100 - }, - { - "level": 58, - "icon": 11330, - "name": "Leaping Salmon", - "xp": 70 - }, - { - "level": 62, - "icon": 7944, - "name": "Raw Monkfish", - "xp": 120 - }, - { - "level": 65, - "icon": 3142, - "name": "Raw Karambwan", - "xp": 50 - }, - { - "level": 70, - "icon": 11332, - "name": "Leaping Sturgeon", - "xp": 80 - }, - { - "level": 76, - "icon": 383, - "name": "Raw Shark", - "xp": 110 - }, - { - "level": 79, - "icon": 395, - "name": "Raw Sea Turtle", - "xp": 38 - }, - { - "level": 80, - "icon": 21293, - "name": "Infernal Eel", - "xp": 95 - }, - { - "level": 81, - "icon": 389, - "name": "Raw Manta Ray", - "xp": 46 - }, - { - "level": 82, - "icon": 13439, - "name": "Raw Anglerfish", - "xp": 120 - }, - { - "level": 82, - "icon": 21356, - "name": "Minnow", - "xp": 26.5 - }, - { - "level": 85, - "icon": 11934, - "name": "Raw Dark Crab", - "xp": 130 - }, - { - "level": 87, - "icon": 13339, - "name": "Sacred Eel", - "xp": 105 - } - ] -} \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_fletching.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_fletching.json deleted file mode 100644 index 13c04e5a1c..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_fletching.json +++ /dev/null @@ -1,580 +0,0 @@ -{ - "actions": [ - { - "level": 1, - "icon": 52, - "name": "Arrow Shaft", - "xp": 0.33 - }, - { - "level": 1, - "icon": 53, - "name": "Headless Arrow", - "xp": 1 - }, - { - "level": 1, - "icon": 882, - "name": "Bronze Arrow", - "xp": 1.3 - }, - { - "level": 5, - "icon": 2866, - "name": "Ogre Arrow", - "xp": 1 - }, - { - "level": 5, - "icon": 50, - "name": "Shortbow (U)", - "xp": 5 - }, - { - "level": 5, - "icon": 841, - "name": "Shortbow", - "xp": 5 - }, - { - "level": 9, - "icon": 877, - "name": "Bronze Bolts", - "xp": 0.5 - }, - { - "level": 9, - "icon": 9440, - "name": "Wooden Stock", - "xp": 6 - }, - { - "level": 9, - "icon": 9454, - "name": "Bronze Crossbow (U)", - "xp": 12 - }, - { - "level": 9, - "icon": 9174, - "name": "Bronze Crossbow", - "xp": 6 - }, - { - "level": 10, - "icon": 806, - "name": "Bronze Dart", - "xp": 1.8 - }, - { - "level": 10, - "icon": 839, - "name": "Longbow", - "xp": 10 - }, - { - "level": 10, - "icon": 48, - "name": "Longbow (U)", - "xp": 10 - }, - { - "level": 11, - "icon": 879, - "name": "Opal Bolts", - "xp": 1.6 - }, - { - "level": 15, - "icon": 884, - "name": "Iron Arrow", - "xp": 2.5 - }, - { - "level": 20, - "icon": 54, - "name": "Oak Shortbow (U)", - "xp": 16.5 - }, - { - "level": 20, - "icon": 843, - "name": "Oak Shortbow", - "xp": 16.5 - }, - { - "level": 22, - "icon": 807, - "name": "Iron Dart", - "xp": 3.8 - }, - { - "level": 24, - "icon": 9442, - "name": "Oak Stock", - "xp": 16 - }, - { - "level": 24, - "icon": 9456, - "name": "Blurite Crossbow (U)", - "xp": 32 - }, - { - "level": 24, - "icon": 9176, - "name": "Blurite Crossbow", - "xp": 16 - }, - { - "level": 25, - "icon": 56, - "name": "Oak Longbow (U)", - "xp": 25 - }, - { - "level": 25, - "icon": 845, - "name": "Oak Longbow", - "xp": 25 - }, - { - "level": 27, - "icon": 22251, - "name": "Oak Shield", - "xp": 50 - }, - { - "level": 30, - "icon": 886, - "name": "Steel Arrow", - "xp": 5 - }, - { - "level": 32, - "icon": 10158, - "name": "Kebbit Bolts", - "xp": 1 - }, - { - "level": 35, - "icon": 60, - "name": "Willow Shortbow (U)", - "xp": 33.3 - }, - { - "level": 35, - "icon": 849, - "name": "Willow Shortbow", - "xp": 33.3 - }, - { - "level": 37, - "icon": 808, - "name": "Steel Dart", - "xp": 7.5 - }, - { - "level": 39, - "icon": 9140, - "name": "Iron Bolts", - "xp": 1.5 - }, - { - "level": 39, - "icon": 9444, - "name": "Willow Stock", - "xp": 22 - }, - { - "level": 39, - "icon": 9457, - "name": "Iron Crossbow (U)", - "xp": 44 - }, - { - "level": 39, - "icon": 9177, - "name": "Iron Crossbow", - "xp": 22 - }, - { - "level": 40, - "icon": 58, - "name": "Willow Longbow (U)", - "xp": 41.5 - }, - { - "level": 40, - "icon": 847, - "name": "Willow Longbow", - "xp": 41.5 - }, - { - "level": 41, - "icon": 880, - "name": "Pearl Bolts", - "xp": 3.2 - }, - { - "level": 42, - "icon": 22254, - "name": "Willow Shield", - "xp": 83 - }, - { - "level": 42, - "icon": 10159, - "name": "Long Kebbit Bolts", - "xp": 1.3 - }, - { - "level": 43, - "icon": 9145, - "name": "Silver Bolts", - "xp": 2.5 - }, - { - "level": 45, - "icon": 888, - "name": "Mithril Arrow", - "xp": 7.5 - }, - { - "level": 46, - "icon": 9141, - "name": "Steel Bolts", - "xp": 3.5 - }, - { - "level": 46, - "icon": 9446, - "name": "Teak Stock", - "xp": 27 - }, - { - "level": 46, - "icon": 9459, - "name": "Steel Crossbow (U)", - "xp": 54 - }, - { - "level": 46, - "icon": 9179, - "name": "Steel Crossbow", - "xp": 27 - }, - { - "level": 50, - "icon": 64, - "name": "Maple Shortbow (U)", - "xp": 50 - }, - { - "level": 50, - "icon": 853, - "name": "Maple Shortbow", - "xp": 50 - }, - { - "level": 51, - "icon": 881, - "name": "Barbed Bolts", - "xp": 9.5 - }, - { - "level": 52, - "icon": 809, - "name": "Mithril Dart", - "xp": 11.2 - }, - { - "level": 52, - "icon": 4150, - "name": "Broad Arrows", - "xp": 10 - }, - { - "level": 53, - "icon": 12926, - "name": "Toxic Blowpipe", - "xp": 120 - }, - { - "level": 54, - "icon": 9181, - "name": "Mith Crossbow", - "xp": 32 - }, - { - "level": 54, - "icon": 9448, - "name": "Maple Stock", - "xp": 32 - }, - { - "level": 54, - "icon": 9142, - "name": "Mithril Bolts", - "xp": 5 - }, - { - "level": 54, - "icon": 9461, - "name": "Mithril Crossbow (U)", - "xp": 64 - }, - { - "level": 55, - "icon": 62, - "name": "Maple Longbow (U)", - "xp": 58.5 - }, - { - "level": 55, - "icon": 11875, - "name": "Broad Bolts", - "xp": 3 - }, - { - "level": 55, - "icon": 851, - "name": "Maple Longbow", - "xp": 58 - }, - { - "level": 56, - "icon": 9337, - "name": "Sapphire Bolts", - "xp": 4.7 - }, - { - "level": 57, - "icon": 22257, - "name": "Maple Shield", - "xp": 116.5 - }, - { - "level": 58, - "icon": 9338, - "name": "Emerald Bolts", - "xp": 5.5 - }, - { - "level": 60, - "icon": 890, - "name": "Adamant Arrow", - "xp": 10 - }, - { - "level": 61, - "icon": 9143, - "name": "Adamant Bolts", - "xp": 7 - }, - { - "level": 61, - "icon": 9450, - "name": "Mahogany Stock", - "xp": 41 - }, - { - "level": 61, - "icon": 9463, - "name": "Adamant Crossbow (U)", - "xp": 82 - }, - { - "level": 61, - "icon": 9183, - "name": "Adamant Crossbow", - "xp": 41 - }, - { - "level": 63, - "icon": 9339, - "name": "Ruby Bolts", - "xp": 6.3 - }, - { - "level": 65, - "icon": 9340, - "name": "Diamond Bolts", - "xp": 7 - }, - { - "level": 65, - "icon": 857, - "name": "Yew Shortbow", - "xp": 67.5 - }, - { - "level": 65, - "icon": 68, - "name": "Yew Shortbow (U)", - "xp": 67.5 - }, - { - "level": 67, - "icon": 810, - "name": "Adamant Dart", - "xp": 15 - }, - { - "level": 69, - "icon": 9465, - "name": "Runite Crossbow (U)", - "xp": 100 - }, - { - "level": 69, - "icon": 9185, - "name": "Rune Crossbow", - "xp": 50 - }, - { - "level": 69, - "icon": 9452, - "name": "Yew Stock", - "xp": 50 - }, - { - "level": 69, - "icon": 9144, - "name": "Runite Bolts", - "xp": 10 - }, - { - "level": 70, - "icon": 855, - "name": "Yew Longbow", - "xp": 75 - }, - { - "level": 70, - "icon": 66, - "name": "Yew Longbow (U)", - "xp": 75 - }, - { - "level": 71, - "icon": 9341, - "name": "Dragonstone Bolts", - "xp": 8.2 - }, - { - "level": 72, - "icon": 22260, - "name": "Yew Shield", - "xp": 150 - }, - { - "level": 73, - "icon": 9342, - "name": "Onyx Bolts", - "xp": 9.4 - }, - { - "level": 75, - "icon": 892, - "name": "Rune Arrow", - "xp": 12.5 - }, - { - "level": 76, - "icon": 21316, - "name": "Amethyst Broad Bolts", - "xp": 10.6 - }, - { - "level": 78, - "icon": 21952, - "name": "Magic Stock", - "xp": 70 - }, - { - "level": 78, - "icon": 21921, - "name": "Dragon Crossbow (U)", - "xp": 135 - }, - { - "level": 78, - "icon": 21902, - "name": "Dragon Crossbow", - "xp": 70 - }, - { - "level": 80, - "icon": 861, - "name": "Magic Shortbow", - "xp": 83.3 - }, - { - "level": 80, - "icon": 72, - "name": "Magic Shortbow (U)", - "xp": 83.3 - }, - { - "level": 81, - "icon": 811, - "name": "Rune Dart", - "xp": 18.8 - }, - { - "level": 82, - "icon": 21326, - "name": "Amethyst Arrow", - "xp": 13.5 - }, - { - "level": 84, - "icon": 21930, - "name": "Dragon Bolts", - "xp": 12 - }, - { - "level": 84, - "icon": 21318, - "name": "Amethyst Javelin", - "xp": 13.5 - }, - { - "level": 85, - "icon": 859, - "name": "Magic Longbow", - "xp": 91.5 - }, - { - "level": 85, - "icon": 70, - "name": "Magic Longbow (U)", - "xp": 91.5 - }, - { - "level": 87, - "icon": 22263, - "name": "Magic Shield", - "xp": 183 - }, - { - "level": 90, - "icon": 11212, - "name": "Dragon Arrow", - "xp": 15 - }, - { - "level": 92, - "icon": 22266, - "name": "Redwood Shield", - "xp": 216 - }, - { - "level": 95, - "icon": 11230, - "name": "Dragon Dart", - "xp": 25 - } - ] -} diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_herblore.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_herblore.json deleted file mode 100644 index 242ca19943..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_herblore.json +++ /dev/null @@ -1,364 +0,0 @@ -{ - "actions": [ - { - "level": 3, - "icon": 121, - "name": "Attack Potion (3)", - "xp": 25 - }, - { - "level": 3, - "icon": 249, - "name": "Guam Leaf", - "xp": 2.5 - }, - { - "level": 5, - "icon": 251, - "name": "Marrentill", - "xp": 3.8 - }, - { - "level": 5, - "icon": 175, - "name": "Antipoison (3)", - "xp": 37.5 - }, - { - "level": 8, - "icon": 4844, - "name": "Relicym's Balm (3)", - "xp": 40 - }, - { - "level": 11, - "icon": 253, - "name": "Tarromin", - "xp": 5 - }, - { - "level": 12, - "icon": 115, - "name": "Strength Potion (3)", - "xp": 50 - }, - { - "level": 15, - "icon": 3410, - "name": "Serum 207 (3)", - "xp": 50 - }, - { - "level": 19, - "icon": 10142, - "name": "Guam tar", - "xp": 30 - }, - { - "level": 20, - "icon": 255, - "name": "Harralander", - "xp": 6.3 - }, - { - "level": 21, - "icon": 6472, - "name": "Compost Potion (3)", - "xp": 60 - }, - { - "level": 22, - "icon": 127, - "name": "Restore Potion (3)", - "xp": 62.5 - }, - { - "level": 25, - "icon": 257, - "name": "Ranarr Weed", - "xp": 7.5 - }, - { - "level": 26, - "icon": 3010, - "name": "Energy Potion (3)", - "xp": 67.5 - }, - { - "level": 30, - "icon": 2998, - "name": "Toadflax", - "xp": 8 - }, - { - "level": 30, - "icon": 133, - "name": "Defence Potion (3)", - "xp": 75 - }, - { - "level": 31, - "icon": 10143, - "name": "Marrentill tar", - "xp": 42.5 - }, - { - "level": 34, - "icon": 3034, - "name": "Agility Potion (3)", - "xp": 80 - }, - { - "level": 36, - "icon": 9741, - "name": "Combat Potion (3)", - "xp": 84 - }, - { - "level": 38, - "icon": 139, - "name": "Prayer Potion (3)", - "xp": 87.5 - }, - { - "level": 39, - "icon": 10144, - "name": "Tarromin tar", - "xp": 55 - }, - { - "level": 40, - "icon": 259, - "name": "Irit Leaf", - "xp": 8.8 - }, - { - "level": 44, - "icon": 10145, - "name": "Harralander tar", - "xp": 72.5 - }, - { - "level": 45, - "icon": 145, - "name": "Super Attack (3)", - "xp": 100 - }, - { - "level": 48, - "icon": 181, - "name": "Superantipoison (3)", - "xp": 106.3 - }, - { - "level": 48, - "icon": 261, - "name": "Avantoe", - "xp": 10 - }, - { - "level": 50, - "icon": 151, - "name": "Fishing Potion (3)", - "xp": 112.5 - }, - { - "level": 52, - "icon": 3018, - "name": "Super Energy (3)", - "xp": 117.5 - }, - { - "level": 53, - "icon": 10000, - "name": "Hunter Potion (3)", - "xp": 120 - }, - { - "level": 54, - "icon": 263, - "name": "Kwuarm", - "xp": 11.3 - }, - { - "level": 55, - "icon": 157, - "name": "Super Strength (3)", - "xp": 125 - }, - { - "level": 59, - "icon": 3000, - "name": "Snapdragon", - "xp": 11.8 - }, - { - "level": 60, - "icon": 187, - "name": "Weapon Poison", - "xp": 137.5 - }, - { - "level": 63, - "icon": 3026, - "name": "Super Restore (3)", - "xp": 142.5 - }, - { - "level": 65, - "icon": 265, - "name": "Cadantine", - "xp": 12.5 - }, - { - "level": 65, - "icon": 10927, - "name": "Sanfew Serum (3)", - "xp": 160 - }, - { - "level": 66, - "icon": 163, - "name": "Super Defence (3)", - "xp": 150 - }, - { - "level": 67, - "icon": 2481, - "name": "Lantadyme", - "xp": 13.1 - }, - { - "level": 68, - "icon": 5945, - "name": "Antidote+ (3)", - "xp": 155 - }, - { - "level": 69, - "icon": 2454, - "name": "Antifire Potion (3)", - "xp": 157.5 - }, - { - "level": 70, - "icon": 267, - "name": "Dwarf Weed", - "xp": 13.8 - }, - { - "level": 72, - "icon": 169, - "name": "Ranging Potion (3)", - "xp": 162.5 - }, - { - "level": 73, - "icon": 5937, - "name": "Weapon Poison (+)", - "xp": 165 - }, - { - "level": 75, - "icon": 269, - "name": "Torstol", - "xp": 15 - }, - { - "level": 76, - "icon": 3042, - "name": "Magic Potion (3)", - "xp": 172.5 - }, - { - "level": 77, - "icon": 12627, - "name": "Stamina Potion (3)", - "xp": 76.5 - }, - { - "level": 77, - "icon": 12625, - "name": "Stamina Potion (4)", - "xp": 102 - }, - { - "level": 78, - "icon": 189, - "name": "Zamorak Brew (3)", - "xp": 175 - }, - { - "level": 79, - "icon": 5954, - "name": "Antidote++ (3)", - "xp": 177.5 - }, - { - "level": 80, - "icon": 22464, - "name": "Bastion Potion (3)", - "xp": 155 - }, - { - "level": 80, - "icon": 22452, - "name": "Battlemage Potion (3)", - "xp": 155 - }, - { - "level": 81, - "icon": 6687, - "name": "Saradomin Brew (3)", - "xp": 180 - }, - { - "level": 82, - "icon": 5940, - "name": "Weapon Poison (++)", - "xp": 190 - }, - { - "level": 84, - "icon": 11953, - "name": "Extended Antifire (3)", - "xp": 82.5 - }, - { - "level": 87, - "icon": 12907, - "name": "Anti-venom(3)", - "xp": 90 - }, - { - "level": 90, - "icon": 12695, - "name": "Super Combat Potion(4)", - "xp": 150 - }, - { - "level": 92, - "icon": 21981, - "name": "Super Antifire (3)", - "xp": 130 - }, - { - "level": 94, - "icon": 12915, - "name": "Anti-venom+(3)", - "xp": 125 - }, - { - "level": 98, - "icon": 21981, - "name": "Extended Super Antifire (3)", - "xp": 120 - }, - { - "level": 98, - "icon": 21978, - "name": "Extended Super Antifire (4)", - "xp": 160 - } - ] -} diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_hunter.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_hunter.json deleted file mode 100644 index a50c2164d6..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_hunter.json +++ /dev/null @@ -1,352 +0,0 @@ -{ - "actions": [ - { - "level": 1, - "icon": 9965, - "name": "Crimson Swift", - "xp": 34 - }, - { - "level": 1, - "icon": 9953, - "name": "Polar Kebbit", - "xp": 30 - }, - { - "level": 3, - "icon": 9954, - "name": "Common Kebbit", - "xp": 36 - }, - { - "level": 5, - "icon": 9968, - "name": "Golden Warbler", - "xp": 47 - }, - { - "level": 5, - "icon": 21512, - "name": "Regular Bird House", - "xp": 280 - }, - { - "level": 7, - "icon": 9955, - "name": "Feldip Weasel", - "xp": 48 - }, - { - "level": 9, - "icon": 9966, - "name": "Copper Longtail", - "xp": 61 - }, - { - "level": 11, - "icon": 9967, - "name": "Cerulean Twitch", - "xp": 64.5 - }, - { - "level": 13, - "icon": 9956, - "name": "Desert Devil", - "xp": 66 - }, - { - "level": 14, - "icon": 21515, - "name": "Oak Bird House", - "xp": 420 - }, - { - "level": 15, - "icon": 9970, - "name": "Ruby Harvest", - "xp": 24 - }, - { - "level": 17, - "icon": 11238, - "name": "Baby Impling", - "xp": 18 - }, - { - "level": 19, - "icon": 9969, - "name": "Tropical Wagtail", - "xp": 95 - }, - { - "level": 22, - "icon": 11240, - "name": "Young Impling", - "xp": 20 - }, - { - "level": 23, - "icon": 9953, - "name": "Wild Kebbit", - "xp": 128 - }, - { - "level": 24, - "icon": 21518, - "name": "Willow Bird House", - "xp": 560 - }, - { - "level": 25, - "icon": 9971, - "name": "Sapphire Glacialis", - "xp": 34 - }, - { - "level": 27, - "icon": 10092, - "name": "Ferret", - "xp": 115 - }, - { - "level": 27, - "icon": 9975, - "name": "White Rabbit", - "xp": 144 - }, - { - "level": 28, - "icon": 11242, - "name": "Gourmet Impling", - "xp": 22 - }, - { - "level": 29, - "icon": 10149, - "name": "Swamp Lizard", - "xp": 152 - }, - { - "level": 31, - "icon": 10045, - "name": "Spined Larupia", - "xp": 180 - }, - { - "level": 33, - "icon": 9958, - "name": "Barb-tailed Kebbit", - "xp": 168 - }, - { - "level": 34, - "icon": 21521, - "name": "Teak Bird House", - "xp": 700 - }, - { - "level": 35, - "icon": 9972, - "name": "Snowy Knight", - "xp": 44 - }, - { - "level": 36, - "icon": 11244, - "name": "Earth Impling", - "xp": 25 - }, - { - "level": 37, - "icon": 9957, - "name": "Prickly Kebbit", - "xp": 204 - }, - { - "level": 41, - "icon": 10051, - "name": "Horned Graahk", - "xp": 240 - }, - { - "level": 42, - "icon": 11246, - "name": "Essence Impling", - "xp": 27 - }, - { - "level": 43, - "icon": 9960, - "name": "Spotted Kebbit", - "xp": 104 - }, - { - "level": 44, - "icon": 22192, - "name": "Maple Bird House", - "xp": 820 - }, - { - "level": 45, - "icon": 9973, - "name": "Black Warlock", - "xp": 54 - }, - { - "level": 47, - "icon": 10146, - "name": "Orange Salamander", - "xp": 224 - }, - { - "level": 49, - "icon": 9961, - "name": "Razor-backed Kebbit", - "xp": 348 - }, - { - "level": 49, - "icon": 22195, - "name": "Mahogany Bird House", - "xp": 960 - }, - { - "level": 50, - "icon": 11248, - "name": "Eclectic Impling", - "xp": 32 - }, - { - "level": 51, - "icon": 9959, - "name": "Sabre-toothed Kebbit", - "xp": 200 - }, - { - "level": 53, - "icon": 9976, - "name": "Chinchompa", - "xp": 198.3 - }, - { - "level": 55, - "icon": 10039, - "name": "Sabre-toothed Kyatt", - "xp": 300 - }, - { - "level": 57, - "icon": 9963, - "name": "Dark Kebbit", - "xp": 132 - }, - { - "level": 58, - "icon": 11250, - "name": "Nature Impling", - "xp": 34 - }, - { - "level": 59, - "icon": 10147, - "name": "Red Salamander", - "xp": 272 - }, - { - "level": 59, - "icon": 22198, - "name": "Yew Bird House", - "xp": 1020 - }, - { - "level": 60, - "icon": 19556, - "name": "Maniacal Monkey", - "xp": 1000 - }, - { - "level": 63, - "icon": 9977, - "name": "Carnivorous Chinchompa", - "xp": 265 - }, - { - "level": 65, - "icon": 11252, - "name": "Magpie Impling", - "xp": 44 - }, - { - "level": 65, - "icon": 11252, - "name": "Magpie Impling (Gielinor)", - "xp": 216 - }, - { - "level": 67, - "icon": 10148, - "name": "Black Salamander", - "xp": 319.5 - }, - { - "level": 69, - "icon": 9964, - "name": "Dashing Kebbit", - "xp": 156 - }, - { - "level": 73, - "icon": 5091, - "name": "Black Chinchompa", - "xp": 315 - }, - { - "level": 74, - "icon": 22201, - "name": "Magic Bird House", - "xp": 1140 - }, - { - "level": 74, - "icon": 11254, - "name": "Ninja Impling", - "xp": 52 - }, - { - "level": 74, - "icon": 11254, - "name": "Ninja Impling (Gielinor)", - "xp": 240 - }, - { - "level": 80, - "icon": 23768, - "name": "Crystal Impling", - "xp": 280 - }, - { - "level": 83, - "icon": 11256, - "name": "Dragon Impling", - "xp": 65 - }, - { - "level": 83, - "icon": 11256, - "name": "Dragon Impling (Gielinor)", - "xp": 300 - }, - { - "level": 89, - "icon": 22204, - "name": "Redwood Bird House", - "xp": 1200 - }, - { - "level": 89, - "icon": 19732, - "name": "Lucky Impling", - "xp": 380 - } - ] -} \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_magic.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_magic.json deleted file mode 100644 index 7350574862..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_magic.json +++ /dev/null @@ -1,1072 +0,0 @@ -{ - "actions": [ - { - "level": 1, - "sprite": 15, - "name": "Wind Strike", - "xp": 5.5 - }, - { - "level": 3, - "sprite": 1247, - "name": "Reanimate Goblin", - "xp": 6 - }, - { - "level": 3, - "sprite": 16, - "name": "Confuse", - "xp": 13 - }, - { - "level": 4, - "sprite": 358, - "name": "Enchant Opal Bolt", - "xp": 9 - }, - { - "level": 5, - "sprite": 17, - "name": "Water Strike", - "xp": 7.5 - }, - { - "level": 6, - "sprite": 1269, - "name": "Lumbridge Graveyard Teleport", - "xp": 10 - }, - { - "level": 7, - "sprite": 18, - "name": "Enchant Sapphire Jewellery", - "xp": 17.5 - }, - { - "level": 7, - "sprite": 358, - "name": "Enchant Sapphire Bolt", - "xp": 17.5 - }, - { - "level": 7, - "sprite": 1264, - "name": "Reanimate Monkey", - "xp": 14 - }, - { - "level": 9, - "sprite": 19, - "name": "Earth Strike", - "xp": 9.5 - }, - { - "level": 11, - "sprite": 20, - "name": "Weaken", - "xp": 21 - }, - { - "level": 12, - "sprite": 1258, - "name": "Reanimate Imp", - "xp": 24 - }, - { - "level": 13, - "sprite": 21, - "name": "Fire Strike", - "xp": 11.5 - }, - { - "level": 14, - "sprite": 358, - "name": "Enchant Jade Bolt", - "xp": 19 - }, - { - "level": 15, - "sprite": 22, - "name": "Bones To Bananas", - "xp": 25 - }, - { - "level": 16, - "sprite": 1259, - "name": "Reanimate Minotaur", - "xp": 32 - }, - { - "level": 17, - "sprite": 1269, - "name": "Draynor Manor Teleport", - "xp": 16 - }, - { - "level": 17, - "sprite": 23, - "name": "Wind Bolt", - "xp": 13.5 - }, - { - "level": 19, - "sprite": 1257, - "name": "Reanimate Scorpion", - "xp": 38 - }, - { - "level": 19, - "sprite": 24, - "name": "Curse", - "xp": 29 - }, - { - "level": 20, - "sprite": 319, - "name": "Bind", - "xp": 30 - }, - { - "level": 21, - "sprite": 25, - "name": "Low Level Alchemy", - "xp": 31 - }, - { - "level": 21, - "sprite": 1256, - "name": "Reanimate Bear", - "xp": 42 - }, - { - "level": 22, - "sprite": 1260, - "name": "Reanimate Unicorn", - "xp": 44 - }, - { - "level": 23, - "sprite": 26, - "name": "Water Bolt", - "xp": 16.5 - }, - { - "level": 24, - "sprite": 358, - "name": "Enchant Pearl Bolt", - "xp": 29 - }, - { - "level": 25, - "sprite": 27, - "name": "Varrock Teleport", - "xp": 35 - }, - { - "level": 26, - "sprite": 1268, - "name": "Reanimate Dog", - "xp": 52 - }, - { - "level": 27, - "sprite": 28, - "name": "Enchant Emerald Jewellery", - "xp": 37 - }, - { - "level": 27, - "sprite": 358, - "name": "Enchant Emerald Bolt", - "xp": 37 - }, - { - "level": 28, - "sprite": 1271, - "name": "Mind Altar Teleport", - "xp": 22 - }, - { - "level": 29, - "sprite": 358, - "name": "Enchant Topaz Bolt", - "xp": 33 - }, - { - "level": 29, - "sprite": 29, - "name": "Earth Bolt", - "xp": 19.5 - }, - { - "level": 30, - "sprite": 1251, - "name": "Reanimate Chaos Druid", - "xp": 60 - }, - { - "level": 31, - "sprite": 30, - "name": "Lumbridge Teleport", - "xp": 41 - }, - { - "level": 33, - "sprite": 31, - "name": "Telekinetic Grab", - "xp": 43 - }, - { - "level": 34, - "sprite": 1300, - "name": "Respawn Teleport", - "xp": 27 - }, - { - "level": 35, - "sprite": 32, - "name": "Fire Bolt", - "xp": 22.5 - }, - { - "level": 37, - "sprite": 1255, - "name": "Reanimate Giant", - "xp": 74 - }, - { - "level": 37, - "sprite": 33, - "name": "Falador Teleport", - "xp": 48 - }, - { - "level": 39, - "sprite": 34, - "name": "Crumble Undead", - "xp": 24.5 - }, - { - "level": 40, - "sprite": 1301, - "name": "Salve Graveyard Teleport", - "xp": 30 - }, - { - "level": 40, - "sprite": 1254, - "name": "Reanimate Ogre", - "xp": 80 - }, - { - "level": 40, - "sprite": 355, - "name": "Teleport To House", - "xp": 30 - }, - { - "level": 41, - "sprite": 35, - "name": "Wind Blast", - "xp": 25.5 - }, - { - "level": 43, - "sprite": 36, - "name": "Superheat Item", - "xp": 53 - }, - { - "level": 43, - "sprite": 1250, - "name": "Reanimate Elf", - "xp": 86 - }, - { - "level": 45, - "sprite": 37, - "name": "Camelot Teleport", - "xp": 55.5 - }, - { - "level": 46, - "sprite": 1252, - "name": "Reanimate Troll", - "xp": 92 - }, - { - "level": 47, - "sprite": 38, - "name": "Water Blast", - "xp": 28.5 - }, - { - "level": 48, - "sprite": 1302, - "name": "Fenkenstrain's Castle Teleport", - "xp": 50 - }, - { - "level": 49, - "sprite": 39, - "name": "Enchant Ruby Jewellery", - "xp": 59 - }, - { - "level": 49, - "sprite": 358, - "name": "Enchant Ruby Bolt", - "xp": 59 - }, - { - "level": 50, - "sprite": 53, - "name": "Iban Blast", - "xp": 30 - }, - { - "level": 50, - "sprite": 329, - "name": "Smoke Rush", - "xp": 30 - }, - { - "level": 50, - "sprite": 324, - "name": "Magic Dart", - "xp": 30 - }, - { - "level": 50, - "sprite": 320, - "name": "Snare", - "xp": 60 - }, - { - "level": 51, - "sprite": 54, - "name": "Ardougne Teleport", - "xp": 61 - }, - { - "level": 52, - "sprite": 1266, - "name": "Reanimate Horror", - "xp": 104 - }, - { - "level": 52, - "sprite": 337, - "name": "Shadow Rush", - "xp": 31 - }, - { - "level": 53, - "sprite": 40, - "name": "Earth Blast", - "xp": 31.5 - }, - { - "level": 54, - "sprite": 341, - "name": "Paddewwa Teleport", - "xp": 64 - }, - { - "level": 55, - "sprite": 41, - "name": "High Level Alchemy", - "xp": 65 - }, - { - "level": 56, - "sprite": 42, - "name": "Charge Water Orb", - "xp": 66 - }, - { - "level": 56, - "sprite": 333, - "name": "Blood Rush", - "xp": 33 - }, - { - "level": 57, - "sprite": 358, - "name": "Enchant Diamond Bolt", - "xp": 67 - }, - { - "level": 57, - "sprite": 43, - "name": "Enchant Diamond Jewellery", - "xp": 67 - }, - { - "level": 57, - "sprite": 1261, - "name": "Reanimate Kalphite", - "xp": 114 - }, - { - "level": 58, - "sprite": 55, - "name": "Watchtower Teleport", - "xp": 68 - }, - { - "level": 58, - "sprite": 325, - "name": "Ice Rush", - "xp": 34 - }, - { - "level": 59, - "sprite": 44, - "name": "Fire Blast", - "xp": 34.5 - }, - { - "level": 60, - "sprite": 342, - "name": "Senntisten Teleport", - "xp": 70 - }, - { - "level": 60, - "sprite": 60, - "name": "Claws Of Guthix", - "xp": 35 - }, - { - "level": 60, - "sprite": 59, - "name": "Flames Of Zamorak", - "xp": 35 - }, - { - "level": 60, - "sprite": 61, - "name": "Saradomin Strike", - "xp": 35 - }, - { - "level": 60, - "sprite": 45, - "name": "Charge Earth Orb", - "xp": 70 - }, - { - "level": 60, - "sprite": 354, - "name": "Bones To Peaches", - "xp": 35.5 - }, - { - "level": 61, - "sprite": 1303, - "name": "West Ardougne Teleport", - "xp": 68 - }, - { - "level": 61, - "sprite": 323, - "name": "Trollheim Teleport", - "xp": 68 - }, - { - "level": 62, - "sprite": 1253, - "name": "Reanimate Dagannoth", - "xp": 124 - }, - { - "level": 62, - "sprite": 330, - "name": "Smoke Burst", - "xp": 36 - }, - { - "level": 62, - "sprite": 46, - "name": "Wind Wave", - "xp": 36 - }, - { - "level": 63, - "sprite": 47, - "name": "Charge Fire Orb", - "xp": 73 - }, - { - "level": 64, - "sprite": 338, - "name": "Shadow Burst", - "xp": 37 - }, - { - "level": 64, - "sprite": 357, - "name": "Teleport Ape Atoll", - "xp": 74 - }, - { - "level": 65, - "sprite": 543, - "name": "Bake Pie", - "xp": 60 - }, - { - "level": 65, - "sprite": 1304, - "name": "Harmony Island Teleport", - "xp": 74 - }, - { - "level": 65, - "sprite": 1267, - "name": "Reanimate Bloodveld", - "xp": 130 - }, - { - "level": 65, - "sprite": 563, - "name": "Geomancy", - "xp": 60 - }, - { - "level": 65, - "sprite": 48, - "name": "Water Wave", - "xp": 37.5 - }, - { - "level": 66, - "sprite": 49, - "name": "Charge Air Orb", - "xp": 76 - }, - { - "level": 66, - "sprite": 567, - "name": "Cure Plant", - "xp": 60 - }, - { - "level": 66, - "sprite": 343, - "name": "Kharyrll Teleport", - "xp": 76 - }, - { - "level": 66, - "sprite": 56, - "name": "Vulnerability", - "xp": 76 - }, - { - "level": 66, - "sprite": 577, - "name": "Monster Examine", - "xp": 61 - }, - { - "level": 67, - "sprite": 568, - "name": "Npc Contact", - "xp": 63 - }, - { - "level": 68, - "sprite": 334, - "name": "Blood Burst", - "xp": 39 - }, - { - "level": 68, - "sprite": 559, - "name": "Cure Other", - "xp": 65 - }, - { - "level": 68, - "sprite": 50, - "name": "Enchant Dragonstone Jewellery", - "xp": 78 - }, - { - "level": 68, - "sprite": 358, - "name": "Enchant Dragonstone Bolt", - "xp": 78 - }, - { - "level": 68, - "sprite": 578, - "name": "Humidify", - "xp": 65 - }, - { - "level": 69, - "sprite": 544, - "name": "Moonclan Teleport", - "xp": 66 - }, - { - "level": 69, - "sprite": 1262, - "name": "Reanimate Tzhaar", - "xp": 138 - }, - { - "level": 70, - "sprite": 51, - "name": "Earth Wave", - "xp": 40 - }, - { - "level": 70, - "sprite": 326, - "name": "Ice Burst", - "xp": 40 - }, - { - "level": 70, - "sprite": 569, - "name": "Tele Group Moonclan", - "xp": 67 - }, - { - "level": 71, - "sprite": 586, - "name": "Ourania Teleport", - "xp": 69 - }, - { - "level": 71, - "sprite": 1305, - "name": "Cemetery Teleport", - "xp": 82 - }, - { - "level": 71, - "sprite": 562, - "name": "Cure Me", - "xp": 69 - }, - { - "level": 71, - "sprite": 579, - "name": "Hunter Kit", - "xp": 70 - }, - { - "level": 72, - "sprite": 344, - "name": "Lassar Teleport", - "xp": 82 - }, - { - "level": 72, - "sprite": 1248, - "name": "Reanimate Demon", - "xp": 144 - }, - { - "level": 72, - "sprite": 545, - "name": "Waterbirth Teleport", - "xp": 71 - }, - { - "level": 73, - "sprite": 570, - "name": "Tele Group Waterbirth", - "xp": 72 - }, - { - "level": 73, - "sprite": 57, - "name": "Enfeeble", - "xp": 83 - }, - { - "level": 74, - "sprite": 349, - "name": "Teleother Lumbridge", - "xp": 84 - }, - { - "level": 74, - "sprite": 331, - "name": "Smoke Blitz", - "xp": 42 - }, - { - "level": 74, - "sprite": 565, - "name": "Cure Group", - "xp": 74 - }, - { - "level": 75, - "sprite": 576, - "name": "Stat Spy", - "xp": 76 - }, - { - "level": 75, - "sprite": 547, - "name": "Barbarian Teleport", - "xp": 76 - }, - { - "level": 75, - "sprite": 52, - "name": "Fire Wave", - "xp": 42.5 - }, - { - "level": 76, - "sprite": 575, - "name": "Tele Group Barbarian", - "xp": 77 - }, - { - "level": 76, - "sprite": 339, - "name": "Shadow Blitz", - "xp": 43 - }, - { - "level": 76, - "sprite": 585, - "name": "Spin Flax", - "xp": 75 - }, - { - "level": 77, - "sprite": 548, - "name": "Superglass Make", - "xp": 78 - }, - { - "level": 78, - "sprite": 583, - "name": "Tan Leather", - "xp": 81 - }, - { - "level": 78, - "sprite": 549, - "name": "Khazard Teleport", - "xp": 80 - }, - { - "level": 78, - "sprite": 345, - "name": "Dareeyak Teleport", - "xp": 88 - }, - { - "level": 78, - "sprite": 1308, - "name": "Resurrect Crops", - "xp": 90 - }, - { - "level": 78, - "sprite": 1263, - "name": "Reanimate Aviansie", - "xp": 156 - }, - { - "level": 79, - "sprite": 321, - "name": "Entangle", - "xp": 89 - }, - { - "level": 79, - "sprite": 572, - "name": "Tele Group Khazard", - "xp": 81 - }, - { - "level": 79, - "sprite": 580, - "name": "Dream", - "xp": 82 - }, - { - "level": 80, - "sprite": 322, - "name": "Charge", - "xp": 180 - }, - { - "level": 80, - "sprite": 335, - "name": "Blood Blitz", - "xp": 45 - }, - { - "level": 80, - "sprite": 58, - "name": "Stun", - "xp": 90 - }, - { - "level": 80, - "sprite": 550, - "name": "String Jewellery", - "xp": 83 - }, - { - "level": 81, - "sprite": 554, - "name": "Stat Restore Pot Share", - "xp": 84 - }, - { - "level": 81, - "sprite": 362, - "name": "Wind Surge", - "xp": 44 - }, - { - "level": 82, - "sprite": 350, - "name": "Teleother Falador", - "xp": 92 - }, - { - "level": 82, - "sprite": 552, - "name": "Magic Imbue", - "xp": 86 - }, - { - "level": 82, - "sprite": 327, - "name": "Ice Blitz", - "xp": 46 - }, - { - "level": 83, - "sprite": 553, - "name": "Fertile Soil", - "xp": 87 - }, - { - "level": 83, - "sprite": 1306, - "name": "Barrows Teleport", - "xp": 90 - }, - { - "level": 84, - "sprite": 346, - "name": "Carrallangar Teleport", - "xp": 82 - }, - { - "level": 84, - "sprite": 551, - "name": "Boost Potion Share", - "xp": 88 - }, - { - "level": 85, - "sprite": 1265, - "name": "Reanimate Abyssal Creature", - "xp": 170 - }, - { - "level": 85, - "sprite": 363, - "name": "Water Surge", - "xp": 46 - }, - { - "level": 85, - "sprite": 555, - "name": "Fishing Guild Teleport", - "xp": 89 - }, - { - "level": 85, - "sprite": 352, - "name": "Tele Block", - "xp": 80 - }, - { - "level": 85, - "sprite": 359, - "name": "Teleport To Bounty Target", - "xp": 45 - }, - { - "level": 86, - "sprite": 332, - "name": "Smoke Barrage", - "xp": 48 - }, - { - "level": 86, - "sprite": 573, - "name": "Tele Group Fishing Guild", - "xp": 90 - }, - { - "level": 86, - "sprite": 581, - "name": "Plank Make", - "xp": 90 - }, - { - "level": 87, - "sprite": 556, - "name": "Catherby Teleport", - "xp": 92 - }, - { - "level": 87, - "sprite": 353, - "name": "Enchant Onyx Jewellery", - "xp": 97 - }, - { - "level": 87, - "sprite": 358, - "name": "Enchant Onyx Bolt", - "xp": 97 - }, - { - "level": 88, - "sprite": 340, - "name": "Shadow Barrage", - "xp": 48 - }, - { - "level": 88, - "sprite": 574, - "name": "Tele Group Catherby", - "xp": 93 - }, - { - "level": 89, - "sprite": 557, - "name": "Ice Plateau Teleport", - "xp": 96 - }, - { - "level": 89, - "sprite": 584, - "name": "Recharge Dragonstone", - "xp": 97.5 - }, - { - "level": 90, - "sprite": 347, - "name": "Annakarl Teleport", - "xp": 100 - }, - { - "level": 90, - "sprite": 364, - "name": "Earth Surge", - "xp": 48 - }, - { - "level": 90, - "sprite": 575, - "name": "Tele Group Ice Plateau", - "xp": 99 - }, - { - "level": 90, - "sprite": 351, - "name": "Teleother Camelot", - "xp": 100 - }, - { - "level": 90, - "sprite": 1307, - "name": "Ape Atoll Teleport", - "xp": 100 - }, - { - "level": 91, - "sprite": 558, - "name": "Energy Transfer", - "xp": 100 - }, - { - "level": 92, - "sprite": 336, - "name": "Blood Barrage", - "xp": 51 - }, - { - "level": 92, - "sprite": 560, - "name": "Heal Other", - "xp": 101 - }, - { - "level": 93, - "sprite": 561, - "name": "Vengeance Other", - "xp": 108 - }, - { - "level": 93, - "sprite": 361, - "name": "Enchant Zenyte Jewellery", - "xp": 110 - }, - { - "level": 93, - "sprite": 1249, - "name": "Reanimate Dragon", - "xp": 186 - }, - { - "level": 94, - "sprite": 328, - "name": "Ice Barrage", - "xp": 52 - }, - { - "level": 94, - "sprite": 564, - "name": "Vengeance", - "xp": 112 - }, - { - "level": 95, - "sprite": 566, - "name": "Heal Group", - "xp": 124 - }, - { - "level": 95, - "sprite": 365, - "name": "Fire Surge", - "xp": 51 - }, - { - "level": 96, - "sprite": 348, - "name": "Ghorrock Teleport", - "xp": 106 - }, - { - "level": 96, - "sprite": 582, - "name": "Spellbook Swap", - "xp": 130 - } - ] -} diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_mining.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_mining.json deleted file mode 100644 index 728f204861..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_mining.json +++ /dev/null @@ -1,154 +0,0 @@ -{ - "bonuses": [ - { - "name": "Prospector Outfit (+2.5%)", - "value": 0.025 - } - ], - "actions": [ - { - "level": 1, - "icon": 434, - "name": "Clay", - "xp": 5 - }, - { - "level": 1, - "icon": 1436, - "name": "Rune Essence", - "xp": 5 - }, - { - "level": 1, - "icon": 436, - "name": "Copper Ore", - "xp": 17.5 - }, - { - "level": 1, - "icon": 438, - "name": "Tin Ore", - "xp": 17.5 - }, - { - "level": 10, - "icon": 3211, - "name": "Limestone", - "xp": 26.5 - }, - { - "level": 15, - "icon": 440, - "name": "Iron Ore", - "xp": 35 - }, - { - "level": 20, - "icon": 442, - "name": "Silver Ore", - "xp": 40 - }, - { - "level": 30, - "icon": 7936, - "name": "Pure Essence", - "xp": 5 - }, - { - "level": 30, - "icon": 453, - "name": "Coal", - "xp": 50 - }, - { - "level": 35, - "icon": 6977, - "name": "Sandstone (10kg)", - "xp": 60 - }, - { - "level": 35, - "icon": 6975, - "name": "Sandstone (5kg)", - "xp": 50 - }, - { - "level": 35, - "icon": 6973, - "name": "Sandstone (2kg)", - "xp": 40 - }, - { - "level": 35, - "icon": 6971, - "name": "Sandstone (1kg)", - "xp": 30 - }, - { - "level": 38, - "icon": 13445, - "name": "Dense Essence Block", - "xp": 12 - }, - { - "level": 40, - "icon": 444, - "name": "Gold Ore", - "xp": 65 - }, - { - "level": 40, - "icon": 1629, - "name": "Gem Rocks", - "xp": 65 - }, - { - "level": 45, - "icon": 6979, - "name": "Granite (500g)", - "xp": 50 - }, - { - "level": 45, - "icon": 6981, - "name": "Granite (2kg)", - "xp": 60 - }, - { - "level": 45, - "icon": 6983, - "name": "Granite (5kg)", - "xp": 75 - }, - { - "level": 55, - "icon": 447, - "name": "Mithril Ore", - "xp": 80 - }, - { - "level": 70, - "icon": 1761, - "name": "Soft Clay", - "xp": 5 - }, - { - "level": 70, - "icon": 449, - "name": "Adamantite Ore", - "xp": 95 - }, - { - "level": 85, - "icon": 451, - "name": "Runite Ore", - "xp": 125 - }, - { - "level": 92, - "icon": 21347, - "name": "Amethyst", - "xp": 240 - } - ] -} \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json deleted file mode 100644 index 292fab6b8f..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_prayer.json +++ /dev/null @@ -1,333 +0,0 @@ -{ - "bonuses": [ - { - "name": "Lit Gilded Altar (350%)", - "value": 2.5 - }, - { - "name": "Ectofuntus (400%)", - "value": 3 - }, - { - "name": "Chaos Altar (700%)", - "value": 6 - } - ], - "actions": [ - { - "level": 1, - "icon": 13447, - "name": "Ensouled Goblin Head", - "xp": 130, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13450, - "name": "Ensouled Monkey Head", - "xp": 182, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13453, - "name": "Ensouled Imp Head", - "xp": 286, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13456, - "name": "Ensouled Minotaur Head", - "xp": 364, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13459, - "name": "Ensouled Scorpion Head", - "xp": 454, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13462, - "name": "Ensouled Bear Head", - "xp": 480, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13465, - "name": "Ensouled Unicorn Head", - "xp": 494, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13468, - "name": "Ensouled Dog Head", - "xp": 520, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13471, - "name": "Ensouled Chaos Druid Head", - "xp": 584, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13474, - "name": "Ensouled Giant Head", - "xp": 650, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13477, - "name": "Ensouled Ogre Head", - "xp": 716, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13480, - "name": "Ensouled Elf Head", - "xp": 754, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13483, - "name": "Ensouled Troll Head", - "xp": 780, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13486, - "name": "Ensouled Horror Head", - "xp": 832, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13489, - "name": "Ensouled Kalphite Head", - "xp": 884, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13492, - "name": "Ensouled Dagannoth Head", - "xp": 936, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13495, - "name": "Ensouled Bloodveld Head", - "xp": 1040, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13498, - "name": "Ensouled Tzhaar Head", - "xp": 1104, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13501, - "name": "Ensouled Demon Head", - "xp": 1170, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13504, - "name": "Ensouled Aviansie Head", - "xp": 1234, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13507, - "name": "Ensouled Abyssal Head", - "xp": 1300, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 13510, - "name": "Ensouled Dragon Head", - "xp": 1560, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 526, - "name": "Bones", - "xp": 4.5 - }, - { - "level": 1, - "icon": 2859, - "name": "Wolf Bones", - "xp": 4.5 - }, - { - "level": 1, - "icon": 3396, - "name": "Loar Remains", - "xp": 33, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 528, - "name": "Burnt Bones", - "xp": 4.5 - }, - { - "level": 1, - "icon": 3179, - "name": "Monkey Bones", - "xp": 5 - }, - { - "level": 1, - "icon": 530, - "name": "Bat Bones", - "xp": 5.3 - }, - { - "level": 1, - "icon": 3125, - "name": "Jogre Bones", - "xp": 15 - }, - { - "level": 1, - "icon": 532, - "name": "Big Bones", - "xp": 15 - }, - { - "level": 1, - "icon": 4812, - "name": "Zogre Bones", - "xp": 22.5 - }, - { - "level": 1, - "icon": 3123, - "name": "Shaikahan Bones", - "xp": 25 - }, - { - "level": 1, - "icon": 534, - "name": "Babydragon Bones", - "xp": 30 - }, - { - "level": 1, - "icon": 3398, - "name": "Phrin Remains", - "xp": 46.5, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 22780, - "name": "Wyrm Bones", - "xp": 50 - }, - { - "level": 1, - "icon": 3400, - "name": "Riyl Remains", - "xp": 59.5, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 6812, - "name": "Wyvern Bones", - "xp": 72 - }, - { - "level": 1, - "icon": 536, - "name": "Dragon Bones", - "xp": 72 - }, - { - "level": 1, - "icon": 22783, - "name": "Drake Bones", - "xp": 80 - }, - { - "level": 1, - "icon": 3402, - "name": "Asyn Remains", - "xp": 82.5, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 4830, - "name": "Fayrg Bones", - "xp": 84 - }, - { - "level": 1, - "icon": 3404, - "name": "Fiyr Remains", - "xp": 84, - "ignoreBonus": true - }, - { - "level": 1, - "icon": 11943, - "name": "Lava Dragon Bones", - "xp": 85 - }, - { - "level": 1, - "icon": 4832, - "name": "Raurg Bones", - "xp": 96 - }, - { - "level": 1, - "icon": 22786, - "name": "Hydra Bones", - "xp": 110 - }, - { - "level": 1, - "icon": 6729, - "name": "Dagannoth Bones", - "xp": 125 - }, - { - "level": 1, - "icon": 4834, - "name": "Ourg Bones", - "xp": 140 - }, - { - "level": 70, - "icon": 22124, - "name": "Superior Dragon Bones", - "xp": 150 - } - ] -} diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_runecraft.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_runecraft.json deleted file mode 100644 index 0c08f5d8da..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_runecraft.json +++ /dev/null @@ -1,202 +0,0 @@ -{ - "actions": [ - { - "level": 1, - "icon": 5527, - "name": "Air Tiara", - "xp": 25 - }, - { - "level": 1, - "icon": 5529, - "name": "Mind Tiara", - "xp": 27.5 - }, - { - "level": 1, - "icon": 5531, - "name": "Water Tiara", - "xp": 30 - }, - { - "level": 1, - "icon": 5535, - "name": "Earth Tiara", - "xp": 32.5 - }, - { - "level": 1, - "icon": 5537, - "name": "Fire Tiara", - "xp": 35 - }, - { - "level": 1, - "icon": 5533, - "name": "Body Tiara", - "xp": 37.5 - }, - { - "level": 1, - "icon": 5539, - "name": "Cosmic Tiara", - "xp": 40 - }, - { - "level": 1, - "icon": 5543, - "name": "Chaos Tiara", - "xp": 42.5 - }, - { - "level": 1, - "icon": 5541, - "name": "Nature Tiara", - "xp": 45 - }, - { - "level": 1, - "icon": 5545, - "name": "Law Tiara", - "xp": 47.5 - }, - { - "level": 1, - "icon": 5547, - "name": "Death Tiara", - "xp": 50 - }, - { - "level": 1, - "icon": 22121, - "name": "Wrath Tiara", - "xp": 52.5 - }, - { - "level": 1, - "icon": 556, - "name": "Air Rune", - "xp": 5 - }, - { - "level": 2, - "icon": 558, - "name": "Mind Rune", - "xp": 5.5 - }, - { - "level": 5, - "icon": 555, - "name": "Water Rune", - "xp": 6 - }, - { - "level": 6, - "icon": 4695, - "name": "Mist Rune", - "xp": 8.5 - }, - { - "level": 9, - "icon": 557, - "name": "Earth Rune", - "xp": 6.5 - }, - { - "level": 10, - "icon": 4696, - "name": "Dust Rune", - "xp": 9 - }, - { - "level": 13, - "icon": 4698, - "name": "Mud Rune", - "xp": 9.5 - }, - { - "level": 14, - "icon": 554, - "name": "Fire Rune", - "xp": 7 - }, - { - "level": 15, - "icon": 4697, - "name": "Smoke Rune", - "xp": 9.5 - }, - { - "level": 19, - "icon": 4694, - "name": "Steam Rune", - "xp": 10 - }, - { - "level": 20, - "icon": 559, - "name": "Body Rune", - "xp": 7.5 - }, - { - "level": 23, - "icon": 4699, - "name": "Lava Rune", - "xp": 10.5 - }, - { - "level": 27, - "icon": 564, - "name": "Cosmic Rune", - "xp": 8 - }, - { - "level": 35, - "icon": 562, - "name": "Chaos Rune", - "xp": 8.5 - }, - { - "level": 40, - "icon": 9075, - "name": "Astral Rune", - "xp": 8.7 - }, - { - "level": 44, - "icon": 561, - "name": "Nature Rune", - "xp": 9 - }, - { - "level": 54, - "icon": 563, - "name": "Law Rune", - "xp": 9.5 - }, - { - "level": 65, - "icon": 560, - "name": "Death Rune", - "xp": 10 - }, - { - "level": 77, - "icon": 565, - "name": "Blood Rune", - "xp": 24.425 - }, - { - "level": 90, - "icon": 566, - "name": "Soul Rune", - "xp": 30.325 - }, - { - "level": 95, - "icon": 21880, - "name": "Wrath Rune", - "xp": 8 - } - ] -} diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_smithing.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_smithing.json deleted file mode 100644 index adce0a7faf..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_smithing.json +++ /dev/null @@ -1,1084 +0,0 @@ -{ - "actions": [ - { - "level": 1, - "icon": 2349, - "name": "Bronze Bar", - "xp": 6.3 - }, - { - "level": 1, - "icon": 1351, - "name": "Bronze Axe", - "xp": 12.5 - }, - { - "level": 1, - "icon": 1205, - "name": "Bronze Dagger", - "xp": 12.5 - }, - { - "level": 2, - "icon": 1422, - "name": "Bronze Mace", - "xp": 12.5 - }, - { - "level": 3, - "icon": 1139, - "name": "Bronze Med Helm", - "xp": 12.5 - }, - { - "level": 3, - "icon": 9375, - "name": "Bronze Bolts (Unf)", - "xp": 12.5 - }, - { - "level": 4, - "icon": 4819, - "name": "Bronze Nails", - "xp": 12.5 - }, - { - "level": 4, - "icon": 1277, - "name": "Bronze Sword", - "xp": 12.5 - }, - { - "level": 4, - "icon": 1794, - "name": "Bronze Wire", - "xp": 12.5 - }, - { - "level": 4, - "icon": 819, - "name": "Bronze Dart Tip", - "xp": 12.5 - }, - { - "level": 5, - "icon": 39, - "name": "Bronze Arrowtips", - "xp": 12.5 - }, - { - "level": 5, - "icon": 1321, - "name": "Bronze Scimitar", - "xp": 25 - }, - { - "level": 5, - "icon": 11367, - "name": "Bronze Hasta", - "xp": 25 - }, - { - "level": 5, - "icon": 1237, - "name": "Bronze Spear", - "xp": 25 - }, - { - "level": 6, - "icon": 19570, - "name": "Bronze Javelin Heads", - "xp": 12.5 - }, - { - "level": 6, - "icon": 1291, - "name": "Bronze Longsword", - "xp": 25 - }, - { - "level": 6, - "icon": 9420, - "name": "Bronze Limbs", - "xp": 12.5 - }, - { - "level": 7, - "icon": 864, - "name": "Bronze Knife", - "xp": 12.5 - }, - { - "level": 7, - "icon": 1155, - "name": "Bronze Full Helm", - "xp": 25 - }, - { - "level": 8, - "icon": 1173, - "name": "Bronze Sq Shield", - "xp": 25 - }, - { - "level": 9, - "icon": 1337, - "name": "Bronze Warhammer", - "xp": 37.5 - }, - { - "level": 10, - "icon": 1375, - "name": "Bronze Battleaxe", - "xp": 37.5 - }, - { - "level": 11, - "icon": 1103, - "name": "Bronze Chainbody", - "xp": 37.5 - }, - { - "level": 12, - "icon": 1189, - "name": "Bronze Kiteshield", - "xp": 37.5 - }, - { - "level": 13, - "icon": 3095, - "name": "Bronze Claws", - "xp": 25 - }, - { - "level": 14, - "icon": 1307, - "name": "Bronze 2h Sword", - "xp": 37.5 - }, - { - "level": 15, - "icon": 2351, - "name": "Iron Bar", - "xp": 12.5 - }, - { - "level": 15, - "icon": 1203, - "name": "Iron Dagger", - "xp": 25 - }, - { - "level": 16, - "icon": 1349, - "name": "Iron Axe", - "xp": 25 - }, - { - "level": 16, - "icon": 1075, - "name": "Bronze Platelegs", - "xp": 37.5 - }, - { - "level": 16, - "icon": 1087, - "name": "Bronze Plateskirt", - "xp": 37.5 - }, - { - "level": 17, - "icon": 7225, - "name": "Iron Spit", - "xp": 25 - }, - { - "level": 17, - "icon": 1420, - "name": "Iron Mace", - "xp": 25 - }, - { - "level": 18, - "icon": 9377, - "name": "Iron Bolts (Unf)", - "xp": 25 - }, - { - "level": 18, - "icon": 1117, - "name": "Bronze Platebody", - "xp": 62.5 - }, - { - "level": 18, - "icon": 1137, - "name": "Iron Med Helm", - "xp": 25 - }, - { - "level": 19, - "icon": 4820, - "name": "Iron Nails", - "xp": 25 - }, - { - "level": 19, - "icon": 820, - "name": "Iron Dart Tip", - "xp": 25 - }, - { - "level": 19, - "icon": 1279, - "name": "Iron Sword", - "xp": 25 - }, - { - "level": 20, - "icon": 2355, - "name": "Silver Bar", - "xp": 13.7 - }, - { - "level": 20, - "icon": 40, - "name": "Iron Arrowtips", - "xp": 25 - }, - { - "level": 20, - "icon": 1323, - "name": "Iron Scimitar", - "xp": 50 - }, - { - "level": 20, - "icon": 11369, - "name": "Iron Hasta", - "xp": 50 - }, - { - "level": 20, - "icon": 1239, - "name": "Iron Spear", - "xp": 50 - }, - { - "level": 21, - "icon": 1293, - "name": "Iron Longsword", - "xp": 50 - }, - { - "level": 21, - "icon": 19572, - "name": "Iron Javelin Heads", - "xp": 25 - }, - { - "level": 22, - "icon": 1153, - "name": "Iron Full Helm", - "xp": 50 - }, - { - "level": 22, - "icon": 863, - "name": "Iron Knife", - "xp": 25 - }, - { - "level": 23, - "icon": 9423, - "name": "Iron Limbs", - "xp": 25 - }, - { - "level": 23, - "icon": 1175, - "name": "Iron Sq Shield", - "xp": 50 - }, - { - "level": 24, - "icon": 1335, - "name": "Iron Warhammer", - "xp": 75 - }, - { - "level": 25, - "icon": 1363, - "name": "Iron Battleaxe", - "xp": 75 - }, - { - "level": 26, - "icon": 4540, - "name": "Oil Lantern Frame", - "xp": 25 - }, - { - "level": 26, - "icon": 1101, - "name": "Iron Chainbody", - "xp": 75 - }, - { - "level": 27, - "icon": 1191, - "name": "Iron Kiteshield", - "xp": 75 - }, - { - "level": 28, - "icon": 3096, - "name": "Iron Claws", - "xp": 50 - }, - { - "level": 29, - "icon": 1309, - "name": "Iron 2h Sword", - "xp": 75 - }, - { - "level": 30, - "icon": 1207, - "name": "Steel Dagger", - "xp": 37.5 - }, - { - "level": 30, - "icon": 2353, - "name": "Steel Bar", - "xp": 17.5 - }, - { - "level": 31, - "icon": 1081, - "name": "Iron Plateskirt", - "xp": 75 - }, - { - "level": 31, - "icon": 1067, - "name": "Iron Platelegs", - "xp": 75 - }, - { - "level": 31, - "icon": 1353, - "name": "Steel Axe", - "xp": 37.5 - }, - { - "level": 32, - "icon": 1424, - "name": "Steel Mace", - "xp": 37.5 - }, - { - "level": 33, - "icon": 1115, - "name": "Iron Platebody", - "xp": 125 - }, - { - "level": 33, - "icon": 1141, - "name": "Steel Med Helm", - "xp": 37.5 - }, - { - "level": 33, - "icon": 9378, - "name": "Steel Bolts (Unf)", - "xp": 37.5 - }, - { - "level": 34, - "icon": 821, - "name": "Steel Dart Tip", - "xp": 37.5 - }, - { - "level": 34, - "icon": 1539, - "name": "Steel Nails", - "xp": 37.5 - }, - { - "level": 34, - "icon": 1281, - "name": "Steel Sword", - "xp": 37.5 - }, - { - "level": 35, - "icon": 2, - "name": "Cannonball", - "xp": 25.6 - }, - { - "level": 35, - "icon": 1325, - "name": "Steel Scimitar", - "xp": 75 - }, - { - "level": 35, - "icon": 41, - "name": "Steel Arrowtips", - "xp": 37.5 - }, - { - "level": 35, - "icon": 11371, - "name": "Steel Hasta", - "xp": 75 - }, - { - "level": 35, - "icon": 1241, - "name": "Steel Spear", - "xp": 75 - }, - { - "level": 36, - "icon": 9425, - "name": "Steel Limbs", - "xp": 37.5 - }, - { - "level": 36, - "icon": 2370, - "name": "Steel Studs", - "xp": 37.5 - }, - { - "level": 36, - "icon": 1295, - "name": "Steel Longsword", - "xp": 75 - }, - { - "level": 36, - "icon": 19574, - "name": "Steel Javelin Heads", - "xp": 37.5 - }, - { - "level": 37, - "icon": 865, - "name": "Steel Knife", - "xp": 37.5 - }, - { - "level": 37, - "icon": 1157, - "name": "Steel Full Helm", - "xp": 75 - }, - { - "level": 38, - "icon": 1177, - "name": "Steel Sq Shield", - "xp": 75 - }, - { - "level": 39, - "icon": 1339, - "name": "Steel Warhammer", - "xp": 112.5 - }, - { - "level": 40, - "icon": 1365, - "name": "Steel Battleaxe", - "xp": 112.5 - }, - { - "level": 40, - "icon": 2357, - "name": "Gold Bar (Goldsmith Gauntlets)", - "xp": 56.2 - }, - { - "level": 40, - "icon": 2357, - "name": "Gold Bar", - "xp": 22.5 - }, - { - "level": 41, - "icon": 1105, - "name": "Steel Chainbody", - "xp": 112.5 - }, - { - "level": 42, - "icon": 1193, - "name": "Steel Kiteshield", - "xp": 112.5 - }, - { - "level": 43, - "icon": 3097, - "name": "Steel Claws", - "xp": 75 - }, - { - "level": 44, - "icon": 1311, - "name": "Steel 2h Sword", - "xp": 112.5 - }, - { - "level": 46, - "icon": 1069, - "name": "Steel Platelegs", - "xp": 112.5 - }, - { - "level": 46, - "icon": 1083, - "name": "Steel Plateskirt", - "xp": 112.5 - }, - { - "level": 48, - "icon": 1119, - "name": "Steel Platebody", - "xp": 187.5 - }, - { - "level": 49, - "icon": 4544, - "name": "Bullseye Lantern (Unf)", - "xp": 37 - }, - { - "level": 50, - "icon": 1209, - "name": "Mithril Dagger", - "xp": 50 - }, - { - "level": 50, - "icon": 2359, - "name": "Mithril Bar", - "xp": 30 - }, - { - "level": 51, - "icon": 1355, - "name": "Mithril Axe", - "xp": 50 - }, - { - "level": 52, - "icon": 1428, - "name": "Mithril Mace", - "xp": 50 - }, - { - "level": 53, - "icon": 1143, - "name": "Mithril Med Helm", - "xp": 50 - }, - { - "level": 53, - "icon": 9379, - "name": "Mithril Bolts (Unf)", - "xp": 50 - }, - { - "level": 54, - "icon": 1285, - "name": "Mithril Sword", - "xp": 50 - }, - { - "level": 54, - "icon": 822, - "name": "Mithril Dart Tip", - "xp": 50 - }, - { - "level": 54, - "icon": 4822, - "name": "Mithril Nails", - "xp": 50 - }, - { - "level": 55, - "icon": 42, - "name": "Mithril Arrowtips", - "xp": 50 - }, - { - "level": 55, - "icon": 1329, - "name": "Mithril Scimitar", - "xp": 100 - }, - { - "level": 55, - "icon": 11373, - "name": "Mithril Hasta", - "xp": 100 - }, - { - "level": 55, - "icon": 1243, - "name": "Mithril Spear", - "xp": 100 - }, - { - "level": 56, - "icon": 1299, - "name": "Mithril Longsword", - "xp": 100 - }, - { - "level": 56, - "icon": 19576, - "name": "Mithril Javelin Heads", - "xp": 50 - }, - { - "level": 56, - "icon": 9427, - "name": "Mithril Limbs", - "xp": 50 - }, - { - "level": 57, - "icon": 1159, - "name": "Mithril Full Helm", - "xp": 100 - }, - { - "level": 57, - "icon": 866, - "name": "Mithril Knife", - "xp": 50 - }, - { - "level": 58, - "icon": 1181, - "name": "Mithril Sq Shield", - "xp": 100 - }, - { - "level": 59, - "icon": 9416, - "name": "Mith Grapple Tip", - "xp": 50 - }, - { - "level": 59, - "icon": 1343, - "name": "Mithril Warhammer", - "xp": 150 - }, - { - "level": 60, - "icon": 1187, - "name": "Dragon Sq Shield", - "xp": 75 - }, - { - "level": 60, - "icon": 1369, - "name": "Mithril Battleaxe", - "xp": 150 - }, - { - "level": 61, - "icon": 1109, - "name": "Mithril Chainbody", - "xp": 150 - }, - { - "level": 62, - "icon": 1197, - "name": "Mithril Kiteshield", - "xp": 150 - }, - { - "level": 63, - "icon": 3099, - "name": "Mithril Claws", - "xp": 100 - }, - { - "level": 64, - "icon": 1315, - "name": "Mithril 2h Sword", - "xp": 150 - }, - { - "level": 66, - "icon": 1085, - "name": "Mithril Plateskirt", - "xp": 150 - }, - { - "level": 66, - "icon": 1071, - "name": "Mithril Platelegs", - "xp": 150 - }, - { - "level": 68, - "icon": 1121, - "name": "Mithril Platebody", - "xp": 250 - }, - { - "level": 70, - "icon": 1211, - "name": "Adamant Dagger", - "xp": 62.5 - }, - { - "level": 70, - "icon": 2361, - "name": "Adamantite Bar", - "xp": 37.5 - }, - { - "level": 71, - "icon": 1357, - "name": "Adamant Axe", - "xp": 62.5 - }, - { - "level": 72, - "icon": 1430, - "name": "Adamant Mace", - "xp": 62.5 - }, - { - "level": 73, - "icon": 9380, - "name": "Adamant Bolts (Unf)", - "xp": 62.5 - }, - { - "level": 73, - "icon": 1145, - "name": "Adamant Med Helm", - "xp": 62.5 - }, - { - "level": 74, - "icon": 823, - "name": "Adamant Dart Tip", - "xp": 62.5 - }, - { - "level": 74, - "icon": 1287, - "name": "Adamant Sword", - "xp": 62.5 - }, - { - "level": 74, - "icon": 4823, - "name": "Adamantite Nails", - "xp": 62.5 - }, - { - "level": 75, - "icon": 43, - "name": "Adamant Arrowtips", - "xp": 62.5 - }, - { - "level": 75, - "icon": 1331, - "name": "Adamant Scimitar", - "xp": 125 - }, - { - "level": 75, - "icon": 11375, - "name": "Adamant Hasta", - "xp": 125 - }, - { - "level": 75, - "icon": 1245, - "name": "Adamant Spear", - "xp": 125 - }, - { - "level": 76, - "icon": 9429, - "name": "Adamantite Limbs", - "xp": 62.5 - }, - { - "level": 76, - "icon": 1301, - "name": "Adamant Longsword", - "xp": 125 - }, - { - "level": 76, - "icon": 19578, - "name": "Adamant Javelin Heads", - "xp": 62.5 - }, - { - "level": 77, - "icon": 1161, - "name": "Adamant Full Helm", - "xp": 125 - }, - { - "level": 77, - "icon": 867, - "name": "Adamant Knife", - "xp": 62.5 - }, - { - "level": 78, - "icon": 1183, - "name": "Adamant Sq Shield", - "xp": 125 - }, - { - "level": 79, - "icon": 1345, - "name": "Adamant Warhammer", - "xp": 187.5 - }, - { - "level": 80, - "icon": 1371, - "name": "Adamant Battleaxe", - "xp": 187.5 - }, - { - "level": 81, - "icon": 1111, - "name": "Adamant Chainbody", - "xp": 187.5 - }, - { - "level": 82, - "icon": 1199, - "name": "Adamant Kiteshield", - "xp": 187.5 - }, - { - "level": 83, - "icon": 3100, - "name": "Adamant Claws", - "xp": 125 - }, - { - "level": 84, - "icon": 1317, - "name": "Adamant 2h Sword", - "xp": 187.5 - }, - { - "level": 85, - "icon": 2363, - "name": "Runite Bar", - "xp": 50 - }, - { - "level": 85, - "icon": 1213, - "name": "Rune Dagger", - "xp": 75 - }, - { - "level": 86, - "icon": 1359, - "name": "Rune Axe", - "xp": 75 - }, - { - "level": 86, - "icon": 1091, - "name": "Adamant Plateskirt", - "xp": 187.5 - }, - { - "level": 86, - "icon": 1073, - "name": "Adamant Platelegs", - "xp": 187.5 - }, - { - "level": 87, - "icon": 1432, - "name": "Rune Mace", - "xp": 75 - }, - { - "level": 88, - "icon": 9381, - "name": "Runite Bolts (Unf)", - "xp": 75 - }, - { - "level": 88, - "icon": 1147, - "name": "Rune Med Helm", - "xp": 75 - }, - { - "level": 88, - "icon": 1123, - "name": "Adamant Platebody", - "xp": 312.5 - }, - { - "level": 89, - "icon": 1289, - "name": "Rune Sword", - "xp": 75 - }, - { - "level": 89, - "icon": 4824, - "name": "Rune Nails", - "xp": 75 - }, - { - "level": 89, - "icon": 824, - "name": "Rune Dart Tip", - "xp": 75 - }, - { - "level": 90, - "icon": 44, - "name": "Rune Arrowtips", - "xp": 75 - }, - { - "level": 90, - "icon": 1333, - "name": "Rune Scimitar", - "xp": 150 - }, - { - "level": 90, - "icon": 11377, - "name": "Rune Hasta", - "xp": 150 - }, - { - "level": 90, - "icon": 1247, - "name": "Rune Spear", - "xp": 150 - }, - { - "level": 90, - "icon": 11283, - "name": "Dragonfire Shield", - "xp": 2000 - }, - { - "level": 91, - "icon": 1303, - "name": "Rune Longsword", - "xp": 150 - }, - { - "level": 91, - "icon": 19580, - "name": "Rune Javelin Heads", - "xp": 75 - }, - { - "level": 91, - "icon": 9431, - "name": "Runite Limbs", - "xp": 75 - }, - { - "level": 92, - "icon": 868, - "name": "Rune Knife", - "xp": 75 - }, - { - "level": 92, - "icon": 1163, - "name": "Rune Full Helm", - "xp": 150 - }, - { - "level": 93, - "icon": 1185, - "name": "Rune Sq Shield", - "xp": 150 - }, - { - "level": 94, - "icon": 1347, - "name": "Rune Warhammer", - "xp": 225 - }, - { - "level": 95, - "icon": 1373, - "name": "Rune Battleaxe", - "xp": 225 - }, - { - "level": 96, - "icon": 1113, - "name": "Rune Chainbody", - "xp": 225 - }, - { - "level": 97, - "icon": 1201, - "name": "Rune Kiteshield", - "xp": 225 - }, - { - "level": 98, - "icon": 3101, - "name": "Rune Claws", - "xp": 150 - }, - { - "level": 99, - "icon": 1127, - "name": "Rune Platebody", - "xp": 375 - }, - { - "level": 99, - "icon": 1093, - "name": "Rune Plateskirt", - "xp": 225 - }, - { - "level": 99, - "icon": 1079, - "name": "Rune Platelegs", - "xp": 225 - }, - { - "level": 99, - "icon": 1319, - "name": "Rune 2h Sword", - "xp": 225 - } - ] -} diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_thieving.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_thieving.json deleted file mode 100644 index 7cd9621e1d..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_thieving.json +++ /dev/null @@ -1,256 +0,0 @@ -{ - "actions": [ - { - "level": 1, - "icon": 3241, - "name": "Man / Woman", - "xp": 8 - }, - { - "level": 1, - "icon": 10851, - "name": "Winter Sq'irkjuice", - "xp": 350 - }, - { - "level": 2, - "icon": 1965, - "name": "Vegetable Stall", - "xp": 10 - }, - { - "level": 5, - "icon": 1891, - "name": "Cake Stall", - "xp": 16 - }, - { - "level": 5, - "icon": 4242, - "name": "Tea Stall", - "xp": 16 - }, - { - "level": 5, - "icon": 5601, - "name": "Crafting Stall", - "xp": 16 - }, - { - "level": 5, - "icon": 1963, - "name": "Monkey Food Stall", - "xp": 16 - }, - { - "level": 10, - "icon": 3243, - "name": "Farmer", - "xp": 14.5 - }, - { - "level": 15, - "icon": 4295, - "name": "Female H.A.M. Member", - "xp": 18.5 - }, - { - "level": 20, - "icon": 950, - "name": "Silk Stall", - "xp": 24 - }, - { - "level": 20, - "icon": 4297, - "name": "Male H.A.M. Member", - "xp": 22.5 - }, - { - "level": 22, - "icon": 7919, - "name": "Wine Stall", - "xp": 27 - }, - { - "level": 25, - "icon": 3245, - "name": "Warrior Women / Al-Kharid Warrior", - "xp": 26 - }, - { - "level": 25, - "icon": 464, - "name": "Fruit Stall", - "xp": 28 - }, - { - "level": 25, - "icon": 10848, - "name": "Spring Sq'irkjuice", - "xp": 1350 - }, - { - "level": 27, - "icon": 5318, - "name": "Seed Stall", - "xp": 10 - }, - { - "level": 32, - "icon": 3247, - "name": "Rogue", - "xp": 35.5 - }, - { - "level": 35, - "icon": 958, - "name": "Fur Stall", - "xp": 36 - }, - { - "level": 36, - "icon": 10998, - "name": "Cave Goblin", - "xp": 40 - }, - { - "level": 38, - "icon": 5068, - "name": "Master Farmer", - "xp": 43 - }, - { - "level": 40, - "icon": 3249, - "name": "Guard", - "xp": 46.8 - }, - { - "level": 42, - "icon": 331, - "name": "Fish Stall", - "xp": 42 - }, - { - "level": 45, - "icon": 6782, - "name": "Bearded Pollnivnian Bandit", - "xp": 65 - }, - { - "level": 45, - "icon": 3686, - "name": "Fremennik Citizen", - "xp": 65 - }, - { - "level": 45, - "icon": 10850, - "name": "Autumn Sq'irkjuice", - "xp": 2350 - }, - { - "level": 49, - "icon": 837, - "name": "Crossbow Stall", - "xp": 52 - }, - { - "level": 50, - "icon": 2355, - "name": "Silver Stall", - "xp": 54 - }, - { - "level": 53, - "icon": 4625, - "name": "Desert Bandit", - "xp": 79.5 - }, - { - "level": 55, - "icon": 3251, - "name": "Knight", - "xp": 84.3 - }, - { - "level": 55, - "icon": 6781, - "name": "Pollnivnian Bandit", - "xp": 84.3 - }, - { - "level": 65, - "icon": 6422, - "name": "Magic Stall", - "xp": 100 - }, - { - "level": 65, - "icon": 1325, - "name": "Scimitar Stall", - "xp": 100 - }, - { - "level": 65, - "icon": 6780, - "name": "Menaphite Thug", - "xp": 137.5 - }, - { - "level": 65, - "icon": 2007, - "name": "Spices Stall", - "xp": 81 - }, - { - "level": 65, - "icon": 3253, - "name": "Yanille Watchman", - "xp": 137.5 - }, - { - "level": 65, - "icon": 10849, - "name": "Summer Sq'irkjuice", - "xp": 3000 - }, - { - "level": 70, - "icon": 3255, - "name": "Paladin", - "xp": 151.8 - }, - { - "level": 75, - "icon": 3257, - "name": "Gnome", - "xp": 198.5 - }, - { - "level": 75, - "icon": 1607, - "name": "Gems Stall", - "xp": 160 - }, - { - "level": 80, - "icon": 3259, - "name": "Hero", - "xp": 275 - }, - { - "level": 85, - "icon": 6105, - "name": "Elf", - "xp": 353 - }, - { - "level": 90, - "icon": 21278, - "name": "TzHaar-Hur", - "xp": 103.4 - } - ] -} \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_woodcutting.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_woodcutting.json deleted file mode 100644 index cae1bf7201..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_woodcutting.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "bonuses": [ - { - "name": "Lumberjack Outfit (+2.5%)", - "value": 0.025 - } - ], - "actions": [ - { - "level": 1, - "icon": 1511, - "name": "Logs", - "xp": 25 - }, - { - "level": 1, - "icon": 2862, - "name": "Achey Tree Logs", - "xp": 25 - }, - { - "level": 15, - "icon": 1521, - "name": "Oak Logs", - "xp": 37.5 - }, - { - "level": 30, - "icon": 1519, - "name": "Willow Logs", - "xp": 67.5 - }, - { - "level": 35, - "icon": 6333, - "name": "Teak Logs", - "xp": 85 - }, - { - "level": 45, - "icon": 3239, - "name": "Bark", - "xp": 82.5 - }, - { - "level": 45, - "icon": 1517, - "name": "Maple Logs", - "xp": 100 - }, - { - "level": 50, - "icon": 6332, - "name": "Mahogany Logs", - "xp": 125 - }, - { - "level": 54, - "icon": 10810, - "name": "Arctic Pine Logs", - "xp": 40 - }, - { - "level": 60, - "icon": 1515, - "name": "Yew Logs", - "xp": 175 - }, - { - "level": 65, - "icon": 21626, - "name": "Sulliusceps", - "xp": 127 - }, - { - "level": 75, - "icon": 1513, - "name": "Magic Logs", - "xp": 250 - }, - { - "level": 90, - "icon": 19669, - "name": "Redwood Logs", - "xp": 380 - } - ] -} \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/view-more-white.png b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/view-more-white.png deleted file mode 100644 index 44f0180d18..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/view-more-white.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skybox/skybox.txt b/runelite-client/src/main/resources/net/runelite/client/plugins/skybox/skybox.txt deleted file mode 100644 index 9451d6a707..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skybox/skybox.txt +++ /dev/null @@ -1,967 +0,0 @@ -// Copyright (c) 2019, Abex -// Copyright (c) 2019, Psikoi -// Copyright (c) 2019, Ron Young -// -// 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. - -// Skybox format -// -// Comments are c-style; Starts with // and ends with the next newline -// -// The first expression must be -// bounds rx1 ry1 rx2 ry2 -// which sets the bounds of the image -// -// Color is set with #RRGGBB or #RGB and persists until set again -// Blending is set with b. It persists until set again. The number is in tiles, up to 13 -// -// p <0> <1> <2> <3> -// p all -// Sets a mask for the planes to be altered by the next operation -// -// m -// Moves the cursor to the specified region. This does not change any chunks -// -// The following operations commit chunks to the map: -// -// r -// Sets all of the chunks in a region to the current color and blending -// -// R -// Sets all of the chunks in [x1,x2] [y1,y2] are set to the current color and blending -// -// c -// Sets the chunk relative to the last region/region1 to the current color and blending -// -// C -// Sets the chunks relative to the last region/region1 to the current color and blending - -bounds 18 19 60 196 - -b 8 - -#8AD2DF -R 18 39 60 64 - -#0f0f0f -r 34 75 - -#161616 -R 47 61 53 62 - -#181818 -R 37 79 39 80 - -#1a1a1a -R 47 60 53 60 - -#202020 -R 46 59 53 59 - -#242424 -r 29 81 - -#242e2c -r 56 160 - -#262626 -R 46 58 53 58 -r 24 79 - -#271010 -R 46 74 48 75 -r 47 76 - -#2a2f42 -r 38 75 - -#2b2b2b -R 46 57 53 57 -R 55 62 56 62 -r 45 151 - -#2e2e2e -R 36 147 37 147 - -#323232 -R 46 56 52 56 -R 51 74 52 75 -R 54 75 55 76 -R 58 58 59 58 -r 59 59 - -#332a15 -R 26 73 27 73 -R 27 80 27 81 -R 27 158 28 158 -R 29 84 29 85 -R 30 72 31 72 -R 36 153 36 154 -R 37 150 41 154 -R 39 147 42 149 -R 40 69 40 70 -R 40 81 40 82 -R 41 70 41 71 -R 41 79 42 79 -R 42 142 43 142 -R 42 150 42 152 -R 44 148 44 150 -R 44 152 49 153 -R 45 150 46 150 -R 46 161 47 161 -R 47 151 48 151 -R 48 150 49 150 -R 48 154 50 155 -R 49 77 49 79 -R 52 152 52 153 -r 20 155 -r 22 157 -r 24 154 -r 28 66 -r 30 80 -r 31 81 -r 34 77 -r 34 85 -r 35 73 -r 35 75 -r 35 156 -r 36 79 -r 36 146 -r 36 150 -r 37 73 -r 37 148 -r 38 147 -r 39 145 -r 41 75 -r 41 146 -r 42 154 -r 43 146 -r 43 149 -r 45 79 -r 45 148 -r 45 154 -r 46 149 -r 47 85 -r 47 87 -r 47 160 -r 48 148 -r 50 151 -r 51 147 -r 54 151 -r 54 153 -r 58 88 - -#342b29 -R 50 144 51 144 - -#353535 -R 42 81 42 83 - -#383838 -R 46 55 52 55 - -#393326 -R 51 77 51 79 - -#3c3c3c -r 30 73 -r 39 73 -r 49 81 - -#3e3e3e -r 48 52 - -#3f384a -R 25 156 26 157 - -#40645d -r 49 49 - -#406e8c -R 37 68 38 69 -r 26 154 -r 36 69 - -#413d2d -r 50 145 - -#424242 -r 50 150 - -#424940 -R 29 68 30 68 -R 38 158 39 158 -R 42 69 43 71 -R 45 68 45 69 -R 49 149 50 149 -R 55 151 56 151 -R 58 151 58 152 -r 39 72 -r 39 156 -r 51 150 -r 53 150 -r 53 154 -r 55 154 -r 56 150 - -#474747 -R 50 146 51 146 -r 25 83 -r 27 83 - -#49432a -R 25 152 26 153 -R 51 148 52 149 -r 42 76 -r 46 148 -r 53 149 -r 54 148 - -#496e53 -r 33 82 - -#4a706a -R 18 54 19 54 -R 20 54 21 56 -R 31 78 38 78 -R 34 47 34 48 -R 42 73 43 74 -R 54 50 56 50 -R 54 51 57 55 -R 56 58 56 59 -R 56 141 57 142 -R 57 57 57 58 -R 58 51 58 53 -r 43 72 -r 44 71 -r 53 55 -r 53 77 - -#4a718f -R 25 58 25 59 -r 26 58 - -#4c463a -R 58 146 58 147 -r 59 147 - -#4f4f4f -r 48 81 - -#51649c -r 37 59 -r 39 58 - -#543232 -r 32 76 -r 36 75 -r 36 81 -r 46 81 -r 47 83 - -#553d75 -R 26 60 28 60 - -#57493e -r 35 83 - -#575757 -R 49 157 50 159 -R 52 150 52 151 - -#576f6f -r 56 159 - -#606060 -r 43 75 - -#64554b -R 22 59 22 60 -R 23 58 23 59 -r 24 58 - -#665742 -r 40 75 - -#697387 -R 40 57 41 57 -r 36 57 -r 41 58 - -#6a5151 -r 39 75 - -#6d758e -R 44 55 45 57 -r 43 56 - -#707b98 -R 32 60 32 61 -r 33 61 -r 34 59 - -#7fc7d9 -R 27 53 28 53 -R 27 58 28 58 -R 29 54 29 55 -R 38 44 40 44 -R 42 42 43 43 -R 42 49 43 50 -R 43 45 46 48 -R 44 49 45 49 -R 49 45 49 47 -R 50 43 51 44 -R 50 45 53 48 -R 51 49 52 51 -R 57 46 59 47 -r 28 57 -r 45 42 -r 52 44 -r 53 49 -r 54 48 -r 57 60 - -#817843 -R 58 160 59 160 - -#85857a -R 45 70 46 71 -r 25 77 -r 27 77 -r 47 68 - -#89a4ab -r 44 51 -r 59 44 - -#a4d3df -R 25 75 26 75 -R 28 75 31 75 -r 28 74 -r 37 75 -r 38 71 -r 42 75 -r 47 73 -r 49 75 - -#a5996a -r 29 72 - -#a5d5e1 -R 25 86 26 89 -R 28 76 31 76 -R 30 86 31 87 -R 32 86 33 86 -R 33 76 33 77 -R 40 73 41 74 -R 53 90 54 92 -R 54 74 55 74 -R 54 89 55 89 -r 26 66 -r 28 70 -r 30 83 -r 32 84 -r 36 71 -r 38 84 -r 40 71 -r 44 75 -r 44 79 -r 45 73 -r 45 85 -r 47 70 -r 53 78 -r 55 90 -r 57 154 -R 42 94 45 96 -R 49 93 52 96 -r 52 92 - -#b2b595 -r 40 67 - -#b6cbd8 -R 22 61 28 62 -R 36 60 37 60 -R 42 59 42 61 -R 42 159 43 159 -R 43 58 45 61 -r 24 60 -r 29 60 -r 44 155 -r 47 158 -r 53 76 - -#dbd9db -r 45 75 - -// RegionID 4663 -m 18 55 -#4a706a -C 0 0 5 7 -#527874 -C 6 0 7 1 -#668d8d -C 6 2 7 7 - -// RegionID 4664 -m 18 56 -#4a706a -C 0 0 5 7 -C 6 2 7 7 -#608786 -C 6 0 7 1 - -// RegionID 4919 -m 19 55 -C 6 0 7 1 -#668d8d -C 0 0 5 1 -#8dbac1 -C 6 2 7 7 -#9dccd6 -C 0 2 5 7 - -// RegionID 4920 -m 19 56 -#4a706a -C 0 2 7 7 -#80aab0 -C 6 0 7 1 -#8dbac1 -C 0 0 5 1 - -// RegionID 5689 -m 22 57 -#4a706a -C 0 4 7 7 - -// RegionID 5690 -m 22 58 -C 0 0 7 1 -#64554b -C 0 2 7 7 - -// RegionID 5945 -m 23 57 -#4a706a -C 0 4 7 7 - -// RegionID 5948 -m 23 60 -#64554b -C 0 0 5 5 -C 0 6 3 7 -C 6 0 7 3 -#b6cbd8 -C 4 6 7 7 -C 6 4 7 5 - -// RegionID 6201 -m 24 57 -#4a706a -C 0 4 3 7 - -// RegionID 6203 -m 24 59 -#4a718f -C 4 2 7 7 -C 6 0 7 1 -#64554b -C 0 0 3 7 -C 4 0 5 1 - -// RegionID 6460 -m 25 60 -#4a718f -C 0 0 5 1 -#553d75 -C 0 2 7 5 -C 4 6 7 7 -C 6 0 7 1 -#adc0cf -C 2 6 3 7 -#b6cbd8 -C 0 6 1 7 - -// RegionID 6710 -m 26 54 -#7fc7d9 -C 0 0 7 3 - -// RegionID 6715 -m 26 59 -#4a718f -C 0 0 5 7 -C 6 0 7 5 -b 5 -#4d020a -C 5 5 8 8 -b 8 - -// RegionID 6966 -m 27 54 -#7fc7d9 -C 0 0 7 3 - -// RegionID 6971 -m 27 59 -#553d75 -C 2 6 7 7 -#5e2423 -C 0 6 1 7 -#7fc7d9 -C 0 0 7 3 - -// RegionID 7222 -m 28 54 -C 0 0 7 3 -C 6 4 7 7 - -// RegionID 7223 -m 28 55 -C 6 0 7 7 - -// RegionID 7224 -m 28 56 -C 4 0 7 7 - -// RegionID 7227 -m 28 59 -#553d75 -C 0 6 7 7 -#7fc7d9 -C 0 0 7 3 -C 4 4 7 5 - -// RegionID 8508 -m 33 60 -#707b98 -C 0 0 1 3 -C 0 4 7 7 -#838aa1 -C 2 0 7 3 - -// RegionID 9007 -m 35 47 -#3b4f4d -C 2 6 5 7 -#4a706a -C 0 0 7 5 -C 0 6 1 7 -C 6 6 7 7 - -// RegionID 9008 -m 35 48 -#384947 -C 2 0 5 1 -#4a706a -C 0 2 7 7 -C 0 0 1 1 -C 6 0 7 1 - -// RegionID 10029 -m 39 45 -#7fc7d9 -C 0 0 7 1 - -// RegionID 10040 -m 39 56 -#6d758e -C 0 4 3 7 - -// RegionID 10044 -m 39 60 -#b6cbd8 -C 0 6 7 7 - -// RegionID 10055 -m 39 71 -#a4d3df -C 0 0 1 7 -#a5d5e1 -C 2 0 7 7 - -// RegionID 10285 -m 40 45 -#7fc7d9 -C 2 0 7 3 -C 4 4 7 5 -C 0 0 1 1 -C 6 6 7 7 - -// RegionID 10555 -m 41 59 -#b6cbd8 -C 6 0 7 7 - -// RegionID 10556 -m 41 60 -C 6 0 7 7 - -// RegionID 10810 -m 42 58 -#869dcc -C 0 0 3 3 -#b6cbd8 -C 0 4 7 7 -C 4 0 7 3 - -// RegionID 10905 -m 42 153 -#332a15 -C 2 0 5 5 -C 6 0 7 1 -#a9bbc6 -C 6 2 7 3 -#b3c7d3 -C 0 2 1 5 -C 2 6 5 7 -C 6 4 7 5 -#b6cbd8 -C 0 0 1 1 -C 0 6 1 7 -C 6 6 7 7 - -// RegionID 11062 -m 43 54 -C 6 6 7 7 - -// RegionID 11065 -m 43 57 -#6d758e -C 0 0 7 3 -#b6cbd8 -C 0 4 7 7 - -// RegionID 11314 -m 44 50 -#89a4ab -C 0 4 7 7 - -// RegionID 11317 -m 44 53 -#b6cbd8 -C 4 6 7 7 - -// RegionID 11318 -m 44 54 -C 0 4 1 7 -C 2 2 7 7 -C 4 0 7 1 - -// RegionID 11418 -m 44 154 -#332a15 -C 0 0 7 3 -#acbfcb -C 0 4 7 5 -#b6cbd8 -C 0 6 7 7 - -// RegionID 11675 -m 45 155 -C 0 0 1 7 - -// RegionID 11825 -m 46 49 -#7fc7d9 -C 0 0 7 3 -C 6 4 7 5 - -// RegionID 11830 -m 46 54 -#b6cbd8 -C 6 0 7 5 - -// RegionID 11836 -m 46 60 -#1a1a1a -C 2 0 3 3 -C 4 0 7 7 -#b4c9d6 -C 2 4 3 5 -#b6cbd8 -C 0 0 1 7 -C 2 6 3 7 - -// RegionID 11837 -m 46 61 -#161616 -C 6 0 7 9 -#b6cbd8 -C 0 0 5 9 - -// RegionID 12081 -m 47 49 -#7fc7d9 -C 0 0 3 5 - -// RegionID 12086 -m 47 54 -#b6cbd8 -C 0 0 1 5 - -// RegionID 12113 -m 47 81 -#4f4f4f -C 0 0 3 3 -C 4 4 7 7 -#543232 -C 0 4 3 7 -C 4 0 7 3 - -// RegionID 12181 -m 47 149 -#332a15 -C 0 0 1 7 -#b6cbd8 -C 2 0 7 7 - -// RegionID 12339 -m 48 51 -#3e3e3e -C 0 6 7 7 - -// RegionID 12437 -m 48 149 -#332a15 -C 2 0 7 7 -#b6cbd8 -C 0 0 1 7 - -// RegionID 12444 -m 48 156 -#332a15 -C 0 0 7 3 - -// RegionID 12595 -m 49 51 -#3e3e3e -C 0 6 1 7 - -// RegionID 12596 -m 49 52 -C 0 0 1 5 - -// RegionID 12849 -m 50 49 -#40645d -C 0 0 5 7 -#426660 -C 6 0 7 7 - -// RegionID 13209 -m 51 153 -#3b3535 -C 0 0 3 3 -C 4 4 7 7 -#543232 -C 0 4 3 7 -C 4 0 7 3 - -// RegionID 13210 -m 51 154 -#332a15 -C 0 0 3 7 - -// RegionID 13618 -m 53 50 -#4a706a -C 4 0 7 7 -#7fc7d9 -C 0 0 3 7 - -// RegionID 13619 -m 53 51 -#4a706a -C 4 0 7 7 -#7fc7d9 -C 0 0 3 7 - -// RegionID 13620 -m 53 52 -#4a706a -C 2 0 7 7 - -// RegionID 13621 -m 53 53 -C 2 0 7 7 - -// RegionID 13622 -m 53 54 -C 4 0 7 7 - -// RegionID 13873 -m 54 49 -C 0 4 7 7 -#7fc7d9 -C 0 0 7 3 - -// RegionID 14129 -m 55 49 -#4a706a -C 0 4 7 7 - -// RegionID 14385 -m 56 49 -C 0 4 7 7 - -// RegionID 14641 -m 57 49 -#543232 -C 0 4 7 7 - -// RegionID 14642 -m 57 50 -#4a706a -C 0 6 7 7 -#543232 -C 0 0 7 5 - -// RegionID 14651 -m 57 59 -#4a706a -C 0 0 7 3 -#7fc7d9 -C 0 4 7 7 - -// RegionID 14907 -m 58 59 -#323232 -C 0 0 7 3 - -// RegionID 14908 -m 58 60 -#7fc7d9 -C 0 0 3 7 - -// Demonic Gorillas -#1A2B2B -R 32 88 33 88 - -// Kebos Mainland -m 19 59 -#443C35 -C 4 0 16 12 - -m 21 57 -C 0 4 8 24 - -m 20 58 -C 0 6 8 8 -C 6 0 8 2 -C 6 4 8 6 - -m 20 57 -C 4 6 8 8 - -m 18 57 -#4A706A -C 4 0 24 4 - -// POH -b 12 -m29 89 - -// 29 89 p0 Basic wood -// 29 89 p1 Basic stone -// 29 89 p3 Fremennik-style wood -p 0 1 3 -#8AD2DF -C 0 0 7 15 -p 0 -#251B09 -c 3 0 -c 0 3 -c 2 3 -c 4 3 -c 6 3 -c 7 4 -p 1 -#484840 -c 3 0 -c 0 3 -c 2 3 -c 4 3 -c 6 3 -c 7 4 - -// 29 89 p2 Whitewashed stone -p 2 -#7fc7d9 -C 0 0 7 15 -p 2 3 -#2C2C29 -c 3 0 -c 0 3 -c 2 3 -c 4 3 -c 6 3 -c 7 4 - -m30 89 - -// 30 89 p0 Tropical wood -p 0 -#7fc7d9 -C 0 0 7 15 - -// 30 89 p1 Fancy stone -// 30 89 p2 Deathly mansion -p 1 2 -#8AD2DF -C 0 0 7 15 - -p 2 -#8AD2DF -C 0 0 7 15 - -p all -#2C2C29 -c 3 0 -c 0 3 -c 2 3 -c 4 3 -c 6 3 -c 7 4 - -// Cerberus -#100 -R 19 19 21 20 - -// Cosmic entity's plane -#040404 -r 32 75 - -b 0 -#000000 -// Song of the elves boss area -R 49 92 51 92 - -// Iorwerth dungeon -#030A0A -R 49 193 51 194 - -// Braindeath Island -#8AD2DF -R 33 79 33 80 \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/slayer/panel_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/slayer/panel_icon.png deleted file mode 100644 index cd454c3956..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/slayer/panel_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/slayer/pause_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/slayer/pause_icon.png deleted file mode 100644 index 57baef8bd3..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/slayer/pause_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/slayer/play_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/slayer/play_icon.png deleted file mode 100644 index 1a5b02e867..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/slayer/play_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/statusorbs/1067-DISEASE.png b/runelite-client/src/main/resources/net/runelite/client/plugins/statusorbs/1067-DISEASE.png deleted file mode 100644 index f2ff5ac911..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/statusorbs/1067-DISEASE.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/statusorbs/1067-POISON.png b/runelite-client/src/main/resources/net/runelite/client/plugins/statusorbs/1067-POISON.png deleted file mode 100644 index a4b05c1ca1..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/statusorbs/1067-POISON.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/statusorbs/1067-VENOM.png b/runelite-client/src/main/resources/net/runelite/client/plugins/statusorbs/1067-VENOM.png deleted file mode 100644 index df6816bb74..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/statusorbs/1067-VENOM.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/stonedtracker/back-arrow-white.png b/runelite-client/src/main/resources/net/runelite/client/plugins/stonedtracker/back-arrow-white.png deleted file mode 100644 index 96b9200f60..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/stonedtracker/back-arrow-white.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/stonedtracker/delete-white.png b/runelite-client/src/main/resources/net/runelite/client/plugins/stonedtracker/delete-white.png deleted file mode 100644 index 014cf20850..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/stonedtracker/delete-white.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/stonedtracker/panel-icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/stonedtracker/panel-icon.png deleted file mode 100644 index 58a523016a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/stonedtracker/panel-icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/stonedtracker/refresh-white.png b/runelite-client/src/main/resources/net/runelite/client/plugins/stonedtracker/refresh-white.png deleted file mode 100644 index cd26305f7a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/stonedtracker/refresh-white.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/stonedtracker/replay-white.png b/runelite-client/src/main/resources/net/runelite/client/plugins/stonedtracker/replay-white.png deleted file mode 100644 index c0d23e4297..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/stonedtracker/replay-white.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/suppliestracker/back_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/suppliestracker/back_icon.png deleted file mode 100644 index 96b9200f60..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/suppliestracker/back_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/suppliestracker/panel_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/suppliestracker/panel_icon.png deleted file mode 100644 index 833bbc37c4..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/suppliestracker/panel_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/suppliestracker/plus_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/suppliestracker/plus_icon.png deleted file mode 100644 index 9634216e10..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/suppliestracker/plus_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/suppliestracker/sarabrew.jpg b/runelite-client/src/main/resources/net/runelite/client/plugins/suppliestracker/sarabrew.jpg deleted file mode 100644 index 11cf0728cb..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/suppliestracker/sarabrew.jpg and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/suppliestracker/ui/Info.html b/runelite-client/src/main/resources/net/runelite/client/plugins/suppliestracker/ui/Info.html deleted file mode 100644 index bcab291d76..0000000000 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/suppliestracker/ui/Info.html +++ /dev/null @@ -1,56 +0,0 @@ -

Supplies Tracker

-

Info:

-

Toxic Blowpipe:

-

Set darts used in config before using.

-

Uses a formula to estimate usage since there is no way to get info from blowpipe automatically. 

-

 

-

Weapon charges:

-

(Default disabled to enable check box in configs) Weapons charges groups items used in weapons charged in a box with the weapons icon. Tooltip shows the items used. 

-

Current supported weapons:

-
    -
  1. Scythe
  2. -
  3. Tridents
  4. -
  5. Sang staff
  6. -
  7. Blade of Saeldor
  8. -
-

 

-

Supplies tracker may not be 100% accurate. Tick eating with Karambwan can be missed if they aren't eaten the same tick as other food.

-

 

-

Current tracking capabilities:

-

Supplies (food, potions, teleport tablets, teleport scrolls)

-

Ammo (blowpipe [must be set in config], arrows, thrown items)

-

Runes (Rune Pouch support added in 1.5)

-

Jewellery

-

Weapons charges

-

Farming (saplings, seeds, compost, and plant cure)

-

Prayer (bones and ensouled heads. Chaos altar, gilded altar, and burying bones)

-

Changelog

-

1.8

-

Prayer added: -

  • POH altar
  • -
  • Chaos Altar
  • -
  • Ensouled heads
  • -
  • Bury bones
  • -

    Fixed bottomless buckets showing in farming supplies

    -

    Small bugs with prices

    -

    Changed dragonstone jewellery to only add cost of charges [(cost of full - cost of empty)/number of max charges]

    -

    1.7

    -

    Added farming: -
    -Saplings -
    -Seeds -
    -Compost -
    -and plant cure

    -

    fixed one handed swords showing as Blade of Saeldor

    -

    Added check to rune pouch to help with bugs

    -

    1.6

    -

    Added standard spell tracking

    -

    Auto cast tracking

    -

    Chinchompas no longer steal food

    -

    Runes now properly used when player gets no xp

    -

    1.5

    -

    Added Rune pouch support!

    -

    Null items shouldn't show anymore

    -

    Fixed barrows tablet in ammo bug

    -

    Fixed knives in food bug

    -

     

    -

     

    \ No newline at end of file diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/add_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/add_icon.png deleted file mode 100644 index 8952e16450..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/add_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/arrow_right.png b/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/arrow_right.png deleted file mode 100644 index 5fdc75e7d2..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/arrow_right.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/delete_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/delete_icon.png deleted file mode 100644 index adeb2841b2..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/delete_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/lap_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/lap_icon.png deleted file mode 100644 index 53fa27fb5e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/lap_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/pause_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/pause_icon.png deleted file mode 100644 index 5acdce651c..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/pause_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/reset_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/reset_icon.png deleted file mode 100644 index d304b26d16..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/reset_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/start_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/start_icon.png deleted file mode 100644 index e290de48f9..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/start_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/watch.png b/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/watch.png deleted file mode 100644 index 89c4277143..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/timetracking/watch.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/ammo.png b/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/ammo.png deleted file mode 100644 index 51c9374c01..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/ammo.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/amulet.png b/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/amulet.png deleted file mode 100644 index 6cf342730d..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/amulet.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/boots.png b/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/boots.png deleted file mode 100644 index c9580b9ef6..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/boots.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/cape.png b/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/cape.png deleted file mode 100644 index 2050dbeab0..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/cape.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/hands.png b/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/hands.png deleted file mode 100644 index adb70ef4c0..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/hands.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/helmet.png b/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/helmet.png deleted file mode 100644 index 798dbbb78f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/helmet.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/legs.png b/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/legs.png deleted file mode 100644 index 085779915f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/legs.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/nav.png b/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/nav.png deleted file mode 100644 index 1a23abe2dc..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/nav.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/shield.png b/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/shield.png deleted file mode 100644 index 52f1aa3330..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/shield.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/torso.png b/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/torso.png deleted file mode 100644 index 96f50a04d9..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/torso.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/weapon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/weapon.png deleted file mode 100644 index 44f7534fa6..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/tmorph/weapon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/vorkath/acid.png b/runelite-client/src/main/resources/net/runelite/client/plugins/vorkath/acid.png deleted file mode 100644 index b7b33acca0..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/vorkath/acid.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/vorkath/fire_strike.png b/runelite-client/src/main/resources/net/runelite/client/plugins/vorkath/fire_strike.png deleted file mode 100644 index eec1fd6bec..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/vorkath/fire_strike.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/vorkath/ice.png b/runelite-client/src/main/resources/net/runelite/client/plugins/vorkath/ice.png deleted file mode 100644 index 0dd962dcde..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/vorkath/ice.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/vorkath/magerange.png b/runelite-client/src/main/resources/net/runelite/client/plugins/vorkath/magerange.png deleted file mode 100644 index e5e713ac5f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/vorkath/magerange.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldhopper/arrow_down.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldhopper/arrow_down.png deleted file mode 100644 index 8b64631a80..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldhopper/arrow_down.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldhopper/flag_aus.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldhopper/flag_aus.png deleted file mode 100644 index ca2980e8a9..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldhopper/flag_aus.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldhopper/flag_ger.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldhopper/flag_ger.png deleted file mode 100644 index 1a3b406cfb..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldhopper/flag_ger.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldhopper/flag_uk.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldhopper/flag_uk.png deleted file mode 100644 index a52b19d0b1..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldhopper/flag_uk.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldhopper/flag_us.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldhopper/flag_us.png deleted file mode 100644 index 7ffafe28be..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldhopper/flag_us.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldhopper/icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldhopper/icon.png deleted file mode 100644 index 6cc398d375..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldhopper/icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/air_altar_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/air_altar_icon.png deleted file mode 100644 index ae281d896c..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/air_altar_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/amulet_of_glory_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/amulet_of_glory_teleport_icon.png deleted file mode 100644 index b8f0a2aecf..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/amulet_of_glory_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/annakarl_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/annakarl_teleport_icon.png deleted file mode 100644 index a56a0f395e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/annakarl_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ape_atoll_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ape_atoll_teleport_icon.png deleted file mode 100644 index 1a2f5249ca..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ape_atoll_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ape_atoll_teleport_icon_arceuus.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ape_atoll_teleport_icon_arceuus.png deleted file mode 100644 index b83aa0bc08..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ape_atoll_teleport_icon_arceuus.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ardougne_cloak_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ardougne_cloak_icon.png deleted file mode 100644 index de115357b7..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ardougne_cloak_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ardougne_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ardougne_teleport_icon.png deleted file mode 100644 index ddfd4417ff..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ardougne_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/astral_altar_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/astral_altar_icon.png deleted file mode 100644 index 10b4aeccce..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/astral_altar_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/barbarian_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/barbarian_teleport_icon.png deleted file mode 100644 index ffb0267692..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/barbarian_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/barrows_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/barrows_teleport_icon.png deleted file mode 100644 index 696c1a0cf6..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/barrows_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/battlefront_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/battlefront_teleport_icon.png deleted file mode 100644 index 696c1a0cf6..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/battlefront_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/blood_altar_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/blood_altar_icon.png deleted file mode 100644 index 356557e538..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/blood_altar_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/body_altar_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/body_altar_icon.png deleted file mode 100644 index d9c51114d4..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/body_altar_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/burning_amulet_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/burning_amulet_teleport_icon.png deleted file mode 100644 index e48b9520bf..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/burning_amulet_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/camelot_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/camelot_teleport_icon.png deleted file mode 100644 index bb374044e6..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/camelot_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/camulet_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/camulet_teleport_icon.png deleted file mode 100644 index 7a74119cc8..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/camulet_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/carrallangar_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/carrallangar_teleport_icon.png deleted file mode 100644 index 41b91276d3..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/carrallangar_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/catherby_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/catherby_teleport_icon.png deleted file mode 100644 index 1400309f10..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/catherby_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/cemetery_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/cemetery_teleport_icon.png deleted file mode 100644 index 64d5571c15..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/cemetery_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/chaos_altar_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/chaos_altar_icon.png deleted file mode 100644 index 91b046d5d4..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/chaos_altar_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/chronicle_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/chronicle_teleport_icon.png deleted file mode 100644 index 4de4456ec7..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/chronicle_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/combat_bracelet_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/combat_bracelet_teleport_icon.png deleted file mode 100644 index 772da72c8b..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/combat_bracelet_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/cosmic_altar_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/cosmic_altar_icon.png deleted file mode 100644 index 3a37733f10..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/cosmic_altar_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/dareeyak_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/dareeyak_teleport_icon.png deleted file mode 100644 index 78ea58227c..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/dareeyak_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/death_altar_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/death_altar_icon.png deleted file mode 100644 index 19c94eb0e2..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/death_altar_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/desert_amulet_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/desert_amulet_icon.png deleted file mode 100644 index 0716a8793b..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/desert_amulet_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/digsite_pendant_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/digsite_pendant_teleport_icon.png deleted file mode 100644 index 9be6e9c5e8..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/digsite_pendant_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/draynor_manor_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/draynor_manor_teleport_icon.png deleted file mode 100644 index 5ade949f89..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/draynor_manor_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/earth_altar_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/earth_altar_icon.png deleted file mode 100644 index 828dffbd1f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/earth_altar_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ectophial_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ectophial_teleport_icon.png deleted file mode 100644 index 349bb9dcf3..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ectophial_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/enchanted_lyre_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/enchanted_lyre_teleport_icon.png deleted file mode 100644 index 6205cdc9b8..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/enchanted_lyre_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/explorers_ring_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/explorers_ring_icon.png deleted file mode 100644 index 09eea3f985..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/explorers_ring_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/fairy_ring_travel.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/fairy_ring_travel.png deleted file mode 100644 index bfc4511bc8..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/fairy_ring_travel.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/falador_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/falador_teleport_icon.png deleted file mode 100644 index 0cfed57e93..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/falador_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/fenkenstrains_castle_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/fenkenstrains_castle_teleport_icon.png deleted file mode 100644 index 06cca2eac1..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/fenkenstrains_castle_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/fire_altar_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/fire_altar_icon.png deleted file mode 100644 index f556a54ce9..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/fire_altar_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/fishing_guild_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/fishing_guild_teleport_icon.png deleted file mode 100644 index ae4dbff612..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/fishing_guild_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/fremennik_boots_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/fremennik_boots_icon.png deleted file mode 100644 index 58c3e5c126..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/fremennik_boots_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/games_necklace_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/games_necklace_teleport_icon.png deleted file mode 100644 index 837618950e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/games_necklace_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ghorrock_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ghorrock_teleport_icon.png deleted file mode 100644 index da4926c429..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ghorrock_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/harmony_island_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/harmony_island_teleport_icon.png deleted file mode 100644 index 01e32ea4b4..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/harmony_island_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/house_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/house_teleport_icon.png deleted file mode 100644 index 6206d35dca..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/house_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ice_plateau_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ice_plateau_teleport_icon.png deleted file mode 100644 index b996fcb665..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ice_plateau_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/icy_basalt_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/icy_basalt_teleport_icon.png deleted file mode 100644 index 406d2c2274..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/icy_basalt_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/kandarin_headgear_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/kandarin_headgear_icon.png deleted file mode 100644 index d3bc5ca17c..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/kandarin_headgear_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/karamja_gloves_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/karamja_gloves_icon.png deleted file mode 100644 index 798c6d5ba7..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/karamja_gloves_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/kharedsts_memoirs_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/kharedsts_memoirs_teleport_icon.png deleted file mode 100644 index 41077e60d9..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/kharedsts_memoirs_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/kharyrll_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/kharyrll_teleport_icon.png deleted file mode 100644 index 13a107adbb..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/kharyrll_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/khazard_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/khazard_teleport_icon.png deleted file mode 100644 index cc0179198c..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/khazard_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/kourend_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/kourend_teleport_icon.png deleted file mode 100644 index cb56803c64..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/kourend_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/lassar_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/lassar_teleport_icon.png deleted file mode 100644 index 168753be24..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/lassar_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/law_altar_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/law_altar_icon.png deleted file mode 100644 index 3a441635d4..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/law_altar_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/lumbridge_graveyard_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/lumbridge_graveyard_teleport_icon.png deleted file mode 100644 index 4c8a1578e2..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/lumbridge_graveyard_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/lumbridge_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/lumbridge_teleport_icon.png deleted file mode 100644 index d7591f2a8d..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/lumbridge_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/mind_altar_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/mind_altar_icon.png deleted file mode 100644 index b0aaeecf2a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/mind_altar_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/mind_altar_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/mind_altar_teleport_icon.png deleted file mode 100644 index 4c8936f022..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/mind_altar_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/moonclan_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/moonclan_teleport_icon.png deleted file mode 100644 index 622d52de7a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/moonclan_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/morytania_legs_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/morytania_legs_icon.png deleted file mode 100644 index 68386d1b5c..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/morytania_legs_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/mythical_cape_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/mythical_cape_teleport_icon.png deleted file mode 100644 index f3fab4b7db..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/mythical_cape_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/nature_altar_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/nature_altar_icon.png deleted file mode 100644 index ee53dbd5a3..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/nature_altar_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/necklace_of_passage_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/necklace_of_passage_teleport_icon.png deleted file mode 100644 index 9b5201c436..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/necklace_of_passage_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/nope_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/nope_icon.png deleted file mode 100644 index 7383512c86..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/nope_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/obelisk_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/obelisk_icon.png deleted file mode 100644 index e0998d700d..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/obelisk_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ourania_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ourania_teleport_icon.png deleted file mode 100644 index cbf4485544..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ourania_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/paddewwa_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/paddewwa_teleport_icon.png deleted file mode 100644 index 5a4b3b179f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/paddewwa_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/pharaohs_sceptre_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/pharaohs_sceptre_teleport_icon.png deleted file mode 100644 index 539625aa2e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/pharaohs_sceptre_teleport_icon.png and /dev/null differ 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 deleted file mode 100644 index 71193ddba2..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/quest_completed_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/quest_highlight_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/quest_highlight_icon.png deleted file mode 100644 index 9c7884450b..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/quest_highlight_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/quest_not_started_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/quest_not_started_icon.png deleted file mode 100644 index c383d269ce..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/quest_not_started_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/quest_started_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/quest_started_icon.png deleted file mode 100644 index bd23865486..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/quest_started_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/radas_blessing_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/radas_blessing_icon.png deleted file mode 100644 index 8ab9767668..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/radas_blessing_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/respawn_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/respawn_teleport_icon.png deleted file mode 100644 index a0fa01e997..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/respawn_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ring_of_dueling_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ring_of_dueling_teleport_icon.png deleted file mode 100644 index 421d5cf3ad..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ring_of_dueling_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ring_of_wealth_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ring_of_wealth_teleport_icon.png deleted file mode 100644 index 332e61f686..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/ring_of_wealth_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/royal_seed_pod_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/royal_seed_pod_teleport_icon.png deleted file mode 100644 index 4d83a8be28..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/royal_seed_pod_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/salve_graveyard_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/salve_graveyard_teleport_icon.png deleted file mode 100644 index 9dc9a999d5..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/salve_graveyard_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/scroll_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/scroll_teleport_icon.png deleted file mode 100644 index ea54385a88..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/scroll_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/senntisten_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/senntisten_teleport_icon.png deleted file mode 100644 index c12cef3a62..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/senntisten_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/skills_necklace_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/skills_necklace_teleport_icon.png deleted file mode 100644 index 2274f6dbf8..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/skills_necklace_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/skull_sceptre_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/skull_sceptre_teleport_icon.png deleted file mode 100644 index 63ea2d6d28..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/skull_sceptre_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/slayer_ring_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/slayer_ring_teleport_icon.png deleted file mode 100644 index 981f70be41..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/slayer_ring_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/soul_altar_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/soul_altar_icon.png deleted file mode 100644 index 08615a949e..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/soul_altar_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/stony_basalt_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/stony_basalt_teleport_icon.png deleted file mode 100644 index fd3d93f995..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/stony_basalt_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/teleport_crystal_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/teleport_crystal_icon.png deleted file mode 100644 index 0ae82e1a5a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/teleport_crystal_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/transportation_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/transportation_icon.png deleted file mode 100644 index b5648c0ca1..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/transportation_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/trollheim_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/trollheim_teleport_icon.png deleted file mode 100644 index 3b4a461ad9..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/trollheim_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/varrock_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/varrock_teleport_icon.png deleted file mode 100644 index 3815cfa445..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/varrock_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/watchtower_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/watchtower_teleport_icon.png deleted file mode 100644 index 4dc2b4b56a..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/watchtower_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/water_altar_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/water_altar_icon.png deleted file mode 100644 index 52200880ad..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/water_altar_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/waterbirth_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/waterbirth_teleport_icon.png deleted file mode 100644 index 9ab1587465..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/waterbirth_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/west_ardougne_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/west_ardougne_teleport_icon.png deleted file mode 100644 index c40f91499b..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/west_ardougne_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/western_banner_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/western_banner_icon.png deleted file mode 100644 index fcf78ff4eb..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/western_banner_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/wilderness_crabs_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/wilderness_crabs_teleport_icon.png deleted file mode 100644 index 0097d15040..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/wilderness_crabs_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/wilderness_sword_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/wilderness_sword_icon.png deleted file mode 100644 index 542cdb1e0f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/wilderness_sword_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/wrath_altar_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/wrath_altar_icon.png deleted file mode 100644 index 87b77a7395..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/wrath_altar_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/xerics_talisman_teleport_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/xerics_talisman_teleport_icon.png deleted file mode 100644 index cb21c4e067..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/xerics_talisman_teleport_icon.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/zulrah/protect_from_magic.png b/runelite-client/src/main/resources/net/runelite/client/plugins/zulrah/protect_from_magic.png deleted file mode 100644 index b71e1d395f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/zulrah/protect_from_magic.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/zulrah/protect_from_missiles.png b/runelite-client/src/main/resources/net/runelite/client/plugins/zulrah/protect_from_missiles.png deleted file mode 100644 index 210e0ff6d6..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/zulrah/protect_from_missiles.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/zulrah/zulrah_magic.png b/runelite-client/src/main/resources/net/runelite/client/plugins/zulrah/zulrah_magic.png deleted file mode 100644 index 6367f6f830..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/zulrah/zulrah_magic.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/zulrah/zulrah_melee.png b/runelite-client/src/main/resources/net/runelite/client/plugins/zulrah/zulrah_melee.png deleted file mode 100644 index a41924d22f..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/zulrah/zulrah_melee.png and /dev/null differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/zulrah/zulrah_range.png b/runelite-client/src/main/resources/net/runelite/client/plugins/zulrah/zulrah_range.png deleted file mode 100644 index 33a932f1ca..0000000000 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/zulrah/zulrah_range.png and /dev/null differ diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/attackstyles/AttackStylesPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/attackstyles/AttackStylesPluginTest.java deleted file mode 100644 index 702a040ec4..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/attackstyles/AttackStylesPluginTest.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright (c) 2018, 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.attackstyles; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import java.util.Set; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.Skill; -import net.runelite.api.VarPlayer; -import net.runelite.api.Varbits; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.events.WidgetHiddenChanged; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.config.OpenOSRSConfig; -import net.runelite.client.events.ConfigChanged; -import net.runelite.client.ui.overlay.OverlayManager; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class AttackStylesPluginTest -{ - @Mock - @Bind - Client client; - - @Mock - @Bind - OverlayManager overlayManager; - - @Mock - @Bind - AttackStylesConfig attackConfig; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Inject - AttackStylesPlugin attackPlugin; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - /* - * Verify that red text is displayed when attacking with a style that gains experience - * in one of the unwanted skills. - */ - @Test - public void testWarning() - { - ConfigChanged warnForAttackEvent = new ConfigChanged(); - warnForAttackEvent.setGroup("attackIndicator"); - warnForAttackEvent.setKey("warnForAttack"); - warnForAttackEvent.setNewValue("true"); - attackPlugin.onConfigChanged(warnForAttackEvent); - - // Verify there is a warned skill - Set warnedSkills = attackPlugin.getWarnedSkills(); - assertTrue(warnedSkills.contains(Skill.ATTACK)); - - // Set mock client to attack in style that gives attack xp - when(client.getVar(VarPlayer.ATTACK_STYLE)).thenReturn(AttackStyle.ACCURATE.ordinal()); - - // verify that earning xp in a warned skill will display red text on the widget - attackPlugin.onVarbitChanged(new VarbitChanged()); - assertTrue(attackPlugin.isWarnedSkillSelected()); - - // Switch to attack style that doesn't give attack xp - when(client.getVar(VarPlayer.ATTACK_STYLE)).thenReturn(AttackStyle.AGGRESSIVE.ordinal()); - - // Verify the widget will now display white text - attackPlugin.onVarbitChanged(new VarbitChanged()); - warnedSkills = attackPlugin.getWarnedSkills(); - assertTrue(warnedSkills.contains(Skill.ATTACK)); - assertFalse(attackPlugin.isWarnedSkillSelected()); - } - - /* - * Verify that attack style widgets are hidden when filtered with the AttackStylesPlugin. - */ - @Test - public void testHiddenWidget() - { - ConfigChanged warnForAttackEvent = new ConfigChanged(); - warnForAttackEvent.setGroup("attackIndicator"); - warnForAttackEvent.setKey("warnForAttack"); - warnForAttackEvent.setNewValue("true"); - attackPlugin.onConfigChanged(warnForAttackEvent); - - // Set up mock widgets for atk and str attack styles - Widget atkWidget = mock(Widget.class); - Widget strWidget = mock(Widget.class); - when(client.getWidget(WidgetInfo.COMBAT_STYLE_ONE)).thenReturn(atkWidget); - when(client.getWidget(WidgetInfo.COMBAT_STYLE_TWO)).thenReturn(strWidget); - // Set widgets to return their hidden value in widgetsToHide when isHidden() is called - when(atkWidget.isHidden()).thenAnswer(x -> isAtkHidden()); - when(strWidget.isHidden()).thenAnswer(x -> isStrHidden()); - - // equip type_4 weapon type on player - when(client.getVar(Varbits.EQUIPPED_WEAPON_TYPE)).thenReturn(WeaponType.TYPE_4.ordinal()); - attackPlugin.onVarbitChanged(new VarbitChanged()); - - // Verify there is a warned skill - Set warnedSkills = attackPlugin.getWarnedSkills(); - assertTrue(warnedSkills.contains(Skill.ATTACK)); - - // Enable hiding widgets - ConfigChanged hideWidgetEvent = new ConfigChanged(); - hideWidgetEvent.setGroup("attackIndicator"); - hideWidgetEvent.setKey("removeWarnedStyles"); - hideWidgetEvent.setNewValue("true"); - attackPlugin.onConfigChanged(hideWidgetEvent); - when(attackConfig.removeWarnedStyles()).thenReturn(true); - - // verify that the accurate attack style widget is hidden - assertTrue(atkWidget.isHidden()); - - // add another warned skill - ConfigChanged warnForStrengthEvent = new ConfigChanged(); - warnForStrengthEvent.setGroup("attackIndicator"); - warnForStrengthEvent.setKey("warnForStrength"); - warnForStrengthEvent.setNewValue("true"); - attackPlugin.onConfigChanged(warnForStrengthEvent); - - // verify that the aggressive attack style widget is now hidden - assertTrue(strWidget.isHidden()); - - // disable hiding attack style widgets - hideWidgetEvent.setGroup("attackIndicator"); - hideWidgetEvent.setKey("removeWarnedStyles"); - hideWidgetEvent.setNewValue("false"); - attackPlugin.onConfigChanged(hideWidgetEvent); - - // verify that the aggressive and accurate attack style widgets are no longer hidden - assertFalse(attackPlugin.getHiddenWidgets().get(WeaponType.TYPE_4, - WidgetInfo.COMBAT_STYLE_ONE)); - assertFalse(attackPlugin.getHiddenWidgets().get(WeaponType.TYPE_4, - WidgetInfo.COMBAT_STYLE_THREE)); - } - - /* - * Verify that the defensive style is hidden when switching from bludgeon to bow - */ - @Test - public void testHiddenLongrange() - { - final ArgumentCaptor captor = ArgumentCaptor.forClass(Boolean.class); - final ConfigChanged warnForAttackEvent = new ConfigChanged(); - warnForAttackEvent.setGroup("attackIndicator"); - warnForAttackEvent.setKey("warnForDefensive"); - warnForAttackEvent.setNewValue("true"); - attackPlugin.onConfigChanged(warnForAttackEvent); - - // verify there is a warned skill - Set warnedSkills = attackPlugin.getWarnedSkills(); - assertTrue(warnedSkills.contains(Skill.DEFENCE)); - - // Set up mock widget for strength and longrange - final Widget widget = mock(Widget.class); - when(client.getWidget(WidgetInfo.COMBAT_STYLE_FOUR)).thenReturn(widget); - - // Set up hidden changed event - final WidgetHiddenChanged widgetHiddenChanged = new WidgetHiddenChanged(); - widgetHiddenChanged.setWidget(widget); - when(widget.getId()).thenReturn(WidgetInfo.COMBAT_STYLE_FOUR.getPackedId()); - - // Enable hiding widgets - final ConfigChanged hideWidgetEvent = new ConfigChanged(); - hideWidgetEvent.setGroup("attackIndicator"); - hideWidgetEvent.setKey("removeWarnedStyles"); - hideWidgetEvent.setNewValue("true"); - attackPlugin.onConfigChanged(hideWidgetEvent); - attackPlugin.removeWarnedStyles = true; - - // equip bludgeon on player - when(client.getVar(Varbits.EQUIPPED_WEAPON_TYPE)).thenReturn(WeaponType.TYPE_26.ordinal()); - attackPlugin.onVarbitChanged(new VarbitChanged()); - attackPlugin.onWidgetHiddenChanged(widgetHiddenChanged); - - // verify that the agressive style style widget is showing - verify(widget, atLeastOnce()).setHidden(captor.capture()); - assertFalse(captor.getValue()); - - // equip bow on player - // the equipped weaopn varbit will change after the hiddenChanged event has been dispatched - attackPlugin.onWidgetHiddenChanged(widgetHiddenChanged); - when(client.getVar(Varbits.EQUIPPED_WEAPON_TYPE)).thenReturn(WeaponType.TYPE_3.ordinal()); - attackPlugin.onVarbitChanged(new VarbitChanged()); - - // verify that the longrange attack style widget is now hidden - verify(widget, atLeastOnce()).setHidden(captor.capture()); - System.out.println(captor.getValue()); - assertTrue(captor.getValue()); - } - - private boolean isAtkHidden() - { - if (attackPlugin.getHiddenWidgets().size() == 0) - { - return false; - } - return attackPlugin.getHiddenWidgets().get(WeaponType.TYPE_4, WidgetInfo.COMBAT_STYLE_ONE); - } - - private boolean isStrHidden() - { - if (attackPlugin.getHiddenWidgets().size() == 0) - { - return false; - } - return attackPlugin.getHiddenWidgets().get(WeaponType.TYPE_4, WidgetInfo.COMBAT_STYLE_TWO); - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/bank/BankPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/bank/BankPluginTest.java deleted file mode 100644 index 0c9e79f662..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/bank/BankPluginTest.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2019, Ron Young - * 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.bank; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemDefinition; -import net.runelite.api.ItemID; -import net.runelite.client.config.OpenOSRSConfig; -import net.runelite.client.game.ItemManager; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -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.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class BankPluginTest -{ - @Mock - @Bind - private Client client; - - @Mock - @Bind - private ItemManager itemManager; - - @Mock - @Bind - private BankConfig bankConfig; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Inject - private BankPlugin bankPlugin; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - @Test - public void testValueSearch() - { - int itemId = ItemID.ABYSSAL_WHIP; - - ItemContainer itemContainer = mock(ItemContainer.class); - when(itemContainer.getItems()).thenReturn(new Item[]{new Item(itemId, 30)}); - when(client.getItemContainer(InventoryID.BANK)).thenReturn(itemContainer); - - ItemDefinition comp = mock(ItemDefinition.class); - - // 60k HA price * 30 = 1.8m - when(comp.getPrice()) - .thenReturn(100_000); - - // 400k GE Price * 30 = 12m - when(itemManager.getItemPrice(itemId)) - .thenReturn(400_000); - when(itemManager.getItemDefinition(itemId)) - .thenReturn(comp); - - assertTrue(bankPlugin.valueSearch(itemId, ">500k")); - assertTrue(bankPlugin.valueSearch(itemId, "< 5.5b")); - assertTrue(bankPlugin.valueSearch(itemId, "500k - 20.6m")); - - assertTrue(bankPlugin.valueSearch(itemId, "ha=1.8m")); - assertTrue(bankPlugin.valueSearch(itemId, "ha 500k - 20.6m")); - assertTrue(bankPlugin.valueSearch(itemId, "ha > 940k")); - - assertFalse(bankPlugin.valueSearch(itemId, "<500k")); - assertFalse(bankPlugin.valueSearch(itemId, "ha >2m")); - assertFalse(bankPlugin.valueSearch(itemId, "ge > 0.02b")); - - assertFalse(bankPlugin.valueSearch(itemId, "1000k")); - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/bank/ContainerCalculationTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/bank/ContainerCalculationTest.java deleted file mode 100644 index 4e33374083..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/bank/ContainerCalculationTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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.bank; - -import com.google.common.collect.ImmutableList; -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.Item; -import net.runelite.api.ItemDefinition; -import net.runelite.api.ItemID; -import net.runelite.client.game.ItemManager; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -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.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class ContainerCalculationTest -{ - @Mock - @Bind - private Client client; - - @Mock - @Bind - private ItemManager itemManager; - - @Inject - private ContainerCalculation containerCalculation; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - @Test - public void testCalculate() - { - Item coins = new Item(ItemID.COINS_995, Integer.MAX_VALUE); - - Item whip = new Item(ItemID.ABYSSAL_WHIP, 1_000_000_000); - - Item[] items = ImmutableList.of( - coins, - whip - ).toArray(new Item[0]); - - ItemDefinition whipComp = mock(ItemDefinition.class); - when(whipComp.getPrice()) - .thenReturn(7); // 7 * .6 = 4, 4 * 1m overflows - when(itemManager.getItemDefinition(ItemID.ABYSSAL_WHIP)) - .thenReturn(whipComp); - when(itemManager.getItemPrice(ItemID.ABYSSAL_WHIP)) - .thenReturn(3); // 1b * 3 overflows - - final ContainerPrices prices = containerCalculation.calculate(items); - assertNotNull(prices); - - assertTrue(prices.getHighAlchPrice() > Integer.MAX_VALUE); - assertTrue(prices.getGePrice() > Integer.MAX_VALUE); - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/banktags/ItemValueSearchTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/banktags/ItemValueSearchTest.java deleted file mode 100644 index f5779cefcd..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/banktags/ItemValueSearchTest.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2019, Ron Young - * 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.banktags; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import java.util.concurrent.ScheduledExecutorService; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.ItemDefinition; -import net.runelite.api.ItemID; -import net.runelite.client.callback.ClientThread; -import net.runelite.client.config.OpenOSRSConfig; -import net.runelite.client.config.RuneLiteConfig; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.game.chatbox.ChatboxPanelManager; -import net.runelite.client.input.KeyManager; -import net.runelite.client.input.MouseManager; -import net.runelite.client.plugins.banktags.tabs.BankSearch; -import net.runelite.client.plugins.banktags.tabs.TabInterface; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -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.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class ItemValueSearchTest -{ - @Mock - @Bind - private Client client; - - @Mock - @Bind - private ItemManager itemManager; - - @Inject - private BankTagsPlugin bankTagsPlugin; - - @Mock - @Bind - private ClientThread clientThread; - - @Mock - @Bind - private ChatboxPanelManager chatboxPanelManager; - - @Mock - @Bind - private MouseManager mouseManager; - - @Mock - @Bind - private BankTagsConfig config; - - @Mock - @Bind - private TagManager tagManager; - - @Mock - @Bind - private TabInterface tabInterface; - - @Mock - @Bind - private BankSearch bankSearch; - - @Mock - @Bind - private KeyManager keyManager; - - @Mock - @Bind - private SpriteManager spriteManager; - - @Mock - @Bind - private RuneLiteConfig runeLiteConfig; - - @Mock - @Bind - private ScheduledExecutorService scheduledExecutorService; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - @Test - public void testCalculate() - { - int itemId = ItemID.ABYSSAL_WHIP; - - bankTagsPlugin.itemQuantities.add(itemId, 30); - - ItemDefinition comp = mock(ItemDefinition.class); - - // 60k HA price * 30 = 1.8m - when(comp.getPrice()) - .thenReturn(100_000); - - // 400k GE Price * 30 = 12m - when(itemManager.getItemPrice(itemId)) - .thenReturn(400_000); - when(itemManager.getItemDefinition(itemId)) - .thenReturn(comp); - - assertTrue(bankTagsPlugin.valueSearch(itemId, ">500k")); - assertTrue(bankTagsPlugin.valueSearch(itemId, "< 5.5b")); - assertTrue(bankTagsPlugin.valueSearch(itemId, "500k - 20.6m")); - - assertTrue(bankTagsPlugin.valueSearch(itemId, "ha=1.8m")); - assertTrue(bankTagsPlugin.valueSearch(itemId, "ha 500k - 20.6m")); - assertTrue(bankTagsPlugin.valueSearch(itemId, "ha > 940k")); - - assertFalse(bankTagsPlugin.valueSearch(itemId, "<500k")); - assertFalse(bankTagsPlugin.valueSearch(itemId, "ha >2m")); - assertFalse(bankTagsPlugin.valueSearch(itemId, "ge > 0.02b")); - - assertFalse(bankTagsPlugin.valueSearch(itemId, "1000k")); - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java deleted file mode 100644 index 9d04e2eacd..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2018, 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.cerberus; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import java.util.Arrays; -import java.util.List; -import javax.inject.Inject; -import net.runelite.api.NPC; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.events.GameTick; -import net.runelite.client.config.OpenOSRSConfig; -import net.runelite.client.ui.overlay.OverlayManager; -import static org.junit.Assert.assertEquals; -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.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class CerberusPluginTest -{ - @Mock - @Bind - OverlayManager overlayManager; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Inject - CerberusPlugin cerberusPlugin; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - @Test - public void testOnGameTick() - { - List ghosts = cerberusPlugin.getGhosts(); - ghosts.addAll(Arrays.asList( - mockNpc(new LocalPoint(0, 0)), - mockNpc(new LocalPoint(1, 0)), - mockNpc(new LocalPoint(0, 5)), - mockNpc(new LocalPoint(2, 0)), - mockNpc(new LocalPoint(2, 5)), - mockNpc(new LocalPoint(1, 5)) - )); - cerberusPlugin.onGameTick(GameTick.INSTANCE); - - // Expected sort is by lowest y first, then by lowest x - assertEquals(ghosts.get(0).getLocalLocation(), new LocalPoint(0, 0)); - assertEquals(ghosts.get(1).getLocalLocation(), new LocalPoint(1, 0)); - assertEquals(ghosts.get(2).getLocalLocation(), new LocalPoint(2, 0)); - - assertEquals(ghosts.get(3).getLocalLocation(), new LocalPoint(0, 5)); - assertEquals(ghosts.get(4).getLocalLocation(), new LocalPoint(1, 5)); - assertEquals(ghosts.get(5).getLocalLocation(), new LocalPoint(2, 5)); - } - - private static NPC mockNpc(LocalPoint localPoint) - { - NPC npc = mock(NPC.class); - when(npc.getLocalLocation()).thenReturn(localPoint); - return npc; - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java deleted file mode 100644 index 375044d2b2..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java +++ /dev/null @@ -1,400 +0,0 @@ -/* - * Copyright (c) 2018, 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.chatcommands; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import java.util.concurrent.ScheduledExecutorService; -import javax.inject.Inject; -import static net.runelite.api.ChatMessageType.FRIENDSCHATNOTIFICATION; -import static net.runelite.api.ChatMessageType.GAMEMESSAGE; -import static net.runelite.api.ChatMessageType.TRADE; -import net.runelite.api.Client; -import net.runelite.api.events.ChatMessage; -import net.runelite.client.config.ChatColorConfig; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.config.OpenOSRSConfig; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import org.mockito.Mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class ChatCommandsPluginTest -{ - @Mock - @Bind - Client client; - - @Mock - @Bind - ConfigManager configManager; - - @Mock - @Bind - ScheduledExecutorService scheduledExecutorService; - - @Mock - @Bind - ChatColorConfig chatColorConfig; - - @Mock - @Bind - ChatCommandsConfig chatCommandsConfig; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Inject - ChatCommandsPlugin chatCommandsPlugin; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - @Test - public void testCorporealBeastKill() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", "Your Corporeal Beast kill count is: 4.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessageEvent); - - verify(configManager).setConfiguration("killcount.adam", "corporeal beast", 4); - } - - @Test - public void testTheatreOfBlood() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Theatre of Blood count is: 73.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessageEvent); - - verify(configManager).setConfiguration("killcount.adam", "theatre of blood", 73); - } - - @Test - public void testWintertodt() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", "Your subdued Wintertodt count is: 4.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessageEvent); - - verify(configManager).setConfiguration("killcount.adam", "wintertodt", 4); - } - - @Test - public void testKreearra() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", "Your Kree'arra kill count is: 4.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessageEvent); - - verify(configManager).setConfiguration("killcount.adam", "kree'arra", 4); - } - - @Test - public void testBarrows() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", "Your Barrows chest count is: 277.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessageEvent); - - verify(configManager).setConfiguration("killcount.adam", "barrows chests", 277); - } - - @Test - public void testHerbiboar() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", "Your herbiboar harvest count is: 4091.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessageEvent); - - verify(configManager).setConfiguration("killcount.adam", "herbiboar", 4091); - } - - @Test - public void testGauntlet() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage gauntletMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Gauntlet completion count is: 123.", null, 0); - chatCommandsPlugin.onChatMessage(gauntletMessage); - - verify(configManager).setConfiguration("killcount.adam", "gauntlet", 123); - } - - @Test - public void testCorruptedGauntlet() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage corruptedGauntletMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Corrupted Gauntlet completion count is: 4729.", null, 0); - chatCommandsPlugin.onChatMessage(corruptedGauntletMessage); - - verify(configManager).setConfiguration("killcount.adam", "corrupted gauntlet", 4729); - } - - @Test - public void testPersonalBest() - { - final String FIGHT_DURATION = "Fight duration: 2:06. Personal best: 1:19."; - - when(client.getUsername()).thenReturn("Adam"); - - // This sets lastBoss - ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Kree'arra kill count is: 4.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - chatMessage = new ChatMessage(null, GAMEMESSAGE, "", FIGHT_DURATION, null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("kree'arra"), eq(79)); - } - - @Test - public void testPersonalBestNoTrailingPeriod() - { - final String FIGHT_DURATION = "Fight duration: 0:59. Personal best: 0:55"; - - when(client.getUsername()).thenReturn("Adam"); - - // This sets lastBoss - ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Zulrah kill count is: 4.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - chatMessage = new ChatMessage(null, GAMEMESSAGE, "", FIGHT_DURATION, null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("zulrah"), eq(55)); - } - - @Test - public void testNewPersonalBest() - { - final String NEW_PB = "Fight duration: 3:01 (new personal best)."; - - when(client.getUsername()).thenReturn("Adam"); - - // This sets lastBoss - ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Kree'arra kill count is: 4.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - chatMessage = new ChatMessage(null, GAMEMESSAGE, "", NEW_PB, null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("kree'arra"), eq(181)); - } - - @Test - public void testDuelArenaWin() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You won! You have now won 27 duels.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessageEvent); - - verify(configManager).setConfiguration("killcount.adam", "duel arena wins", 27); - verify(configManager).setConfiguration("killcount.adam", "duel arena win streak", 1); - } - - @Test - public void testDuelArenaWin2() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You were defeated! You have won 22 duels.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessageEvent); - - verify(configManager).setConfiguration("killcount.adam", "duel arena wins", 22); - } - - @Test - public void testDuelArenaLose() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You have now lost 999 duels.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessageEvent); - - verify(configManager).setConfiguration("killcount.adam", "duel arena losses", 999); - } - - @Test - public void testAgilityLap() - { - final String NEW_PB = "Lap duration: 1:01 (new personal best)."; - - when(client.getUsername()).thenReturn("Adam"); - - // This sets lastBoss - ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Prifddinas Agility Course lap count is: 2.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - chatMessage = new ChatMessage(null, GAMEMESSAGE, "", NEW_PB, null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("prifddinas agility course"), eq(61)); - verify(configManager).setConfiguration(eq("killcount.adam"), eq("prifddinas agility course"), eq(2)); - } - - @Test - public void testZukNewPb() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your TzKal-Zuk kill count is: 2.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Duration: 104:31 (new personal best)", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("tzkal-zuk"), eq(104 * 60 + 31)); - verify(configManager).setConfiguration(eq("killcount.adam"), eq("tzkal-zuk"), eq(2)); - } - - @Test - public void testZukKill() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your TzKal-Zuk kill count is: 3.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Duration: 172:18. Personal best: 134:52", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("tzkal-zuk"), eq(134 * 60 + 52)); - verify(configManager).setConfiguration(eq("killcount.adam"), eq("tzkal-zuk"), eq(3)); - } - - @Test - public void testGgNewPb() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Fight duration: 1:36 (new personal best)", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Grotesque Guardians kill count is: 179.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("grotesque guardians"), eq(96)); - verify(configManager).setConfiguration(eq("killcount.adam"), eq("grotesque guardians"), eq(179)); - } - - @Test - public void testGgKill() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Fight duration: 2:41. Personal best: 2:14", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Grotesque Guardians kill count is: 32.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("grotesque guardians"), eq(2 * 60 + 14)); - verify(configManager).setConfiguration(eq("killcount.adam"), eq("grotesque guardians"), eq(32)); - } - - @Test - public void testGuantletPersonalBest() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Challenge duration: 10:24. Personal best: 7:59.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Gauntlet completion count is: 124.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - verify(configManager).setConfiguration(eq("killcount.adam"), eq("gauntlet"), eq(124)); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("gauntlet"), eq(7 * 60 + 59)); - } - - @Test - public void testGuantletNewPersonalBest() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Challenge duration: 10:24 (new personal best).", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Gauntlet completion count is: 124.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("gauntlet"), eq(10 * 60 + 24)); - verify(configManager).setConfiguration(eq("killcount.adam"), eq("gauntlet"), eq(124)); - } - - @Test - public void testCoXKill() - { - when(client.getUsername()).thenReturn("Adam"); - - ChatMessage chatMessage = new ChatMessage(null, FRIENDSCHATNOTIFICATION, "", "Congratulations - your raid is complete! Duration: 37:04", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Chambers of Xeric count is: 51.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - verify(configManager).setConfiguration(eq("killcount.adam"), eq("chambers of xeric"), eq(51)); - verify(configManager).setConfiguration(eq("personalbest.adam"), eq("chambers of xeric"), eq(37 * 60 + 4)); - } - - @Test - public void testCoXKillNoPb() - { - when(client.getUsername()).thenReturn("Adam"); - when(configManager.getConfiguration(anyString(), anyString(), any())).thenReturn(2224); - - ChatMessage chatMessage = new ChatMessage(null, FRIENDSCHATNOTIFICATION, "", "Congratulations - your raid is complete! Duration: 1:45:04", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your completed Chambers of Xeric count is: 52.", null, 0); - chatCommandsPlugin.onChatMessage(chatMessage); - - verify(configManager).setConfiguration(eq("killcount.adam"), eq("chambers of xeric"), eq(52)); - verify(configManager, never()).setConfiguration(eq("personalbest.adam"), eq("chambers of xeric"), anyInt()); - } -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatfilter/ChatFilterPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatfilter/ChatFilterPluginTest.java deleted file mode 100644 index 65569eb2cf..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatfilter/ChatFilterPluginTest.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2019, Adam - * Copyright (c) 2019, osrs-music-map - * 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.chatfilter; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.Player; -import net.runelite.client.config.OpenOSRSConfig; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import static org.mockito.Mockito.lenient; -import static org.mockito.Mockito.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class ChatFilterPluginTest -{ - @Mock - @Bind - private Client client; - - @Mock - @Bind - private ChatFilterConfig chatFilterConfig; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Mock - private Player localPlayer; - - @Inject - private ChatFilterPlugin chatFilterPlugin; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - - chatFilterPlugin.setFilterType(ChatFilterType.CENSOR_WORDS); - chatFilterPlugin.setFilteredWords(""); - chatFilterPlugin.setFilteredRegex(""); - - when(client.getLocalPlayer()).thenReturn(localPlayer); - } - - @Test - public void testCensorWords() - { - chatFilterPlugin.setFilteredWords("hat"); - - chatFilterPlugin.updateFilteredPatterns(); - assertEquals("w***s up", chatFilterPlugin.censorMessage("whats up")); - } - - @Test - public void testCensorRegex() - { - chatFilterPlugin.setFilterType(ChatFilterType.REMOVE_MESSAGE); - chatFilterPlugin.setFilteredRegex("5[0-9]x2\n("); - - chatFilterPlugin.updateFilteredPatterns(); - assertNull(chatFilterPlugin.censorMessage("55X2 Dicing | Trusted Ranks | Huge Pay Outs!")); - } - - @Test - public void testBrokenRegex() - { - chatFilterPlugin.setFilteredRegex("Test\n)\n73"); - - chatFilterPlugin.updateFilteredPatterns(); - assertEquals("** isn't funny", chatFilterPlugin.censorMessage("73 isn't funny")); - } - - @Test - public void testCaseSensitivity() - { - chatFilterPlugin.setFilterType(ChatFilterType.CENSOR_MESSAGE); - chatFilterPlugin.setFilteredWords("ReGeX!!!"); - - chatFilterPlugin.updateFilteredPatterns(); - assertEquals("Hey, everyone, I just tried to say something very silly!", - chatFilterPlugin.censorMessage("I love regex!!!!!!!!")); - } - - @Test - public void testNonPrintableCharacters() - { - chatFilterPlugin.setFilterType(ChatFilterType.REMOVE_MESSAGE); - chatFilterPlugin.setFilteredWords("test"); - - chatFilterPlugin.updateFilteredPatterns(); - assertNull(chatFilterPlugin.censorMessage("te\u008Cst")); - } - - @Test - public void testReplayedMessage() - { - chatFilterPlugin.setFilterType(ChatFilterType.REMOVE_MESSAGE); - chatFilterPlugin.setFilteredWords("hello osrs"); - - chatFilterPlugin.updateFilteredPatterns(); - assertNull(chatFilterPlugin.censorMessage("hello\u00A0osrs")); - } - - @Test - public void testMessageFromFriendIsFiltered() - { - chatFilterPlugin.setFilterFriends(true); - when(client.isClanMember("Iron Mammal")).thenReturn(false); - assertTrue(chatFilterPlugin.shouldFilterPlayerMessage("Iron Mammal")); - } - - @Test - public void testMessageFromFriendIsNotFiltered() - { - when(client.isFriended("Iron Mammal", false)).thenReturn(true); - chatFilterPlugin.setFilterFriends(false); - assertFalse(chatFilterPlugin.shouldFilterPlayerMessage("Iron Mammal")); - } - - @Test - public void testMessageFromClanIsFiltered() - { - when(client.isFriended("B0aty", false)).thenReturn(false); - assertTrue(chatFilterPlugin.shouldFilterPlayerMessage("B0aty")); - } - - @Test - public void testMessageFromClanIsNotFiltered() - { - lenient().when(client.isClanMember("B0aty")).thenReturn(true); - chatFilterPlugin.setFilterClan(false); - assertFalse(chatFilterPlugin.shouldFilterPlayerMessage("B0aty")); - } - - @Test - public void testMessageFromSelfIsNotFiltered() - { - lenient().when(localPlayer.getName()).thenReturn("Swampletics"); - assertFalse(chatFilterPlugin.shouldFilterPlayerMessage("Swampletics")); - } - - @Test - public void testMessageFromNonFriendNonClanIsFiltered() - { - lenient().when(client.isFriended("Woox", false)).thenReturn(false); - lenient().when(client.isClanMember("Woox")).thenReturn(false); - assertTrue(chatFilterPlugin.shouldFilterPlayerMessage("Woox")); - } -} \ No newline at end of file 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 deleted file mode 100644 index 429001408f..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (c) 2018, 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.chatnotifications; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import java.util.Iterator; -import java.util.List; -import javax.inject.Inject; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.MessageNode; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.util.Text; -import net.runelite.client.Notifier; -import net.runelite.client.chat.ChatMessageManager; -import net.runelite.client.config.OpenOSRSConfig; -import static org.junit.Assert.assertEquals; -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.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class ChatNotificationsPluginTest -{ - @Mock - @Bind - private Client client; - - @Mock - @Bind - private ChatNotificationsConfig config; - - @Mock - @Bind - private ChatMessageManager chatMessageManager; - - @Mock - @Bind - private Notifier notifier; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Inject - private ChatNotificationsPlugin chatNotificationsPlugin; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - @Test - public void onChatMessage() - { - when(config.highlightWordsString()).thenReturn("Deathbeam, Deathbeam OSRS , test"); - - MessageNode messageNode = mock(MessageNode.class); - when(messageNode.getValue()).thenReturn("Deathbeam, Deathbeam OSRS"); - - ChatMessage chatMessage = new ChatMessage(); - chatMessage.setType(ChatMessageType.PUBLICCHAT); - chatMessage.setMessageNode(messageNode); - - chatNotificationsPlugin.startUp(); // load highlight config - chatNotificationsPlugin.onChatMessage(chatMessage); - - 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 testColor() - { - when(config.highlightWordsString()).thenReturn("you. It"); - - String message = "Your dodgy necklace protects you. It has 1 charge left."; - 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("Your dodgy necklace protects you. It has 1 charge left."); - } - - @Test - public void testPreceedingColor() - { - when(config.highlightWordsString()).thenReturn("you. It"); - - String message = "Your dodgy necklace protects you. It has 1 charge left."; - 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("Your dodgy necklace protects you. It has 1 charge left."); - } - - @Test - public void testEmoji() - { - when(config.highlightWordsString()).thenReturn("test"); - - String message = "emoji 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("emoji test "); - } - - @Test - public void testNonMatchedColors() - { - when(config.highlightWordsString()).thenReturn("test"); - - String message = "color 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("color test "); - } - - @Test - public void highlightListTest() - { - when(config.highlightWordsString()).thenReturn("this,is, a , test, "); - final List higlights = Text.fromCSV(config.highlightWordsString()); - assertEquals(4, higlights.size()); - - final Iterator iterator = higlights.iterator(); - assertEquals("this", iterator.next()); - assertEquals("is", iterator.next()); - assertEquals("a", iterator.next()); - assertEquals("test", iterator.next()); - } - - @Test - public void testStripColor() - { - assertEquals("you. It", ChatNotificationsPlugin.stripColor("you. It")); - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/ClueScrollPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/ClueScrollPluginTest.java deleted file mode 100644 index d1585382d4..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/ClueScrollPluginTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2019 Hydrox6 - * 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.cluescrolls; - -import net.runelite.api.coords.WorldPoint; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import org.junit.Test; - -public class ClueScrollPluginTest -{ - @Test - public void getGetMirrorPoint() - { - WorldPoint point, converted; - - // Zalcano's entrance portal - point = new WorldPoint(3282, 6058, 0); - converted = ClueScrollPlugin.getMirrorPoint(point, true); - assertNotEquals(point, converted); - - // Elven Crystal Chest, which is upstairs - point = new WorldPoint(3273, 6082, 2); - converted = ClueScrollPlugin.getMirrorPoint(point, true); - assertNotEquals(point, converted); - - // Around the area of the Elite coordinate clue - point = new WorldPoint(2185, 3280, 0); - // To overworld - converted = ClueScrollPlugin.getMirrorPoint(point, true); - assertEquals(point, converted); - // To real - converted = ClueScrollPlugin.getMirrorPoint(point, false); - assertNotEquals(point, converted); - - // Brugsen Bursen, Grand Exchange - point = new WorldPoint(3165, 3477, 0); - converted = ClueScrollPlugin.getMirrorPoint(point, false); - assertEquals(point, converted); - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClueTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClueTest.java deleted file mode 100644 index d3854d843f..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/CoordinateClueTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.cluescrolls.clues; - -import net.runelite.api.coords.WorldPoint; -import org.junit.Test; - -public class CoordinateClueTest -{ - @Test - public void testDuplicateCoordinates() - { - // If this doesn't throw then the clues map doesn't have duplicate keys - new CoordinateClue("test", new WorldPoint(0, 0, 0), null); - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperatureTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperatureTest.java deleted file mode 100644 index e4ea28eb7f..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdTemperatureTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2019, 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.cluescrolls.clues.hotcold; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import org.junit.Test; - -public class HotColdTemperatureTest -{ - private static final String[] VALID_MESSAGES = { - "The device is warm, and warmer than last time.", - "The device is visibly shaking and burns to the touch. This must be the spot.", - "The device is cold.", - "The device is ice cold.", - "The device is very cold.", - "The device is hot.", - "The device is incredibly hot.", - }; - private static final String[] INVALID_MESSAGES = { - "The device is an octopus, and is wetter than last time.", - "foobar", - "a q p w", - "My feet are cold, I should put them in some lukewarm water, or run hot water over them.", - }; - - @Test - public void testValidTemperatureMessages() - { - for (final String message : VALID_MESSAGES) - { - assertNotNull(message, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.BEGINNER_HOT_COLD_TEMPERATURES, message)); - assertNotNull(message, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES, message)); - } - } - - @Test - public void testInvalidTemperatureMessages() - { - for (final String message : INVALID_MESSAGES) - { - assertNull(message, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.BEGINNER_HOT_COLD_TEMPERATURES, message)); - assertNull(message, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES, message)); - } - } - - @Test - public void testAmbiguousTemperatureMessages() - { - assertEquals(HotColdTemperature.ICE_COLD, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES, "The device is ice cold.")); - assertEquals(HotColdTemperature.VERY_COLD, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES, "The device is very cold.")); - assertEquals(HotColdTemperature.VERY_HOT, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES, "The device is very hot.")); - assertEquals(HotColdTemperature.COLD, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.BEGINNER_HOT_COLD_TEMPERATURES, "The device is cold, and warmer than last time.")); - assertEquals(HotColdTemperature.WARM, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.BEGINNER_HOT_COLD_TEMPERATURES, "The device is warm, but colder than last time.")); - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/combatlevel/CombatLevelPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/combatlevel/CombatLevelPluginTest.java deleted file mode 100644 index e372ef763f..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/combatlevel/CombatLevelPluginTest.java +++ /dev/null @@ -1,396 +0,0 @@ -/* - * Copyright (c) 2018, Brett Middle - * 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.combatlevel; - -import net.runelite.api.Experience; -import static org.junit.Assert.assertEquals; -import org.junit.Test; - -public class CombatLevelPluginTest -{ - @Test - public void testNewPlayer() - { - int attackLevel = 1; - int strengthLevel = 1; - int defenceLevel = 1; - int hitpointsLevel = 10; - int magicLevel = 1; - int rangeLevel = 1; - int prayerLevel = 1; - - int combatLevel = Experience.getCombatLevel(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int meleeNeed = Experience.getNextCombatLevelMelee(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int hpDefNeed = Experience.getNextCombatLevelHpDef(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int rangeNeed = Experience.getNextCombatLevelRange(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int magicNeed = Experience.getNextCombatLevelMagic(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - - // test combat level - assertEquals(3, combatLevel); - - // test attack/strength - assertEquals(2, meleeNeed); - - // test defence/hitpoints - assertEquals(3, hpDefNeed); - - // test ranged - assertEquals(2, rangeNeed); - - // test magic - assertEquals(2, magicNeed); - - // test prayer - assertEquals(5, prayerNeed); - } - - @Test - public void testAll10() - { - int attackLevel = 10; - int strengthLevel = 10; - int defenceLevel = 10; - int hitpointsLevel = 10; - int magicLevel = 10; - int rangeLevel = 10; - int prayerLevel = 10; - - int combatLevel = Experience.getCombatLevel(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int meleeNeed = Experience.getNextCombatLevelMelee(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int hpDefNeed = Experience.getNextCombatLevelHpDef(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int rangeNeed = Experience.getNextCombatLevelRange(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int magicNeed = Experience.getNextCombatLevelMagic(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - - // test combat level - assertEquals(12, combatLevel); - - // test attack/strength - assertEquals(1, meleeNeed); - - // test defence/hitpoints - assertEquals(1, hpDefNeed); - - // test ranged - assertEquals(4, rangeNeed); - - // test magic - assertEquals(4, magicNeed); - - // test prayer - assertEquals(2, prayerNeed); - } - - @Test - public void testPlayerBmid() - { - // snapshot of current stats 2018-10-2 - int attackLevel = 65; - int strengthLevel = 70; - int defenceLevel = 60; - int hitpointsLevel = 71; - int magicLevel = 73; - int rangeLevel = 75; - int prayerLevel = 56; - - int combatLevel = Experience.getCombatLevel(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int meleeNeed = Experience.getNextCombatLevelMelee(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int hpDefNeed = Experience.getNextCombatLevelHpDef(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int rangeNeed = Experience.getNextCombatLevelRange(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int magicNeed = Experience.getNextCombatLevelMagic(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - - // test combat level - assertEquals(83, combatLevel); - - // test attack/strength - assertEquals(2, meleeNeed); - - // test defence/hitpoints - assertEquals(2, hpDefNeed); - - // test ranged - assertEquals(17, rangeNeed); - - // test magic - assertEquals(19, magicNeed); - - // test prayer - assertEquals(4, prayerNeed); - } - - @Test - public void testPlayerRunelite() - { - // snapshot of current stats 2018-10-2 - int attackLevel = 43; - int strengthLevel = 36; - int defenceLevel = 1; - int hitpointsLevel = 42; - int magicLevel = 64; - int rangeLevel = 51; - int prayerLevel = 15; - - int combatLevel = Experience.getCombatLevel(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int meleeNeed = Experience.getNextCombatLevelMelee(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int hpDefNeed = Experience.getNextCombatLevelHpDef(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int rangeNeed = Experience.getNextCombatLevelRange(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int magicNeed = Experience.getNextCombatLevelMagic(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - - // test combat level - assertEquals(43, combatLevel); - - // test attack/strength - assertEquals(18, meleeNeed); - - // test defence/hitpoints - assertEquals(2, hpDefNeed); - - // test ranged - assertEquals(14, rangeNeed); - - // test magic - assertEquals(1, magicNeed); - - // test prayer - assertEquals(3, prayerNeed); - } - - @Test - public void testPlayerZezima() - { - // snapshot of current stats 2018-10-3 - // Zezima cannot earn a combat level from ranged/magic anymore, so it won't show as the result is too high - int attackLevel = 74; - int strengthLevel = 74; - int defenceLevel = 72; - int hitpointsLevel = 72; - int magicLevel = 60; - int rangeLevel = 44; - int prayerLevel = 52; - - int combatLevel = Experience.getCombatLevel(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int meleeNeed = Experience.getNextCombatLevelMelee(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int hpDefNeed = Experience.getNextCombatLevelHpDef(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - - // test combat level - assertEquals(90, combatLevel); - - // test attack/strength - assertEquals(2, meleeNeed); - - // test defence/hitpoints - assertEquals(2, hpDefNeed); - - // test prayer - assertEquals(4, prayerNeed); - } - - @Test - public void testPrayerLevelsNeeded() - { - int attackLevel = 99; - int strengthLevel = 99; - int defenceLevel = 99; - int hitpointsLevel = 99; - int magicLevel = 99; - int rangeLevel = 99; - int prayerLevel = 89; - - int combatLevel = Experience.getCombatLevel(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - - // test combat level - assertEquals(124, combatLevel); - - // test prayer - assertEquals(1, prayerNeed); - } - - @Test - public void testEvenPrayerLevelsNeededWhenNearNextCombatLevel() - { - int attackLevel = 74; - int strengthLevel = 75; - int defenceLevel = 72; - int hitpointsLevel = 72; - int magicLevel = 60; - int rangeLevel = 44; - int prayerLevel = 52; - - int combatLevel = Experience.getCombatLevel(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - - // test combat level - assertEquals(90, combatLevel); - - // test prayer - assertEquals(2, prayerNeed); - } - - @Test - public void testOddPrayerLevelsNeededWhenNearNextCombatLevel() - { - int attackLevel = 74; - int strengthLevel = 75; - int defenceLevel = 72; - int hitpointsLevel = 72; - int magicLevel = 60; - int rangeLevel = 44; - int prayerLevel = 53; - - int combatLevel = Experience.getCombatLevel(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - - // test combat level - assertEquals(90, combatLevel); - - // test prayer - assertEquals(1, prayerNeed); - } - - @Test - public void testNextMagicLevelBarelyReachesNextCombatLevel() - { - int attackLevel = 40; - int strengthLevel = 44; - int defenceLevel = 46; - int hitpointsLevel = 39; - int magicLevel = 57; - int rangeLevel = 40; - int prayerLevel = 29; - - int combatLevel = Experience.getCombatLevel(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int meleeNeed = Experience.getNextCombatLevelMelee(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int hpDefNeed = Experience.getNextCombatLevelHpDef(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int rangeNeed = Experience.getNextCombatLevelRange(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int magicNeed = Experience.getNextCombatLevelMagic(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - - // test combat level - assertEquals(52, combatLevel); - - // test attack/strength - assertEquals(3, meleeNeed); - - // test defence/hitpoints - assertEquals(3, hpDefNeed); - - // test ranged - assertEquals(18, rangeNeed); - - // test magic - assertEquals(1, magicNeed); - - // test prayer - assertEquals(5, prayerNeed); - } - - @Test - public void testRangeMagicLevelsNeeded() - { - int attackLevel = 60; - int strengthLevel = 69; - int defenceLevel = 1; - int hitpointsLevel = 78; - int magicLevel = 85; - int rangeLevel = 85; - int prayerLevel = 52; - - int combatLevel = Experience.getCombatLevel(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int meleeNeed = Experience.getNextCombatLevelMelee(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int hpDefNeed = Experience.getNextCombatLevelHpDef(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int rangeNeed = Experience.getNextCombatLevelRange(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int magicNeed = Experience.getNextCombatLevelMagic(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel, - magicLevel, rangeLevel, prayerLevel); - - // test combat level - assertEquals(68, combatLevel); - - // test attack/strength - assertEquals(3, meleeNeed); - - // test defence/hitpoints - assertEquals(4, hpDefNeed); - - // test ranged - assertEquals(3, rangeNeed); - - // test magic - assertEquals(3, magicNeed); - - // test prayer - assertEquals(8, prayerNeed); - } -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/cooking/CookingPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/cooking/CookingPluginTest.java deleted file mode 100644 index 6e24cdfe11..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/cooking/CookingPluginTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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.cooking; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import javax.inject.Inject; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.GraphicID; -import net.runelite.api.Player; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.SpotAnimationChanged; -import net.runelite.client.config.OpenOSRSConfig; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import static org.mockito.ArgumentMatchers.any; -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.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class CookingPluginTest -{ - private static final String[] COOKING_MESSAGES = { - "You successfully cook a shark.", - "You successfully cook an anglerfish.", - "You manage to cook a tuna.", - "You cook the karambwan. It looks delicious.", - "You roast a lobster.", - "You cook a bass.", - "You successfully bake a tasty garden pie." - }; - - @Inject - CookingPlugin cookingPlugin; - - @Mock - @Bind - Client client; - - @Mock - @Bind - InfoBoxManager infoBoxManager; - - @Mock - @Bind - ItemManager itemManager; - - @Mock - @Bind - CookingConfig config; - - @Mock - @Bind - CookingOverlay cookingOverlay; - - @Mock - @Bind - OverlayManager overlayManager; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - @Test - public void testOnChatMessage() - { - for (String message : COOKING_MESSAGES) - { - ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", message, "", 0); - cookingPlugin.onChatMessage(chatMessage); - } - - CookingSession cookingSession = cookingPlugin.getSession(); - assertNotNull(cookingSession); - assertEquals(COOKING_MESSAGES.length, cookingSession.getCookAmount()); - } - - @Test - public void testOnSpotAnimationChanged() - { - Player player = mock(Player.class); - when(player.getSpotAnimation()).thenReturn(GraphicID.WINE_MAKE); - - cookingPlugin.setFermentTimer(true); - - when(client.getLocalPlayer()).thenReturn(player); - - SpotAnimationChanged graphicChanged = new SpotAnimationChanged(); - graphicChanged.setActor(player); - cookingPlugin.onSpotAnimationChanged(graphicChanged); - - verify(infoBoxManager).addInfoBox(any(FermentTimer.class)); - } -} \ No newline at end of file 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 deleted file mode 100644 index d6019ce8f9..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/emojis/EmojiPluginTest.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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 net.runelite.client.config.OpenOSRSConfig; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -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.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class EmojiPluginTest -{ - @Mock - @Bind - private Client client; - - @Mock - @Bind - private ChatMessageManager chatMessageManager; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @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(""); - } - - @Test - public void testEmojiUpdateMessage() - { - String PARTY_POPPER = "'; - String OPEN_MOUTH = "'; - assertNull(emojiPlugin.updateMessage("@@@@@")); - assertEquals(PARTY_POPPER, emojiPlugin.updateMessage("@@@")); - assertEquals(PARTY_POPPER + ' ' + PARTY_POPPER, emojiPlugin.updateMessage("@@@ @@@")); - assertEquals(PARTY_POPPER + ' ' + OPEN_MOUTH, emojiPlugin.updateMessage("@@@\u00A0:O")); - assertEquals(PARTY_POPPER + ' ' + OPEN_MOUTH + ' ' + PARTY_POPPER, emojiPlugin.updateMessage("@@@\u00A0:O @@@")); - assertEquals(PARTY_POPPER + " Hello World " + PARTY_POPPER, emojiPlugin.updateMessage("@@@\u00A0Hello World\u00A0@@@")); - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/examine/ExaminePluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/examine/ExaminePluginTest.java deleted file mode 100644 index 0c11589e71..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/examine/ExaminePluginTest.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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.examine; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import java.util.concurrent.ScheduledExecutorService; -import javax.inject.Inject; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.ItemID; -import net.runelite.api.MenuOpcode; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.MenuOptionClicked; -import net.runelite.api.widgets.Widget; -import net.runelite.client.chat.ChatMessageManager; -import net.runelite.client.config.OpenOSRSConfig; -import net.runelite.client.game.ItemManager; -import net.runelite.http.api.examine.ExamineClient; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyString; -import org.mockito.Mock; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class ExaminePluginTest -{ - @Inject - ExaminePlugin examinePlugin; - - @Mock - @Bind - ExamineClient examineClient; - - @Mock - @Bind - Client client; - - @Mock - @Bind - ChatMessageManager chatMessageManager; - - @Mock - @Bind - ItemManager itemManager; - - @Mock - @Bind - ScheduledExecutorService scheduledExecutorService; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - @Test - public void testItem() - { - when(client.getWidget(anyInt(), anyInt())).thenReturn(mock(Widget.class)); - - MenuOptionClicked menuOptionClicked = new MenuOptionClicked( - "Examine", - "Something", - ItemID.ABYSSAL_WHIP, - MenuOpcode.EXAMINE_ITEM.getId(), - 123, - 456, - false - ); - examinePlugin.onMenuOptionClicked(menuOptionClicked); - - ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.ITEM_EXAMINE, "", "A weapon from the abyss.", "", 0); - examinePlugin.onChatMessage(chatMessage); - - // This passes due to not mocking the ItemDefinition for the whip - verify(examineClient).submitItem(anyInt(), anyString()); - } - - @Test - public void testLargeStacks() - { - when(client.getWidget(anyInt(), anyInt())).thenReturn(mock(Widget.class)); - - MenuOptionClicked menuOptionClicked = new MenuOptionClicked( - "Examine", - "Something", - ItemID.ABYSSAL_WHIP, - MenuOpcode.EXAMINE_ITEM.getId(), - 123, - 456, - false - ); - - examinePlugin.onMenuOptionClicked(menuOptionClicked); - - ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.ITEM_EXAMINE, "", "100000 x Abyssal whip", "", 0); - examinePlugin.onChatMessage(chatMessage); - - verify(examineClient, never()).submitItem(anyInt(), anyString()); - } -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/gpu/ShaderTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/gpu/ShaderTest.java deleted file mode 100644 index bc42b37239..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/gpu/ShaderTest.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (c) 2018, 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.gpu; - -import com.jogamp.nativewindow.AbstractGraphicsConfiguration; -import com.jogamp.nativewindow.NativeWindowFactory; -import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration; -import com.jogamp.nativewindow.awt.JAWTWindow; -import com.jogamp.opengl.GL4; -import com.jogamp.opengl.GLCapabilities; -import com.jogamp.opengl.GLContext; -import com.jogamp.opengl.GLDrawable; -import com.jogamp.opengl.GLDrawableFactory; -import com.jogamp.opengl.GLProfile; -import java.awt.Canvas; -import java.util.function.Function; -import javax.swing.JFrame; -import static net.runelite.client.plugins.gpu.GLUtil.inputStreamToString; -import net.runelite.client.plugins.gpu.template.Template; -import static org.junit.Assert.fail; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; - -public class ShaderTest -{ - private static final String VERTEX_SHADER = "" + - "void main() {" + - " gl_Position = vec4(1.0, 1.0, 1.0, 1.0);" + - "}"; - private GL4 gl; - - @Before - public void before() - { - Canvas canvas = new Canvas(); - JFrame frame = new JFrame(); - frame.setSize(100, 100); - frame.add(canvas); - frame.setVisible(true); - - GLProfile glProfile = GLProfile.getMaxFixedFunc(true); - - GLCapabilities glCaps = new GLCapabilities(glProfile); - AbstractGraphicsConfiguration config = AWTGraphicsConfiguration.create(canvas.getGraphicsConfiguration(), - glCaps, glCaps); - - JAWTWindow jawtWindow = (JAWTWindow) NativeWindowFactory.getNativeWindow(canvas, config); - - GLDrawableFactory glDrawableFactory = GLDrawableFactory.getFactory(glProfile); - - GLDrawable glDrawable = glDrawableFactory.createGLDrawable(jawtWindow); - glDrawable.setRealized(true); - - - GLContext glContext = glDrawable.createContext(null); - int res = glContext.makeCurrent(); - if (res == GLContext.CONTEXT_NOT_CURRENT) - { - fail("error making context current"); - } - - gl = glContext.getGL().getGL4(); - } - - @Test - @Ignore - public void testUnordered() throws ShaderException - { - int glComputeProgram = gl.glCreateProgram(); - int glComputeShader = gl.glCreateShader(gl.GL_COMPUTE_SHADER); - try - { - Function func = (s) -> inputStreamToString(getClass().getResourceAsStream(s)); - Template template = new Template(func); - String source = template.process(func.apply("comp_unordered.glsl")); - - int line = 0; - for (String str : source.split("\\n")) - { - System.out.println(++line + " " + str); - } - - GLUtil.loadComputeShader(gl, glComputeProgram, glComputeShader, source); - } - finally - { - gl.glDeleteShader(glComputeShader); - gl.glDeleteProgram(glComputeProgram); - } - } - - @Test - @Ignore - public void testSmall() throws ShaderException - { - int glComputeProgram = gl.glCreateProgram(); - int glComputeShader = gl.glCreateShader(gl.GL_COMPUTE_SHADER); - try - { - Function func = (s) -> inputStreamToString(getClass().getResourceAsStream(s)); - Template template = new Template(func); - String source = template.process(func.apply("comp_small.glsl")); - - int line = 0; - for (String str : source.split("\\n")) - { - System.out.println(++line + " " + str); - } - - GLUtil.loadComputeShader(gl, glComputeProgram, glComputeShader, source); - } - finally - { - gl.glDeleteShader(glComputeShader); - gl.glDeleteProgram(glComputeProgram); - } - } - - @Test - @Ignore - public void testComp() throws ShaderException - { - int glComputeProgram = gl.glCreateProgram(); - int glComputeShader = gl.glCreateShader(gl.GL_COMPUTE_SHADER); - try - { - Function func = (s) -> inputStreamToString(getClass().getResourceAsStream(s)); - Template template = new Template(func); - String source = template.process(func.apply("comp.glsl")); - - int line = 0; - for (String str : source.split("\\n")) - { - System.out.println(++line + " " + str); - } - - GLUtil.loadComputeShader(gl, glComputeProgram, glComputeShader, source); - } - finally - { - gl.glDeleteShader(glComputeShader); - gl.glDeleteProgram(glComputeProgram); - } - } - - @Test - @Ignore - public void testGeom() throws ShaderException - { - int glComputeProgram = gl.glCreateProgram(); - int glVertexShader = gl.glCreateShader(gl.GL_VERTEX_SHADER); - int glGeometryShader = gl.glCreateShader(gl.GL_GEOMETRY_SHADER); - int glFragmentShader = gl.glCreateShader(gl.GL_FRAGMENT_SHADER); - try - { - Function func = (s) -> inputStreamToString(getClass().getResourceAsStream(s)); - Template template = new Template(func); - String source = template.process(func.apply("geom.glsl")); - - int line = 0; - for (String str : source.split("\\n")) - { - System.out.println(++line + " " + str); - } - - GLUtil.loadShaders(gl, glComputeProgram, glVertexShader, glGeometryShader, glFragmentShader, VERTEX_SHADER, source, ""); - } - finally - { - gl.glDeleteShader(glVertexShader); - gl.glDeleteShader(glGeometryShader); - gl.glDeleteShader(glFragmentShader); - gl.glDeleteProgram(glComputeProgram); - } - } -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/gpu/template/TemplateTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/gpu/template/TemplateTest.java deleted file mode 100644 index 4279252ea9..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/gpu/template/TemplateTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2018, 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.gpu.template; - -import java.util.function.Function; -import static org.junit.Assert.assertEquals; -import org.junit.Test; - -public class TemplateTest -{ - private static final String FILE1 = "" + - "test1\n" + - "#include file2\n" + - "test3\n"; - - private static final String FILE2 = "" + - "test4\n" + - "test5\n"; - - private static final String RESULT = "" + - "test1\n" + - "test4\n" + - "test5\n" + - "test3\n"; - - @Test - public void testProcess() - { - Function func = (String resource) -> - { - if ("file2".equals(resource)) - { - return FILE2; - } - throw new RuntimeException("unknown resource"); - }; - String out = new Template(func).process(FILE1); - assertEquals(RESULT, out); - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/grandexchange/GrandExchangeOfferSlotTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/grandexchange/GrandExchangeOfferSlotTest.java deleted file mode 100644 index 4ffd59f830..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/grandexchange/GrandExchangeOfferSlotTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2018, SomeoneWithAnInternetConnection - * 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.grandexchange; - -import net.runelite.api.GrandExchangeOffer; -import net.runelite.api.GrandExchangeOfferState; -import net.runelite.api.ItemDefinition; -import net.runelite.client.util.AsyncBufferedImage; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class GrandExchangeOfferSlotTest -{ - @Mock - private GrandExchangeOffer offer; - - @Test - public void testUpdateOffer() - { - when(offer.getState()).thenReturn(GrandExchangeOfferState.CANCELLED_BUY); - - GrandExchangeOfferSlot offerSlot = new GrandExchangeOfferSlot(); - offerSlot.updateOffer(mock(ItemDefinition.class), mock(AsyncBufferedImage.class), offer); - } - -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/grounditems/WildcardMatchLoaderTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/grounditems/WildcardMatchLoaderTest.java deleted file mode 100644 index b65dc30076..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/grounditems/WildcardMatchLoaderTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2018, 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.grounditems; - -import java.util.Arrays; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import org.junit.Test; - -public class WildcardMatchLoaderTest -{ - @Test - public void testLoad() - { - WildcardMatchLoader loader = new WildcardMatchLoader(Arrays.asList("rune*", "Abyssal whip")); - assertTrue(loader.load("rune pouch")); - assertTrue(loader.load("Rune pouch")); - assertFalse(loader.load("Adamant dagger")); - assertTrue(loader.load("Runeite Ore")); - assertTrue(loader.load("Abyssal whip")); - assertFalse(loader.load("Abyssal dagger")); - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/hiscore/HiscorePanelTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/hiscore/HiscorePanelTest.java deleted file mode 100644 index 6c954d062b..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/hiscore/HiscorePanelTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2017, 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.hiscore; - -import org.junit.Test; - -public class HiscorePanelTest -{ - @Test - public void testConstructor() - { - new HiscorePanel(new HiscorePlugin() {}); - } -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPluginTest.java deleted file mode 100644 index dff30ddf14..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPluginTest.java +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.idlenotifier; - -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 java.util.EnumSet; -import net.runelite.api.Actor; -import net.runelite.api.AnimationID; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.Hitsplat; -import net.runelite.api.NPC; -import net.runelite.api.NPCDefinition; -import net.runelite.api.Player; -import net.runelite.api.VarPlayer; -import net.runelite.api.WorldType; -import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.AnimationChanged; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.HitsplatApplied; -import net.runelite.api.events.InteractingChanged; -import net.runelite.client.Notifier; -import net.runelite.client.config.OpenOSRSConfig; -import net.runelite.client.game.SoundManager; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import org.mockito.Mock; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class IdleNotifierPluginTest -{ - private static final String PLAYER_NAME = "Deathbeam"; - - @Mock - @Bind - private Client client; - - @Mock - @Bind - private IdleNotifierConfig config; - - @Mock - @Bind - private SoundManager soundManager; - - @Mock - @Bind - private Notifier notifier; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Inject - private IdleNotifierPlugin plugin; - - @Mock - private NPC monster; - - @Mock - private NPC randomEvent; - - @Mock - private Player player; - - @Before - public void setUp() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - - // Mock monster - final String[] monsterActions = new String[]{"Attack", "Examine"}; - final NPCDefinition monsterComp = mock(NPCDefinition.class); - when(monsterComp.getActions()).thenReturn(monsterActions); - when(monster.getDefinition()).thenReturn(monsterComp); - - // Mock random event - final String[] randomEventActions = new String[]{"Talk-to", "Dismiss", "Examine"}; - final NPCDefinition randomEventComp = mock(NPCDefinition.class); - when(randomEventComp.getActions()).thenReturn(randomEventActions); - when(randomEvent.getDefinition()).thenReturn(randomEventComp); - - // Mock player - when(player.getName()).thenReturn(PLAYER_NAME); - when(player.getAnimation()).thenReturn(AnimationID.IDLE); - when(client.getLocalPlayer()).thenReturn(player); - - // Mock config - plugin.setLogoutIdle(true); - plugin.setAnimationIdle(true); - plugin.setInteractionIdle(true); - plugin.setGetIdleNotificationDelay(0); - plugin.setGetHitpointsThreshold(42); - plugin.setGetPrayerThreshold(42); - - // Mock client - when(client.getGameState()).thenReturn(GameState.LOGGED_IN); - when(client.getKeyboardIdleTicks()).thenReturn(42); - when(client.getMouseLastPressedMillis()).thenReturn(System.currentTimeMillis() - 100_000L); - when(client.getWorldType()).thenReturn(EnumSet.of(WorldType.DEADMAN)); - } - - @Test - public void checkAnimationIdle() - { - when(player.getAnimation()).thenReturn(AnimationID.WOODCUTTING_BRONZE); - AnimationChanged animationChanged = new AnimationChanged(); - animationChanged.setActor(player); - plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(GameTick.INSTANCE); - when(player.getAnimation()).thenReturn(AnimationID.IDLE); - plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(GameTick.INSTANCE); - verify(notifier).notify("[" + PLAYER_NAME + "] is now idle!"); - } - - @Test - public void checkAnimationReset() - { - when(player.getAnimation()).thenReturn(AnimationID.WOODCUTTING_BRONZE); - AnimationChanged animationChanged = new AnimationChanged(); - animationChanged.setActor(player); - plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(GameTick.INSTANCE); - when(player.getAnimation()).thenReturn(AnimationID.LOOKING_INTO); - plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(GameTick.INSTANCE); - when(player.getAnimation()).thenReturn(AnimationID.IDLE); - plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(GameTick.INSTANCE); - verify(notifier, times(0)).notify(any()); - } - - @Test - public void checkAnimationLogout() - { - when(player.getAnimation()).thenReturn(AnimationID.WOODCUTTING_BRONZE); - AnimationChanged animationChanged = new AnimationChanged(); - animationChanged.setActor(player); - plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(GameTick.INSTANCE); - - // Logout - when(client.getGameState()).thenReturn(GameState.LOGIN_SCREEN); - GameStateChanged gameStateChanged = new GameStateChanged(); - gameStateChanged.setGameState(GameState.LOGIN_SCREEN); - plugin.onGameStateChanged(gameStateChanged); - - // Log back in - when(client.getGameState()).thenReturn(GameState.LOGGED_IN); - gameStateChanged.setGameState(GameState.LOGGED_IN); - plugin.onGameStateChanged(gameStateChanged); - - // Tick - when(player.getAnimation()).thenReturn(AnimationID.IDLE); - plugin.onAnimationChanged(animationChanged); - plugin.onGameTick(GameTick.INSTANCE); - verify(notifier, times(0)).notify(any()); - } - - @Test - public void checkCombatIdle() - { - when(player.getInteracting()).thenReturn(monster); - plugin.onInteractingChanged(new InteractingChanged(player, monster)); - plugin.onGameTick(GameTick.INSTANCE); - when(player.getInteracting()).thenReturn(null); - plugin.onInteractingChanged(new InteractingChanged(player, null)); - plugin.onGameTick(GameTick.INSTANCE); - verify(notifier).notify("[" + PLAYER_NAME + "] is now out of combat!"); - } - - @Test - public void checkCombatReset() - { - when(player.getInteracting()).thenReturn(mock(Actor.class)); - plugin.onInteractingChanged(new InteractingChanged(player, monster)); - plugin.onGameTick(GameTick.INSTANCE); - plugin.onInteractingChanged(new InteractingChanged(player, randomEvent)); - plugin.onGameTick(GameTick.INSTANCE); - plugin.onInteractingChanged(new InteractingChanged(player, null)); - plugin.onGameTick(GameTick.INSTANCE); - verify(notifier, times(0)).notify(any()); - } - - @Test - public void checkCombatLogout() - { - plugin.onInteractingChanged(new InteractingChanged(player, monster)); - when(player.getInteracting()).thenReturn(mock(Actor.class)); - plugin.onGameTick(GameTick.INSTANCE); - - // Logout - when(client.getGameState()).thenReturn(GameState.LOGIN_SCREEN); - GameStateChanged gameStateChanged = new GameStateChanged(); - gameStateChanged.setGameState(GameState.LOGIN_SCREEN); - plugin.onGameStateChanged(gameStateChanged); - - // Log back in - when(client.getGameState()).thenReturn(GameState.LOGGED_IN); - gameStateChanged.setGameState(GameState.LOGGED_IN); - plugin.onGameStateChanged(gameStateChanged); - - // Tick - plugin.onInteractingChanged(new InteractingChanged(player, null)); - plugin.onGameTick(GameTick.INSTANCE); - verify(notifier, times(0)).notify(any()); - } - - @Test - public void checkCombatLogoutIdle() - { - // Player is idle - when(client.getMouseIdleTicks()).thenReturn(80_000); - - // But player is being damaged (is in combat) - final HitsplatApplied hitsplatApplied = new HitsplatApplied(); - hitsplatApplied.setActor(player); - hitsplatApplied.setHitsplat(new Hitsplat(Hitsplat.HitsplatType.DAMAGE, 0, 0)); - plugin.onHitsplatApplied(hitsplatApplied); - plugin.onGameTick(GameTick.INSTANCE); - verify(notifier, times(0)).notify(any()); - } - - @Test - public void doubleNotifyOnMouseReset() - { - // Player is idle, but in combat so the idle packet is getting set repeatedly - // make sure we are not notifying - - when(client.getKeyboardIdleTicks()).thenReturn(80_000); - when(client.getMouseIdleTicks()).thenReturn(14_500); - - plugin.onGameTick(GameTick.INSTANCE); - plugin.onGameTick(GameTick.INSTANCE); - verify(notifier, times(1)).notify(any()); - } - - @Test - public void testSpecRegen() - { - plugin.setGetSpecEnergyThreshold(50); - - when(client.getVar(eq(VarPlayer.SPECIAL_ATTACK_PERCENT))).thenReturn(400); // 40% - plugin.onGameTick(GameTick.INSTANCE); // once to set lastSpecEnergy to 400 - verify(notifier, never()).notify(any()); - - when(client.getVar(eq(VarPlayer.SPECIAL_ATTACK_PERCENT))).thenReturn(500); // 50% - plugin.onGameTick(GameTick.INSTANCE); - verify(notifier).notify(eq("[" + PLAYER_NAME + "] has restored spec energy!")); - } - - @Test - public void testMovementIdle() - { - plugin.setMovementIdle(true); - - when(player.getWorldLocation()).thenReturn(new WorldPoint(0, 0, 0)); - plugin.onGameTick(GameTick.INSTANCE); - when(player.getWorldLocation()).thenReturn(new WorldPoint(1, 0, 0)); - plugin.onGameTick(GameTick.INSTANCE); - // No movement here - plugin.onGameTick(GameTick.INSTANCE); - - verify(notifier).notify(eq("[" + PLAYER_NAME + "] has stopped moving!")); - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java deleted file mode 100644 index c93c56d850..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2018, 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.itemcharges; - -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 java.util.concurrent.ScheduledExecutorService; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.EquipmentInventorySlot; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemID; -import net.runelite.api.events.ChatMessage; -import net.runelite.client.Notifier; -import net.runelite.client.config.OpenOSRSConfig; -import net.runelite.client.config.RuneLiteConfig; -import net.runelite.client.ui.overlay.OverlayManager; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import static org.mockito.ArgumentMatchers.eq; -import org.mockito.Mock; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class ItemChargePluginTest -{ - private static final String CHECK = "Your dodgy necklace has 10 charges left."; - private static final String PROTECT = "Your dodgy necklace protects you. It has 9 charges left."; - private static final String PROTECT_1 = "Your dodgy necklace protects you. It has 1 charge left."; - private static final String BREAK = "Your dodgy necklace protects you. It then crumbles to dust."; - - private static final String CHECK_RING_OF_FORGING_FULL = "You can smelt 140 more pieces of iron ore before a ring melts."; - private static final String CHECK_RING_OF_FORGING_ONE = "You can smelt one more piece of iron ore before a ring melts."; - private static final String USED_RING_OF_FORGING = "You retrieve a bar of iron."; - private static final String BREAK_RING_OF_FORGING = "Your Ring of Forging has melted."; - - @Mock - @Bind - private Client client; - - @Mock - @Bind - private ScheduledExecutorService scheduledExecutorService; - - @Mock - @Bind - private RuneLiteConfig runeLiteConfig; - - @Mock - @Bind - private OverlayManager overlayManager; - - @Mock - @Bind - private Notifier notifier; - - @Mock - @Bind - private ItemChargeConfig config; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Inject - private ItemChargePlugin itemChargePlugin; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - @Test - public void testOnChatMessage() - { - ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHECK, "", 0); - itemChargePlugin.onChatMessage(chatMessage); - verify(config).dodgyNecklace(eq(10)); - reset(config); - - chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", PROTECT, "", 0); - itemChargePlugin.onChatMessage(chatMessage); - verify(config).dodgyNecklace(eq(9)); - reset(config); - - chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", PROTECT_1, "", 0); - itemChargePlugin.onChatMessage(chatMessage); - verify(config).dodgyNecklace(eq(1)); - reset(config); - - chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BREAK, "", 0); - itemChargePlugin.onChatMessage(chatMessage); - verify(config).dodgyNecklace(eq(10)); - reset(config); - - chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHECK_RING_OF_FORGING_ONE, "", 0); - itemChargePlugin.onChatMessage(chatMessage); - verify(config).ringOfForging(eq(1)); - reset(config); - - chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHECK_RING_OF_FORGING_FULL, "", 0); - itemChargePlugin.onChatMessage(chatMessage); - verify(config).ringOfForging(eq(140)); - reset(config); - - // Create equipment inventory with ring of forging - ItemContainer equipmentItemContainer = mock(ItemContainer.class); - when(client.getItemContainer(eq(InventoryID.EQUIPMENT))).thenReturn(equipmentItemContainer); - Item[] items = new Item[EquipmentInventorySlot.RING.getSlotIdx() + 1]; - when(equipmentItemContainer.getItems()).thenReturn(items); - Item ring = new Item(ItemID.RING_OF_FORGING, 1); - items[EquipmentInventorySlot.RING.getSlotIdx()] = ring; - // Run message - chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", USED_RING_OF_FORGING, "", 0); - itemChargePlugin.onChatMessage(chatMessage); - verify(config).ringOfForging(eq(139)); - reset(config); - - chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BREAK_RING_OF_FORGING, "", 0); - itemChargePlugin.onChatMessage(chatMessage); - verify(config).ringOfForging(eq(140)); - reset(config); - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPluginTest.java deleted file mode 100644 index dc57659955..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPluginTest.java +++ /dev/null @@ -1,690 +0,0 @@ -/* - * 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.inject.Guice; -import com.google.inject.Inject; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import net.runelite.api.Client; -import net.runelite.api.Item; -import net.runelite.api.ItemDefinition; -import net.runelite.api.ItemID; -import net.runelite.client.config.OpenOSRSConfig; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.ItemReclaimCost; -import static net.runelite.client.plugins.itemskeptondeath.ItemsKeptOnDeathPlugin.DeathItems; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -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.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class ItemsKeptOnDeathPluginTest -{ - @Mock - @Bind - private Client client; - - @Mock - @Bind - private ItemManager itemManager; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Inject - private ItemsKeptOnDeathPlugin plugin; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - resetBuffs(); - } - - private void resetBuffs() - { - plugin.isSkulled = false; - plugin.protectingItem = false; - plugin.wildyLevel = -1; - } - - // Mocks an item and the necessary itemManager functions for it - private Item mItem(final int id, final int qty, final String name, final boolean tradeable, final int price) - { - // Mock Item Composition and necessary ItemManager methods for this item - ItemDefinition c = mock(ItemDefinition.class); - when(c.getId()) - .thenReturn(id); - when(c.getName()) - .thenReturn(name); - when(c.isTradeable()) - .thenReturn(tradeable); - when(c.getPrice()) - .thenReturn(price); - - if (!tradeable) - { - when(c.getNote()).thenReturn(-1); - when(c.getLinkedNoteId()).thenReturn(-1); - } - - when(itemManager.getItemDefinition(id)).thenReturn(c); - when(itemManager.canonicalize(id)).thenReturn(id); - when(itemManager.getItemPrice(id, true)).thenReturn(price); - - return item(id, qty); - } - - // Creates a new item - private static Item item(final int id, final int qty) - { - return new Item(id, qty); - } - - @Test - public void deathPriceTestRegularItems() - { - final Item acs = mItem(ItemID.ARMADYL_CHAINSKIRT, 1, "Armadyl chainskirt", true, 27837495); - assertEquals(27837495, plugin.getDeathPrice(acs)); - - final Item karambwan = mItem(ItemID.COOKED_KARAMBWAN, 1, "Cooked karambwan", true, 608); - assertEquals(608, plugin.getDeathPrice(karambwan)); - - final Item defender = mItem(ItemID.RUNE_DEFENDER, 1, "Rune defender", false, 35000); - assertEquals(35000, plugin.getDeathPrice(defender)); - } - - @Test - public void deathPriceTestItemMapping() - { - mItem(ItemID.OCCULT_NECKLACE, 1, "Occult necklace", true, 1000000); - mItem(ItemID.OCCULT_ORNAMENT_KIT, 1, "Occult ornament kit", true, 3000000); - final Item occult = mItem(ItemID.OCCULT_NECKLACE_OR, 1, "Occult necklace (or)", false, 0); - assertEquals(4000000, plugin.getDeathPrice(occult)); - - mItem(ItemID.BLACK_MASK, 1, "Black mask", true, 1000000); - final Item blackMask8 = mItem(ItemID.BLACK_MASK_8, 1, "Black mask (8)", false, 0); - assertEquals(1000000, plugin.getDeathPrice(blackMask8)); - final Item slayerHelm = mItem(ItemID.SLAYER_HELMET, 1, "Slayer helmet", false, 0); - assertEquals(1000000, plugin.getDeathPrice(slayerHelm)); - } - - @Test - public void deathPriceTestFixedPriceItems() - { - mItem(ItemID.KARILS_COIF_0, 1, "Karil's coif 0", true, 35000); - final Item coif = mItem(ItemID.KARILS_COIF_100, 1, "Karil's coif 100", false, 0); - final int coifOffset = FixedPriceItem.KARILS_COIF_100.getOffset(); - assertEquals(35000 + coifOffset, plugin.getDeathPrice(coif)); - - mItem(ItemID.AHRIMS_ROBETOP_0, 1, "Ahrim's robetop 0", true, 2500000); - final Item robetop = mItem(ItemID.AHRIMS_ROBETOP_25, 1, "Ahrim's robetop 100", false, 0); - final int robetopOffset = FixedPriceItem.AHRIMS_ROBETOP_25.getOffset(); - assertEquals(2500000 + robetopOffset, plugin.getDeathPrice(robetop)); - - mItem(ItemID.AMULET_OF_GLORY, 1, "Amulet of glory", true, 13000); - final Item glory = mItem(ItemID.AMULET_OF_GLORY3, 1, "Amulet of glory(3)", true, 0); - final int gloryOffset = FixedPriceItem.AMULET_OF_GLORY3.getOffset(); - assertEquals(13000 + gloryOffset, plugin.getDeathPrice(glory)); - - mItem(ItemID.COMBAT_BRACELET, 1, "Combat bracelet", true, 13500); - final Item brace = mItem(ItemID.COMBAT_BRACELET1, 1, "Combat bracelet(1)", true, 0); - final int braceletOffset = FixedPriceItem.COMBAT_BRACELET1.getOffset(); - assertEquals(13500 + braceletOffset, plugin.getDeathPrice(brace)); - - final Item amulet = mItem(ItemID.SALVE_AMULETEI, 1, "Salve Amulet(ei)", false, 300); - assertEquals(210200, plugin.getDeathPrice(amulet)); - } - - @Test - public void deathPriceTestDynamicPriceItems() - { - final Item rod8 = mItem(ItemID.RING_OF_DUELING8, 1, "Ring of dueling(8)", true, 725); - final Item rod3 = mItem(ItemID.RING_OF_DUELING3, 1, "Ring of dueling(3)", true, 0); - final Item rod1 = mItem(ItemID.RING_OF_DUELING1, 1, "Ring of dueling(1)", true, 0); - // Dynamic price items - final int rodPrice = 725 / 8; - assertEquals(rodPrice, plugin.getDeathPrice(rod1)); - assertEquals(725, plugin.getDeathPrice(rod8)); - assertEquals(rodPrice * 3, plugin.getDeathPrice(rod3)); - - final Item nop5 = mItem(ItemID.NECKLACE_OF_PASSAGE5, 1, "Necklace of passage(5)", true, 1250); - final Item nop4 = mItem(ItemID.NECKLACE_OF_PASSAGE4, 1, "Necklace of passage(4)", true, 0); - final Item nop2 = mItem(ItemID.NECKLACE_OF_PASSAGE2, 1, "Necklace of passage(2)", true, 0); - - final int nopPrice = 1250 / 5; - assertEquals(nopPrice * 2, plugin.getDeathPrice(nop2)); - assertEquals(nopPrice * 4, plugin.getDeathPrice(nop4)); - assertEquals(1250, plugin.getDeathPrice(nop5)); - } - - private Item[] getFourExpensiveItems() - { - return new Item[] - { - mItem(ItemID.TWISTED_BOW, 1, "Twister bow", true, Integer.MAX_VALUE), - mItem(ItemID.SCYTHE_OF_VITUR, 1, "Scythe of vitur", true, Integer.MAX_VALUE), - mItem(ItemID.ELYSIAN_SPIRIT_SHIELD, 1, "Elysian spirit shield", true, 800000000), - mItem(ItemID.ARCANE_SPIRIT_SHIELD, 1, "Arcane spirit shield", true, 250000000) - }; - } - - @Test - public void alwaysLostTestRunePouch() - { - final Item[] inv = getFourExpensiveItems(); - final Item[] equip = new Item[] - { - mItem(ItemID.RUNE_POUCH, 1, "Rune pouch", false, 1) - }; - - final DeathItems deathItems = plugin.calculateKeptLostItems(inv, equip); - assertFalse(deathItems.isHasAlwaysLost()); - } - - @Test - public void alwaysLostTestRunePouchWildy() - { - final Item[] inv = getFourExpensiveItems(); - final Item[] equip = new Item[] - { - mItem(ItemID.RUNE_POUCH, 1, "Rune pouch", false, 1) - }; - - plugin.wildyLevel = 1; - final DeathItems deathItems = plugin.calculateKeptLostItems(inv, equip); - assertTrue(deathItems.isHasAlwaysLost()); - } - - @Test - public void alwaysLostTestLootBag() - { - final Item[] inv = getFourExpensiveItems(); - final Item[] equip = new Item[] - { - mItem(ItemID.LOOTING_BAG, 1, "Looting bag", false, 1) - }; - - final DeathItems deathItems = plugin.calculateKeptLostItems(inv, equip); - assertTrue(deathItems.isHasAlwaysLost()); - - } - - @Test - public void alwaysLostTestLootBagWildy() - { - final Item[] inv = getFourExpensiveItems(); - final Item[] equip = new Item[] - { - mItem(ItemID.LOOTING_BAG, 1, "Looting bag", false, 1) - }; - - plugin.wildyLevel = 1; - final DeathItems deathItems = plugin.calculateKeptLostItems(inv, equip); - assertTrue(deathItems.isHasAlwaysLost()); - } - - private Item[] getClueBoxTestInventory() - { - return new Item[] - { - mItem(ItemID.BLACK_DHIDE_BODY, 1, "Black d'hide body", true, 7552), - mItem(ItemID.ARMADYL_CHAINSKIRT, 1, "Armadyl chainskirt", true, 27837495), - mItem(ItemID.PEGASIAN_BOOTS, 1, "Pegasian boots", true, 30542187), - mItem(ItemID.DRAGON_SCIMITAR, 1, "Dragon scimitar", true, 63123), - - mItem(ItemID.HELM_OF_NEITIZNOT, 1, "Helm of neitiznot", true, 45519), - mItem(ItemID.RUNE_DEFENDER, 1, "Rune defender", false, 35000), - mItem(ItemID.SPADE, 1, "Spade", true, 104), - mItem(ItemID.CLUE_SCROLL_EASY, 1, "Clue scroll (easy)", false, 50), - - mItem(ItemID.CLUE_BOX, 1, "Clue box", false, 50), - mItem(ItemID.COOKED_KARAMBWAN, 1, "Cooked karambwan", true, 608), - mItem(ItemID.COOKED_KARAMBWAN, 1, "Cooked karambwan", true, 608), - mItem(ItemID.COOKED_KARAMBWAN, 1, "Cooked karambwan", true, 608), - - mItem(ItemID.COOKED_KARAMBWAN, 1, "Cooked karambwan", true, 608), - mItem(ItemID.COOKED_KARAMBWAN, 1, "Cooked karambwan", true, 608), - mItem(ItemID.LAW_RUNE, 200, "Law rune", true, 212), - mItem(ItemID.DUST_RUNE, 200, "Dust rune", true, 3), - - mItem(ItemID.CLUE_SCROLL_MASTER, 1, "Clue scroll (master)", false, 50), - mItem(ItemID.CLUELESS_SCROLL, 1, "Clueless scroll", false, 50), - }; - } - - @Test - public void isClueBoxableTest() - { - getClueBoxTestInventory(); - mItem(ItemID.REWARD_CASKET_EASY, 1, "Reward casket (easy)", false, 50); - - assertTrue(plugin.isClueBoxable(ItemID.CLUE_SCROLL_EASY)); - assertTrue(plugin.isClueBoxable(ItemID.CLUE_SCROLL_MASTER)); - assertTrue(plugin.isClueBoxable(ItemID.REWARD_CASKET_EASY)); - - assertFalse(plugin.isClueBoxable(ItemID.CLUELESS_SCROLL)); - assertFalse(plugin.isClueBoxable(ItemID.LAW_RUNE)); - assertFalse(plugin.isClueBoxable(ItemID.SPADE)); - } - - @Test - public void clueBoxTestDefault() - { - final Item[] inv = getClueBoxTestInventory(); - final Item[] equip = new Item[0]; - - final DeathItems deathItems = plugin.calculateKeptLostItems(inv, equip); - - final List kept = deathItems.getKeptItems(); - final List expectedKept = Arrays.asList( - new ItemStack(ItemID.PEGASIAN_BOOTS, 1), - new ItemStack(ItemID.ARMADYL_CHAINSKIRT, 1), - new ItemStack(ItemID.DRAGON_SCIMITAR, 1), - new ItemStack(ItemID.RUNE_DEFENDER, 1), - new ItemStack(ItemID.CLUE_SCROLL_EASY, 1), - new ItemStack(ItemID.CLUE_SCROLL_MASTER, 1), - new ItemStack(ItemID.CLUELESS_SCROLL, 1) - ); - assertEquals(expectedKept, kept); - - final List lost = deathItems.getLostItems(); - assertEquals((inv.length + equip.length) - expectedKept.size(), lost.size()); - } - - @Test - public void clueBoxTestDeepWildy() - { - final Item[] inv = getClueBoxTestInventory(); - final Item[] equip = new Item[0]; - - plugin.wildyLevel = 21; - - final DeathItems deathItems = plugin.calculateKeptLostItems(inv, equip); - - final List kept = deathItems.getKeptItems(); - final List expectedKept = Arrays.asList( - new ItemStack(ItemID.PEGASIAN_BOOTS, 1), - new ItemStack(ItemID.ARMADYL_CHAINSKIRT, 1), - new ItemStack(ItemID.DRAGON_SCIMITAR, 1), - new ItemStack(ItemID.CLUE_SCROLL_MASTER, 1) - ); - assertEquals(expectedKept, kept); - - final List lost = deathItems.getLostItems(); - final int keptOffset = expectedKept.size(); - assertEquals((inv.length + equip.length) - keptOffset, lost.size()); - } - - @Test - public void clueBoxTestDeepWildyProtectItem() - { - final Item[] inv = getClueBoxTestInventory(); - final Item[] equip = new Item[0]; - - plugin.wildyLevel = 21; - plugin.protectingItem = true; - - final DeathItems deathItems = plugin.calculateKeptLostItems(inv, equip); - - final List kept = deathItems.getKeptItems(); - final List expectedKept = Arrays.asList( - new ItemStack(ItemID.PEGASIAN_BOOTS, 1), - new ItemStack(ItemID.ARMADYL_CHAINSKIRT, 1), - new ItemStack(ItemID.DRAGON_SCIMITAR, 1), - new ItemStack(ItemID.HELM_OF_NEITIZNOT, 1), - new ItemStack(ItemID.CLUE_SCROLL_MASTER, 1) // Clue box - ); - assertEquals(expectedKept, kept); - - final List lost = deathItems.getLostItems(); - final int keptOffset = expectedKept.size(); - assertEquals((inv.length + equip.length) - keptOffset, lost.size()); - } - - @Test - public void clueBoxTestDeepWildySkulled() - { - final Item[] inv = getClueBoxTestInventory(); - final Item[] equip = new Item[0]; - - plugin.wildyLevel = 21; - plugin.isSkulled = true; - - final DeathItems deathItems = plugin.calculateKeptLostItems(inv, equip); - - final List kept = deathItems.getKeptItems(); - final List expectedKept = Collections.singletonList( - new ItemStack(ItemID.CLUE_SCROLL_MASTER, 1) - ); - assertEquals(expectedKept, kept); - - final List lost = deathItems.getLostItems(); - final int keptOffset = expectedKept.size(); - assertEquals(lost.size(), (inv.length + equip.length) - keptOffset); - } - - @Test - public void clueBoxTestLowWildy() - { - final Item[] inv = getClueBoxTestInventory(); - final Item[] equip = new Item[0]; - - plugin.wildyLevel = 1; - - final DeathItems deathItems = plugin.calculateKeptLostItems(inv, equip); - - final List kept = deathItems.getKeptItems(); - final List expectedKept = Arrays.asList( - new ItemStack(ItemID.PEGASIAN_BOOTS, 1), - new ItemStack(ItemID.ARMADYL_CHAINSKIRT, 1), - new ItemStack(ItemID.DRAGON_SCIMITAR, 1), - new ItemStack(ItemID.RUNE_DEFENDER, 1), // Rune defender protected because of broken variant - new ItemStack(ItemID.CLUE_SCROLL_MASTER, 1) - ); - assertEquals(expectedKept, kept); - - final List lost = deathItems.getLostItems(); - final int keptOffset = expectedKept.size(); - assertEquals(lost.size(), (inv.length + equip.length) - keptOffset); - } - - @Test - public void clueBoxTestLowWildyProtectItem() - { - final Item[] inv = getClueBoxTestInventory(); - final Item[] equip = new Item[0]; - - plugin.wildyLevel = 1; - plugin.protectingItem = true; - - final DeathItems deathItems = plugin.calculateKeptLostItems(inv, equip); - - final List kept = deathItems.getKeptItems(); - final List expectedKept = Arrays.asList( - new ItemStack(ItemID.PEGASIAN_BOOTS, 1), - new ItemStack(ItemID.ARMADYL_CHAINSKIRT, 1), - new ItemStack(ItemID.DRAGON_SCIMITAR, 1), - new ItemStack(ItemID.HELM_OF_NEITIZNOT, 1), - new ItemStack(ItemID.RUNE_DEFENDER, 1), // Rune defender protected because of broken variant - new ItemStack(ItemID.CLUE_SCROLL_MASTER, 1) - ); - assertEquals(expectedKept, kept); - - final List lost = deathItems.getLostItems(); - final int keptOffset = expectedKept.size(); - assertEquals((inv.length + equip.length) - keptOffset, lost.size()); - } - - @Test - public void clueBoxTestLowWildySkulled() - { - final Item[] inv = getClueBoxTestInventory(); - final Item[] equip = new Item[0]; - - plugin.wildyLevel = 1; - plugin.isSkulled = true; - - final DeathItems deathItems = plugin.calculateKeptLostItems(inv, equip); - - final List kept = deathItems.getKeptItems(); - final List expectedKept = Arrays.asList( - new ItemStack(ItemID.RUNE_DEFENDER, 1), // Rune defender protected because of broken variant - new ItemStack(ItemID.CLUE_SCROLL_MASTER, 1) - ); - assertEquals(expectedKept, kept); - - final List lost = deathItems.getLostItems(); - final int keptOffset = expectedKept.size(); - assertEquals((inv.length + equip.length) - keptOffset, lost.size()); - } - - private Item[] getClueBoxCasketTestInventory() - { - // Reward caskets can stack but the clue box should only protect one - return new Item[] - { - mItem(ItemID.BLACK_DHIDE_BODY, 1, "Black d'hide body", true, 7552), - mItem(ItemID.ARMADYL_CHAINSKIRT, 1, "Armadyl chainskirt", true, 27837495), - mItem(ItemID.PEGASIAN_BOOTS, 1, "Pegasian boots", true, 30542187), - mItem(ItemID.DRAGON_SCIMITAR, 1, "Dragon scimitar", true, 63123), - - mItem(ItemID.SPADE, 1, "Spade", true, 104), - mItem(ItemID.CLUE_SCROLL_EASY, 1, "Clue scroll (easy)", false, 50), - mItem(ItemID.REWARD_CASKET_EASY, 20, "Reward casket (easy)", false, 50), - mItem(ItemID.CLUE_BOX, 1, "Clue box", false, 50), - - mItem(ItemID.COOKED_KARAMBWAN, 1, "Cooked karambwan", true, 608), - mItem(ItemID.COOKED_KARAMBWAN, 1, "Cooked karambwan", true, 608), - mItem(ItemID.COOKED_KARAMBWAN, 1, "Cooked karambwan", true, 608), - mItem(ItemID.COOKED_KARAMBWAN, 1, "Cooked karambwan", true, 608), - - mItem(ItemID.LAW_RUNE, 200, "Law rune", true, 212), - mItem(ItemID.DUST_RUNE, 200, "Dust rune", true, 3), - }; - } - - @Test - public void clueBoxTestCasketProtect() - { - final Item[] inv = getClueBoxCasketTestInventory(); - final Item[] equip = new Item[0]; - - plugin.wildyLevel = 1; - - final DeathItems deathItems = plugin.calculateKeptLostItems(inv, equip); - - final List kept = deathItems.getKeptItems(); - final List expectedKept = Arrays.asList( - new ItemStack(ItemID.PEGASIAN_BOOTS, 1), - new ItemStack(ItemID.ARMADYL_CHAINSKIRT, 1), - new ItemStack(ItemID.DRAGON_SCIMITAR, 1), - new ItemStack(ItemID.REWARD_CASKET_EASY, 1) // Clue box - ); - assertEquals(expectedKept, kept); - - final List lost = deathItems.getLostItems(); - final int keptOffset = expectedKept.size() - 1; // We are still losing some reward caskets. - assertEquals((inv.length + equip.length) - keptOffset, lost.size()); - } - - private Item[] getFullGracefulItems() - { - return new Item[] - { - mItem(ItemID.GRACEFUL_HOOD, 1, "Graceful hood", false, 35), - mItem(ItemID.GRACEFUL_CAPE, 1, "Graceful cape", false, 40), - mItem(ItemID.GRACEFUL_TOP, 1, "Graceful top", false, 55), - mItem(ItemID.GRACEFUL_LEGS, 1, "Graceful legs", false, 60), - mItem(ItemID.GRACEFUL_BOOTS, 1, "Graceful boots", false, 40), - mItem(ItemID.GRACEFUL_GLOVES, 1, "Graceful gloves", false, 30), - }; - } - - @Test - public void gracefulValueTest() - { - final Item[] inv = getFullGracefulItems(); - final Item[] equip = new Item[] - { - mItem(ItemID.AMULET_OF_GLORY6, 1, "Amulet of glory (6)", true, 20000) - }; - - - final DeathItems deathItems = plugin.calculateKeptLostItems(inv, equip); - - final List kept = deathItems.getKeptItems(); - final List expectedKept = Arrays.asList( - new ItemStack(ItemID.AMULET_OF_GLORY6, 1), - new ItemStack(ItemID.GRACEFUL_CAPE, 1), - new ItemStack(ItemID.GRACEFUL_TOP, 1), - new ItemStack(ItemID.GRACEFUL_LEGS, 1), - new ItemStack(ItemID.GRACEFUL_BOOTS, 1), - new ItemStack(ItemID.GRACEFUL_HOOD, 1), - new ItemStack(ItemID.GRACEFUL_GLOVES, 1) - ); - assertEquals(expectedKept, kept); - - final List lost = deathItems.getLostItems(); - assertEquals((inv.length + equip.length) - expectedKept.size(), lost.size()); - } - - @Test - public void gracefulValueTestWildy() - { - final Item[] inv = getFullGracefulItems(); - final Item[] equip = new Item[] - { - mItem(ItemID.AMULET_OF_GLORY6, 1, "Amulet of glory (6)", true, 20000) - }; - - plugin.wildyLevel = 1; - - final DeathItems deathItems = plugin.calculateKeptLostItems(inv, equip); - - final List kept = deathItems.getKeptItems(); - final List expectedKept = Arrays.asList( - new ItemStack(ItemID.AMULET_OF_GLORY6, 1), - new ItemStack(ItemID.GRACEFUL_CAPE, 1), - new ItemStack(ItemID.GRACEFUL_TOP, 1) - ); - assertEquals(expectedKept, kept); - - final List lost = deathItems.getLostItems(); - assertEquals((inv.length + equip.length) - expectedKept.size(), lost.size()); - } - - @Test - public void lostIfNotProtectedTestLost() - { - final Item[] inv = getFourExpensiveItems(); - final Item[] equip = new Item[] - { - mItem(ItemID.SHADOW_SWORD, 1, "Shadow sword", false, 1) - }; - - final DeathItems deathItems = plugin.calculateKeptLostItems(inv, equip); - - final List lost = deathItems.getLostItems(); - assertTrue(lost.contains(new ItemStack(ItemID.SHADOW_SWORD, 1))); - } - - @Test - public void lostIfNotProtectedTestKept() - { - final Item[] inv = new Item[] - { - mItem(ItemID.SHADOW_SWORD, 1, "Shadow sword", false, 1) - }; - final Item[] equip = new Item[0]; - - final DeathItems deathItems = plugin.calculateKeptLostItems(inv, equip); - - final List kept = deathItems.getKeptItems(); - assertTrue(kept.contains(new ItemStack(ItemID.SHADOW_SWORD, 1))); - } - - @Test - public void brokenOnDeathTestRepairPrice() - { - // Dragon defender price should actually be pulled from BrokenOnDeathItem, and be lost on death - final Item[] inv = new Item[] - { - mItem(ItemID.BARROWS_GLOVES, 1, "Barrows gloves", false, 130000), - mItem(ItemID.DRAGON_DEFENDER, 1, "Dragon defender", false, 68007), - mItem(ItemID.DRAGON_SCIMITAR, 1, "Dragon scimitar", true, 63123), - mItem(ItemID.HELM_OF_NEITIZNOT, 1, "Helm of neitiznot", true, 45519), - }; - - plugin.wildyLevel = 21; - - final DeathItems deathItems = plugin.calculateKeptLostItems(inv, new Item[0]); - - final List lost = deathItems.getLostItems(); - assertTrue(lost.contains(new ItemStack(ItemID.DRAGON_DEFENDER, 1))); - } - - @Test - public void avernicDefenderPriceTest() - { - final Item defender = mItem(ItemID.AVERNIC_DEFENDER, 1, "Avernic defender", false, 0); - final int defenderOffset = FixedPriceItem.AVERNIC_DEFENDER.getOffset(); - final ItemReclaimCost defenderBrokenPrice = ItemReclaimCost.of(ItemID.AVERNIC_DEFENDER); - final int defenderExpectedPrice = (defenderBrokenPrice == null ? 0 : defenderBrokenPrice.getValue()) + defenderOffset; - assertEquals(defenderExpectedPrice, plugin.getDeathPrice(defender)); - - final Item[] inv = new Item[] - { - defender, - mItem(ItemID.BERSERKER_RING_I, 1, "Berserker Ring (i)", false, 3042579) - }; - - plugin.isSkulled = true; - plugin.protectingItem = true; - plugin.wildyLevel = 21; - - final DeathItems deathItems = plugin.calculateKeptLostItems(inv, new Item[0]); - - final List kept = deathItems.getKeptItems(); - assertTrue(kept.contains(new ItemStack(ItemID.AVERNIC_DEFENDER, 1))); - } - - @Test - public void lockedItemTest() - { - // Base item data needs to exist for each locked item tested as the death price is pulled from the base item. - final Item defenderBase = mItem(ItemID.AVERNIC_DEFENDER, 1, "Avernic defender", false, 0); - final Item defenderLocked = mItem(ItemID.AVERNIC_DEFENDER_L, 1, "Avernic defender (l)", false, 0); - - assertEquals(plugin.getDeathPrice(defenderBase), plugin.getDeathPrice(defenderLocked)); - - final Item[] inv = new Item[] - { - defenderLocked, - mItem(ItemID.DRAGON_CLAWS, 1, "Dragon Claws", true, 30042579) - }; - - plugin.isSkulled = true; - plugin.protectingItem = true; - plugin.wildyLevel = 21; - - final DeathItems deathItems = plugin.calculateKeptLostItems(inv, new Item[0]); - - final List kept = deathItems.getKeptItems(); - assertEquals(inv.length, kept.size()); - } -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/itemstats/ItemStatChangesTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/itemstats/ItemStatChangesTest.java deleted file mode 100644 index 6a134ff101..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/itemstats/ItemStatChangesTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2016-2018, 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.itemstats; - -import org.junit.Test; - -public class ItemStatChangesTest -{ - @Test - public void testInit() - { - new ItemStatChanges(); - } - -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/maxhit/calculators/MaxHitCalculatorTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/maxhit/calculators/MaxHitCalculatorTest.java deleted file mode 100644 index 3aa1c59c44..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/maxhit/calculators/MaxHitCalculatorTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.calculators; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import net.runelite.api.Client; -import net.runelite.client.plugins.maxhit.calculators.testconfig.MagicMaxHitConfig; -import net.runelite.client.plugins.maxhit.calculators.testconfig.MaxHitConfig; -import net.runelite.client.plugins.maxhit.calculators.testconfig.MeleeMaxHitConfig; -import net.runelite.client.plugins.maxhit.calculators.testconfig.RangeMaxHitConfig; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class MaxHitCalculatorTest -{ - @Mock - @Bind - protected Client client; - - @Before - public void setUp() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - @Test - public void calculate() - { - testMaxHitConfig(MeleeMaxHitConfig.values()); - testMaxHitConfig(RangeMaxHitConfig.values()); - testMaxHitConfig(MagicMaxHitConfig.values()); - } - - private void testMaxHitConfig(MaxHitConfig[] maxHitConfigs) - { - for (MaxHitConfig maxHitConfig : maxHitConfigs) - { - maxHitConfig.test(client); - } - } -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/maxhit/calculators/testconfig/MagicMaxHitConfig.java b/runelite-client/src/test/java/net/runelite/client/plugins/maxhit/calculators/testconfig/MagicMaxHitConfig.java deleted file mode 100644 index b1339691a8..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/maxhit/calculators/testconfig/MagicMaxHitConfig.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.calculators.testconfig; - -import net.runelite.api.Client; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemID; -import net.runelite.api.Skill; -import net.runelite.api.Varbits; -import net.runelite.client.plugins.maxhit.calculators.MagicMaxHitCalculator; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public enum MagicMaxHitConfig implements MaxHitConfig -{ - - TRIDENT_SLAYER(new int[]{75, 83, 99}, 0, new Item[] - { - mockItem(ItemID.SLAYER_HELMET_I), - mockItem(ItemID.SARADOMIN_CAPE), - mockItem(ItemID.OCCULT_NECKLACE), - mockItem(ItemID.TRIDENT_OF_THE_SEAS), - mockItem(ItemID.MYSTIC_ROBE_TOP), - mockItem(ItemID.BROODOO_SHIELD), - null, - mockItem(ItemID.MYSTIC_ROBE_BOTTOM), - null, - mockItem(ItemID.MYSTIC_GLOVES), - mockItem(ItemID.WIZARD_BOOTS), - mockItem(ItemID.RING_OF_WEALTH) - }, new int[]{25, 27, 34}), - - TRIDENT_OF_SEAS(new int[]{75, 83, 99}, 0, new Item[] - { - mockItem(ItemID.MYSTIC_HAT), - mockItem(ItemID.SARADOMIN_CAPE), - mockItem(ItemID.AMULET_OF_GLORY), - mockItem(ItemID.TRIDENT_OF_THE_SEAS), - mockItem(ItemID.MYSTIC_ROBE_TOP), - mockItem(ItemID.BROODOO_SHIELD), - null, - mockItem(ItemID.MYSTIC_ROBE_BOTTOM), - null, - mockItem(ItemID.MYSTIC_GLOVES), - mockItem(ItemID.WIZARD_BOOTS), - mockItem(ItemID.RING_OF_WEALTH) - }, new int[]{20, 22, 28}), - - TRIDENT_OF_SWAMP(new int[]{75, 83, 99}, 0, new Item[] - { - mockItem(ItemID.MYSTIC_HAT), - mockItem(ItemID.SARADOMIN_CAPE), - mockItem(ItemID.AMULET_OF_GLORY), - mockItem(ItemID.TRIDENT_OF_THE_SWAMP), - mockItem(ItemID.MYSTIC_ROBE_TOP), - mockItem(ItemID.BROODOO_SHIELD), - null, - mockItem(ItemID.MYSTIC_ROBE_BOTTOM), - null, - mockItem(ItemID.MYSTIC_GLOVES), - mockItem(ItemID.WIZARD_BOOTS), - mockItem(ItemID.RING_OF_WEALTH) - }, new int[]{23, 25, 31}), - - MAGIC_DART(new int[]{75, 83, 99}, 18, new Item[] - { - mockItem(ItemID.MYSTIC_HAT), - mockItem(ItemID.SARADOMIN_CAPE), - mockItem(ItemID.AMULET_OF_GLORY), - mockItem(ItemID.SLAYERS_STAFF), - mockItem(ItemID.MYSTIC_ROBE_TOP), - mockItem(ItemID.BROODOO_SHIELD), - null, - mockItem(ItemID.MYSTIC_ROBE_BOTTOM), - null, - mockItem(ItemID.MYSTIC_GLOVES), - mockItem(ItemID.WIZARD_BOOTS), - mockItem(ItemID.RING_OF_WEALTH) - }, new int[]{17, 18, 19}), - - - FIRE_BOLT(75, 8, new Item[] - { - mockItem(ItemID.SLAYER_HELMET_I), - mockItem(ItemID.IMBUED_SARADOMIN_CAPE), - mockItem(ItemID.OCCULT_NECKLACE), - mockItem(ItemID.STAFF_OF_THE_DEAD), - mockItem(ItemID.MYSTIC_ROBE_TOP), - mockItem(ItemID.TOME_OF_FIRE), - null, - mockItem(ItemID.MYSTIC_ROBE_BOTTOM), - null, - mockItem(ItemID.CHAOS_GAUNTLETS), - mockItem(ItemID.WIZARD_BOOTS), - mockItem(ItemID.RING_OF_WEALTH) - }, 31), - - - WIND_BLAST(75, 9, new Item[] - { - mockItem(ItemID.MYSTIC_HAT), - mockItem(ItemID.SARADOMIN_CAPE), - mockItem(ItemID.AMULET_OF_GLORY), - mockItem(ItemID.STAFF_OF_AIR), - mockItem(ItemID.MYSTIC_ROBE_TOP), - mockItem(ItemID.BROODOO_SHIELD), - null, - mockItem(ItemID.MYSTIC_ROBE_BOTTOM), - null, - mockItem(ItemID.MYSTIC_GLOVES), - mockItem(ItemID.WIZARD_BOOTS), - mockItem(ItemID.RING_OF_WEALTH) - }, 13), - - - EARTH_WAVE(75, 15, new Item[] - { - mockItem(ItemID.MYSTIC_HAT), - mockItem(ItemID.SARADOMIN_CAPE), - mockItem(ItemID.OCCULT_NECKLACE), - mockItem(ItemID.STAFF_OF_EARTH), - mockItem(ItemID.MYSTIC_ROBE_TOP), - mockItem(ItemID.TOME_OF_FIRE), - null, - mockItem(ItemID.MYSTIC_ROBE_BOTTOM), - null, - mockItem(ItemID.MYSTIC_GLOVES), - mockItem(ItemID.WIZARD_BOOTS), - mockItem(ItemID.RING_OF_WEALTH) - }, 20), - - FLAMES_OF_ZAMORAK(75, 20, new Item[] - { - mockItem(ItemID.MYSTIC_HAT), - mockItem(ItemID.SARADOMIN_CAPE), - mockItem(ItemID.AMULET_OF_GLORY), - mockItem(ItemID.STAFF_OF_THE_DEAD), - mockItem(ItemID.MYSTIC_ROBE_TOP), - mockItem(ItemID.BROODOO_SHIELD), - null, - mockItem(ItemID.MYSTIC_ROBE_BOTTOM), - null, - mockItem(ItemID.MYSTIC_GLOVES), - mockItem(ItemID.WIZARD_BOOTS), - mockItem(ItemID.RING_OF_WEALTH) - }, 23), - - SARADOMIN_STRIKE(75, 52, new Item[] - { - mockItem(ItemID.MYSTIC_HAT), - mockItem(ItemID.SARADOMIN_CAPE), - mockItem(ItemID.AMULET_OF_GLORY), - mockItem(ItemID.STAFF_OF_LIGHT), - mockItem(ItemID.MYSTIC_ROBE_TOP), - mockItem(ItemID.BROODOO_SHIELD), - null, - mockItem(ItemID.MYSTIC_ROBE_BOTTOM), - null, - mockItem(ItemID.MYSTIC_GLOVES), - mockItem(ItemID.WIZARD_BOOTS), - mockItem(ItemID.RING_OF_WEALTH) - }, 23), - - - ; - - - private final int[] magicLevels; - private final int spellId; - private final Item[] equipedItems; - private final int[] expectedMaxHits; - - MagicMaxHitConfig(int magicLevel, int spellId, Item[] equipedItems, int expectedMaxHit) - { - this.magicLevels = new int[]{magicLevel}; - this.spellId = spellId; - this.equipedItems = equipedItems; - this.expectedMaxHits = new int[]{expectedMaxHit}; - } - - MagicMaxHitConfig(int[] magicLevels, int spellId, Item[] equipedItems, int[] expectedMaxHits) - { - this.magicLevels = magicLevels; - this.spellId = spellId; - this.equipedItems = equipedItems; - this.expectedMaxHits = expectedMaxHits; - } - - - private static Item mockItem(int itemId) - { - Item item = mock(Item.class); - when(item.getId()).thenReturn(itemId); - return item; - } - - public void test(Client client) - { - int[] magicLevels = this.magicLevels; - for (int i = 0, magicLevelsLength = magicLevels.length; i < magicLevelsLength; i++) - { - int magicLevel = magicLevels[i]; - int expectedMaxHit = this.expectedMaxHits[i]; - - // Mock equipment container - ItemContainer equipmentContainer = mock(ItemContainer.class); - when(equipmentContainer.getItems()) - .thenReturn(this.equipedItems); - when(client.getItemContainer(InventoryID.EQUIPMENT)).thenReturn(equipmentContainer); - - // Mock Varbits - when(client.getBoostedSkillLevel(Skill.MAGIC)).thenReturn(magicLevel); - when(client.getVar(Varbits.AUTO_CAST_SPELL)).thenReturn(this.spellId); - - // Test - MagicMaxHitCalculator maxHitCalculator = new MagicMaxHitCalculator(client, this.equipedItems); - assertEquals(this.toString(), expectedMaxHit, maxHitCalculator.getMaxHit(), 0); - - } - - } - -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/maxhit/calculators/testconfig/MaxHitConfig.java b/runelite-client/src/test/java/net/runelite/client/plugins/maxhit/calculators/testconfig/MaxHitConfig.java deleted file mode 100644 index 309abe1727..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/maxhit/calculators/testconfig/MaxHitConfig.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.calculators.testconfig; - -import net.runelite.api.Client; - -public interface MaxHitConfig -{ - void test(Client client); -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/maxhit/calculators/testconfig/MeleeMaxHitConfig.java b/runelite-client/src/test/java/net/runelite/client/plugins/maxhit/calculators/testconfig/MeleeMaxHitConfig.java deleted file mode 100644 index a986dd9390..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/maxhit/calculators/testconfig/MeleeMaxHitConfig.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.calculators.testconfig; - -import net.runelite.api.Client; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemID; -import net.runelite.api.Skill; -import net.runelite.api.VarPlayer; -import net.runelite.api.Varbits; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.plugins.attackstyles.WeaponType; -import net.runelite.client.plugins.maxhit.calculators.MeleeMaxHitCalculator; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public enum MeleeMaxHitConfig implements MaxHitConfig -{ - - DRAGON_SCIMITAR(new int[]{75, 83, 99}, 66, WeaponType.TYPE_9, 1, new Item[] - { - mockItem(ItemID.IRON_FULL_HELM), - mockItem(ItemID.BLACK_CAPE), - mockItem(ItemID.GOLD_NECKLACE), - mockItem(ItemID.DRAGON_SCIMITAR), - mockItem(ItemID.IRON_PLATEBODY), - mockItem(ItemID.IRON_KITESHIELD), - null, - mockItem(ItemID.IRON_PLATELEGS), - null, - mockItem(ItemID.LEATHER_GLOVES), - mockItem(ItemID.LEATHER_BOOTS), - mockItem(ItemID.GOLD_RING) - }, new int[]{17, 19, 22}), - - DRAGON_SCIMITAR_DEFENDER(new int[]{75, 83, 99}, 76, WeaponType.TYPE_9, 1, new Item[] - { - mockItem(ItemID.IRON_FULL_HELM), - mockItem(ItemID.BLACK_CAPE), - mockItem(ItemID.GOLD_NECKLACE), - mockItem(ItemID.DRAGON_SCIMITAR), - mockItem(ItemID.IRON_PLATEBODY), - mockItem(ItemID.DRAGON_DEFENDER), - null, - mockItem(ItemID.IRON_PLATELEGS), - null, - mockItem(ItemID.LEATHER_GLOVES), - mockItem(ItemID.LEATHER_BOOTS), - mockItem(ItemID.GOLD_RING) - }, new int[]{19, 21, 24}), - - DRAGON_SCIMITAR_COMPLETE(new int[]{75, 83, 99}, 108, WeaponType.TYPE_9, 1, new Item[] - { - mockItem(ItemID.SLAYER_HELMET), - mockItem(ItemID.FIRE_CAPE), - mockItem(ItemID.AMULET_OF_FURY), - mockItem(ItemID.DRAGON_SCIMITAR), - mockItem(ItemID.FIGHTER_TORSO), - mockItem(ItemID.DRAGON_DEFENDER), - null, - mockItem(ItemID.IRON_PLATELEGS), - null, - mockItem(ItemID.BARROWS_GLOVES), - mockItem(ItemID.DRAGON_BOOTS), - mockItem(ItemID.BERSERKER_RING) - }, new int[]{26, 29, 35}), - - OBSIDIAN_SET(new int[]{75, 83, 99}, 61, WeaponType.TYPE_17, 2, new Item[] - { - mockItem(ItemID.OBSIDIAN_HELMET), - mockItem(ItemID.OBSIDIAN_CAPE), - mockItem(ItemID.GOLD_NECKLACE), - mockItem(ItemID.TOKTZXILAK), - mockItem(ItemID.OBSIDIAN_PLATEBODY), - mockItem(ItemID.TOKTZKETXIL), - null, - mockItem(ItemID.OBSIDIAN_PLATELEGS), - null, - mockItem(ItemID.LEATHER_GLOVES), - mockItem(ItemID.LEATHER_BOOTS), - mockItem(ItemID.GOLD_RING) - }, new int[]{18, 19, 23}), - - DHAROK_SET(new int[]{75, 75, 75, 83, 83, 83, 99, 99, 99}, 105, WeaponType.TYPE_1, 1, - new int[][]{{99, 99}, {1, 99}, {32, 75}, {99, 99}, {1, 99}, {32, 75}, {99, 99}, {1, 99}, {32, 75}}, - new Item[] - { - mockItem(ItemID.DHAROKS_HELM_100), - mockItem(ItemID.BLACK_CAPE), - mockItem(ItemID.GOLD_NECKLACE), - mockItem(ItemID.DHAROKS_GREATAXE_100), - mockItem(ItemID.DHAROKS_PLATEBODY_100), - null, - null, - mockItem(ItemID.DHAROKS_PLATELEGS_100), - null, - mockItem(ItemID.LEATHER_GLOVES), - mockItem(ItemID.LEATHER_BOOTS), - mockItem(ItemID.GOLD_RING) - }, new int[]{23, 45, 30, 25, 49, 33, 29, 57, 38}), - - VOID_SET(new int[]{75, 83, 99}, 66, WeaponType.TYPE_9, 1, new Item[] - { - mockItem(ItemID.VOID_MELEE_HELM), - mockItem(ItemID.BLACK_CAPE), - mockItem(ItemID.GOLD_NECKLACE), - mockItem(ItemID.DRAGON_SCIMITAR), - mockItem(ItemID.VOID_KNIGHT_TOP), - mockItem(ItemID.IRON_KITESHIELD), - null, - mockItem(ItemID.VOID_KNIGHT_ROBE), - null, - mockItem(ItemID.VOID_KNIGHT_GLOVES), - mockItem(ItemID.LEATHER_BOOTS), - mockItem(ItemID.GOLD_RING) - }, new int[]{19, 21, 25}), - ; - - - private final int[] strengthLevels; - private final WeaponType weaponType; - private final int attackStyleId; - private final Item[] equipedItems; - private final int[] expectedMaxHits; - private final int[][] hitpoints; - private final int meleeEquipmentStrength; - - MeleeMaxHitConfig(int[] strengthLevels, int meleeEquipmentStrength, WeaponType weaponType, int attackStyleId, int[][] hitpoints, Item[] equipedItems, int[] expectedMaxHits) - { - this.strengthLevels = strengthLevels; - this.meleeEquipmentStrength = meleeEquipmentStrength; - this.weaponType = weaponType; - this.attackStyleId = attackStyleId; - this.hitpoints = hitpoints; - this.equipedItems = equipedItems; - this.expectedMaxHits = expectedMaxHits; - } - - MeleeMaxHitConfig(int[] strengthLevels, int meleeEquipmentStrength, WeaponType weaponType, int attackStyleId, Item[] equipedItems, int[] expectedMaxHits) - { - this.strengthLevels = strengthLevels; - this.hitpoints = new int[strengthLevels.length][2]; - this.meleeEquipmentStrength = meleeEquipmentStrength; - this.weaponType = weaponType; - this.attackStyleId = attackStyleId; - this.equipedItems = equipedItems; - this.expectedMaxHits = expectedMaxHits; - } - - - private static Item mockItem(int itemId) - { - Item item = mock(Item.class); - when(item.getId()).thenReturn(itemId); - return item; - } - - public void test(Client client) - { - int[] strengthLevels = this.strengthLevels; - for (int i = 0, strengthLevelsLength = strengthLevels.length; i < strengthLevelsLength; i++) - { - int strengthLevel = strengthLevels[i]; - int[] hitpoints = this.hitpoints[i]; - int expectedMaxHit = this.expectedMaxHits[i]; - - // Mock equipment container - ItemContainer equipmentContainer = mock(ItemContainer.class); - when(equipmentContainer.getItems()) - .thenReturn(this.equipedItems); - when(client.getItemContainer(InventoryID.EQUIPMENT)).thenReturn(equipmentContainer); - - // Mock equipment strength - Widget equipmentWidget = mock(Widget.class); - when(client.getWidget(WidgetInfo.EQUIPMENT_MELEE_STRENGTH)).thenReturn(equipmentWidget); - when(equipmentWidget.getText()).thenReturn("Melee strength: " + this.meleeEquipmentStrength); - - // Mock Varbits - when(client.getVar(Varbits.EQUIPPED_WEAPON_TYPE)).thenReturn(this.weaponType.ordinal()); - when(client.getVar(VarPlayer.ATTACK_STYLE)).thenReturn(this.attackStyleId); - - // Mock strength - when(client.getBoostedSkillLevel(Skill.STRENGTH)).thenReturn(strengthLevel); - - // Mock hitpoints - when(client.getBoostedSkillLevel(Skill.HITPOINTS)).thenReturn(hitpoints[0]); - when(client.getRealSkillLevel(Skill.HITPOINTS)).thenReturn(hitpoints[1]); - - // Test - MeleeMaxHitCalculator maxHitCalculator = new MeleeMaxHitCalculator(client, this.equipedItems); - assertEquals(this.toString(), expectedMaxHit, maxHitCalculator.getMaxHit(), 0); - - } - - } - -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/maxhit/calculators/testconfig/RangeMaxHitConfig.java b/runelite-client/src/test/java/net/runelite/client/plugins/maxhit/calculators/testconfig/RangeMaxHitConfig.java deleted file mode 100644 index 81d7f196e5..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/maxhit/calculators/testconfig/RangeMaxHitConfig.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2019, Bartvollebregt - * 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.maxhit.calculators.testconfig; - -import net.runelite.api.Client; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemID; -import net.runelite.api.Skill; -import net.runelite.api.VarPlayer; -import net.runelite.api.Varbits; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.plugins.maxhit.attackstyle.WeaponType; -import net.runelite.client.plugins.maxhit.calculators.RangeMaxHitCalculator; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public enum RangeMaxHitConfig implements MaxHitConfig -{ - - MAGIC_SHORTBOW(new int[]{75, 83, 99}, 49, WeaponType.TYPE_3, 1, new Item[] - { - mockItem(ItemID.IRON_FULL_HELM), - mockItem(ItemID.BLACK_CAPE), - mockItem(ItemID.GOLD_NECKLACE), - mockItem(ItemID.MAGIC_SHORTBOW), - mockItem(ItemID.IRON_PLATEBODY), - null, - null, - mockItem(ItemID.IRON_PLATELEGS), - null, - mockItem(ItemID.LEATHER_GLOVES), - mockItem(ItemID.LEATHER_BOOTS), - mockItem(ItemID.GOLD_RING), - mockItem(ItemID.RUNE_ARROW) - }, new int[]{15, 16, 19}), - - RUNE_CROSSBOW(new int[]{75, 83, 99}, 115, WeaponType.TYPE_5, 0, new Item[] - { - mockItem(ItemID.IRON_FULL_HELM), - mockItem(ItemID.BLACK_CAPE), - mockItem(ItemID.GOLD_NECKLACE), - mockItem(ItemID.RUNE_CROSSBOW), - mockItem(ItemID.IRON_PLATEBODY), - null, - null, - mockItem(ItemID.IRON_PLATELEGS), - null, - mockItem(ItemID.LEATHER_GLOVES), - mockItem(ItemID.LEATHER_BOOTS), - mockItem(ItemID.GOLD_RING), - mockItem(ItemID.RUNITE_BOLTS) - }, new int[]{24, 26, 31}), - - BLOwPIPE(new int[]{75, 83, 99}, 50, WeaponType.TYPE_19, 1, new Item[] - { - mockItem(ItemID.IRON_FULL_HELM), - mockItem(ItemID.BLACK_CAPE), - mockItem(ItemID.GOLD_NECKLACE), - mockItem(ItemID.TOXIC_BLOWPIPE), - mockItem(ItemID.IRON_PLATEBODY), - null, - null, - mockItem(ItemID.IRON_PLATELEGS), - null, - mockItem(ItemID.LEATHER_GLOVES), - mockItem(ItemID.LEATHER_BOOTS), - mockItem(ItemID.GOLD_RING) - }, new int[]{15, 16, 19}), - - VOID_SET(new int[]{75, 83, 99}, 115, WeaponType.TYPE_5, 1, new Item[] - { - mockItem(ItemID.VOID_RANGER_HELM), - mockItem(ItemID.BLACK_CAPE), - mockItem(ItemID.GOLD_NECKLACE), - mockItem(ItemID.RUNE_CROSSBOW), - mockItem(ItemID.VOID_KNIGHT_TOP), - mockItem(ItemID.IRON_KITESHIELD), - null, - mockItem(ItemID.VOID_KNIGHT_ROBE), - null, - mockItem(ItemID.VOID_KNIGHT_GLOVES), - mockItem(ItemID.LEATHER_BOOTS), - mockItem(ItemID.GOLD_RING) - }, new int[]{26, 28, 33}), - - ; - - private final int[] rangeLevels; - private final WeaponType weaponType; - private final int attackStyleId; - private final Item[] equipedItems; - private final int[] expectedMaxHits; - private final int ammoEquipmentStrength; - - RangeMaxHitConfig(int[] rangeLevels, int ammoEquipmentStrength, WeaponType weaponType, int attackStyleId, Item[] equipedItems, int[] expectedMaxHits) - { - this.rangeLevels = rangeLevels; - this.ammoEquipmentStrength = ammoEquipmentStrength; - this.weaponType = weaponType; - this.attackStyleId = attackStyleId; - this.equipedItems = equipedItems; - this.expectedMaxHits = expectedMaxHits; - } - - - private static Item mockItem(int itemId) - { - Item item = mock(Item.class); - when(item.getId()).thenReturn(itemId); - return item; - } - - public void test(Client client) - { - int[] rangeLevels = this.rangeLevels; - for (int i = 0, rangeLevelsLength = rangeLevels.length; i < rangeLevelsLength; i++) - { - int rangeLevel = rangeLevels[i]; - int expectedMaxHit = this.expectedMaxHits[i]; - - // Mock equipment container - ItemContainer equipmentContainer = mock(ItemContainer.class); - when(client.getItemContainer(InventoryID.EQUIPMENT)).thenReturn(equipmentContainer); - - // Mock equipment strength - Widget equipmentWidget = mock(Widget.class); - when(client.getWidget(WidgetInfo.EQUIPMENT_RANGED_STRENGTH)).thenReturn(equipmentWidget); - when(equipmentWidget.getText()).thenReturn("Ranged strength: " + this.ammoEquipmentStrength); - - // Mock Varbits - when(client.getVar(Varbits.EQUIPPED_WEAPON_TYPE)).thenReturn(this.weaponType.ordinal()); - when(client.getVar(VarPlayer.ATTACK_STYLE)).thenReturn(this.attackStyleId); - - // Mock strength - when(client.getBoostedSkillLevel(Skill.RANGED)).thenReturn(rangeLevel); - - // Test - RangeMaxHitCalculator maxHitCalculator = new RangeMaxHitCalculator(client, this.equipedItems); - assertEquals(this.toString(), expectedMaxHit, maxHitCalculator.getMaxHit(), 0); - - } - - } - -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/motherlode/MotherlodePluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/motherlode/MotherlodePluginTest.java deleted file mode 100644 index 162a78ac18..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/motherlode/MotherlodePluginTest.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * 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.motherlode; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import java.util.concurrent.ScheduledExecutorService; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.api.ItemID; -import net.runelite.api.Varbits; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.ItemContainerChanged; -import net.runelite.api.events.VarbitChanged; -import net.runelite.client.Notifier; -import net.runelite.client.config.ChatColorConfig; -import net.runelite.client.config.OpenOSRSConfig; -import net.runelite.client.config.RuneLiteConfig; -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.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class MotherlodePluginTest -{ - @Inject - private MotherlodePlugin motherlodePlugin; - - @Mock - @Bind - private Client client; - - @Mock - @Bind - MotherlodeSession motherlodeSession; - - @Mock - @Bind - private MotherlodeConfig motherlodeConfig; - - @Mock - @Bind - private MotherlodeGemOverlay motherlodeGemOverlay; - - @Mock - @Bind - private MotherlodeOreOverlay motherlodeOreOverlay; - - @Mock - @Bind - private MotherlodeRocksOverlay motherlodeRocksOverlay; - - @Mock - @Bind - private MotherlodeSackOverlay motherlodeSackOverlay; - - @Mock - @Bind - private ScheduledExecutorService scheduledExecutorService; - - @Mock - @Bind - private ChatColorConfig chatColorConfig; - - @Mock - @Bind - private RuneLiteConfig runeliteConfig; - - @Mock - @Bind - private Notifier notifier; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - - when(client.getGameState()).thenReturn(GameState.LOGGED_IN); - when(client.getMapRegions()).thenReturn(new int[]{14679}); - } - - @Test - public void testOreCounter() - { - // set inMlm - GameStateChanged gameStateChanged = new GameStateChanged(); - gameStateChanged.setGameState(GameState.LOADING); - motherlodePlugin.onGameStateChanged(gameStateChanged); - - // Initial sack count - when(client.getVar(Varbits.SACK_NUMBER)).thenReturn(42); - motherlodePlugin.onVarbitChanged(new VarbitChanged()); - - // Create before inventory - ItemContainer inventory = mock(ItemContainer.class); - Item[] items = new Item[]{ - item(ItemID.RUNITE_ORE, 1), - item(ItemID.GOLDEN_NUGGET, 4), - item(ItemID.COAL, 1), - item(ItemID.COAL, 1), - item(ItemID.COAL, 1), - item(ItemID.COAL, 1), - - }; - when(inventory.getItems()) - .thenReturn(items); - when(client.getItemContainer(InventoryID.INVENTORY)).thenReturn(inventory); - - // Withdraw 20 - when(client.getVar(Varbits.SACK_NUMBER)).thenReturn(22); - motherlodePlugin.onVarbitChanged(new VarbitChanged()); - - inventory = mock(ItemContainer.class); - // +1 rune, +4 nugget, +2 coal, +1 addy - items = new Item[]{ - item(ItemID.RUNITE_ORE, 1), - item(ItemID.RUNITE_ORE, 1), - item(ItemID.GOLDEN_NUGGET, 8), - item(ItemID.COAL, 1), - item(ItemID.COAL, 1), - item(ItemID.COAL, 1), - item(ItemID.COAL, 1), - item(ItemID.COAL, 1), - item(ItemID.COAL, 1), - item(ItemID.ADAMANTITE_ORE, 1), - }; - when(inventory.getItems()) - .thenReturn(items); - when(client.getItemContainer(InventoryID.INVENTORY)).thenReturn(inventory); - - // Trigger comparison - motherlodePlugin.onItemContainerChanged(new ItemContainerChanged(InventoryID.INVENTORY.getId(), inventory)); - - verify(motherlodeSession).updateOreFound(ItemID.RUNITE_ORE, 1); - verify(motherlodeSession).updateOreFound(ItemID.GOLDEN_NUGGET, 4); - verify(motherlodeSession).updateOreFound(ItemID.COAL, 2); - verify(motherlodeSession).updateOreFound(ItemID.ADAMANTITE_ORE, 1); - verifyNoMoreInteractions(motherlodeSession); - } - - private static Item item(int itemId, int quantity) - { - return new Item(itemId, quantity); - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPluginTest.java deleted file mode 100644 index ccb8fb0451..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPluginTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.npchighlight; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import java.util.Iterator; -import java.util.List; -import java.util.concurrent.ScheduledExecutorService; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.client.config.OpenOSRSConfig; -import static org.junit.Assert.assertEquals; -import net.runelite.client.Notifier; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class NpcIndicatorsPluginTest -{ - @Mock - @Bind - private Client client; - - @Mock - @Bind - private ScheduledExecutorService executorService; - - @Mock - @Bind - private NpcIndicatorsConfig npcIndicatorsConfig; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Mock - @Bind - private Notifier notifier; - - @Inject - private NpcIndicatorsPlugin npcIndicatorsPlugin; - - @Before - public void setUp() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - @Test - public void getHighlights() - { - npcIndicatorsPlugin.setGetNpcToHighlight("goblin, , zulrah , *wyvern, ,"); - final List highlightedNpcs = npcIndicatorsPlugin.getHighlights(); - assertEquals("Length of parsed NPCs is incorrect", 3, highlightedNpcs.size()); - - final Iterator iterator = highlightedNpcs.iterator(); - assertEquals("goblin", iterator.next()); - assertEquals("zulrah", iterator.next()); - assertEquals("*wyvern", iterator.next()); - } -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/puzzlesolver/PuzzleSolverTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/puzzlesolver/PuzzleSolverTest.java deleted file mode 100644 index efd84a3646..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/puzzlesolver/PuzzleSolverTest.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2018, 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.client.plugins.puzzlesolver; - -import net.runelite.client.plugins.puzzlesolver.solver.PuzzleSolver; -import net.runelite.client.plugins.puzzlesolver.solver.PuzzleState; -import net.runelite.client.plugins.puzzlesolver.solver.heuristics.ManhattanDistance; -import net.runelite.client.plugins.puzzlesolver.solver.pathfinding.IDAStar; -import net.runelite.client.plugins.puzzlesolver.solver.pathfinding.IDAStarMM; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import org.junit.Test; - -public class PuzzleSolverTest -{ - private static final PuzzleState[] START_STATES = - { - new PuzzleState(new int[]{0, 11, 1, 3, 4, 5, 12, 2, 7, 9, 6, 20, 18, 16, 8, 15, 22, 10, 14, 13, 21, -1, 17, 23, 19}), - new PuzzleState(new int[]{0, 2, 7, 3, 4, 10, 5, 12, 1, 9, 6, 17, 8, 14, 19, -1, 16, 21, 11, 13, 15, 20, 22, 18, 23}), - new PuzzleState(new int[]{0, 1, 11, 3, 4, 12, 2, 7, 13, 9, 5, 21, 15, 17, 14, -1, 10, 6, 8, 19, 16, 20, 22, 18, 23}), - new PuzzleState(new int[]{0, 1, 2, 3, 4, 10, 5, 6, 9, 14, 15, -1, 7, 13, 17, 21, 11, 20, 23, 8, 16, 22, 12, 19, 18}), - new PuzzleState(new int[]{0, 1, 2, 3, 4, 5, 6, 8, 22, 18, 10, -1, 7, 17, 9, 20, 11, 12, 21, 14, 16, 15, 23, 13, 19}), - new PuzzleState(new int[]{0, 1, 2, 3, 4, 5, 6, 8, 12, 9, 16, 11, 17, 7, 14, 10, 20, -1, 22, 13, 15, 18, 21, 23, 19}), - new PuzzleState(new int[]{1, 6, 16, 8, 4, 0, 7, 11, 2, 9, 5, 21, 18, 3, 14, 10, 20, -1, 13, 22, 15, 23, 12, 17, 19}), - new PuzzleState(new int[]{0, 1, 2, 4, 8, 6, 16, 11, 7, 3, 5, -1, 12, 14, 9, 15, 10, 17, 13, 18, 20, 21, 22, 23, 19}), - new PuzzleState(new int[]{0, 2, 9, 14, 6, 5, 7, 11, 3, 4, 15, 10, 1, 12, 18, 16, 17, -1, 8, 13, 20, 21, 22, 23, 19}), - new PuzzleState(new int[]{0, 1, 2, 3, 4, 11, 5, 12, 7, 8, 10, 6, 15, 13, 9, 16, 21, -1, 17, 14, 20, 22, 23, 18, 19}), - new PuzzleState(new int[]{5, 0, 1, 2, 4, 10, 6, 3, 8, 9, 12, 13, 7, 14, 19, 15, 11, 16, 17, -1, 20, 21, 22, 18, 23}), - new PuzzleState(new int[]{0, 6, 1, 3, 4, 5, 8, -1, 2, 9, 16, 11, 12, 7, 14, 10, 15, 17, 13, 19, 20, 21, 22, 18, 23}), - new PuzzleState(new int[]{0, 6, 1, 2, 4, 11, 15, 8, 3, 14, 5, 7, 9, 12, 18, 16, 10, 17, 23, 13, 20, 21, 22, -1, 19}), - new PuzzleState(new int[]{0, 1, 7, 2, 4, 5, 3, 12, 8, 9, 15, 6, 18, -1, 13, 11, 10, 22, 17, 23, 16, 21, 20, 19, 14}), - new PuzzleState(new int[]{0, 1, 2, 7, 3, 5, 11, 6, 14, 4, 10, -1, 16, 12, 9, 15, 17, 18, 8, 19, 20, 21, 13, 22, 23}), - new PuzzleState(new int[]{2, 10, 5, 3, 4, -1, 0, 1, 8, 9, 15, 11, 7, 13, 23, 17, 6, 20, 14, 19, 16, 12, 18, 21, 22}), - new PuzzleState(new int[]{0, 1, 2, 8, 9, 5, 6, 7, 3, 4, 10, -1, 14, 23, 18, 21, 11, 16, 12, 19, 15, 20, 17, 13, 22}), - new PuzzleState(new int[]{0, 6, 1, 3, 4, 11, 2, 13, 9, 12, 5, 16, 7, 18, 8, 20, 15, -1, 14, 19, 21, 10, 22, 23, 17}), - new PuzzleState(new int[]{12, 1, 2, 3, 4, 0, 7, 6, 8, 9, 5, 10, 22, 13, 19, 15, 11, 21, 14, 17, 20, 16, 18, -1, 23}), - new PuzzleState(new int[]{0, 2, 11, 3, 4, 5, 1, 6, 8, 9, 15, 10, 13, 14, 19, 7, 12, -1, 17, 18, 20, 21, 16, 22, 23}), - new PuzzleState(new int[]{5, 0, 4, 2, 9, 10, 7, 3, 19, 8, 6, 1, 18, -1, 14, 15, 11, 16, 12, 13, 20, 21, 17, 22, 23}), - new PuzzleState(new int[]{0, 3, 2, 7, 4, 6, 10, 1, 8, 9, 15, 5, 12, 18, 13, -1, 20, 11, 22, 14, 16, 21, 23, 17, 19}), - new PuzzleState(new int[]{1, 2, 4, -1, 9, 0, 5, 7, 3, 14, 10, 6, 8, 13, 19, 15, 11, 18, 12, 22, 20, 16, 21, 23, 17}), - new PuzzleState(new int[]{0, 1, 2, 4, 9, 5, 11, -1, 7, 14, 10, 17, 6, 13, 8, 15, 16, 20, 3, 18, 22, 21, 12, 23, 19}), - new PuzzleState(new int[]{0, 1, 8, 2, 4, 5, 11, 17, 3, 9, 6, 16, 7, 12, 18, 15, 21, -1, 14, 13, 20, 22, 10, 23, 19}), - new PuzzleState(new int[]{5, 0, 2, 3, 4, 1, 8, 6, 7, 9, 11, 12, 16, 13, 14, -1, 22, 20, 17, 19, 21, 10, 15, 18, 23}), - new PuzzleState(new int[]{0, -1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 16, 11, 13, 14, 10, 15, 19, 22, 23, 20, 21, 17, 12, 18}), - new PuzzleState(new int[]{0, 2, 7, -1, 4, 6, 1, 9, 3, 14, 5, 12, 8, 13, 19, 15, 16, 10, 22, 23, 20, 11, 18, 21, 17}), - new PuzzleState(new int[]{7, 5, 13, 1, 12, 0, 2, 4, 3, 9, 10, 6, 8, 17, 14, 15, 11, 16, 18, -1, 20, 21, 22, 23, 19}), - new PuzzleState(new int[]{5, 0, 3, 8, 4, 10, 6, -1, 7, 9, 11, 1, 12, 2, 19, 15, 16, 17, 14, 13, 20, 21, 22, 18, 23}), - new PuzzleState(new int[]{5, 2, 3, 7, 4, 0, 6, 14, 9, 19, 1, 11, 22, 17, 12, 10, 15, -1, 13, 8, 20, 16, 21, 18, 23}), - new PuzzleState(new int[]{0, 1, 3, 4, 9, 5, 6, 2, 7, 14, 10, 13, 17, -1, 8, 15, 11, 16, 12, 18, 20, 21, 22, 23, 19}), - new PuzzleState(new int[]{0, 3, 11, 7, 4, 5, 2, 6, 12, 8, 10, 1, 17, -1, 9, 15, 16, 23, 13, 14, 20, 21, 18, 22, 19}), - new PuzzleState(new int[]{1, 5, 8, 2, 4, -1, 0, 7, 3, 9, 11, 22, 15, 12, 14, 6, 10, 18, 16, 19, 20, 21, 17, 13, 23}), - new PuzzleState(new int[]{7, 12, 11, 4, 9, -1, 0, 8, 10, 2, 6, 1, 16, 3, 14, 5, 15, 17, 13, 19, 20, 21, 22, 18, 23}), - new PuzzleState(new int[]{11, 3, 2, 12, 4, 6, 0, 7, 13, 8, 1, 5, 17, 16, 9, -1, 10, 15, 18, 14, 20, 21, 22, 23, 19}), - new PuzzleState(new int[]{0, 6, 1, 3, 4, 5, 11, 2, 10, 9, 15, 12, 8, 14, 19, 16, 21, -1, 7, 13, 20, 22, 17, 18, 23}), - new PuzzleState(new int[]{0, 1, 2, 3, 4, 6, 10, 7, 8, 9, 5, 16, 11, 14, 17, 20, 13, 18, 12, 22, 21, 15, 23, -1, 19}), - new PuzzleState(new int[]{0, 1, 2, 4, 8, 5, 6, 7, 3, -1, 10, 16, 18, 17, 9, 15, 12, 11, 14, 13, 20, 21, 22, 23, 19}), - new PuzzleState(new int[]{0, 11, 6, 1, 4, 5, 21, 8, 2, 9, 10, 3, 16, -1, 14, 15, 12, 17, 13, 19, 20, 22, 7, 18, 23}), - new PuzzleState(new int[]{0, 6, 1, 2, 4, 11, 10, 3, 13, 9, 5, 7, 8, -1, 23, 15, 16, 22, 18, 14, 20, 21, 12, 17, 19}), - new PuzzleState(new int[]{0, 6, 1, 2, 3, 10, 11, 12, 5, 18, 15, 7, 4, -1, 14, 21, 17, 13, 8, 9, 16, 20, 22, 23, 19}), - new PuzzleState(new int[]{0, 1, 3, 11, 4, 6, 10, 14, 2, 8, 5, -1, 12, 7, 9, 15, 16, 18, 13, 19, 20, 21, 22, 17, 23}), - new PuzzleState(new int[]{1, 5, 2, 3, 4, -1, 0, 7, 14, 8, 11, 6, 13, 9, 23, 10, 12, 15, 19, 17, 20, 21, 16, 22, 18}), - }; - - private static final PuzzleState[] START_STATES_MM = - { - new PuzzleState(new int[]{0, 5, 1, 3, 4, 15, 2, 8, 10, 9, 22, 16, 11, 6, 14, 7, 21, 23, 12, 18, 20, -1, 17, 13, 19}), - new PuzzleState(new int[]{0, 12, 8, 13, 4, 3, 16, 2, 1, 9, 21, 5, 6, 10, 14, 7, 17, 20, 18, -1, 15, 11, 22, 23, 19}), - new PuzzleState(new int[]{1, 3, 7, 9, 8, 13, 17, 2, 4, 6, 15, 5, 22, 12, 14, 11, 0, 10, 21, -1, 20, 18, 16, 23, 19}), - new PuzzleState(new int[]{5, 2, 16, 14, 4, 3, 0, 8, 9, 11, 15, 6, 17, 19, 7, 1, 10, -1, 23, 18, 20, 12, 21, 13, 22}), - new PuzzleState(new int[]{0, 6, 1, 4, 13, 10, 2, 16, 7, 3, 20, -1, 8, 14, 9, 21, 5, 18, 11, 19, 17, 15, 12, 22, 23}), - new PuzzleState(new int[]{5, 0, 1, 4, 8, 10, 6, 7, 12, 3, 17, 16, 21, 2, 9, 18, 20, 13, 14, 19, 11, -1, 23, 15, 22}), - new PuzzleState(new int[]{1, 9, 2, 13, 17, 5, 7, 8, 3, 22, 6, -1, 16, 12, 4, 15, 18, 0, 23, 14, 10, 21, 11, 20, 19}), - new PuzzleState(new int[]{1, 2, 11, 13, 4, 21, 7, 3, 6, 9, 0, 8, 10, 19, 14, 20, 12, 16, 23, -1, 5, 17, 15, 22, 18}), - new PuzzleState(new int[]{2, 0, 1, 4, 13, 6, 7, 3, 8, 9, 22, 15, 10, 14, 18, 5, 12, -1, 17, 21, 20, 11, 23, 16, 19}), - new PuzzleState(new int[]{0, 1, 2, 8, 3, 6, 12, 22, 9, 7, 11, 21, 13, 4, 14, 5, 10, -1, 18, 19, 20, 15, 16, 23, 17}), - new PuzzleState(new int[]{1, 2, 3, 4, 8, 0, 6, 15, 14, 18, 16, 17, 20, -1, 9, 10, 12, 22, 11, 13, 21, 7, 5, 19, 23}), - new PuzzleState(new int[]{0, 5, 2, 4, 9, 7, 15, 20, 12, 13, 6, -1, 22, 1, 8, 10, 11, 23, 14, 3, 21, 16, 17, 19, 18}), - new PuzzleState(new int[]{0, 1, 9, 6, 13, 5, 18, -1, 4, 2, 15, 12, 3, 17, 7, 16, 10, 8, 23, 14, 20, 21, 19, 11, 22}), - new PuzzleState(new int[]{11, 5, 12, 3, 4, 15, 8, 0, 7, 1, 6, -1, 19, 2, 9, 16, 10, 13, 17, 23, 20, 21, 22, 14, 18}), - new PuzzleState(new int[]{10, 0, 1, 3, 4, 18, 5, 6, 12, 9, 7, 11, 8, -1, 22, 15, 23, 14, 19, 13, 20, 2, 17, 16, 21}), - new PuzzleState(new int[]{19, -1, 6, 2, 4, 0, 21, 10, 3, 9, 1, 15, 17, 8, 14, 11, 13, 22, 7, 18, 16, 12, 5, 23, 20}), - new PuzzleState(new int[]{11, 6, 3, 4, 9, 1, 10, 16, 2, 7, 5, 0, 13, -1, 12, 21, 8, 18, 17, 14, 15, 20, 22, 23, 19}), - new PuzzleState(new int[]{0, 1, 5, 3, 4, -1, 6, 2, 15, 10, 7, 8, 23, 16, 13, 22, 11, 9, 12, 14, 20, 21, 18, 17, 19}), - new PuzzleState(new int[]{10, 0, 1, -1, 2, 6, 5, 4, 13, 9, 16, 17, 12, 8, 19, 20, 15, 7, 21, 11, 22, 18, 14, 23, 3}), - new PuzzleState(new int[]{1, 0, 5, 3, 9, 20, 15, 7, 2, 14, 6, 4, 12, -1, 8, 13, 18, 10, 23, 11, 21, 16, 17, 19, 22}), - new PuzzleState(new int[]{0, 7, 6, 3, 4, 15, 1, 2, 8, 18, 11, 5, 13, -1, 22, 17, 16, 23, 14, 9, 20, 10, 12, 19, 21}), - new PuzzleState(new int[]{5, 7, 0, 2, 9, 10, 1, 11, 3, 4, 16, 22, 8, 14, 17, 15, 20, 12, 13, 6, 21, 23, 19, -1, 18}), - new PuzzleState(new int[]{3, 0, 1, 5, 4, 11, 6, 2, 16, 9, 15, 10, 7, 12, 13, 21, 19, -1, 22, 8, 20, 17, 14, 18, 23}), - new PuzzleState(new int[]{6, 0, 3, 2, 4, 5, 1, 8, 13, 12, 15, 14, 10, 7, 9, -1, 22, 11, 19, 23, 16, 20, 17, 21, 18}), - new PuzzleState(new int[]{11, 5, 6, 8, 9, 0, 21, 16, 4, 3, 17, 18, 2, 7, 1, 15, 10, -1, 22, 14, 20, 19, 13, 12, 23}), - new PuzzleState(new int[]{2, 18, 3, 11, 4, -1, 5, 6, 12, 1, 10, 20, 0, 7, 9, 21, 15, 14, 23, 19, 16, 22, 13, 8, 17}), - new PuzzleState(new int[]{0, 6, 8, 3, 1, 5, 2, 12, 9, 13, 16, 14, 19, 7, 18, 10, 11, -1, 4, 15, 20, 17, 23, 21, 22}), - new PuzzleState(new int[]{1, 16, 10, 4, 3, 0, 15, 2, 9, -1, 8, 5, 23, 12, 6, 21, 18, 14, 13, 11, 20, 22, 7, 19, 17}), - new PuzzleState(new int[]{1, 7, 6, 3, 4, 0, 2, 14, 5, 22, 18, 21, 16, 9, 13, 10, 20, -1, 8, 17, 15, 23, 11, 19, 12}), - new PuzzleState(new int[]{5, 0, 1, 7, 9, 11, 8, 4, 2, 14, 15, 17, 18, -1, 3, 20, 10, 12, 22, 19, 16, 6, 13, 21, 23}), - new PuzzleState(new int[]{5, 0, 6, 14, 7, 13, 15, 1, 3, 10, 20, 9, 17, 4, 2, 11, 12, 8, 19, -1, 21, 16, 22, 18, 23}), - new PuzzleState(new int[]{12, 7, 8, 4, 9, 6, 11, 15, 2, 1, 5, -1, 13, 16, 3, 17, 0, 10, 18, 14, 20, 22, 21, 19, 23}), - new PuzzleState(new int[]{15, 1, 2, 3, 14, -1, 20, 9, 4, 19, 0, 6, 7, 16, 13, 10, 5, 12, 17, 18, 22, 11, 21, 23, 8}), - new PuzzleState(new int[]{0, 1, 17, -1, 14, 6, 4, 2, 3, 16, 10, 18, 13, 19, 9, 7, 5, 8, 21, 22, 11, 20, 15, 12, 23}), - new PuzzleState(new int[]{5, 11, 9, 0, 3, 8, 14, -1, 6, 4, 1, 13, 7, 2, 19, 10, 21, 18, 23, 17, 15, 20, 12, 16, 22}), - new PuzzleState(new int[]{2, 0, 14, -1, 4, 18, 1, 10, 12, 13, 5, 9, 11, 22, 7, 15, 8, 17, 19, 3, 20, 21, 6, 16, 23}), - new PuzzleState(new int[]{0, 1, 13, 9, 2, 6, 8, 22, 3, 4, 12, 16, 10, 7, 19, -1, 5, 11, 14, 17, 15, 20, 21, 18, 23}), - new PuzzleState(new int[]{0, 13, 17, 8, 3, 5, 1, 12, 14, 4, 10, -1, 6, 7, 9, 15, 23, 2, 16, 19, 20, 11, 21, 22, 18}), - new PuzzleState(new int[]{5, 10, 7, 2, 9, 15, 0, -1, 1, 3, 18, 4, 17, 12, 14, 21, 11, 6, 8, 23, 20, 16, 22, 19, 13}), - new PuzzleState(new int[]{0, 3, 1, 2, 4, 10, 5, 7, 8, 9, 11, 6, 21, 13, 12, 20, 17, -1, 14, 19, 22, 18, 15, 16, 23}), - new PuzzleState(new int[]{0, 2, 7, 11, 13, 3, 14, 1, 4, 9, 5, -1, 12, 8, 18, 20, 10, 15, 22, 23, 17, 16, 6, 21, 19}), - new PuzzleState(new int[]{0, 16, 3, 22, 7, 11, 6, -1, 9, 4, 2, 1, 13, 12, 18, 5, 10, 8, 19, 14, 15, 20, 17, 23, 21}), - new PuzzleState(new int[]{0, 13, 5, 12, 3, 2, 10, 4, 6, 8, 1, 21, 19, 14, 9, 17, 23, 22, 16, 11, 15, 7, 20, -1, 18}), - new PuzzleState(new int[]{14, 5, 6, 12, 4, 10, 20, 1, 0, 23, 2, 16, 13, 19, 3, 15, 22, -1, 9, 8, 11, 7, 18, 17, 21}), - new PuzzleState(new int[]{0, 1, 2, 4, 7, 5, 11, -1, 18, 8, 16, 10, 12, 13, 3, 17, 6, 21, 23, 9, 15, 20, 22, 14, 19}), - new PuzzleState(new int[]{1, 6, 7, 3, 4, 5, 17, 0, 22, 12, 10, 15, 8, -1, 14, 11, 13, 16, 18, 19, 20, 2, 21, 9, 23}), - }; - - private static final int[] FINISHED_STATE = new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, -1}; - - @Test - public void testSolverMM() - { - for (PuzzleState state : START_STATES_MM) - { - PuzzleSolver solver = new PuzzleSolver(new IDAStarMM(new ManhattanDistance()), state); - solver.run(); - - assertTrue(solver.hasSolution()); - assertFalse(solver.hasFailed()); - assertTrue(solver.getStep(solver.getStepCount() - 1).hasPieces(FINISHED_STATE)); - } - } - - @Test - public void testSolver() - { - for (PuzzleState state : START_STATES) - { - PuzzleSolver solver = new PuzzleSolver(new IDAStar(new ManhattanDistance()), state); - solver.run(); - - assertTrue(solver.hasSolution()); - assertFalse(solver.hasFailed()); - assertTrue(solver.getStep(solver.getStepCount() - 1).hasPieces(FINISHED_STATE)); - } - } -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/puzzlesolver/lightbox/LightboxSolverTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/puzzlesolver/lightbox/LightboxSolverTest.java deleted file mode 100644 index 7b6fefc4f1..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/puzzlesolver/lightbox/LightboxSolverTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2018, 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.puzzlesolver.lightbox; - -import static org.junit.Assert.assertEquals; -import org.junit.Test; - -public class LightboxSolverTest -{ - private static final int[] INITIAL = new int[]{ - 1, 0, 1, 0, 0, - 0, 1, 0, 1, 0, - 0, 1, 1, 1, 0, - 0, 1, 0, 1, 0, - 1, 0, 1, 0, 1 - }; - - private static final int[] A = new int[]{ - 0, 1, 0, 0, 0, - 0, 0, 0, 0, 1, - 0, 1, 0, 1, 0, - 0, 0, 0, 1, 0, - 0, 0, 0, 0, 1 - }; - - private static final int[] B = new int[]{ - 0, 1, 0, 0, 0, - 1, 0, 0, 0, 1, - 0, 0, 0, 1, 0, - 1, 1, 0, 1, 0, - 0, 0, 0, 1, 1, - }; - - private static final int[] C = new int[]{ - 0, 1, 0, 0, 0, - 1, 0, 0, 0, 1, - 1, 1, 0, 0, 0, - 0, 1, 0, 0, 0, - 0, 0, 0, 0, 1, - }; - - private static final int[] D = new int[]{ - 1, 1, 0, 0, 0, - 1, 0, 1, 0, 1, - 1, 1, 0, 1, 1, - 0, 1, 1, 0, 0, - 1, 0, 0, 1, 1, - }; - - private static final int[] E = new int[]{ - 1, 0, 0, 1, 0, - 1, 1, 1, 0, 1, - 1, 1, 0, 1, 0, - 0, 0, 1, 0, 0, - 1, 0, 0, 1, 1, - }; - - private static final int[] F = new int[]{ - 1, 0, 0, 1, 0, - 1, 0, 0, 0, 1, - 1, 0, 1, 1, 0, - 0, 0, 1, 0, 0, - 1, 0, 0, 0, 0, - }; - - private static final int[] G = new int[]{ - 1, 0, 0, 1, 1, - 1, 1, 1, 0, 0, - 0, 1, 1, 1, 0, - 0, 0, 0, 0, 1, - 1, 1, 0, 0, 0, - }; - - private static final int[] H = new int[]{ - 1, 0, 1, 1, 1, - 1, 1, 1, 0, 0, - 0, 1, 1, 1, 0, - 1, 1, 0, 0, 1, - 1, 0, 0, 1, 0 - }; - - private static LightboxState fromArray(int[] array) - { - LightboxState s = new LightboxState(); - - assert array.length == 25; - for (int i = 0; i < array.length; ++i) - { - s.setState(i / 5, i % 5, array[i] != 0); - } - - return s; - } - - @Test - public void test() - { - LightboxSolver solver = new LightboxSolver(); - - solver.setInitial(fromArray(INITIAL)); - solver.setSwitchChange(Combination.A, fromArray(A)); - solver.setSwitchChange(Combination.B, fromArray(B)); - solver.setSwitchChange(Combination.C, fromArray(C)); - solver.setSwitchChange(Combination.D, fromArray(D)); - solver.setSwitchChange(Combination.E, fromArray(E)); - solver.setSwitchChange(Combination.F, fromArray(F)); - solver.setSwitchChange(Combination.G, fromArray(G)); - solver.setSwitchChange(Combination.H, fromArray(H)); - - LightboxSolution solution = solver.solve(); - - LightboxSolution expected = new LightboxSolution(); - expected.flip(Combination.A); - expected.flip(Combination.B); - expected.flip(Combination.D); - expected.flip(Combination.E); - expected.flip(Combination.F); - expected.flip(Combination.G); - - assertEquals(expected, solution); - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersPluginTest.java deleted file mode 100644 index 3b3df9f784..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersPluginTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2018, 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.reorderprayers; - -import net.runelite.api.Prayer; -import static net.runelite.api.Prayer.*; -import static org.junit.Assert.assertArrayEquals; -import org.junit.Test; - -public class ReorderPrayersPluginTest -{ - private static final Prayer[] PRAYER_ORDER = new Prayer[]{ - THICK_SKIN, - BURST_OF_STRENGTH, - CLARITY_OF_THOUGHT, - SHARP_EYE, - MYSTIC_WILL, - ROCK_SKIN, - SUPERHUMAN_STRENGTH, - IMPROVED_REFLEXES, - RAPID_RESTORE, - RAPID_HEAL, - PROTECT_ITEM, - HAWK_EYE, - MYSTIC_LORE, - STEEL_SKIN, - ULTIMATE_STRENGTH, - INCREDIBLE_REFLEXES, - PROTECT_FROM_MAGIC, - PROTECT_FROM_MISSILES, - PROTECT_FROM_MELEE, - EAGLE_EYE, - MYSTIC_MIGHT, - RETRIBUTION, - REDEMPTION, - SMITE, - CHIVALRY, - PIETY, - PRESERVE, - RIGOUR, - AUGURY - }; - - @Test - public void testPrayerOrder() - { - // the reorder prayers plugin depends on the Prayer enum order - assertArrayEquals(Prayer.values(), PRAYER_ORDER); - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java deleted file mode 100644 index 5c199b2b09..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/screenshot/ScreenshotPluginTest.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (c) 2018, 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.screenshot; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import java.util.concurrent.ScheduledExecutorService; -import java.util.function.Consumer; -import javax.inject.Inject; -import static net.runelite.api.ChatMessageType.GAMEMESSAGE; -import net.runelite.api.Client; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.widgets.Widget; -import static net.runelite.api.widgets.WidgetID.DIALOG_SPRITE_GROUP_ID; -import static net.runelite.api.widgets.WidgetID.LEVEL_UP_GROUP_ID; -import static net.runelite.api.widgets.WidgetInfo.DIALOG_SPRITE_TEXT; -import static net.runelite.api.widgets.WidgetInfo.LEVEL_UP_LEVEL; -import net.runelite.client.Notifier; -import net.runelite.client.config.OpenOSRSConfig; -import net.runelite.client.config.RuneLiteConfig; -import net.runelite.client.ui.ClientUI; -import net.runelite.client.ui.DrawManager; -import static org.junit.Assert.assertEquals; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -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.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class ScreenshotPluginTest -{ - private static final String CLUE_SCROLL = "You have completed 28 medium Treasure Trails"; - private static final String BARROWS_CHEST = "Your Barrows chest count is 310"; - private static final String CHAMBERS_OF_XERIC_CHEST = "Your completed Chambers of Xeric count is: 489."; - private static final String THEATRE_OF_BLOOD_CHEST = "Your completed Theatre of Blood count is: 73."; - private static final String VALUABLE_DROP = "Valuable drop: 6 x Bronze arrow (42 coins)"; - private static final String UNTRADEABLE_DROP = "Untradeable drop: Rusty sword"; - - @Mock - @Bind - private Client client; - - @Inject - private ScreenshotPlugin screenshotPlugin; - - @Mock - @Bind - private ScreenshotConfig screenshotConfig; - - @Mock - @Bind - Notifier notifier; - - @Mock - @Bind - ClientUI clientUi; - - @Mock - @Bind - DrawManager drawManager; - - @Mock - @Bind - RuneLiteConfig config; - - @Mock - @Bind - ScheduledExecutorService service; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - screenshotPlugin.setScreenshotRewards(true); - screenshotPlugin.setScreenshotLevels(true); - screenshotPlugin.setScreenshotValuableDrop(true); - screenshotPlugin.setScreenshotUntradeableDrop(true); - } - - @Test - public void testClueScroll() - { - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Seth", CLUE_SCROLL, null, 0); - screenshotPlugin.onChatMessage(chatMessageEvent); - - assertEquals("medium", screenshotPlugin.getClueType()); - assertEquals(28, screenshotPlugin.getClueNumber()); - } - - @Test - public void testBarrowsChest() - { - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Seth", BARROWS_CHEST, null, 0); - screenshotPlugin.onChatMessage(chatMessageEvent); - - assertEquals(310, screenshotPlugin.getBarrowsNumber()); - } - - @Test - public void testChambersOfXericChest() - { - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Seth", CHAMBERS_OF_XERIC_CHEST, null, 0); - screenshotPlugin.onChatMessage(chatMessageEvent); - - assertEquals(489, screenshotPlugin.getChambersOfXericNumber()); - } - - @Test - public void testTheatreOfBloodChest() - { - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Magic fTail", THEATRE_OF_BLOOD_CHEST, null, 0); - screenshotPlugin.onChatMessage(chatMessageEvent); - - assertEquals(73, screenshotPlugin.gettheatreOfBloodNumber()); - } - - @SuppressWarnings("unchecked") - @Test - public void testValuableDrop() - { - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", VALUABLE_DROP, null, 0); - screenshotPlugin.onChatMessage(chatMessageEvent); - - verify(drawManager).requestNextFrameListener(any(Consumer.class)); - } - - @SuppressWarnings("unchecked") - @Test - public void testUntradeableDrop() - { - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", UNTRADEABLE_DROP, null, 0); - screenshotPlugin.onChatMessage(chatMessageEvent); - - verify(drawManager).requestNextFrameListener(any(Consumer.class)); - } - - @SuppressWarnings("unchecked") - @Test - public void testHitpointsLevel99() - { - Widget levelChild = mock(Widget.class); - when(client.getWidget(eq(LEVEL_UP_LEVEL))).thenReturn(levelChild); - - when(levelChild.getText()).thenReturn("Your Hitpoints are now 99."); - - assertEquals("Hitpoints(99)", screenshotPlugin.parseLevelUpWidget(client.getWidget(LEVEL_UP_LEVEL))); - - WidgetLoaded event = new WidgetLoaded(); - event.setGroupId(LEVEL_UP_GROUP_ID); - screenshotPlugin.onWidgetLoaded(event); - - GameTick tick = GameTick.INSTANCE; - screenshotPlugin.onGameTick(tick); - - verify(drawManager).requestNextFrameListener(any(Consumer.class)); - } - - @SuppressWarnings("unchecked") - @Test - public void testFiremakingLevel9() - { - Widget levelChild = mock(Widget.class); - when(client.getWidget(eq(LEVEL_UP_LEVEL))).thenReturn(levelChild); - - when(levelChild.getText()).thenReturn("Your Firemaking level is now 9."); - - assertEquals("Firemaking(9)", screenshotPlugin.parseLevelUpWidget(client.getWidget(LEVEL_UP_LEVEL))); - - WidgetLoaded event = new WidgetLoaded(); - event.setGroupId(LEVEL_UP_GROUP_ID); - screenshotPlugin.onWidgetLoaded(event); - - GameTick tick = GameTick.INSTANCE; - screenshotPlugin.onGameTick(tick); - - verify(drawManager).requestNextFrameListener(any(Consumer.class)); - } - - @SuppressWarnings("unchecked") - @Test - public void testAttackLevel70() - { - Widget levelChild = mock(Widget.class); - when(client.getWidget(eq(LEVEL_UP_LEVEL))).thenReturn(levelChild); - - when(levelChild.getText()).thenReturn("Your Attack level is now 70."); - - assertEquals("Attack(70)", screenshotPlugin.parseLevelUpWidget(client.getWidget(LEVEL_UP_LEVEL))); - - WidgetLoaded event = new WidgetLoaded(); - event.setGroupId(LEVEL_UP_GROUP_ID); - screenshotPlugin.onWidgetLoaded(event); - - GameTick tick = GameTick.INSTANCE; - screenshotPlugin.onGameTick(tick); - - verify(drawManager).requestNextFrameListener(any(Consumer.class)); - } - - @SuppressWarnings("unchecked") - @Test - public void testHunterLevel2() - { - Widget levelChild = mock(Widget.class); - when(client.getWidget(eq(DIALOG_SPRITE_TEXT))).thenReturn(levelChild); - - when(levelChild.getText()).thenReturn("Congratulations, you've just advanced a Hunter level.

    Your Hunter level is now 2."); - - assertEquals("Hunter(2)", screenshotPlugin.parseLevelUpWidget(client.getWidget(DIALOG_SPRITE_TEXT))); - - WidgetLoaded event = new WidgetLoaded(); - event.setGroupId(DIALOG_SPRITE_GROUP_ID); - screenshotPlugin.onWidgetLoaded(event); - - GameTick tick = GameTick.INSTANCE; - screenshotPlugin.onGameTick(tick); - - verify(drawManager).requestNextFrameListener(any(Consumer.class)); - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/skybox/SkyboxTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/skybox/SkyboxTest.java deleted file mode 100644 index 6787759ead..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/skybox/SkyboxTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2019 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.skybox; - -import com.google.common.base.Strings; -import com.google.common.io.CharSource; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import javax.imageio.ImageIO; -import lombok.extern.slf4j.Slf4j; -import org.junit.Assert; -import org.junit.Test; - -@Slf4j -public class SkyboxTest -{ - @Test - public void testLoadSimple() throws IOException - { - Skybox skybox = new Skybox(CharSource.wrap("bounds 0 0 100 100 #00F // R 0 0 100 100\r\nr 99 99").openStream(), "simple"); - Assert.assertEquals(0, skybox.getColorForPoint(0, 0, 0, 0, 0, 1, null)); - int x = (99 * 64) + 32; - int y = (99 * 64) + 32; - Assert.assertEquals(0x0000FF, skybox.getColorForPoint(x, y, x, y, 0, 1, null)); - } - - @Test - public void testLoadActual() throws IOException - { - long start = System.nanoTime(); - Skybox skybox = new Skybox(SkyboxPlugin.class.getResourceAsStream("skybox.txt"), "skybox.txt"); - log.info("Parse took {}ms", (System.nanoTime() - start) / 1_000_000); - - String skyboxFile = System.getProperty("skyboxExport"); - if (!Strings.isNullOrEmpty(skyboxFile)) - { - start = System.nanoTime(); - BufferedImage img = skybox.render(1f, 0, 0, null); - long time = System.nanoTime() - start; - log.info("Map render took {}ms", time / 1_000_000); - log.info("Single render takes ~{}ns/frame", time / (img.getWidth() * img.getHeight())); - ImageIO.write(img, "png", new File(skyboxFile)); - } - - Assert.assertNotEquals(skybox.getColorForPoint(3232, 3232, 3232, 3232, 0, .9, null), 0); // Lumbridge will never be black - } -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java deleted file mode 100644 index 43050ae12b..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java +++ /dev/null @@ -1,651 +0,0 @@ -/* - * Copyright (c) 2017, 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.slayer; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import java.io.IOException; -import java.util.concurrent.ScheduledExecutorService; -import javax.inject.Inject; -import net.runelite.api.ChatMessageType; -import static net.runelite.api.ChatMessageType.GAMEMESSAGE; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.MessageNode; -import net.runelite.api.Player; -import net.runelite.api.Skill; -import net.runelite.api.Varbits; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.events.ChatMessage; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.StatChanged; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.Notifier; -import net.runelite.client.chat.ChatCommandManager; -import net.runelite.client.chat.ChatMessageManager; -import net.runelite.client.config.OpenOSRSConfig; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; -import net.runelite.http.api.chat.ChatClient; -import static org.junit.Assert.assertEquals; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import org.mockito.Mock; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class SlayerPluginTest -{ - private static final String TASK_NEW = "Your new task is to kill 231 Suqahs."; - private static final String TASK_NEW_KONAR = "You are to bring balance to 147 Wyrms in the Karuulm Slayer Dungeon."; - private static final String TASK_NEW_KONAR_2 = "You are to bring balance to 142 Hellhounds in Witchhaven Dungeon."; - private static final String TASK_NEW_KONAR_3 = "You are to bring balance to 135 Trolls south of Mount Quidamortem."; - private static final String TASK_NEW_FIRST = "We'll start you off hunting goblins, you'll need to kill 17 of them."; - private static final String TASK_NEW_FIRST_KONAR = "We'll start you off bringing balance to cows, you'll need to kill 44 of them."; - private static final String TASK_NEW_NPC_CONTACT = "Excellent, you're doing great. Your new task is to kill
    211 Suqahs."; - private static final String TASK_NEW_FROM_PARTNER = "You have received a new Slayer assignment from breaklulz: Dust Devils (377)"; - private static final String TASK_CHECKSLAYERGEM = "You're assigned to kill Suqahs; only 211 more to go."; - private static final String TASK_CHECKSLAYERGEM_WILDERNESS = "You're assigned to kill Suqahs in the Wilderness; only 211 more to go."; - private static final String TASK_CHECKSLAYERGEM_KONAR = "You're assigned to kill Blue dragons in the Ogre Enclave; only 122 more to go."; - - private static final String TASK_BOSS_NEW = "Excellent. You're now assigned to kill Vet'ion 3 times.
    Your reward point tally is 914."; - private static final String TASK_BOSS_NEW_THE = "Excellent. You're now assigned to kill the Chaos
    Elemental 3 times. Your reward point tally is 914."; - - private static final String TASK_EXISTING = "You're still hunting suqahs; you have 222 to go. Come
    back when you've finished your task."; - - private static final String REWARD_POINTS = "Reward points: 17,566"; - - private static final String TASK_ONE = "You've completed one task; return to a Slayer master."; - private static final String TASK_COMPLETE_NO_POINTS = "You've completed 3 tasks; return to a Slayer master."; - private static final String TASK_POINTS = "You've completed 9 tasks and received 0 points, giving you a total of 18,000; return to a Slayer master."; - private static final String TASK_LARGE_STREAK = "You've completed 2,465 tasks and received 15 points, giving you a total of 17,566,000; return to a Slayer master."; - - private static final String TASK_COMPLETE = "You need something new to hunt."; - private static final String TASK_CANCELED = "Your task has been cancelled."; - - private static final String SUPERIOR_MESSAGE = "A superior foe has appeared..."; - - @Mock - @Bind - Client client; - - @Mock - @Bind - SlayerConfig slayerConfig; - - @Mock - @Bind - OverlayManager overlayManager; - - @Mock - @Bind - SlayerOverlay overlay; - - @Mock - @Bind - InfoBoxManager infoBoxManager; - - @Mock - @Bind - ItemManager itemManager; - - @Mock - @Bind - Notifier notifier; - - @Mock - @Bind - ChatMessageManager chatMessageManager; - - @Mock - @Bind - ChatCommandManager chatCommandManager; - - @Mock - @Bind - ScheduledExecutorService executor; - - @Mock - @Bind - ChatClient chatClient; - - @Inject - SlayerPlugin slayerPlugin; - - @Mock - @Bind - SlayerTaskPanel panel; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - @Test - public void testNewTask() - { - Widget npcDialog = mock(Widget.class); - when(npcDialog.getText()).thenReturn(TASK_NEW); - when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(GameTick.INSTANCE); - - assertEquals("Suqahs", slayerPlugin.getCurrentTask().getTaskName()); - assertEquals(231, slayerPlugin.getCurrentTask().getAmount()); - } - - @Test - public void testNewKonarTask() - { - Widget npcDialog = mock(Widget.class); - when(npcDialog.getText()).thenReturn(TASK_NEW_KONAR); - when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(GameTick.INSTANCE); - - assertEquals("Wyrms", slayerPlugin.getCurrentTask().getTaskName()); - assertEquals(147, slayerPlugin.getCurrentTask().getAmount()); - assertEquals("Karuulm Slayer Dungeon", slayerPlugin.getCurrentTask().getTaskLocation()); - } - - @Test - public void testNewKonarTask2() - { - Widget npcDialog = mock(Widget.class); - when(npcDialog.getText()).thenReturn(TASK_NEW_KONAR_2); - when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(GameTick.INSTANCE); - - assertEquals("Hellhounds", slayerPlugin.getCurrentTask().getTaskName()); - assertEquals(142, slayerPlugin.getCurrentTask().getAmount()); - assertEquals("Witchhaven Dungeon", slayerPlugin.getCurrentTask().getTaskLocation()); - } - - @Test - public void testNewKonarTask3() - { - Widget npcDialog = mock(Widget.class); - when(npcDialog.getText()).thenReturn(TASK_NEW_KONAR_3); - when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(GameTick.INSTANCE); - - assertEquals("Trolls", slayerPlugin.getCurrentTask().getTaskName()); - assertEquals(135, slayerPlugin.getCurrentTask().getAmount()); - assertEquals("Mount Quidamortem", slayerPlugin.getCurrentTask().getTaskLocation()); - } - - @Test - public void testFirstTask() - { - Widget npcDialog = mock(Widget.class); - when(npcDialog.getText()).thenReturn(TASK_NEW_FIRST); - when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(GameTick.INSTANCE); - - assertEquals("goblins", slayerPlugin.getCurrentTask().getTaskName()); - assertEquals(17, slayerPlugin.getCurrentTask().getAmount()); - } - - @Test - public void testFirstTaskKonar() - { - Widget npcDialog = mock(Widget.class); - when(npcDialog.getText()).thenReturn(TASK_NEW_FIRST_KONAR); - when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(GameTick.INSTANCE); - - assertEquals("cows", slayerPlugin.getCurrentTask().getTaskName()); - assertEquals(44, slayerPlugin.getCurrentTask().getAmount()); - } - - @Test - public void testNewNpcContactTask() - { - Widget npcDialog = mock(Widget.class); - when(npcDialog.getText()).thenReturn(TASK_NEW_NPC_CONTACT); - when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(GameTick.INSTANCE); - - assertEquals("Suqahs", slayerPlugin.getCurrentTask().getTaskName()); - assertEquals(211, slayerPlugin.getCurrentTask().getAmount()); - } - - @Test - public void testBossTask() - { - Widget npcDialog = mock(Widget.class); - when(npcDialog.getText()).thenReturn(TASK_BOSS_NEW); - when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(GameTick.INSTANCE); - - assertEquals("Vet'ion", slayerPlugin.getCurrentTask().getTaskName()); - assertEquals(3, slayerPlugin.getCurrentTask().getAmount()); - assertEquals(914, slayerPlugin.getPoints()); - } - - @Test - public void testBossTaskThe() - { - Widget npcDialog = mock(Widget.class); - when(npcDialog.getText()).thenReturn(TASK_BOSS_NEW_THE); - when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(GameTick.INSTANCE); - - assertEquals("Chaos Elemental", slayerPlugin.getCurrentTask().getTaskName()); - assertEquals(3, slayerPlugin.getCurrentTask().getAmount()); - assertEquals(914, slayerPlugin.getPoints()); - } - - @Test - public void testPartnerTask() - { - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", TASK_NEW_FROM_PARTNER, null, 0); - slayerPlugin.onChatMessage(chatMessageEvent); - - assertEquals("Dust Devils", slayerPlugin.getCurrentTask().getTaskName()); - assertEquals(377, slayerPlugin.getCurrentTask().getAmount()); - } - - @Test - public void testCheckSlayerGem() - { - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", TASK_CHECKSLAYERGEM, null, 0); - slayerPlugin.onChatMessage(chatMessageEvent); - assertEquals("Suqahs", slayerPlugin.getCurrentTask().getTaskName()); - assertEquals(211, slayerPlugin.getCurrentTask().getAmount()); - } - - @Test - public void testCheckSlayerGemWildernessTask() - { - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", TASK_CHECKSLAYERGEM_WILDERNESS, null, 0); - slayerPlugin.onChatMessage(chatMessageEvent); - assertEquals("Suqahs", slayerPlugin.getCurrentTask().getTaskName()); - assertEquals(211, slayerPlugin.getCurrentTask().getAmount()); - assertEquals("Wilderness", slayerPlugin.getCurrentTask().getTaskLocation()); - } - - @Test - public void testCheckSlayerGemKonarTask() - { - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", TASK_CHECKSLAYERGEM_KONAR, null, 0); - slayerPlugin.onChatMessage(chatMessageEvent); - - assertEquals("Blue dragons", slayerPlugin.getCurrentTask().getTaskName()); - assertEquals(122, slayerPlugin.getCurrentTask().getAmount()); - assertEquals("Ogre Enclave", slayerPlugin.getCurrentTask().getTaskLocation()); - } - - @Test - public void testExistingTask() - { - Widget npcDialog = mock(Widget.class); - when(npcDialog.getText()).thenReturn(TASK_EXISTING); - when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog); - slayerPlugin.onGameTick(GameTick.INSTANCE); - - assertEquals("suqahs", slayerPlugin.getCurrentTask().getTaskName()); - assertEquals(222, slayerPlugin.getCurrentTask().getAmount()); - } - - @Test - public void testOneTask() - { - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Perterter", TASK_ONE, null, 0); - slayerPlugin.onChatMessage(chatMessageEvent); - - assertEquals(1, slayerPlugin.getStreak()); - assertEquals("", slayerPlugin.getCurrentTask().getTaskName()); - assertEquals(0, slayerPlugin.getCurrentTask().getAmount()); - } - - @Test - public void testNoPoints() - { - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Perterter", TASK_COMPLETE_NO_POINTS, null, 0); - slayerPlugin.onChatMessage(chatMessageEvent); - - assertEquals(3, slayerPlugin.getStreak()); - assertEquals("", slayerPlugin.getCurrentTask().getTaskName()); - assertEquals(0, slayerPlugin.getCurrentTask().getAmount()); - } - - @Test - public void testPoints() - { - when(client.getVar(Varbits.SLAYER_REWARD_POINTS)).thenReturn(18_000); - - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Perterter", TASK_POINTS, null, 0); - slayerPlugin.onChatMessage(chatMessageEvent); - VarbitChanged varbitChanged = new VarbitChanged(); - slayerPlugin.onVarbitChanged(varbitChanged); - - assertEquals(9, slayerPlugin.getStreak()); - assertEquals("", slayerPlugin.getCurrentTask().getTaskName()); - assertEquals(0, slayerPlugin.getCurrentTask().getAmount()); - assertEquals(18_000, slayerPlugin.getPoints()); - } - - @Test - public void testLargeStreak() - { - when(client.getVar(Varbits.SLAYER_REWARD_POINTS)).thenReturn(17_566_000); - - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Perterter", TASK_LARGE_STREAK, null, 0); - slayerPlugin.onChatMessage(chatMessageEvent); - VarbitChanged varbitChanged = new VarbitChanged(); - slayerPlugin.onVarbitChanged(varbitChanged); - - assertEquals(2465, slayerPlugin.getStreak()); - assertEquals("", slayerPlugin.getCurrentTask().getTaskName()); - assertEquals(0, slayerPlugin.getCurrentTask().getAmount()); - assertEquals(17_566_000, slayerPlugin.getPoints()); - } - - @Test - public void testComplete() - { - slayerPlugin.getCurrentTask().setTaskName("cows"); - slayerPlugin.getCurrentTask().setAmount(42); - - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Perterter", TASK_COMPLETE, null, 0); - slayerPlugin.onChatMessage(chatMessageEvent); - - assertEquals("", slayerPlugin.getCurrentTask().getTaskName()); - assertEquals(0, slayerPlugin.getCurrentTask().getAmount()); - } - - @Test - public void testCancelled() - { - slayerPlugin.getCurrentTask().setTaskName("cows"); - slayerPlugin.getCurrentTask().setAmount(42); - - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Perterter", TASK_CANCELED, null, 0); - slayerPlugin.onChatMessage(chatMessageEvent); - - assertEquals("", slayerPlugin.getCurrentTask().getTaskName()); - assertEquals(0, slayerPlugin.getCurrentTask().getAmount()); - } - - @Test - public void testSuperiorNotification() - { - ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Superior", SUPERIOR_MESSAGE, null, 0); - - slayerPlugin.setShowSuperiorNotification(true); - slayerPlugin.onChatMessage(chatMessageEvent); - verify(notifier).notify(SUPERIOR_MESSAGE); - - slayerPlugin.setShowSuperiorNotification(false); - slayerPlugin.onChatMessage(chatMessageEvent); - verifyNoMoreInteractions(notifier); - } - - @Test - public void testTaskLookup() throws IOException - { - net.runelite.http.api.chat.Task task = new net.runelite.http.api.chat.Task(); - task.setTask("Abyssal demons"); - task.setLocation("Abyss"); - task.setAmount(42); - task.setInitialAmount(42); - - slayerPlugin.setTaskCommand(true); - when(chatClient.getTask(anyString())).thenReturn(task); - - ChatMessage setMessage = new ChatMessage(); - setMessage.setType(ChatMessageType.PUBLICCHAT); - setMessage.setName("Adam"); - setMessage.setMessageNode(mock(MessageNode.class)); - - slayerPlugin.taskLookup(setMessage, "!task"); - - verify(chatMessageManager).update(any(MessageNode.class)); - } - - @Test - public void testTaskLookupInvalid() - { - net.runelite.http.api.chat.Task task = new net.runelite.http.api.chat.Task(); - task.setTask("task<"); - task.setLocation("loc"); - task.setAmount(42); - task.setInitialAmount(42); - - ChatMessage chatMessage = new ChatMessage(); - chatMessage.setType(ChatMessageType.PUBLICCHAT); - chatMessage.setName("Adam"); - chatMessage.setMessageNode(mock(MessageNode.class)); - - slayerPlugin.taskLookup(chatMessage, "!task"); - - verify(chatMessageManager, never()).update(any(MessageNode.class)); - } - - @Test - public void testSuperiorsLowercase() - { - for (String name : SlayerPlugin.SUPERIOR_SLAYER_MONSTERS) - { - assertEquals(name, name.toLowerCase()); - } - } - - @Test - public void testCorrectlyCapturedTaskKill() - { - final Player player = mock(Player.class); - when(player.getLocalLocation()).thenReturn(new LocalPoint(0, 0)); - when(client.getLocalPlayer()).thenReturn(player); - - StatChanged statChanged = new StatChanged( - Skill.SLAYER, - 100, - 2, - 2 - ); - slayerPlugin.onStatChanged(statChanged); - - slayerPlugin.setTask("Dagannoth", 143, 143, true, 0); - - statChanged = new StatChanged( - Skill.SLAYER, - 110, - 2, - 2 - ); - slayerPlugin.onStatChanged(statChanged); - - assertEquals(142, slayerPlugin.getCurrentTask().getAmount()); - } - - @Test - public void testIncorrectlyCapturedTaskKill() - { - final Player player = mock(Player.class); - when(player.getLocalLocation()).thenReturn(new LocalPoint(0, 0)); - when(client.getLocalPlayer()).thenReturn(player); - - StatChanged statChanged = new StatChanged( - Skill.SLAYER, - 100, - 2, - 2 - ); - slayerPlugin.onStatChanged(statChanged); - - slayerPlugin.setTask("Monster", 98, 98, true, 0); - assert Task.getTask("Monster") == null; - - statChanged = new StatChanged( - Skill.SLAYER, - 110, - 2, - 2 - ); - slayerPlugin.onStatChanged(statChanged); - - assertEquals(97, slayerPlugin.getCurrentTask().getAmount()); - } - - @Test - public void testJadTaskKill() - { - final Player player = mock(Player.class); - when(player.getLocalLocation()).thenReturn(new LocalPoint(0, 0)); - when(client.getLocalPlayer()).thenReturn(player); - - StatChanged statChanged = new StatChanged( - Skill.SLAYER, - 100, - 2, - 2 - ); - slayerPlugin.onStatChanged(statChanged); - - slayerPlugin.setTask("TzTok-Jad", 1, 1, true, 0); - - // One bat kill - statChanged = new StatChanged( - Skill.SLAYER, - 110, - 2, - 2 - ); - slayerPlugin.onStatChanged(statChanged); - - assertEquals(1, slayerPlugin.getCurrentTask().getAmount()); - - // One Jad kill - statChanged = new StatChanged( - Skill.SLAYER, - 25360, - -1, - -1 - ); - slayerPlugin.onStatChanged(statChanged); - - assertEquals(0, slayerPlugin.getCurrentTask().getAmount()); - } - - @Test - public void testZukTaskKill() - { - final Player player = mock(Player.class); - when(player.getLocalLocation()).thenReturn(new LocalPoint(0, 0)); - when(client.getLocalPlayer()).thenReturn(player); - - StatChanged statChanged = new StatChanged( - Skill.SLAYER, - 110, - 2, - 2 - ); - slayerPlugin.onStatChanged(statChanged); - - slayerPlugin.setTask("TzKal-Zuk", 1, 1, true, 0); - - // One bat kill - statChanged = new StatChanged( - Skill.SLAYER, - 125, - 2, - 2 - ); - slayerPlugin.onStatChanged(statChanged); - - assertEquals(1, slayerPlugin.getCurrentTask().getAmount()); - - // One Zuk kill - statChanged = new StatChanged( - Skill.SLAYER, - 102_015, - -1, - -1 - ); - slayerPlugin.onStatChanged(statChanged); - - assertEquals(0, slayerPlugin.getCurrentTask().getAmount()); - } - - @Test - public void testNewAccountSlayerKill() - { - final Player player = mock(Player.class); - when(player.getLocalLocation()).thenReturn(new LocalPoint(0, 0)); - when(client.getLocalPlayer()).thenReturn(player); - - slayerPlugin.setTask("Bears", 35, 35, true, 0); - - StatChanged statChanged = new StatChanged( - Skill.SLAYER, - 0, - 1, - 1 - ); - slayerPlugin.onStatChanged(statChanged); - - statChanged = new StatChanged( - Skill.SLAYER, - 27, - 1, - 1 - ); - slayerPlugin.onStatChanged(statChanged); - - assertEquals(34, slayerPlugin.getCurrentTask().getAmount()); - } - - @Test - public void infoboxNotAddedOnLogin() - { - GameStateChanged loggingIn = new GameStateChanged(); - loggingIn.setGameState(GameState.LOGGING_IN); - slayerPlugin.onGameStateChanged(loggingIn); - - GameStateChanged loggedIn = new GameStateChanged(); - loggedIn.setGameState(GameState.LOGGED_IN); - slayerPlugin.onGameStateChanged(loggedIn); - - verify(infoBoxManager, never()).addInfoBox(any()); - } -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/smelting/SmeltingPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/smelting/SmeltingPluginTest.java deleted file mode 100644 index 6bc033e300..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/smelting/SmeltingPluginTest.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2019, Stephen - * 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.smelting; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import javax.inject.Inject; -import net.runelite.api.ChatMessageType; -import net.runelite.api.events.ChatMessage; -import net.runelite.client.config.OpenOSRSConfig; -import net.runelite.client.ui.overlay.OverlayManager; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class SmeltingPluginTest -{ - private static final String SMELT_CANNONBALL = "You remove the cannonballs from the mould"; - private static final String SMELT_BAR = "You retrieve a bar of steel."; - - @Inject - SmeltingPlugin smeltingPlugin; - - @Mock - @Bind - SmeltingConfig config; - - @Mock - @Bind - SmeltingOverlay smeltingOverlay; - - @Mock - @Bind - OverlayManager overlayManager; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - @Test - public void testCannonballs() - { - ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", SMELT_CANNONBALL, "", 0); - smeltingPlugin.onChatMessage(chatMessage); - - SmeltingSession smeltingSession = smeltingPlugin.getSession(); - assertNotNull(smeltingSession); - assertEquals(4, smeltingSession.getCannonBallsSmelted()); - } - - @Test - public void testBars() - { - ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", SMELT_BAR, "", 0); - smeltingPlugin.onChatMessage(chatMessage); - - SmeltingSession smeltingSession = smeltingPlugin.getSession(); - assertNotNull(smeltingSession); - assertEquals(1, smeltingSession.getBarsSmelted()); - } -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/timers/TimersPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/timers/TimersPluginTest.java deleted file mode 100644 index fda280c0b9..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/timers/TimersPluginTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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.timers; - -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 java.util.EnumSet; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.WorldType; -import net.runelite.api.events.ChatMessage; -import net.runelite.client.config.OpenOSRSConfig; -import net.runelite.client.game.ItemManager; -import net.runelite.client.game.SpriteManager; -import net.runelite.client.ui.overlay.infobox.InfoBox; -import net.runelite.client.ui.overlay.infobox.InfoBoxManager; -import static org.junit.Assert.assertEquals; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class TimersPluginTest -{ - private static final String DMM_HALF_TELEBLOCK_MESSAGE = "A Tele Block spell has been cast on you by Runelite. It will expire in 1 minute, 15 seconds."; - private static final String FULL_TELEBLOCK_MESSAGE = "A Tele Block spell has been cast on you by Runelite. It will expire in 5 minutes."; - private static final String HALF_TELEBLOCK_MESSAGE = "A Tele Block spell has been cast on you by Runelite. It will expire in 2 minutes, 30 seconds."; - - @Inject - private TimersPlugin timersPlugin; - - @Mock - @Bind - private TimersConfig timersConfig; - - @Mock - @Bind - private Client client; - - @Mock - @Bind - private ItemManager itemManager; - - @Mock - @Bind - private SpriteManager spriteManager; - - @Mock - @Bind - private InfoBoxManager infoBoxManager; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - @Test - public void testHalfTeleblock() - { - timersPlugin.setShowTeleblock(true); - when(client.getWorldType()).thenReturn(EnumSet.of(WorldType.MEMBERS)); - ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", HALF_TELEBLOCK_MESSAGE, "", 0); - timersPlugin.onChatMessage(chatMessage); - - ArgumentCaptor captor = ArgumentCaptor.forClass(InfoBox.class); - verify(infoBoxManager).addInfoBox(captor.capture()); - TimerTimer infoBox = (TimerTimer) captor.getValue(); - assertEquals(GameTimer.HALFTB, infoBox.getTimer()); - } - - @Test - public void testFullTeleblock() - { - timersPlugin.setShowTeleblock(true); - ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", FULL_TELEBLOCK_MESSAGE, "", 0); - timersPlugin.onChatMessage(chatMessage); - - ArgumentCaptor captor = ArgumentCaptor.forClass(InfoBox.class); - verify(infoBoxManager).addInfoBox(captor.capture()); - TimerTimer infoBox = (TimerTimer) captor.getValue(); - assertEquals(GameTimer.FULLTB, infoBox.getTimer()); - } - - @Test - public void testDmmHalfTb() - { - timersPlugin.setShowTeleblock(true); - ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", DMM_HALF_TELEBLOCK_MESSAGE, "", 0); - timersPlugin.onChatMessage(chatMessage); - - ArgumentCaptor captor = ArgumentCaptor.forClass(InfoBox.class); - verify(infoBoxManager).addInfoBox(captor.capture()); - TimerTimer infoBox = (TimerTimer) captor.getValue(); - assertEquals(GameTimer.DMM_HALFTB, infoBox.getTimer()); - } - - @Test - public void testDmmFullTb() - { - timersPlugin.setShowTeleblock(true); - when(client.getWorldType()).thenReturn(EnumSet.of(WorldType.DEADMAN)); - ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", HALF_TELEBLOCK_MESSAGE, "", 0); - timersPlugin.onChatMessage(chatMessage); - - ArgumentCaptor captor = ArgumentCaptor.forClass(InfoBox.class); - verify(infoBoxManager).addInfoBox(captor.capture()); - TimerTimer infoBox = (TimerTimer) captor.getValue(); - assertEquals(GameTimer.DMM_FULLTB, infoBox.getTimer()); - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/timestamp/TimestampPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/timestamp/TimestampPluginTest.java deleted file mode 100644 index e278553476..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/timestamp/TimestampPluginTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2019, Trevor - * 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.timestamp; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import java.util.TimeZone; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.client.config.OpenOSRSConfig; -import net.runelite.client.events.ConfigChanged; -import static org.junit.Assert.assertEquals; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import static org.mockito.Mockito.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class TimestampPluginTest -{ - @Mock - @Bind - Client client; - - @Mock - @Bind - TimestampConfig config; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Inject - TimestampPlugin plugin; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - @Test - public void testGenerateTimestamp() - { - when(config.timestampFormat()).thenReturn("[yyyy:MM:dd:HH:hh:mm:ss]"); - - ConfigChanged configChanged = new ConfigChanged(); - configChanged.setGroup("timestamp"); - configChanged.setKey("format"); - configChanged.setNewValue("true"); - plugin.onConfigChanged(configChanged); - - int testInput = 1554667116; - String testOutput = "[2019:04:07:15:03:58:36]"; - TimeZone timeZone = TimeZone.getTimeZone("America/New_York"); - plugin.getFormatter().setTimeZone(timeZone); - assertEquals(plugin.generateTimestamp(testInput, timeZone.toZoneId()), testOutput); - } -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/timetracking/clocks/ClockPanelTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/timetracking/clocks/ClockPanelTest.java deleted file mode 100644 index fb75827ebe..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/timetracking/clocks/ClockPanelTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2018, Jamy C - * 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.timetracking.clocks; - -import java.time.format.DateTimeParseException; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; -import org.junit.Test; - -public class ClockPanelTest -{ - @Test - public void properColonSeparatedTimeStringShouldReturnCorrectSeconds() - { - assertEquals(5, ClockPanel.stringToSeconds("5")); - assertEquals(50, ClockPanel.stringToSeconds("50")); - assertEquals(120, ClockPanel.stringToSeconds("2:00")); - assertEquals(120, ClockPanel.stringToSeconds("0:120")); - assertEquals(120, ClockPanel.stringToSeconds("0:0:120")); - assertEquals(1200, ClockPanel.stringToSeconds("20:00")); - - assertEquals(50, ClockPanel.stringToSeconds("00:00:50")); - assertEquals(121, ClockPanel.stringToSeconds("00:02:01")); - assertEquals(3660, ClockPanel.stringToSeconds("01:01:00")); - assertEquals(9000, ClockPanel.stringToSeconds("2:30:00")); - assertEquals(9033, ClockPanel.stringToSeconds("02:30:33")); - assertEquals(82800, ClockPanel.stringToSeconds("23:00:00")); - assertEquals(400271, ClockPanel.stringToSeconds("111:11:11")); - } - - @Test - public void properIntuitiveTimeStringShouldReturnCorrectSeconds() - { - assertEquals(5, ClockPanel.stringToSeconds("5s")); - assertEquals(50, ClockPanel.stringToSeconds("50s")); - assertEquals(120, ClockPanel.stringToSeconds("2m")); - assertEquals(120, ClockPanel.stringToSeconds("120s")); - assertEquals(1200, ClockPanel.stringToSeconds("20m")); - - assertEquals(121, ClockPanel.stringToSeconds("2m1s")); - assertEquals(121, ClockPanel.stringToSeconds("2m 1s")); - assertEquals(3660, ClockPanel.stringToSeconds("1h 1m")); - assertEquals(3660, ClockPanel.stringToSeconds("61m")); - assertEquals(3660, ClockPanel.stringToSeconds("3660s")); - assertEquals(9000, ClockPanel.stringToSeconds("2h 30m")); - assertEquals(9033, ClockPanel.stringToSeconds("2h 30m 33s")); - assertEquals(82800, ClockPanel.stringToSeconds("23h")); - assertEquals(400271, ClockPanel.stringToSeconds("111h 11m 11s")); - } - - @Test - public void incorrectTimeStringShouldThrowException() - { - Class numberEx = NumberFormatException.class; - Class dateTimeEx = DateTimeParseException.class; - - tryFail("a", numberEx); - tryFail("abc", numberEx); - tryFail("aa:bb:cc", numberEx); - tryFail("01:12=", numberEx); - - tryFail("s", dateTimeEx); - tryFail("1s 1m", dateTimeEx); - tryFail("20m:10s", dateTimeEx); - tryFail("20hh10m10s", dateTimeEx); - } - - private void tryFail(String input, Class expectedException) - { - try - { - ClockPanel.stringToSeconds(input); - fail("Should have thrown " + expectedException.getSimpleName()); - } - catch (Exception exception) - { - assertEquals(expectedException, exception.getClass()); - } - } -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/timetracking/farming/FarmingWorldTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/timetracking/farming/FarmingWorldTest.java deleted file mode 100644 index 78bf100c05..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/timetracking/farming/FarmingWorldTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.timetracking.farming; - -import org.junit.Test; - -public class FarmingWorldTest -{ - @Test - public void testInit() - { - new FarmingWorld(); - } -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/timetracking/farming/PatchImplementationTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/timetracking/farming/PatchImplementationTest.java deleted file mode 100644 index 51110b0c2f..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/timetracking/farming/PatchImplementationTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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.timetracking.farming; - -import java.util.HashMap; -import java.util.Map; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.Matchers.greaterThanOrEqualTo; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.lessThan; -import static org.hamcrest.Matchers.notNullValue; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ErrorCollector; - -public class PatchImplementationTest -{ - @Rule - public ErrorCollector collector = new ErrorCollector(); - - @Test - public void testRange() - { - for (PatchImplementation impl : PatchImplementation.values()) - { - Map harvestStages = new HashMap<>(); - for (int i = 0; i < 256; i++) - { - PatchState s = impl.forVarbitValue(i); - if (s != null) - { - String pfx = impl.name() + "[" + i + "]"; - collector.checkThat(pfx + ": cropState", s.getCropState(), notNullValue()); - collector.checkThat(pfx + ": produce", s.getProduce(), notNullValue()); - collector.checkThat(pfx + ": negative stage", s.getStage(), greaterThanOrEqualTo(0)); - int stages = s.getProduce().getStages(); - if (s.getCropState() == CropState.HARVESTABLE) - { - stages = s.getProduce().getHarvestStages(); - } - collector.checkThat(pfx + ": out of bounds stage", s.getStage(), lessThan(stages)); - if (s.getCropState() == CropState.DEAD || s.getCropState() == CropState.DISEASED) - { - collector.checkThat(pfx + ": dead seed", s.getStage(), greaterThan(0)); - } - if (s.getCropState() == CropState.GROWING && s.getProduce() != Produce.WEEDS && s.getStage() < stages) - { - harvestStages.computeIfAbsent(s.getProduce(), k -> new boolean[s.getProduce().getStages()])[s.getStage()] = true; - } - } - } - - for (Map.Entry produce : harvestStages.entrySet()) - { - boolean[] states = produce.getValue(); - // Alot of time the final stage is not hit, because some plants do not have a "Check-health" stage - for (int i = 0; i < states.length - 1; i++) - { - collector.checkThat(produce.getKey().getName() + " stage " + i + " never found by varbit", states[i], is(true)); - } - } - } - } -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/twitch/irc/MessageTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/twitch/irc/MessageTest.java deleted file mode 100644 index 7ef1b4d839..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/twitch/irc/MessageTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018, 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.twitch.irc; - -import java.util.Map; -import static org.junit.Assert.assertEquals; -import org.junit.Test; - -public class MessageTest -{ - @Test - public void testParse() - { - Message message = Message.parse("@badges=subscriber/0;color=;display-name=kappa_kid_;emotes=;id=6539b42a-e945-4a83-a5b7-018149ca9fa7;mod=0;room-id=27107346;subscriber=1;tmi-sent-ts=1535926830652;turbo=0;user-id=33390095;user-type= :kappa_kid_!kappa_kid_@kappa_kid_.tmi.twitch.tv PRIVMSG #b0aty :how do u add charges to that zeah book?"); - Map messageTags = message.getTags(); - assertEquals("subscriber/0", messageTags.get("badges")); - assertEquals("kappa_kid_!kappa_kid_@kappa_kid_.tmi.twitch.tv", message.getSource()); - assertEquals("PRIVMSG", message.getCommand()); - assertEquals("#b0aty", message.getArguments()[0]); - assertEquals("how do u add charges to that zeah book?", message.getArguments()[1]); - - message = Message.parse("@badges=moderator/1,subscriber/12,bits/10000;color=#008000;display-name=Am_Sephiroth;emotes=;id=7d516b7c-de7a-4c8b-ad23-d8880b55d46b;login=am_sephiroth;mod=1;msg-id=subgift;msg-param-months=8;msg-param-recipient-display-name=IntRS;msg-param-recipient-id=189672346;msg-param-recipient-user-name=intrs;msg-param-sender-count=215;msg-param-sub-plan-name=Sick\\sNerd\\sSubscription\\s;msg-param-sub-plan=1000;room-id=49408183;subscriber=1;system-msg=Am_Sephiroth\\sgifted\\sa\\sTier\\s1\\ssub\\sto\\sIntRS!\\sThey\\shave\\sgiven\\s215\\sGift\\sSubs\\sin\\sthe\\schannel!;tmi-sent-ts=1535980032939;turbo=0;user-id=69539403;user-type=mod :tmi.twitch.tv USERNOTICE #sick_nerd"); - messageTags = message.getTags(); - assertEquals("Am_Sephiroth gifted a Tier 1 sub to IntRS! They have given 215 Gift Subs in the channel!", messageTags.get("system-msg")); - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/wintertodt/WintertodtPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/wintertodt/WintertodtPluginTest.java deleted file mode 100644 index 68e9308aa2..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/wintertodt/WintertodtPluginTest.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2019, Kusha Gharahi - * 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.wintertodt; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.Varbits; -import net.runelite.api.events.VarbitChanged; -import net.runelite.client.Notifier; -import net.runelite.client.chat.ChatMessageManager; -import net.runelite.client.config.OpenOSRSConfig; -import net.runelite.client.ui.overlay.OverlayManager; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class WintertodtPluginTest -{ - @Inject - WintertodtPlugin wintertodtPlugin; - - @Mock - @Bind - WintertodtConfig config; - - @Mock - @Bind - WintertodtOverlay wintertodtOverlay; - - @Mock - @Bind - OverlayManager overlayManager; - - @Mock - @Bind - ChatMessageManager chatMessageManager; - - @Mock - @Bind - Notifier notifier; - - @Mock - @Bind - Client client; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - @Test - public void matchStartingNotification_shouldNotify_when15SecondsOptionSelected() - { - when(config.roundNotification()).thenReturn(15); - - when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(35); - wintertodtPlugin.onVarbitChanged(new VarbitChanged()); - //(15 * 50) / 30 = ~25 - when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(25); - wintertodtPlugin.onVarbitChanged(new VarbitChanged()); - - verify(notifier, times(1)).notify("Wintertodt round is about to start"); - } - - @Test - public void matchStartingNotification_shouldNotify_when10SecondsOptionSelected() - { - when(config.roundNotification()).thenReturn(10); - - when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(20); - wintertodtPlugin.onVarbitChanged(new VarbitChanged()); - //(10 * 50) / 30 = ~16 - when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(16); - wintertodtPlugin.onVarbitChanged(new VarbitChanged()); - - verify(notifier, times(1)).notify("Wintertodt round is about to start"); - } - - @Test - public void matchStartingNotification_shouldNotify_when5SecondsOptionSelected() - { - when(config.roundNotification()).thenReturn(5); - - when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(10); - wintertodtPlugin.onVarbitChanged(new VarbitChanged()); - //(5 * 50) / 30 = ~8 - when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(8); - wintertodtPlugin.onVarbitChanged(new VarbitChanged()); - - verify(notifier, times(1)).notify("Wintertodt round is about to start"); - } - - @Test - public void matchStartingNotification_shouldNotifyOnce() - { - when(config.roundNotification()).thenReturn(5); - - when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(0); - wintertodtPlugin.onVarbitChanged(new VarbitChanged()); - when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(10); - wintertodtPlugin.onVarbitChanged(new VarbitChanged()); - when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(8); - wintertodtPlugin.onVarbitChanged(new VarbitChanged()); - when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(6); - wintertodtPlugin.onVarbitChanged(new VarbitChanged()); - when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(5); - wintertodtPlugin.onVarbitChanged(new VarbitChanged()); - when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(4); - wintertodtPlugin.onVarbitChanged(new VarbitChanged()); - - verify(notifier, times(1)).notify("Wintertodt round is about to start"); - } - - @Test - public void matchStartingNotification_shouldNotNotify_whenNoneOptionSelected() - { - when(config.roundNotification()).thenReturn(5); - when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(25); - - wintertodtPlugin.onVarbitChanged(new VarbitChanged()); - verify(notifier, times(0)).notify("Wintertodt round is about to start"); - } -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/woodcutting/WoodcuttingPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/woodcutting/WoodcuttingPluginTest.java deleted file mode 100644 index ad4b7fda79..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/woodcutting/WoodcuttingPluginTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2019, Jordan Zomerlei - * 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.woodcutting; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import java.util.concurrent.ScheduledExecutorService; -import javax.inject.Inject; -import net.runelite.api.ChatMessageType; -import net.runelite.api.Client; -import net.runelite.api.events.ChatMessage; -import net.runelite.client.Notifier; -import net.runelite.client.config.OpenOSRSConfig; -import net.runelite.client.game.ItemManager; -import net.runelite.client.ui.overlay.OverlayManager; -import static org.junit.Assert.assertNotNull; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class WoodcuttingPluginTest -{ - private static final String BIRDS_NEST_MESSAGE = "A bird's nest falls out of the tree."; - - @Inject - WoodcuttingPlugin woodcuttingPlugin; - - @Mock - @Bind - WoodcuttingConfig woodcuttingConfig; - - @Mock - @Bind - OpenOSRSConfig openOSRSConfig; - - @Mock - @Bind - ScheduledExecutorService scheduledExecutorService; - - @Mock - @Bind - Notifier notifier; - - @Mock - @Bind - Client client; - - @Mock - @Bind - WoodcuttingOverlay woodcuttingOverlay; - - @Mock - @Bind - WoodcuttingTreesOverlay woodcuttingTreesOverlay; - - @Mock - @Bind - OverlayManager overlayManager; - - @Mock - @Bind - private ItemManager itemManager; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - @Test - public void testLogs() - { - ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", "You get some logs.", "", 0); - woodcuttingPlugin.onChatMessage(chatMessage); - assertNotNull(woodcuttingPlugin.getSession()); - } - - @Test - public void testOakLogs() - { - ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", "You get some oak logs.", "", 0); - woodcuttingPlugin.onChatMessage(chatMessage); - assertNotNull(woodcuttingPlugin.getSession()); - } - - @Test - public void testArcticLogs() - { - ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", "You get an arctic log.", "", 0); - woodcuttingPlugin.onChatMessage(chatMessage); - assertNotNull(woodcuttingPlugin.getSession()); - } - - @Test - public void testMushrooms() - { - ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", "You get some mushrooms.", "", 0); - woodcuttingPlugin.onChatMessage(chatMessage); - assertNotNull(woodcuttingPlugin.getSession()); - } - - @Test - public void testBirdsNest() - { - ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BIRDS_NEST_MESSAGE, "", 0); - - when(woodcuttingConfig.showNestNotification()).thenReturn(true); - woodcuttingPlugin.onChatMessage(chatMessage); - verify(notifier).notify("A bird nest has spawned!"); - - when(woodcuttingConfig.showNestNotification()).thenReturn(false); - woodcuttingPlugin.onChatMessage(chatMessage); - verifyNoMoreInteractions(notifier); - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/worldmap/TeleportLocationDataTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/worldmap/TeleportLocationDataTest.java deleted file mode 100644 index 2c52d0ae4f..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/worldmap/TeleportLocationDataTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2018, 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 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.client.plugins.worldmap; - -import static org.junit.Assert.assertNotNull; -import org.junit.Test; - -public class TeleportLocationDataTest -{ - @Test - public void testResources() - { - for (TeleportLocationData data : TeleportLocationData.values()) - { - String path = data.getIconPath(); - assertNotNull(path); - assertNotNull(path, getClass().getResourceAsStream(path)); - } - } -} \ No newline at end of file diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/xptracker/XpTrackerPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/xptracker/XpTrackerPluginTest.java deleted file mode 100644 index 9a3267f6f6..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/xptracker/XpTrackerPluginTest.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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.xptracker; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.Player; -import net.runelite.api.Skill; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.StatChanged; -import net.runelite.client.config.OpenOSRSConfig; -import net.runelite.client.game.NPCManager; -import net.runelite.client.game.SkillIconManager; -import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.overlay.OverlayManager; -import static org.junit.Assert.assertEquals; -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.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class XpTrackerPluginTest -{ - @Inject - private XpTrackerPlugin xpTrackerPlugin; - - @Mock - @Bind - private ClientToolbar clientToolbar; - - @Mock - @Bind - private Client client; - - @Mock - @Bind - private SkillIconManager skillIconManager; - - @Mock - @Bind - private XpTrackerConfig xpTrackerConfig; - - @Mock - @Bind - private NPCManager npcManager; - - @Mock - @Bind - private OverlayManager overlayManager; - - @Mock - @Bind - private OpenOSRSConfig openOSRSConfig; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - - when(client.getLocalPlayer()).thenReturn(mock(Player.class)); - - xpTrackerPlugin.setXpPanel(mock(XpPanel.class)); - } - - @Test - public void testOfflineXp() - { - GameStateChanged gameStateChanged = new GameStateChanged(); - gameStateChanged.setGameState(GameState.LOGGING_IN); - - // Flag initialization of tracker - xpTrackerPlugin.onGameStateChanged(gameStateChanged); - when(client.getSkillExperience(Skill.ATTACK)).thenReturn(42); - // Initialize tracker - xpTrackerPlugin.onGameTick(GameTick.INSTANCE); - - // Gain attack xp - StatChanged statChanged = new StatChanged( - Skill.ATTACK, - 100, - 2, - 2 - ); - xpTrackerPlugin.onStatChanged(statChanged); - - // Offline gain - when(client.getSkillExperience(Skill.ATTACK)).thenReturn(42000); - // Flag initialization of tracker - xpTrackerPlugin.onGameStateChanged(gameStateChanged); - // Initialize tracker - xpTrackerPlugin.onGameTick(GameTick.INSTANCE); - - // Start at 42 xp, gain of 58 xp, offline gain of 41900 xp - offset start XP: 42 + 41900 - XpStateSingle skillState = xpTrackerPlugin.getSkillState(Skill.ATTACK); - assertEquals(41942, skillState.getStartXp()); - } -} \ No newline at end of file